From 70b2c3a5531aa73fd8473744d192eba118829b85 Mon Sep 17 00:00:00 2001 From: KINDNICK <68893236+KINDNICK@users.noreply.github.com> Date: Sat, 10 May 2025 23:14:50 +0900 Subject: [PATCH] =?UTF-8?q?ADD=20:=20=EB=A6=AC=EC=86=8C=EC=8A=A4=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...aterials.meta => AmplifyShaderEditor.meta} | 4 +- .../AmplifyShaderEditor.asmdef} | 12 +- .../AmplifyShaderEditor.asmdef.meta | 14 + .../AmplifyShaderEditor/ChangeLog.txt | 3 + .../AmplifyShaderEditor/ChangeLog.txt.meta | 15 + .../Examples.meta} | 4 +- .../Examples/Built-In Samples.unitypackage | 3 + .../Built-In Samples.unitypackage.meta | 15 + .../AmplifyShaderEditor/Examples/Credits.txt | 3 + .../Examples/Credits.txt.meta | 15 + .../Examples/HDRP Samples 10x.unitypackage | 3 + .../HDRP Samples 10x.unitypackage.meta | 14 + .../Examples/HDRP Samples 12x.unitypackage | 3 + .../HDRP Samples 12x.unitypackage.meta | 14 + .../Examples/HDRP Samples 14x.unitypackage | 3 + .../HDRP Samples 14x.unitypackage.meta | 14 + .../Examples/HDRP Samples 15x.unitypackage | 3 + .../HDRP Samples 15x.unitypackage.meta | 14 + .../Examples/HDRP Samples 16x.unitypackage | 3 + .../HDRP Samples 16x.unitypackage.meta | 14 + .../Examples/HDRP Samples 17x.unitypackage | 3 + .../HDRP Samples 17x.unitypackage.meta | 14 + .../Examples/HDRP Samples.unitypackage | 3 + .../Examples/HDRP Samples.unitypackage.meta | 15 + .../Examples/README Samples.txt | 3 + .../Examples/README Samples.txt.meta | 15 + .../Examples/Sample Resources.unitypackage | 3 + .../Sample Resources.unitypackage.meta | 15 + .../Examples/URP Samples 10x.unitypackage | 3 + .../URP Samples 10x.unitypackage.meta | 14 + .../Examples/URP Samples 12x.unitypackage | 3 + .../URP Samples 12x.unitypackage.meta | 14 + .../Examples/URP Samples 14x.unitypackage | 3 + .../URP Samples 14x.unitypackage.meta | 14 + .../Examples/URP Samples 15x.unitypackage | 3 + .../URP Samples 15x.unitypackage.meta | 14 + .../Examples/URP Samples 16x.unitypackage | 3 + .../URP Samples 16x.unitypackage.meta | 14 + .../Examples/URP Samples 17x.unitypackage | 3 + .../URP Samples 17x.unitypackage.meta | 14 + .../Examples/URP Samples.unitypackage | 3 + .../Examples/URP Samples.unitypackage.meta | 15 + .../Plugins.meta} | 4 +- .../AmplifyShaderEditor/Plugins/Editor.meta | 9 + .../Plugins/Editor/Actions.meta | 9 + .../Plugins/Editor/Actions/ActionData.cs | 336 + .../Plugins/Editor/Actions/ActionData.cs.meta | 19 + .../Plugins/Editor/Actions/ActionLog.cs | 58 + .../Plugins/Editor/Actions/ActionLog.cs.meta | 19 + .../Plugins/Editor/Actions/ActionSequence.cs | 39 + .../Editor/Actions/ActionSequence.cs.meta | 19 + .../Plugins/Editor/Constants.cs | 674 ++ .../Plugins/Editor/Constants.cs.meta | 19 + .../Plugins/Editor/CustomDrawers.meta | 9 + .../Editor/CustomDrawers/ASEEndDecorator.cs | 39 + .../CustomDrawers/ASEEndDecorator.cs.meta | 18 + .../Editor/CustomDrawers/EditableIf.cs | 296 + .../Editor/CustomDrawers/EditableIf.cs.meta | 19 + .../Editor/CustomDrawers/NoKeywordToggle.cs | 29 + .../CustomDrawers/NoKeywordToggle.cs.meta | 19 + .../Editor/CustomDrawers/RemapSliders.cs | 39 + .../Editor/CustomDrawers/RemapSliders.cs.meta | 18 + .../Editor/CustomDrawers/RemapSlidersFull.cs | 39 + .../CustomDrawers/RemapSlidersFull.cs.meta | 18 + .../Editor/CustomDrawers/SingleLineTexture.cs | 26 + .../CustomDrawers/SingleLineTexture.cs.meta | 18 + .../Plugins/Editor/DoCreateFunction.cs | 17 + .../Plugins/Editor/DoCreateFunction.cs.meta | 19 + .../Plugins/Editor/DoCreateShader.cs | 48 + .../Plugins/Editor/DoCreateShader.cs.meta | 19 + .../Plugins/Editor/EditorOptions.cs | 67 + .../Plugins/Editor/EditorOptions.cs.meta | 19 + .../Plugins/Editor/Graphs.meta | 9 + .../Plugins/Editor/Graphs/NodeGrid.cs | 283 + .../Plugins/Editor/Graphs/NodeGrid.cs.meta | 19 + .../Plugins/Editor/Graphs/ParentGraph.cs | 4067 +++++++++++ .../Plugins/Editor/Graphs/ParentGraph.cs.meta | 19 + .../Plugins/Editor/Menu.meta | 9 + .../Editor/Menu/AmplifyShaderEditorWindow.cs | 6107 +++++++++++++++++ .../Menu/AmplifyShaderEditorWindow.cs.meta | 19 + .../Editor/Menu/AmplifyShaderFunction.cs | 221 + .../Editor/Menu/AmplifyShaderFunction.cs.meta | 19 + .../Menu/AmplifyShaderFunctionEditor.cs | 164 + .../Menu/AmplifyShaderFunctionEditor.cs.meta | 19 + .../Plugins/Editor/Menu/AutoPanData.cs | 94 + .../Plugins/Editor/Menu/AutoPanData.cs.meta | 19 + .../Plugins/Editor/Menu/Clipboard.cs | 262 + .../Plugins/Editor/Menu/Clipboard.cs.meta | 19 + .../Plugins/Editor/Menu/ConfirmationWindow.cs | 120 + .../Editor/Menu/ConfirmationWindow.cs.meta | 19 + .../Plugins/Editor/Menu/ConsoleLogWindow.cs | 309 + .../Editor/Menu/ConsoleLogWindow.cs.meta | 19 + .../Plugins/Editor/Menu/ContextMenuItem.cs | 81 + .../Editor/Menu/ContextMenuItem.cs.meta | 19 + .../Editor/Menu/CustomStylesContainer.cs | 53 + .../Editor/Menu/CustomStylesContainer.cs.meta | 19 + .../Plugins/Editor/Menu/DebugConsoleWindow.cs | 213 + .../Editor/Menu/DebugConsoleWindow.cs.meta | 19 + .../Plugins/Editor/Menu/DragAndDropTool.cs | 47 + .../Editor/Menu/DragAndDropTool.cs.meta | 19 + .../Editor/Menu/DuplicatePreventionBuffer.cs | 375 + .../Menu/DuplicatePreventionBuffer.cs.meta | 19 + .../Plugins/Editor/Menu/GraphContextMenu.cs | 396 ++ .../Editor/Menu/GraphContextMenu.cs.meta | 19 + .../Plugins/Editor/Menu/MenuParent.cs | 448 ++ .../Plugins/Editor/Menu/MenuParent.cs.meta | 19 + .../Editor/Menu/NodeParametersWindow.cs | 569 ++ .../Editor/Menu/NodeParametersWindow.cs.meta | 19 + .../Editor/Menu/NodeWireReferencesUtils.cs | 56 + .../Menu/NodeWireReferencesUtils.cs.meta | 19 + .../Plugins/Editor/Menu/Palette.meta | 9 + .../Editor/Menu/Palette/ContextPalette.cs | 101 + .../Menu/Palette/ContextPalette.cs.meta | 19 + .../Editor/Menu/Palette/PaletteParent.cs | 573 ++ .../Editor/Menu/Palette/PaletteParent.cs.meta | 19 + .../Editor/Menu/Palette/PalettePopUp.cs | 73 + .../Editor/Menu/Palette/PalettePopUp.cs.meta | 19 + .../Editor/Menu/Palette/PaletteWindow.cs | 33 + .../Editor/Menu/Palette/PaletteWindow.cs.meta | 19 + .../Plugins/Editor/Menu/PortLegendInfo.cs | 469 ++ .../Editor/Menu/PortLegendInfo.cs.meta | 19 + .../Plugins/Editor/Menu/SceneSaveCallback.cs | 40 + .../Editor/Menu/SceneSaveCallback.cs.meta | 19 + .../Editor/Menu/ShaderEditorModeWindow.cs | 192 + .../Menu/ShaderEditorModeWindow.cs.meta | 19 + .../Plugins/Editor/Menu/ShaderLibrary.cs | 91 + .../Plugins/Editor/Menu/ShaderLibrary.cs.meta | 19 + .../Plugins/Editor/Menu/Tools.meta | 9 + .../Editor/Menu/Tools/ToolsMenuButton.cs | 249 + .../Editor/Menu/Tools/ToolsMenuButton.cs.meta | 19 + .../Menu/Tools/ToolsMenuButtonParent.cs | 75 + .../Menu/Tools/ToolsMenuButtonParent.cs.meta | 19 + .../Editor/Menu/Tools/ToolsMenuButtonSep.cs | 41 + .../Menu/Tools/ToolsMenuButtonSep.cs.meta | 19 + .../Plugins/Editor/Menu/Tools/ToolsWindow.cs | 632 ++ .../Editor/Menu/Tools/ToolsWindow.cs.meta | 19 + .../Plugins/Editor/Native.meta | 9 + .../Plugins/Editor/Native/FallbackColor.cs | 55 + .../Editor/Native/FallbackColor.cs.meta | 19 + .../Plugins/Editor/Native/FallbackFloat.cs | 56 + .../Editor/Native/FallbackFloat.cs.meta | 19 + .../Plugins/Editor/Native/FallbackInt.cs | 56 + .../Plugins/Editor/Native/FallbackInt.cs.meta | 19 + .../Editor/Native/FallbackMatrix4x4.cs | 55 + .../Editor/Native/FallbackMatrix4x4.cs.meta | 19 + .../Plugins/Editor/Native/FallbackString.cs | 56 + .../Editor/Native/FallbackString.cs.meta | 19 + .../Plugins/Editor/Native/FallbackTexture.cs | 55 + .../Editor/Native/FallbackTexture.cs.meta | 19 + .../Plugins/Editor/Native/FallbackVariable.cs | 36 + .../Editor/Native/FallbackVariable.cs.meta | 19 + .../Plugins/Editor/Native/FallbackVector2.cs | 56 + .../Editor/Native/FallbackVector2.cs.meta | 19 + .../Plugins/Editor/Native/FallbackVector3.cs | 56 + .../Editor/Native/FallbackVector3.cs.meta | 19 + .../Plugins/Editor/Native/FallbackVector4.cs | 48 + .../Editor/Native/FallbackVector4.cs.meta | 19 + .../Plugins/Editor/Native/IFallbackVars.cs | 10 + .../Editor/Native/IFallbackVars.cs.meta | 19 + .../Plugins/Editor/Nodes.meta | 9 + .../Plugins/Editor/Nodes/CommentaryNode.cs | 692 ++ .../Editor/Nodes/CommentaryNode.cs.meta | 19 + .../Plugins/Editor/Nodes/Constants.meta | 9 + .../Editor/Nodes/Constants/ColorNode.cs | 551 ++ .../Editor/Nodes/Constants/ColorNode.cs.meta | 19 + .../Editor/Nodes/Constants/GlobalArrayNode.cs | 489 ++ .../Nodes/Constants/GlobalArrayNode.cs.meta | 19 + .../Editor/Nodes/Constants/GradientNode.cs | 206 + .../Nodes/Constants/GradientNode.cs.meta | 19 + .../Plugins/Editor/Nodes/Constants/IntNode.cs | 300 + .../Editor/Nodes/Constants/IntNode.cs.meta | 19 + .../Editor/Nodes/Constants/Matrix3X3Node.cs | 262 + .../Nodes/Constants/Matrix3X3Node.cs.meta | 19 + .../Editor/Nodes/Constants/Matrix4X4Node.cs | 249 + .../Nodes/Constants/Matrix4X4Node.cs.meta | 19 + .../Nodes/Constants/MatrixParentNode.cs | 129 + .../Nodes/Constants/MatrixParentNode.cs.meta | 19 + .../Plugins/Editor/Nodes/Constants/PiNode.cs | 63 + .../Editor/Nodes/Constants/PiNode.cs.meta | 19 + .../Editor/Nodes/Constants/PropertyNode.cs | 1927 ++++++ .../Nodes/Constants/PropertyNode.cs.meta | 19 + .../Editor/Nodes/Constants/RangedFloatNode.cs | 534 ++ .../Nodes/Constants/RangedFloatNode.cs.meta | 19 + .../Nodes/Constants/ShaderVariables.meta | 9 + .../ShaderVariables/CameraAndScreen.meta | 9 + .../CameraAndScreen/CameraProjectionNode.cs | 100 + .../CameraProjectionNode.cs.meta | 19 + .../CameraAndScreen/CameraWorldClipPlanes.cs | 130 + .../CameraWorldClipPlanes.cs.meta | 19 + .../CameraAndScreen/OrthoParams.cs | 38 + .../CameraAndScreen/OrthoParams.cs.meta | 19 + .../CameraAndScreen/ProjectionParams.cs | 32 + .../CameraAndScreen/ProjectionParams.cs.meta | 19 + .../CameraAndScreen/ScreenParams.cs | 32 + .../CameraAndScreen/ScreenParams.cs.meta | 19 + .../CameraAndScreen/WorldSpaceCameraPos.cs | 28 + .../WorldSpaceCameraPos.cs.meta | 19 + .../CameraAndScreen/ZBufferParams.cs | 31 + .../CameraAndScreen/ZBufferParams.cs.meta | 19 + .../ShaderVariables/ConstVecShaderVariable.cs | 39 + .../ConstVecShaderVariable.cs.meta | 19 + .../ShaderVariables/ConstantShaderVariable.cs | 35 + .../ConstantShaderVariable.cs.meta | 19 + .../ShaderVariables/FogAndAmbient.meta | 9 + .../FogAndAmbient/FogAndAmbientColorsNode.cs | 126 + .../FogAndAmbientColorsNode.cs.meta | 19 + .../FogAndAmbient/FogParamsNode.cs | 32 + .../FogAndAmbient/FogParamsNode.cs.meta | 19 + .../Constants/ShaderVariables/Lighting.meta | 9 + .../Lighting/CustomStandardSurface.cs | 208 + .../Lighting/CustomStandardSurface.cs.meta | 19 + .../Lighting/IndirectDiffuseLighting.cs | 484 ++ .../Lighting/IndirectDiffuseLighting.cs.meta | 19 + .../Lighting/IndirectSpecularLight.cs | 310 + .../Lighting/IndirectSpecularLight.cs.meta | 19 + .../Lighting/LightAttenuation.cs | 210 + .../Lighting/LightAttenuation.cs.meta | 19 + .../Lighting/LightColorNode.cs | 99 + .../Lighting/LightColorNode.cs.meta | 19 + .../Lighting/WorldSpaceLightPos.cs | 93 + .../Lighting/WorldSpaceLightPos.cs.meta | 19 + .../ShaderVariables/ShaderVariablesNode.cs | 27 + .../ShaderVariablesNode.cs.meta | 19 + .../Nodes/Constants/ShaderVariables/Time.meta | 9 + .../Constants/ShaderVariables/Time/CosTime.cs | 51 + .../ShaderVariables/Time/CosTime.cs.meta | 19 + .../ShaderVariables/Time/DeltaTime.cs | 33 + .../ShaderVariables/Time/DeltaTime.cs.meta | 19 + .../ShaderVariables/Time/SimpleTimeNode.cs | 46 + .../Time/SimpleTimeNode.cs.meta | 19 + .../ShaderVariables/Time/SinTimeNode.cs | 55 + .../ShaderVariables/Time/SinTimeNode.cs.meta | 19 + .../ShaderVariables/Time/TimeNode.cs | 52 + .../ShaderVariables/Time/TimeNode.cs.meta | 19 + .../Constants/ShaderVariables/Transform.meta | 9 + .../Transform/CameraToWorldMatrix.cs | 24 + .../Transform/CameraToWorldMatrix.cs.meta | 19 + .../ShaderVariables/Transform/IMMatrixNode.cs | 25 + .../Transform/IMMatrixNode.cs.meta | 19 + .../Transform/InverseProjectionMatrixNode.cs | 24 + .../InverseProjectionMatrixNode.cs.meta | 18 + .../Transform/InverseTranspMVMatrixNode.cs | 18 + .../InverseTranspMVMatrixNode.cs.meta | 19 + .../Transform/InverseViewMatrixNode.cs | 19 + .../Transform/InverseViewMatrixNode.cs.meta | 19 + .../InverseViewProjectionMatrixNode.cs | 24 + .../InverseViewProjectionMatrixNode.cs.meta | 18 + .../ShaderVariables/Transform/MMatrixNode.cs | 18 + .../Transform/MMatrixNode.cs.meta | 19 + .../ShaderVariables/Transform/MVMatrixNode.cs | 18 + .../Transform/MVMatrixNode.cs.meta | 19 + .../Transform/MVPMatrixNode.cs | 18 + .../Transform/MVPMatrixNode.cs.meta | 19 + .../Transform/ObjectToWorldMatrixNode.cs | 19 + .../Transform/ObjectToWorldMatrixNode.cs.meta | 19 + .../Transform/ProjectionMatrixNode.cs | 19 + .../Transform/ProjectionMatrixNode.cs.meta | 19 + .../Transform/Texture0MatrixNode.cs | 18 + .../Transform/Texture0MatrixNode.cs.meta | 19 + .../Transform/Texture1MatrixNode.cs | 18 + .../Transform/Texture1MatrixNode.cs.meta | 19 + .../Transform/Texture2MatrixNode.cs | 18 + .../Transform/Texture2MatrixNode.cs.meta | 19 + .../Transform/Texture3MatrixNode.cs | 18 + .../Transform/Texture3MatrixNode.cs.meta | 19 + .../Transform/TransformDirectionNode.cs | 579 ++ .../Transform/TransformDirectionNode.cs.meta | 19 + .../Transform/TransformPositionNode.cs | 638 ++ .../Transform/TransformPositionNode.cs.meta | 19 + .../Transform/TransformVariables.cs | 193 + .../Transform/TransformVariables.cs.meta | 19 + .../Transform/TransposeMVMatrix.cs | 18 + .../Transform/TransposeMVMatrix.cs.meta | 19 + .../Transform/UnityProjectorClipMatrixNode.cs | 23 + .../UnityProjectorClipMatrixNode.cs.meta | 19 + .../Transform/UnityProjectorMatrixNode.cs | 23 + .../UnityProjectorMatrixNode.cs.meta | 19 + .../Transform/UnityScaleMatrix.cs | 18 + .../Transform/UnityScaleMatrix.cs.meta | 19 + .../Transform/ViewMatrixNode.cs | 19 + .../Transform/ViewMatrixNode.cs.meta | 19 + .../Transform/ViewProjectionMatrixNode.cs | 18 + .../ViewProjectionMatrixNode.cs.meta | 19 + .../Transform/WorldToCameraMatrix.cs | 23 + .../Transform/WorldToCameraMatrix.cs.meta | 19 + .../Transform/WorldToObjectMatrix.cs | 20 + .../Transform/WorldToObjectMatrix.cs.meta | 19 + .../Transform/WorldToTangentMatrix.cs | 47 + .../Transform/WorldToTangentMatrix.cs.meta | 19 + .../Constants/ShaderVariables/Various.meta | 9 + .../Various/ColorSpaceDouble.cs | 37 + .../Various/ColorSpaceDouble.cs.meta | 19 + .../Various/FaceVariableNode.cs | 64 + .../Various/FaceVariableNode.cs.meta | 19 + .../ShaderVariables/Various/InstanceIdNode.cs | 137 + .../Various/InstanceIdNode.cs.meta | 19 + .../ShaderVariables/Various/LODFadeNode.cs | 101 + .../Various/LODFadeNode.cs.meta | 19 + .../Various/PrimitiveIdVariableNode.cs | 36 + .../Various/PrimitiveIdVariableNode.cs.meta | 19 + .../Various/SwitchByFaceNode.cs | 88 + .../Various/SwitchByFaceNode.cs.meta | 19 + .../Various/SwitchBySRPVersionNode.cs | 127 + .../Various/SwitchBySRPVersionNode.cs.meta | 19 + .../Various/TwoSidedSignNode.cs | 66 + .../Various/TwoSidedSignNode.cs.meta | 19 + .../Various/VertexIdVariableNode.cs | 58 + .../Various/VertexIdVariableNode.cs.meta | 19 + .../Various/WorldTransformParams.cs | 32 + .../Various/WorldTransformParams.cs.meta | 19 + .../Editor/Nodes/Constants/StaticSwitch.cs | 1391 ++++ .../Nodes/Constants/StaticSwitch.cs.meta | 19 + .../Plugins/Editor/Nodes/Constants/TauNode.cs | 32 + .../Editor/Nodes/Constants/TauNode.cs.meta | 19 + .../Nodes/Constants/TextureArrayNode.cs | 990 +++ .../Nodes/Constants/TextureArrayNode.cs.meta | 19 + .../Editor/Nodes/Constants/Vector2Node.cs | 303 + .../Nodes/Constants/Vector2Node.cs.meta | 19 + .../Editor/Nodes/Constants/Vector3Node.cs | 318 + .../Nodes/Constants/Vector3Node.cs.meta | 19 + .../Editor/Nodes/Constants/Vector4Node.cs | 325 + .../Nodes/Constants/Vector4Node.cs.meta | 19 + .../Plugins/Editor/Nodes/CustomAddNode.cs | 19 + .../Editor/Nodes/CustomAddNode.cs.meta | 19 + .../Plugins/Editor/Nodes/CustomNode.cs | 183 + .../Plugins/Editor/Nodes/CustomNode.cs.meta | 19 + .../Plugins/Editor/Nodes/DrawInfo.cs | 19 + .../Plugins/Editor/Nodes/DrawInfo.cs.meta | 19 + .../Plugins/Editor/Nodes/DynamicTypeNode.cs | 521 ++ .../Editor/Nodes/DynamicTypeNode.cs.meta | 19 + .../Plugins/Editor/Nodes/HelperFuncs.meta | 9 + .../Nodes/HelperFuncs/CameraDepthFade.cs | 130 + .../Nodes/HelperFuncs/CameraDepthFade.cs.meta | 19 + .../ComputeGrabScreenPosHlpNode.cs | 54 + .../ComputeGrabScreenPosHlpNode.cs.meta | 19 + .../HelperFuncs/ComputeScreenPosHlpNode.cs | 76 + .../ComputeScreenPosHlpNode.cs.meta | 19 + .../HelperFuncs/DecodeDepthNormalNode.cs | 46 + .../HelperFuncs/DecodeDepthNormalNode.cs.meta | 19 + .../HelperFuncs/DecodeFloatRGBAHlpNode.cs | 27 + .../DecodeFloatRGBAHlpNode.cs.meta | 19 + .../Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs | 27 + .../HelperFuncs/DecodeFloatRGHlpNode.cs.meta | 19 + .../HelperFuncs/DecodeLightmapHlpNode.cs | 109 + .../HelperFuncs/DecodeLightmapHlpNode.cs.meta | 19 + .../DecodeViewNormalStereoHlpNode.cs | 27 + .../DecodeViewNormalStereoHlpNode.cs.meta | 19 + .../Editor/Nodes/HelperFuncs/DepthFade.cs | 173 + .../Nodes/HelperFuncs/DepthFade.cs.meta | 19 + .../DiffuseAndSpecularFromMetallicNode.cs | 67 + ...DiffuseAndSpecularFromMetallicNode.cs.meta | 19 + .../Editor/Nodes/HelperFuncs/DitheringNode.cs | 300 + .../Nodes/HelperFuncs/DitheringNode.cs.meta | 19 + .../HelperFuncs/EncodeDepthNormalNode.cs | 34 + .../HelperFuncs/EncodeDepthNormalNode.cs.meta | 19 + .../HelperFuncs/EncodeFloatRGBAHlpNode.cs | 27 + .../EncodeFloatRGBAHlpNode.cs.meta | 19 + .../Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs | 27 + .../HelperFuncs/EncodeFloatRGHlpNode.cs.meta | 19 + .../EncodeViewNormalStereoHlpNode.cs | 27 + .../EncodeViewNormalStereoHlpNode.cs.meta | 19 + .../Nodes/HelperFuncs/GammaToLinearNode.cs | 122 + .../HelperFuncs/GammaToLinearNode.cs.meta | 19 + .../Nodes/HelperFuncs/HelperParentNode.cs | 93 + .../HelperFuncs/HelperParentNode.cs.meta | 19 + .../Nodes/HelperFuncs/LinearToGammaNode.cs | 127 + .../HelperFuncs/LinearToGammaNode.cs.meta | 19 + .../Nodes/HelperFuncs/LuminanceHlpNode.cs | 26 + .../HelperFuncs/LuminanceHlpNode.cs.meta | 19 + .../HelperFuncs/ObjSpaceLightDirHlpNode.cs | 43 + .../ObjSpaceLightDirHlpNode.cs.meta | 19 + .../HelperFuncs/ObjSpaceViewDirHlpNode.cs | 50 + .../ObjSpaceViewDirHlpNode.cs.meta | 19 + .../Nodes/HelperFuncs/ParallaxMappingNode.cs | 148 + .../HelperFuncs/ParallaxMappingNode.cs.meta | 19 + .../ParallaxOcclusionMappingNode.cs | 650 ++ .../ParallaxOcclusionMappingNode.cs.meta | 19 + .../HelperFuncs/ParallaxOffsetHlpNode.cs | 47 + .../HelperFuncs/ParallaxOffsetHlpNode.cs.meta | 19 + .../HelperFuncs/ShadeVertexLightsHlpNode.cs | 105 + .../ShadeVertexLightsHlpNode.cs.meta | 19 + .../Nodes/HelperFuncs/SurfaceDepthNode.cs | 207 + .../HelperFuncs/SurfaceDepthNode.cs.meta | 19 + .../Editor/Nodes/HelperFuncs/TriplanarNode.cs | 1499 ++++ .../Nodes/HelperFuncs/TriplanarNode.cs.meta | 19 + .../HelperFuncs/UnityObjToClipPosHlpNode.cs | 34 + .../UnityObjToClipPosHlpNode.cs.meta | 19 + .../HelperFuncs/UnityObjToViewPosHlpNode.cs | 33 + .../UnityObjToViewPosHlpNode.cs.meta | 19 + .../HelperFuncs/WorldSpaceLightDirHlpNode.cs | 78 + .../WorldSpaceLightDirHlpNode.cs.meta | 19 + .../HelperFuncs/WorldSpaceViewDirHlpNode.cs | 50 + .../WorldSpaceViewDirHlpNode.cs.meta | 19 + .../Plugins/Editor/Nodes/ISignalGenerator.cs | 11 + .../Editor/Nodes/ISignalGenerator.cs.meta | 19 + .../Plugins/Editor/Nodes/ImageEffects.meta | 9 + .../Editor/Nodes/ImageEffects/BlendOpsNode.cs | 445 ++ .../Nodes/ImageEffects/BlendOpsNode.cs.meta | 19 + .../Nodes/ImageEffects/DesaturateOpNode.cs | 57 + .../ImageEffects/DesaturateOpNode.cs.meta | 19 + .../Editor/Nodes/ImageEffects/HSVToRGBNode.cs | 87 + .../Nodes/ImageEffects/HSVToRGBNode.cs.meta | 19 + .../Nodes/ImageEffects/LuminanceNode.cs | 32 + .../Nodes/ImageEffects/LuminanceNode.cs.meta | 19 + .../Nodes/ImageEffects/NoiseGeneratorNode.cs | 466 ++ .../ImageEffects/NoiseGeneratorNode.cs.meta | 19 + .../Nodes/ImageEffects/PosterizeNode.cs | 98 + .../Nodes/ImageEffects/PosterizeNode.cs.meta | 19 + .../Editor/Nodes/ImageEffects/RGBToHSVNode.cs | 93 + .../Nodes/ImageEffects/RGBToHSVNode.cs.meta | 19 + .../ImageEffects/SimpleContrastOpNode.cs | 55 + .../ImageEffects/SimpleContrastOpNode.cs.meta | 19 + .../Nodes/ImageEffects/SimplexNoiseNode.cs | 104 + .../ImageEffects/SimplexNoiseNode.cs.meta | 19 + .../Nodes/ImageEffects/TFHCGrayscale.cs | 116 + .../Nodes/ImageEffects/TFHCGrayscale.cs.meta | 19 + .../Editor/Nodes/ImageEffects/VoronoiNode.cs | 618 ++ .../Nodes/ImageEffects/VoronoiNode.cs.meta | 19 + .../Editor/Nodes/LogicalOperators.meta | 9 + .../Nodes/LogicalOperators/AllOpNode.cs | 47 + .../Nodes/LogicalOperators/AllOpNode.cs.meta | 19 + .../Nodes/LogicalOperators/AnyOpNode.cs | 47 + .../Nodes/LogicalOperators/AnyOpNode.cs.meta | 19 + .../Editor/Nodes/LogicalOperators/Compare.cs | 293 + .../Nodes/LogicalOperators/Compare.cs.meta | 19 + .../LogicalOperators/ConditionalIfNode.cs | 297 + .../ConditionalIfNode.cs.meta | 19 + .../Editor/Nodes/LogicalOperators/FlipNode.cs | 208 + .../Nodes/LogicalOperators/FlipNode.cs.meta | 19 + .../Nodes/LogicalOperators/IsInfiniteNode.cs | 47 + .../LogicalOperators/IsInfiniteNode.cs.meta | 19 + .../Nodes/LogicalOperators/IsNaNNode.cs | 47 + .../Nodes/LogicalOperators/IsNaNNode.cs.meta | 19 + .../LogicalOperators/KeywordSwitchNode.cs | 133 + .../KeywordSwitchNode.cs.meta | 19 + .../Editor/Nodes/LogicalOperators/NandNode.cs | 76 + .../Nodes/LogicalOperators/NandNode.cs.meta | 19 + .../Editor/Nodes/LogicalOperators/NotNode.cs | 47 + .../Nodes/LogicalOperators/NotNode.cs.meta | 19 + .../LogicalOperators/TFHCCompareEqual.cs | 35 + .../LogicalOperators/TFHCCompareEqual.cs.meta | 19 + .../LogicalOperators/TFHCCompareGreater.cs | 36 + .../TFHCCompareGreater.cs.meta | 19 + .../TFHCCompareGreaterEqual.cs | 37 + .../TFHCCompareGreaterEqual.cs.meta | 19 + .../LogicalOperators/TFHCCompareLower.cs | 35 + .../LogicalOperators/TFHCCompareLower.cs.meta | 19 + .../LogicalOperators/TFHCCompareLowerEqual.cs | 35 + .../TFHCCompareLowerEqual.cs.meta | 19 + .../LogicalOperators/TFHCCompareNotEqual.cs | 35 + .../TFHCCompareNotEqual.cs.meta | 19 + .../LogicalOperators/TFHCCompareWithRange.cs | 122 + .../TFHCCompareWithRange.cs.meta | 19 + .../Editor/Nodes/LogicalOperators/TFHCIf.cs | 133 + .../Nodes/LogicalOperators/TFHCIf.cs.meta | 19 + .../Editor/Nodes/LogicalOperators/TFHCStub.cs | 103 + .../Nodes/LogicalOperators/TFHCStub.cs.meta | 19 + .../Plugins/Editor/Nodes/Master.meta | 9 + .../Nodes/Master/AdditionalDefinesHelper.cs | 140 + .../Master/AdditionalDefinesHelper.cs.meta | 19 + .../Nodes/Master/AdditionalIncludesHelper.cs | 154 + .../Master/AdditionalIncludesHelper.cs.meta | 19 + .../Nodes/Master/AdditionalPragmasHelper.cs | 141 + .../Master/AdditionalPragmasHelper.cs.meta | 19 + .../Master/AdditionalSurfaceOptionsHelper.cs | 153 + .../AdditionalSurfaceOptionsHelper.cs.meta | 19 + .../Editor/Nodes/Master/BillboardOpHelper.cs | 270 + .../Nodes/Master/BillboardOpHelper.cs.meta | 19 + .../Editor/Nodes/Master/BlendOpsHelper.cs | 447 ++ .../Nodes/Master/BlendOpsHelper.cs.meta | 19 + .../Editor/Nodes/Master/CodeGenerationData.cs | 24 + .../Nodes/Master/CodeGenerationData.cs.meta | 19 + .../Editor/Nodes/Master/ColorMaskHelper.cs | 119 + .../Nodes/Master/ColorMaskHelper.cs.meta | 19 + .../Editor/Nodes/Master/CustomTagsHelper.cs | 482 ++ .../Nodes/Master/CustomTagsHelper.cs.meta | 19 + .../Editor/Nodes/Master/DependenciesHelper.cs | 210 + .../Nodes/Master/DependenciesHelper.cs.meta | 19 + .../Nodes/Master/FallbackPickerHelper.cs | 120 + .../Nodes/Master/FallbackPickerHelper.cs.meta | 19 + .../Editor/Nodes/Master/FunctionInput.cs | 527 ++ .../Editor/Nodes/Master/FunctionInput.cs.meta | 19 + .../Editor/Nodes/Master/FunctionNode.cs | 1262 ++++ .../Editor/Nodes/Master/FunctionNode.cs.meta | 19 + .../Editor/Nodes/Master/FunctionOutput.cs | 318 + .../Nodes/Master/FunctionOutput.cs.meta | 19 + .../Editor/Nodes/Master/FunctionSubtitle.cs | 124 + .../Nodes/Master/FunctionSubtitle.cs.meta | 19 + .../Editor/Nodes/Master/FunctionSwitch.cs | 886 +++ .../Nodes/Master/FunctionSwitch.cs.meta | 19 + .../Nodes/Master/FunctionSwitchByPipeline.cs | 102 + .../Master/FunctionSwitchByPipeline.cs.meta | 19 + .../Plugins/Editor/Nodes/Master/LogNode.cs | 80 + .../Editor/Nodes/Master/LogNode.cs.meta | 19 + .../Plugins/Editor/Nodes/Master/MasterNode.cs | 1061 +++ .../Editor/Nodes/Master/MasterNode.cs.meta | 19 + .../Nodes/Master/MasterNodeDataCollector.cs | 2384 +++++++ .../Master/MasterNodeDataCollector.cs.meta | 19 + .../Editor/Nodes/Master/OutlineOpHelper.cs | 683 ++ .../Nodes/Master/OutlineOpHelper.cs.meta | 19 + .../Plugins/Editor/Nodes/Master/OutputNode.cs | 90 + .../Editor/Nodes/Master/OutputNode.cs.meta | 19 + .../Nodes/Master/RenderingOptionsOpHelper.cs | 221 + .../Master/RenderingOptionsOpHelper.cs.meta | 19 + .../Master/RenderingPlatformsOpHelper.cs | 355 + .../Master/RenderingPlatformsOpHelper.cs.meta | 19 + .../Editor/Nodes/Master/StandardSurface.cs | 3324 +++++++++ .../Nodes/Master/StandardSurface.cs.meta | 19 + .../Nodes/Master/StencilBufferOpHelper.cs | 305 + .../Master/StencilBufferOpHelper.cs.meta | 19 + .../Master/TerrainDrawInstancedHelper.cs | 379 + .../Master/TerrainDrawInstancedHelper.cs.meta | 19 + .../Nodes/Master/TessellationOpHelper.cs | 654 ++ .../Nodes/Master/TessellationOpHelper.cs.meta | 19 + .../Editor/Nodes/Master/UsePassHelper.cs | 360 + .../Editor/Nodes/Master/UsePassHelper.cs.meta | 19 + .../Editor/Nodes/Master/ZBufferOpHelper.cs | 272 + .../Nodes/Master/ZBufferOpHelper.cs.meta | 19 + .../Plugins/Editor/Nodes/Misc.meta | 9 + .../Plugins/Editor/Nodes/Misc/AppendNode.cs | 254 + .../Editor/Nodes/Misc/AppendNode.cs.meta | 19 + .../Nodes/Misc/BreakToComponentsNode.cs | 290 + .../Nodes/Misc/BreakToComponentsNode.cs.meta | 19 + .../Editor/Nodes/Misc/CustomExpressionNode.cs | 1881 +++++ .../Nodes/Misc/CustomExpressionNode.cs.meta | 19 + .../Editor/Nodes/Misc/DynamicAppendNode.cs | 475 ++ .../Nodes/Misc/DynamicAppendNode.cs.meta | 19 + .../Plugins/Editor/Nodes/Misc/FresnelNode.cs | 393 ++ .../Editor/Nodes/Misc/FresnelNode.cs.meta | 19 + .../Editor/Nodes/Misc/GetLocalVarNode.cs | 430 ++ .../Editor/Nodes/Misc/GetLocalVarNode.cs.meta | 19 + .../Editor/Nodes/Misc/LayeredBlendNode.cs | 61 + .../Nodes/Misc/LayeredBlendNode.cs.meta | 19 + .../Editor/Nodes/Misc/LinearDepthNode.cs | 109 + .../Editor/Nodes/Misc/LinearDepthNode.cs.meta | 19 + .../Editor/Nodes/Misc/MatrixFromVectors.cs | 215 + .../Nodes/Misc/MatrixFromVectors.cs.meta | 19 + .../Nodes/Misc/PosFromTransformMatrix.cs | 34 + .../Nodes/Misc/PosFromTransformMatrix.cs.meta | 19 + .../Editor/Nodes/Misc/RegisterLocalVarNode.cs | 359 + .../Nodes/Misc/RegisterLocalVarNode.cs.meta | 19 + .../Plugins/Editor/Nodes/Misc/RelayNode.cs | 39 + .../Editor/Nodes/Misc/RelayNode.cs.meta | 19 + .../Editor/Nodes/Misc/RotateAboutAxisNode.cs | 95 + .../Nodes/Misc/RotateAboutAxisNode.cs.meta | 19 + .../Editor/Nodes/Misc/SummedBlendNode.cs | 56 + .../Editor/Nodes/Misc/SummedBlendNode.cs.meta | 19 + .../Plugins/Editor/Nodes/Misc/SwitchNode.cs | 230 + .../Editor/Nodes/Misc/SwitchNode.cs.meta | 19 + .../Plugins/Editor/Nodes/Misc/SwizzleNode.cs | 415 ++ .../Editor/Nodes/Misc/SwizzleNode.cs.meta | 19 + .../Editor/Nodes/Misc/ToggleSwitchNode.cs | 307 + .../Nodes/Misc/ToggleSwitchNode.cs.meta | 19 + .../Editor/Nodes/Misc/Transformation.meta | 9 + .../Transformation/ObjectToWorldTransfNode.cs | 30 + .../ObjectToWorldTransfNode.cs.meta | 19 + .../Misc/Transformation/ParentTransfNode.cs | 53 + .../Transformation/ParentTransfNode.cs.meta | 19 + .../Transformation/WorldToObjectTransfNode.cs | 54 + .../WorldToObjectTransfNode.cs.meta | 19 + .../Editor/Nodes/Misc/VectorFromMatrixNode.cs | 131 + .../Nodes/Misc/VectorFromMatrixNode.cs.meta | 19 + .../Editor/Nodes/Misc/WeightedAvgNode.cs | 182 + .../Editor/Nodes/Misc/WeightedAvgNode.cs.meta | 19 + .../Editor/Nodes/Misc/WeightedBlendNode.cs | 58 + .../Nodes/Misc/WeightedBlendNode.cs.meta | 19 + .../Plugins/Editor/Nodes/Misc/WireNode.cs | 484 ++ .../Editor/Nodes/Misc/WireNode.cs.meta | 19 + .../Plugins/Editor/Nodes/NodeAttributes.cs | 97 + .../Editor/Nodes/NodeAttributes.cs.meta | 19 + .../Plugins/Editor/Nodes/NodeRestrictions.cs | 119 + .../Editor/Nodes/NodeRestrictions.cs.meta | 19 + .../Plugins/Editor/Nodes/NodeUsageRegister.cs | 208 + .../Editor/Nodes/NodeUsageRegister.cs.meta | 19 + .../Plugins/Editor/Nodes/NodeUtils.cs | 291 + .../Plugins/Editor/Nodes/NodeUtils.cs.meta | 19 + .../Plugins/Editor/Nodes/Operators.meta | 9 + .../Editor/Nodes/Operators/ACosOpNode.cs | 26 + .../Editor/Nodes/Operators/ACosOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/ASinOpNode.cs | 26 + .../Editor/Nodes/Operators/ASinOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/ATan2OpNode.cs | 28 + .../Nodes/Operators/ATan2OpNode.cs.meta | 19 + .../Editor/Nodes/Operators/ATanOpNode.cs | 26 + .../Editor/Nodes/Operators/ATanOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/AbsOpNode.cs | 26 + .../Editor/Nodes/Operators/AbsOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/CeilOpNode.cs | 26 + .../Editor/Nodes/Operators/CeilOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/ClampOpNode.cs | 103 + .../Nodes/Operators/ClampOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/ClipNode.cs | 123 + .../Editor/Nodes/Operators/ClipNode.cs.meta | 19 + .../Nodes/Operators/ComponentMaskNode.cs | 382 ++ .../Nodes/Operators/ComponentMaskNode.cs.meta | 19 + .../Editor/Nodes/Operators/CosOpNode.cs | 26 + .../Editor/Nodes/Operators/CosOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/CoshOpNode.cs | 26 + .../Editor/Nodes/Operators/CoshOpNode.cs.meta | 19 + .../Nodes/Operators/CrossProductOpNode.cs | 35 + .../Operators/CrossProductOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/DdxOpNode.cs | 32 + .../Editor/Nodes/Operators/DdxOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/DdyOpNode.cs | 32 + .../Editor/Nodes/Operators/DdyOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/DegreesOpNode.cs | 26 + .../Nodes/Operators/DegreesOpNode.cs.meta | 19 + .../Nodes/Operators/DeterminantOpNode.cs | 25 + .../Nodes/Operators/DeterminantOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/DistanceOpNode.cs | 32 + .../Nodes/Operators/DistanceOpNode.cs.meta | 19 + .../Nodes/Operators/DotProductOpNode.cs | 61 + .../Nodes/Operators/DotProductOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/Exp2OpNode.cs | 26 + .../Editor/Nodes/Operators/Exp2OpNode.cs.meta | 19 + .../Editor/Nodes/Operators/ExpOpNode.cs | 26 + .../Editor/Nodes/Operators/ExpOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/FWidthOpNode.cs | 38 + .../Nodes/Operators/FWidthOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/FloorOpNode.cs | 24 + .../Nodes/Operators/FloorOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/FmodOpNode.cs | 36 + .../Editor/Nodes/Operators/FmodOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/FractNode.cs | 26 + .../Editor/Nodes/Operators/FractNode.cs.meta | 19 + .../Nodes/Operators/GradientSampleNode.cs | 231 + .../Operators/GradientSampleNode.cs.meta | 19 + .../Editor/Nodes/Operators/InverseOpNode.cs | 138 + .../Nodes/Operators/InverseOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/LengthOpNode.cs | 41 + .../Nodes/Operators/LengthOpNode.cs.meta | 19 + .../Plugins/Editor/Nodes/Operators/LerpOp.cs | 116 + .../Editor/Nodes/Operators/LerpOp.cs.meta | 19 + .../Editor/Nodes/Operators/Log10OpNode.cs | 26 + .../Nodes/Operators/Log10OpNode.cs.meta | 19 + .../Editor/Nodes/Operators/Log2OpNode.cs | 26 + .../Editor/Nodes/Operators/Log2OpNode.cs.meta | 19 + .../Editor/Nodes/Operators/LogOpNode.cs | 26 + .../Editor/Nodes/Operators/LogOpNode.cs.meta | 19 + .../Nodes/Operators/MultipleInputOpNode.cs | 3 + .../Operators/MultipleInputOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/NegateNode.cs | 46 + .../Editor/Nodes/Operators/NegateNode.cs.meta | 19 + .../Editor/Nodes/Operators/NormalizeNode.cs | 104 + .../Nodes/Operators/NormalizeNode.cs.meta | 19 + .../Editor/Nodes/Operators/OneMinusNode.cs | 45 + .../Nodes/Operators/OneMinusNode.cs.meta | 19 + .../Editor/Nodes/Operators/PowerNode.cs | 93 + .../Editor/Nodes/Operators/PowerNode.cs.meta | 19 + .../Editor/Nodes/Operators/RSqrtOpNode.cs | 26 + .../Nodes/Operators/RSqrtOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/RadiansOpNode.cs | 26 + .../Nodes/Operators/RadiansOpNode.cs.meta | 19 + .../Nodes/Operators/ReciprocalOpNode.cs | 59 + .../Nodes/Operators/ReciprocalOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/ReflectOpNode.cs | 33 + .../Nodes/Operators/ReflectOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/RefractOpVec.cs | 92 + .../Nodes/Operators/RefractOpVec.cs.meta | 19 + .../Editor/Nodes/Operators/RoundOpNode.cs | 26 + .../Nodes/Operators/RoundOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/SaturateNode.cs | 26 + .../Nodes/Operators/SaturateNode.cs.meta | 19 + .../Nodes/Operators/ScaleAndOffsetNode.cs | 78 + .../Operators/ScaleAndOffsetNode.cs.meta | 19 + .../Editor/Nodes/Operators/ScaleNode.cs | 152 + .../Editor/Nodes/Operators/ScaleNode.cs.meta | 19 + .../Editor/Nodes/Operators/SignOpNode.cs | 26 + .../Editor/Nodes/Operators/SignOpNode.cs.meta | 19 + .../Nodes/Operators/SimplifiedFModOpNode.cs | 32 + .../Operators/SimplifiedFModOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/SinOpNode.cs | 26 + .../Editor/Nodes/Operators/SinOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/SingleInputOp.cs | 67 + .../Nodes/Operators/SingleInputOp.cs.meta | 19 + .../Editor/Nodes/Operators/SinhOpNode.cs | 26 + .../Editor/Nodes/Operators/SinhOpNode.cs.meta | 19 + .../Nodes/Operators/SmoothstepOpNode.cs | 122 + .../Nodes/Operators/SmoothstepOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/SqrtOpNode.cs | 26 + .../Editor/Nodes/Operators/SqrtOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/StepOpNode.cs | 24 + .../Editor/Nodes/Operators/StepOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/TFHCRemapNode.cs | 74 + .../Nodes/Operators/TFHCRemapNode.cs.meta | 19 + .../Editor/Nodes/Operators/TanOpNode.cs | 26 + .../Editor/Nodes/Operators/TanOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/TanhOpNode.cs | 26 + .../Editor/Nodes/Operators/TanhOpNode.cs.meta | 19 + .../Nodes/Operators/TransformVectorOpNode.cs | 160 + .../Operators/TransformVectorOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/TransposeOpNode.cs | 23 + .../Nodes/Operators/TransposeOpNode.cs.meta | 19 + .../Editor/Nodes/Operators/TruncOpNode.cs | 26 + .../Nodes/Operators/TruncOpNode.cs.meta | 19 + .../Nodes/Operators/VariablePortTypeOpNode.cs | 76 + .../Operators/VariablePortTypeOpNode.cs.meta | 19 + .../Plugins/Editor/Nodes/ParentNode.cs | 3918 +++++++++++ .../Plugins/Editor/Nodes/ParentNode.cs.meta | 19 + .../Plugins/Editor/Nodes/ReordenatorNode.cs | 170 + .../Editor/Nodes/ReordenatorNode.cs.meta | 19 + .../Plugins/Editor/Nodes}/SRP.meta | 4 +- .../Plugins/Editor/Nodes/SRP/BakedGINode.cs | 212 + .../Editor/Nodes/SRP/BakedGINode.cs.meta | 18 + .../Plugins/Editor/Nodes/SRP/ExposureNode.cs | 41 + .../Editor/Nodes/SRP/ExposureNode.cs.meta | 18 + .../Plugins/Editor/Nodes/SRP/HDRP.meta} | 2 +- .../Nodes/SRP/HDRP/ASEDiffusionProfile.cs | 87 + .../SRP/HDRP/ASEDiffusionProfile.cs.meta | 19 + .../Nodes/SRP/HDRP/DiffusionProfileNode.cs | 466 ++ .../SRP/HDRP/DiffusionProfileNode.cs.meta | 18 + .../Editor/Nodes/SRP/HDRP/HDEmissionNode.cs | 152 + .../Nodes/SRP/HDRP/HDEmissionNode.cs.meta | 18 + .../Editor/Nodes/SRP/MaterialQualityNode.cs | 128 + .../Nodes/SRP/MaterialQualityNode.cs.meta | 19 + .../Plugins/Editor/Nodes/SRP/URP.meta | 9 + .../Nodes/SRP/URP/ReflectionProbeNode.cs | 114 + .../Nodes/SRP/URP/ReflectionProbeNode.cs.meta | 19 + .../Editor/Nodes/SignalGeneratorNode.cs | 41 + .../Editor/Nodes/SignalGeneratorNode.cs.meta | 19 + .../Plugins/Editor/Nodes/SimpleNodes.meta | 9 + .../Nodes/SimpleNodes/SimpleAddOpNode.cs | 58 + .../Nodes/SimpleNodes/SimpleAddOpNode.cs.meta | 19 + .../Nodes/SimpleNodes/SimpleDivideOpNode.cs | 45 + .../SimpleNodes/SimpleDivideOpNode.cs.meta | 19 + .../Nodes/SimpleNodes/SimpleMaxOpNode.cs | 24 + .../Nodes/SimpleNodes/SimpleMaxOpNode.cs.meta | 19 + .../Nodes/SimpleNodes/SimpleMinOpNode.cs | 24 + .../Nodes/SimpleNodes/SimpleMinOpNode.cs.meta | 19 + .../Nodes/SimpleNodes/SimpleMultiplyOpNode.cs | 175 + .../SimpleNodes/SimpleMultiplyOpNode.cs.meta | 19 + .../Nodes/SimpleNodes/SimpleRemainderNode.cs | 60 + .../SimpleNodes/SimpleRemainderNode.cs.meta | 19 + .../Nodes/SimpleNodes/SimpleSubtractOpNode.cs | 39 + .../SimpleNodes/SimpleSubtractOpNode.cs.meta | 19 + .../Plugins/Editor/Nodes/StickyNoteNode.cs | 502 ++ .../Editor/Nodes/StickyNoteNode.cs.meta | 19 + .../Editor/Nodes/SurfaceShaderInputs.meta | 9 + .../SurfaceShaderInputs/ColorInputsNode.cs | 17 + .../ColorInputsNode.cs.meta | 19 + .../SurfaceShaderInputs/GrabScreenPosition.cs | 118 + .../GrabScreenPosition.cs.meta | 19 + .../SurfaceShaderInputs/LocalVertexPosNode.cs | 50 + .../LocalVertexPosNode.cs.meta | 19 + .../Nodes/SurfaceShaderInputs/PositionNode.cs | 117 + .../SurfaceShaderInputs/PositionNode.cs.meta | 19 + .../SurfaceShaderInputs/ScreenColorNode.cs | 714 ++ .../ScreenColorNode.cs.meta | 19 + .../SurfaceShaderInputs/ScreenDepthNode.cs | 179 + .../ScreenDepthNode.cs.meta | 19 + .../ScreenPosInputsNode.cs | 163 + .../ScreenPosInputsNode.cs.meta | 19 + .../SurfaceShaderINParentNode.cs | 122 + .../SurfaceShaderINParentNode.cs.meta | 19 + .../SurfaceShaderInputs/TexelSizeNode.cs | 340 + .../SurfaceShaderInputs/TexelSizeNode.cs.meta | 19 + .../SurfaceShaderInputs/UVCoordsParentNode.cs | 112 + .../UVCoordsParentNode.cs.meta | 19 + .../ViewDirInputsCoordNode.cs | 151 + .../ViewDirInputsCoordNode.cs.meta | 19 + .../SurfaceShaderInputs/ViewVectorNode.cs | 120 + .../ViewVectorNode.cs.meta | 19 + .../WorldNormalInputsNode.cs | 119 + .../WorldNormalInputsNode.cs.meta | 19 + .../SurfaceShaderInputs/WorldNormalVector.cs | 178 + .../WorldNormalVector.cs.meta | 19 + .../SurfaceShaderInputs/WorldPosInputsNode.cs | 37 + .../WorldPosInputsNode.cs.meta | 19 + .../WorldReflInputsNode.cs | 18 + .../WorldReflInputsNode.cs.meta | 19 + .../WorldReflectionVector.cs | 215 + .../WorldReflectionVector.cs.meta | 19 + .../Plugins/Editor/Nodes}/Textures.meta | 4 +- .../Editor/Nodes/Textures/BlendNormalsNode.cs | 104 + .../Nodes/Textures/BlendNormalsNode.cs.meta | 19 + .../Nodes/Textures/HeightMapBlendNode.cs | 80 + .../Nodes/Textures/HeightMapBlendNode.cs.meta | 19 + .../Editor/Nodes/Textures/PannerNode.cs | 110 + .../Editor/Nodes/Textures/PannerNode.cs.meta | 19 + .../Editor/Nodes/Textures/RotatorNode.cs | 96 + .../Editor/Nodes/Textures/RotatorNode.cs.meta | 19 + .../Editor/Nodes/Textures/SamplerNode.cs | 2306 +++++++ .../Editor/Nodes/Textures/SamplerNode.cs.meta | 19 + .../Editor/Nodes/Textures/SamplerStateNode.cs | 402 ++ .../Nodes/Textures/SamplerStateNode.cs.meta | 19 + .../Nodes/Textures/TFHCFlipBookUVAnimation.cs | 257 + .../Textures/TFHCFlipBookUVAnimation.cs.meta | 19 + .../Editor/Nodes/Textures/TFHCPixelate.cs | 54 + .../Nodes/Textures/TFHCPixelate.cs.meta | 19 + .../Nodes/Textures/TextureCoordinatesNode.cs | 633 ++ .../Textures/TextureCoordinatesNode.cs.meta | 19 + .../Nodes/Textures/TexturePropertyNode.cs | 1115 +++ .../Textures/TexturePropertyNode.cs.meta | 19 + .../Nodes/Textures/TextureTransformNode.cs | 364 + .../Textures/TextureTransformNode.cs.meta | 19 + .../Nodes/Textures/UnpackScaleNormalNode.cs | 101 + .../Textures/UnpackScaleNormalNode.cs.meta | 19 + .../Nodes/Textures/VirtualTextureObject.cs | 296 + .../Textures/VirtualTextureObject.cs.meta | 19 + .../Plugins/Editor/Nodes/UndoParentNode.cs | 702 ++ .../Editor/Nodes/UndoParentNode.cs.meta | 19 + .../Plugins/Editor/Nodes/Vertex.meta | 9 + .../Editor/Nodes/Vertex/BillboardNode.cs | 135 + .../Editor/Nodes/Vertex/BillboardNode.cs.meta | 19 + .../Nodes/Vertex/BitangentVertexDataNode.cs | 37 + .../Vertex/BitangentVertexDataNode.cs.meta | 19 + .../Editor/Nodes/Vertex/BlendIndicesNode.cs | 56 + .../Nodes/Vertex/BlendIndicesNode.cs.meta | 18 + .../Editor/Nodes/Vertex/BlendWeightsNode.cs | 52 + .../Nodes/Vertex/BlendWeightsNode.cs.meta | 18 + .../Nodes/Vertex/ColorVertexDataNode.cs | 18 + .../Nodes/Vertex/ColorVertexDataNode.cs.meta | 19 + .../Nodes/Vertex/NormalVertexDataNode.cs | 44 + .../Nodes/Vertex/NormalVertexDataNode.cs.meta | 19 + .../Editor/Nodes/Vertex/ObjectBoundsNode.cs | 68 + .../Nodes/Vertex/ObjectBoundsNode.cs.meta | 19 + .../Editor/Nodes/Vertex/ObjectPositionNode.cs | 28 + .../Nodes/Vertex/ObjectPositionNode.cs.meta | 19 + .../Editor/Nodes/Vertex/ObjectScaleNode.cs | 75 + .../Nodes/Vertex/ObjectScaleNode.cs.meta | 19 + .../Editor/Nodes/Vertex/OutlineNode.cs | 421 ++ .../Editor/Nodes/Vertex/OutlineNode.cs.meta | 19 + .../Editor/Nodes/Vertex/PosVertexDataNode.cs | 143 + .../Nodes/Vertex/PosVertexDataNode.cs.meta | 19 + .../Nodes/Vertex/TangentSignVertexDataNode.cs | 23 + .../Vertex/TangentSignVertexDataNode.cs.meta | 19 + .../Nodes/Vertex/TangentVertexDataNode.cs | 120 + .../Vertex/TangentVertexDataNode.cs.meta | 19 + .../Editor/Nodes/Vertex/Tessellation.meta | 9 + .../Tessellation/DistanceBasedTessNode.cs | 30 + .../DistanceBasedTessNode.cs.meta | 19 + .../Tessellation/EdgeLengthCullTessNode.cs | 27 + .../EdgeLengthCullTessNode.cs.meta | 19 + .../Vertex/Tessellation/EdgeLengthTessNode.cs | 23 + .../Tessellation/EdgeLengthTessNode.cs.meta | 19 + .../Tessellation/TessellationParentNode.cs | 29 + .../TessellationParentNode.cs.meta | 19 + .../Nodes/Vertex/TexCoord1VertexDataNode.cs | 16 + .../Vertex/TexCoord1VertexDataNode.cs.meta | 19 + .../Nodes/Vertex/TexCoordVertexDataNode.cs | 245 + .../Vertex/TexCoordVertexDataNode.cs.meta | 19 + .../Editor/Nodes/Vertex/VertexBinormalNode.cs | 48 + .../Nodes/Vertex/VertexBinormalNode.cs.meta | 19 + .../Editor/Nodes/Vertex/VertexColorNode.cs | 47 + .../Nodes/Vertex/VertexColorNode.cs.meta | 19 + .../Editor/Nodes/Vertex/VertexDataNode.cs | 50 + .../Nodes/Vertex/VertexDataNode.cs.meta | 19 + .../Editor/Nodes/Vertex/VertexTangentNode.cs | 50 + .../Nodes/Vertex/VertexTangentNode.cs.meta | 19 + .../Nodes/Vertex/VertexToFragmentNode.cs | 187 + .../Nodes/Vertex/VertexToFragmentNode.cs.meta | 19 + .../Plugins/Editor/PreMadeShaders.cs | 47 + .../Plugins/Editor/PreMadeShaders.cs.meta | 19 + .../Plugins/Editor/Templates.meta | 9 + .../TemplateAdditionalDefinesHelper.cs | 31 + .../TemplateAdditionalDefinesHelper.cs.meta | 19 + .../TemplateAdditionalDirectivesHelper.cs | 962 +++ ...TemplateAdditionalDirectivesHelper.cs.meta | 19 + .../TemplateAdditionalIncludesHelper.cs | 31 + .../TemplateAdditionalIncludesHelper.cs.meta | 19 + .../TemplateAdditionalParentHelper.cs | 193 + .../TemplateAdditionalParentHelper.cs.meta | 19 + .../TemplateAdditionalPragmasHelper.cs | 31 + .../TemplateAdditionalPragmasHelper.cs.meta | 19 + .../Templates/TemplateAlphaToMaskModule.cs | 128 + .../TemplateAlphaToMaskModule.cs.meta | 19 + .../Templates/TemplateCodeSnippetBase.cs | 102 + .../Templates/TemplateCodeSnippetBase.cs.meta | 19 + .../Templates/TemplateColorMaskModule.cs | 200 + .../Templates/TemplateColorMaskModule.cs.meta | 19 + .../Templates/TemplateCullModeModule.cs | 128 + .../Templates/TemplateCullModeModule.cs.meta | 19 + .../Editor/Templates/TemplateDBItem.cs | 21 + .../Editor/Templates/TemplateDBItem.cs.meta | 19 + .../Plugins/Editor/Templates/TemplateData.cs | 1183 ++++ .../Editor/Templates/TemplateData.cs.meta | 19 + .../Editor/Templates/TemplateDataCollector.cs | 2399 +++++++ .../Templates/TemplateDataCollector.cs.meta | 19 + .../Editor/Templates/TemplateDataParent.cs | 217 + .../Templates/TemplateDataParent.cs.meta | 19 + .../Editor/Templates/TemplateDepthModule.cs | 397 ++ .../Templates/TemplateDepthModule.cs.meta | 19 + .../Templates/TemplateFragmentDataNode.cs | 285 + .../TemplateFragmentDataNode.cs.meta | 19 + .../Templates/TemplateHelperFunctions.cs | 2718 ++++++++ .../Templates/TemplateHelperFunctions.cs.meta | 19 + .../Editor/Templates/TemplateIdManager.cs | 237 + .../Templates/TemplateIdManager.cs.meta | 19 + .../Editor/Templates/TemplateInterpData.cs | 239 + .../Templates/TemplateInterpData.cs.meta | 19 + .../Editor/Templates/TemplateLocalVarData.cs | 59 + .../Templates/TemplateLocalVarData.cs.meta | 19 + .../Editor/Templates/TemplateLocalVarsNode.cs | 275 + .../Templates/TemplateLocalVarsNode.cs.meta | 19 + .../Editor/Templates/TemplateMasterNode.cs | 770 +++ .../Templates/TemplateMasterNode.cs.meta | 19 + .../Editor/Templates/TemplateMenuItems.cs | 95 + .../Templates/TemplateMenuItems.cs.meta | 19 + .../Editor/Templates/TemplateModuleHelper.cs | 788 +++ .../Templates/TemplateModuleHelper.cs.meta | 19 + .../Editor/Templates/TemplateModuleParent.cs | 82 + .../Templates/TemplateModuleParent.cs.meta | 19 + .../Editor/Templates/TemplateModulesData.cs | 819 +++ .../Templates/TemplateModulesData.cs.meta | 19 + .../Editor/Templates/TemplateMultiPass.cs | 1499 ++++ .../Templates/TemplateMultiPass.cs.meta | 19 + .../Templates/TemplateMultiPassMasterNode.cs | 3633 ++++++++++ .../TemplateMultiPassMasterNode.cs.meta | 19 + .../Templates/TemplateMultiPassSwitchNode.cs | 329 + .../TemplateMultiPassSwitchNode.cs.meta | 19 + .../Editor/Templates/TemplateNodeParent.cs | 303 + .../Templates/TemplateNodeParent.cs.meta | 19 + .../Editor/Templates/TemplateOptionsData.cs | 1233 ++++ .../Templates/TemplateOptionsData.cs.meta | 19 + .../TemplateOptionsDefinesContainer.cs | 69 + .../TemplateOptionsDefinesContainer.cs.meta | 19 + .../Editor/Templates/TemplateOptionsPort.cs | 198 + .../Templates/TemplateOptionsPort.cs.meta | 19 + .../Editor/Templates/TemplateOptionsUI.cs | 329 + .../Templates/TemplateOptionsUI.cs.meta | 19 + .../Templates/TemplateOptionsUIHelper.cs | 945 +++ .../Templates/TemplateOptionsUIHelper.cs.meta | 19 + .../Plugins/Editor/Templates/TemplatePass.cs | 637 ++ .../Editor/Templates/TemplatePass.cs.meta | 19 + .../Templates/TemplatePassSelectorHelper.cs | 175 + .../TemplatePassSelectorHelper.cs.meta | 19 + .../Editor/Templates/TemplatePostProcessor.cs | 180 + .../Templates/TemplatePostProcessor.cs.meta | 19 + .../Templates/TemplateRenderPlatformHelper.cs | 80 + .../TemplateRenderPlatformHelper.cs.meta | 19 + .../Editor/Templates/TemplateShaderData.cs | 121 + .../Templates/TemplateShaderData.cs.meta | 19 + .../Templates/TemplateShaderModelModule.cs | 122 + .../TemplateShaderModelModule.cs.meta | 19 + .../Templates/TemplateShaderPropertyData.cs | 52 + .../TemplateShaderPropertyData.cs.meta | 19 + .../Templates/TemplateShaderPropertyNode.cs | 723 ++ .../TemplateShaderPropertyNode.cs.meta | 19 + .../Editor/Templates/TemplateSubShader.cs | 173 + .../Templates/TemplateSubShader.cs.meta | 19 + .../Editor/Templates/TemplateTagsModule.cs | 472 ++ .../Templates/TemplateTagsModule.cs.meta | 19 + .../Editor/Templates/TemplateVertexData.cs | 190 + .../Templates/TemplateVertexData.cs.meta | 19 + .../Templates/TemplateVertexDataNode.cs | 285 + .../Templates/TemplateVertexDataNode.cs.meta | 19 + .../Editor/Templates/TemplatesBlendModule.cs | 757 ++ .../Templates/TemplatesBlendModule.cs.meta | 19 + .../Editor/Templates/TemplatesManager.cs | 1005 +++ .../Editor/Templates/TemplatesManager.cs.meta | 19 + .../Templates/TemplatesStencilBufferModule.cs | 668 ++ .../TemplatesStencilBufferModule.cs.meta | 19 + .../Plugins/Editor/Utils.meta | 9 + .../Plugins/Editor/Utils/ASEPPSHelperTool.cs | 464 ++ .../Editor/Utils/ASEPPSHelperTool.cs.meta | 19 + .../Editor/Utils/ASEPackageManagerHelper.cs | 463 ++ .../Utils/ASEPackageManagerHelper.cs.meta | 19 + .../Editor/Utils/ASESaveBundleAsset.cs | 31 + .../Editor/Utils/ASESaveBundleAsset.cs.meta | 19 + .../Plugins/Editor/Utils/ASESaveBundleTool.cs | 476 ++ .../Editor/Utils/ASESaveBundleTool.cs.meta | 19 + .../Plugins/Editor/Utils/ASEStartScreen.cs | 512 ++ .../Editor/Utils/ASEStartScreen.cs.meta | 19 + .../Editor/Utils/ASETextureArrayCreator.cs | 808 +++ .../Utils/ASETextureArrayCreator.cs.meta | 19 + .../Editor/Utils/CustomMaterialInspector.cs | 571 ++ .../Utils/CustomMaterialInspector.cs.meta | 19 + .../Editor/Utils/CustomShaderInspector.cs | 953 +++ .../Utils/CustomShaderInspector.cs.meta | 19 + .../Editor/Utils/EditorVariablesManager.cs | 254 + .../Utils/EditorVariablesManager.cs.meta | 19 + .../Plugins/Editor/Utils/GeneratorUtils.cs | 1963 ++++++ .../Editor/Utils/GeneratorUtils.cs.meta | 19 + .../Plugins/Editor/Utils/GenericMessage.cs | 117 + .../Editor/Utils/GenericMessage.cs.meta | 19 + .../Plugins/Editor/Utils/IOUtils.cs | 1056 +++ .../Plugins/Editor/Utils/IOUtils.cs.meta | 19 + .../Plugins/Editor/Utils/InlineProperty.cs | 381 + .../Editor/Utils/InlineProperty.cs.meta | 19 + .../Editor/Utils/InlinePropertyTable.cs | 43 + .../Editor/Utils/InlinePropertyTable.cs.meta | 19 + .../Editor/Utils/InvalidDataChecker.cs | 168 + .../Editor/Utils/InvalidDataChecker.cs.meta | 19 + .../Plugins/Editor/Utils/NodeExporterUtils.cs | 334 + .../Editor/Utils/NodeExporterUtils.cs.meta | 19 + .../Editor/Utils/Preferences.Project.cs | 106 + .../Editor/Utils/Preferences.Project.cs.meta | 18 + .../Plugins/Editor/Utils/Preferences.User.cs | 157 + .../Editor/Utils/Preferences.User.cs.meta | 18 + .../Plugins/Editor/Utils/Preferences.cs | 83 + .../Plugins/Editor/Utils/Preferences.cs.meta | 18 + .../Plugins/Editor/Utils/RectExtension.cs | 40 + .../Editor/Utils/RectExtension.cs.meta | 19 + .../Editor/Utils/SamplerStateAutoGenerator.cs | 185 + .../Utils/SamplerStateAutoGenerator.cs.meta | 19 + .../Editor/Utils/ShaderBodyTokenizer.cs | 155 + .../Editor/Utils/ShaderBodyTokenizer.cs.meta | 19 + .../Plugins/Editor/Utils/ShortcutsManager.cs | 215 + .../Editor/Utils/ShortcutsManager.cs.meta | 19 + .../Editor/Utils/TextureArrayCreatorAsset.cs | 78 + .../Utils/TextureArrayCreatorAsset.cs.meta | 19 + .../Plugins/Editor/Utils/TipsWindow.cs | 148 + .../Plugins/Editor/Utils/TipsWindow.cs.meta | 19 + .../Plugins/Editor/Utils/UIUtils.cs | 3209 +++++++++ .../Plugins/Editor/Utils/UIUtils.cs.meta | 19 + .../Plugins/Editor/Utils/UndoUtils.cs | 118 + .../Plugins/Editor/Utils/UndoUtils.cs.meta | 19 + .../Editor/Utils/UpperLeftWidgetHelper.cs | 91 + .../Utils/UpperLeftWidgetHelper.cs.meta | 19 + .../Plugins/Editor/Utils/WindowHelper.cs | 257 + .../Plugins/Editor/Utils/WindowHelper.cs.meta | 19 + .../Plugins/Editor/Utils/WindowsUtil.cs | 150 + .../Plugins/Editor/Utils/WindowsUtil.cs.meta | 19 + .../Plugins/Editor/Version.meta | 9 + .../Plugins/Editor/Version/About.cs | 66 + .../Plugins/Editor/Version/About.cs.meta | 19 + .../Plugins/Editor/Version/VersionInfo.cs | 24 + .../Editor/Version/VersionInfo.cs.meta | 19 + .../Plugins/Editor/Wires.meta | 9 + .../Plugins/Editor/Wires/GLDraw.cs | 156 + .../Plugins/Editor/Wires/GLDraw.cs.meta | 19 + .../Plugins/Editor/Wires/InputPort.cs | 1493 ++++ .../Plugins/Editor/Wires/InputPort.cs.meta | 19 + .../Plugins/Editor/Wires/OutputPort.cs | 314 + .../Plugins/Editor/Wires/OutputPort.cs.meta | 19 + .../Editor/Wires/WireBezierReference.cs | 58 + .../Editor/Wires/WireBezierReference.cs.meta | 19 + .../Plugins/Editor/Wires/WirePort.cs | 606 ++ .../Plugins/Editor/Wires/WirePort.cs.meta | 19 + .../Plugins/Editor/Wires/WireReference.cs | 126 + .../Editor/Wires/WireReference.cs.meta | 19 + .../Plugins/EditorResources.meta | 9 + .../Plugins/EditorResources/GUISkins.meta | 9 + .../EditorResources/GUISkins/MainSkin.guiskin | 5340 ++++++++++++++ .../GUISkins/MainSkin.guiskin.meta | 15 + .../Plugins/EditorResources/Nodes.meta | 9 + .../EditorResources/Nodes/Bezier1X2AA.png | 3 + .../Nodes/Bezier1X2AA.png.meta | 66 + .../Nodes/GPUInstancingIconOFF.png | 3 + .../Nodes/GPUInstancingIconOFF.png.meta | 65 + .../Nodes/GPUInstancingIconON.png | 3 + .../Nodes/GPUInstancingIconON.png.meta | 65 + .../EditorResources/Nodes/LinkIcon.png | 3 + .../EditorResources/Nodes/LinkIcon.png.meta | 83 + .../Nodes/MasterNodeIconOFF.png | 3 + .../Nodes/MasterNodeIconOFF.png.meta | 65 + .../Nodes/MasterNodeIconON.png | 3 + .../Nodes/MasterNodeIconON.png.meta | 65 + .../Nodes/TextureReferenceBg.png | 3 + .../Nodes/TextureReferenceBg.png.meta} | 22 +- .../Plugins/EditorResources/Previews.meta | 9 + .../Previews/IndirectSpecularPreview.exr | 3 + .../Previews/IndirectSpecularPreview.exr.meta | 76 + .../Previews/LinearPreviews.shader | 233 + .../Previews/LinearPreviews.shader.meta | 18 + .../EditorResources/Previews/Preview.cginc | 121 + .../Previews/Preview.cginc.meta | 16 + .../Previews/Preview_ACosOpNode.shader | 26 + .../Previews/Preview_ACosOpNode.shader.meta | 16 + .../Previews/Preview_ASinOpNode.shader | 26 + .../Previews/Preview_ASinOpNode.shader.meta | 16 + .../Previews/Preview_ATan2OpNode.shader | 30 + .../Previews/Preview_ATan2OpNode.shader.meta | 16 + .../Previews/Preview_ATanOpNode.shader | 26 + .../Previews/Preview_ATanOpNode.shader.meta | 16 + .../Previews/Preview_AbsOpNode.shader | 26 + .../Previews/Preview_AbsOpNode.shader.meta | 16 + .../Previews/Preview_AllNode.shader | 26 + .../Previews/Preview_AllNode.shader.meta | 16 + .../Previews/Preview_AnyNode.shader | 26 + .../Previews/Preview_AnyNode.shader.meta | 16 + .../Previews/Preview_AppendNode.shader | 37 + .../Previews/Preview_AppendNode.shader.meta | 16 + .../Previews/Preview_BlendNormalsNode.shader | 83 + .../Preview_BlendNormalsNode.shader.meta | 16 + .../Previews/Preview_BlendOpsNode.shader | 620 ++ .../Previews/Preview_BlendOpsNode.shader.meta | 16 + .../Preview_BreakToComponentsNode.shader | 77 + .../Preview_BreakToComponentsNode.shader.meta | 16 + .../Previews/Preview_CeilOpNode.shader | 26 + .../Previews/Preview_CeilOpNode.shader.meta | 16 + .../Previews/Preview_ClampOpNode.shader | 34 + .../Previews/Preview_ClampOpNode.shader.meta | 16 + .../Previews/Preview_Clip.shader | 36 + .../Previews/Preview_Clip.shader.meta | 16 + .../Previews/Preview_ClipPlanes.shader | 26 + .../Previews/Preview_ClipPlanes.shader.meta | 16 + .../Previews/Preview_ColorNode.shader | 25 + .../Previews/Preview_ColorNode.shader.meta | 16 + .../Previews/Preview_ColorSpaceDouble.shader | 20 + .../Preview_ColorSpaceDouble.shader.meta | 16 + .../Previews/Preview_Compare.shader | 49 + .../Previews/Preview_Compare.shader.meta | 16 + .../Previews/Preview_ComponentMaskNode.shader | 63 + .../Preview_ComponentMaskNode.shader.meta | 16 + .../Previews/Preview_ComputeScreenPos.shader | 49 + .../Preview_ComputeScreenPos.shader.meta | 16 + .../Previews/Preview_ConditionalIfNode.shader | 48 + .../Preview_ConditionalIfNode.shader.meta | 16 + .../Previews/Preview_CosOpNode.shader | 26 + .../Previews/Preview_CosOpNode.shader.meta | 16 + .../Previews/Preview_CosTime.shader | 26 + .../Previews/Preview_CosTime.shader.meta | 16 + .../Previews/Preview_CoshOpNode.shader | 26 + .../Previews/Preview_CoshOpNode.shader.meta | 16 + .../Preview_CrossProductOpNode.shader | 30 + .../Preview_CrossProductOpNode.shader.meta | 16 + .../Previews/Preview_DdxOpNode.shader | 26 + .../Previews/Preview_DdxOpNode.shader.meta | 16 + .../Previews/Preview_DdyOpNode.shader | 26 + .../Previews/Preview_DdyOpNode.shader.meta | 16 + .../Preview_DecodeDepthNormalNode.shader | 31 + .../Preview_DecodeDepthNormalNode.shader.meta | 16 + .../Preview_DecodeFloatRGBAHlpNode.shader | 28 + ...Preview_DecodeFloatRGBAHlpNode.shader.meta | 16 + .../Preview_DecodeFloatRGHlpNode.shader | 28 + .../Preview_DecodeFloatRGHlpNode.shader.meta | 16 + .../Preview_DecodeLightmapHlpNode.shader | 27 + .../Preview_DecodeLightmapHlpNode.shader.meta | 16 + ...eview_DecodeViewNormalStereoHlpNode.shader | 28 + ..._DecodeViewNormalStereoHlpNode.shader.meta | 16 + .../Previews/Preview_DegreesOpNode.shader | 26 + .../Preview_DegreesOpNode.shader.meta | 16 + .../Previews/Preview_DeltaTime.shader | 27 + .../Previews/Preview_DeltaTime.shader.meta | 16 + .../Previews/Preview_DesaturateNode.shader | 35 + .../Preview_DesaturateNode.shader.meta | 16 + ...view_DiffuseAndSpecularFromMetallic.shader | 46 + ...DiffuseAndSpecularFromMetallic.shader.meta | 16 + .../Previews/Preview_DistanceOpNode.shader | 30 + .../Preview_DistanceOpNode.shader.meta | 16 + .../Previews/Preview_DotProductOpNode.shader | 40 + .../Preview_DotProductOpNode.shader.meta | 16 + .../Previews/Preview_DynamicAppendNode.shader | 136 + .../Preview_DynamicAppendNode.shader.meta | 16 + .../Preview_EncodeFloatRGBAHlpNode.shader | 28 + ...Preview_EncodeFloatRGBAHlpNode.shader.meta | 16 + .../Preview_EncodeFloatRGHlpNode.shader | 28 + .../Preview_EncodeFloatRGHlpNode.shader.meta | 16 + ...eview_EncodeViewNormalStereoHlpNode.shader | 28 + ..._EncodeViewNormalStereoHlpNode.shader.meta | 16 + .../Previews/Preview_Exp2OpNode.shader | 26 + .../Previews/Preview_Exp2OpNode.shader.meta | 16 + .../Previews/Preview_ExpOpNode.shader | 26 + .../Previews/Preview_ExpOpNode.shader.meta | 16 + .../Previews/Preview_FWidthOpNode.shader | 26 + .../Previews/Preview_FWidthOpNode.shader.meta | 16 + .../Previews/Preview_FaceVariableNode.shader | 20 + .../Preview_FaceVariableNode.shader.meta | 16 + .../Previews/Preview_FlipNode.shader | 33 + .../Previews/Preview_FlipNode.shader.meta | 16 + .../Previews/Preview_FloorOpNode.shader | 26 + .../Previews/Preview_FloorOpNode.shader.meta | 16 + .../Previews/Preview_FmodOpNode.shader | 30 + .../Previews/Preview_FmodOpNode.shader.meta | 16 + .../Preview_FogAndAmbientColors.shader | 80 + .../Preview_FogAndAmbientColors.shader.meta | 16 + .../Previews/Preview_FogParams.shader | 20 + .../Previews/Preview_FogParams.shader.meta | 16 + .../Previews/Preview_FractNode.shader | 26 + .../Previews/Preview_FractNode.shader.meta | 16 + .../Previews/Preview_FresnelNode.shader | 358 + .../Previews/Preview_FresnelNode.shader.meta | 16 + .../Previews/Preview_FunctionInputNode.shader | 40 + .../Preview_FunctionInputNode.shader.meta | 16 + .../Previews/Preview_FunctionNode.shader | 26 + .../Previews/Preview_FunctionNode.shader.meta | 16 + .../Preview_FunctionOutputNode.shader | 26 + .../Preview_FunctionOutputNode.shader.meta | 16 + .../Previews/Preview_GammaToLinearNode.shader | 28 + .../Preview_GammaToLinearNode.shader.meta | 18 + .../Previews/Preview_GetLocalVarNode.shader | 26 + .../Preview_GetLocalVarNode.shader.meta | 16 + .../Previews/Preview_GradientSample.shader | 124 + .../Preview_GradientSample.shader.meta | 16 + .../Previews/Preview_GrayscaleNode.shader | 65 + .../Preview_GrayscaleNode.shader.meta | 16 + .../Previews/Preview_HSVToRGBNode.shader | 42 + .../Previews/Preview_HSVToRGBNode.shader.meta | 16 + .../Preview_HeightMapTextureBlend.shader | 34 + .../Preview_HeightMapTextureBlend.shader.meta | 16 + .../Preview_IndirectDiffuseLight.shader | 102 + .../Preview_IndirectDiffuseLight.shader.meta | 16 + .../Preview_IndirectSpecularLight.shader | 104 + .../Preview_IndirectSpecularLight.shader.meta | 20 + .../Previews/Preview_InstanceIDNode.shader | 25 + .../Preview_InstanceIDNode.shader.meta | 16 + .../Previews/Preview_IntNode.shader | 25 + .../Previews/Preview_IntNode.shader.meta | 16 + .../Previews/Preview_IsInfinite.shader | 26 + .../Previews/Preview_IsInfinite.shader.meta | 16 + .../Previews/Preview_IsNaN.shader | 33 + .../Previews/Preview_IsNaN.shader.meta | 16 + .../Previews/Preview_LODFadeNode.shader | 20 + .../Previews/Preview_LODFadeNode.shader.meta | 16 + .../Previews/Preview_LayeredBlendNode.shader | 91 + .../Preview_LayeredBlendNode.shader.meta | 16 + .../Previews/Preview_LengthOpNode.shader | 77 + .../Previews/Preview_LengthOpNode.shader.meta | 16 + .../Previews/Preview_LerpOp.shader | 33 + .../Previews/Preview_LerpOp.shader.meta | 16 + .../Previews/Preview_LightAttenuation.shader | 27 + .../Preview_LightAttenuation.shader.meta | 16 + .../Previews/Preview_LightColorNode.shader | 59 + .../Preview_LightColorNode.shader.meta | 16 + .../Previews/Preview_LinearDepthNode.shader | 45 + .../Preview_LinearDepthNode.shader.meta | 16 + .../Previews/Preview_LinearToGammaNode.shader | 28 + .../Preview_LinearToGammaNode.shader.meta | 18 + .../Previews/Preview_Log10OpNode.shader | 26 + .../Previews/Preview_Log10OpNode.shader.meta | 16 + .../Previews/Preview_Log2OpNode.shader | 26 + .../Previews/Preview_Log2OpNode.shader.meta | 16 + .../Previews/Preview_LogOpNode.shader | 26 + .../Previews/Preview_LogOpNode.shader.meta | 16 + .../Previews/Preview_LuminanceNode.shader | 27 + .../Preview_LuminanceNode.shader.meta | 16 + .../Previews/Preview_NandNode.shader | 28 + .../Previews/Preview_NandNode.shader.meta | 16 + .../Previews/Preview_NegateNode.shader | 26 + .../Previews/Preview_NegateNode.shader.meta | 16 + .../Previews/Preview_NodeMasking.shader | 59 + .../Previews/Preview_NodeMasking.shader.meta | 16 + .../Preview_NoiseGeneratorNode.shader | 272 + .../Preview_NoiseGeneratorNode.shader.meta | 16 + .../Preview_NormalVertexDataNode.shader | 21 + .../Preview_NormalVertexDataNode.shader.meta | 16 + .../Previews/Preview_NormalizeNode.shader | 26 + .../Preview_NormalizeNode.shader.meta | 16 + .../Previews/Preview_NotNode.shader | 26 + .../Previews/Preview_NotNode.shader.meta | 16 + .../Preview_ObjSpaceLightDirHlpNode.shader | 23 + ...review_ObjSpaceLightDirHlpNode.shader.meta | 16 + .../Preview_ObjSpaceViewDirHlpNode.shader | 26 + ...Preview_ObjSpaceViewDirHlpNode.shader.meta | 16 + .../Preview_ObjectPositionNode.shader | 22 + .../Preview_ObjectPositionNode.shader.meta | 16 + .../Previews/Preview_ObjectScaleNode.shader | 38 + .../Preview_ObjectScaleNode.shader.meta | 16 + .../Previews/Preview_ObjectToClipPos.shader | 29 + .../Preview_ObjectToClipPos.shader.meta | 16 + .../Previews/Preview_ObjectToViewPos.shader | 30 + .../Preview_ObjectToViewPos.shader.meta | 16 + .../Preview_ObjectToWorldTransfNode.shader | 26 + ...review_ObjectToWorldTransfNode.shader.meta | 16 + .../Previews/Preview_OneMinusNode.shader | 26 + .../Previews/Preview_OneMinusNode.shader.meta | 16 + .../Previews/Preview_OrthoParams.shader | 20 + .../Previews/Preview_OrthoParams.shader.meta | 16 + .../Previews/Preview_PannerNode.shader | 41 + .../Previews/Preview_PannerNode.shader.meta | 16 + .../Preview_ParallaxMappingNode.shader | 45 + .../Preview_ParallaxMappingNode.shader.meta | 16 + .../Previews/Preview_ParallaxOffset.shader | 36 + .../Preview_ParallaxOffset.shader.meta | 16 + .../Previews/Preview_PiNode.shader | 22 + .../Previews/Preview_PiNode.shader.meta | 16 + .../Previews/Preview_PosVertexDataNode.shader | 21 + .../Preview_PosVertexDataNode.shader.meta | 16 + .../Previews/Preview_PositionNode.shader | 64 + .../Previews/Preview_PositionNode.shader.meta | 16 + .../Previews/Preview_PosterizeNode.shader | 36 + .../Preview_PosterizeNode.shader.meta | 16 + .../Previews/Preview_PowerNode.shader | 30 + .../Previews/Preview_PowerNode.shader.meta | 16 + .../Preview_PrimitiveIDVariableNode.shader | 20 + ...review_PrimitiveIDVariableNode.shader.meta | 16 + .../Previews/Preview_ProjectionParams.shader | 20 + .../Preview_ProjectionParams.shader.meta | 16 + .../Previews/Preview_RGBToHSVNode.shader | 38 + .../Previews/Preview_RGBToHSVNode.shader.meta | 16 + .../Previews/Preview_RadiansOpNode.shader | 26 + .../Preview_RadiansOpNode.shader.meta | 16 + .../Previews/Preview_RangedFloatNode.shader | 25 + .../Preview_RangedFloatNode.shader.meta | 16 + .../Previews/Preview_ReciprocalNode.shader | 30 + .../Preview_ReciprocalNode.shader.meta | 16 + .../Previews/Preview_ReflectOpNode.shader | 30 + .../Preview_ReflectOpNode.shader.meta | 16 + .../Previews/Preview_ReflectionProbe.shader | 68 + .../Preview_ReflectionProbe.shader.meta | 20 + .../Previews/Preview_RefractOpVec.shader | 33 + .../Previews/Preview_RefractOpVec.shader.meta | 16 + .../Preview_RegisterLocalVarNode.shader | 26 + .../Preview_RegisterLocalVarNode.shader.meta | 16 + .../Previews/Preview_RelayNode.shader | 26 + .../Previews/Preview_RelayNode.shader.meta | 16 + .../Previews/Preview_RotatorNode.shader | 44 + .../Previews/Preview_RotatorNode.shader.meta | 16 + .../Previews/Preview_RoundOpNode.shader | 26 + .../Previews/Preview_RoundOpNode.shader.meta | 16 + .../Previews/Preview_RsqrtOpNode.shader | 26 + .../Previews/Preview_RsqrtOpNode.shader.meta | 16 + .../Previews/Preview_SamplerNode.shader | 139 + .../Previews/Preview_SamplerNode.shader.meta | 16 + .../Previews/Preview_SaturateNode.shader | 26 + .../Previews/Preview_SaturateNode.shader.meta | 16 + .../Preview_ScaleAndOffsetNode.shader | 34 + .../Preview_ScaleAndOffsetNode.shader.meta | 16 + .../Previews/Preview_ScaleNode.shader | 28 + .../Previews/Preview_ScaleNode.shader.meta | 16 + .../Previews/Preview_ScreenParams.shader | 20 + .../Previews/Preview_ScreenParams.shader.meta | 16 + .../Preview_ScreenPosInputsNode.shader | 92 + .../Preview_ScreenPosInputsNode.shader.meta | 16 + .../Previews/Preview_ShadeVertexLights.shader | 35 + .../Preview_ShadeVertexLights.shader.meta | 16 + .../Previews/Preview_SignOpNode.shader | 26 + .../Previews/Preview_SignOpNode.shader.meta | 16 + .../Previews/Preview_SimpleAddOpNode.shader | 67 + .../Preview_SimpleAddOpNode.shader.meta | 16 + .../Preview_SimpleContrastNode.shader | 40 + .../Preview_SimpleContrastNode.shader.meta | 16 + .../Preview_SimpleDivideOpNode.shader | 30 + .../Preview_SimpleDivideOpNode.shader.meta | 16 + .../Previews/Preview_SimpleMaxOp.shader | 30 + .../Previews/Preview_SimpleMaxOp.shader.meta | 16 + .../Previews/Preview_SimpleMinNode.shader | 30 + .../Preview_SimpleMinNode.shader.meta | 16 + .../Preview_SimpleMultiplyOpNode.shader | 281 + .../Preview_SimpleMultiplyOpNode.shader.meta | 16 + .../Preview_SimpleRemainderNode.shader | 30 + .../Preview_SimpleRemainderNode.shader.meta | 16 + .../Preview_SimpleSubtractOpNode.shader | 30 + .../Preview_SimpleSubtractOpNode.shader.meta | 16 + .../Previews/Preview_SimpleTimeNode.shader | 30 + .../Preview_SimpleTimeNode.shader.meta | 16 + .../Preview_SimplifiedFModOpNode.shader | 30 + .../Preview_SimplifiedFModOpNode.shader.meta | 16 + .../Previews/Preview_SinOpNode.shader | 26 + .../Previews/Preview_SinOpNode.shader.meta | 16 + .../Previews/Preview_SinTimeNode.shader | 26 + .../Previews/Preview_SinTimeNode.shader.meta | 16 + .../Previews/Preview_SinhOpNode.shader | 26 + .../Previews/Preview_SinhOpNode.shader.meta | 16 + .../Previews/Preview_SmoothstepOpNode.shader | 33 + .../Preview_SmoothstepOpNode.shader.meta | 16 + .../Previews/Preview_SqrtOpNode.shader | 26 + .../Previews/Preview_SqrtOpNode.shader.meta | 16 + .../Previews/Preview_StaticSwitchNode.shader | 60 + .../Preview_StaticSwitchNode.shader.meta | 16 + .../Previews/Preview_StepOpNode.shader | 30 + .../Previews/Preview_StepOpNode.shader.meta | 16 + .../Previews/Preview_SummedBlendNode.shader | 86 + .../Preview_SummedBlendNode.shader.meta | 16 + .../Previews/Preview_SwitchByFaceNode.shader | 30 + .../Preview_SwitchByFaceNode.shader.meta | 16 + .../Preview_SwitchBySRPVersionNode.shader | 51 + ...Preview_SwitchBySRPVersionNode.shader.meta | 16 + .../Previews/Preview_SwitchNode.shader | 60 + .../Previews/Preview_SwitchNode.shader.meta | 16 + .../Previews/Preview_SwizzleNode.shader | 28 + .../Previews/Preview_SwizzleNode.shader.meta | 16 + .../Previews/Preview_TFHCCompareEqual.shader | 36 + .../Preview_TFHCCompareEqual.shader.meta | 16 + .../Preview_TFHCCompareGreater.shader | 36 + .../Preview_TFHCCompareGreater.shader.meta | 16 + .../Preview_TFHCCompareGreaterEqual.shader | 36 + ...review_TFHCCompareGreaterEqual.shader.meta | 16 + .../Preview_TFHCCompareLessNode.shader | 36 + .../Preview_TFHCCompareLessNode.shader.meta | 16 + .../Preview_TFHCCompareLowerEqual.shader | 36 + .../Preview_TFHCCompareLowerEqual.shader.meta | 16 + .../Preview_TFHCCompareNotEqual.shader | 36 + .../Preview_TFHCCompareNotEqual.shader.meta | 16 + .../Preview_TFHCCompareWithRange.shader | 39 + .../Preview_TFHCCompareWithRange.shader.meta | 16 + .../Preview_TFHCFlipBookUVAnimation.shader | 95 + ...review_TFHCFlipBookUVAnimation.shader.meta | 16 + .../Previews/Preview_TFHCIf.shader | 42 + .../Previews/Preview_TFHCIf.shader.meta | 16 + .../Previews/Preview_TFHCPixelateUV.shader | 36 + .../Preview_TFHCPixelateUV.shader.meta | 16 + .../Previews/Preview_TFHCRemap.shader | 50 + .../Previews/Preview_TFHCRemap.shader.meta | 16 + .../Previews/Preview_TanOpNode.shader | 26 + .../Previews/Preview_TanOpNode.shader.meta | 16 + .../Preview_TangentSignVertexDataNode.shader | 32 + ...view_TangentSignVertexDataNode.shader.meta | 16 + .../Preview_TangentVertexDataNode.shader | 22 + .../Preview_TangentVertexDataNode.shader.meta | 16 + .../Previews/Preview_TanhOpNode.shader | 26 + .../Previews/Preview_TanhOpNode.shader.meta | 16 + .../Previews/Preview_TauNode.shader | 20 + .../Previews/Preview_TauNode.shader.meta | 16 + .../Preview_TemplateShaderProperty.shader | 48 + ...Preview_TemplateShaderProperty.shader.meta | 16 + .../Preview_TexCoordVertexDataNode.shader | 20 + ...Preview_TexCoordVertexDataNode.shader.meta | 16 + .../Previews/Preview_TexelSize.shader | 84 + .../Previews/Preview_TexelSize.shader.meta | 16 + .../Previews/Preview_Texture2D.shader | 20 + .../Previews/Preview_Texture2D.shader.meta | 16 + .../Previews/Preview_TextureArrayNode.shader | 64 + .../Preview_TextureArrayNode.shader.meta | 16 + .../Preview_TextureCoordinatesNode.shader | 30 + ...Preview_TextureCoordinatesNode.shader.meta | 16 + .../Preview_TexturePropertyNode.shader | 84 + .../Preview_TexturePropertyNode.shader.meta | 16 + .../Previews/Preview_TextureTransform.shader | 91 + .../Preview_TextureTransform.shader.meta | 16 + .../Previews/Preview_TimeNode.shader | 26 + .../Previews/Preview_TimeNode.shader.meta | 16 + .../Previews/Preview_ToggleSwitchNode.shader | 31 + .../Preview_ToggleSwitchNode.shader.meta | 16 + .../Previews/Preview_TriplanarNode.shader | 104 + .../Preview_TriplanarNode.shader.meta | 16 + .../Previews/Preview_TruncOpNode.shader | 26 + .../Previews/Preview_TruncOpNode.shader.meta | 16 + .../Previews/Preview_TwoSidedSignNode.shader | 20 + .../Preview_TwoSidedSignNode.shader.meta | 16 + .../Preview_UnpackScaleNormalNode.shader | 34 + .../Preview_UnpackScaleNormalNode.shader.meta | 16 + .../Previews/Preview_Vector2Node.shader | 25 + .../Previews/Preview_Vector2Node.shader.meta | 16 + .../Previews/Preview_Vector3Node.shader | 25 + .../Previews/Preview_Vector3Node.shader.meta | 16 + .../Previews/Preview_Vector4Node.shader | 25 + .../Previews/Preview_Vector4Node.shader.meta | 16 + .../Preview_VertexBinormalNode.shader | 30 + .../Preview_VertexBinormalNode.shader.meta | 16 + .../Previews/Preview_VertexColorNode.shader | 20 + .../Preview_VertexColorNode.shader.meta | 16 + .../Preview_VertexIdVariableNode.shader | 40 + .../Preview_VertexIdVariableNode.shader.meta | 16 + .../Previews/Preview_VertexTangentNode.shader | 32 + .../Preview_VertexTangentNode.shader.meta | 16 + .../Preview_ViewDirInputsCoordNode.shader | 101 + ...Preview_ViewDirInputsCoordNode.shader.meta | 16 + .../Previews/Preview_ViewVector.shader | 101 + .../Previews/Preview_ViewVector.shader.meta | 16 + .../Previews/Preview_VoronoiNode.shader | 265 + .../Previews/Preview_VoronoiNode.shader.meta | 16 + .../Previews/Preview_WeightedBlendNode.shader | 85 + .../Preview_WeightedBlendNode.shader.meta | 16 + .../Previews/Preview_WireNode.shader | 26 + .../Previews/Preview_WireNode.shader.meta | 16 + .../Previews/Preview_WorldNormalVector.shader | 66 + .../Preview_WorldNormalVector.shader.meta | 16 + .../Preview_WorldPosInputsNode.shader | 22 + .../Preview_WorldPosInputsNode.shader.meta | 16 + .../Preview_WorldReflectionVector.shader | 75 + .../Preview_WorldReflectionVector.shader.meta | 16 + .../Preview_WorldSpaceCameraPos.shader | 21 + .../Preview_WorldSpaceCameraPos.shader.meta | 16 + .../Preview_WorldSpaceLightDirHlpNode.shader | 23 + ...view_WorldSpaceLightDirHlpNode.shader.meta | 16 + .../Preview_WorldSpaceLightPosNode.shader | 34 + ...Preview_WorldSpaceLightPosNode.shader.meta | 16 + .../Preview_WorldSpaceViewDirHlpNode.shader | 26 + ...eview_WorldSpaceViewDirHlpNode.shader.meta | 16 + .../Preview_WorldToObjectTransfNode.shader | 26 + ...review_WorldToObjectTransfNode.shader.meta | 16 + .../Preview_WorldTransformParams.shader | 21 + .../Preview_WorldTransformParams.shader.meta | 16 + .../Previews/Preview_ZBufferParams.shader | 20 + .../Preview_ZBufferParams.shader.meta | 16 + .../Previews/TextureArrayInspector.shader | 30 + .../TextureArrayInspector.shader.meta | 16 + .../EditorResources/ShaderFunctions.meta | 9 + .../ShaderFunctions/Alpha Merge.asset | 3 + .../ShaderFunctions/Alpha Merge.asset.meta | 16 + .../ShaderFunctions/Alpha Split.asset | 3 + .../ShaderFunctions/Alpha Split.asset.meta | 16 + .../EditorResources/ShaderFunctions/And.asset | 3 + .../ShaderFunctions/And.asset.meta | 15 + .../ShaderFunctions/Bacteria Smoothstep.asset | 3 + .../Bacteria Smoothstep.asset.meta | 16 + .../ShaderFunctions/Bacteria.asset | 3 + .../ShaderFunctions/Bacteria.asset.meta | 15 + .../ShaderFunctions/Bicubic Precompute.asset | 3 + .../Bicubic Precompute.asset.meta | 16 + .../ShaderFunctions/Bicubic Sample.asset | 3 + .../ShaderFunctions/Bicubic Sample.asset.meta | 16 + .../Bidirectional Parallax Mapping.asset | 3 + .../Bidirectional Parallax Mapping.asset.meta | 16 + .../ShaderFunctions/Blackbody.asset | 3 + .../ShaderFunctions/Blackbody.asset.meta | 15 + .../Blinn-Phong Half Vector.asset | 3 + .../Blinn-Phong Half Vector.asset.meta | 16 + .../ShaderFunctions/Blinn-Phong Light.asset | 3 + .../Blinn-Phong Light.asset.meta | 16 + .../ShaderFunctions/BlinnPhongLightWrap.asset | 3 + .../BlinnPhongLightWrap.asset.meta | 15 + .../ShaderFunctions/BoxMask.asset | 3 + .../ShaderFunctions/BoxMask.asset.meta | 16 + .../ShaderFunctions/Bricks Pattern.asset | 3 + .../ShaderFunctions/Bricks Pattern.asset.meta | 16 + .../ShaderFunctions/Checkerboard.asset | 3 + .../ShaderFunctions/Checkerboard.asset.meta | 15 + .../ShaderFunctions/Color Mask.asset | 3 + .../ShaderFunctions/Color Mask.asset.meta | 16 + .../ShaderFunctions/Compute Mip Level.asset | 3 + .../Compute Mip Level.asset.meta | 16 + .../ShaderFunctions/ComputeFilterWidth.asset | 3 + .../ComputeFilterWidth.asset.meta | 15 + .../ShaderFunctions/ConstantBiasScale.asset | 3 + .../ConstantBiasScale.asset.meta | 15 + .../ShaderFunctions/CotangentFrame.asset | 3 + .../ShaderFunctions/CotangentFrame.asset.meta | 15 + .../Create Orthogonal Vector.asset | 3 + .../Create Orthogonal Vector.asset.meta | 16 + .../Custom Screen Position.asset | 3 + .../Custom Screen Position.asset.meta | 16 + .../Decode Directional Lighmap.asset | 3 + .../Decode Directional Lighmap.asset.meta | 16 + .../DepthMaskedRefraction.asset | 3 + .../DepthMaskedRefraction.asset.meta | 15 + .../Derive Tangent Basis.asset | 3 + .../Derive Tangent Basis.asset.meta | 16 + .../ShaderFunctions/Detail Albedo.asset | 3 + .../ShaderFunctions/Detail Albedo.asset.meta | 16 + .../ShaderFunctions/Device Depth.asset | 3 + .../ShaderFunctions/Device Depth.asset.meta | 16 + .../ShaderFunctions/Dielectric Specular.asset | 3 + .../Dielectric Specular.asset.meta | 16 + .../ShaderFunctions/Dots Pattern.asset | 3 + .../ShaderFunctions/Dots Pattern.asset.meta | 16 + .../ShaderFunctions/Ellipse.asset | 3 + .../ShaderFunctions/Ellipse.asset.meta | 15 + .../ShaderFunctions/Fade Transition.asset | 3 + .../Fade Transition.asset.meta | 16 + .../ShaderFunctions/FetchHDColorPyramid.asset | 3 + .../FetchHDColorPyramid.asset.meta | 15 + .../ShaderFunctions/FetchLightmapValue.asset | 3 + .../FetchLightmapValue.asset.meta | 16 + .../ShaderFunctions/Flipbook.asset | 3 + .../ShaderFunctions/Flipbook.asset.meta | 15 + .../ShaderFunctions/Flow.asset | 3 + .../ShaderFunctions/Flow.asset.meta | 15 + .../Four Splats First Pass Terrain.asset | 3 + .../Four Splats First Pass Terrain.asset.meta | 16 + .../ShaderFunctions/Grid.asset | 3 + .../ShaderFunctions/Grid.asset.meta | 15 + .../ShaderFunctions/HDRP Decal UVs.asset | 3 + .../ShaderFunctions/HDRP Decal UVs.asset.meta | 16 + .../ShaderFunctions/Half Lambert Term.asset | 3 + .../Half Lambert Term.asset.meta | 16 + .../Height-based Blending.asset | 3 + .../Height-based Blending.asset.meta | 16 + .../ShaderFunctions/Herringbone.asset | 3 + .../ShaderFunctions/Herringbone.asset.meta | 15 + .../ShaderFunctions/Hex Lattice.asset | 3 + .../ShaderFunctions/Hex Lattice.asset.meta | 16 + .../ShaderFunctions/Houndstooth.asset | 3 + .../ShaderFunctions/Houndstooth.asset.meta | 15 + .../ShaderFunctions/Inverse Lerp.asset | 3 + .../ShaderFunctions/Inverse Lerp.asset.meta | 16 + .../ShaderFunctions/Lambert Light.asset | 3 + .../ShaderFunctions/Lambert Light.asset.meta | 16 + .../ShaderFunctions/Lerp White To.asset | 3 + .../ShaderFunctions/Lerp White To.asset.meta | 16 + .../ShaderFunctions/Lightmap UV.asset | 3 + .../ShaderFunctions/Lightmap UV.asset.meta | 16 + .../ShaderFunctions/Metal Reflectance.asset | 3 + .../Metal Reflectance.asset.meta | 16 + .../ShaderFunctions/Midtones Control.asset | 3 + .../Midtones Control.asset.meta | 16 + .../ShaderFunctions/Noise Sine Wave.asset | 3 + .../Noise Sine Wave.asset.meta | 16 + .../Non Stereo Screen Pos.asset | 3 + .../Non Stereo Screen Pos.asset.meta | 16 + .../ShaderFunctions/Normal Face.asset | 3 + .../ShaderFunctions/Normal Face.asset.meta | 16 + .../ShaderFunctions/Normal From Height.asset | 3 + .../Normal From Height.asset.meta | 16 + .../ShaderFunctions/Normal From Texture.asset | 3 + .../Normal From Texture.asset.meta | 16 + .../Normal Reconstruct Z.asset | 3 + .../Normal Reconstruct Z.asset.meta | 16 + .../ShaderFunctions/NormalCreate.asset | 3 + .../ShaderFunctions/NormalCreate.asset.meta | 15 + .../EditorResources/ShaderFunctions/Or.asset | 3 + .../ShaderFunctions/Or.asset.meta | 15 + .../ShaderFunctions/PerturbNormal.asset | 3 + .../ShaderFunctions/PerturbNormal.asset.meta | 15 + .../ShaderFunctions/PerturbNormalHQ.asset | 3 + .../PerturbNormalHQ.asset.meta | 15 + .../ShaderFunctions/Polar Coordinates.asset | 3 + .../Polar Coordinates.asset.meta | 16 + .../ShaderFunctions/Polygon.asset | 3 + .../ShaderFunctions/Polygon.asset.meta | 15 + .../PreparePerturbNormalHQ.asset | 3 + .../PreparePerturbNormalHQ.asset.meta | 15 + .../ShaderFunctions/Procedural Sample.asset | 3 + .../Procedural Sample.asset.meta | 16 + .../ShaderFunctions/Projection.asset | 3 + .../ShaderFunctions/Projection.asset.meta | 15 + .../ShaderFunctions/Radial Shear.asset | 3 + .../ShaderFunctions/Radial Shear.asset.meta | 16 + .../ShaderFunctions/RadialUVDistortion.asset | 3 + .../RadialUVDistortion.asset.meta | 15 + .../ShaderFunctions/Random Range.asset | 3 + .../ShaderFunctions/Random Range.asset.meta | 16 + ...econstruct World Position From Depth.asset | 3 + ...truct World Position From Depth.asset.meta | 16 + .../ShaderFunctions/Rectangle.asset | 3 + .../ShaderFunctions/Rectangle.asset.meta | 15 + .../ShaderFunctions/Rejection.asset | 3 + .../ShaderFunctions/Rejection.asset.meta | 15 + .../ShaderFunctions/Replace Color.asset | 3 + .../ShaderFunctions/Replace Color.asset.meta | 16 + .../ShaderFunctions/Rounded Polygon.asset | 3 + .../Rounded Polygon.asset.meta | 16 + .../ShaderFunctions/Rounded Rectangle.asset | 3 + .../Rounded Rectangle.asset.meta | 16 + .../SRP Additional Light.asset | 3 + .../SRP Additional Light.asset.meta | 16 + .../ShaderFunctions/Sample Lightmap.asset | 3 + .../Sample Lightmap.asset.meta | 16 + .../ShaderFunctions/Saturation.asset | 3 + .../ShaderFunctions/Saturation.asset.meta | 15 + .../ShaderFunctions/Sawtooth Wave.asset | 3 + .../ShaderFunctions/Sawtooth Wave.asset.meta | 16 + .../ShaderFunctions/Shadow Mask.asset | 3 + .../ShaderFunctions/Shadow Mask.asset.meta | 16 + .../ShaderFunctions/Simple HUE.asset | 3 + .../ShaderFunctions/Simple HUE.asset.meta | 16 + .../ShaderFunctions/Smooth Wave.asset | 3 + .../ShaderFunctions/Smooth Wave.asset.meta | 16 + .../ShaderFunctions/SphereMask.asset | 3 + .../ShaderFunctions/SphereMask.asset.meta | 15 + .../ShaderFunctions/Spherize.asset | 3 + .../ShaderFunctions/Spherize.asset.meta | 15 + .../ShaderFunctions/Spiral.asset | 3 + .../ShaderFunctions/Spiral.asset.meta | 15 + .../ShaderFunctions/Square Wave.asset | 3 + .../ShaderFunctions/Square Wave.asset.meta | 16 + .../ShaderFunctions/Square.asset | 3 + .../ShaderFunctions/Square.asset.meta | 15 + .../ShaderFunctions/Step Antialiasing.asset | 3 + .../Step Antialiasing.asset.meta | 16 + .../ShaderFunctions/Stereo Screen Pos.asset | 3 + .../Stereo Screen Pos.asset.meta | 16 + .../ShaderFunctions/Stripes.asset | 3 + .../ShaderFunctions/Stripes.asset.meta | 15 + .../Terrain Wind Animate Vertex.asset | 3 + .../Terrain Wind Animate Vertex.asset.meta | 16 + .../ShaderFunctions/Terrain Wind Value.asset | 3 + .../Terrain Wind Value.asset.meta | 16 + .../ShaderFunctions/Triangle Wave.asset | 3 + .../ShaderFunctions/Triangle Wave.asset.meta | 16 + .../ShaderFunctions/Truchet.asset | 3 + .../ShaderFunctions/Truchet.asset.meta | 15 + .../ShaderFunctions/Twirl.asset | 3 + .../ShaderFunctions/Twirl.asset.meta | 15 + .../UI-Sprite Effect Layer.asset | 3 + .../UI-Sprite Effect Layer.asset.meta | 16 + .../URP Tangent To World Normal.asset | 3 + .../URP Tangent To World Normal.asset.meta | 16 + .../ShaderFunctions/Whirl.asset | 3 + .../ShaderFunctions/Whirl.asset.meta | 15 + .../ShaderFunctions/World Normal Face.asset | 3 + .../World Normal Face.asset.meta | 16 + .../ShaderFunctions/Zig Zag.asset | 3 + .../ShaderFunctions/Zig Zag.asset.meta | 16 + .../EditorResources/ShaderLibrary.meta | 9 + .../ShaderLibrary/ShaderLibrary.txt | 3 + .../ShaderLibrary/ShaderLibrary.txt.meta | 15 + .../Plugins/EditorResources}/Shaders.meta | 4 +- .../Shaders/ASESShaderSelectorUnlit.shader | 39 + .../ASESShaderSelectorUnlit.shader.meta | 16 + .../Shaders/Unlit-ColoredAlpha.shader | 165 + .../Shaders/Unlit-ColoredAlpha.shader.meta | 20 + .../Plugins/EditorResources/Templates.meta | 9 + .../EditorResources/Templates/CustomRT.meta} | 2 +- .../Templates/CustomRT/CustomRTInit.shader | 62 + .../CustomRT/CustomRTInit.shader.meta | 15 + .../Templates/CustomRT/CustomRTUpdate.shader | 159 + .../CustomRT/CustomRTUpdate.shader.meta | 15 + .../Templates/HDRP 10x.unitypackage | 3 + .../Templates/HDRP 10x.unitypackage.meta | 14 + .../Templates/HDRP 12x.unitypackage | 3 + .../Templates/HDRP 12x.unitypackage.meta | 14 + .../Templates/HDRP 14x.unitypackage | 3 + .../Templates/HDRP 14x.unitypackage.meta | 14 + .../Templates/HDRP 15x.unitypackage | 3 + .../Templates/HDRP 15x.unitypackage.meta | 14 + .../Templates/HDRP 16x.unitypackage | 3 + .../Templates/HDRP 16x.unitypackage.meta | 14 + .../Templates/HDRP 17x.unitypackage | 3 + .../Templates/HDRP 17x.unitypackage.meta | 14 + .../EditorResources/Templates/Legacy.meta | 9 + .../Templates/Legacy/Lit.shader | 2302 +++++++ .../Templates/Legacy/Lit.shader.meta | 16 + .../Templates/Legacy/MultiPassUnlit.shader | 297 + .../Legacy/MultiPassUnlit.shader.meta | 16 + .../Templates/Legacy/PPStack.shader | 89 + .../Templates/Legacy/PPStack.shader.meta | 16 + .../Legacy/Particle Alpha Blend.shader | 123 + .../Legacy/Particle Alpha Blend.shader.meta | 17 + .../Templates/Legacy/PostProcess.shader | 94 + .../Templates/Legacy/PostProcess.shader.meta | 16 + .../Templates/Legacy/Sprites-Default.shader | 114 + .../Legacy/Sprites-Default.shader.meta | 16 + .../Templates/Legacy/Unlit.shader | 103 + .../Templates/Legacy/Unlit.shader.meta | 16 + .../Templates/Legacy/UnlitLightmap.shader | 127 + .../Legacy/UnlitLightmap.shader.meta | 16 + .../EditorResources/Templates/UI.meta} | 2 +- .../Templates/UI/UI-Default.shader | 151 + .../Templates/UI/UI-Default.shader.meta | 16 + .../Templates/URP 10x.unitypackage | 3 + .../Templates/URP 10x.unitypackage.meta | 14 + .../Templates/URP 12x.unitypackage | 3 + .../Templates/URP 12x.unitypackage.meta | 14 + .../Templates/URP 14x.unitypackage | 3 + .../Templates/URP 14x.unitypackage.meta | 14 + .../Templates/URP 15x.unitypackage | 3 + .../Templates/URP 15x.unitypackage.meta | 14 + .../Templates/URP 16x.unitypackage | 3 + .../Templates/URP 16x.unitypackage.meta | 14 + .../Templates/URP 17x.unitypackage | 3 + .../Templates/URP 17x.unitypackage.meta | 14 + .../EditorResources/Templates}/URP.meta | 2 +- .../Templates/URP/2DCustomLit.shader | 768 +++ .../Templates/URP/2DCustomLit.shader.meta} | 6 +- .../Templates/URP/2DLit.shader | 752 ++ .../Templates/URP/2DLit.shader.meta} | 6 +- .../Templates/URP/2DUnlit.shader | 592 ++ .../Templates/URP/2DUnlit.shader.meta} | 6 +- .../Templates/URP/Decal.shader | 3609 ++++++++++ .../Templates/URP/Decal.shader.meta} | 6 +- .../EditorResources/Templates/URP/Lit.shader | 3981 +++++++++++ .../Templates/URP/Lit.shader.meta | 12 + .../Templates/URP/Unlit.shader | 2966 ++++++++ .../Templates/URP/Unlit.shader.meta | 9 + .../Plugins/EditorResources/Textures.meta | 9 + .../EditorResources/Textures/About.png | 3 + .../EditorResources/Textures/About.png.meta | 83 + .../EditorResources/Textures/Icon64.png | 3 + .../EditorResources/Textures/Icon64.png.meta | 89 + .../EditorResources/Textures/black.png | 3 + .../EditorResources/Textures/black.png.meta | 66 + .../Plugins/EditorResources/Textures/blue.png | 3 + .../EditorResources/Textures/blue.png.meta | 66 + .../Plugins/EditorResources/Textures/flat.png | 3 + .../EditorResources/Textures/flat.png.meta | 66 + .../EditorResources/Textures/green.png | 3 + .../EditorResources/Textures/green.png.meta | 66 + .../Plugins/EditorResources/Textures/grey.png | 3 + .../EditorResources/Textures/grey.png.meta | 66 + .../Plugins/EditorResources/Textures/red.png | 3 + .../EditorResources/Textures/red.png.meta | 66 + .../EditorResources/Textures/white.png | 3 + .../EditorResources/Textures/white.png.meta | 66 + .../Plugins/EditorResources/UI.meta | 9 + .../Plugins/EditorResources/UI/Buttons.meta | 9 + .../EditorResources/UI/Buttons/AddToList.png | 3 + .../UI/Buttons/AddToList.png.meta | 83 + .../EditorResources/UI/Buttons/Checkmark.png | 3 + .../UI/Buttons/Checkmark.png.meta | 83 + .../UI/Buttons/CircularToggle_OFF_Dark.png | 3 + .../Buttons/CircularToggle_OFF_Dark.png.meta | 83 + .../UI/Buttons/CircularToggle_ON_Dark.png | 3 + .../Buttons/CircularToggle_ON_Dark.png.meta | 83 + .../EditorResources/UI/Buttons/CleanupOFF.png | 3 + .../UI/Buttons/CleanupOFF.png.meta | 83 + .../UI/Buttons/CleanupOFFNew.png | 3 + .../UI/Buttons/CleanupOFFNew.png.meta | 83 + .../EditorResources/UI/Buttons/CleanupON.png | 3 + .../UI/Buttons/CleanupON.png.meta | 83 + .../UI/Buttons/CleanupONNew.png | 3 + .../UI/Buttons/CleanupONNew.png.meta | 83 + .../UI/Buttons/CustomExpAddIconActive.png | 3 + .../Buttons/CustomExpAddIconActive.png.meta | 83 + .../UI/Buttons/CustomExpAddIconNormal.png | 3 + .../Buttons/CustomExpAddIconNormal.png.meta | 83 + .../UI/Buttons/CustomExpRemoveIconActive.png | 3 + .../CustomExpRemoveIconActive.png.meta | 83 + .../UI/Buttons/CustomExpRemoveIconNormal.png | 3 + .../CustomExpRemoveIconNormal.png.meta | 83 + .../EditorResources/UI/Buttons/FitView.png | 3 + .../UI/Buttons/FitView.png.meta | 83 + .../EditorResources/UI/Buttons/FocusNode.png | 3 + .../UI/Buttons/FocusNode.png.meta | 83 + .../EditorResources/UI/Buttons/Help.png | 3 + .../EditorResources/UI/Buttons/Help.png.meta | 83 + .../EditorResources/UI/Buttons/Help2.png | 3 + .../EditorResources/UI/Buttons/Help2.png.meta | 83 + .../UI/Buttons/ItemCleanupOFF.png | 3 + .../UI/Buttons/ItemCleanupOFF.png.meta | 83 + .../UI/Buttons/ItemCleanupON.png | 3 + .../UI/Buttons/ItemCleanupON.png.meta | 83 + .../EditorResources/UI/Buttons/Library.png | 3 + .../UI/Buttons/Library.png.meta | 83 + .../EditorResources/UI/Buttons/LiveOFF.png | 3 + .../UI/Buttons/LiveOFF.png.meta | 83 + .../EditorResources/UI/Buttons/LiveON.png | 3 + .../UI/Buttons/LiveON.png.meta | 83 + .../UI/Buttons/LivePending.png | 3 + .../UI/Buttons/LivePending.png.meta | 83 + .../UI/Buttons/MaximizeWindow.png | 3 + .../UI/Buttons/MaximizeWindow.png.meta | 83 + .../UI/Buttons/MiniBotLeftOff.png | 3 + .../UI/Buttons/MiniBotLeftOff.png.meta | 70 + .../UI/Buttons/MiniBotLeftOffHover.png | 3 + .../UI/Buttons/MiniBotLeftOffHover.png.meta | 70 + .../UI/Buttons/MiniBotLeftOn.png | 3 + .../UI/Buttons/MiniBotLeftOn.png.meta | 70 + .../UI/Buttons/MiniBotLeftOnHover.png | 3 + .../UI/Buttons/MiniBotLeftOnHover.png.meta | 70 + .../UI/Buttons/MiniBotMidOff.png | 3 + .../UI/Buttons/MiniBotMidOff.png.meta | 70 + .../UI/Buttons/MiniBotMidOffHover.png | 3 + .../UI/Buttons/MiniBotMidOffHover.png.meta | 70 + .../UI/Buttons/MiniBotMidOn.png | 3 + .../UI/Buttons/MiniBotMidOn.png.meta | 70 + .../UI/Buttons/MiniBotMidOnHover.png | 3 + .../UI/Buttons/MiniBotMidOnHover.png.meta | 70 + .../UI/Buttons/MiniBotRightOff.png | 3 + .../UI/Buttons/MiniBotRightOff.png.meta | 70 + .../UI/Buttons/MiniBotRightOffHover.png | 3 + .../UI/Buttons/MiniBotRightOffHover.png.meta | 70 + .../UI/Buttons/MiniBotRightOn.png | 3 + .../UI/Buttons/MiniBotRightOn.png.meta | 70 + .../UI/Buttons/MiniBotRightOnHover.png | 3 + .../UI/Buttons/MiniBotRightOnHover.png.meta | 70 + .../UI/Buttons/MinimizeWindow.png | 3 + .../UI/Buttons/MinimizeWindow.png.meta | 83 + .../EditorResources/UI/Buttons/New.png | 3 + .../EditorResources/UI/Buttons/New.png.meta | 83 + .../EditorResources/UI/Buttons/Open.png | 3 + .../EditorResources/UI/Buttons/Open.png.meta | 83 + .../UI/Buttons/OpenListedShader.png | 3 + .../UI/Buttons/OpenListedShader.png.meta | 83 + .../UI/Buttons/OpenSourceCodeOFF.PNG | 3 + .../UI/Buttons/OpenSourceCodeOFF.PNG.meta | 83 + .../UI/Buttons/OpenSourceCodeON.PNG | 3 + .../UI/Buttons/OpenSourceCodeON.PNG.meta | 83 + .../EditorResources/UI/Buttons/Options.png | 3 + .../UI/Buttons/Options.png.meta | 83 + .../UI/Buttons/RemoveFromList.png | 3 + .../UI/Buttons/RemoveFromList.png.meta | 83 + .../UI/Buttons/ResetInspectorIcon.png | 3 + .../UI/Buttons/ResetInspectorIcon.png.meta | 83 + .../EditorResources/UI/Buttons/SaveOFF.png | 3 + .../UI/Buttons/SaveOFF.png.meta | 83 + .../EditorResources/UI/Buttons/SaveON.png | 3 + .../UI/Buttons/SaveON.png.meta | 83 + .../UI/Buttons/SelectionAsTemplate.png | 3 + .../UI/Buttons/SelectionAsTemplate.png.meta | 83 + .../UI/Buttons/ShaderSelectOFF.png | 3 + .../UI/Buttons/ShaderSelectOFF.png.meta | 83 + .../UI/Buttons/ShaderSelectON.png | 3 + .../UI/Buttons/ShaderSelectON.png.meta | 83 + .../EditorResources/UI/Buttons/ShareOFF.png | 3 + .../UI/Buttons/ShareOFF.png.meta | 83 + .../UI/Buttons/SliderHoriz.png | 3 + .../UI/Buttons/SliderHoriz.png.meta | 83 + .../UI/Buttons/TakeScreenshotOFF.png | 3 + .../UI/Buttons/TakeScreenshotOFF.png.meta | 83 + .../UI/Buttons/TransparentPixel.png | 3 + .../UI/Buttons/TransparentPixel.png.meta} | 20 +- .../EditorResources/UI/Buttons/UpdateOFF.png | 3 + .../UI/Buttons/UpdateOFF.png.meta | 83 + .../UI/Buttons/UpdateOutdated.png | 3 + .../UI/Buttons/UpdateOutdated.png.meta | 83 + .../UI/Buttons/UpdateUpToDated.png | 3 + .../UI/Buttons/UpdateUpToDated.png.meta | 83 + .../Plugins/EditorResources/UI/Canvas.meta | 9 + .../UI/Canvas/CircleBackground.png | 3 + .../UI/Canvas/CircleBackground.png.meta | 83 + .../EditorResources/UI/Canvas/Grid128.png | 3 + .../UI/Canvas/Grid128.png.meta | 83 + .../EditorResources/UI/Canvas/LineTex 2.png | 3 + .../UI/Canvas/LineTex 2.png.meta | 92 + .../EditorResources/UI/Canvas/LineTex 3.png | 3 + .../UI/Canvas/LineTex 3.png.meta | 92 + .../EditorResources/UI/Canvas/LineTex 4.png | 3 + .../UI/Canvas/LineTex 4.png.meta | 92 + .../EditorResources/UI/Canvas/LineTex.png | 3 + .../UI/Canvas/LineTex.png.meta | 91 + .../UI/Canvas/MainCanvasTitleBg.png | 3 + .../UI/Canvas/MainCanvasTitleBg.png.meta | 103 + .../EditorResources/UI/Canvas/Material.png | 3 + .../UI/Canvas/Material.png.meta | 103 + .../UI/Canvas/MaterialModeIcon.PNG | 3 + .../UI/Canvas/MaterialModeIcon.PNG.meta | 83 + .../UI/Canvas/MaterialModeIconOFF.png | 3 + .../UI/Canvas/MaterialModeIconOFF.png.meta | 83 + .../UI/Canvas/SelectionBox.png | 3 + .../UI/Canvas/SelectionBox.png.meta | 103 + .../EditorResources/UI/Canvas/Shader.png | 3 + .../EditorResources/UI/Canvas/Shader.png.meta | 103 + .../UI/Canvas/ShaderFunction.png | 3 + .../UI/Canvas/ShaderFunction.png.meta | 103 + .../UI/Canvas/ShaderFunctionIcon.png | 3 + .../UI/Canvas/ShaderFunctionIcon.png.meta | 103 + .../UI/Canvas/ShaderFunctionModeIcon.png | 3 + .../UI/Canvas/ShaderFunctionModeIcon.png.meta | 103 + .../UI/Canvas/ShaderFunctionModeIconOFF.png | 3 + .../Canvas/ShaderFunctionModeIconOFF.png.meta | 83 + .../UI/Canvas/ShaderModeIcon.PNG | 3 + .../UI/Canvas/ShaderModeIcon.PNG.meta | 83 + .../UI/Canvas/ShaderModeIconOFF.png | 3 + .../UI/Canvas/ShaderModeIconOFF.png.meta | 83 + .../UI/Canvas/ShaderModeMatIcon.png | 3 + .../UI/Canvas/ShaderModeMatIcon.png.meta | 83 + .../UI/Canvas/TransparentOverlay.png | 3 + .../UI/Canvas/TransparentOverlay.png.meta | 103 + .../Plugins/EditorResources/UI/Nodes.meta | 9 + .../UI/Nodes/BlueNormalBase.png | 3 + .../UI/Nodes/BlueNormalBase.png.meta | 83 + .../UI/Nodes/BlueNormalBaseLeft.png | 3 + .../UI/Nodes/BlueNormalBaseLeft.png.meta | 83 + .../UI/Nodes/BlueNormalBaseSquare.png | 3 + .../UI/Nodes/BlueNormalBaseSquare.png.meta | 83 + .../UI/Nodes/BlueNormalHeader.png | 3 + .../UI/Nodes/BlueNormalHeader.png.meta | 83 + .../UI/Nodes/ButtonBackground.png | 3 + .../UI/Nodes/ButtonBackground.png.meta | 83 + .../UI/Nodes/CommentNodeBase.png | 3 + .../UI/Nodes/CommentNodeBase.png.meta | 103 + .../UI/Nodes/CommentaryResizeIcon.png | 3 + .../UI/Nodes/CommentaryResizeIcon.png.meta | 83 + .../UI/Nodes/CommentaryResizeIconInv.png | 3 + .../UI/Nodes/CommentaryResizeIconInv.png.meta | 83 + .../UI/Nodes/FlatBackground.png | 3 + .../UI/Nodes/FlatBackground.png.meta | 83 + .../EditorResources/UI/Nodes/GraphButton.png | 3 + .../UI/Nodes/GraphButton.png.meta | 83 + .../UI/Nodes/GraphButtonActive.png | 3 + .../UI/Nodes/GraphButtonActive.png.meta | 83 + .../EditorResources/UI/Nodes/GraphPopup.png | 3 + .../UI/Nodes/GraphPopup.png.meta | 83 + .../UI/Nodes/GrayNormalHeader.png | 3 + .../UI/Nodes/GrayNormalHeader.png.meta | 83 + .../UI/Nodes/GrayNormalHeaderSquare.png | 3 + .../UI/Nodes/GrayNormalHeaderSquare.png.meta | 83 + .../EditorResources/UI/Nodes/NoPreview.png | 3 + .../UI/Nodes/NoPreview.png.meta | 83 + .../EditorResources/UI/Nodes/NodeSelected.png | 3 + .../UI/Nodes/NodeSelected.png.meta | 83 + .../UI/Nodes/NodeSelectedSquare.png | 3 + .../UI/Nodes/NodeSelectedSquare.png.meta | 83 + .../Nodes/ObjectPickerBackgroundOutline.png | 3 + .../ObjectPickerBackgroundOutline.png.meta | 83 + .../EditorResources/UI/Nodes/PopupPicker.png | 3 + .../UI/Nodes/PopupPicker.png.meta | 83 + .../EditorResources/UI/Nodes/PreviewOff.png | 3 + .../UI/Nodes/PreviewOff.png.meta | 83 + .../EditorResources/UI/Nodes/PreviewOn.png | 3 + .../UI/Nodes/PreviewOn.png.meta | 83 + .../UI/Nodes/PropertyPicker.png | 3 + .../UI/Nodes/PropertyPicker.png.meta | 83 + .../UI/Nodes/ShaderFunctionHeaderIcon.png | 3 + .../Nodes/ShaderFunctionHeaderIcon.png.meta | 131 + .../EditorResources/UI/Nodes/SliderButton.png | 3 + .../UI/Nodes/SliderButton.png.meta | 65 + .../UI/Nodes/WhitePortOutline.png | 3 + .../UI/Nodes/WhitePortOutline.png.meta | 91 + .../UI/Nodes/WhitePortSolid.png | 3 + .../UI/Nodes/WhitePortSolid.png.meta | 91 + .../UI/Nodes/WireNodeSelection.png | 3 + .../UI/Nodes/WireNodeSelection.png.meta | 65 + .../External/AmplifyShaderEditor/Readme.txt | 3 + .../AmplifyShaderEditor/Readme.txt.meta | 15 + .../Demo/Demo.unity | 3 - .../Demo/Demo.unity.meta | 8 - .../Demo/Models/Textures/Dragons.png | 3 - .../Demo/Runtime.meta | 9 - .../Demo/Runtime/HBAO.Demo.Runtime.asmdef | 17 - .../Demo/Runtime/HBAOControl.cs | 29 - .../Demo/Runtime/RotateObject.cs | 19 - .../Documentation.meta | 9 - .../Documentation/User Guide.pdf | 3 - .../Documentation/User Guide.pdf.meta | 8 - .../Editor/HBAO.Editor.asmdef.meta | 7 - .../Editor/HBAOEditor.cs | 266 - .../Editor/HBAOGaiaExtension.cs | 140 - .../Editor/Resources.meta | 9 - .../Editor/Resources/hbao.png | 3 - .../Editor/Resources/icon.png | 3 - .../Readme.txt | 3 - .../Runtime.meta | 9 - .../Runtime/HBAO.Runtime.asmdef | 15 - .../Runtime/HBAO.Runtime.asmdef.meta | 7 - .../Runtime/HBAO.cs | 1776 ----- .../Runtime/HBAO.cs.meta | 14 - .../SRP 1/URP/Demo.meta | 8 - .../SRP 1/URP/Demo/Demo.unity | 3 - .../Demo/Post Process Volume Profile.asset | 3 - .../SRP 1/URP/Demo/Prefabs.meta | 8 - .../URP/Demo/Prefabs/Dragons Candle.prefab | 3 - .../SRP 1/URP/Demo/Runtime.meta | 8 - .../HBAO.Demo.Universal.Runtime.asmdef | 18 - .../HBAO.Demo.Universal.Runtime.asmdef.meta | 7 - .../SRP 1/URP/Demo/Runtime/HBAOControl.cs | 61 - .../SRP 1/URP/Demo/Runtime/RotateObject.cs | 19 - .../URP/Editor/HBAO.Universal.Editor.asmdef | 26 - .../Editor/HBAO.Universal.Editor.asmdef.meta | 7 - .../SRP 1/URP/Editor/HBAOEditor.cs | 336 - .../SRP 1/URP/Editor/Resources/hbao_urp.png | 3 - .../SRP 1/URP/Runtime.meta | 8 - .../URP/Runtime/HBAO.Universal.Runtime.asmdef | 24 - .../HBAO.Universal.Runtime.asmdef.meta | 7 - .../SRP 1/URP/Runtime/HBAO.cs | 631 -- .../SRP 1/URP/Runtime/HBAORendererFeature.cs | 1003 --- .../URP/Runtime/HBAORendererFeature.cs.meta | 13 - .../SRP 1/URP/Shaders/HBAO.shader | 370 - .../SRP 1/URP/Shaders/HBAO_AO.hlsl | 205 - .../SRP 1/URP/Shaders/HBAO_Blur.hlsl | 143 - .../SRP 1/URP/Shaders/HBAO_Common.hlsl | 91 - .../SRP 1/URP/Shaders/HBAO_Common.hlsl.meta | 9 - .../SRP 1/URP/Shaders/HBAO_Composite.hlsl | 86 - .../URP/Shaders/HBAO_Composite.hlsl.meta | 9 - .../URP/Shaders/HBAO_Deinterleaving.hlsl | 70 - .../URP/Shaders/HBAO_Deinterleaving.hlsl.meta | 9 - .../URP/Shaders/HBAO_TemporalFilter.hlsl | 175 - .../URP/Shaders/HBAO_TemporalFilter.hlsl.meta | 9 - .../SRP/Readme.txt | 3 - .../Shaders/HBAO.shader | 429 -- .../Shaders/HBAO_AO.cginc | 203 - .../Shaders/HBAO_AO.cginc.meta | 9 - .../Shaders/HBAO_Blur.cginc | 139 - .../Shaders/HBAO_Common.cginc | 65 - .../Shaders/HBAO_Common.cginc.meta | 9 - .../Shaders/HBAO_Composite.cginc | 123 - .../Shaders/HBAO_Composite.cginc.meta | 9 - .../Shaders/HBAO_Deinterleaving.cginc | 62 - .../Shaders/HBAO_TemporalFilter.cginc | 171 - Assets/External/VolumetricLightBeam.meta | 8 + .../URP => VolumetricLightBeam}/Editor.meta | 2 +- .../Editor/ButtonToggleScope.cs | 135 + .../Editor/ButtonToggleScope.cs.meta} | 2 +- .../VolumetricLightBeam/Editor/EditorData.cs | 44 + .../Editor/EditorData.cs.meta | 12 + .../Editor/EditorExtensions.cs | 335 + .../Editor/EditorExtensions.cs.meta | 12 + .../Editor/EditorMenuItems.cs | 328 + .../Editor/EditorMenuItems.cs.meta} | 2 +- .../Editor/EditorStrings.cs | 465 ++ .../Editor/EditorStrings.cs.meta | 12 + .../Editor/Editor_Common.cs | 129 + .../Editor/Editor_Common.cs.meta | 12 + .../Editor/Editor_Config.cs | 616 ++ .../Editor/Editor_Config.cs.meta | 12 + .../Editor/Editor_EffectAbstractBase.cs | 68 + .../Editor/Editor_EffectAbstractBase.cs.meta | 12 + .../Editor/Editor_EffectFlicker.cs | 48 + .../Editor/Editor_EffectFlicker.cs.meta | 12 + .../Editor/Editor_EffectFromProfile.cs | 67 + .../Editor/Editor_EffectFromProfile.cs.meta} | 2 +- .../Editor/Editor_EffectPulse.cs | 29 + .../Editor/Editor_EffectPulse.cs.meta | 12 + .../Editor/Editor_TriggerZone.cs | 46 + .../Editor/Editor_TriggerZone.cs.meta | 12 + .../Editor/Editor_VolumetricDustParticles.cs | 94 + .../Editor_VolumetricDustParticles.cs.meta | 12 + .../Editor_VolumetricLightBeamAbstractBase.cs | 345 + ...r_VolumetricLightBeamAbstractBase.cs.meta} | 2 +- .../Editor/FoldableHeader.cs | 77 + .../Editor/FoldableHeader.cs.meta | 12 + .../VolumetricLightBeam/Editor/HD.meta | 8 + .../Editor/HD/Editor_CommonHD.cs | 14 + .../Editor/HD/Editor_CommonHD.cs.meta | 13 + .../Editor_TrackRealtimeChangesOnLightHD.cs | 26 + ...itor_TrackRealtimeChangesOnLightHD.cs.meta | 11 + .../Editor/HD/Editor_VolumetricCookieHD.cs | 73 + .../HD/Editor_VolumetricCookieHD.cs.meta | 12 + .../Editor/HD/Editor_VolumetricLightBeamHD.cs | 318 + .../HD/Editor_VolumetricLightBeamHD.cs.meta | 11 + .../HD/Editor_VolumetricLightBeamHD2D.cs | 47 + .../HD/Editor_VolumetricLightBeamHD2D.cs.meta | 12 + .../Editor/HD/Editor_VolumetricShadowHD.cs | 104 + .../HD/Editor_VolumetricShadowHD.cs.meta | 12 + .../VolumetricLightBeam/Editor/Icons.meta | 8 + .../Editor/Icons/DynamicOcclusion_button.png | 3 + .../Icons/DynamicOcclusion_button.png.meta | 84 + .../Editor/Icons/DynamicOcclusion_icon.png | 3 + .../Icons/DynamicOcclusion_icon.png.meta | 84 + .../Editor/Icons/Effect_button.png | 3 + .../Editor/Icons/Effect_button.png.meta | 84 + .../Editor/Icons/Effect_icon.png | 3 + .../Editor/Icons/Effect_icon.png.meta | 84 + .../Editor/Icons/FromSpotLight_button.png | 3 + .../Icons/FromSpotLight_button.png.meta | 84 + .../Editor/Icons/SkewingHandle_icon.png | 3 + .../Editor/Icons/SkewingHandle_icon.png.meta | 84 + .../TrackRealtimeChangesOnLight_button.png | 3 + ...rackRealtimeChangesOnLight_button.png.meta | 84 + .../TrackRealtimeChangesOnLight_icon.png | 3 + .../TrackRealtimeChangesOnLight_icon.png.meta | 84 + .../Editor/Icons/TriggerZone_button.png | 3 + .../Editor/Icons/TriggerZone_button.png.meta | 84 + .../Editor/Icons/TriggerZone_icon.png | 3 + .../Editor/Icons/TriggerZone_icon.png.meta | 84 + .../Editor/Icons/VolumetricCookie_button.png | 3 + .../Icons/VolumetricCookie_button.png.meta | 84 + .../Editor/Icons/VolumetricCookie_icon.png | 3 + .../Icons/VolumetricCookie_icon.png.meta | 84 + .../Icons/VolumetricDustParticles_button.png | 3 + .../VolumetricDustParticles_button.png.meta | 84 + .../Icons/VolumetricDustParticles_icon.png | 3 + .../VolumetricDustParticles_icon.png.meta | 84 + .../Editor/Icons/VolumetricLightBeam_icon.png | 3 + .../Icons/VolumetricLightBeam_icon.png.meta | 84 + .../Editor/Icons/VolumetricShadow_button.png | 3 + .../Icons/VolumetricShadow_button.png.meta | 110 + .../Editor/Icons/VolumetricShadow_icon.png | 3 + .../Icons/VolumetricShadow_icon.png.meta} | 31 +- .../Editor/OnBuildPostprocess.cs | 15 + .../Editor/OnBuildPostprocess.cs.meta | 12 + .../Editor/OnBuildPreprocess.cs | 16 + .../Editor/OnBuildPreprocess.cs.meta | 12 + .../Editor/OnBuildTargetChanged.cs | 20 + .../Editor/OnBuildTargetChanged.cs.meta | 12 + .../Editor/RenderQueueDrawer.cs | 67 + .../Editor/RenderQueueDrawer.cs.meta | 11 + .../Editor/Resources.meta | 2 +- .../Editor/Resources/VLBEditorData.asset | 3 + .../Editor/Resources/VLBEditorData.asset.meta | 8 + .../VolumetricLightBeam/Editor/SD.meta | 8 + .../Editor/SD/Editor_CommonSD.cs | 14 + .../Editor/SD/Editor_CommonSD.cs.meta | 11 + .../SD/Editor_DynamicOcclusionAbstractBase.cs | 51 + ...ditor_DynamicOcclusionAbstractBase.cs.meta | 12 + .../SD/Editor_DynamicOcclusionDepthBuffer.cs | 55 + ...Editor_DynamicOcclusionDepthBuffer.cs.meta | 12 + .../SD/Editor_DynamicOcclusionRaycasting.cs | 111 + .../Editor_DynamicOcclusionRaycasting.cs.meta | 12 + .../Editor/SD/Editor_SkewingHandleSD.cs | 47 + .../Editor/SD/Editor_SkewingHandleSD.cs.meta | 12 + .../Editor/SD/Editor_VolumetricLightBeamSD.cs | 562 ++ .../SD/Editor_VolumetricLightBeamSD.cs.meta | 12 + .../Editor/SortingLayerAndOrderDrawer.cs | 53 + .../Editor/SortingLayerAndOrderDrawer.cs.meta | 11 + .../VolumetricLightBeam/Editor/TargetList.cs | 91 + .../Editor/TargetList.cs.meta | 12 + .../VolumetricLightBeam/Resources.meta | 8 + .../Resources/DustParticles.mat | 34 + .../Resources/DustParticles.mat.meta | 8 + .../Resources/DustParticles.prefab | 3 + .../Resources/DustParticles.prefab.meta | 8 + .../Resources/DustParticles.psd | 3 + .../Resources/DustParticles.psd.meta} | 17 +- .../Resources/Noise3D_64x64x64.asset | 3 + .../Resources/Noise3D_64x64x64.asset.meta | 10 + .../Resources/VLBBlueNoise.png | 3 + .../Resources/VLBBlueNoise.png.meta | 121 + .../Resources/VLBDitheringNoise.png | 3 + .../Resources/VLBDitheringNoise.png.meta | 121 + .../External/VolumetricLightBeam/Samples.meta | 8 + .../Samples/Animations.meta | 8 + .../Samples/Animations/AnimAngleAndColor.anim | 309 + .../Animations/AnimAngleAndColor.anim.meta | 8 + .../Animations/AnimAngleAndColor.controller | 67 + .../AnimAngleAndColor.controller.meta | 8 + .../Animations/AnimFadingDistances.anim | 116 + .../Animations/AnimFadingDistances.anim.meta | 8 + .../Animations/AnimFadingDistances.controller | 67 + .../AnimFadingDistances.controller.meta | 8 + .../Animations/AnimLightProperties.anim | 309 + .../Animations/AnimLightProperties.anim.meta | 8 + .../Animations/AnimLightProperties.controller | 67 + .../AnimLightProperties.controller.meta | 8 + .../Samples}/Materials.meta | 2 +- .../Samples/Materials/Cookies.meta | 8 + .../Materials/Cookies/cookie_colored.jpg | 3 + .../Materials/Cookies/cookie_colored.jpg.meta | 121 + .../Samples/Materials/Cookies/cookie_fan.png | 3 + .../Materials/Cookies/cookie_fan.png.meta | 121 + .../Materials/Cookies/cookie_heart.psd | 3 + .../Materials/Cookies/cookie_heart.psd.meta | 121 + .../Samples/Materials/Cookies/cookie_star.psd | 3 + .../Materials/Cookies/cookie_star.psd.meta | 121 + .../Samples/Materials/checkIfInsideBeam.mat | 138 + .../Materials/checkIfInsideBeam.mat.meta | 8 + .../Samples/Materials/geometry_hdrp.mat | 243 + .../Samples/Materials/geometry_hdrp.mat.meta} | 4 +- .../Samples/Materials/geometry_urp.mat | 135 + .../Samples/Materials/geometry_urp.mat.meta} | 2 +- .../Samples/Materials/green.mat | 138 + .../Samples/Materials/green.mat.meta | 8 + .../Samples/Materials/red.mat | 138 + .../Samples/Materials/red.mat.meta | 8 + .../Samples/Materials/skybox.mat | 162 + .../Samples/Materials/skybox.mat.meta | 8 + .../Samples/Materials/white.mat | 138 + .../Samples/Materials/white.mat.meta | 8 + .../Samples/Materials/yellow.mat | 138 + .../Samples/Materials/yellow.mat.meta | 8 + .../VolumetricLightBeam/Samples/Scenes.meta | 8 + .../Samples/Scenes/demoScenePrefab.prefab | 3 + .../Scenes/demoScenePrefab.prefab.meta | 8 + .../Scenes/demoScene_builtin_pipeline.unity | 3 + .../demoScene_builtin_pipeline.unity.meta | 8 + .../Samples/Scenes/demoScene_hdrp.unity | 3 + .../Samples/Scenes/demoScene_hdrp.unity.meta | 8 + .../Samples/Scenes/demoScene_urp.unity | 3 + .../Samples/Scenes/demoScene_urp.unity.meta | 8 + .../Samples/Scenes/demoStressTest.unity | 3 + .../Samples/Scenes/demoStressTest.unity.meta | 8 + .../VolumetricLightBeam/Samples/Scripts.meta | 8 + .../Scripts/CameraToggleBeamVisibility.cs | 30 + .../CameraToggleBeamVisibility.cs.meta | 12 + .../Samples/Scripts/CheckIfInsideBeam.cs | 53 + .../Samples/Scripts/CheckIfInsideBeam.cs.meta | 12 + .../Scripts/FeaturesNotSupportedMessage.cs | 13 + .../FeaturesNotSupportedMessage.cs.meta | 12 + .../Samples/Scripts/FreeCameraController.cs | 72 + .../Scripts/FreeCameraController.cs.meta | 12 + .../Samples/Scripts/LightGenerator.cs | 87 + .../Samples/Scripts/LightGenerator.cs.meta | 12 + .../Samples/Scripts/Rotater.cs | 18 + .../Samples/Scripts/Rotater.cs.meta | 12 + .../External/VolumetricLightBeam/Scripts.meta | 8 + .../Scripts/BatchingHelper.cs | 239 + .../Scripts/BatchingHelper.cs.meta | 12 + .../Scripts/BeamGeometryAbstractBase.cs | 56 + .../Scripts/BeamGeometryAbstractBase.cs.meta | 11 + .../Scripts/CachedLightProperties.cs | 41 + .../Scripts/CachedLightProperties.cs.meta | 12 + .../VolumetricLightBeam/Scripts/Config.cs | 867 +++ .../Scripts/Config.cs.meta | 12 + .../VolumetricLightBeam/Scripts/Consts.cs | 244 + .../Scripts/Consts.cs.meta | 12 + .../Scripts/DummyMaterial.cs | 49 + .../Scripts/DummyMaterial.cs.meta | 12 + .../Scripts/EditorPrefsStrings.cs | 16 + .../Scripts/EditorPrefsStrings.cs.meta | 11 + .../Scripts/EffectAbstractBase.cs | 126 + .../Scripts/EffectAbstractBase.cs.meta | 12 + .../Scripts/EffectFlicker.cs | 125 + .../Scripts/EffectFlicker.cs.meta} | 8 +- .../Scripts/EffectFromProfile.cs | 57 + .../Scripts/EffectFromProfile.cs.meta | 11 + .../Scripts/EffectPulse.cs | 59 + .../Scripts/EffectPulse.cs.meta} | 8 +- .../VolumetricLightBeam/Scripts/Enums.cs | 189 + .../VolumetricLightBeam/Scripts/Enums.cs.meta | 13 + .../VolumetricLightBeam/Scripts/HD.meta | 8 + .../Scripts/HD/BeamGeometryHD.cs | 556 ++ .../Scripts/HD/BeamGeometryHD.cs.meta | 11 + .../Scripts/HD/GlobalMeshHD.cs | 37 + .../Scripts/HD/GlobalMeshHD.cs.meta | 13 + .../Scripts/HD/RaymarchingQuality.cs | 52 + .../Scripts/HD/RaymarchingQuality.cs.meta | 12 + .../HD/TrackRealtimeChangesOnLightHD.cs | 29 + .../HD/TrackRealtimeChangesOnLightHD.cs.meta | 13 + .../Scripts/HD/VolumetricCookieHD.cs | 166 + .../Scripts/HD/VolumetricCookieHD.cs.meta | 13 + .../Scripts/HD/VolumetricLightBeamHD.cs | 712 ++ .../Scripts/HD/VolumetricLightBeamHD.cs.meta | 28 + .../Scripts/HD/VolumetricLightBeamHD2D.cs | 66 + .../HD/VolumetricLightBeamHD2D.cs.meta | 29 + .../Scripts/HD/VolumetricShadowHD.cs | 384 ++ .../Scripts/HD/VolumetricShadowHD.cs.meta | 13 + .../Scripts/HighlightNullAttribute.cs | 33 + .../Scripts/HighlightNullAttribute.cs.meta | 13 + .../Scripts/MaterialManager.cs | 305 + .../Scripts/MaterialManager.cs.meta | 12 + .../Scripts/MaterialModifier.cs | 18 + .../Scripts/MaterialModifier.cs.meta | 12 + .../Scripts/MeshGenerator.cs | 444 ++ .../Scripts/MeshGenerator.cs.meta | 12 + .../Scripts/MinMaxRangeFloat.cs | 102 + .../Scripts/MinMaxRangeFloat.cs.meta | 12 + .../VolumetricLightBeam/Scripts/Noise3D.cs | 77 + .../Scripts/Noise3D.cs.meta | 12 + .../Scripts/PlatformHelper.cs | 107 + .../Scripts/PlatformHelper.cs.meta | 12 + .../Scripts/PolygonHelper.cs | 84 + .../Scripts/PolygonHelper.cs.meta | 12 + .../VolumetricLightBeam/Scripts/SD.meta | 8 + .../Scripts/SD/BeamGeometrySD.cs | 621 ++ .../Scripts/SD/BeamGeometrySD.cs.meta | 12 + .../SD/DynamicOcclusionAbstractBase.cs | 185 + .../SD/DynamicOcclusionAbstractBase.cs.meta | 12 + .../Scripts/SD/DynamicOcclusionDepthBuffer.cs | 225 + .../SD/DynamicOcclusionDepthBuffer.cs.meta | 28 + .../Scripts/SD/DynamicOcclusionRaycasting.cs | 472 ++ .../SD/DynamicOcclusionRaycasting.cs.meta | 28 + .../Scripts/SD/GlobalMeshSD.cs | 45 + .../Scripts/SD/GlobalMeshSD.cs.meta | 12 + .../Scripts/SD/SkewingHandleSD.cs | 59 + .../Scripts/SD/SkewingHandleSD.cs.meta} | 8 +- .../Scripts/SD/VolumetricLightBeamSD.cs | 1103 +++ .../Scripts/SD/VolumetricLightBeamSD.cs.meta | 29 + .../VolumetricLightBeam/Scripts/SRPHelper.cs | 186 + .../Scripts/SRPHelper.cs.meta | 12 + .../Scripts/ShaderGenerator.cs | 393 ++ .../Scripts/ShaderGenerator.cs.meta | 12 + .../Scripts/ShaderKeywords.cs | 32 + .../Scripts/ShaderKeywords.cs.meta | 12 + .../Scripts/ShaderProperties.cs | 72 + .../Scripts/ShaderProperties.cs.meta | 12 + .../Scripts/SpotLightHelper.cs | 11 + .../Scripts/SpotLightHelper.cs.meta | 11 + .../Scripts/TransformUtils.cs | 29 + .../Scripts/TransformUtils.cs.meta | 12 + .../Scripts/TriggerZone.cs | 159 + .../Scripts/TriggerZone.cs.meta} | 8 +- .../VolumetricLightBeam/Scripts/Utils.cs | 364 + .../VolumetricLightBeam/Scripts/Utils.cs.meta | 12 + .../Scripts/UtilsBeamProps.cs | 172 + .../Scripts/UtilsBeamProps.cs.meta | 11 + .../VolumetricLightBeam/Scripts/Version.cs | 22 + .../Scripts/Version.cs.meta | 12 + .../Scripts/VolumetricDustParticles.cs | 407 ++ .../Scripts/VolumetricDustParticles.cs.meta | 28 + .../VolumetricLightBeamAbstractBase.cs | 136 + .../VolumetricLightBeamAbstractBase.cs.meta | 13 + .../URP => VolumetricLightBeam}/Shaders.meta | 2 +- .../Shaders/ShaderDefines.cginc | 80 + .../Shaders/ShaderDefines.cginc.meta | 9 + .../Shaders/ShaderGenerator.asset | 3 + .../Shaders/ShaderGenerator.asset.meta | 8 + .../Shaders/ShaderMaths.cginc | 52 + .../Shaders/ShaderMaths.cginc.meta | 9 + .../Shaders/ShaderProperties.cginc | 109 + .../Shaders/ShaderProperties.cginc.meta | 9 + .../Shaders/ShaderPropertySystem.cginc | 39 + .../Shaders/ShaderPropertySystem.cginc.meta | 9 + .../Shaders/ShaderSpecificBuiltin.cginc | 65 + .../Shaders/ShaderSpecificBuiltin.cginc.meta | 9 + .../Shaders/ShaderSpecificHDRP.hlsl | 73 + .../Shaders/ShaderSpecificHDRP.hlsl.meta | 8 + .../Shaders/ShaderSpecificURP.cginc | 54 + .../Shaders/ShaderSpecificURP.cginc.meta | 9 + .../Shaders/ShaderUtils.cginc | 230 + .../Shaders/ShaderUtils.cginc.meta | 9 + .../Shaders/VLBDummyMaterialHD.mat | 78 + .../Shaders/VLBDummyMaterialHD.mat.meta} | 5 +- .../Shaders/VLBDummyMaterialSD.mat | 78 + .../Shaders/VLBDummyMaterialSD.mat.meta | 8 + .../Shaders/VLBGeneratedShaderHD.shader | 138 + .../Shaders/VLBGeneratedShaderHD.shader.meta} | 2 +- .../Shaders/VLBGeneratedShaderSD.shader | 128 + .../Shaders/VLBGeneratedShaderSD.shader.meta} | 2 +- .../Shaders/VolumetricLightBeamSharedHD.cginc | 527 ++ .../VolumetricLightBeamSharedHD.cginc.meta} | 2 +- .../Shaders/VolumetricLightBeamSharedSD.cginc | 581 ++ .../VolumetricLightBeamSharedSD.cginc.meta | 9 + .../Shaders/shadergen_base.txt | 3 + .../Shaders/shadergen_base.txt.meta} | 6 +- .../Shaders/shadergen_includes_builtin.txt | 3 + .../shadergen_includes_builtin.txt.meta} | 8 +- .../Shaders/shadergen_includes_hdrp.txt | 3 + .../Shaders/shadergen_includes_hdrp.txt.meta} | 6 +- .../Shaders/shadergen_includes_urp.txt | 3 + .../Shaders/shadergen_includes_urp.txt.meta | 8 + .../Shaders/shadergen_pass.txt | 3 + .../Shaders/shadergen_pass.txt.meta | 8 + .../External/VolumetricLightBeam/package.json | 3 + .../package.json.meta} | 4 +- Assets/Resources/VLBConfigOverride.asset | 3 + Assets/Resources/VLBConfigOverride.asset.meta | 8 + .../Cathedral_medieval_Fantastic.meta | 8 + .../Cathedral_medieval_Fantastic/Cookie.meta | 8 + .../Cookie/Light Cookie.png | 3 + .../Cookie/Light Cookie.png.meta | 115 + .../Cathedral_medieval_Fantastic/Glb.meta | 8 + ...athedral_medieval_Fantastic.Materials.meta | 8 + .../[ColorD03].mat | 141 + .../[ColorD03].mat.meta | 8 + .../[ColorI07].mat | 141 + .../[ColorI07].mat.meta | 8 + .../f-1.mat} | 13 +- .../f-1.mat.meta | 8 + .../f-2.mat} | 72 +- .../f-2.mat.meta | 8 + .../f-3.mat | 136 + .../f-3.mat.meta | 8 + .../f-4.mat | 136 + .../f-4.mat.meta | 8 + .../f-5.mat | 136 + .../f-5.mat.meta | 8 + .../floor.mat | 136 + .../floor.mat.meta | 8 + .../g-1.mat | 141 + .../g-1.mat.meta | 8 + .../g-2.mat | 141 + .../g-2.mat.meta | 8 + .../g-3.mat | 141 + .../g-3.mat.meta | 8 + .../glass.mat | 141 + .../glass.mat.meta | 8 + .../marble1.mat | 136 + .../marble1.mat.meta | 8 + .../marble2.mat | 136 + .../marble2.mat.meta | 8 + .../marble3.mat | 136 + .../marble3.mat.meta | 8 + .../marble4.mat | 136 + .../marble4.mat.meta | 8 + .../roof.mat | 136 + .../roof.mat.meta | 8 + .../roof2.mat | 136 + .../roof2.mat.meta | 8 + .../silver.mat | 136 + .../silver.mat.meta | 8 + .../stone.mat | 136 + .../stone.mat.meta | 8 + .../stone3.mat | 136 + .../stone3.mat.meta | 8 + .../wall.mat | 136 + .../wall.mat.meta | 8 + .../window.mat | 140 + .../window.mat.meta | 8 + .../wood.mat | 136 + .../wood.mat.meta | 8 + .../wood1.mat | 136 + .../wood1.mat.meta | 8 + ...Cathedral_medieval_Fantastic.Textures.meta | 8 + .../wood_5.png | 3 + .../wood_5.png.meta | 115 + .../wood_5__UNIGLTF__DUPLICATED__2.png | 3 + .../wood_5__UNIGLTF__DUPLICATED__2.png.meta | 115 + .../금속2_수정.png | 3 + .../금속2_수정.png.meta | 115 + .../대리석_2.png | 3 + .../대리석_2.png.meta | 115 + .../대리석_2__UNIGLTF__DUPLICATED__2.png | 3 + .../대리석_2__UNIGLTF__DUPLICATED__2.png.meta | 115 + .../대리석_2__UNIGLTF__DUPLICATED__3.png | 3 + .../대리석_2__UNIGLTF__DUPLICATED__3.png.meta | 115 + .../대리석_2__UNIGLTF__DUPLICATED__4.png | 3 + .../대리석_2__UNIGLTF__DUPLICATED__4.png.meta | 115 + .../대리석_2__UNIGLTF__DUPLICATED__5.png | 3 + .../대리석_2__UNIGLTF__DUPLICATED__5.png.meta | 115 + .../대리석_brown.png | 3 + .../대리석_brown.png.meta | 115 + .../대리석_brown__UNIGLTF__DUPLICATED__2.png | 3 + ...리석_brown__UNIGLTF__DUPLICATED__2.png.meta | 115 + .../대리석_brown__UNIGLTF__DUPLICATED__3.png | 3 + ...리석_brown__UNIGLTF__DUPLICATED__3.png.meta | 115 + .../대리석_brown__UNIGLTF__DUPLICATED__4.png | 3 + ...리석_brown__UNIGLTF__DUPLICATED__4.png.meta | 115 + .../대리석_brown__UNIGLTF__DUPLICATED__5.png | 3 + ...리석_brown__UNIGLTF__DUPLICATED__5.png.meta | 115 + .../대리석_brown__UNIGLTF__DUPLICATED__6.png | 3 + ...리석_brown__UNIGLTF__DUPLICATED__6.png.meta | 115 + .../돌바닥2.png | 3 + .../돌바닥2.png.meta | 115 + .../벽돌2-1.png | 3 + .../벽돌2-1.png.meta | 115 + .../석재.png | 3 + .../석재.png.meta | 115 + .../지붕2.png | 3 + .../지붕2.png.meta | 115 + .../Glb/Cathedral_medieval_Fantastic.glb | 3 + .../Glb/Cathedral_medieval_Fantastic.glb.meta | 227 + .../Glb/New Lighting Settings.lighting} | 41 +- .../Glb/New Lighting Settings.lighting.meta} | 2 +- .../Cathedral_medieval_Fantastic/Scene.meta | 8 + .../Scene/Cathedral_medieval_Fantastic.meta | 8 + .../Scene/Cathedral_medieval_Fantastic.unity | 3 + .../Cathedral_medieval_Fantastic.unity.meta} | 2 +- .../Global Volume Profile.asset | 3 + .../Global Volume Profile.asset.meta | 8 + .../LightingData.asset | 3 + .../LightingData.asset.meta | 8 + .../Lightmap-0_comp_dir.png | 3 + .../Lightmap-0_comp_dir.png.meta | 115 + .../Lightmap-0_comp_light.exr | 3 + .../Lightmap-0_comp_light.exr.meta | 115 + .../Lightmap-0_comp_shadowmask.png | 3 + .../Lightmap-0_comp_shadowmask.png.meta | 115 + .../Lightmap-10_comp_dir.png | 3 + .../Lightmap-10_comp_dir.png.meta | 115 + .../Lightmap-10_comp_light.exr | 3 + .../Lightmap-10_comp_light.exr.meta | 115 + .../Lightmap-10_comp_shadowmask.png | 3 + .../Lightmap-10_comp_shadowmask.png.meta | 115 + .../Lightmap-1_comp_dir.png | 3 + .../Lightmap-1_comp_dir.png.meta | 115 + .../Lightmap-1_comp_light.exr | 3 + .../Lightmap-1_comp_light.exr.meta | 115 + .../Lightmap-1_comp_shadowmask.png | 3 + .../Lightmap-1_comp_shadowmask.png.meta | 115 + .../Lightmap-2_comp_dir.png | 3 + .../Lightmap-2_comp_dir.png.meta | 115 + .../Lightmap-2_comp_light.exr | 3 + .../Lightmap-2_comp_light.exr.meta | 115 + .../Lightmap-2_comp_shadowmask.png | 3 + .../Lightmap-2_comp_shadowmask.png.meta | 115 + .../Lightmap-3_comp_dir.png | 3 + .../Lightmap-3_comp_dir.png.meta | 115 + .../Lightmap-3_comp_light.exr | 3 + .../Lightmap-3_comp_light.exr.meta | 115 + .../Lightmap-3_comp_shadowmask.png | 3 + .../Lightmap-3_comp_shadowmask.png.meta | 115 + .../Lightmap-4_comp_dir.png | 3 + .../Lightmap-4_comp_dir.png.meta | 115 + .../Lightmap-4_comp_light.exr | 3 + .../Lightmap-4_comp_light.exr.meta | 115 + .../Lightmap-4_comp_shadowmask.png | 3 + .../Lightmap-4_comp_shadowmask.png.meta | 115 + .../Lightmap-5_comp_dir.png | 3 + .../Lightmap-5_comp_dir.png.meta | 115 + .../Lightmap-5_comp_light.exr | 3 + .../Lightmap-5_comp_light.exr.meta | 115 + .../Lightmap-5_comp_shadowmask.png | 3 + .../Lightmap-5_comp_shadowmask.png.meta | 115 + .../Lightmap-6_comp_dir.png | 3 + .../Lightmap-6_comp_dir.png.meta | 115 + .../Lightmap-6_comp_light.exr | 3 + .../Lightmap-6_comp_light.exr.meta | 115 + .../Lightmap-6_comp_shadowmask.png | 3 + .../Lightmap-6_comp_shadowmask.png.meta | 115 + .../Lightmap-7_comp_dir.png | 3 + .../Lightmap-7_comp_dir.png.meta | 115 + .../Lightmap-7_comp_light.exr | 3 + .../Lightmap-7_comp_light.exr.meta | 115 + .../Lightmap-7_comp_shadowmask.png | 3 + .../Lightmap-7_comp_shadowmask.png.meta | 115 + .../Lightmap-8_comp_dir.png | 3 + .../Lightmap-8_comp_dir.png.meta | 115 + .../Lightmap-8_comp_light.exr | 3 + .../Lightmap-8_comp_light.exr.meta | 115 + .../Lightmap-8_comp_shadowmask.png | 3 + .../Lightmap-8_comp_shadowmask.png.meta | 115 + .../Lightmap-9_comp_dir.png | 3 + .../Lightmap-9_comp_dir.png.meta | 115 + .../Lightmap-9_comp_light.exr | 3 + .../Lightmap-9_comp_light.exr.meta | 115 + .../Lightmap-9_comp_shadowmask.png | 3 + .../Lightmap-9_comp_shadowmask.png.meta | 115 + .../ReflectionProbe-0.exr | 3 + .../ReflectionProbe-0.exr.meta | 115 + .../ReflectionProbe-1.exr | 3 + .../ReflectionProbe-1.exr.meta | 115 + .../Etc/Fake Shadow/Fake Shadow.shader | 651 +- 2525 files changed, 218845 insertions(+), 7539 deletions(-) rename Assets/External/{Horizon Based Ambient Occlusion/Demo/Models/Materials.meta => AmplifyShaderEditor.meta} (67%) rename Assets/External/{Horizon Based Ambient Occlusion/Editor/HBAO.Editor.asmdef => AmplifyShaderEditor/AmplifyShaderEditor.asmdef} (51%) create mode 100644 Assets/External/AmplifyShaderEditor/AmplifyShaderEditor.asmdef.meta create mode 100644 Assets/External/AmplifyShaderEditor/ChangeLog.txt create mode 100644 Assets/External/AmplifyShaderEditor/ChangeLog.txt.meta rename Assets/External/{Horizon Based Ambient Occlusion/Demo.meta => AmplifyShaderEditor/Examples.meta} (67%) create mode 100644 Assets/External/AmplifyShaderEditor/Examples/Built-In Samples.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/Built-In Samples.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/Credits.txt create mode 100644 Assets/External/AmplifyShaderEditor/Examples/Credits.txt.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 10x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 10x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 12x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 12x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 14x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 14x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 15x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 15x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 16x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 16x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 17x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 17x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/HDRP Samples.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/HDRP Samples.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/README Samples.txt create mode 100644 Assets/External/AmplifyShaderEditor/Examples/README Samples.txt.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/Sample Resources.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/Sample Resources.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/URP Samples 10x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/URP Samples 10x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/URP Samples 12x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/URP Samples 12x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/URP Samples 14x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/URP Samples 14x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/URP Samples 15x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/URP Samples 15x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/URP Samples 16x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/URP Samples 16x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/URP Samples 17x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/URP Samples 17x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Examples/URP Samples.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Examples/URP Samples.unitypackage.meta rename Assets/External/{Horizon Based Ambient Occlusion/Demo/Models.meta => AmplifyShaderEditor/Plugins.meta} (67%) create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Constants.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Constants.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/ASEEndDecorator.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/ASEEndDecorator.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/NoKeywordToggle.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/NoKeywordToggle.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSlidersFull.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSlidersFull.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/IMMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/IMMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchBySRPVersionNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchBySRPVersionNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/TwoSidedSignNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/TwoSidedSignNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AllOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AllOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AnyOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AnyOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/FlipNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/FlipNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsInfiniteNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsInfiniteNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsNaNNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsNaNNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NandNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NandNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NotNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NotNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReciprocalOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReciprocalOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs.meta rename Assets/External/{Horizon Based Ambient Occlusion => AmplifyShaderEditor/Plugins/Editor/Nodes}/SRP.meta (67%) create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/ExposureNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/ExposureNode.cs.meta rename Assets/External/{Horizon Based Ambient Occlusion.meta => AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP.meta} (77%) create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/ASEDiffusionProfile.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/ASEDiffusionProfile.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/DiffusionProfileNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/DiffusionProfileNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/HDEmissionNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/HDEmissionNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/URP.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/URP/ReflectionProbeNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/URP/ReflectionProbeNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/StickyNoteNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/StickyNoteNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/PositionNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/PositionNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewVectorNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewVectorNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs.meta rename Assets/External/{Horizon Based Ambient Occlusion/Demo/Models => AmplifyShaderEditor/Plugins/Editor/Nodes}/Textures.meta (67%) create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerStateNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerStateNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendIndicesNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendIndicesNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendWeightsNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendWeightsNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectBoundsNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectBoundsNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectPositionNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectPositionNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAlphaToMaskModule.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAlphaToMaskModule.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDBItem.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDBItem.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateRenderPlatformHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateRenderPlatformHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleAsset.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleAsset.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleTool.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleTool.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlinePropertyTable.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlinePropertyTable.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.Project.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.Project.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.User.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.User.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShaderBodyTokenizer.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShaderBodyTokenizer.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TextureArrayCreatorAsset.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TextureArrayCreatorAsset.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Version.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/About.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/About.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/GUISkins.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources/hbao_urp.png.meta => AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png.meta} (86%) create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview.cginc create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview.cginc.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AllNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AllNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AnyNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AnyNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FlipNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FlipNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsInfinite.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsInfinite.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsNaN.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsNaN.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NandNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NandNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NotNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NotNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectPositionNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectPositionNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PositionNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PositionNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReciprocalNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReciprocalNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectionProbe.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectionProbe.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchBySRPVersionNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchBySRPVersionNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TwoSidedSignNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TwoSidedSignNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewVector.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewVector.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Merge.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Merge.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Split.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Split.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/And.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/And.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria Smoothstep.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria Smoothstep.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Precompute.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Precompute.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Sample.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Sample.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional Parallax Mapping.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional Parallax Mapping.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blackbody.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blackbody.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Half Vector.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Half Vector.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Light.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Light.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks Pattern.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks Pattern.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color Mask.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color Mask.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Compute Mip Level.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Compute Mip Level.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create Orthogonal Vector.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create Orthogonal Vector.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Custom Screen Position.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Custom Screen Position.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode Directional Lighmap.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode Directional Lighmap.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/DepthMaskedRefraction.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/DepthMaskedRefraction.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive Tangent Basis.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive Tangent Basis.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail Albedo.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail Albedo.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Device Depth.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Device Depth.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dielectric Specular.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dielectric Specular.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots Pattern.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots Pattern.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Fade Transition.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Fade Transition.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four Splats First Pass Terrain.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four Splats First Pass Terrain.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/HDRP Decal UVs.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/HDRP Decal UVs.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half Lambert Term.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half Lambert Term.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based Blending.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based Blending.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex Lattice.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex Lattice.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse Lerp.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse Lerp.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lambert Light.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lambert Light.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp White To.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp White To.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lightmap UV.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lightmap UV.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Metal Reflectance.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Metal Reflectance.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones Control.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones Control.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise Sine Wave.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise Sine Wave.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non Stereo Screen Pos.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non Stereo Screen Pos.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Face.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Face.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Height.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Height.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Texture.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Texture.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Reconstruct Z.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Reconstruct Z.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Or.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Or.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar Coordinates.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar Coordinates.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Procedural Sample.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Procedural Sample.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Projection.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Projection.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial Shear.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial Shear.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random Range.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random Range.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct World Position From Depth.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct World Position From Depth.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rejection.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rejection.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace Color.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace Color.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Polygon.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Polygon.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Rectangle.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Rectangle.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP Additional Light.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP Additional Light.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sample Lightmap.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sample Lightmap.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Saturation.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Saturation.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth Wave.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth Wave.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Shadow Mask.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Shadow Mask.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple HUE.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple HUE.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth Wave.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth Wave.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square Wave.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square Wave.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step Antialiasing.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step Antialiasing.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stereo Screen Pos.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stereo Screen Pos.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Animate Vertex.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Animate Vertex.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Value.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Value.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle Wave.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle Wave.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite Effect Layer.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite Effect Layer.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/URP Tangent To World Normal.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/URP Tangent To World Normal.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/World Normal Face.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/World Normal Face.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig Zag.asset create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig Zag.asset.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt.meta rename Assets/External/{Horizon Based Ambient Occlusion => AmplifyShaderEditor/Plugins/EditorResources}/Shaders.meta (67%) create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates.meta rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1.meta => AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT.meta} (77%) create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTInit.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTInit.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTUpdate.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTUpdate.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 10x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 10x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 12x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 12x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 14x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 14x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 15x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 15x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 16x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 16x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 17x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 17x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Lit.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Lit.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PPStack.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PPStack.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle Alpha Blend.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle Alpha Blend.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader.meta rename Assets/External/{Horizon Based Ambient Occlusion/Editor.meta => AmplifyShaderEditor/Plugins/EditorResources/Templates/UI.meta} (77%) create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/UI/UI-Default.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/UI/UI-Default.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 10x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 10x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 12x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 12x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 14x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 14x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 15x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 15x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 16x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 16x.unitypackage.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 17x.unitypackage create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 17x.unitypackage.meta rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1 => AmplifyShaderEditor/Plugins/EditorResources/Templates}/URP.meta (77%) create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DCustomLit.shader rename Assets/External/{Horizon Based Ambient Occlusion/Shaders/HBAO.shader.meta => AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DCustomLit.shader.meta} (58%) create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DLit.shader rename Assets/External/{Horizon Based Ambient Occlusion/Shaders/HBAO_Blur.cginc.meta => AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DLit.shader.meta} (58%) create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DUnlit.shader rename Assets/External/{Horizon Based Ambient Occlusion/Shaders/HBAO_Deinterleaving.cginc.meta => AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DUnlit.shader.meta} (58%) create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Decal.shader rename Assets/External/{Horizon Based Ambient Occlusion/Shaders/HBAO_TemporalFilter.cginc.meta => AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Decal.shader.meta} (58%) create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Lit.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Lit.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Unlit.shader create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Unlit.shader.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png rename Assets/External/{Horizon Based Ambient Occlusion/Editor/Resources/hbao.png.meta => AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png.meta} (69%) create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 2.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 2.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 3.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 3.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 4.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 4.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ShaderFunctionHeaderIcon.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ShaderFunctionHeaderIcon.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png create mode 100644 Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png.meta create mode 100644 Assets/External/AmplifyShaderEditor/Readme.txt create mode 100644 Assets/External/AmplifyShaderEditor/Readme.txt.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Demo/Demo.unity delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Demo/Demo.unity.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures/Dragons.png delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAO.Demo.Runtime.asmdef delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAOControl.cs delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/RotateObject.cs delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Documentation.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Documentation/User Guide.pdf delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Documentation/User Guide.pdf.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Editor/HBAO.Editor.asmdef.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOEditor.cs delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOGaiaExtension.cs delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Editor/Resources.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/hbao.png delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/icon.png delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Readme.txt delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Runtime.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.Runtime.asmdef delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.Runtime.asmdef.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.cs delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.cs.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Demo.unity delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Post Process Volume Profile.asset delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs/Dragons Candle.prefab delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAO.Demo.Universal.Runtime.asmdef delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAO.Demo.Universal.Runtime.asmdef.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAOControl.cs delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/RotateObject.cs delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAO.Universal.Editor.asmdef delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAO.Universal.Editor.asmdef.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAOEditor.cs delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources/hbao_urp.png delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.Universal.Runtime.asmdef delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.Universal.Runtime.asmdef.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.cs delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAORendererFeature.cs delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAORendererFeature.cs.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO.shader delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_AO.hlsl delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Blur.hlsl delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Common.hlsl delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Common.hlsl.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Composite.hlsl delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Composite.hlsl.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Deinterleaving.hlsl delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Deinterleaving.hlsl.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_TemporalFilter.hlsl delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_TemporalFilter.hlsl.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/SRP/Readme.txt delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO.shader delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_AO.cginc delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_AO.cginc.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Blur.cginc delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Common.cginc delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Common.cginc.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Composite.cginc delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Composite.cginc.meta delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Deinterleaving.cginc delete mode 100644 Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_TemporalFilter.cginc create mode 100644 Assets/External/VolumetricLightBeam.meta rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP => VolumetricLightBeam}/Editor.meta (77%) create mode 100644 Assets/External/VolumetricLightBeam/Editor/ButtonToggleScope.cs rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAOControl.cs.meta => VolumetricLightBeam/Editor/ButtonToggleScope.cs.meta} (83%) create mode 100644 Assets/External/VolumetricLightBeam/Editor/EditorData.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/EditorData.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/EditorExtensions.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/EditorExtensions.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/EditorMenuItems.cs rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/RotateObject.cs.meta => VolumetricLightBeam/Editor/EditorMenuItems.cs.meta} (83%) create mode 100644 Assets/External/VolumetricLightBeam/Editor/EditorStrings.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/EditorStrings.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_Common.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_Common.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_Config.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_Config.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_EffectAbstractBase.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_EffectAbstractBase.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_EffectFlicker.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_EffectFlicker.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_EffectFromProfile.cs rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAOEditor.cs.meta => VolumetricLightBeam/Editor/Editor_EffectFromProfile.cs.meta} (83%) create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_EffectPulse.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_EffectPulse.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_TriggerZone.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_TriggerZone.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricDustParticles.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricDustParticles.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricLightBeamAbstractBase.cs rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.cs.meta => VolumetricLightBeam/Editor/Editor_VolumetricLightBeamAbstractBase.cs.meta} (83%) create mode 100644 Assets/External/VolumetricLightBeam/Editor/FoldableHeader.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/FoldableHeader.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/HD.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/HD/Editor_CommonHD.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/HD/Editor_CommonHD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/HD/Editor_TrackRealtimeChangesOnLightHD.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/HD/Editor_TrackRealtimeChangesOnLightHD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricCookieHD.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricCookieHD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD2D.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD2D.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricShadowHD.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricShadowHD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_button.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_button.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_icon.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_icon.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/Effect_button.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/Effect_button.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/Effect_icon.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/Effect_icon.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/FromSpotLight_button.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/FromSpotLight_button.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/SkewingHandle_icon.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/SkewingHandle_icon.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_button.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_button.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_icon.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_icon.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_button.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_button.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_icon.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_icon.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_button.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_button.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_icon.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_icon.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_button.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_button.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_icon.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_icon.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricLightBeam_icon.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricLightBeam_icon.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_button.png create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_button.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_icon.png rename Assets/External/{Horizon Based Ambient Occlusion/Editor/Resources/icon.png.meta => VolumetricLightBeam/Editor/Icons/VolumetricShadow_icon.png.meta} (81%) create mode 100644 Assets/External/VolumetricLightBeam/Editor/OnBuildPostprocess.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/OnBuildPostprocess.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/OnBuildPreprocess.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/OnBuildPreprocess.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/OnBuildTargetChanged.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/OnBuildTargetChanged.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/RenderQueueDrawer.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/RenderQueueDrawer.cs.meta rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP => VolumetricLightBeam}/Editor/Resources.meta (77%) create mode 100644 Assets/External/VolumetricLightBeam/Editor/Resources/VLBEditorData.asset create mode 100644 Assets/External/VolumetricLightBeam/Editor/Resources/VLBEditorData.asset.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/SD.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/SD/Editor_CommonSD.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/SD/Editor_CommonSD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionAbstractBase.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionAbstractBase.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionDepthBuffer.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionDepthBuffer.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionRaycasting.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionRaycasting.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/SD/Editor_SkewingHandleSD.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/SD/Editor_SkewingHandleSD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/SD/Editor_VolumetricLightBeamSD.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/SD/Editor_VolumetricLightBeamSD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/SortingLayerAndOrderDrawer.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/SortingLayerAndOrderDrawer.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Editor/TargetList.cs create mode 100644 Assets/External/VolumetricLightBeam/Editor/TargetList.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Resources.meta create mode 100644 Assets/External/VolumetricLightBeam/Resources/DustParticles.mat create mode 100644 Assets/External/VolumetricLightBeam/Resources/DustParticles.mat.meta create mode 100644 Assets/External/VolumetricLightBeam/Resources/DustParticles.prefab create mode 100644 Assets/External/VolumetricLightBeam/Resources/DustParticles.prefab.meta create mode 100644 Assets/External/VolumetricLightBeam/Resources/DustParticles.psd rename Assets/External/{Horizon Based Ambient Occlusion/Demo/Models/Textures/Dragons.png.meta => VolumetricLightBeam/Resources/DustParticles.psd.meta} (81%) create mode 100644 Assets/External/VolumetricLightBeam/Resources/Noise3D_64x64x64.asset create mode 100644 Assets/External/VolumetricLightBeam/Resources/Noise3D_64x64x64.asset.meta create mode 100644 Assets/External/VolumetricLightBeam/Resources/VLBBlueNoise.png create mode 100644 Assets/External/VolumetricLightBeam/Resources/VLBBlueNoise.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Resources/VLBDitheringNoise.png create mode 100644 Assets/External/VolumetricLightBeam/Resources/VLBDitheringNoise.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Animations.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.anim create mode 100644 Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.anim.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.controller create mode 100644 Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.controller.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.anim create mode 100644 Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.anim.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.controller create mode 100644 Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.controller.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.anim create mode 100644 Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.anim.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.controller create mode 100644 Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.controller.meta rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP/Demo => VolumetricLightBeam/Samples}/Materials.meta (77%) create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/Cookies.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_colored.jpg create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_colored.jpg.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_fan.png create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_fan.png.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_heart.psd create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_heart.psd.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_star.psd create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_star.psd.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/checkIfInsideBeam.mat create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/checkIfInsideBeam.mat.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/geometry_hdrp.mat rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Post Process Volume Profile.asset.meta => VolumetricLightBeam/Samples/Materials/geometry_hdrp.mat.meta} (64%) create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/geometry_urp.mat rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials/Dragons.mat.meta => VolumetricLightBeam/Samples/Materials/geometry_urp.mat.meta} (78%) create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/green.mat create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/green.mat.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/red.mat create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/red.mat.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/skybox.mat create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/skybox.mat.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/white.mat create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/white.mat.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/yellow.mat create mode 100644 Assets/External/VolumetricLightBeam/Samples/Materials/yellow.mat.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scenes.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scenes/demoScenePrefab.prefab create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scenes/demoScenePrefab.prefab.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_builtin_pipeline.unity create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_builtin_pipeline.unity.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_hdrp.unity create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_hdrp.unity.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_urp.unity create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_urp.unity.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scenes/demoStressTest.unity create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scenes/demoStressTest.unity.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scripts.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scripts/CameraToggleBeamVisibility.cs create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scripts/CameraToggleBeamVisibility.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scripts/CheckIfInsideBeam.cs create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scripts/CheckIfInsideBeam.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scripts/FeaturesNotSupportedMessage.cs create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scripts/FeaturesNotSupportedMessage.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scripts/FreeCameraController.cs create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scripts/FreeCameraController.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scripts/LightGenerator.cs create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scripts/LightGenerator.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scripts/Rotater.cs create mode 100644 Assets/External/VolumetricLightBeam/Samples/Scripts/Rotater.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/BatchingHelper.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/BatchingHelper.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/BeamGeometryAbstractBase.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/BeamGeometryAbstractBase.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/CachedLightProperties.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/CachedLightProperties.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/Config.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/Config.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/Consts.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/Consts.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/DummyMaterial.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/DummyMaterial.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/EditorPrefsStrings.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/EditorPrefsStrings.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/EffectAbstractBase.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/EffectAbstractBase.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/EffectFlicker.cs rename Assets/External/{Horizon Based Ambient Occlusion/Demo/Runtime/HBAOControl.cs.meta => VolumetricLightBeam/Scripts/EffectFlicker.cs.meta} (50%) create mode 100644 Assets/External/VolumetricLightBeam/Scripts/EffectFromProfile.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/EffectFromProfile.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/EffectPulse.cs rename Assets/External/{Horizon Based Ambient Occlusion/Demo/Runtime/RotateObject.cs.meta => VolumetricLightBeam/Scripts/EffectPulse.cs.meta} (50%) create mode 100644 Assets/External/VolumetricLightBeam/Scripts/Enums.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/Enums.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/BeamGeometryHD.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/BeamGeometryHD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/GlobalMeshHD.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/GlobalMeshHD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/RaymarchingQuality.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/RaymarchingQuality.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/TrackRealtimeChangesOnLightHD.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/TrackRealtimeChangesOnLightHD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricCookieHD.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricCookieHD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD2D.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD2D.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricShadowHD.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricShadowHD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HighlightNullAttribute.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/HighlightNullAttribute.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/MaterialManager.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/MaterialManager.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/MaterialModifier.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/MaterialModifier.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/MeshGenerator.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/MeshGenerator.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/MinMaxRangeFloat.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/MinMaxRangeFloat.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/Noise3D.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/Noise3D.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/PlatformHelper.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/PlatformHelper.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/PolygonHelper.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/PolygonHelper.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SD.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SD/BeamGeometrySD.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SD/BeamGeometrySD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionAbstractBase.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionAbstractBase.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionDepthBuffer.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionDepthBuffer.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionRaycasting.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionRaycasting.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SD/GlobalMeshSD.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SD/GlobalMeshSD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SD/SkewingHandleSD.cs rename Assets/External/{Horizon Based Ambient Occlusion/Editor/HBAOEditor.cs.meta => VolumetricLightBeam/Scripts/SD/SkewingHandleSD.cs.meta} (50%) create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SD/VolumetricLightBeamSD.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SD/VolumetricLightBeamSD.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SRPHelper.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SRPHelper.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/ShaderGenerator.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/ShaderGenerator.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/ShaderKeywords.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/ShaderKeywords.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/ShaderProperties.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/ShaderProperties.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SpotLightHelper.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/SpotLightHelper.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/TransformUtils.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/TransformUtils.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/TriggerZone.cs rename Assets/External/{Horizon Based Ambient Occlusion/Editor/HBAOGaiaExtension.cs.meta => VolumetricLightBeam/Scripts/TriggerZone.cs.meta} (50%) create mode 100644 Assets/External/VolumetricLightBeam/Scripts/Utils.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/Utils.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/UtilsBeamProps.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/UtilsBeamProps.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/Version.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/Version.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/VolumetricDustParticles.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/VolumetricDustParticles.cs.meta create mode 100644 Assets/External/VolumetricLightBeam/Scripts/VolumetricLightBeamAbstractBase.cs create mode 100644 Assets/External/VolumetricLightBeam/Scripts/VolumetricLightBeamAbstractBase.cs.meta rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP => VolumetricLightBeam}/Shaders.meta (77%) create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderDefines.cginc create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderDefines.cginc.meta create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderGenerator.asset create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderGenerator.asset.meta create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderMaths.cginc create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderMaths.cginc.meta create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderProperties.cginc create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderProperties.cginc.meta create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderPropertySystem.cginc create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderPropertySystem.cginc.meta create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificBuiltin.cginc create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificBuiltin.cginc.meta create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificHDRP.hlsl create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificHDRP.hlsl.meta create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificURP.cginc create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificURP.cginc.meta create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderUtils.cginc create mode 100644 Assets/External/VolumetricLightBeam/Shaders/ShaderUtils.cginc.meta create mode 100644 Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialHD.mat rename Assets/External/{Horizon Based Ambient Occlusion/Demo/Runtime/HBAO.Demo.Runtime.asmdef.meta => VolumetricLightBeam/Shaders/VLBDummyMaterialHD.mat.meta} (52%) create mode 100644 Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialSD.mat create mode 100644 Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialSD.mat.meta create mode 100644 Assets/External/VolumetricLightBeam/Shaders/VLBGeneratedShaderHD.shader rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO.shader.meta => VolumetricLightBeam/Shaders/VLBGeneratedShaderHD.shader.meta} (80%) create mode 100644 Assets/External/VolumetricLightBeam/Shaders/VLBGeneratedShaderSD.shader rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_AO.hlsl.meta => VolumetricLightBeam/Shaders/VLBGeneratedShaderSD.shader.meta} (80%) create mode 100644 Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedHD.cginc rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Blur.hlsl.meta => VolumetricLightBeam/Shaders/VolumetricLightBeamSharedHD.cginc.meta} (80%) create mode 100644 Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedSD.cginc create mode 100644 Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedSD.cginc.meta create mode 100644 Assets/External/VolumetricLightBeam/Shaders/shadergen_base.txt rename Assets/External/{Horizon Based Ambient Occlusion/Readme.txt.meta => VolumetricLightBeam/Shaders/shadergen_base.txt.meta} (54%) create mode 100644 Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_builtin.txt rename Assets/External/{Horizon Based Ambient Occlusion/Demo/Models/Materials/Dragons.mat.meta => VolumetricLightBeam/Shaders/shadergen_includes_builtin.txt.meta} (55%) create mode 100644 Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_hdrp.txt rename Assets/External/{Horizon Based Ambient Occlusion/SRP/Readme.txt.meta => VolumetricLightBeam/Shaders/shadergen_includes_hdrp.txt.meta} (54%) create mode 100644 Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_urp.txt create mode 100644 Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_urp.txt.meta create mode 100644 Assets/External/VolumetricLightBeam/Shaders/shadergen_pass.txt create mode 100644 Assets/External/VolumetricLightBeam/Shaders/shadergen_pass.txt.meta create mode 100644 Assets/External/VolumetricLightBeam/package.json rename Assets/External/{Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs/Dragons Candle.prefab.meta => VolumetricLightBeam/package.json.meta} (62%) create mode 100644 Assets/Resources/VLBConfigOverride.asset create mode 100644 Assets/Resources/VLBConfigOverride.asset.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Cookie.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Cookie/Light Cookie.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Cookie/Light Cookie.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorD03].mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorD03].mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorI07].mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorI07].mat.meta rename Assets/{External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials/Dragons.mat => ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-1.mat} (91%) create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-1.mat.meta rename Assets/{External/Horizon Based Ambient Occlusion/Demo/Models/Materials/Dragons.mat => ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-2.mat} (53%) create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-2.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-3.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-3.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-4.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-4.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-5.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-5.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/floor.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/floor.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-1.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-1.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-2.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-2.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-3.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-3.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/glass.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/glass.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble1.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble1.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble2.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble2.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble3.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble3.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble4.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble4.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof2.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof2.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/silver.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/silver.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone3.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone3.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wall.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wall.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/window.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/window.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood1.mat create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood1.mat.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5__UNIGLTF__DUPLICATED__2.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5__UNIGLTF__DUPLICATED__2.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/금속2_수정.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/금속2_수정.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__2.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__2.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__3.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__3.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__4.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__4.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__5.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__5.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__2.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__2.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__3.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__3.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__4.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__4.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__5.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__5.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__6.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__6.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/돌바닥2.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/돌바닥2.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/벽돌2-1.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/벽돌2-1.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/석재.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/석재.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/지붕2.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/지붕2.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.glb create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.glb.meta rename Assets/{External/Horizon Based Ambient Occlusion/Demo/DemoSettings.lighting => ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/New Lighting Settings.lighting} (68%) rename Assets/{External/Horizon Based Ambient Occlusion/Demo/DemoSettings.lighting.meta => ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/New Lighting Settings.lighting.meta} (80%) create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic.unity rename Assets/{External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Demo.unity.meta => ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic.unity.meta} (74%) create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Global Volume Profile.asset create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Global Volume Profile.asset.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/LightingData.asset create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/LightingData.asset.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_dir.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_dir.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_light.exr create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_light.exr.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_shadowmask.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_shadowmask.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_dir.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_dir.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_light.exr create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_light.exr.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_shadowmask.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_shadowmask.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_dir.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_dir.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_light.exr create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_light.exr.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_shadowmask.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_shadowmask.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_dir.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_dir.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_light.exr create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_light.exr.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_shadowmask.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_shadowmask.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_dir.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_dir.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_light.exr create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_light.exr.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_shadowmask.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_shadowmask.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_dir.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_dir.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_light.exr create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_light.exr.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_shadowmask.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_shadowmask.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_dir.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_dir.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_light.exr create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_light.exr.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_shadowmask.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_shadowmask.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_dir.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_dir.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_light.exr create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_light.exr.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_shadowmask.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_shadowmask.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_dir.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_dir.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_light.exr create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_light.exr.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_shadowmask.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_shadowmask.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_dir.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_dir.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_light.exr create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_light.exr.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_shadowmask.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_shadowmask.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_dir.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_dir.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_light.exr create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_light.exr.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_shadowmask.png create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_shadowmask.png.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-0.exr create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-0.exr.meta create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-1.exr create mode 100644 Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-1.exr.meta diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials.meta b/Assets/External/AmplifyShaderEditor.meta similarity index 67% rename from Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials.meta rename to Assets/External/AmplifyShaderEditor.meta index ef77836e..5e8940d5 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials.meta +++ b/Assets/External/AmplifyShaderEditor.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 29ca2b7c485291d4b92e1a7e3c2ec3a7 +guid: daca988099666ec40aaa2cde22bb4935 folderAsset: yes -timeCreated: 1455959813 +timeCreated: 1441276737 licenseType: Store DefaultImporter: userData: diff --git a/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAO.Editor.asmdef b/Assets/External/AmplifyShaderEditor/AmplifyShaderEditor.asmdef similarity index 51% rename from Assets/External/Horizon Based Ambient Occlusion/Editor/HBAO.Editor.asmdef rename to Assets/External/AmplifyShaderEditor/AmplifyShaderEditor.asmdef index 7ce3da17..9cb8cff4 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAO.Editor.asmdef +++ b/Assets/External/AmplifyShaderEditor/AmplifyShaderEditor.asmdef @@ -1,17 +1,15 @@ { - "name": "HBAO.Editor", - "references": [ - "GUID:b83dc51897666cb44bdfbf9671f74e85" - ], - "optionalUnityReferences": [], + "name": "AmplifyShaderEditor", + "references": [], "includePlatforms": [ "Editor" ], "excludePlatforms": [], - "allowUnsafeCode": false, + "allowUnsafeCode": true, "overrideReferences": false, "precompiledReferences": [], "autoReferenced": true, "defineConstraints": [], - "versionDefines": [] + "versionDefines": [], + "noEngineReferences": false } \ No newline at end of file diff --git a/Assets/External/AmplifyShaderEditor/AmplifyShaderEditor.asmdef.meta b/Assets/External/AmplifyShaderEditor/AmplifyShaderEditor.asmdef.meta new file mode 100644 index 00000000..ccc897c9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/AmplifyShaderEditor.asmdef.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: f540dafdfbc0586439d98823585550d4 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/AmplifyShaderEditor.asmdef + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/ChangeLog.txt b/Assets/External/AmplifyShaderEditor/ChangeLog.txt new file mode 100644 index 00000000..fb415a4e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/ChangeLog.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:96e08dda491ed0daf1a19aec64477d4f4fa0a58c910b25bb9c2c97ccccba48ac +size 257263 diff --git a/Assets/External/AmplifyShaderEditor/ChangeLog.txt.meta b/Assets/External/AmplifyShaderEditor/ChangeLog.txt.meta new file mode 100644 index 00000000..6cbf3241 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/ChangeLog.txt.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 580cccd3e608b7f4cac35ea46d62d429 +timeCreated: 1481127071 +licenseType: Store +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/ChangeLog.txt + uploadId: 723576 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo.meta b/Assets/External/AmplifyShaderEditor/Examples.meta similarity index 67% rename from Assets/External/Horizon Based Ambient Occlusion/Demo.meta rename to Assets/External/AmplifyShaderEditor/Examples.meta index 06cd026a..607a472e 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo.meta +++ b/Assets/External/AmplifyShaderEditor/Examples.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 264dde3b9012fa346b510f9f1d502066 +guid: 425c3aed47dd05444960ca41af18e591 folderAsset: yes -timeCreated: 1455959812 +timeCreated: 1481126943 licenseType: Store DefaultImporter: userData: diff --git a/Assets/External/AmplifyShaderEditor/Examples/Built-In Samples.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/Built-In Samples.unitypackage new file mode 100644 index 00000000..5e813b23 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/Built-In Samples.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d721a950d95509f432c879251e0341c5fd08e56ab3360bb7dccb366445ad6e26 +size 553352 diff --git a/Assets/External/AmplifyShaderEditor/Examples/Built-In Samples.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/Built-In Samples.unitypackage.meta new file mode 100644 index 00000000..71e79def --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/Built-In Samples.unitypackage.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e00e6f90ab8233e46a41c5e33917c642 +timeCreated: 1585839223 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/Built-In Samples.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/Credits.txt b/Assets/External/AmplifyShaderEditor/Examples/Credits.txt new file mode 100644 index 00000000..fb2858ff --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/Credits.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:054acf7a2b8cd8be226446b18d7968ce028e234f6861fbb0445d37090b610787 +size 347 diff --git a/Assets/External/AmplifyShaderEditor/Examples/Credits.txt.meta b/Assets/External/AmplifyShaderEditor/Examples/Credits.txt.meta new file mode 100644 index 00000000..e04dd514 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/Credits.txt.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 451790f45b4e5434586d16e924540ee7 +timeCreated: 1481127071 +licenseType: Store +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/Credits.txt + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 10x.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 10x.unitypackage new file mode 100644 index 00000000..9f84227d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 10x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c76a44ae1a47d402766775a8918adb85f35e17df756922da9e8309df97857f3d +size 250305 diff --git a/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 10x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 10x.unitypackage.meta new file mode 100644 index 00000000..51686679 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 10x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 9da5530d5ebfab24c8ecad68795e720f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/HDRP Samples 10x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 12x.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 12x.unitypackage new file mode 100644 index 00000000..d14d4877 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 12x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2dddb22c12b56af0c4ad7e1bf30b23fef3d8c92168dfb95217a840889971206e +size 310928 diff --git a/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 12x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 12x.unitypackage.meta new file mode 100644 index 00000000..e6511c51 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 12x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: aa102d640b98b5d4781710a3a3dd6983 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/HDRP Samples 12x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 14x.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 14x.unitypackage new file mode 100644 index 00000000..bc93f501 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 14x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6141aec3831087c3572ea02c7c4c54febe12a3092cf63fdd6d754833151631a +size 311818 diff --git a/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 14x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 14x.unitypackage.meta new file mode 100644 index 00000000..6b8e1437 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 14x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 7a0bb33169d95ec499136d59cb25918b +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/HDRP Samples 14x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 15x.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 15x.unitypackage new file mode 100644 index 00000000..74caf4b1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 15x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:526d91909bb63aa52489d4d56a3dce038e149061506a2d2a5047e7ee87511090 +size 302644 diff --git a/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 15x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 15x.unitypackage.meta new file mode 100644 index 00000000..02d5f83b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 15x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 641c955d37d2fac4f87e00ac5c9d9bd8 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/HDRP Samples 15x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 16x.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 16x.unitypackage new file mode 100644 index 00000000..980eb1cb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 16x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97a5f8e0f514a1e6f20c23880198720d0d09fca57b2e040f30ad02dcb36c5d9a +size 306013 diff --git a/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 16x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 16x.unitypackage.meta new file mode 100644 index 00000000..d803b2b5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 16x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 2690f45490c175045bbdc63395bf6278 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/HDRP Samples 16x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 17x.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 17x.unitypackage new file mode 100644 index 00000000..2fa4a3d1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 17x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d4de2fb896ed4c121dc90a593c127da32981b5f40b98c666627c4e2cbdd1f61 +size 321892 diff --git a/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 17x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 17x.unitypackage.meta new file mode 100644 index 00000000..34a7d916 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples 17x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: f42c2bc4dab4723429b0d30b635c3035 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/HDRP Samples 17x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples.unitypackage new file mode 100644 index 00000000..a730cf4d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71201a3357b1d835eb35e3fb0c5df2287348847fa3ca8963300de78eaf04027d +size 1662661 diff --git a/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples.unitypackage.meta new file mode 100644 index 00000000..d1366602 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/HDRP Samples.unitypackage.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d1c0b77896049554fa4b635531caf741 +timeCreated: 1533059192 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/HDRP Samples.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/README Samples.txt b/Assets/External/AmplifyShaderEditor/Examples/README Samples.txt new file mode 100644 index 00000000..10e72feb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/README Samples.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7126b961120bb9e567d6ab19d7a60af14287b2642a83b0f596e1a9edd9486732 +size 1302 diff --git a/Assets/External/AmplifyShaderEditor/Examples/README Samples.txt.meta b/Assets/External/AmplifyShaderEditor/Examples/README Samples.txt.meta new file mode 100644 index 00000000..af4e859c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/README Samples.txt.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5c5208e121a880c4fbb9de7aaeaa8aa2 +timeCreated: 1541776170 +licenseType: Store +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/README Samples.txt + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/Sample Resources.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/Sample Resources.unitypackage new file mode 100644 index 00000000..a2c8d343 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/Sample Resources.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a021361101f56aab945c20ee2c00b20e9654c8377de0923170ad952ada8c8186 +size 45771425 diff --git a/Assets/External/AmplifyShaderEditor/Examples/Sample Resources.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/Sample Resources.unitypackage.meta new file mode 100644 index 00000000..4c6c0fcf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/Sample Resources.unitypackage.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c0a0a980c9ba86345bc15411db88d34f +timeCreated: 1585839223 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/Sample Resources.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/URP Samples 10x.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 10x.unitypackage new file mode 100644 index 00000000..3ec8a52b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 10x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1fac6a92f01d0b926a3f4f17888b91863b9ac94c14ce7847321ea8c8bc871dd +size 62361 diff --git a/Assets/External/AmplifyShaderEditor/Examples/URP Samples 10x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 10x.unitypackage.meta new file mode 100644 index 00000000..2c5b9cd0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 10x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 2edbf4a9b9544774bbef617e92429664 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/URP Samples 10x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/URP Samples 12x.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 12x.unitypackage new file mode 100644 index 00000000..6f081201 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 12x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b06535db05e3533931ddc3de31eff2bb1cd7523973a5870752073cb53ac7317 +size 75338 diff --git a/Assets/External/AmplifyShaderEditor/Examples/URP Samples 12x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 12x.unitypackage.meta new file mode 100644 index 00000000..7501209f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 12x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 13ab599a7bda4e54fba3e92a13c9580a +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/URP Samples 12x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/URP Samples 14x.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 14x.unitypackage new file mode 100644 index 00000000..598060e9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 14x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9aeee193783028df7ec189deb985b664b16bd7d47f9e42841084afd1313a383e +size 76479 diff --git a/Assets/External/AmplifyShaderEditor/Examples/URP Samples 14x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 14x.unitypackage.meta new file mode 100644 index 00000000..516cc8a0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 14x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: f6f268949ccf3f34fa4d18e92501ed82 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/URP Samples 14x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/URP Samples 15x.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 15x.unitypackage new file mode 100644 index 00000000..4b0799ef --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 15x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0946d155a8eecfbde1f18718baa919bd15561eab31c0bd301fefa66f218f296f +size 79828 diff --git a/Assets/External/AmplifyShaderEditor/Examples/URP Samples 15x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 15x.unitypackage.meta new file mode 100644 index 00000000..0acdc73e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 15x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 69bc3229216b1504ea3e28b5820bbb0d +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/URP Samples 15x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/URP Samples 16x.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 16x.unitypackage new file mode 100644 index 00000000..84c4f2ca --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 16x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:313d64349235bf922e0eb8f567be7b7c66a9b8f49f6934cef756814ad015d932 +size 82619 diff --git a/Assets/External/AmplifyShaderEditor/Examples/URP Samples 16x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 16x.unitypackage.meta new file mode 100644 index 00000000..e60e0c5f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 16x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 4f665a06c5a2aa5499fa1c79ac058999 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/URP Samples 16x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/URP Samples 17x.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 17x.unitypackage new file mode 100644 index 00000000..df006657 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 17x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe6d9d2c9fec1f1660c4540fcfa2bead357a2afde94d911415d487d8e4fde5aa +size 85083 diff --git a/Assets/External/AmplifyShaderEditor/Examples/URP Samples 17x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 17x.unitypackage.meta new file mode 100644 index 00000000..24112cba --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/URP Samples 17x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 47fc5ccecd261894994c1e9e827cf553 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/URP Samples 17x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Examples/URP Samples.unitypackage b/Assets/External/AmplifyShaderEditor/Examples/URP Samples.unitypackage new file mode 100644 index 00000000..4172bfd7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/URP Samples.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cce3cc148644e4db9b44a352f5a91adfcb1f3c2b335320e15ce733d349756f5c +size 149179 diff --git a/Assets/External/AmplifyShaderEditor/Examples/URP Samples.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Examples/URP Samples.unitypackage.meta new file mode 100644 index 00000000..a409e798 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Examples/URP Samples.unitypackage.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a9d68dd8913f05d4d9ce75e7b40c6044 +timeCreated: 1575902011 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Examples/URP Samples.unitypackage + uploadId: 723576 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Models.meta b/Assets/External/AmplifyShaderEditor/Plugins.meta similarity index 67% rename from Assets/External/Horizon Based Ambient Occlusion/Demo/Models.meta rename to Assets/External/AmplifyShaderEditor/Plugins.meta index bd1a108f..301d4048 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Models.meta +++ b/Assets/External/AmplifyShaderEditor/Plugins.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 28143174a74ad204d9199cb14598af2f +guid: 3306ce0ede814a84c8d289893da72b7a folderAsset: yes -timeCreated: 1455959813 +timeCreated: 1481126943 licenseType: Store DefaultImporter: userData: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor.meta new file mode 100644 index 00000000..e7035616 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4a66239afbf6d2c4eb99238642c8d40f +folderAsset: yes +timeCreated: 1481126943 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions.meta new file mode 100644 index 00000000..060fde10 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a2ba8588f45692f4ea2fa5afa9faf434 +folderAsset: yes +timeCreated: 1481126944 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs new file mode 100644 index 00000000..67572b46 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs @@ -0,0 +1,336 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public class ActionData + { + public virtual void ExecuteForward() { } + public virtual void ExecuteReverse() { } + } + + // NODES + // Create node + public class CreateNodeActionData : ActionData + { + private int m_nodeId; + private System.Type m_nodeType; + private Vector2 m_nodePos; + + public CreateNodeActionData( ParentNode node ) + { + m_nodeId = node.UniqueId; + m_nodePos = node.Vec2Position; + m_nodeType = node.GetType(); + } + + + public CreateNodeActionData( int nodeId, System.Type nodeType, Vector2 nodePos ) + { + m_nodeId = nodeId; + m_nodePos = nodePos; + m_nodeType = nodeType; + } + + public override void ExecuteForward() + { + UIUtils.CreateNode( m_nodeType, false, m_nodePos, m_nodeId ); + } + + public override void ExecuteReverse() + { + UIUtils.DestroyNode( m_nodeId ); + } + + public override string ToString() + { + return "Create Node - Type: " + m_nodeType + " Node: " + m_nodeId + " Position: " + m_nodePos; + } + } + + // Destroy node + public class DestroyNodeActionData : ActionData + { + private int m_nodeId; + private System.Type m_nodeType; + private Vector2 m_nodePos; + + public DestroyNodeActionData( ParentNode node ) + { + m_nodeId = node.UniqueId; + m_nodePos = node.Vec2Position; + m_nodeType = node.GetType(); + } + + public DestroyNodeActionData( int nodeId, System.Type nodeType, Vector2 nodePos ) + { + m_nodeId = nodeId; + m_nodePos = nodePos; + m_nodeType = nodeType; + } + + public override void ExecuteForward() + { + UIUtils.DestroyNode( m_nodeId ); + } + + public override void ExecuteReverse() + { + UIUtils.CreateNode( m_nodeType, false, m_nodePos, m_nodeId ); + } + + public override string ToString() + { + return "Destroy Node - Type: " + m_nodeType + " Node: " + m_nodeId + " Position: " + m_nodePos; + } + } + + // Move node + public class MoveNodeActionData : ActionData + { + private int m_nodeId; + private Vector2 m_nodeInitalPos; + private Vector2 m_nodeFinalPos; + + public MoveNodeActionData( int nodeId, Vector2 nodeInitialPos, Vector2 nodeFinalPos ) + { + m_nodeId = nodeId; + m_nodeInitalPos = nodeInitialPos; + m_nodeFinalPos = nodeFinalPos; + } + + public override void ExecuteForward() + { + ParentNode node = UIUtils.GetNode( m_nodeId ); + if ( node != null ) + node.Vec2Position = m_nodeFinalPos; + } + + public override void ExecuteReverse() + { + ParentNode node = UIUtils.GetNode( m_nodeId ); + if ( node != null ) + node.Vec2Position = m_nodeInitalPos; + } + + public override string ToString() + { + return "Move Node - Node: " + m_nodeId + " Initial Position: " + m_nodeInitalPos + " Final Position: " + m_nodeFinalPos; + } + } + + // CONNECTIONS + // Create connection + public class CreateConnectionActionData : ActionData + { + private int m_inputNodeId; + private int m_inputPortId; + + private int m_outputNodeId; + private int m_outputPortId; + + public CreateConnectionActionData( int inputNodeId, int inputPortId, int outputNodeId, int outputPortId ) + { + m_inputNodeId = inputNodeId; + m_inputPortId = inputPortId; + m_outputNodeId = outputNodeId; + m_outputPortId = outputPortId; + } + + public override void ExecuteForward() + { + UIUtils.ConnectInputToOutput( m_inputNodeId, m_inputPortId, m_outputNodeId, m_outputPortId ); + } + + public override void ExecuteReverse() + { + UIUtils.DeleteConnection( true, m_inputNodeId, m_inputPortId, false, true ); + } + + public override string ToString() + { + return "Create Connection Node - Input Node: " + m_inputNodeId + " Input Port: " + m_inputPortId + " Output Node: " + m_outputNodeId + " Output Port: " + m_outputPortId; + } + } + + // Destroy connection + public class DestroyConnectionActionData : ActionData + { + private int m_inputNodeId; + private int m_inputPortId; + + private int m_outputNodeId; + private int m_outputPortId; + + public DestroyConnectionActionData( int inputNodeId, int inputPortId, int outputNodeId, int outputPortId ) + { + m_inputNodeId = inputNodeId; + m_inputPortId = inputPortId; + m_outputNodeId = outputNodeId; + m_outputPortId = outputPortId; + } + + public override void ExecuteForward() + { + UIUtils.DeleteConnection( true, m_inputNodeId, m_inputPortId, false, true ); + } + + public override void ExecuteReverse() + { + UIUtils.ConnectInputToOutput( m_inputNodeId, m_inputPortId, m_outputNodeId, m_outputPortId ); + } + + public override string ToString() + { + return "Destroy Connection Node - Input Node: " + m_inputNodeId + " Input Port: " + m_inputPortId + " Output Node: " + m_outputNodeId + " Output Port: " + m_outputPortId; + } + } + + // Move connection + public class MoveInputConnectionActionData : ActionData + { + private int m_oldInputNodeId; + private int m_oldInputNodePortId; + + private int m_newInputNodeId; + private int m_newInputNodePortId; + + private int m_outputNodeId; + private int m_outputPortId; + + public MoveInputConnectionActionData( int oldInputNodeId, int oldInputPortId, int newInputNodeId, int newInputPortId, int outputNodeId, int outputPortId ) + { + m_oldInputNodeId = oldInputNodeId; + m_oldInputNodePortId = oldInputPortId; + + m_newInputNodeId = newInputNodeId; + m_newInputNodePortId = newInputPortId; + + m_outputNodeId = outputNodeId; + m_outputPortId = outputPortId; + } + + public override void ExecuteForward() + { + UIUtils.DeleteConnection( true, m_oldInputNodeId, m_oldInputNodePortId, false, true ); + UIUtils.ConnectInputToOutput( m_newInputNodeId, m_newInputNodePortId, m_outputNodeId, m_outputPortId ); + } + + public override void ExecuteReverse() + { + base.ExecuteReverse(); + UIUtils.DeleteConnection( true, m_newInputNodeId, m_newInputNodePortId, false, true ); + UIUtils.ConnectInputToOutput( m_oldInputNodeId, m_oldInputNodePortId, m_outputNodeId, m_outputPortId ); + } + + public override string ToString() + { + return "Move Input Connection Node - Old Input Node: " + m_oldInputNodeId + " Old Input Port: " + m_oldInputNodePortId + " New Input Node: " + m_newInputNodeId + " New Input Port: " + m_newInputNodePortId + " Output Node: " + m_outputNodeId + " Output Port: " + m_outputPortId; + } + } + + public class MoveOutputConnectionActionData : ActionData + { + private int m_inputNodeId; + private int m_inputPortId; + + private int m_newOutputNodeId; + private int m_newOutputPortId; + + private int m_oldOutputNodeId; + private int m_oldOutputPortId; + + public MoveOutputConnectionActionData( int inputNodeId, int inputPortId, int newOutputNodeId, int newOutputPortId, int oldOutputNodeId, int oldOutputPortId ) + { + m_inputNodeId = inputNodeId; + m_inputPortId = inputPortId; + + m_newOutputNodeId = newOutputNodeId; + m_newOutputPortId = newOutputPortId; + + m_oldOutputNodeId = oldOutputNodeId; + m_oldOutputPortId = oldOutputPortId; + } + + public override void ExecuteForward() + { + UIUtils.DeleteConnection( false, m_oldOutputNodeId, m_oldOutputNodeId, false, true ); + UIUtils.ConnectInputToOutput( m_inputNodeId, m_inputPortId, m_newOutputNodeId, m_newOutputPortId ); + } + + public override void ExecuteReverse() + { + base.ExecuteReverse(); + UIUtils.DeleteConnection( false, m_newOutputNodeId, m_newOutputPortId, false, true ); + UIUtils.ConnectInputToOutput( m_inputNodeId, m_inputPortId, m_oldOutputNodeId, m_oldOutputPortId ); + } + + public override string ToString() + { + return "Move Input Connection Node - Input Node: " + m_inputNodeId + " Input Port: " + m_inputPortId + " Old Output Node: " + m_oldOutputNodeId + " Old Output Port: " + m_oldOutputPortId + " New Output Node: " + m_newOutputNodeId + " New Output Port: " + m_newOutputPortId; + } + } + + public class CreateNewGraphActionData : ActionData + { + private string m_name; + + public CreateNewGraphActionData( string name ) + { + m_name = name; + } + + public override void ExecuteForward() + { + UIUtils.CreateNewGraph( m_name ); + } + } + + public class ChangeNodePropertiesActionData : ActionData + { + private string m_originalProperties; + private string m_newProperties; + private int m_nodeId; + + public ChangeNodePropertiesActionData( ParentNode node, string originalProperties ) + { + m_nodeId = node.UniqueId; + m_originalProperties = originalProperties; + + m_newProperties = string.Empty; + string trash = string.Empty; + node.WriteToString( ref m_newProperties, ref trash ); + } + + public ChangeNodePropertiesActionData( int nodeId, string originalProperties ) + { + m_nodeId = nodeId; + m_originalProperties = originalProperties; + + m_newProperties = string.Empty; + string trash = string.Empty; + UIUtils.GetNode( nodeId ).WriteToString( ref m_newProperties, ref trash ); + } + + public override void ExecuteForward() + { + string[] properties = m_newProperties.Split( IOUtils.FIELD_SEPARATOR ); + UIUtils.GetNode( m_nodeId ).ReadFromString( ref properties ); + } + + public override void ExecuteReverse() + { + string[] properties = m_originalProperties.Split( IOUtils.FIELD_SEPARATOR ); + UIUtils.GetNode( m_nodeId ).ReadFromString( ref properties ); + } + + public override string ToString() + { + return "Change Node Propertie - Node: " + m_nodeId + "\nOriginal Properties:\n" + m_originalProperties + "\nNew Properties:\n" + m_newProperties; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs.meta new file mode 100644 index 00000000..f4a7f8b3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 29204f353101f46439a93f1c503d3197 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs new file mode 100644 index 00000000..666c9020 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs @@ -0,0 +1,58 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + public class ActionLog + { + private int m_maxCount; + private int m_index; + private List m_sequence; + + public ActionLog(int maxCount) + { + m_maxCount = maxCount; + m_index = 0; + m_sequence = new List(); + } + + public void AddToLog(ActionData actionData) + { + if (m_sequence.Count > m_maxCount) + { + m_sequence.RemoveAt(0); + } + + m_sequence.Add(actionData); + m_index = m_sequence.Count - 1; + } + + + public void UndoLastAction() + { + if ( m_index > -1 && m_index < m_sequence.Count ) + m_sequence[m_index--].ExecuteReverse(); + } + + public void RedoLastAction() + { + if (m_index < (m_sequence.Count - 1)) + m_sequence[++m_index].ExecuteForward(); + + } + + public void ClearLog() + { + m_sequence.Clear(); + m_index = 0; + } + + public void Destroy() + { + m_sequence.Clear(); + m_sequence = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs.meta new file mode 100644 index 00000000..4b24cfce --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: bc089a69595d8994cb89946a919517c2 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs new file mode 100644 index 00000000..c60480e0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs @@ -0,0 +1,39 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System.Collections.Generic; +namespace AmplifyShaderEditor +{ + public class ActionSequence + { + private string m_name; + private List m_sequence; + + public ActionSequence( string name ) + { + m_name = name; + m_sequence = new List(); + } + + public void AddToSequence( ActionData actionData ) + { + m_sequence.Add( actionData ); + } + + public void Execute() + { + for ( int i = 0; i < m_sequence.Count; i++ ) + { + m_sequence[ i ].ExecuteForward(); + } + } + + public void Destroy() + { + m_sequence.Clear(); + m_sequence = null; + } + + public string Name { get { return m_name; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs.meta new file mode 100644 index 00000000..7db11db4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 43bd963fa46ee9c4680dacff1d8dc0b9 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Constants.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Constants.cs new file mode 100644 index 00000000..5a4a8cef --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Constants.cs @@ -0,0 +1,674 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + + public struct Constants + { + /*public readonly static string[] CustomASEStandardArgsMacros = + { + "#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC)//ASE Args Macros", + "#define ASE_TEXTURE2D_ARGS(textureName) Texture2D textureName, SamplerState sampler##textureName", + "#define ASE_TEXTURE3D_ARGS(textureName) Texture3D textureName, SamplerState sampler##textureName", + "#define ASE_TEXTURECUBE_ARGS(textureName) TextureCube textureName, SamplerState sampler##textureName", + "#define ASE_TEXTURE2D_PARAMS(textureName) textureName, sampler##textureName", + "#define ASE_TEXTURE3D_PARAMS(textureName) textureName, sampler##textureName", + "#define ASE_TEXTURECUBE_PARAMS(textureName) textureName, sampler##textureName", + "#define ASE_TEXTURE2D_ARRAY_PARAMS(textureName) textureName, sampler##textureName", + "#else//ASE Args Macros", + "#define ASE_TEXTURE2D_ARGS(textureName) sampler2D textureName", + "#define ASE_TEXTURE3D_ARGS(textureName) sampler3D textureName", + "#define ASE_TEXTURECUBE_ARGS(textureName) samplerCUBE textureName", + "#define ASE_TEXTURE2D_PARAMS(textureName) textureName", + "#define ASE_TEXTURE3D_PARAMS(textureName) textureName", + "#define ASE_TEXTURECUBE_PARAMS(textureName) textureName", + "#define ASE_TEXTURE2D_ARRAY_PARAMS(textureName) textureName", + "#endif//ASE Args Macros\n" + }; + + public readonly static string[] CustomASEDeclararionMacros = + { + "#define ASE_TEXTURE2D(textureName) {0}2D(textureName)", + "#define ASE_TEXTURE2D_ARRAY(textureName) {0}2D_ARRAY(textureName)", + "#define ASE_TEXTURE3D(textureName) {0}3D(textureName)", + "#define ASE_TEXTURECUBE(textureName) {0}CUBE(textureName)\n" + }; + + public readonly static string[] CustomASEStandarSamplingMacrosHelper = + { + "#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC)//ASE Sampling Macros", + "#else//ASE Sampling Macros", + "#endif//ASE Sampling Macros\n" + };*/ + + /*public readonly static string[] CustomASESamplingMacros = + { + "#define ASE_SAMPLE_TEXTURE2D(textureName,{0}coords) {1}2D{2}(textureName,{0}coords)", + "#define ASE_SAMPLE_TEXTURE2D_LOD(textureName, {0}coord2, lod) {1}2D{2}_LOD(textureName, {0}coord2, lod)", + "#define ASE_SAMPLE_TEXTURE2D_BIAS(textureName,{0}coord2, bias) {1}2D{2}_BIAS(textureName,{0}coord2, bias)", + "#define ASE_SAMPLE_TEXTURE2D_GRAD(textureName,{0}coord2, dpdx, dpdy) {1}2D{2}_GRAD(textureName,{0}coord2, dpdx, dpdy)", + + "#define ASE_SAMPLE_TEXTURE3D(textureName,{0}coord3) {1}3D{2}(textureName,{0}coord3)", + "#define ASE_SAMPLE_TEXTURE3D_LOD(textureName,{0}coord3, lod) {1}3D{2}_LOD(textureName,{0}coord3, lod)", + "#define ASE_SAMPLE_TEXTURE3D_BIAS(textureName,{0}coord3, bias) {1}3D{2}_BIAS(textureName,{0}coord3, bias)", + "#define ASE_SAMPLE_TEXTURE3D_GRAD(textureName,{0}coord3, dpdx, dpdy) {1}3D{2}_GRAD(textureName,{0}coord3, dpdx, dpdy)", + + "#define ASE_SAMPLE_TEXTURECUBE(textureName,{0}coord3) {1}CUBE{2}(textureName,{0}coord3)", + "#define ASE_SAMPLE_TEXTURECUBE_LOD(textureName,{0}coord3, lod) {1}CUBE{2}_LOD(textureName,{0}coord3, lod)", + "#define ASE_SAMPLE_TEXTURECUBE_BIAS(textureName,{0}coord3, bias) {1}CUBE{2}_BIAS(textureName,{0}coord3, bias)\n" + };*/ + + // SRP + /*public readonly static string[] CustomASESRPArgsMacros = + { + "#define ASE_TEXTURE2D_ARGS(textureName) TEXTURE2D(textureName), SAMPLER(textureName)", + "#define ASE_TEXTURE3D_ARGS(textureName) TEXTURE3D(textureName), SAMPLER(textureName)", + "#define ASE_TEXTURECUBE_ARGS(textureName) TEXTURECUBE(textureName), SAMPLER(textureName)", + "#define ASE_TEXTURE2D_PARAMS(textureName) textureName, sampler##textureName", + "#define ASE_TEXTURE3D_PARAMS(textureName) textureName, sampler##textureName", + "#define ASE_TEXTURECUBE_PARAMS(textureName) textureName, sampler##textureName", + "#define ASE_TEXTURE2D_ARRAY_PARAMS(textureName) textureName, sampler##textureName\n" + };*/ + + public readonly static RenderTextureFormat PreviewFormat = RenderTextureFormat.ARGBFloat; + public readonly static int PreviewSize = 128; + + public readonly static List UnityNativeInspectors = new List + { + "Rendering.HighDefinition.LightingShaderGraphGUI", + "Rendering.HighDefinition.HDUnlitGUI", + "UnityEditor.Rendering.HighDefinition.HDLitGUI", + "UnityEditor.ShaderGraph.PBRMasterGUI", + "UnityEditor.Rendering.HighDefinition.DecalGUI", + "UnityEditor.Rendering.HighDefinition.FabricGUI", + "UnityEditor.Experimental.Rendering.HDPipeline.HDLitGUI", + "Rendering.HighDefinition.DecalGUI", + "Rendering.HighDefinition.LitShaderGraphGUI", + "Rendering.HighDefinition.DecalShaderGraphGUI", + "UnityEditor.ShaderGraphUnlitGUI", + "UnityEditor.ShaderGraphLitGUI", + "UnityEditor.Rendering.Universal.DecalShaderGraphGUI" + }; + + public readonly static Dictionary CustomInspectorHD7To10 = new Dictionary + { + { "UnityEditor.Rendering.HighDefinition.DecalGUI","Rendering.HighDefinition.DecalGUI"}, + { "UnityEditor.Rendering.HighDefinition.FabricGUI","Rendering.HighDefinition.LightingShaderGraphGUI"}, + { "UnityEditor.Rendering.HighDefinition.HDLitGUI","Rendering.HighDefinition.LitShaderGraphGUI"}, + { "UnityEditor.Experimental.Rendering.HDPipeline.HDLitGUI","Rendering.HighDefinition.LitShaderGraphGUI"}, + }; + + + public readonly static Dictionary CustomInspectorURP10To12 = new Dictionary + { + { "UnityEditor.ShaderGraph.PBRMasterGUI","UnityEditor.ShaderGraphLitGUI"}, + }; + + public readonly static Dictionary CustomInspectorHDLegacyTo11 = new Dictionary + { + { "UnityEditor.Rendering.HighDefinition.DecalGUI","Rendering.HighDefinition.DecalShaderGraphGUI"}, + { "Rendering.HighDefinition.DecalGUI","Rendering.HighDefinition.DecalShaderGraphGUI"}, + { "UnityEditor.Rendering.HighDefinition.FabricGUI","Rendering.HighDefinition.LightingShaderGraphGUI"}, + { "UnityEditor.Rendering.HighDefinition.HDLitGUI","Rendering.HighDefinition.LitShaderGraphGUI"}, + { "UnityEditor.Experimental.Rendering.HDPipeline.HDLitGUI","Rendering.HighDefinition.LitShaderGraphGUI"}, + }; + + + public readonly static string CustomASEStandardSamplerParams = "#define ASE_TEXTURE_PARAMS(textureName) textureName\n"; + public readonly static string[] CustomASESRPTextureArrayMacros = + { + "#define ASE_TEXTURE2D_ARRAY_ARGS(textureName) TEXTURE2D_ARRAY_ARGS(textureName,sampler##textureName)\n" , + "#define ASE_TEXTURE2D_ARRAY_PARAM(textureName) TEXTURE2D_ARRAY_PARAM(textureName,sampler##textureName)\n" , + "#define ASE_SAMPLE_TEXTURE2D_ARRAY(textureName, coord3) textureName.Sample(sampler##textureName, coord3)", + "#define ASE_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, coord3, lod) textureName.SampleLevel(sampler##textureName, coord3, lod)" + }; + public readonly static string CustomASESRPSamplerParams = "#define ASE_TEXTURE_PARAMS(textureName) textureName, sampler##textureName\n"; + + public readonly static string[] CustomSRPSamplingMacros = + { + "#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (defined(SHADER_TARGET_SURFACE_ANALYSIS) && !defined(SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER))//3D SRP MACROS", + "#define SAMPLE_TEXTURE3D_GRAD(textureName, samplerName, coord3, dpdx, dpdy) textureName.SampleGrad(samplerName, coord3, dpdx, dpdy)", + "#define SAMPLE_TEXTURE3D_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias)", + "#else//3D SRP MACROS", + "#define SAMPLE_TEXTURE3D_GRAD(textureName, samplerName, coord3, dpdx, dpdy) SAMPLE_TEXTURE3D(textureName, samplerName, coord3)", + "#define SAMPLE_TEXTURE3D_BIAS(textureName, samplerName, coord3, bias) SAMPLE_TEXTURE3D(textureName, samplerName, coord3)", + "#endif//3D SRP MACROS\n" + }; + + public readonly static Dictionary TexDeclarationSRPMacros = new Dictionary + { + { TextureType.Texture2D,"TEXTURE2D({0}); SAMPLER(sampler{0});"}, + { TextureType.Texture3D,"TEXTURE3D({0}); SAMPLER(sampler{0});"}, + { TextureType.Cube,"TEXTURECUBE({0}); SAMPLER(sampler{0});"}, + { TextureType.Texture2DArray,"TEXTURE2D_ARRAY({0}); SAMPLER(sampler{0});"}, + }; + + public readonly static Dictionary SamplerDeclarationSRPMacros = new Dictionary + { + { TextureType.Texture2D,"SAMPLER(sampler{0});"}, + { TextureType.Texture3D,"SAMPLER(sampler{0});"}, + { TextureType.Cube,"SAMPLER(sampler{0});"}, + { TextureType.Texture2DArray,"SAMPLER(sampler{0});"}, + }; + + public readonly static Dictionary TexDeclarationNoSamplerSRPMacros = new Dictionary + { + { TextureType.Texture2D,"TEXTURE2D({0})"}, + { TextureType.Texture3D,"TEXTURE3D({0})"}, + { TextureType.Cube,"TEXTURECUBE({0})"}, + { TextureType.Texture2DArray,"TEXTURE2D_ARRAY({0})"}, + }; + + public readonly static Dictionary TexSampleSRPMacros = new Dictionary + { + { TextureType.Texture2D,"SAMPLE_TEXTURE2D{0}( {1}, {2}, {3} )"}, + { TextureType.Texture3D,"SAMPLE_TEXTURE3D{0}( {1}, {2}, {3} )"}, + { TextureType.Cube,"SAMPLE_TEXTURECUBE{0}( {1}, {2}, {3} )"}, + { TextureType.Texture2DArray,"SAMPLE_TEXTURE2D_ARRAY{0}( {1}, {2}, {3} )"}, + }; + + public readonly static Dictionary TexParams = new Dictionary + { + { TextureType.Texture2D,"ASE_TEXTURE2D_PARAMS({0})"}, + { TextureType.Texture3D,"ASE_TEXTURE3D_PARAMS({0})"}, + { TextureType.Cube,"ASE_TEXTURECUBE_PARAMS({0})"}, + { TextureType.Texture2DArray,"ASE_TEXTURE2D_ARRAY_PARAMS({0})"}, + }; + + public readonly static Dictionary WireToTexture = new Dictionary + { + { WirePortDataType.SAMPLER1D,TextureType.Texture1D}, + { WirePortDataType.SAMPLER2D,TextureType.Texture2D}, + { WirePortDataType.SAMPLER3D,TextureType.Texture3D}, + { WirePortDataType.SAMPLERCUBE,TextureType.Cube}, + { WirePortDataType.SAMPLER2DARRAY,TextureType.Texture2DArray}, + }; + + public readonly static Dictionary TextureToWire = new Dictionary + { + { TextureType.Texture1D,WirePortDataType.SAMPLER1D}, + { TextureType.Texture2D,WirePortDataType.SAMPLER2D}, + { TextureType.Texture3D, WirePortDataType.SAMPLER3D}, + { TextureType.Cube,WirePortDataType.SAMPLERCUBE}, + { TextureType.Texture2DArray,WirePortDataType.SAMPLER2DARRAY}, + { TextureType.ProceduralTexture,WirePortDataType.SAMPLER2D}, + }; + + public readonly static string SamplingMacrosDirective = "#define ASE_USING_SAMPLING_MACROS 1"; + + // STANDARD + public readonly static string[] CustomASEStandarSamplingMacrosHelper = + { + "#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (defined(SHADER_TARGET_SURFACE_ANALYSIS) && !defined(SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER))//ASE Sampler Macros", + "#else//ASE Sampling Macros", + "#endif//ASE Sampling Macros\n" + }; + + public readonly static string[] CustomASEArraySamplingMacrosRecent = + { + "#define UNITY_SAMPLE_TEX2DARRAY(tex,coord) tex.Sample(sampler##tex,coord)", + "#define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) tex.SampleLevel(sampler##tex,coord, lod)", + "#define UNITY_SAMPLE_TEX2DARRAY_BIAS(tex,coord,bias) tex.SampleBias(sampler##tex,coord,bias)", + "#define UNITY_SAMPLE_TEX2DARRAY_GRAD(tex,coord,ddx,ddy) tex.SampleGrad(sampler##tex,coord,ddx,ddy)", + }; + + public readonly static string[] CustomASEArraySamplingMacrosOlder = + { + "#define UNITY_SAMPLE_TEX2DARRAY(tex,coord) tex2DArray(tex,coord)", + "#define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) tex2DArraylod(tex, float4(coord,lod))", + "#define UNITY_SAMPLE_TEX2DARRAY_BIAS(tex,coord,bias) tex2DArray(tex,coord)", + "#define UNITY_SAMPLE_TEX2DARRAY_GRAD(tex,coord,ddx,ddy) tex2DArray(tex,coord)", + }; + + public readonly static string[] CustomASEStandarSamplingMacrosRecent = + { + "#define SAMPLE_TEXTURE2D(tex,samplerTex,coord) tex.Sample(samplerTex,coord)", + "#define SAMPLE_TEXTURE2D_LOD(tex,samplerTex,coord,lod) tex.SampleLevel(samplerTex,coord, lod)", + "#define SAMPLE_TEXTURE2D_BIAS(tex,samplerTex,coord,bias) tex.SampleBias(samplerTex,coord,bias)", + "#define SAMPLE_TEXTURE2D_GRAD(tex,samplerTex,coord,ddx,ddy) tex.SampleGrad(samplerTex,coord,ddx,ddy)", + + "#define SAMPLE_TEXTURE3D(tex,samplerTex,coord) tex.Sample(samplerTex,coord)", + "#define SAMPLE_TEXTURE3D_LOD(tex,samplerTex,coord,lod) tex.SampleLevel(samplerTex,coord, lod)", + "#define SAMPLE_TEXTURE3D_BIAS(tex,samplerTex,coord,bias) tex.SampleBias(samplerTex,coord,bias)", + "#define SAMPLE_TEXTURE3D_GRAD(tex,samplerTex,coord,ddx,ddy) tex.SampleGrad(samplerTex,coord,ddx,ddy)", + + "#define SAMPLE_TEXTURECUBE(tex,samplerTex,coord) tex.Sample(samplerTex,coord)", + "#define SAMPLE_TEXTURECUBE_LOD(tex,samplerTex,coord,lod) tex.SampleLevel(samplerTex,coord, lod)", + "#define SAMPLE_TEXTURECUBE_BIAS(tex,samplerTex,coord,bias) tex.SampleBias(samplerTex,coord,bias)", + "#define SAMPLE_TEXTURECUBE_GRAD(tex,samplerTex,coord,ddx,ddy) tex.SampleGrad(samplerTex,coord,ddx,ddy)", + + "#define SAMPLE_TEXTURE2D_ARRAY(tex,samplerTex,coord) tex.Sample(samplerTex,coord)", + "#define SAMPLE_TEXTURE2D_ARRAY_LOD(tex,samplerTex,coord,lod) tex.SampleLevel(samplerTex,coord, lod)", + "#define SAMPLE_TEXTURE2D_ARRAY_BIAS(tex,samplerTex,coord,bias) tex.SampleBias(samplerTex,coord,bias)", + "#define SAMPLE_TEXTURE2D_ARRAY_GRAD(tex,samplerTex,coord,ddx,ddy) tex.SampleGrad(samplerTex,coord,ddx,ddy)", + }; + + public readonly static string[] CustomASEStandarSamplingMacrosOlder = + { + "#define SAMPLE_TEXTURE2D(tex,samplerTex,coord) tex2D(tex,coord)", + "#define SAMPLE_TEXTURE2D_LOD(tex,samplerTex,coord,lod) tex2Dlod(tex,float4(coord,0,lod))", + "#define SAMPLE_TEXTURE2D_BIAS(tex,samplerTex,coord,bias) tex2Dbias(tex,float4(coord,0,bias))", + "#define SAMPLE_TEXTURE2D_GRAD(tex,samplerTex,coord,ddx,ddy) tex2Dgrad(tex,coord,ddx,ddy)", + + "#define SAMPLE_TEXTURE3D(tex,samplerTex,coord) tex3D(tex,coord)", + "#define SAMPLE_TEXTURE3D_LOD(tex,samplerTex,coord,lod) tex3Dlod(tex,float4(coord,lod))", + "#define SAMPLE_TEXTURE3D_BIAS(tex,samplerTex,coord,bias) tex3D(tex,coord)", + "#define SAMPLE_TEXTURE3D_GRAD(tex,samplerTex,coord,ddx,ddy) tex3D(tex,coord)", + + "#define SAMPLE_TEXTURECUBE(tex,samplertex,coord) texCUBE(tex,coord)", + "#define SAMPLE_TEXTURECUBE_LOD(tex,samplertex,coord,lod) texCUBElod (tex,half4(coord,lod))", + "#define SAMPLE_TEXTURECUBE_BIAS(tex,samplertex,coord,bias) texCUBE(tex,coord)", + "#define SAMPLE_TEXTURECUBE_GRAD(tex,samplertex,coord,ddx,ddy) texCUBE(tex,coord)", + + "#define SAMPLE_TEXTURE2D_ARRAY(tex,samplertex,coord) tex2DArray(tex,coord)", + "#define SAMPLE_TEXTURE2D_ARRAY_LOD(tex,samplertex,coord,lod) tex2DArraylod(tex, float4(coord,lod))", + "#define SAMPLE_TEXTURE2D_ARRAY_BIAS(tex,samplerTex,coord,bias) tex2DArray(tex,coord)", + "#define SAMPLE_TEXTURE2D_ARRAY_GRAD(tex,samplerTex,coord,ddx,ddy) tex2DArray(tex,coord)", + }; + + public readonly static string[] CustomArraySamplingMacros = + { + "#if defined(UNITY_COMPILER_HLSL2GLSL) || defined(SHADER_TARGET_SURFACE_ANALYSIS)//ASE Array Sampler Macros", + "#define ASE_SAMPLE_TEX2DARRAY_GRAD(tex,coord,dx,dy) UNITY_SAMPLE_TEX2DARRAY (tex,coord)", + "#else//ASE Array Sampler Macros", + "#define ASE_SAMPLE_TEX2DARRAY_GRAD(tex,coord,dx,dy) tex.SampleGrad (sampler##tex,coord,dx,dy)", + "#endif//ASE Array Sampler Macros\n" + }; + + public readonly static Dictionary TexDeclarationStandardMacros = new Dictionary + { + { TextureType.Texture2D,"UNITY_DECLARE_TEX2D({0});"}, + { TextureType.Texture3D,"UNITY_DECLARE_TEX3D({0});"}, + { TextureType.Cube,"UNITY_DECLARE_TEXCUBE({0});"}, + { TextureType.Texture2DArray,"UNITY_DECLARE_TEX2DARRAY({0});"} + }; + + public readonly static Dictionary TexDeclarationNoSamplerStandardMacros = new Dictionary + { + { TextureType.Texture2D,"UNITY_DECLARE_TEX2D_NOSAMPLER({0})"}, + { TextureType.Texture3D,"UNITY_DECLARE_TEX3D_NOSAMPLER({0})"}, + { TextureType.Cube,"UNITY_DECLARE_TEXCUBE_NOSAMPLER({0})"}, + { TextureType.Texture2DArray,"UNITY_DECLARE_TEX2DARRAY_NOSAMPLER({0})"} + }; + + public readonly static Dictionary TexSampleStandardMacros = new Dictionary + { + { TextureType.Texture2D,"UNITY_SAMPLE_TEX2D{0}( {1}, {3} )"}, + { TextureType.Texture3D,"UNITY_SAMPLE_TEX3D{0}( {1}, {3} )"}, + { TextureType.Cube,"UNITY_SAMPLE_TEXCUBE{0}( {1}, {3} )"}, + { TextureType.Texture2DArray,"UNITY_SAMPLE_TEX2DARRAY{0}( {1}, {3} )"} + }; + + public readonly static Dictionary TexSampleSamplerStandardMacros = new Dictionary + { + { TextureType.Texture2D,"SAMPLE_TEXTURE2D{0}( {1}, {2}, {3} )"}, + { TextureType.Texture3D,"SAMPLE_TEXTURE3D{0}( {1}, {2}, {3} )"}, + { TextureType.Cube,"SAMPLE_TEXTURECUBE{0}( {1}, {2}, {3} )"}, + { TextureType.Texture2DArray,"SAMPLE_TEXTURE2D_ARRAY{0}( {1}, {2}, {3} )"} + }; + + public readonly static Dictionary TexSampleStandard = new Dictionary + { + { TextureType.Texture2D,"tex2D{0}( {1}, {2} )"}, + { TextureType.Texture3D,"tex3D{0}( {1}, {2} )"}, + { TextureType.Cube,"texCUBE{0}( {1}, {2} )"}, + { TextureType.Texture2DArray,"tex2DArray{0}( {1}, {2} )"} + }; + public readonly static char LineFeedSeparator = '$'; + public readonly static char SemiColonSeparator = '@'; + public readonly static string AppDataFullName = "appdata_full"; + public readonly static string CustomAppDataFullName = "appdata_full_custom"; + public readonly static string CustomAppDataFullBody = + "\n\t\tstruct appdata_full_custom\n" + + "\t\t{\n" + + "\t\t\tfloat4 vertex : POSITION;\n" + + "\t\t\tfloat4 tangent : TANGENT;\n" + + "\t\t\tfloat3 normal : NORMAL;\n" + + "\t\t\tfloat4 texcoord : TEXCOORD0;\n" + + "\t\t\tfloat4 texcoord1 : TEXCOORD1;\n" + + "\t\t\tfloat4 texcoord2 : TEXCOORD2;\n" + + "\t\t\tfloat4 texcoord3 : TEXCOORD3;\n" + + "\t\t\tfloat4 color : COLOR;\n" + + "\t\t\tUNITY_VERTEX_INPUT_INSTANCE_ID\n"; + + public readonly static string IncludeFormat = "#include \"{0}\""; + public readonly static string PragmaFormat = "#pragma {0}"; + public readonly static string DefineFormat = "#define {0}"; + + public readonly static string RenderTypeHelperStr = "RenderType"; + public readonly static string RenderQueueHelperStr = "Queue"; + public readonly static string DisableBatchingHelperStr = "DisableBatching"; + + public readonly static string DefaultShaderName = "New Amplify Shader"; + + public readonly static string UndoReplaceMasterNodeId = "Replacing Master Node"; + public readonly static string UnityLightingLib = "Lighting.cginc"; + public readonly static string UnityAutoLightLib = "AutoLight.cginc"; + public readonly static string UnityBRDFLib = "UnityStandardBRDF.cginc"; + public readonly static string LocalValueDecWithoutIdent = "{0} {1} = {2};"; + public readonly static string CustomTypeLocalValueDecWithoutIdent = "{0} {1} =({0}){2};"; + public readonly static string LocalValueDefWithoutIdent = "{0} {1} {2};"; + public readonly static string TilingOffsetFormat = "{0} * {1} + {2}"; + public static string InvalidPostProcessDatapath = "__DELETED_GUID_Trash"; + //TEMPLATES + + public static float PlusMinusButtonLayoutWidth = 15; + + public static float NodeButtonSizeX = 16; + public static float NodeButtonSizeY = 16; + public static float NodeButtonDeltaX = 5; + public static float NodeButtonDeltaY = 11; + + public readonly static string SafeNormalizeInfoStr = "With Safe Normalize division by 0 is prevented over the normalize operation at the expense of additional instructions on shader."; + public readonly static string ReservedPropertyNameStr = "Property name '{0}' is reserved and cannot be used"; + public readonly static string NumericPropertyNameStr = "Property name '{0}' is numeric thus cannot be used"; + public readonly static string DeprecatedMessageStr = "Node '{0}' is deprecated. Use node '{1}' instead."; + public readonly static string DeprecatedNoAlternativeMessageStr = "Node '{0}' is deprecated and should be removed."; + public readonly static string UndoChangePropertyTypeNodesId = "Changing Property Types"; + public readonly static string UndoChangeTypeNodesId = "Changing Nodes Types"; + public readonly static string UndoMoveNodesId = "Moving Nodes"; + public readonly static string UndoRegisterFullGrapId = "Register Graph"; + public readonly static string UndoAddNodeToCommentaryId = "Add node to Commentary"; + public readonly static string UndoRemoveNodeFromCommentaryId = "Remove node from Commentary"; + public readonly static string UndoCreateDynamicPortId = "Create Dynamic Port"; + public readonly static string UndoDeleteDynamicPortId = "Destroy Dynamic Port"; + public readonly static string UndoRegisterNodeId = "Register Object"; + public readonly static string UndoUnregisterNodeId = "Unregister Object"; + public readonly static string UndoCreateNodeId = "Create Object"; + public readonly static string UndoPasteNodeId = "Paste Object"; + public readonly static string UndoDeleteNodeId = "Destroy Object"; + public readonly static string UndoDeleteConnectionId = "Destroy Connection"; + public readonly static string UndoCreateConnectionId = "Create Connection"; + + public readonly static float MenuDragSpeed = -0.5f; + public readonly static string DefaultCustomInspector = "AmplifyShaderEditor.MaterialInspector"; + public readonly static string OldCustomInspector = "ASEMaterialInspector"; + public readonly static string ReferenceTypeStr = "Mode"; + public readonly static string AvailableReferenceStr = "Reference"; + public readonly static string InstancePostfixStr = " (Reference) "; + + public readonly static string ASEMenuName = "Amplify Shader"; + + public readonly static string LodCrossFadeOption2017 = "dithercrossfade"; + + public readonly static string UnityShaderVariables = "UnityShaderVariables.cginc"; + public readonly static string UnityCgLibFuncs = "UnityCG.cginc"; + public readonly static string UnityStandardUtilsLibFuncs = "UnityStandardUtils.cginc"; + public readonly static string UnityPBSLightingLib = "UnityPBSLighting.cginc"; + public readonly static string UnityDeferredLightLib = "UnityDeferredLibrary.cginc"; + public readonly static string ATSharedLibGUID = "ba242738c4be3324aa88d126f7cc19f9"; + public readonly static string CameraDepthTextureValue = "UNITY_DECLARE_DEPTH_TEXTURE( _CameraDepthTexture );"; + + //public readonly static string CameraDepthTextureSRPVar = "TEXTURE2D(_CameraDepthTexture);"; + //public readonly static string CameraDepthTextureSRPSampler = "SAMPLER(sampler_CameraDepthTexture);"; + public readonly static string CameraDepthTextureLWEnabler = "REQUIRE_DEPTH_TEXTURE 1"; + + public readonly static string CameraDepthTextureTexelSize = "uniform float4 _CameraDepthTexture_TexelSize;"; + public readonly static string InstanceIdMacro = "UNITY_VERTEX_INPUT_INSTANCE_ID"; + public readonly static string InstanceIdVariable = "UNITY_GET_INSTANCE_ID({0})"; + + + public readonly static string HelpURL = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor"; + //public readonly static string NodeCommonUrl = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Nodes#"; + //public readonly static string CommunityNodeCommonUrl = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Community_Nodes#"; + public readonly static string NodeCommonUrl = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/"; + public readonly static string CommunityNodeCommonUrl = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/"; + public readonly static Color InfiniteLoopColor = Color.red; + + public readonly static Color DefaultCategoryColor = new Color( 0.26f, 0.35f, 0.44f, 1.0f ); + public readonly static Color NodeBodyColor = new Color( 1f, 1f, 1f, 1.0f ); + + public readonly static Color ModeTextColor = new Color( 1f, 1f, 1f, 0.25f ); + public readonly static Color ModeIconColor = new Color( 1f, 1f, 1f, 0.75f ); + + public readonly static Color PortTextColor = new Color( 1f, 1f, 1f, 0.5f ); + public readonly static Color PortLockedTextColor = new Color( 1f, 1f, 1f, 0.35f ); + public readonly static Color BoxSelectionColor = new Color( 0.5f, 0.75f, 1f, 0.33f ); + public readonly static Color SpecialRegisterLocalVarSelectionColor = new Color( 0.27f, 0.52f, 1.0f, 1f ); + public readonly static Color SpecialGetLocalVarSelectionColor = new Color( 0.2f, 0.8f, 0.4f, 1f ); + public readonly static Color NodeSelectedColor = new Color( 0.85f, 0.56f, 0f, 1f ); + public readonly static Color NodeDefaultColor = new Color( 1f, 1f, 1f, 1f ); + public readonly static Color NodeConnectedColor = new Color( 1.0f, 1f, 0.0f, 1f ); + public readonly static Color NodeErrorColor = new Color( 1f, 0.5f, 0.5f, 1f ); + public readonly static string NoSpecifiedCategoryStr = ""; + + public readonly static int MINIMIZE_WINDOW_LOCK_SIZE = 630; + + public readonly static int FoldoutMouseId = 0; // Left Mouse Button + + public readonly static float SNAP_SQR_DIST = 200f; + public readonly static int INVALID_NODE_ID = -1; + public readonly static float WIRE_WIDTH = 7f; + public readonly static float WIRE_CONTROL_POINT_DIST = 0.7f; + public readonly static float WIRE_CONTROL_POINT_DIST_INV = 1.7f; + + public readonly static float IconsLeftRightMargin = 5f; + public readonly static float PropertyPickerWidth = 16f; + public readonly static float PropertyPickerHeight = 16f; + public readonly static float PreviewExpanderWidth = 16f; + public readonly static float PreviewExpanderHeight = 16f; + public readonly static float TextFieldFontSize = 11f; + public readonly static float DefaultFontSize = 14f; + public readonly static float DefaultTitleFontSize = 12f; + public readonly static float PropertiesTitleFontSize = 11f; + public readonly static float MessageFontSize = 40f; + public readonly static float SelectedObjectFontSize = 30f; + + public readonly static float PORT_X_ADJUST = 10; + public readonly static float PORT_INITIAL_X = 10; + + public readonly static float PORT_INITIAL_Y = 41; + public readonly static float INPUT_PORT_DELTA_Y = 7; + public readonly static float PORT_TO_LABEL_SPACE_X = 4; + + public readonly static float NODE_HEADER_HEIGHT = 32; + public readonly static float NODE_HEADER_EXTRA_HEIGHT = 0; + public readonly static float NODE_HEADER_LEFTRIGHT_MARGIN = 10; + + public readonly static float MULTIPLE_SELECION_BOX_ALPHA = 0.5f; + public readonly static float RMB_CLICK_DELTA_TIME = 0.1f; + public readonly static float RMB_SCREEN_DIST = 10f; + + public readonly static float CAMERA_MAX_ZOOM = 2f; + public readonly static float CAMERA_MIN_ZOOM = 1f; + public readonly static float CAMERA_ZOOM_SPEED = 0.1f; + public readonly static float ALT_CAMERA_ZOOM_SPEED = -0.05f; + + public readonly static object INVALID_VALUE = null; + + public readonly static float HORIZONTAL_TANGENT_SIZE = 100f; + public readonly static float OUTSIDE_WIRE_MARGIN = 5f; + + public readonly static string SubTitleNameFormatStr = "Name( {0} )"; + public readonly static string SubTitleSpaceFormatStr = "Space( {0} )"; + public readonly static string SubTitleTypeFormatStr = "Type( {0} )"; + public readonly static string SubTitleModeFormatStr = "Mode( {0} )"; + public readonly static string SubTitleValueFormatStr = "Value( {0} )"; + public readonly static string SubTitleConstFormatStr = "Const( {0} )"; + public readonly static string SubTitleVarNameFormatStr = "Var( {0} )"; + public readonly static string SubTitleRefNameFormatStr = "Ref( {0} )"; + public readonly static string SubTitleCurrentFormatStr = "Current( {0} )"; + + public readonly static string CodeWrapper = "( {0} )"; + public readonly static string InlineCodeWrapper = "{{\n{0}\n}}"; + + public readonly static string NodesDumpFormat = "{0}:,{1},{2}\n"; + public readonly static string TagFormat = " \"{0}\" = \"{1}\""; + + public readonly static string LocalVarIdentation = "\t\t\t"; + public readonly static string SimpleLocalValueDec = LocalVarIdentation + "{0} {1};\n"; + + public readonly static string LocalValueDec = LocalVarIdentation + LocalValueDecWithoutIdent + '\n'; + public readonly static string LocalValueDef = LocalVarIdentation + "{0} = {1};\n"; + public readonly static string CastHelper = "({0}).{1}"; + public readonly static string PropertyLocalVarDec = "{0} {1} = {0}({2});"; + public readonly static string[] UniformDec = { "uniform {0} {1};", "{0} {1};" }; + + public readonly static string PropertyValueLabel = "Value( {0} )"; + public readonly static string ConstantsValueLabel = "Const( {0} )"; + + public readonly static string PropertyFloatFormatLabel = "0.###"; + public readonly static string PropertyBigFloatFormatLabel = "0.###e+0"; + + public readonly static string PropertyIntFormatLabel = "0"; + public readonly static string PropertyBigIntFormatLabel = "0e+0"; + + + public readonly static string PropertyVectorFormatLabel = "0.##"; + public readonly static string PropertyBigVectorFormatLabel = "0.##e+0"; + + + public readonly static string PropertyMatrixFormatLabel = "0.#"; + public readonly static string PropertyBigMatrixFormatLabel = "0.#e+0"; + + public readonly static string NoPropertiesLabel = "No assigned properties"; + + public readonly static string ValueLabel = "Value"; + public readonly static string DefaultValueLabel = "Default Value"; + public readonly static string MaterialValueLabel = "Material Value"; + public readonly static GUIContent DefaultValueLabelContent = new GUIContent( "Default Value" ); + public readonly static GUIContent MaterialValueLabelContent = new GUIContent( "Material Value" ); + + public readonly static string InputVarStr = "i";//"input"; + public readonly static string OutputVarStr = "o";//"output"; + + public readonly static string CustomLightOutputVarStr = "s"; + public readonly static string CustomLightStructStr = "Custom"; + + public readonly static string VertexShaderOutputStr = "o"; + public readonly static string VertexShaderInputStr = "v";//"vertexData"; + public readonly static string VertexDataFunc = "vertexDataFunc"; + + public readonly static string VirtualCoordNameStr = "vcoord"; + + public readonly static string VertexVecNameStr = "vertexVec"; + public readonly static string VertexVecDecStr = "float3 " + VertexVecNameStr; + public readonly static string VertexVecVertStr = VertexShaderOutputStr + "." + VertexVecNameStr; + + public readonly static string NormalVecNameStr = "normalVec"; + public readonly static string NormalVecDecStr = "float3 " + NormalVecNameStr; + public readonly static string NormalVecFragStr = InputVarStr + "." + NormalVecNameStr; + public readonly static string NormalVecVertStr = VertexShaderOutputStr + "." + NormalVecNameStr; + + + public readonly static string IncidentVecNameStr = "incidentVec"; + public readonly static string IncidentVecDecStr = "float3 " + IncidentVecNameStr; + public readonly static string IncidentVecDefStr = VertexShaderOutputStr + "." + IncidentVecNameStr + " = normalize( " + VertexVecNameStr + " - _WorldSpaceCameraPos.xyz)"; + public readonly static string IncidentVecFragStr = InputVarStr + "." + IncidentVecNameStr; + public readonly static string IncidentVecVertStr = VertexShaderOutputStr + "." + IncidentVecNameStr; + public readonly static string WorldNormalLocalDecStr = "WorldNormalVector( " + Constants.InputVarStr + " , {0}( 0,0,1 ))"; + + public readonly static string IsFrontFacingVariable = "ASEIsFrontFacing"; + public readonly static string IsFrontFacingInput = "half ASEIsFrontFacing : SV_IsFrontFacing"; + public readonly static string IsFrontFacingInputVFACE = "half ASEIsFrontFacing : VFACE"; + + public readonly static string ColorVariable = "vertexColor"; + public readonly static string ColorInput = "float4 vertexColor : COLOR"; + + public readonly static string NoStringValue = "None"; + public readonly static string EmptyPortValue = " "; + + public readonly static string[] OverallInvalidChars = { "\r", "\n", "\\", " ", ".", ">", ",", "<", "\'", "\"", ";", ":", "[", "{", "]", "}","|", "=", "+", "`", "~", "/", "?", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-" }; + public readonly static string[] RegisterInvalidChars = { "\r", "\n", "\\", ".", ">", ",", "<", "\'", "\"", ";", ":", "[", "{", "]", "}", "|", "=", "+", "`", "~", "?", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-" }; + public readonly static string[] ShaderInvalidChars = { "\r", "\n", "\\", "\'", "\"", }; + public readonly static string[] EnumInvalidChars = { "\r", "\n", "\\", ".", ">", ",", "<", "\'", "\"", ";", ":", "[", "{", "]", "}", "=", "+", "`", "~", "/", "?", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-" }; + public readonly static string[] AttrInvalidChars = { "\r", "\n", "\\", ">", "<", "\'", "\"", ";", ":", "[", "{", "]", "}", "=", "+", "`", "~", "/", "?", "!", "@", "#", "$", "%", "^", "&", "*" }; + public readonly static string[] HeaderInvalidChars = { "\r", "\n", "\\", ">", ",", "<", "\'", "\"", ";", ":", "[", "{", "]", "}", "=", "+", "`", "~", "/", "?", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-" }; + + public readonly static string[] WikiInvalidChars = { "#", "<", ">", "[", "]", "|", "{", "}", "%", "+", "?", "\\", "/", ",", ";", "." }; + + public readonly static string[,] UrlReplacementStringValues = + { + { " = ", "Equals" }, + { " == ", "Equals" }, + { " != ", "NotEqual" }, + { " \u2260 ", "NotEqual" }, + { " > ", "Greater" }, + { " \u2265 " , "GreaterOrEqual" }, + { " >= ", "GreaterOrEqual" }, + { " < ", "Less" }, + { " \u2264 ", "LessOrEqual" }, + { " <= ", "LessOrEqual" }, + { " ", "_" }, + { "[", string.Empty }, + { "]", string.Empty } + }; + + public readonly static int UrlReplacementStringValuesLen = UrlReplacementStringValues.Length / 2; + + public readonly static string[,] ReplacementStringValues = + { + { " = ", "Equals" }, + { " == ", "Equals" }, + { " != ", "NotEqual" }, + { " \u2260 ", "NotEqual" }, + { " > ", "Greater" }, + { " \u2265 ", "GreaterOrEqual" }, + { " >= ", "GreaterOrEqual" }, + { " < ", "Less" }, + { " \u2264 ", "LessOrEqual" }, + { " <= ", "LessOrEqual" } + }; + public readonly static int ReplacementStringValuesLen = ReplacementStringValues.Length / 2; + + public readonly static string InternalData = "INTERNAL_DATA"; + + + + public readonly static string NoMaterialStr = "None"; + + public readonly static string OptionalParametersSep = " "; + + public readonly static string NodeUndoId = "NODE_UNDO_ID"; + public readonly static string NodeCreateUndoId = "NODE_CREATE_UNDO_ID"; + public readonly static string NodeDestroyUndoId = "NODE_DESTROY_UNDO_ID"; + + // Custom node tags + //[InPortBegin:Id:Type:Name:InPortEnd] + public readonly static string CNIP = "#IP"; + + public readonly static float FLOAT_DRAW_HEIGHT_FIELD_SIZE = 16f; + public readonly static float FLOAT_DRAW_WIDTH_FIELD_SIZE = 45f; + public readonly static float FLOAT_WIDTH_SPACING = 3f; + + public readonly static Color LockedPortColor = new Color( 0.3f, 0.3f, 0.3f, 0.5f ); + + public readonly static int[] AvailableUVChannels = { 0, 1, 2, 3, 4, 5, 6, 7 }; + public readonly static string[] AvailableUVChannelsStr = { "0", "1", "2", "3", "4", "5", "6", "7"}; + public readonly static string AvailableUVChannelLabel = "UV Channel"; + + public readonly static int[] AvailableUVSets = { 0, 1, 2, 3, 4, 5, 6, 7 }; + public readonly static string[] AvailableUVSetsStr = { "0", "1", "2", "3","4", "5", "6", "7" }; + public readonly static string AvailableUVSetsLabel = "UV Set"; + + public readonly static int[] AvailableUVSizes = { 2, 3, 4 }; + public readonly static string[] AvailableUVSizesStr = { "Float 2", "Float 3", "Float 4" }; + public readonly static string AvailableUVSizesLabel = "Coord Size"; + + + public readonly static string LineSeparator = "________________________________"; + + public readonly static Vector2 CopyPasteDeltaPos = new Vector2( 40, 40 ); + + public readonly static string[] VectorSuffixes = { ".x", ".y", ".z", ".w" }; + public readonly static string[] ColorSuffixes = { ".r", ".g", ".b", ".a" }; + + + public const string InternalDataLabelStr = "Internal Data"; + public const string AttributesLaberStr = "Attributes"; + public const string ParameterLabelStr = "Parameters"; + + public static readonly string[] ReferenceArrayLabels = { "Object", "Reference" }; + + public static readonly string[] ChannelNamesVector = { "X", "Y", "Z", "W" }; + public static readonly string[] ChannelNamesColor = { "R", "G", "B", "A" }; + + public static readonly string SamplerFormat = "sampler{0}"; + public static readonly string SamplerDeclFormat = "SamplerState {0}"; + public static readonly string SamplerDeclSRPFormat = "SAMPLER({0})"; + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Constants.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Constants.cs.meta new file mode 100644 index 00000000..68a7e78d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Constants.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d833dd0968f913f449477da6bcd56b48 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Constants.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers.meta new file mode 100644 index 00000000..a2177293 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2206c4bd7f3d18643a6a3452b0c070d1 +folderAsset: yes +timeCreated: 1522769470 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/ASEEndDecorator.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/ASEEndDecorator.cs new file mode 100644 index 00000000..7f8f1c2d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/ASEEndDecorator.cs @@ -0,0 +1,39 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using AmplifyShaderEditor; + +namespace AmplifyShaderEditor +{ + public class ASEEndDecorator : MaterialPropertyDrawer + { + bool m_applyNext = false; + + public override void OnGUI( Rect position, MaterialProperty prop, String label, MaterialEditor editor ) + { + if( prop.applyPropertyCallback == null ) + prop.applyPropertyCallback = Testc; + + if( GUI.changed || m_applyNext ) + { + m_applyNext = false; + Material mat = editor.target as Material; + UIUtils.CopyValuesFromMaterial( mat ); + } + } + + bool Testc( MaterialProperty prop, int changeMask, object previousValue ) + { + m_applyNext = true; + return false; + } + + public override float GetPropertyHeight( MaterialProperty prop, string label, MaterialEditor editor ) + { + return 0; + } + } +} \ No newline at end of file diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/ASEEndDecorator.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/ASEEndDecorator.cs.meta new file mode 100644 index 00000000..ae859104 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/ASEEndDecorator.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: fdf2e52babbbbf040b3b9f6df50243f3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/ASEEndDecorator.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs new file mode 100644 index 00000000..d631cf80 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs @@ -0,0 +1,296 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Donated by BinaryCats +// https://forum.unity.com/threads/best-tool-asset-store-award-amplify-shader-editor-node-based-shader-creation-tool.430959/page-60#post-3414465 +////////////////////// +// README / HOW TO USE +////////////////////// +// Examples: +// +// Floats: +// +// x Equals value +// EditableIf( _float1, Equalto, 1) +// This will allow the value to be edited, if the property _float1 is equal to 1. (_float1==1) +// Note: NotEqualTo is also a valid argument which will do the opposite of this example.EditableIf(_float1, NotEqualTo, 1) (NotEqualTo != 1) +// +// x Greater than value +// EditableIf(_Float1,GreaterThan,1) +// This will allow the value to be edited if the property _float1 is Greater than 1. (_float1>1) +// +// x Greater Than Or Equal to value +// EditableIf(_Float1,GreaterThanOrEqualTo,1) +// This will allow the value to be edited if the property _float1 is Greater than or equal to 1. (_float1>=1) +// +// +// x Less Than value +// EditableIf(_Float1,LessThan,1) +// This will allow the value to be edited if the property _float1 is Less than 1. (_float1<1) +// +// x Less Than Or Equal to value +// EditableIf(_Float1,LessThanOrEqualTo,1) +// This will allow the value to be edited if the property _float1 is Less than or equal to 1. (_float1<=1) +// +// +// Colour: +// +// x Equals r,g,b,a +// EditableIf(_Color0,EqualTo,255,255,255,255) +// This will allow the value to be edited, if the property _Color0 R,G,B and A value all Equal 255. (_Color0.R==255 && _Color0.G==255 & _Color0.B == 255 && _Color0.A == 255) +// +// x Equals alpha +// EditableIf(_Color0,EqualTo,null,null,null,255) +// This will allow the value to be edited, if the property _Color0 Alpha value is Equal to 255. (_Color0.A == 255) +// +// a Greater than blue +// EditableIf(_Color0,GreaterThan,null,null,125) +// This will allow the value to be edited, if the property _Color0 Blue value is Greater Than 125. (_Color0.B > 125) +// Note: as I do not want to check the Red or Green Values, i have entered "null" for the parameter +// Note: I have not inputted a value to check for Alpha, as i do not want to check it. Simularly, if I wanted to Only check the Red Value I could have used EditableIf(_Color0,GreaterThan,125) +// +// Like wise with floats GreaterThanOrEqualTo, LessThan, LessThanOrEqualTo +// +// Vector: +// Vector Checks work the same as colour checks +// +// Texture: +// x Does Not have a Texture +// EditableIf(_TextureSample0,Equals,null) +// This will allow the value to be edited, if the property _TextureSample0 does NOT have a texture +// +// x Does have a Texture +// EditableIf(_TextureSample0,NotEqualTo,null) +// This will allow the value to be edited, if the property _TextureSample0 does have a texture + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + public enum ComparisonOperators + { + EqualTo, NotEqualTo, GreaterThan, LessThan, EqualsOrGreaterThan, EqualsOrLessThan, ContainsFlags, + DoesNotContainsFlags + } + + public class EditableIf : MaterialPropertyDrawer + { + ComparisonOperators op; + string FieldName = ""; + object ExpectedValue; + bool InputError; + public EditableIf() + { + InputError = true; + } + public EditableIf( object fieldname, object comparison, object expectedvalue ) + { + if ( expectedvalue.ToString().ToLower() == "true" ) + { + expectedvalue = ( System.Single )1; + } + else if ( expectedvalue.ToString().ToLower() == "false" ) + { + expectedvalue = ( System.Single )0; + + } + Init( fieldname, comparison, expectedvalue ); + + } + public EditableIf( object fieldname, object comparison, object expectedvaluex, object expectedvaluey ) + { + float? x = expectedvaluex as float?; + float? y = expectedvaluey as float?; + float? z = float.NegativeInfinity; + float? w = float.NegativeInfinity; + x = GetVectorValue( x ); + y = GetVectorValue( y ); + + Init( fieldname, comparison, new Vector4( x.Value, y.Value, z.Value, w.Value ) ); + } + public EditableIf( object fieldname, object comparison, object expectedvaluex, object expectedvaluey, object expectedvaluez ) + { + float? x = expectedvaluex as float?; + float? y = expectedvaluey as float?; + float? z = expectedvaluez as float?; + float? w = float.NegativeInfinity; + x = GetVectorValue( x ); + y = GetVectorValue( y ); + z = GetVectorValue( z ); + + Init( fieldname, comparison, new Vector4( x.Value, y.Value, z.Value, w.Value ) ); + + } + public EditableIf( object fieldname, object comparison, object expectedvaluex, object expectedvaluey, object expectedvaluez, object expectedvaluew ) + { + var x = expectedvaluex as float?; + var y = expectedvaluey as float?; + var z = expectedvaluez as float?; + var w = expectedvaluew as float?; + x = GetVectorValue( x ); + y = GetVectorValue( y ); + z = GetVectorValue( z ); + w = GetVectorValue( w ); + + Init( fieldname, comparison, new Vector4( x.Value, y.Value, z.Value, w.Value ) ); + + } + + private void Init( object fieldname, object comparison, object expectedvalue ) + { + FieldName = fieldname.ToString(); + var names = Enum.GetNames( typeof( ComparisonOperators ) ); + var name = comparison.ToString().ToLower().Replace( " ", "" ); + + for ( int i = 0; i < names.Length; i++ ) + { + if ( names[ i ].ToLower() == name ) + { + op = ( ComparisonOperators )i; + break; + } + } + + ExpectedValue = expectedvalue; + } + + private static float? GetVectorValue( float? x ) + { + if ( x.HasValue == false ) + { + x = float.NegativeInfinity; + } + + return x; + } + + // Draw the property inside the given rect + public override void OnGUI( Rect position, MaterialProperty prop, String label, MaterialEditor editor ) + { + if ( InputError ) + { + EditorGUI.LabelField( position, "EditableIf Attribute Error: Input parameters are invalid!" ); + return; + } + var LHSprop = MaterialEditor.GetMaterialProperty( prop.targets, FieldName ); + if ( string.IsNullOrEmpty( LHSprop.name ) ) + { + LHSprop = MaterialEditor.GetMaterialProperty( prop.targets, "_" + FieldName.Replace( " ", "" ) ); + if ( string.IsNullOrEmpty( LHSprop.name ) ) + { + EditorGUI.LabelField( position, "EditableIf Attribute Error: " + FieldName + " Does not exist!" ); + return; + } + } + object LHSVal = null; + + bool test = false; + switch ( LHSprop.type ) + { + case MaterialProperty.PropType.Color: + case MaterialProperty.PropType.Vector: + LHSVal = LHSprop.type == MaterialProperty.PropType.Color ? ( Vector4 )LHSprop.colorValue : LHSprop.vectorValue; + var v4 = ExpectedValue as Vector4?; + v4 = v4.HasValue ? v4 : new Vector4( ( System.Single )ExpectedValue, float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity ); + + if ( LHSprop.type == MaterialProperty.PropType.Color ) + { + test = VectorCheck( ( Vector4 )LHSVal, op, v4 / 255 ); + + } + else + test = VectorCheck( ( Vector4 )LHSVal, op, v4 ); + break; + case MaterialProperty.PropType.Range: + case MaterialProperty.PropType.Float: + LHSVal = LHSprop.floatValue; + test = ( Check( LHSVal, op, ExpectedValue ) ); + break; + case MaterialProperty.PropType.Texture: + LHSVal = LHSprop.textureValue; + test = ( CheckObject( LHSVal, op, ExpectedValue ) ); + break; + } + + GUI.enabled = test; + editor.DefaultShaderProperty( position, prop, label ); + GUI.enabled = true; + } + + private bool VectorCheck( Vector4 LHS, ComparisonOperators op, object expectedValue ) + { + var RHS = ( Vector4 )expectedValue; + if ( RHS.x != float.NegativeInfinity ) + { + if ( !Check( LHS.x, op, RHS.x ) ) + return false; + } + if ( RHS.y != float.NegativeInfinity ) + { + if ( !Check( LHS.y, op, RHS.y ) ) + return false; + } + if ( RHS.z != float.NegativeInfinity ) + { + if ( !Check( LHS.z, op, RHS.z ) ) + return false; + } + if ( RHS.w != float.NegativeInfinity ) + { + if ( !Check( LHS.w, op, RHS.w ) ) + return false; + } + + return true; + } + + protected bool Check( object LHS, ComparisonOperators op, object RHS ) + { + if ( !( LHS is IComparable ) || !( RHS is IComparable ) ) + throw new Exception( "Check using non basic type" ); + + switch ( op ) + { + case ComparisonOperators.EqualTo: + return ( ( IComparable )LHS ).CompareTo( RHS ) == 0; + + case ComparisonOperators.NotEqualTo: + return ( ( IComparable )LHS ).CompareTo( RHS ) != 0; + + case ComparisonOperators.EqualsOrGreaterThan: + return ( ( IComparable )LHS ).CompareTo( RHS ) >= 0; + + case ComparisonOperators.EqualsOrLessThan: + return ( ( IComparable )LHS ).CompareTo( RHS ) <= 0; + + case ComparisonOperators.GreaterThan: + return ( ( IComparable )LHS ).CompareTo( RHS ) > 0; + + case ComparisonOperators.LessThan: + return ( ( IComparable )LHS ).CompareTo( RHS ) < 0; + case ComparisonOperators.ContainsFlags: + return ( ( int )LHS & ( int )RHS ) != 0; // Dont trust LHS values, it has been casted to a char and then to an int again, first bit will be the sign + case ComparisonOperators.DoesNotContainsFlags: + return ( ( ( int )LHS & ( int )RHS ) == ( int )LHS ); // Dont trust LHS values, it has been casted to a char and then to an int again, first bit will be the sign + + default: + break; + } + return false; + } + private bool CheckObject( object LHS, ComparisonOperators comparasonOperator, object RHS ) + { + switch ( comparasonOperator ) + { + case ComparisonOperators.EqualTo: + return ( LHS == null ); + + case ComparisonOperators.NotEqualTo: + return ( LHS != null ); + } + return true; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs.meta new file mode 100644 index 00000000..d6810a3c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7a5504a2b7d04a846978416748dc6e0a +timeCreated: 1520330108 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/NoKeywordToggle.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/NoKeywordToggle.cs new file mode 100644 index 00000000..b7f81966 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/NoKeywordToggle.cs @@ -0,0 +1,29 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + public class NoKeywordToggle : MaterialPropertyDrawer + { + + public override void OnGUI( Rect position, MaterialProperty prop, String label, MaterialEditor editor ) + { + bool value = ( prop.floatValue != 0.0f ); + + EditorGUI.BeginChangeCheck(); + { + EditorGUI.showMixedValue = prop.hasMixedValue; + value = EditorGUI.Toggle( position, label, value ); + EditorGUI.showMixedValue = false; + } + if ( EditorGUI.EndChangeCheck() ) + { + prop.floatValue = value ? 1.0f : 0.0f; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/NoKeywordToggle.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/NoKeywordToggle.cs.meta new file mode 100644 index 00000000..1eed5286 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/NoKeywordToggle.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e1a000d43a26286499b39a7571e5c61b +timeCreated: 1605540234 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/NoKeywordToggle.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs new file mode 100644 index 00000000..c7a3487c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs @@ -0,0 +1,39 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + public class RemapSliders : MaterialPropertyDrawer + { + public override void OnGUI( Rect position, MaterialProperty prop, String label, MaterialEditor editor ) + { + EditorGUI.BeginChangeCheck(); + Vector4 value = prop.vectorValue; + + EditorGUI.showMixedValue = prop.hasMixedValue; + + var cacheLabel = EditorGUIUtility.labelWidth; + var cacheField = EditorGUIUtility.fieldWidth; + if ( cacheField <= 64 ) + { + float total = position.width; + EditorGUIUtility.labelWidth = Mathf.Ceil( 0.45f * total ) - 30; + EditorGUIUtility.fieldWidth = Mathf.Ceil( 0.55f * total ) + 30; + } + + EditorGUI.MinMaxSlider( position, label, ref value.x, ref value.y, 0, 1 ); + + EditorGUIUtility.labelWidth = cacheLabel; + EditorGUIUtility.fieldWidth = cacheField; + EditorGUI.showMixedValue = false; + if ( EditorGUI.EndChangeCheck() ) + { + prop.vectorValue = value; + } + } + } +} \ No newline at end of file diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs.meta new file mode 100644 index 00000000..ca49ff05 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 314af1bcecbba6c4d92cbb5843c221ba +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSlidersFull.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSlidersFull.cs new file mode 100644 index 00000000..3fb9d534 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSlidersFull.cs @@ -0,0 +1,39 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + public class RemapSlidersFull : MaterialPropertyDrawer + { + public override void OnGUI( Rect position, MaterialProperty prop, String label, MaterialEditor editor ) + { + EditorGUI.BeginChangeCheck(); + Vector4 value = prop.vectorValue; + + EditorGUI.showMixedValue = prop.hasMixedValue; + + var cacheLabel = EditorGUIUtility.labelWidth; + var cacheField = EditorGUIUtility.fieldWidth; + if ( cacheField <= 64 ) + { + float total = position.width; + EditorGUIUtility.labelWidth = Mathf.Ceil( 0.45f * total ) - 30; + EditorGUIUtility.fieldWidth = Mathf.Ceil( 0.55f * total ) + 30; + } + + EditorGUI.MinMaxSlider( position, label, ref value.x, ref value.y, value.z, value.w ); + + EditorGUIUtility.labelWidth = cacheLabel; + EditorGUIUtility.fieldWidth = cacheField; + EditorGUI.showMixedValue = false; + if ( EditorGUI.EndChangeCheck() ) + { + prop.vectorValue = value; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSlidersFull.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSlidersFull.cs.meta new file mode 100644 index 00000000..74f4a6b3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSlidersFull.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 9a724dcf5c5ddef40bcef06f0b2c8ec0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSlidersFull.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs new file mode 100644 index 00000000..30ddbde5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + public class SingleLineTexture : MaterialPropertyDrawer + { + public override void OnGUI( Rect position, MaterialProperty prop, String label, MaterialEditor editor ) + { + EditorGUI.BeginChangeCheck(); + EditorGUI.showMixedValue = prop.hasMixedValue; + + Texture value = editor.TexturePropertyMiniThumbnail( position, prop, label, string.Empty ); + + EditorGUI.showMixedValue = false; + if( EditorGUI.EndChangeCheck() ) + { + prop.textureValue = value; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs.meta new file mode 100644 index 00000000..14d2ac44 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 85da32683d237ac4f8665251e2ac38dc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs new file mode 100644 index 00000000..791b7588 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs @@ -0,0 +1,17 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEditor; +using UnityEditor.ProjectWindowCallback; +namespace AmplifyShaderEditor +{ + public class DoCreateFunction : EndNameEditAction + { + public override void Action( int instanceId, string pathName, string resourceFile ) + { + UnityEngine.Object obj = EditorUtility.InstanceIDToObject( instanceId ); + AssetDatabase.CreateAsset( obj, AssetDatabase.GenerateUniqueAssetPath( pathName ) ); + AmplifyShaderEditorWindow.LoadShaderFunctionToASE( (AmplifyShaderFunction)obj, false ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs.meta new file mode 100644 index 00000000..ec2ac877 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3f2c950b0ed192943b7484f6b551965f +timeCreated: 1493906087 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs new file mode 100644 index 00000000..5fa1424f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs @@ -0,0 +1,48 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using UnityEditor.ProjectWindowCallback; +using System.IO; +namespace AmplifyShaderEditor +{ + public class DoCreateStandardShader : EndNameEditAction + { + public override void Action( int instanceId, string pathName, string resourceFile ) + { + string uniquePath = AssetDatabase.GenerateUniqueAssetPath( pathName ); + string shaderName = Path.GetFileName( uniquePath ); + + if( IOUtils.AllOpenedWindows.Count > 0 ) + { + EditorWindow openedWindow = AmplifyShaderEditorWindow.GetWindow(); + AmplifyShaderEditorWindow currentWindow = AmplifyShaderEditorWindow.CreateTab(); + WindowHelper.AddTab( openedWindow, currentWindow ); + UIUtils.CurrentWindow = currentWindow; + } + else + { + AmplifyShaderEditorWindow currentWindow = AmplifyShaderEditorWindow.OpenWindow( shaderName, UIUtils.ShaderIcon ); + UIUtils.CurrentWindow = currentWindow; + } + + Shader shader = UIUtils.CreateNewEmpty( uniquePath, shaderName ); + ProjectWindowUtil.ShowCreatedAsset( shader ); + } + } + + public class DoCreateTemplateShader : EndNameEditAction + { + public override void Action( int instanceId, string pathName, string resourceFile ) + { + string uniquePath = AssetDatabase.GenerateUniqueAssetPath( pathName ); + string shaderName = Path.GetFileName( uniquePath ); + if( !string.IsNullOrEmpty( UIUtils.NewTemplateGUID ) ) + { + Shader shader = AmplifyShaderEditorWindow.CreateNewTemplateShader( UIUtils.NewTemplateGUID, uniquePath, shaderName ); + ProjectWindowUtil.ShowCreatedAsset( shader ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs.meta new file mode 100644 index 00000000..04f53386 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2cfa7290f61ad684f99f8d81328ad52c +timeCreated: 1573664425 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs new file mode 100644 index 00000000..89cc8ed6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs @@ -0,0 +1,67 @@ +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [System.Serializable] + public class OptionsWindow + { + private AmplifyShaderEditorWindow m_parentWindow = null; + + private bool m_coloredPorts = true; + private bool m_multiLinePorts = true; + private const string MultiLineId = "MultiLinePortsDefault"; + private const string ColorPortId = "ColoredPortsDefault"; + public OptionsWindow( AmplifyShaderEditorWindow parentWindow ) + { + m_parentWindow = parentWindow; + //Load (); + } + + public void Init() + { + Load(); + } + + public void Destroy() + { + Save(); + } + + public void Save() + { + EditorPrefs.SetBool( ColorPortId, ColoredPorts ); + EditorPrefs.SetBool( MultiLineId, m_multiLinePorts ); + } + + public void Load() + { + ColoredPorts = EditorPrefs.GetBool( ColorPortId, true ); + m_multiLinePorts = EditorPrefs.GetBool( MultiLineId, true ); + } + + public bool ColoredPorts + { + get { return m_coloredPorts; } + set + { + if ( m_coloredPorts != value ) + EditorPrefs.SetBool( ColorPortId, value ); + + m_coloredPorts = value; + } + } + + public bool MultiLinePorts + { + get { return m_multiLinePorts; } + set + { + if ( m_multiLinePorts != value ) + EditorPrefs.SetBool( MultiLineId, value ); + + m_multiLinePorts = value; + } + } + public AmplifyShaderEditorWindow ParentWindow { get { return m_parentWindow; } set { m_parentWindow = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs.meta new file mode 100644 index 00000000..12223006 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 44cb06bc7bfe6e84aa8b5e8b702eb2dd +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs.meta new file mode 100644 index 00000000..e542e0f4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 52f451731ec183e43ab18f0896f7172a +folderAsset: yes +timeCreated: 1481126944 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs new file mode 100644 index 00000000..6b39910e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs @@ -0,0 +1,283 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public class NodeGrid + { + private bool m_debugGrid = false; + private const float GRID_SIZE_X = 16; + private const float GRID_SIZE_Y = 16; + + private const float GRID_AREA_X = 64; + private const float GRID_AREA_Y = 64; + + private Dictionary>> m_grid; + + private int m_xMin = int.MaxValue; + private int m_yMin = int.MaxValue; + + private int m_xMax = int.MinValue; + private int m_yMax = int.MinValue; + + public NodeGrid() + { + m_grid = new Dictionary>>(); + } + + public void AddNodeToGrid( ParentNode node ) + { + Rect pos = node.Position; + if ( Mathf.Abs( pos.width ) < 0.001f || Mathf.Abs( pos.height ) < 0.001f ) + { + return; + } + + float initialXf = pos.x / GRID_SIZE_X; + float initialYf = pos.y / GRID_SIZE_Y; + + int endX = Mathf.CeilToInt( initialXf + pos.width / GRID_SIZE_X ); + int endY = Mathf.CeilToInt( initialYf + pos.height / GRID_SIZE_Y ); + + int initialX = Mathf.FloorToInt( initialXf ); + int initialY = Mathf.FloorToInt( initialYf ); + + + if ( initialX < m_xMin ) + { + m_xMin = initialX; + } + + if ( initialY < m_yMin ) + { + m_yMin = initialY; + } + + if ( endX > m_xMax ) + { + m_xMax = endX; + } + + if ( endY > m_yMax ) + { + m_yMax = endY; + } + + for ( int x = initialX; x < endX; x += 1 ) + { + for ( int y = initialY; y < endY; y += 1 ) + { + if ( !m_grid.ContainsKey( x ) ) + { + m_grid.Add( x, new Dictionary>() ); + + } + + if ( !m_grid[ x ].ContainsKey( y ) ) + { + m_grid[ x ].Add( y, new List() ); + } + + m_grid[ x ][ y ].Add( node ); + } + } + node.IsOnGrid = true; + //DebugLimits(); + } + + public void RemoveNodeFromGrid( ParentNode node, bool useCachedPos ) + { + Rect pos = useCachedPos ? node.CachedPos : node.Position; + if ( Mathf.Abs( pos.width ) < 0.001f || Mathf.Abs( pos.height ) < 0.001f ) + { + return; + } + + float initialXf = pos.x / GRID_SIZE_X; + float initialYf = pos.y / GRID_SIZE_Y; + + int endX = Mathf.CeilToInt( initialXf + pos.width / GRID_SIZE_X ); + int endY = Mathf.CeilToInt( initialYf + pos.height / GRID_SIZE_Y ); + + int initialX = Mathf.FloorToInt( initialXf ); + int initialY = Mathf.FloorToInt( initialYf ); + bool testLimits = false; + + int xMinCount = 0; + int xMaxCount = 0; + + int yMinCount = 0; + int yMaxCount = 0; + + + for ( int x = initialX; x < endX; x += 1 ) + { + for ( int y = initialY; y < endY; y += 1 ) + { + if ( m_grid.ContainsKey( x ) ) + { + if ( m_grid[ x ].ContainsKey( y ) ) + { + m_grid[ x ][ y ].Remove( node ); + node.IsOnGrid = false; + + if ( initialX == m_xMin && x == initialX ) + { + testLimits = true; + if ( m_grid[ x ][ y ].Count != 0 ) + { + xMinCount += 1; + } + } + + if ( endX == m_xMax && x == endX ) + { + testLimits = true; + if ( m_grid[ x ][ y ].Count != 0 ) + { + xMaxCount += 1; + } + } + + if ( initialY == m_yMin && y == initialY ) + { + testLimits = true; + if ( m_grid[ x ][ y ].Count != 0 ) + { + yMinCount += 1; + } + } + + if ( endY == m_yMax && y == endY ) + { + testLimits = true; + if ( m_grid[ x ][ y ].Count != 0 ) + { + yMaxCount += 1; + } + } + } + } + } + } + + + if ( testLimits ) + { + if ( xMinCount == 0 || xMaxCount == 0 || yMinCount == 0 || yMaxCount == 0 ) + { + m_xMin = int.MaxValue; + m_yMin = int.MaxValue; + + m_xMax = int.MinValue; + m_yMax = int.MinValue; + foreach ( KeyValuePair>> entryX in m_grid ) + { + foreach ( KeyValuePair> entryY in entryX.Value ) + { + if ( entryY.Value.Count > 0 ) + { + if ( entryX.Key < m_xMin ) + { + m_xMin = entryX.Key; + } + + if ( entryY.Key < m_yMin ) + { + m_yMin = entryY.Key; + } + + if ( entryX.Key > m_xMax ) + { + m_xMax = entryX.Key; + } + + if ( entryY.Key > m_yMax ) + { + m_yMax = entryY.Key; + } + } + } + } + // The += 1 is to maintain consistence with AddNodeToGrid() ceil op on max values + m_xMax += 1; + m_yMax += 1; + } + } + //DebugLimits(); + } + + public void DebugLimits() + { + Debug.Log( "[ " + m_xMin + " , " + m_yMin + " ] " + "[ " + m_xMax + " , " + m_yMax + " ] " ); + } + + //pos must be the transformed mouse position to local canvas coordinates + public List GetNodesOn( Vector2 pos ) + { + int x = Mathf.FloorToInt( pos.x / GRID_SIZE_X ); + int y = Mathf.FloorToInt( pos.y / GRID_SIZE_Y ); + + if ( m_grid.ContainsKey( x ) ) + { + if ( m_grid[ x ].ContainsKey( y ) ) + { + return m_grid[ x ][ y ]; + } + } + + return null; + } + + public List GetNodesOn( int x, int y ) + { + if ( m_grid.ContainsKey( x ) ) + { + if ( m_grid[ x ].ContainsKey( y ) ) + { + return m_grid[ x ][ y ]; + } + } + return null; + } + + public void DrawGrid( DrawInfo drawInfo ) + { + if ( m_debugGrid ) + { + Handles.CircleHandleCap( 0, drawInfo.InvertedZoom * ( new Vector3( drawInfo.CameraOffset.x, drawInfo.CameraOffset.y, 0f ) ), Quaternion.identity, 5,EventType.Layout ); + for ( int x = -( int ) GRID_AREA_X; x < GRID_AREA_X; x += ( int ) GRID_SIZE_X ) + { + Handles.DrawLine( drawInfo.InvertedZoom * ( new Vector3( x + drawInfo.CameraOffset.x, drawInfo.CameraOffset.y - GRID_AREA_Y, 0 ) ), drawInfo.InvertedZoom * ( new Vector3( drawInfo.CameraOffset.x + x, drawInfo.CameraOffset.y + GRID_AREA_Y, 0 ) ) ); + } + + for ( int y = -( int ) GRID_AREA_Y; y < GRID_AREA_X; y += ( int ) GRID_SIZE_Y ) + { + Handles.DrawLine( drawInfo.InvertedZoom * ( new Vector3( drawInfo.CameraOffset.x - GRID_AREA_X, drawInfo.CameraOffset.y + y, 0 ) ), drawInfo.InvertedZoom * ( new Vector3( drawInfo.CameraOffset.x + GRID_AREA_X, drawInfo.CameraOffset.y + y, 0 ) ) ); + } + } + } + + public void Destroy() + { + foreach ( KeyValuePair>> entryX in m_grid ) + { + foreach ( KeyValuePair> entryY in entryX.Value ) + { + entryY.Value.Clear(); + } + entryX.Value.Clear(); + } + m_grid.Clear(); + } + + public float MaxNodeDist + { + get { return Mathf.Max( ( m_xMax - m_xMin )*GRID_SIZE_X, ( m_yMax - m_yMin )*GRID_SIZE_Y ); } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs.meta new file mode 100644 index 00000000..0c6b20a4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6344917ce0eed6b43840632b98a2ed57 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs new file mode 100644 index 00000000..34b0463d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs @@ -0,0 +1,4067 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using System.Linq; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class ParentGraph : ScriptableObject, ISerializationCallbackReceiver + { + private const int MasterNodeLODIncrement = 100; + private const int MaxLodAmount = 9; + + public enum NodeLOD + { + LOD0, + LOD1, + LOD2, + LOD3, + LOD4, + LOD5 + } + + [SerializeField] + private bool m_samplingThroughMacros = false; + + private NodeLOD m_lodLevel = NodeLOD.LOD0; + private GUIStyle nodeStyleOff; + private GUIStyle nodeStyleOn; + private GUIStyle nodeTitle; + private GUIStyle commentaryBackground; + + public delegate void LODMasterNodesAdded( int lod ); + public event LODMasterNodesAdded OnLODMasterNodesAddedEvent; + + public delegate void EmptyGraphDetected( ParentGraph graph ); + public event EmptyGraphDetected OnEmptyGraphDetectedEvt; + + public delegate void NodeEvent( ParentNode node ); + public event NodeEvent OnNodeEvent = null; + public event NodeEvent OnNodeRemovedEvent; + + public delegate void DuplicateEvent(); + public event DuplicateEvent OnDuplicateEvent; + + public event MasterNode.OnMaterialUpdated OnMaterialUpdatedEvent; + public event MasterNode.OnMaterialUpdated OnShaderUpdatedEvent; + + private bool m_afterDeserializeFlag = true; + private bool m_lateOptionsRefresh = false; + private bool m_foundDuplicates = false; + + //[SerializeField] + private AmplifyShaderEditorWindow m_parentWindow = null; + + [SerializeField] + private int m_validNodeId; + + [SerializeField] + private List m_nodes = new List(); + + // Sampler Nodes registry + [SerializeField] + private UsageListSamplerNodes m_samplerNodes = new UsageListSamplerNodes(); + + [SerializeField] + private UsageListFloatIntNodes m_floatNodes = new UsageListFloatIntNodes(); + + [SerializeField] + private UsageListTexturePropertyNodes m_texturePropertyNodes = new UsageListTexturePropertyNodes(); + + [SerializeField] + private UsageListTextureArrayNodes m_textureArrayNodes = new UsageListTextureArrayNodes(); + + [SerializeField] + private UsageListPropertyNodes m_propertyNodes = new UsageListPropertyNodes(); + + [SerializeField] + private UsageListPropertyNodes m_rawPropertyNodes = new UsageListPropertyNodes(); + + [SerializeField] + private UsageListScreenColorNodes m_screenColorNodes = new UsageListScreenColorNodes(); + + [SerializeField] + private UsageListRegisterLocalVarNodes m_localVarNodes = new UsageListRegisterLocalVarNodes(); + + [SerializeField] + private UsageListGlobalArrayNodes m_globalArrayNodes = new UsageListGlobalArrayNodes(); + + [SerializeField] + private UsageListFunctionInputNodes m_functionInputNodes = new UsageListFunctionInputNodes(); + + [SerializeField] + private UsageListFunctionNodes m_functionNodes = new UsageListFunctionNodes(); + + [SerializeField] + private UsageListFunctionOutputNodes m_functionOutputNodes = new UsageListFunctionOutputNodes(); + + [SerializeField] + private UsageListFunctionSwitchNodes m_functionSwitchNodes = new UsageListFunctionSwitchNodes(); + + [SerializeField] + private UsageListFunctionSwitchCopyNodes m_functionSwitchCopyNodes = new UsageListFunctionSwitchCopyNodes(); + + [SerializeField] + private UsageListTemplateMultiPassMasterNodes m_multiPassMasterNodes = new UsageListTemplateMultiPassMasterNodes(); + + [SerializeField] + private List m_lodMultiPassMasterNodes; + + [SerializeField] + private UsageListCustomExpressionsOnFunctionMode m_customExpressionsOnFunctionMode = new UsageListCustomExpressionsOnFunctionMode(); + + [SerializeField] + private UsageListStaticSwitchNodes m_staticSwitchNodes = new UsageListStaticSwitchNodes(); + + [SerializeField] + private int m_masterNodeId = Constants.INVALID_NODE_ID; + + [SerializeField] + private bool m_isDirty; + + [SerializeField] + private bool m_saveIsDirty = false; + + [SerializeField] + private int m_nodeClicked; + + [SerializeField] + private int m_loadedShaderVersion; + + [SerializeField] + private int m_instancePropertyCount = 0; + + [SerializeField] + private int m_virtualTextureCount = 0; + + [SerializeField] + private int m_graphId = 0; + + [SerializeField] + private PrecisionType m_currentPrecision = PrecisionType.Float; + + [SerializeField] + private NodeAvailability m_currentCanvasMode = NodeAvailability.SurfaceShader; + + [SerializeField] + private TemplateSRPType m_currentSRPType = TemplateSRPType.BiRP; + + //private List m_visibleNodes = new List(); + + private List m_nodePreviewList = new List(); + + private Dictionary m_nodesDict = new Dictionary(); + + [NonSerialized] + private List m_selectedNodes = new List(); + + [NonSerialized] + private List m_markedForDeletion = new List(); + + [SerializeField] + private List m_highlightedWires = new List(); + private System.Type m_masterNodeDefaultType; + + [SerializeField] + private List m_internalTemplateNodesList = new List(); + private Dictionary m_internalTemplateNodesDict = new Dictionary(); + + private NodeGrid m_nodeGrid; + + private bool m_markedToDeSelect = false; + private int m_markToSelect = -1; + private bool m_markToReOrder = false; + + private bool m_hasUnConnectedNodes = false; + + private bool m_checkSelectedWireHighlights = false; + + // Bezier info + [SerializeField] + private List m_bezierReferences; + private const int MaxBezierReferences = 50; + private int m_wireBezierCount = 0; + + protected int m_normalDependentCount = 0; + private bool m_forceCategoryRefresh = false; + + [SerializeField] + private bool m_forceRepositionCheck = false; + + private bool m_isLoading = false; + private bool m_isDuplicating = false; + + private bool m_changedLightingModel = false; + + public void ResetEvents() + { + OnNodeEvent = null; + OnMaterialUpdatedEvent = null; + OnShaderUpdatedEvent = null; + OnEmptyGraphDetectedEvt = null; + OnNodeRemovedEvent = null; + } + + public void Init() + { + UndoUtils.RegisterUndoRedoCallback( OnUndoRedoCallback ); + m_normalDependentCount = 0; + m_nodes = new List(); + m_samplerNodes = new UsageListSamplerNodes(); + m_samplerNodes.ContainerGraph = this; + m_samplerNodes.ReorderOnChange = true; + m_floatNodes = new UsageListFloatIntNodes(); + m_floatNodes.ContainerGraph = this; + m_texturePropertyNodes = new UsageListTexturePropertyNodes(); + m_texturePropertyNodes.ContainerGraph = this; + m_textureArrayNodes = new UsageListTextureArrayNodes(); + m_textureArrayNodes.ContainerGraph = this; + m_textureArrayNodes.ReorderOnChange = true; + m_propertyNodes = new UsageListPropertyNodes(); + m_propertyNodes.ContainerGraph = this; + m_rawPropertyNodes = new UsageListPropertyNodes(); + m_rawPropertyNodes.ContainerGraph = this; + m_customExpressionsOnFunctionMode = new UsageListCustomExpressionsOnFunctionMode(); + m_customExpressionsOnFunctionMode.ContainerGraph = this; + m_staticSwitchNodes = new UsageListStaticSwitchNodes(); + m_staticSwitchNodes.ContainerGraph = this; + m_staticSwitchNodes.ReorderOnChange = true; + m_screenColorNodes = new UsageListScreenColorNodes(); + m_screenColorNodes.ContainerGraph = this; + m_screenColorNodes.ReorderOnChange = true; + m_localVarNodes = new UsageListRegisterLocalVarNodes(); + m_localVarNodes.ContainerGraph = this; + m_localVarNodes.ReorderOnChange = true; + m_globalArrayNodes = new UsageListGlobalArrayNodes(); + m_globalArrayNodes.ContainerGraph = this; + m_functionInputNodes = new UsageListFunctionInputNodes(); + m_functionInputNodes.ContainerGraph = this; + m_functionNodes = new UsageListFunctionNodes(); + m_functionNodes.ContainerGraph = this; + m_functionOutputNodes = new UsageListFunctionOutputNodes(); + m_functionOutputNodes.ContainerGraph = this; + m_functionSwitchNodes = new UsageListFunctionSwitchNodes(); + m_functionSwitchNodes.ContainerGraph = this; + m_functionSwitchCopyNodes = new UsageListFunctionSwitchCopyNodes(); + m_functionSwitchCopyNodes.ContainerGraph = this; + m_multiPassMasterNodes = new UsageListTemplateMultiPassMasterNodes(); + m_multiPassMasterNodes.ContainerGraph = this; + m_lodMultiPassMasterNodes = new List( MaxLodAmount ); + for( int i = 0; i < MaxLodAmount; i++ ) + { + m_lodMultiPassMasterNodes.Add( new UsageListTemplateMultiPassMasterNodes() ); + } + m_selectedNodes = new List(); + m_markedForDeletion = new List(); + m_highlightedWires = new List(); + m_validNodeId = 0; + IsDirty = false; + SaveIsDirty = false; + m_masterNodeDefaultType = typeof( StandardSurfaceOutputNode ); + + m_bezierReferences = new List( MaxBezierReferences ); + for( int i = 0; i < MaxBezierReferences; i++ ) + { + m_bezierReferences.Add( new WireBezierReference() ); + } + } + + public void ActivatePreviews( bool value ) + { + int count = m_nodes.Count; + if( value ) + { + for( int i = 0 ; i < count ; i++ ) + { + m_nodes[ i ].PreviewIsDirty = true; + } + } + else + { + //for( int i = 0 ; i < count ; i++ ) + //{ + // m_nodes[ i ].DisablePreview(); + //} + } + } + + private void OnUndoRedoCallback() + { + DeSelectAll(); + } + + private void OnEnable() + { + hideFlags = HideFlags.HideAndDontSave; + m_nodeGrid = new NodeGrid(); + m_internalTemplateNodesDict = new Dictionary(); + m_nodesDict = new Dictionary(); + nodeStyleOff = UIUtils.GetCustomStyle( CustomStyle.NodeWindowOff ); + nodeStyleOn = UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ); + nodeTitle = UIUtils.GetCustomStyle( CustomStyle.NodeHeader ); + commentaryBackground = UIUtils.GetCustomStyle( CustomStyle.CommentaryBackground ); + } + + public void UpdateRegisters() + { + m_samplerNodes.UpdateNodeArr(); + m_propertyNodes.UpdateNodeArr(); + m_rawPropertyNodes.UpdateNodeArr(); + m_customExpressionsOnFunctionMode.UpdateNodeArr(); + m_staticSwitchNodes.UpdateNodeArr(); + m_functionInputNodes.UpdateNodeArr(); + m_functionNodes.UpdateNodeArr(); + m_functionOutputNodes.UpdateNodeArr(); + m_functionSwitchNodes.UpdateNodeArr(); + m_functionSwitchCopyNodes.UpdateNodeArr(); + m_multiPassMasterNodes.UpdateNodeArr(); + for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) + { + m_lodMultiPassMasterNodes[ i ].UpdateNodeArr(); + } + m_texturePropertyNodes.UpdateNodeArr(); + m_textureArrayNodes.UpdateNodeArr(); + m_screenColorNodes.UpdateNodeArr(); + m_localVarNodes.UpdateNodeArr(); + m_globalArrayNodes.UpdateNodeArr(); + } + + public int GetValidId() + { + return m_validNodeId++; + } + + void UpdateIdFromNode( ParentNode node ) + { + if( node.UniqueId >= m_validNodeId ) + { + m_validNodeId = node.UniqueId + 1; + } + } + + public void ResetNodeConnStatus() + { + for( int i = 0; i < m_nodes.Count; i++ ) + { + if( m_nodes[ i ].ConnStatus == NodeConnectionStatus.Connected ) + { + m_nodes[ i ].ConnStatus = NodeConnectionStatus.Not_Connected; + } + } + } + + public void CleanUnusedNodes() + { + List unusedNodes = new List(); + for( int i = 0; i < m_nodes.Count; i++ ) + { + if( m_nodes[ i ].ConnStatus == NodeConnectionStatus.Not_Connected ) + { + unusedNodes.Add( m_nodes[ i ] ); + } + } + + for( int i = 0; i < unusedNodes.Count; i++ ) + { + DestroyNode( unusedNodes[ i ] ); + } + unusedNodes.Clear(); + unusedNodes = null; + + IsDirty = true; + } + + // Destroy all nodes excluding Master Node + public void ClearGraph() + { + List list = new List(); + int count = m_nodes.Count; + for( int i = 0; i < count; i++ ) + { + if( m_nodes[ i ].UniqueId != m_masterNodeId ) + { + list.Add( m_nodes[ i ] ); + } + } + + while( list.Count > 0 ) + { + DestroyNode( list[ 0 ] ); + list.RemoveAt( 0 ); + } + } + + public void CleanNodes() + { + for( int i = 0; i < m_nodes.Count; i++ ) + { + if( m_nodes[ i ] != null ) + { + UndoUtils.ClearUndo( m_nodes[ i ] ); + m_nodes[ i ].Destroy(); + GameObject.DestroyImmediate( m_nodes[ i ] ); + } + } + ClearInternalTemplateNodes(); + + m_masterNodeId = Constants.INVALID_NODE_ID; + m_validNodeId = 0; + m_instancePropertyCount = 0; + m_virtualTextureCount = 0; + + m_nodesDict.Clear(); + m_nodes.Clear(); + m_samplerNodes.Clear(); + m_propertyNodes.Clear(); + m_rawPropertyNodes.Clear(); + m_customExpressionsOnFunctionMode.Clear(); + m_staticSwitchNodes.Clear(); + m_functionInputNodes.Clear(); + m_functionNodes.Clear(); + m_functionOutputNodes.Clear(); + m_functionSwitchNodes.Clear(); + m_functionSwitchCopyNodes.Clear(); + m_multiPassMasterNodes.Clear(); + for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) + { + m_lodMultiPassMasterNodes[ i ].Clear(); + } + + m_texturePropertyNodes.Clear(); + m_textureArrayNodes.Clear(); + m_screenColorNodes.Clear(); + m_localVarNodes.Clear(); + m_globalArrayNodes.Clear(); + m_selectedNodes.Clear(); + m_markedForDeletion.Clear(); + } + + public void ResetHighlightedWires() + { + for( int i = 0; i < m_highlightedWires.Count; i++ ) + { + m_highlightedWires[ i ].WireStatus = WireStatus.Default; + } + m_highlightedWires.Clear(); + } + + public void HighlightWiresStartingNode( ParentNode node ) + { + for( int outputIdx = 0; outputIdx < node.OutputPorts.Count; outputIdx++ ) + { + for( int extIdx = 0; extIdx < node.OutputPorts[ outputIdx ].ExternalReferences.Count; extIdx++ ) + { + WireReference wireRef = node.OutputPorts[ outputIdx ].ExternalReferences[ extIdx ]; + ParentNode nextNode = GetNode( wireRef.NodeId ); + if( nextNode && nextNode.ConnStatus == NodeConnectionStatus.Connected ) + { + InputPort port = nextNode.GetInputPortByUniqueId( wireRef.PortId ); + if( port.ExternalReferences.Count == 0 || port.ExternalReferences[ 0 ].WireStatus == WireStatus.Highlighted ) + { + // if even one wire is already highlighted then this tells us that this node was already been analysed + return; + } + + port.ExternalReferences[ 0 ].WireStatus = WireStatus.Highlighted; + m_highlightedWires.Add( port.ExternalReferences[ 0 ] ); + HighlightWiresStartingNode( nextNode ); + } + } + } + + RegisterLocalVarNode regNode = node as RegisterLocalVarNode; + if( (object)regNode != null ) + { + int count = regNode.NodeReferences.Count; + for( int i = 0; i < count; i++ ) + { + HighlightWiresStartingNode( regNode.NodeReferences[ i ] ); + } + } + } + + void PropagateHighlightDeselection( ParentNode node, int portId = -1 ) + { + if( portId > -1 ) + { + InputPort port = node.GetInputPortByUniqueId( portId ); + port.ExternalReferences[ 0 ].WireStatus = WireStatus.Default; + } + + if( node.Selected ) + return; + + for( int i = 0; i < node.InputPorts.Count; i++ ) + { + if( node.InputPorts[ i ].ExternalReferences.Count > 0 && node.InputPorts[ i ].ExternalReferences[ 0 ].WireStatus == WireStatus.Highlighted ) + { + // even though node is deselected, it receives wire highlight from a previous one + return; + } + } + + for( int outputIdx = 0; outputIdx < node.OutputPorts.Count; outputIdx++ ) + { + for( int extIdx = 0; extIdx < node.OutputPorts[ outputIdx ].ExternalReferences.Count; extIdx++ ) + { + WireReference wireRef = node.OutputPorts[ outputIdx ].ExternalReferences[ extIdx ]; + ParentNode nextNode = GetNode( wireRef.NodeId ); + PropagateHighlightDeselection( nextNode, wireRef.PortId ); + } + } + + RegisterLocalVarNode regNode = node as RegisterLocalVarNode; + if( (object)regNode != null ) + { + int count = regNode.NodeReferences.Count; + for( int i = 0; i < count; i++ ) + { + PropagateHighlightDeselection( regNode.NodeReferences[ i ], -1 ); + } + } + } + + + public void ResetNodesData() + { + int count = m_nodes.Count; + for( int i = 0; i < count; i++ ) + { + m_nodes[ i ].ResetNodeData(); + } + } + + public void FullCleanUndoStack() + { + UndoUtils.ClearUndo( this ); + int count = m_nodes.Count; + for( int i = 0; i < count; i++ ) + { + if( m_nodes[ i ] != null ) + { + UndoUtils.ClearUndo( m_nodes[ i ] ); + } + } + } + + public void FullRegisterOnUndoStack() + { + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoRegisterFullGrapId ); + int count = m_nodes.Count; + for( int i = 0; i < count; i++ ) + { + if( m_nodes[ i ] != null ) + { + UndoUtils.RegisterCompleteObjectUndo( m_nodes[ i ], Constants.UndoRegisterFullGrapId ); + } + } + } + + public void CheckPropertiesAutoRegister( ref MasterNodeDataCollector dataCollector ) + { + List propertyNodesList = m_rawPropertyNodes.NodesList; + int propertyCount = propertyNodesList.Count; + for( int i = 0; i < propertyCount; i++ ) + { + propertyNodesList[ i ].CheckIfAutoRegister( ref dataCollector ); + } + propertyNodesList = null; + + List globalArrayNodeList = m_globalArrayNodes.NodesList; + int globalArrayCount = globalArrayNodeList.Count; + for( int i = 0; i < globalArrayCount; i++ ) + { + globalArrayNodeList[ i ].CheckIfAutoRegister( ref dataCollector ); + } + globalArrayNodeList = null; + + //List propertyNodesList = m_propertyNodes.NodesList; + //int propertyCount = propertyNodesList.Count; + //for( int i = 0; i < propertyCount; i++ ) + //{ + // propertyNodesList[ i ].CheckIfAutoRegister( ref dataCollector ); + //} + //propertyNodesList = null; + + //List screenColorNodes = m_screenColorNodes.NodesList; + //int screenColorNodesCount = screenColorNodes.Count; + //for( int i = 0; i < screenColorNodesCount; i++ ) + //{ + // screenColorNodes[ i ].CheckIfAutoRegister( ref dataCollector ); + //} + //screenColorNodes = null; + } + + public void SoftDestroy() + { + OnNodeRemovedEvent = null; + + m_masterNodeId = Constants.INVALID_NODE_ID; + m_validNodeId = 0; + + m_nodeGrid.Destroy(); + //m_nodeGrid = null; + + ClearInternalTemplateNodes(); + + for( int i = 0; i < m_nodes.Count; i++ ) + { + if( m_nodes[ i ] != null ) + { + m_nodes[ i ].Destroy(); + GameObject.DestroyImmediate( m_nodes[ i ] ); + } + } + + m_instancePropertyCount = 0; + + m_nodes.Clear(); + //m_nodes = null; + + m_nodesDict.Clear(); + //m_nodesDict = null; + + m_samplerNodes.Clear(); + //m_samplerNodes = null; + + m_propertyNodes.Clear(); + m_rawPropertyNodes.Clear(); + //m_propertyNodes = null; + + m_customExpressionsOnFunctionMode.Clear(); + + m_staticSwitchNodes.Clear(); + + m_functionInputNodes.Clear(); + //m_functionInputNodes = null; + + m_functionNodes.Clear(); + //m_functionNodes = null; + + m_functionOutputNodes.Clear(); + //m_functionOutputNodes = null; + + m_functionSwitchNodes.Clear(); + //m_functionSwitchNodes = null; + + m_functionSwitchCopyNodes.Clear(); + //m_functionSwitchCopyNodes = null; + + m_texturePropertyNodes.Clear(); + //m_texturePropertyNodes = null; + + m_textureArrayNodes.Clear(); + //m_textureArrayNodes = null; + + m_screenColorNodes.Clear(); + //m_screenColorNodes = null; + + m_localVarNodes.Clear(); + //m_localVarNodes = null; + + m_globalArrayNodes.Clear(); + + m_selectedNodes.Clear(); + //m_selectedNodes = null; + + m_markedForDeletion.Clear(); + //m_markedForDeletion = null; + + m_nodePreviewList.Clear(); + //m_nodePreviewList = null; + + IsDirty = true; + + OnNodeEvent = null; + OnDuplicateEvent = null; + //m_currentShaderFunction = null; + + OnMaterialUpdatedEvent = null; + OnShaderUpdatedEvent = null; + OnEmptyGraphDetectedEvt = null; + + nodeStyleOff = null; + nodeStyleOn = null; + nodeTitle = null; + commentaryBackground = null; + OnLODMasterNodesAddedEvent = null; + } + + + + + public void Destroy() + { + UndoUtils.UnregisterUndoRedoCallback( OnUndoRedoCallback ); + for( int i = 0; i < m_nodes.Count; i++ ) + { + if( m_nodes[ i ] != null ) + { + UndoUtils.ClearUndo( m_nodes[ i ] ); + m_nodes[ i ].Destroy(); + GameObject.DestroyImmediate( m_nodes[ i ] ); + } + } + + //Must be before m_propertyNodes.Destroy(); + ClearInternalTemplateNodes(); + m_internalTemplateNodesDict = null; + m_internalTemplateNodesList = null; + + OnNodeRemovedEvent = null; + + m_masterNodeId = Constants.INVALID_NODE_ID; + m_validNodeId = 0; + m_instancePropertyCount = 0; + + m_nodeGrid.Destroy(); + m_nodeGrid = null; + + m_nodes.Clear(); + m_nodes = null; + + m_samplerNodes.Destroy(); + m_samplerNodes = null; + + m_propertyNodes.Destroy(); + m_propertyNodes = null; + + m_rawPropertyNodes.Destroy(); + m_rawPropertyNodes = null; + + m_customExpressionsOnFunctionMode.Destroy(); + m_customExpressionsOnFunctionMode = null; + + m_staticSwitchNodes.Destroy(); + m_staticSwitchNodes = null; + + m_functionInputNodes.Destroy(); + m_functionInputNodes = null; + + m_functionNodes.Destroy(); + m_functionNodes = null; + + m_functionOutputNodes.Destroy(); + m_functionOutputNodes = null; + + m_functionSwitchNodes.Destroy(); + m_functionSwitchNodes = null; + + m_functionSwitchCopyNodes.Destroy(); + m_functionSwitchCopyNodes = null; + + m_multiPassMasterNodes.Destroy(); + m_multiPassMasterNodes = null; + + for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) + { + m_lodMultiPassMasterNodes[ i ].Destroy(); + m_lodMultiPassMasterNodes[ i ] = null; + } + m_lodMultiPassMasterNodes.Clear(); + m_lodMultiPassMasterNodes = null; + + m_texturePropertyNodes.Destroy(); + m_texturePropertyNodes = null; + + m_textureArrayNodes.Destroy(); + m_textureArrayNodes = null; + + m_screenColorNodes.Destroy(); + m_screenColorNodes = null; + + m_localVarNodes.Destroy(); + m_localVarNodes = null; + + m_globalArrayNodes.Destroy(); + m_globalArrayNodes = null; + + m_selectedNodes.Clear(); + m_selectedNodes = null; + + m_markedForDeletion.Clear(); + m_markedForDeletion = null; + + + m_nodesDict.Clear(); + m_nodesDict = null; + + m_nodePreviewList.Clear(); + m_nodePreviewList = null; + + IsDirty = true; + + OnNodeEvent = null; + OnDuplicateEvent = null; + //m_currentShaderFunction = null; + + OnMaterialUpdatedEvent = null; + OnShaderUpdatedEvent = null; + OnEmptyGraphDetectedEvt = null; + + nodeStyleOff = null; + nodeStyleOn = null; + nodeTitle = null; + commentaryBackground = null; + + OnLODMasterNodesAddedEvent = null; + } + + void OnNodeChangeSizeEvent( ParentNode node ) + { + m_nodeGrid.RemoveNodeFromGrid( node, true ); + m_nodeGrid.AddNodeToGrid( node ); + } + + public void OnNodeFinishMoving( ParentNode node, bool testOnlySelected, InteractionMode interactionMode ) + { + if( OnNodeEvent != null ) + { + OnNodeEvent( node ); + SaveIsDirty = true; + } + + m_nodeGrid.RemoveNodeFromGrid( node, true ); + m_nodeGrid.AddNodeToGrid( node ); + + //if( testOnlySelected ) + //{ + // for( int i = m_visibleNodes.Count - 1; i > -1; i-- ) + // { + // if( node.UniqueId != m_visibleNodes[ i ].UniqueId ) + // { + // switch( interactionMode ) + // { + // case InteractionMode.Target: + // { + // node.OnNodeInteraction( m_visibleNodes[ i ] ); + // } + // break; + // case InteractionMode.Other: + // { + // m_visibleNodes[ i ].OnNodeInteraction( node ); + // } + // break; + // case InteractionMode.Both: + // { + // node.OnNodeInteraction( m_visibleNodes[ i ] ); + // m_visibleNodes[ i ].OnNodeInteraction( node ); + // } + // break; + // } + // } + // } + //} + //else + { + for( int i = m_nodes.Count - 1; i > -1; i-- ) + { + if( node.UniqueId != m_nodes[ i ].UniqueId ) + { + switch( interactionMode ) + { + case InteractionMode.Target: + { + node.OnNodeInteraction( m_nodes[ i ] ); + } + break; + case InteractionMode.Other: + { + m_nodes[ i ].OnNodeInteraction( node ); + } + break; + case InteractionMode.Both: + { + node.OnNodeInteraction( m_nodes[ i ] ); + m_nodes[ i ].OnNodeInteraction( node ); + } + break; + } + } + } + } + } + + + public void OnNodeReOrderEvent( ParentNode node, int index ) + { + if( node.Depth < index ) + { + Debug.LogWarning( "Reorder canceled: This is a specific method for when reordering needs to be done and a its original index is higher than the new one" ); + } + else + { + m_nodes.Remove( node ); + m_nodes.Insert( index, node ); + m_markToReOrder = true; + } + } + + public void AddNode( ParentNode node, bool updateId = false, bool addLast = true, bool registerUndo = true, bool fetchMaterialValues = true ) + { + if( registerUndo ) + { + UIUtils.MarkUndoAction(); + UndoUtils.RegisterCompleteObjectUndo( ParentWindow, Constants.UndoCreateNodeId ); + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoCreateNodeId ); + UndoUtils.RegisterCreatedObjectUndo( node, Constants.UndoCreateNodeId ); + } + + if( OnNodeEvent != null ) + { + OnNodeEvent( node ); + } + if( updateId ) + { + node.UniqueId = GetValidId(); + } + else + { + UpdateIdFromNode( node ); + } + + + + if( addLast ) + { + m_nodes.Add( node ); + node.Depth = m_nodes.Count; + } + else + { + m_nodes.Insert( 0, node ); + node.Depth = 0; + } + + if( m_nodesDict.ContainsKey( node.UniqueId ) ) + { + //m_nodesDict[ node.UniqueId ] = node; + m_foundDuplicates = true; + } + else + { + m_nodesDict.Add( node.UniqueId, node ); + node.SetMaterialMode( CurrentMaterial, fetchMaterialValues ); + } + + m_nodeGrid.AddNodeToGrid( node ); + node.OnNodeChangeSizeEvent += OnNodeChangeSizeEvent; + node.OnNodeReOrderEvent += OnNodeReOrderEvent; + IsDirty = true; + } + + public void CheckForDuplicates() + { + if( m_foundDuplicates ) + { + Debug.LogWarning( "Found duplicates:" ); + m_foundDuplicates = false; + m_nodesDict.Clear(); + int count = m_nodes.Count; + for( int i = 0; i < count; i++ ) + { + if( m_nodesDict.ContainsKey( m_nodes[ i ].UniqueId ) ) + { + m_nodes[ i ].UniqueId = GetValidId(); + m_nodesDict.Add( m_nodes[ i ].UniqueId, m_nodes[ i ] ); + Debug.LogWarning( "Assigning new ID to " + m_nodes[ i ].TypeName ); + } + else + { + m_nodesDict.Add( m_nodes[ i ].UniqueId, m_nodes[ i ] ); + } + } + } + } + + public ParentNode GetClickedNode() + { + if( m_nodeClicked < 0 ) + return null; + return GetNode( m_nodeClicked ); + } + + public PropertyNode GetInternalTemplateNode( int nodeId ) + { + if( m_internalTemplateNodesDict.Count != m_internalTemplateNodesList.Count ) + { + m_internalTemplateNodesDict.Clear(); + int count = m_internalTemplateNodesList.Count; + for( int i = 0; i < m_internalTemplateNodesList.Count; i++ ) + { + if( m_internalTemplateNodesList[ i ] != null ) + m_internalTemplateNodesDict.Add( m_internalTemplateNodesList[ i ].UniqueId, m_internalTemplateNodesList[ i ] ); + } + } + + if( m_internalTemplateNodesDict.ContainsKey( nodeId ) ) + return m_internalTemplateNodesDict[ nodeId ]; + + return null; + } + + public PropertyNode GetInternalTemplateNode( string propertyName ) + { + return m_internalTemplateNodesList.Find( ( x ) => x.PropertyName.Equals( propertyName ) ); + } + + public void AddInternalTemplateNode( TemplateShaderPropertyData data ) + { + PropertyNode propertyNode = null; + switch( data.PropertyDataType ) + { + case WirePortDataType.FLOAT: + propertyNode = CreateInstance(); break; + case WirePortDataType.FLOAT4: + propertyNode = CreateInstance(); + break; + case WirePortDataType.COLOR: + propertyNode = CreateInstance(); + break; + case WirePortDataType.INT: + propertyNode = CreateInstance(); break; + case WirePortDataType.SAMPLER1D: + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.SAMPLER2DARRAY: + propertyNode = CreateInstance(); + break; + default: return; + } + + propertyNode.PropertyNameFromTemplate( data ); + + // Create a negative unique Id to separate it from + // the regular ids on the main nodes list + // Its begins at -2 since -1 is used to detect invalid values + int uniqueId = -( m_internalTemplateNodesList.Count + 2 ); + propertyNode.SetBaseUniqueId( uniqueId ); + + //Register into Float/Int Nodes list to be available inline + // Unique Id must be already set at this point to properly + // create array + if( data.PropertyDataType == WirePortDataType.FLOAT || + data.PropertyDataType == WirePortDataType.INT ) + m_floatNodes.AddNode( propertyNode ); + + m_internalTemplateNodesList.Add( propertyNode ); + m_internalTemplateNodesDict.Add( uniqueId, propertyNode ); + } + + public void ClearInternalTemplateNodes() + { + if( m_internalTemplateNodesList != null ) + { + int count = m_internalTemplateNodesList.Count; + for( int i = 0; i < count; i++ ) + { + m_internalTemplateNodesList[ i ].Destroy(); + GameObject.DestroyImmediate( m_internalTemplateNodesList[ i ] ); + } + + m_internalTemplateNodesList.Clear(); + m_internalTemplateNodesDict.Clear(); + } + } + + public ParentNode GetNode( int nodeId ) + { + if( m_nodesDict.Count != m_nodes.Count ) + { + m_nodesDict.Clear(); + int count = m_nodes.Count; + for( int i = 0; i < count; i++ ) + { + if( m_nodes[ i ] != null && !m_nodesDict.ContainsKey( m_nodes[ i ].UniqueId ) ) + m_nodesDict.Add( m_nodes[ i ].UniqueId, m_nodes[ i ] ); + } + } + + if( m_nodesDict.ContainsKey( nodeId ) ) + return m_nodesDict[ nodeId ]; + + return null; + } + + public void ForceReOrder() + { + // @diogo: replaced Sort() with OrderBy() for stable sorting + m_nodes = m_nodes.OrderBy( s => s.Depth ).ToList(); + } + + public bool Draw( DrawInfo drawInfo ) + { + MasterNode masterNode = GetNode( m_masterNodeId ) as MasterNode; + if( m_forceCategoryRefresh && masterNode != null ) + { + masterNode.RefreshAvailableCategories(); + m_forceCategoryRefresh = false; + } + + SaveIsDirty = false; + if( m_afterDeserializeFlag ) + { + // this is now done after logic update... templates needs it this way + //m_afterDeserializeFlag = false; + + CleanCorruptedNodes(); + if( m_nodes.Count == 0 ) + { + //TODO: remove this temp from here + NodeAvailability cachedCanvas = CurrentCanvasMode; + ParentWindow.CreateNewGraph( "Empty" ); + CurrentCanvasMode = cachedCanvas; + if( OnEmptyGraphDetectedEvt != null ) + { + OnEmptyGraphDetectedEvt( this ); + SaveIsDirty = false; + } + else + { + SaveIsDirty = true; + } + } + + //for( int i = 0; i < m_nodes.Count; i++ ) + //{ + // m_nodes[ i ].SetContainerGraph( this ); + //} + } + + if( drawInfo.CurrentEventType == EventType.Repaint ) + { + if( m_markedToDeSelect ) + DeSelectAll(); + + if( m_markToSelect > -1 ) + { + AddToSelectedNodes( GetNode( m_markToSelect ) ); + m_markToSelect = -1; + } + + if( m_markToReOrder ) + { + m_markToReOrder = false; + int nodesCount = m_nodes.Count; + for( int i = 0; i < nodesCount; i++ ) + { + m_nodes[ i ].Depth = i; + } + } + } + + if( drawInfo.CurrentEventType == EventType.Repaint ) + { + // Resizing Nods per LOD level + NodeLOD newLevel = NodeLOD.LOD0; + float referenceValue; + if( drawInfo.InvertedZoom > 0.5f ) + { + newLevel = NodeLOD.LOD0; + referenceValue = 4; + } + else if( drawInfo.InvertedZoom > 0.25f ) + { + newLevel = NodeLOD.LOD1; + referenceValue = 2; + } + else if( drawInfo.InvertedZoom > 0.15f ) + { + newLevel = NodeLOD.LOD2; + referenceValue = 1; + } + else if( drawInfo.InvertedZoom > 0.1f ) + { + newLevel = NodeLOD.LOD3; + referenceValue = 0; + } + else if( drawInfo.InvertedZoom > 0.07f ) + { + newLevel = NodeLOD.LOD4; + referenceValue = 0; + } + else + { + newLevel = NodeLOD.LOD5; + referenceValue = 0; + } + + // Just a sanity check + nodeStyleOff = UIUtils.GetCustomStyle( CustomStyle.NodeWindowOff ); + nodeStyleOn = UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn );//= UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ); + nodeTitle = UIUtils.GetCustomStyle( CustomStyle.NodeHeader ); + commentaryBackground = UIUtils.GetCustomStyle( CustomStyle.CommentaryBackground ); + + if( newLevel != m_lodLevel || ( UIUtils.MainSkin != null && UIUtils.MainSkin.textField.border.left != referenceValue ) ) + { + m_lodLevel = newLevel; + switch( m_lodLevel ) + { + default: + case NodeLOD.LOD0: + { + UIUtils.MainSkin.textField.border = UIUtils.RectOffsetFour; + nodeStyleOff.border = UIUtils.RectOffsetSix; + UIUtils.NodeWindowOffSquare.border = UIUtils.RectOffsetFour; + + nodeStyleOn.border = UIUtils.RectOffsetSix; + UIUtils.NodeWindowOnSquare.border = UIUtils.RectOffsetSix; + + nodeTitle.border.left = 6; + nodeTitle.border.right = 6; + nodeTitle.border.top = 6; + nodeTitle.border.bottom = 4; + + UIUtils.NodeHeaderSquare.border = UIUtils.RectOffsetFour; + commentaryBackground.border = UIUtils.RectOffsetSix; + } + break; + case NodeLOD.LOD1: + { + UIUtils.MainSkin.textField.border = UIUtils.RectOffsetTwo; + nodeStyleOff.border = UIUtils.RectOffsetFive; + UIUtils.NodeWindowOffSquare.border = UIUtils.RectOffsetFive; + + nodeStyleOn.border = UIUtils.RectOffsetFive; + UIUtils.NodeWindowOnSquare.border = UIUtils.RectOffsetFour; + + nodeTitle.border.left = 5; + nodeTitle.border.right = 5; + nodeTitle.border.top = 5; + nodeTitle.border.bottom = 2; + + UIUtils.NodeHeaderSquare.border = UIUtils.RectOffsetThree; + commentaryBackground.border = UIUtils.RectOffsetFive; + } + break; + case NodeLOD.LOD2: + { + UIUtils.MainSkin.textField.border = UIUtils.RectOffsetOne; + + nodeStyleOff.border.left = 2; + nodeStyleOff.border.right = 2; + nodeStyleOff.border.top = 2; + nodeStyleOff.border.bottom = 3; + + UIUtils.NodeWindowOffSquare.border = UIUtils.RectOffsetThree; + + nodeStyleOn.border.left = 4; + nodeStyleOn.border.right = 4; + nodeStyleOn.border.top = 4; + nodeStyleOn.border.bottom = 3; + + UIUtils.NodeWindowOnSquare.border = UIUtils.RectOffsetThree; + + nodeTitle.border = UIUtils.RectOffsetTwo; + UIUtils.NodeHeaderSquare.border = UIUtils.RectOffsetTwo; + + commentaryBackground.border.left = 2; + commentaryBackground.border.right = 2; + commentaryBackground.border.top = 2; + commentaryBackground.border.bottom = 3; + } + break; + case NodeLOD.LOD3: + case NodeLOD.LOD4: + case NodeLOD.LOD5: + { + UIUtils.MainSkin.textField.border = UIUtils.RectOffsetZero; + + nodeStyleOff.border.left = 1; + nodeStyleOff.border.right = 1; + nodeStyleOff.border.top = 1; + nodeStyleOff.border.bottom = 2; + + UIUtils.NodeWindowOffSquare.border = UIUtils.RectOffsetTwo; + + nodeStyleOn.border = UIUtils.RectOffsetTwo; + UIUtils.NodeWindowOnSquare.border = UIUtils.RectOffsetTwo; + + nodeTitle.border = UIUtils.RectOffsetOne; + UIUtils.NodeHeaderSquare.border = UIUtils.RectOffsetOne; + + commentaryBackground.border.left = 1; + commentaryBackground.border.right = 1; + commentaryBackground.border.top = 1; + commentaryBackground.border.bottom = 2; + } + break; + } + } + } + + //m_visibleNodes.Clear(); + //int nullCount = 0; + m_hasUnConnectedNodes = false; + bool repaint = false; + Material currentMaterial = masterNode != null ? masterNode.CurrentMaterial : null; + EditorGUI.BeginChangeCheck(); + bool repaintMaterialInspector = false; + + int nodeCount = m_nodes.Count; + for( int i = 0; i < nodeCount; i++ ) + { + m_nodes[ i ].OnNodeLogicUpdate( drawInfo ); + } + + if( m_afterDeserializeFlag || m_lateOptionsRefresh ) + { + m_afterDeserializeFlag = false; + m_lateOptionsRefresh = false; + if( CurrentCanvasMode == NodeAvailability.TemplateShader ) + { + RefreshLinkedMasterNodes( true ); + OnRefreshLinkedPortsComplete(); + //If clipboard has cached nodes then a master node replacement will take place + //We need to re-cache master nodes to ensure applied options are correctly cached + //As first cache happens before that + if( m_parentWindow.ClipboardInstance.HasCachedMasterNodes ) + { + m_parentWindow.ClipboardInstance.AddMultiPassNodesToClipboard( MultiPassMasterNodes.NodesList,true,-1 ); + for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) + { + if( m_lodMultiPassMasterNodes[ i ].Count > 0 ) + m_parentWindow.ClipboardInstance.AddMultiPassNodesToClipboard( m_lodMultiPassMasterNodes[ i ].NodesList, false, i ); + } + } + //RepositionTemplateNodes( CurrentMasterNode ); + } + } + + if( m_forceRepositionCheck ) + { + RepositionTemplateNodes( CurrentMasterNode ); + } + + //for( int i = 0; i < m_functionNodes.NodesList.Count; i++ ) + //{ + // m_functionNodes.NodesList[ i ].LogicGraph(); + //} + + //for( int i = 0; i < UIUtils.FunctionSwitchCopyList().Count; i++ ) + //{ + // UIUtils.FunctionSwitchCopyList()[ i ].CheckReference(); + //} + + + + // Dont use nodeCount variable because node count can change in this loop??? + nodeCount = m_nodes.Count; + ParentNode node = null; + for( int i = 0; i < nodeCount; i++ ) + { + node = m_nodes[ i ]; + if( !node.IsOnGrid ) + { + m_nodeGrid.AddNodeToGrid( node ); + } + + node.MovingInFrame = false; + + if( drawInfo.CurrentEventType == EventType.Repaint ) + node.OnNodeLayout( drawInfo ); + + m_hasUnConnectedNodes = m_hasUnConnectedNodes || + ( node.ConnStatus != NodeConnectionStatus.Connected && node.ConnStatus != NodeConnectionStatus.Island ); + + if( node.RequireMaterialUpdate && currentMaterial != null ) + { + node.UpdateMaterial( currentMaterial ); + repaintMaterialInspector = true; + } + + //if( node.IsVisible ) + // m_visibleNodes.Add( node ); + + IsDirty = ( m_isDirty || node.IsDirty ); + SaveIsDirty = ( m_saveIsDirty || node.SaveIsDirty ); + } + + // Handles GUI controls + nodeCount = m_nodes.Count; + for( int i = nodeCount - 1; i >= 0; i-- ) + //for ( int i = 0; i < nodeCount; i++ ) + { + node = m_nodes[ i ]; + bool restoreMouse = false; + if( drawInfo.CurrentEventType == EventType.MouseDown && m_nodeClicked > -1 && node.UniqueId != m_nodeClicked ) + { + restoreMouse = true; + drawInfo.CurrentEventType = EventType.Ignore; + } + + node.DrawGUIControls( drawInfo ); + + if( restoreMouse ) + { + drawInfo.CurrentEventType = EventType.MouseDown; + } + } + + // Draw connection wires + if( drawInfo.CurrentEventType == EventType.Repaint ) + DrawWires( ParentWindow.WireTexture, drawInfo, ParentWindow.WindowContextPallete.IsActive, ParentWindow.WindowContextPallete.CurrentPosition ); + + // Master Draw + nodeCount = m_nodes.Count; + for( int i = 0; i < nodeCount; i++ ) + { + node = m_nodes[ i ]; + bool restoreMouse = false; + if( drawInfo.CurrentEventType == EventType.MouseDown && m_nodeClicked > -1 && node.UniqueId != m_nodeClicked ) + { + restoreMouse = true; + drawInfo.CurrentEventType = EventType.Ignore; + } + + node.Draw( drawInfo ); + + if( restoreMouse ) + { + drawInfo.CurrentEventType = EventType.MouseDown; + } + } + + // Draw Tooltip + if( drawInfo.CurrentEventType == EventType.Repaint || drawInfo.CurrentEventType == EventType.MouseDown ) + { + nodeCount = m_nodes.Count; + for( int i = nodeCount - 1; i >= 0; i-- ) + { + node = m_nodes[ i ]; + if( node.IsVisible && !node.IsMoving ) + { + bool showing = node.ShowTooltip( drawInfo ); + if( showing ) + break; + } + } + } + + if( repaintMaterialInspector ) + { + if( MaterialInspector.Instance != null ) + { + MaterialInspector.Instance.Repaint(); + } + } + + if( m_checkSelectedWireHighlights ) + { + m_checkSelectedWireHighlights = false; + ResetHighlightedWires(); + for( int i = 0; i < m_selectedNodes.Count; i++ ) + { + HighlightWiresStartingNode( m_selectedNodes[ i ] ); + } + } + + if( EditorGUI.EndChangeCheck() ) + { + SaveIsDirty = true; + repaint = true; + } + + if( drawInfo.CurrentEventType == EventType.Repaint ) + { + // Revert LOD changes to LOD0 (only if it's different) + if( UIUtils.MainSkin.textField.border.left != 4 ) + { + UIUtils.MainSkin.textField.border = UIUtils.RectOffsetFour; + nodeStyleOff.border = UIUtils.RectOffsetSix; + UIUtils.NodeWindowOffSquare.border = UIUtils.RectOffsetFour; + + nodeStyleOn.border = UIUtils.RectOffsetSix; + UIUtils.NodeWindowOnSquare.border = UIUtils.RectOffsetSix; + + nodeTitle.border.left = 6; + nodeTitle.border.right = 6; + nodeTitle.border.top = 6; + nodeTitle.border.bottom = 4; + + UIUtils.NodeHeaderSquare.border = UIUtils.RectOffsetFour; + commentaryBackground.border = UIUtils.RectOffsetSix; + } + } + + //if ( nullCount == m_nodes.Count ) + // m_nodes.Clear(); + + ChangedLightingModel = false; + + return repaint; + } + + public bool UpdateMarkForDeletion() + { + if( m_markedForDeletion.Count != 0 ) + { + DeleteMarkedForDeletionNodes(); + return true; + } + return false; + } + + public void DrawWires( Texture2D wireTex, DrawInfo drawInfo, bool contextPaletteActive, Vector3 contextPalettePos ) + { + //Handles.BeginGUI(); + //Debug.Log(GUI.depth); + // Draw connected node wires + m_wireBezierCount = 0; + for( int nodeIdx = 0; nodeIdx < m_nodes.Count; nodeIdx++ ) + { + ParentNode node = m_nodes[ nodeIdx ]; + if( (object)node == null ) + return; + + for( int inputPortIdx = 0; inputPortIdx < node.InputPorts.Count; inputPortIdx++ ) + { + InputPort inputPort = node.InputPorts[ inputPortIdx ]; + if( inputPort.ExternalReferences.Count > 0 && inputPort.Visible ) + { + bool cleanInvalidConnections = false; + for( int wireIdx = 0; wireIdx < inputPort.ExternalReferences.Count; wireIdx++ ) + { + WireReference reference = inputPort.ExternalReferences[ wireIdx ]; + if( reference.NodeId != -1 && reference.PortId != -1 ) + { + ParentNode outputNode = GetNode( reference.NodeId ); + if( outputNode != null ) + { + OutputPort outputPort = outputNode.GetOutputPortByUniqueId( reference.PortId ); + Vector3 endPos = new Vector3( inputPort.Position.x, inputPort.Position.y ); + Vector3 startPos = new Vector3( outputPort.Position.x, outputPort.Position.y ); + float x = ( startPos.x < endPos.x ) ? startPos.x : endPos.x; + float y = ( startPos.y < endPos.y ) ? startPos.y : endPos.y; + float width = Mathf.Abs( startPos.x - endPos.x ) + outputPort.Position.width; + float height = Mathf.Abs( startPos.y - endPos.y ) + outputPort.Position.height; + Rect portsBoundingBox = new Rect( x, y, width, height ); + + bool isVisible = node.IsVisible || outputNode.IsVisible; + if( !isVisible ) + { + isVisible = drawInfo.TransformedCameraArea.Overlaps( portsBoundingBox ); + } + + if( isVisible ) + { + + Rect bezierBB = DrawBezier( drawInfo.InvertedZoom, startPos, endPos, inputPort.DataType, outputPort.DataType, node.GetInputPortVisualDataTypeByArrayIdx( inputPortIdx ), outputNode.GetOutputPortVisualDataTypeById( reference.PortId ), reference.WireStatus, wireTex, node, outputNode ); + bezierBB.x -= Constants.OUTSIDE_WIRE_MARGIN; + bezierBB.y -= Constants.OUTSIDE_WIRE_MARGIN; + + bezierBB.width += Constants.OUTSIDE_WIRE_MARGIN * 2; + bezierBB.height += Constants.OUTSIDE_WIRE_MARGIN * 2; + + if( m_wireBezierCount < m_bezierReferences.Count ) + { + m_bezierReferences[ m_wireBezierCount ].UpdateInfo( ref bezierBB, inputPort.NodeId, inputPort.PortId, outputPort.NodeId, outputPort.PortId ); + } + else + { + m_bezierReferences.Add( new WireBezierReference( ref bezierBB, inputPort.NodeId, inputPort.PortId, outputPort.NodeId, outputPort.PortId ) ); + } + m_wireBezierCount++; + + } + } + else + { + if( DebugConsoleWindow.DeveloperMode ) + UIUtils.ShowMessage( "Detected Invalid connection from node " + node.UniqueId + " port " + inputPortIdx + " to Node " + reference.NodeId + " port " + reference.PortId, MessageSeverity.Error ); + cleanInvalidConnections = true; + inputPort.ExternalReferences[ wireIdx ].Invalidate(); + } + } + } + + if( cleanInvalidConnections ) + { + inputPort.RemoveInvalidConnections(); + } + } + } + } + + //Draw selected wire + if( m_parentWindow.WireReferenceUtils.ValidReferences() ) + { + if( m_parentWindow.WireReferenceUtils.InputPortReference.IsValid ) + { + InputPort inputPort = GetNode( m_parentWindow.WireReferenceUtils.InputPortReference.NodeId ).GetInputPortByUniqueId( m_parentWindow.WireReferenceUtils.InputPortReference.PortId ); + Vector3 endPos = Vector3.zero; + if( m_parentWindow.WireReferenceUtils.SnapEnabled ) + { + Vector2 pos = ( m_parentWindow.WireReferenceUtils.SnapPosition + drawInfo.CameraOffset ) * drawInfo.InvertedZoom; + endPos = new Vector3( pos.x, pos.y ) + UIUtils.ScaledPortsDelta; + } + else + { + endPos = contextPaletteActive ? contextPalettePos : new Vector3( Event.current.mousePosition.x, Event.current.mousePosition.y ); + } + + Vector3 startPos = new Vector3( inputPort.Position.x, inputPort.Position.y ); + DrawBezier( drawInfo.InvertedZoom, endPos, startPos, inputPort.DataType, inputPort.DataType, inputPort.DataType, inputPort.DataType, WireStatus.Default, wireTex ); + } + + if( m_parentWindow.WireReferenceUtils.OutputPortReference.IsValid ) + { + OutputPort outputPort = GetNode( m_parentWindow.WireReferenceUtils.OutputPortReference.NodeId ).GetOutputPortByUniqueId( m_parentWindow.WireReferenceUtils.OutputPortReference.PortId ); + Vector3 endPos = Vector3.zero; + if( m_parentWindow.WireReferenceUtils.SnapEnabled ) + { + Vector2 pos = ( m_parentWindow.WireReferenceUtils.SnapPosition + drawInfo.CameraOffset ) * drawInfo.InvertedZoom; + endPos = new Vector3( pos.x, pos.y ) + UIUtils.ScaledPortsDelta; + } + else + { + endPos = contextPaletteActive ? contextPalettePos : new Vector3( Event.current.mousePosition.x, Event.current.mousePosition.y ); + } + Vector3 startPos = new Vector3( outputPort.Position.x, outputPort.Position.y ); + DrawBezier( drawInfo.InvertedZoom, startPos, endPos, outputPort.DataType, outputPort.DataType, outputPort.DataType, outputPort.DataType, WireStatus.Default, wireTex ); + } + } + //Handles.EndGUI(); + } + + Rect DrawBezier( float invertedZoom, Vector3 startPos, Vector3 endPos, WirePortDataType inputDataType, WirePortDataType outputDataType, WirePortDataType inputVisualDataType, WirePortDataType outputVisualDataType, WireStatus wireStatus, Texture2D wireTex, ParentNode inputNode = null, ParentNode outputNode = null ) + { + startPos += UIUtils.ScaledPortsDelta; + endPos += UIUtils.ScaledPortsDelta; + + // Calculate the 4 points for bezier taking into account wire nodes and their automatic tangents + float mag = ( endPos - startPos ).magnitude; + float resizedMag = Mathf.Min( mag * 0.66f, Constants.HORIZONTAL_TANGENT_SIZE * invertedZoom ); + + Vector3 startTangent = new Vector3( startPos.x + resizedMag, startPos.y ); + Vector3 endTangent = new Vector3( endPos.x - resizedMag, endPos.y ); + + if( (object)inputNode != null && inputNode.GetType() == typeof( WireNode ) ) + endTangent = endPos + ( ( inputNode as WireNode ).TangentDirection ) * mag * 0.33f; + + if( (object)outputNode != null && outputNode.GetType() == typeof( WireNode ) ) + startTangent = startPos - ( ( outputNode as WireNode ).TangentDirection ) * mag * 0.33f; + + ///////////////Draw tangents + //Rect box1 = new Rect( new Vector2( startTangent.x, startTangent.y ), new Vector2( 10, 10 ) ); + //box1.x -= box1.width * 0.5f; + //box1.y -= box1.height * 0.5f; + //GUI.Label( box1, string.Empty, UIUtils.Box ); + + //Rect box2 = new Rect( new Vector2( endTangent.x, endTangent.y ), new Vector2( 10, 10 ) ); + //box2.x -= box2.width * 0.5f; + //box2.y -= box2.height * 0.5f; + //GUI.Label( box2, string.Empty, UIUtils.Box ); + + //m_auxRect.Set( 0, 0, UIUtils.CurrentWindow.position.width, UIUtils.CurrentWindow.position.height ); + //GLDraw.BeginGroup( m_auxRect ); + + int ty = 1; + float wireThickness = 0; + + + if( ParentWindow.Options.MultiLinePorts ) + { + GLDraw.MultiLine = true; + Shader.SetGlobalFloat( "_InvertedZoom", invertedZoom ); + + WirePortDataType smallest = ( (int)outputDataType < (int)inputDataType ? outputDataType : inputDataType ); + smallest = ( (int)smallest < (int)outputVisualDataType ? smallest : outputVisualDataType ); + smallest = ( (int)smallest < (int)inputVisualDataType ? smallest : inputVisualDataType ); + + switch( smallest ) + { + case WirePortDataType.FLOAT2: ty = 2; break; + case WirePortDataType.FLOAT3: ty = 3; break; + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + { + ty = 4; + } + break; + default: ty = 1; break; + } + wireThickness = Mathf.Lerp( Constants.WIRE_WIDTH * ( ty * invertedZoom * -0.05f + 0.15f ), Constants.WIRE_WIDTH * ( ty * invertedZoom * 0.175f + 0.3f ), invertedZoom + 0.4f ); + } + else + { + GLDraw.MultiLine = false; + wireThickness = Mathf.Lerp( Constants.WIRE_WIDTH * ( invertedZoom * -0.05f + 0.15f ), Constants.WIRE_WIDTH * ( invertedZoom * 0.175f + 0.3f ), invertedZoom + 0.4f ); + } + + Rect boundBox = new Rect(); + int segments = 11; + if( LodLevel <= ParentGraph.NodeLOD.LOD4 ) + segments = Mathf.Clamp( Mathf.FloorToInt( mag * 0.2f * invertedZoom ), 11, 35 ); + else + segments = (int)( invertedZoom * 14.28f * 11 ); + + if( ParentWindow.Options.ColoredPorts && wireStatus != WireStatus.Highlighted ) + boundBox = GLDraw.DrawBezier( startPos, startTangent, endPos, endTangent, UIUtils.GetColorForDataType( outputVisualDataType, false, false ), UIUtils.GetColorForDataType( inputVisualDataType, false, false ), wireThickness, segments, ty ); + else + boundBox = GLDraw.DrawBezier( startPos, startTangent, endPos, endTangent, UIUtils.GetColorFromWireStatus( wireStatus ), wireThickness, segments, ty ); + //GLDraw.EndGroup(); + + //GUI.Box( m_auxRect, string.Empty, UIUtils.CurrentWindow.CustomStylesInstance.Box ); + //GUI.Box( boundBox, string.Empty, UIUtils.CurrentWindow.CustomStylesInstance.Box ); + //if ( UIUtils.CurrentWindow.Options.ColoredPorts && wireStatus != WireStatus.Highlighted ) + // Handles.DrawBezier( startPos, endPos, startTangent, endTangent, UIUtils.GetColorForDataType( outputDataType, false, false ), wireTex, wiresTickness ); + //else + // Handles.DrawBezier( startPos, endPos, startTangent, endTangent, UIUtils.GetColorFromWireStatus( wireStatus ), wireTex, wiresTickness ); + + //Handles.DrawLine( startPos, startTangent ); + //Handles.DrawLine( endPos, endTangent ); + + float extraBound = 30 * invertedZoom; + boundBox.xMin -= extraBound; + boundBox.xMax += extraBound; + boundBox.yMin -= extraBound; + boundBox.yMax += extraBound; + + return boundBox; + } + + public void DrawBezierBoundingBox() + { + for( int i = 0; i < m_wireBezierCount; i++ ) + { + m_bezierReferences[ i ].DebugDraw(); + } + } + + public WireBezierReference GetWireBezierInPos( Vector2 position ) + { + for( int i = 0; i < m_wireBezierCount; i++ ) + { + if( m_bezierReferences[ i ].Contains( position ) ) + return m_bezierReferences[ i ]; + } + return null; + } + + + public List GetWireBezierListInPos( Vector2 position ) + { + List list = new List(); + for( int i = 0; i < m_wireBezierCount; i++ ) + { + if( m_bezierReferences[ i ].Contains( position ) ) + list.Add( m_bezierReferences[ i ] ); + } + + return list; + } + + + public void MoveSelectedNodes( Vector2 delta, bool snap = false ) + { + //bool validMovement = delta.magnitude > 0.001f; + //if ( validMovement ) + //{ + // UndoUtils.RegisterCompleteObjectUndo( ParentWindow, Constants.UndoMoveNodesId ); + // for ( int i = 0; i < m_selectedNodes.Count; i++ ) + // { + // if ( !m_selectedNodes[ i ].MovingInFrame ) + // { + // UndoUtils.RecordObject( m_selectedNodes[ i ], Constants.UndoMoveNodesId ); + // m_selectedNodes[ i ].Move( delta, snap ); + // } + // } + // IsDirty = true; + //} + + bool performUndo = delta.magnitude > 0.01f; + if( performUndo ) + { + UndoUtils.RegisterCompleteObjectUndo( ParentWindow, Constants.UndoMoveNodesId ); + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoMoveNodesId ); + } + + for( int i = 0; i < m_selectedNodes.Count; i++ ) + { + if( !m_selectedNodes[ i ].MovingInFrame ) + { + if( performUndo ) + m_selectedNodes[ i ].RecordObject( Constants.UndoMoveNodesId ); + m_selectedNodes[ i ].Move( delta, snap ); + } + } + + IsDirty = true; + } + + public void SetConnection( int InNodeId, int InPortId, int OutNodeId, int OutPortId ) + { + ParentNode inNode = GetNode( InNodeId ); + ParentNode outNode = GetNode( OutNodeId ); + InputPort inputPort = null; + OutputPort outputPort = null; + if( inNode != null && outNode != null ) + { + inputPort = inNode.GetInputPortByUniqueId( InPortId ); + outputPort = outNode.GetOutputPortByUniqueId( OutPortId ); + if( inputPort != null && outputPort != null ) + { + if( inputPort.IsConnectedTo( OutNodeId, OutPortId ) || outputPort.IsConnectedTo( InNodeId, InPortId ) ) + { + if( DebugConsoleWindow.DeveloperMode ) + UIUtils.ShowMessage( "Node/Port already connected " + InNodeId, MessageSeverity.Error ); + return; + } + + if( !inputPort.CheckValidType( outputPort.DataType ) ) + { + if( DebugConsoleWindow.DeveloperMode ) + UIUtils.ShowIncompatiblePortMessage( true, inNode, inputPort, outNode, outputPort ); + return; + } + + if( !outputPort.CheckValidType( inputPort.DataType ) ) + { + + if( DebugConsoleWindow.DeveloperMode ) + UIUtils.ShowIncompatiblePortMessage( false, outNode, outputPort, inNode, inputPort ); + return; + } + if( !inputPort.Available || !outputPort.Available ) + { + if( DebugConsoleWindow.DeveloperMode ) + UIUtils.ShowMessage( "Ports not available to connection", MessageSeverity.Warning ); + + return; + } + + if( inputPort.ConnectTo( OutNodeId, OutPortId, outputPort.DataType, false ) ) + { + inNode.OnInputPortConnected( InPortId, OutNodeId, OutPortId ); + } + + + if( outputPort.ConnectTo( InNodeId, InPortId, inputPort.DataType, inputPort.TypeLocked ) ) + { + outNode.OnOutputPortConnected( OutPortId, InNodeId, InPortId ); + } + } + else if( (object)inputPort == null ) + { + if( DebugConsoleWindow.DeveloperMode ) + UIUtils.ShowMessage( "Input Port " + InPortId + " doesn't exist on node " + InNodeId, MessageSeverity.Error ); + } + else + { + if( DebugConsoleWindow.DeveloperMode ) + UIUtils.ShowMessage( "Output Port " + OutPortId + " doesn't exist on node " + OutNodeId, MessageSeverity.Error ); + } + } + else if( (object)inNode == null ) + { + if( DebugConsoleWindow.DeveloperMode ) + UIUtils.ShowMessage( "Input node " + InNodeId + " doesn't exist", MessageSeverity.Error ); + } + else + { + if( DebugConsoleWindow.DeveloperMode ) + UIUtils.ShowMessage( "Output node " + OutNodeId + " doesn't exist", MessageSeverity.Error ); + } + } + + public void CreateConnection( int inNodeId, int inPortId, int outNodeId, int outPortId, bool registerUndo = true ) + { + ParentNode outputNode = GetNode( outNodeId ); + if( outputNode != null ) + { + OutputPort outputPort = outputNode.GetOutputPortByUniqueId( outPortId ); + if( outputPort != null ) + { + ParentNode inputNode = GetNode( inNodeId ); + InputPort inputPort = inputNode.GetInputPortByUniqueId( inPortId ); + + if( !inputPort.CheckValidType( outputPort.DataType ) ) + { + UIUtils.ShowIncompatiblePortMessage( true, inputNode, inputPort, outputNode, outputPort ); + return; + } + + if( !outputPort.CheckValidType( inputPort.DataType ) ) + { + UIUtils.ShowIncompatiblePortMessage( false, outputNode, outputPort, inputNode, inputPort ); + return; + } + + inputPort.DummyAdd( outputPort.NodeId, outputPort.PortId ); + outputPort.DummyAdd( inNodeId, inPortId ); + + if( UIUtils.DetectNodeLoopsFrom( inputNode, new Dictionary() ) ) + { + inputPort.DummyRemove(); + outputPort.DummyRemove(); + m_parentWindow.WireReferenceUtils.InvalidateReferences(); + UIUtils.ShowMessage( "Infinite Loop detected" ); + Event.current.Use(); + return; + } + + inputPort.DummyRemove(); + outputPort.DummyRemove(); + + if( inputPort.IsConnected ) + { + DeleteConnection( true, inNodeId, inPortId, true, false, registerUndo ); + } + + //link output to input + if( outputPort.ConnectTo( inNodeId, inPortId, inputPort.DataType, inputPort.TypeLocked ) ) + outputNode.OnOutputPortConnected( outputPort.PortId, inNodeId, inPortId ); + + //link input to output + if( inputPort.ConnectTo( outputPort.NodeId, outputPort.PortId, outputPort.DataType, inputPort.TypeLocked ) ) + inputNode.OnInputPortConnected( inPortId, outputNode.UniqueId, outputPort.PortId ); + + MarkWireHighlights(); + } + SaveIsDirty = true; + //ParentWindow.ShaderIsModified = true; + } + } + + public void DeleteInvalidConnections() + { + int count = m_nodes.Count; + for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) + { + { + int inputCount = m_nodes[ nodeIdx ].InputPorts.Count; + for( int inputIdx = 0; inputIdx < inputCount; inputIdx++ ) + { + if( !m_nodes[ nodeIdx ].InputPorts[ inputIdx ].Visible && + m_nodes[ nodeIdx ].InputPorts[ inputIdx ].IsConnected && + !m_nodes[ nodeIdx ].InputPorts[ inputIdx ].IsDummy ) + { + DeleteConnection( true, m_nodes[ nodeIdx ].UniqueId, m_nodes[ nodeIdx ].InputPorts[ inputIdx ].PortId, true, true ); + } + } + } + { + int outputCount = m_nodes[ nodeIdx ].OutputPorts.Count; + for( int outputIdx = 0; outputIdx < outputCount; outputIdx++ ) + { + if( !m_nodes[ nodeIdx ].OutputPorts[ outputIdx ].Visible && m_nodes[ nodeIdx ].OutputPorts[ outputIdx ].IsConnected ) + { + DeleteConnection( false, m_nodes[ nodeIdx ].UniqueId, m_nodes[ nodeIdx ].OutputPorts[ outputIdx ].PortId, true, true ); + } + } + } + } + } + + public void DeleteAllConnectionFromNode( int nodeId, bool registerOnLog, bool propagateCallback, bool registerUndo ) + { + ParentNode node = GetNode( nodeId ); + if( (object)node == null ) + return; + DeleteAllConnectionFromNode( node, registerOnLog, propagateCallback, registerUndo ); + } + + public void DeleteAllConnectionFromNode( ParentNode node, bool registerOnLog, bool propagateCallback, bool registerUndo ) + { + + for( int i = 0; i < node.InputPorts.Count; i++ ) + { + if( node.InputPorts[ i ].IsConnected ) + DeleteConnection( true, node.UniqueId, node.InputPorts[ i ].PortId, registerOnLog, propagateCallback, registerUndo ); + } + + for( int i = 0; i < node.OutputPorts.Count; i++ ) + { + if( node.OutputPorts[ i ].IsConnected ) + DeleteConnection( false, node.UniqueId, node.OutputPorts[ i ].PortId, registerOnLog, propagateCallback, registerUndo ); + } + } + + public void DeleteConnection( bool isInput, int nodeId, int portId, bool registerOnLog, bool propagateCallback, bool registerUndo = true ) + { + ParentNode node = GetNode( nodeId ); + if( (object)node == null ) + return; + + if( registerUndo ) + { + UIUtils.MarkUndoAction(); + UndoUtils.RegisterCompleteObjectUndo( ParentWindow, Constants.UndoDeleteConnectionId ); + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoDeleteConnectionId ); + node.RecordObject( Constants.UndoDeleteConnectionId ); + } + + if( isInput ) + { + InputPort inputPort = node.GetInputPortByUniqueId( portId ); + if( inputPort != null && inputPort.IsConnected ) + { + + if( node.ConnStatus == NodeConnectionStatus.Connected ) + { + node.DeactivateInputPortNode( portId, false ); + //inputPort.GetOutputNode().DeactivateNode( portId, false ); + m_checkSelectedWireHighlights = true; + } + + for( int i = 0; i < inputPort.ExternalReferences.Count; i++ ) + { + WireReference inputReference = inputPort.ExternalReferences[ i ]; + ParentNode outputNode = GetNode( inputReference.NodeId ); + if( registerUndo ) + outputNode.RecordObject( Constants.UndoDeleteConnectionId ); + outputNode.GetOutputPortByUniqueId( inputReference.PortId ).InvalidateConnection( inputPort.NodeId, inputPort.PortId ); + if( propagateCallback ) + outputNode.OnOutputPortDisconnected( inputReference.PortId ); + } + inputPort.InvalidateAllConnections(); + if( propagateCallback ) + node.OnInputPortDisconnected( portId ); + } + } + else + { + OutputPort outputPort = node.GetOutputPortByUniqueId( portId ); + if( outputPort != null && outputPort.IsConnected ) + { + if( propagateCallback ) + node.OnOutputPortDisconnected( portId ); + + for( int i = 0; i < outputPort.ExternalReferences.Count; i++ ) + { + WireReference outputReference = outputPort.ExternalReferences[ i ]; + ParentNode inputNode = GetNode( outputReference.NodeId ); + if( registerUndo ) + inputNode.RecordObject( Constants.UndoDeleteConnectionId ); + if( inputNode.ConnStatus == NodeConnectionStatus.Connected ) + { + node.DeactivateNode( portId, false ); + m_checkSelectedWireHighlights = true; + } + inputNode.GetInputPortByUniqueId( outputReference.PortId ).InvalidateConnection( outputPort.NodeId, outputPort.PortId ); + if( propagateCallback ) + { + // Removing WireNodes fires this after the rewiring ( and the OnInputPortConnected callback ) which causes incorrect behaviors + // If is connected is true then we're on that case so we don't fire the OnInputPortDisconnected + if( !inputNode.GetInputPortByUniqueId( outputReference.PortId ).IsConnected ) + inputNode.OnInputPortDisconnected( outputReference.PortId ); + } + } + outputPort.InvalidateAllConnections(); + } + } + IsDirty = true; + SaveIsDirty = true; + } + + //public void DeleteSelectedNodes() + //{ + // bool invalidateMasterNode = false; + // int count = m_selectedNodes.Count; + // for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) + // { + // ParentNode node = m_selectedNodes[ nodeIdx ]; + // if( node.UniqueId == m_masterNodeId ) + // { + // invalidateMasterNode = true; + // } + // else + // { + // DestroyNode( node ); + // } + // } + + // if( invalidateMasterNode ) + // { + // CurrentOutputNode.Selected = false; + // } + // //Clear all references + // m_selectedNodes.Clear(); + // IsDirty = true; + //} + + public void DeleteNodesOnArray( ref ParentNode[] nodeArray ) + { + bool invalidateMasterNode = false; + for( int nodeIdx = 0; nodeIdx < nodeArray.Length; nodeIdx++ ) + { + ParentNode node = nodeArray[ nodeIdx ]; + if( node.UniqueId == m_masterNodeId ) + { + FunctionOutput fout = node as FunctionOutput; + if( fout != null ) + { + for( int i = 0; i < m_nodes.Count; i++ ) + { + FunctionOutput secondfout = m_nodes[ i ] as FunctionOutput; + if( secondfout != null && secondfout != fout ) + { + secondfout.Function = fout.Function; + AssignMasterNode( secondfout, false ); + + DeselectNode( fout ); + DestroyNode( fout ); + break; + } + } + } + invalidateMasterNode = true; + } + else + { + DeselectNode( node ); + DestroyNode( node ); + } + nodeArray[ nodeIdx ] = null; + } + + if( invalidateMasterNode && CurrentMasterNode != null ) + { + CurrentMasterNode.Selected = false; + } + + //Clear all references + nodeArray = null; + IsDirty = true; + } + + public void MarkWireNodeSequence( WireNode node, bool isInput ) + { + if( node == null ) + { + return; + } + + if( m_markedForDeletion.Contains( node ) ) + return; + + m_markedForDeletion.Add( node ); + + if( isInput && node.InputPorts[ 0 ].IsConnected ) + { + MarkWireNodeSequence( GetNode( node.InputPorts[ 0 ].ExternalReferences[ 0 ].NodeId ) as WireNode, isInput ); + } + else if( !isInput && node.OutputPorts[ 0 ].IsConnected ) + { + MarkWireNodeSequence( GetNode( node.OutputPorts[ 0 ].ExternalReferences[ 0 ].NodeId ) as WireNode, isInput ); + } + } + + public void UndoableDeleteSelectedNodes( List nodeList ) + { + if( nodeList.Count == 0 ) + return; + + List validNode = new List(); + + for( int i = 0; i < nodeList.Count; i++ ) + { + if( nodeList[ i ] != null && nodeList[ i ].UniqueId != m_masterNodeId ) + { + validNode.Add( nodeList[ i ] ); + } + } + UIUtils.ClearUndoHelper(); + ParentNode[] selectedNodes = new ParentNode[ validNode.Count ]; + for( int i = 0; i < selectedNodes.Length; i++ ) + { + if( validNode[ i ] != null ) + { + selectedNodes[ i ] = validNode[ i ]; + UIUtils.CheckUndoNode( selectedNodes[ i ] ); + } + } + + //Check nodes connected to deleted nodes to preserve connections on undo + List extraNodes = new List(); + for( int selectedNodeIdx = 0; selectedNodeIdx < selectedNodes.Length; selectedNodeIdx++ ) + { + // Check inputs + if( selectedNodes[ selectedNodeIdx ] != null ) + { + int inputIdxCount = selectedNodes[ selectedNodeIdx ].InputPorts.Count; + if( inputIdxCount > 0 ) + { + for( int inputIdx = 0; inputIdx < inputIdxCount; inputIdx++ ) + { + if( selectedNodes[ selectedNodeIdx ].InputPorts[ inputIdx ].IsConnected ) + { + int nodeIdx = selectedNodes[ selectedNodeIdx ].InputPorts[ inputIdx ].ExternalReferences[ 0 ].NodeId; + if( nodeIdx > -1 ) + { + ParentNode node = GetNode( nodeIdx ); + if( node != null && UIUtils.CheckUndoNode( node ) ) + { + extraNodes.Add( node ); + } + } + } + } + } + } + + // Check outputs + if( selectedNodes[ selectedNodeIdx ] != null ) + { + int outputIdxCount = selectedNodes[ selectedNodeIdx ].OutputPorts.Count; + if( outputIdxCount > 0 ) + { + for( int outputIdx = 0; outputIdx < outputIdxCount; outputIdx++ ) + { + int inputIdxCount = selectedNodes[ selectedNodeIdx ].OutputPorts[ outputIdx ].ExternalReferences.Count; + if( inputIdxCount > 0 ) + { + for( int inputIdx = 0; inputIdx < inputIdxCount; inputIdx++ ) + { + int nodeIdx = selectedNodes[ selectedNodeIdx ].OutputPorts[ outputIdx ].ExternalReferences[ inputIdx ].NodeId; + if( nodeIdx > -1 ) + { + ParentNode node = GetNode( nodeIdx ); + if( UIUtils.CheckUndoNode( node ) ) + { + extraNodes.Add( node ); + } + } + } + } + } + } + + } + } + + UIUtils.ClearUndoHelper(); + //Record deleted nodes + UIUtils.MarkUndoAction(); + UndoUtils.RegisterCompleteObjectUndo( ParentWindow, Constants.UndoDeleteNodeId ); + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoDeleteNodeId ); + UndoUtils.RecordObjects( selectedNodes, Constants.UndoDeleteNodeId ); + UndoUtils.RecordObjects( extraNodes.ToArray(), Constants.UndoDeleteNodeId ); + + //Record deleting connections + for( int i = 0; i < selectedNodes.Length; i++ ) + { + CurrentOutputNode.Selected = false; + selectedNodes[ i ].Alive = false; + DeleteAllConnectionFromNode( selectedNodes[ i ], false, true, true ); + } + //Delete + DeleteNodesOnArray( ref selectedNodes ); + + extraNodes.Clear(); + extraNodes = null; + + EditorUtility.SetDirty( ParentWindow ); + + ParentWindow.ForceRepaint(); + } + + public void DeleteMarkedForDeletionNodes() + { + UndoableDeleteSelectedNodes( m_markedForDeletion ); + m_markedForDeletion.Clear(); + IsDirty = true; + + //bool invalidateMasterNode = false; + //int count = m_markedForDeletion.Count; + //for ( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) + //{ + // ParentNode node = m_markedForDeletion[ nodeIdx ]; + // if ( node.UniqueId == m_masterNodeId ) + // { + // invalidateMasterNode = true; + // } + // else + // { + // if ( node.Selected ) + // { + // m_selectedNodes.Remove( node ); + // node.Selected = false; + // } + // DestroyNode( node ); + // } + //} + + //if ( invalidateMasterNode ) + //{ + // CurrentMasterNode.Selected = false; + //} + ////Clear all references + //m_markedForDeletion.Clear(); + //IsDirty = true; + } + + public void DestroyNode( int nodeId ) + { + ParentNode node = GetNode( nodeId ); + DestroyNode( node ); + } + + public void DestroyNode( ParentNode node, bool registerUndo = true, bool destroyMasterNode = false ) + { + if( node == null ) + { + UIUtils.ShowMessage( "Attempting to destroying a inexistant node ", MessageSeverity.Warning ); + return; + } + + if( node.ConnStatus == NodeConnectionStatus.Connected && !m_checkSelectedWireHighlights ) + { + ResetHighlightedWires(); + m_checkSelectedWireHighlights = true; + } + + //TODO: check better placement of this code (reconnects wires from wire nodes) + //if ( node.GetType() == typeof( WireNode ) ) + //{ + // if ( node.InputPorts[ 0 ].ExternalReferences != null && node.InputPorts[ 0 ].ExternalReferences.Count > 0 ) + // { + // WireReference backPort = node.InputPorts[ 0 ].ExternalReferences[ 0 ]; + // for ( int i = 0; i < node.OutputPorts[ 0 ].ExternalReferences.Count; i++ ) + // { + // UIUtils.CurrentWindow.ConnectInputToOutput( node.OutputPorts[ 0 ].ExternalReferences[ i ].NodeId, node.OutputPorts[ 0 ].ExternalReferences[ i ].PortId, backPort.NodeId, backPort.PortId ); + // } + // } + //} + if( destroyMasterNode || ( node.UniqueId != m_masterNodeId && !( node is TemplateMultiPassMasterNode )/*!m_multiPassMasterNodes.HasNode( node.UniqueId )*/ ) ) + { + m_nodeGrid.RemoveNodeFromGrid( node, false ); + //Send Deactivation signal if active + if( node.ConnStatus == NodeConnectionStatus.Connected ) + { + node.DeactivateNode( -1, true ); + } + + //Invalidate references + //Invalidate input references + for( int inputPortIdx = 0; inputPortIdx < node.InputPorts.Count; inputPortIdx++ ) + { + InputPort inputPort = node.InputPorts[ inputPortIdx ]; + if( inputPort.IsConnected ) + { + for( int wireIdx = 0; wireIdx < inputPort.ExternalReferences.Count; wireIdx++ ) + { + WireReference inputReference = inputPort.ExternalReferences[ wireIdx ]; + ParentNode outputNode = GetNode( inputReference.NodeId ); + outputNode.GetOutputPortByUniqueId( inputReference.PortId ).InvalidateConnection( inputPort.NodeId, inputPort.PortId ); + outputNode.OnOutputPortDisconnected( inputReference.PortId ); + } + inputPort.InvalidateAllConnections(); + } + } + + //Invalidate output reference + for( int outputPortIdx = 0; outputPortIdx < node.OutputPorts.Count; outputPortIdx++ ) + { + OutputPort outputPort = node.OutputPorts[ outputPortIdx ]; + if( outputPort.IsConnected ) + { + for( int wireIdx = 0; wireIdx < outputPort.ExternalReferences.Count; wireIdx++ ) + { + WireReference outputReference = outputPort.ExternalReferences[ wireIdx ]; + ParentNode outnode = GetNode( outputReference.NodeId ); + if( outnode != null ) + { + outnode.GetInputPortByUniqueId( outputReference.PortId ).InvalidateConnection( outputPort.NodeId, outputPort.PortId ); + outnode.OnInputPortDisconnected( outputReference.PortId ); + } + } + outputPort.InvalidateAllConnections(); + } + } + + //Remove node from main list + //UndoUtils.RecordObject( node, "Destroying node " + ( node.Attributes != null? node.Attributes.Name: node.GetType().ToString() ) ); + if( registerUndo ) + { + UIUtils.MarkUndoAction(); + UndoUtils.RegisterCompleteObjectUndo( ParentWindow, Constants.UndoDeleteNodeId ); + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoDeleteNodeId ); + node.RecordObjectOnDestroy( Constants.UndoDeleteNodeId ); + } + + if( OnNodeRemovedEvent != null ) + OnNodeRemovedEvent( node ); + + m_nodes.Remove( node ); + m_nodesDict.Remove( node.UniqueId ); + node.Destroy(); + if ( registerUndo ) + { + UndoUtils.DestroyObjectImmediate( node ); + } + else + { + DestroyImmediate( node ); + } + IsDirty = true; + m_markToReOrder = true; + } + //else if( node.UniqueId == m_masterNodeId && node.GetType() == typeof(FunctionOutput) ) + //{ + // Debug.Log( "Attempting to destroy a output node" ); + // DeselectNode( node ); + // UIUtils.ShowMessage( "Attempting to destroy a output node" ); + //} + else + { + TemplateMultiPassMasterNode templateMasterNode = node as TemplateMultiPassMasterNode; + if( templateMasterNode != null && templateMasterNode.InvalidNode ) + { + DestroyNode( node, false, true ); + return; + } + + DeselectNode( node ); + UIUtils.ShowMessage( "Attempting to destroy a master node" ); + } + } + + void AddToSelectedNodes( ParentNode node ) + { + node.Selected = true; + m_selectedNodes.Add( node ); + node.OnNodeStoppedMovingEvent += OnNodeFinishMoving; + if( node.ConnStatus == NodeConnectionStatus.Connected ) + { + HighlightWiresStartingNode( node ); + } + } + + void RemoveFromSelectedNodes( ParentNode node ) + { + node.Selected = false; + m_selectedNodes.Remove( node ); + node.OnNodeStoppedMovingEvent -= OnNodeFinishMoving; + } + + public void SelectNode( ParentNode node, bool append, bool reorder ) + { + if( node == null ) + return; + + if( append ) + { + if( !m_selectedNodes.Contains( node ) ) + { + AddToSelectedNodes( node ); + } + } + else + { + DeSelectAll(); + AddToSelectedNodes( node ); + } + if( reorder && !node.ReorderLocked ) + { + m_nodes.Remove( node ); + m_nodes.Add( node ); + m_markToReOrder = true; + } + } + + public void MultipleSelection( Rect selectionArea, bool appendSelection = true ) + { + if( !appendSelection ) + { + for( int i = 0; i < m_nodes.Count; i++ ) + { + if( selectionArea.Overlaps( m_nodes[ i ].Position, true ) ) + { + RemoveFromSelectedNodes( m_nodes[ i ] ); + } + } + + m_markedToDeSelect = false; + ResetHighlightedWires(); + } + else + { + for( int i = 0; i < m_nodes.Count; i++ ) + { + if( !m_nodes[ i ].Selected && selectionArea.Overlaps( m_nodes[ i ].Position, true ) ) + { + AddToSelectedNodes( m_nodes[ i ] ); + } + } + } + + // reorder nodes and highlight them + for( int i = 0; i < m_selectedNodes.Count; i++ ) + { + if( !m_selectedNodes[ i ].ReorderLocked ) + { + m_nodes.Remove( m_selectedNodes[ i ] ); + m_nodes.Add( m_selectedNodes[ i ] ); + m_markToReOrder = true; + if( m_selectedNodes[ i ].ConnStatus == NodeConnectionStatus.Connected ) + { + HighlightWiresStartingNode( m_selectedNodes[ i ] ); + } + } + } + } + + public void SelectAll() + { + for( int i = 0; i < m_nodes.Count; i++ ) + { + if( !m_nodes[ i ].Selected ) + AddToSelectedNodes( m_nodes[ i ] ); + } + } + + public void SelectMasterNode() + { + if( m_masterNodeId != Constants.INVALID_NODE_ID ) + { + SelectNode( CurrentMasterNode, false, false ); + } + } + + public void SelectOutputNode() + { + if( m_masterNodeId != Constants.INVALID_NODE_ID ) + { + SelectNode( CurrentOutputNode, false, false ); + } + } + + public void DeselectNode( int nodeId ) + { + ParentNode node = GetNode( nodeId ); + if( node ) + { + m_selectedNodes.Remove( node ); + node.Selected = false; + } + } + + public void DeselectNode( ParentNode node ) + { + m_selectedNodes.Remove( node ); + node.Selected = false; + PropagateHighlightDeselection( node ); + } + + + + public void DeSelectAll() + { + m_markedToDeSelect = false; + for( int i = 0; i < m_selectedNodes.Count; i++ ) + { + m_selectedNodes[ i ].Selected = false; + m_selectedNodes[ i ].OnNodeStoppedMovingEvent -= OnNodeFinishMoving; + } + m_selectedNodes.Clear(); + ResetHighlightedWires(); + } + + public void AssignMasterNode() + { + if( m_selectedNodes.Count == 1 ) + { + OutputNode newOutputNode = m_selectedNodes[ 0 ] as OutputNode; + MasterNode newMasterNode = newOutputNode as MasterNode; + if( newOutputNode != null ) + { + if( m_masterNodeId != Constants.INVALID_NODE_ID && m_masterNodeId != newOutputNode.UniqueId ) + { + OutputNode oldOutputNode = GetNode( m_masterNodeId ) as OutputNode; + MasterNode oldMasterNode = oldOutputNode as MasterNode; + if( oldOutputNode != null ) + { + oldOutputNode.IsMainOutputNode = false; + if( oldMasterNode != null ) + { + oldMasterNode.ClearUpdateEvents(); + } + } + } + m_masterNodeId = newOutputNode.UniqueId; + newOutputNode.IsMainOutputNode = true; + if( newMasterNode != null ) + { + newMasterNode.OnMaterialUpdatedEvent += OnMaterialUpdatedEvent; + newMasterNode.OnShaderUpdatedEvent += OnShaderUpdatedEvent; + } + } + } + + IsDirty = true; + } + + public void AssignMasterNode( OutputNode node, bool onlyUpdateGraphId ) + { + AssignMasterNode( node.UniqueId, onlyUpdateGraphId ); + MasterNode masterNode = node as MasterNode; + if( masterNode != null ) + { + masterNode.OnMaterialUpdatedEvent += OnMaterialUpdatedEvent; + masterNode.OnShaderUpdatedEvent += OnShaderUpdatedEvent; + } + } + + public void AssignMasterNode( int nodeId, bool onlyUpdateGraphId ) + { + if( nodeId < 0 || m_masterNodeId == nodeId ) + return; + + if( m_masterNodeId > Constants.INVALID_NODE_ID ) + { + OutputNode oldOutputNode = ( GetNode( nodeId ) as OutputNode ); + MasterNode oldMasterNode = oldOutputNode as MasterNode; + if( oldOutputNode != null ) + { + oldOutputNode.IsMainOutputNode = false; + if( oldMasterNode != null ) + { + oldMasterNode.ClearUpdateEvents(); + } + } + } + + if( onlyUpdateGraphId ) + { + m_masterNodeId = nodeId; + } + else + { + OutputNode outputNode = ( GetNode( nodeId ) as OutputNode ); + if( outputNode != null ) + { + outputNode.IsMainOutputNode = true; + m_masterNodeId = nodeId; + } + } + + IsDirty = true; + } + + public void RefreshOnUndo() + { + if( m_nodes != null ) + { + int count = m_nodes.Count; + for( int i = 0; i < count; i++ ) + { + if( m_nodes[ i ] != null ) + { + m_nodes[ i ].RefreshOnUndo(); + } + } + } + } + + public void DrawGrid( DrawInfo drawInfo ) + { + m_nodeGrid.DrawGrid( drawInfo ); + } + + public float MaxNodeDist + { + get { return m_nodeGrid.MaxNodeDist; } + } + + public List GetNodesInGrid( Vector2 transformedMousePos ) + { + return m_nodeGrid.GetNodesOn( transformedMousePos ); + } + + public void FireMasterNode( Shader selectedShader ) + { + ( GetNode( m_masterNodeId ) as MasterNode ).Execute( selectedShader ); + } + + public Shader FireMasterNode( string pathname, bool isFullPath ) + { + return ( GetNode( m_masterNodeId ) as MasterNode ).Execute( pathname, isFullPath ); + } + + private void ForceSignalPropagationOnMasterNodeInternal( UsageListTemplateMultiPassMasterNodes masterNodes ) + { + int mpCount = masterNodes.Count; + for( int i = 0; i < mpCount; i++ ) + { + masterNodes.NodesList[ i ].GenerateSignalPropagation(); + } + } + + public void ForceSignalPropagationOnMasterNode() + { + if( m_multiPassMasterNodes.Count > 0 ) + { + ForceSignalPropagationOnMasterNodeInternal( m_multiPassMasterNodes ); + for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) + { + ForceSignalPropagationOnMasterNodeInternal( m_lodMultiPassMasterNodes[ i ] ); + } + } + else if( CurrentOutputNode != null ) + CurrentOutputNode.GenerateSignalPropagation(); + + List allOutputs = m_functionOutputNodes.NodesList; + for( int i = 0; i < allOutputs.Count; i++ ) + { + allOutputs[ i ].GenerateSignalPropagation(); + } + + //List localVarNodes = m_localVarNodes.NodesList; + //int count = localVarNodes.Count; + //for( int i = 0; i < count; i++ ) + //{ + // localVarNodes[ i ].GenerateSignalPropagation(); + //} + } + + public void UpdateShaderOnMasterNode( Shader newShader ) + { + MasterNode mainMasterNode = ( GetNode( m_masterNodeId ) as MasterNode ); + if( mainMasterNode == null ) + { + Debug.LogError( "No Master Node was detected. Aborting update!" ); + return; + } + mainMasterNode.UpdateFromShader( newShader ); + + if( HasLODs ) + { + int passIdx = ( (TemplateMultiPassMasterNode)mainMasterNode ).PassIdx; + for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) + { + if( m_lodMultiPassMasterNodes.Count != 0 && m_lodMultiPassMasterNodes[ i ].NodesList.Count > 0 ) + { + if( m_lodMultiPassMasterNodes[ i ].NodesList[ passIdx ] != null ) + { + m_lodMultiPassMasterNodes[ i ].NodesList[ passIdx ].UpdateFromShader( newShader ); + } + else + { + Debug.LogError( "Null master node detected. Aborting update!" ); + return; + } + } + else break; + } + } + } + + public void CopyValuesFromMaterial( Material material ) + { + Material currMaterial = CurrentMaterial; + if( currMaterial == material ) + { + for( int i = 0; i < m_nodes.Count; i++ ) + { + m_nodes[ i ].ForceUpdateFromMaterial( material ); + } + } + } + + public void UpdateMaterialOnMasterNode( Material material ) + { + MasterNode mainMasterNode = ( GetNode( m_masterNodeId ) as MasterNode ); + mainMasterNode.UpdateMasterNodeMaterial( material ); + if( HasLODs ) + { + int passIdx = ( (TemplateMultiPassMasterNode)mainMasterNode ).PassIdx; + for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) + { + if( m_lodMultiPassMasterNodes.Count != 0 && m_lodMultiPassMasterNodes[ i ].NodesList.Count > 0 ) + { + m_lodMultiPassMasterNodes[ i ].NodesList[ passIdx ].UpdateMasterNodeMaterial( material ); + } + else break; + } + } + } + + public void UpdateMaterialOnPropertyNodes( Material material ) + { + int propertyCount = m_propertyNodes.Count; + for(int i = 0;i< propertyCount;i++ ) + { + m_propertyNodes.NodesList[i].UpdateMaterial( material ); + } + } + + public void SetMaterialModeOnGraph( Material mat, bool fetchMaterialValues = true ) + { + for( int i = 0; i < m_nodes.Count; i++ ) + { + m_nodes[ i ].SetMaterialMode( mat, fetchMaterialValues ); + } + } + + public ParentNode CheckNodeAt( Vector3 pos, bool checkForRMBIgnore = false ) + { + ParentNode selectedNode = null; + + // this is checked on the inverse order to give priority to nodes that are drawn on top ( last on the list ) + for( int i = m_nodes.Count - 1; i > -1; i-- ) + { + if( m_nodes[ i ].Contains( pos ) ) + { + if( checkForRMBIgnore ) + { + if( !m_nodes[ i ].RMBIgnore ) + { + selectedNode = m_nodes[ i ]; + break; + } + } + else + { + selectedNode = m_nodes[ i ]; + break; + } + } + } + return selectedNode; + } + + public void ResetNodesLocalVariables() + { + for( int i = 0; i < m_nodes.Count; i++ ) + { + m_nodes[ i ].Reset(); + m_nodes[ i ].ResetOutputLocals(); + + FunctionNode fnode = m_nodes[ i ] as FunctionNode; + if( fnode != null ) + { + if( fnode.Function != null ) + fnode.FunctionGraph.ResetNodesLocalVariables(); + } + } + } + + public void ResetNodesLocalVariablesIfNot( MasterNodePortCategory category ) + { + for( int i = 0; i < m_nodes.Count; i++ ) + { + m_nodes[ i ].Reset(); + m_nodes[ i ].ResetOutputLocalsIfNot( category ); + + FunctionNode fnode = m_nodes[ i ] as FunctionNode; + if( fnode != null ) + { + if( fnode.Function != null ) + fnode.FunctionGraph.ResetNodesLocalVariablesIfNot( category ); + } + } + } + + public void ResetNodesLocalVariables( ParentNode node ) + { + if( node is GetLocalVarNode ) + { + GetLocalVarNode localVarNode = node as GetLocalVarNode; + if( localVarNode.CurrentSelected != null ) + { + node = localVarNode.CurrentSelected; + } + } + + node.Reset(); + node.ResetOutputLocals(); + int count = node.InputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( node.InputPorts[ i ].IsConnected ) + { + ResetNodesLocalVariables( m_nodesDict[ node.InputPorts[ i ].GetConnection().NodeId ] ); + } + } + } + + public void ResetNodesLocalVariablesIfNot( ParentNode node, MasterNodePortCategory category ) + { + if( node is GetLocalVarNode ) + { + GetLocalVarNode localVarNode = node as GetLocalVarNode; + if( localVarNode.CurrentSelected != null ) + { + node = localVarNode.CurrentSelected; + } + } + + node.Reset(); + node.ResetOutputLocalsIfNot( category ); + int count = node.InputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( node.InputPorts[ i ].IsConnected ) + { + ResetNodesLocalVariablesIfNot( m_nodesDict[ node.InputPorts[ i ].GetConnection().NodeId ], category ); + } + } + } + + + public override string ToString() + { + string dump = ( "Parent Graph \n" ); + for( int i = 0; i < m_nodes.Count; i++ ) + { + dump += ( m_nodes[ i ] + "\n" ); + } + return dump; + } + + public void OrderNodesByGraphDepth() + { + if( CurrentMasterNode != null ) + { + //CurrentMasterNode.SetupNodeCategories(); + int count = m_nodes.Count; + for( int i = 0; i < count; i++ ) + { + if( m_nodes[ i ].ConnStatus == NodeConnectionStatus.Island ) + { + m_nodes[ i ].CalculateCustomGraphDepth(); + } + } + } + else + { + //TODO: remove this dynamic list + List allOutputs = new List(); + for( int i = 0; i < AllNodes.Count; i++ ) + { + OutputNode temp = AllNodes[ i ] as OutputNode; + if( temp != null ) + allOutputs.Add( temp ); + } + + for( int j = 0; j < allOutputs.Count; j++ ) + { + allOutputs[ j ].SetupNodeCategories(); + int count = m_nodes.Count; + for( int i = 0; i < count; i++ ) + { + if( m_nodes[ i ].ConnStatus == NodeConnectionStatus.Island ) + { + m_nodes[ i ].CalculateCustomGraphDepth(); + } + } + } + } + + // @diogo: replaced Sort() with OrderBy() for stable sorting + m_nodes = m_nodes.OrderByDescending( s => s.GraphDepth ).ToList(); + } + + public void WriteToString( ref string nodesInfo, ref string connectionsInfo ) + { + for( int i = 0; i < m_nodes.Count; i++ ) + { + m_nodes[ i ].FullWriteToString( ref nodesInfo, ref connectionsInfo ); + IOUtils.AddLineTerminator( ref nodesInfo ); + } + } + + public void Reset() + { + SaveIsDirty = false; + IsDirty = false; + } + + public void OnBeforeSerialize() + { + //DeSelectAll(); + } + + public void OnAfterDeserialize() + { + m_afterDeserializeFlag = true; + } + + public void CleanCorruptedNodes() + { + for( int i = 0; i < m_nodes.Count; i++ ) + { + if( (object)m_nodes[ i ] == null ) + { + m_nodes.RemoveAt( i ); + CleanCorruptedNodes(); + } + } + } + + public void OnDuplicateEventWrapper() + { + if( OnDuplicateEvent != null ) + { + AmplifyShaderEditorWindow temp = UIUtils.CurrentWindow; + UIUtils.CurrentWindow = ParentWindow; + OnDuplicateEvent(); + UIUtils.CurrentWindow = temp; + } + } + + public ParentNode CreateNode( AmplifyShaderFunction shaderFunction, bool registerUndo, int nodeId = -1, bool addLast = true ) + { + FunctionNode newNode = ScriptableObject.CreateInstance(); + if( newNode ) + { + newNode.ContainerGraph = this; + newNode.CommonInit( shaderFunction, nodeId ); + newNode.UniqueId = nodeId; + AddNode( newNode, nodeId < 0, addLast, registerUndo ); + } + return newNode; + } + + public ParentNode CreateNode( AmplifyShaderFunction shaderFunction, bool registerUndo, Vector2 pos, int nodeId = -1, bool addLast = true ) + { + ParentNode newNode = CreateNode( shaderFunction, registerUndo, nodeId, addLast ); + if( newNode ) + { + newNode.Vec2Position = pos; + } + return newNode; + } + + public TemplateMultiPassMasterNode CreateMultipassMasterNode( int lodId, bool registerUndo, int nodeId = -1, bool addLast = true ) + { + TemplateMultiPassMasterNode newNode = ScriptableObject.CreateInstance(); + if( newNode ) + { + newNode.LODIndex = lodId; + newNode.ContainerGraph = this; + if( newNode.IsStubNode ) + { + TemplateMultiPassMasterNode stubNode = newNode.ExecuteStubCode() as TemplateMultiPassMasterNode; + ScriptableObject.DestroyImmediate( newNode, true ); + newNode = stubNode; + } + else + { + newNode.UniqueId = nodeId; + AddNode( newNode, nodeId < 0, addLast, registerUndo ); + } + } + return newNode; + } + + public ParentNode CreateNode( System.Type type, bool registerUndo, int nodeId = -1, bool addLast = true ) + { + ParentNode newNode = ScriptableObject.CreateInstance( type ) as ParentNode; + if( newNode ) + { + newNode.ContainerGraph = this; + if( newNode.IsStubNode ) + { + ParentNode stubNode = newNode.ExecuteStubCode(); + ScriptableObject.DestroyImmediate( newNode, true ); + newNode = stubNode; + } + else + { + newNode.UniqueId = nodeId; + AddNode( newNode, nodeId < 0, addLast, registerUndo ); + } + } + return newNode; + } + + public ParentNode CreateNode( System.Type type, bool registerUndo, Vector2 pos, int nodeId = -1, bool addLast = true ) + { + ParentNode newNode = CreateNode( type, registerUndo, nodeId, addLast ); + if( newNode ) + { + newNode.Vec2Position = pos; + } + return newNode; + } + + public void FireMasterNodeReplacedEvent() + { + MasterNode masterNode = CurrentMasterNode; + int count = m_nodes.Count; + for( int i = 0; i < count; i++ ) + { + if( m_nodes[ i ].UniqueId != m_masterNodeId ) + { + m_nodes[ i ].OnMasterNodeReplaced( masterNode ); + } + } + } + + //Used over shader functions to propagate signal into their graphs + public void FireMasterNodeReplacedEvent( MasterNode masterNode ) + { + int count = m_nodes.Count; + for( int i = 0; i < count; i++ ) + { + if( m_nodes[ i ].UniqueId != masterNode.UniqueId ) + { + m_nodes[ i ].OnMasterNodeReplaced( masterNode ); + } + } + } + + + public void CrossCheckTemplateNodes( TemplateDataParent templateData , List mpNodesList , int lodId ) + { + /*Paulo*/ + DeSelectAll(); + TemplateMultiPassMasterNode newMasterNode = null; + Dictionary nodesDict = new Dictionary(); + int mpNodeCount = mpNodesList.Count; + for( int i = 0; i < mpNodeCount; i++ ) + { + string masterNodeId = mpNodesList[ i ].InvalidNode ? mpNodesList[ i ].OriginalPassName + "ASEInvalidMasterNode" + i : mpNodesList[ i ].OriginalPassName; + nodesDict.Add( masterNodeId, new TemplateReplaceHelper( mpNodesList[ i ] ) ); + } + + TemplateMultiPassMasterNode currMasterNode = GetNode( m_masterNodeId ) as TemplateMultiPassMasterNode; + + TemplateMultiPass multipassData = templateData as TemplateMultiPass; + m_currentSRPType = multipassData.SubShaders[ 0 ].Modules.SRPType; + + bool sortTemplatesNodes = false; + Vector2 currentPosition = currMasterNode.Vec2Position; + for( int subShaderIdx = 0; subShaderIdx < multipassData.SubShaders.Count; subShaderIdx++ ) + { + for( int passIdx = 0; passIdx < multipassData.SubShaders[ subShaderIdx ].Passes.Count; passIdx++ ) + { + string currPassName = multipassData.SubShaders[ subShaderIdx ].Passes[ passIdx ].PassNameContainer.Data; + if( nodesDict.ContainsKey( currPassName ) ) + { + bool wasMainNode = nodesDict[ currPassName ].MasterNode.IsMainOutputNode; + + currentPosition.y += nodesDict[ currPassName ].MasterNode.Position.height + 10; + nodesDict[ currPassName ].Used = true; + nodesDict[ currPassName ].MasterNode.SetTemplate( multipassData, false, false, subShaderIdx, passIdx, SetTemplateSource.NewShader ); + if( wasMainNode && !nodesDict[ currPassName ].MasterNode.IsMainOutputNode ) + { + nodesDict[ currPassName ].MasterNode.ReleaseResources(); + } + else if( !wasMainNode && nodesDict[ currPassName ].MasterNode.IsMainOutputNode ) + { + newMasterNode = nodesDict[ currPassName ].MasterNode; + } + } + else + { + sortTemplatesNodes = true; + TemplateMultiPassMasterNode masterNode = CreateMultipassMasterNode( lodId, false ); + if( multipassData.SubShaders[ subShaderIdx ].Passes[ passIdx ].IsMainPass ) + { + newMasterNode = masterNode; + currMasterNode.ReleaseResources(); + } + masterNode.Vec2Position = currentPosition; + masterNode.SetTemplate( multipassData, true, true, subShaderIdx, passIdx, SetTemplateSource.NewShader ); + //currentPosition.y += masterNode.HeightEstimate + 10; + } + } + } + + foreach( KeyValuePair kvp in nodesDict ) + { + if( !kvp.Value.Used ) + DestroyNode( kvp.Value.MasterNode, false, true ); + } + nodesDict.Clear(); + + if( newMasterNode != null ) + { + if( lodId == -1 ) + { + m_masterNodeId = newMasterNode.UniqueId; + } + newMasterNode.OnMaterialUpdatedEvent += OnMaterialUpdatedEvent; + newMasterNode.OnShaderUpdatedEvent += OnShaderUpdatedEvent; + newMasterNode.IsMainOutputNode = true; + } + + if( sortTemplatesNodes ) + { + mpNodesList.Sort( ( x, y ) => ( x.PassIdx.CompareTo( y.PassIdx ) ) ); + } + } + + public void OnRefreshLinkedPortsComplete() + { + OnRefreshLinkedPortsCompleteInternal( m_multiPassMasterNodes ); + for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) + { + OnRefreshLinkedPortsCompleteInternal( m_lodMultiPassMasterNodes[ i ] ); + } + } + + private void OnRefreshLinkedPortsCompleteInternal( UsageListTemplateMultiPassMasterNodes masterNodes ) + { + int mpCount = masterNodes.Count; + for( int i = 0; i < mpCount; i++ ) + { + masterNodes.NodesList[ i ].OnRefreshLinkedPortsComplete(); + } + } + + public void RefreshLinkedMasterNodes( bool optionsUpdate = false ) + { + if( DebugConsoleWindow.DeveloperMode ) + Debug.Log( "Refresh linked master nodes" ); + + RefreshLinkedMasterNodesInternal( m_multiPassMasterNodes, optionsUpdate ); + for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) + { + RefreshLinkedMasterNodesInternal( m_lodMultiPassMasterNodes[i], optionsUpdate ); + } + } + + private void RefreshLinkedMasterNodesInternal( UsageListTemplateMultiPassMasterNodes masterNodes, bool optionsUpdate ) + { + int mpCount = masterNodes.Count; + if( mpCount > 1 ) + { + Dictionary> registeredLinks = new Dictionary>(); + for( int i = 0; i < mpCount; i++ ) + { + CheckLinkedPorts( ref registeredLinks, masterNodes.NodesList[ mpCount - 1 - i ] ); + } + + foreach( KeyValuePair> kvp in registeredLinks ) + { + int linkCount = kvp.Value.Count; + if( linkCount == 1 ) + { + kvp.Value[ 0 ].Visible = true; + } + else + { + kvp.Value[ 0 ].Visible = true; + for( int i = 1; i < linkCount; i++ ) + { + kvp.Value[ i ].SetExternalLink( kvp.Value[ 0 ].NodeId, kvp.Value[ 0 ].PortId ); + kvp.Value[ i ].Visible = false; + } + } + kvp.Value.Clear(); + } + registeredLinks.Clear(); + registeredLinks = null; + } + + masterNodes.NodesList.Sort( ( x, y ) => ( x.SubShaderIdx * 1000 + x.PassIdx ).CompareTo( y.SubShaderIdx * 1000 + y.PassIdx ) ); + masterNodes.UpdateNodeArr(); + + m_parentWindow.TemplatesManagerInstance.ResetOptionsSetupData(); + for( int i = 0; i < mpCount; i++ ) + { + int visiblePorts = 0; + for( int j = 0; j < masterNodes.NodesList[ i ].InputPorts.Count; j++ ) + { + if( masterNodes.NodesList[ i ].InputPorts[ j ].Visible ) + { + visiblePorts++; + } + } + + if( masterNodes.NodesList[ i ].VisiblePorts != visiblePorts ) + { + masterNodes.NodesList[ i ].VisiblePorts = visiblePorts; + ForceRepositionCheck = true; + } + + masterNodes.NodesList[ i ].Docking = visiblePorts <= 0; + if( optionsUpdate ) + { + masterNodes.NodesList[ i ].ForceOptionsRefresh(); + } + } + } + + void CheckLinkedPorts( ref Dictionary> registeredLinks, TemplateMultiPassMasterNode masterNode ) + { + if( masterNode.HasLinkPorts ) + { + int inputCount = masterNode.InputPorts.Count; + for( int i = 0; i < inputCount; i++ ) + { + if( !string.IsNullOrEmpty( masterNode.InputPorts[ i ].ExternalLinkId ) ) + { + string linkId = masterNode.InputPorts[ i ].ExternalLinkId; + if( !registeredLinks.ContainsKey( masterNode.InputPorts[ i ].ExternalLinkId ) ) + { + registeredLinks.Add( linkId, new List() ); + } + + if( masterNode.IsMainOutputNode ) + { + registeredLinks[ linkId ].Insert( 0, masterNode.InputPorts[ i ] ); + } + else + { + registeredLinks[ linkId ].Add( masterNode.InputPorts[ i ] ); + } + } + else + { + masterNode.InputPorts[ i ].Visible = true; + } + } + } + else + { + int inputCount = masterNode.InputPorts.Count; + for( int i = 0; i < inputCount; i++ ) + { + masterNode.InputPorts[ i ].Visible = true; + } + } + + } + + public MasterNode ReplaceMasterNode( AvailableShaderTypes newType, bool writeDefaultData = false, TemplateDataParent templateData = null ) + { + DeSelectAll(); + ResetNodeConnStatus(); + MasterNode newMasterNode = null; + List nodesToDelete = null; + int mpNodeCount = m_multiPassMasterNodes.NodesList.Count; + if( mpNodeCount > 0 ) + { + nodesToDelete = new List(); + for( int i = 0; i < mpNodeCount; i++ ) + { + if( m_multiPassMasterNodes.NodesList[ i ].UniqueId != m_masterNodeId ) + { + nodesToDelete.Add( m_multiPassMasterNodes.NodesList[ i ] ); + } + } + + for( int lod = 0; lod < m_lodMultiPassMasterNodes.Count; lod++ ) + { + int lodNodeCount = m_lodMultiPassMasterNodes[ lod ].Count; + for( int i = 0; i < lodNodeCount; i++ ) + { + nodesToDelete.Add( m_lodMultiPassMasterNodes[ lod ].NodesList[ i ] ); + } + } + } + + MasterNode currMasterNode = GetNode( m_masterNodeId ) as MasterNode; + if( currMasterNode != null ) + { + currMasterNode.ReleaseResources(); + } + + bool refreshLinkedMasterNodes = false; + switch( newType ) + { + default: + case AvailableShaderTypes.SurfaceShader: + { + CurrentCanvasMode = NodeAvailability.SurfaceShader; + m_currentSRPType = TemplateSRPType.BiRP; + newMasterNode = CreateNode( typeof( StandardSurfaceOutputNode ), false ) as MasterNode; + } + break; + case AvailableShaderTypes.Template: + { + CurrentCanvasMode = NodeAvailability.TemplateShader; + if( templateData.TemplateType == TemplateDataType.LegacySinglePass ) + { + newMasterNode = CreateNode( typeof( TemplateMasterNode ), false ) as MasterNode; + ( newMasterNode as TemplateMasterNode ).SetTemplate( templateData as TemplateData, writeDefaultData, false ); + m_currentSRPType = TemplateSRPType.BiRP; + } + else + { + /*Paulo*/ + TemplateMultiPass multipassData = templateData as TemplateMultiPass; + m_currentSRPType = multipassData.SubShaders[ 0 ].Modules.SRPType; + + Vector2 currentPosition = currMasterNode.Vec2Position; + + for( int subShaderIdx = 0; subShaderIdx < multipassData.SubShaders.Count; subShaderIdx++ ) + { + for( int passIdx = 0; passIdx < multipassData.SubShaders[ subShaderIdx ].Passes.Count; passIdx++ ) + { + TemplateMultiPassMasterNode masterNode = CreateNode( typeof( TemplateMultiPassMasterNode ), false ) as TemplateMultiPassMasterNode; + if( multipassData.SubShaders[ subShaderIdx ].Passes[ passIdx ].IsMainPass ) + { + newMasterNode = masterNode; + ParentWindow.IsShaderFunctionWindow = false; + CurrentCanvasMode = NodeAvailability.TemplateShader; + } + masterNode.Vec2Position = currentPosition; + masterNode.SetTemplate( multipassData, true, true, subShaderIdx, passIdx, SetTemplateSource.NewShader ); + //currentPosition.y += masterNode.HeightEstimate + 10; + } + } + refreshLinkedMasterNodes = true; + //RefreshLinkedMasterNodes(); + } + } + break; + } + + if( currMasterNode != null ) + { + newMasterNode.CopyFrom( currMasterNode ); + m_masterNodeId = -1; + DestroyNode( currMasterNode, false, true ); + } + + if( nodesToDelete != null ) + { + for( int i = 0; i < nodesToDelete.Count; i++ ) + { + DestroyNode( nodesToDelete[ i ], false, true ); + } + nodesToDelete.Clear(); + } + + m_masterNodeId = newMasterNode.UniqueId; + + if( refreshLinkedMasterNodes ) + RefreshLinkedMasterNodes( true ); + + newMasterNode.OnMaterialUpdatedEvent += OnMaterialUpdatedEvent; + newMasterNode.OnShaderUpdatedEvent += OnShaderUpdatedEvent; + newMasterNode.IsMainOutputNode = true; + OnRefreshLinkedPortsComplete(); + FullCleanUndoStack(); + return newMasterNode; + } + + private void RepositionTemplateNodes( MasterNode newMasterNode ) + { + m_forceRepositionCheck = false; + + int dockedElementsBefore = 0; + int dockedElementsAfter = 0; + int masterIndex = 0; + bool foundMaster = false; + for( int i = 0; i < MultiPassMasterNodes.Count; i++ ) + { + if( MultiPassMasterNodes.NodesList[ i ].UniqueId == m_masterNodeId ) + { + foundMaster = true; + masterIndex = i; + } + + if( !MultiPassMasterNodes.NodesList[ i ].IsInvisible && MultiPassMasterNodes.NodesList[ i ].Docking ) + { + if( foundMaster ) + dockedElementsAfter++; + else + dockedElementsBefore++; + } + } + + if( dockedElementsBefore > 0 ) + { + newMasterNode.UseSquareNodeTitle = true; + } + + for( int i = masterIndex - 1; i >= 0; i-- ) + { + float forwardTracking = 0; + for( int j = i + 1; j <= masterIndex; j++ ) + { + if( !MultiPassMasterNodes.NodesList[ i ].IsInvisible && !MultiPassMasterNodes.NodesList[ j ].Docking ) + { + forwardTracking += MultiPassMasterNodes.NodesList[ j ].HeightEstimate + 10; + } + } + MasterNode node = MultiPassMasterNodes.NodesList[ i ]; + node.Vec2Position = new Vector2( node.Vec2Position.x, newMasterNode.Position.y - forwardTracking - 33 * ( dockedElementsBefore ) ); + } + + for( int i = masterIndex + 1; i < MultiPassMasterNodes.Count; i++ ) + { + if( MultiPassMasterNodes.NodesList[ i ].UniqueId == newMasterNode.UniqueId || MultiPassMasterNodes.NodesList[ i ].Docking ) + continue; + + float backTracking = 0; + for( int j = i - 1; j >= masterIndex; j-- ) + { + if( !MultiPassMasterNodes.NodesList[ i ].IsInvisible && !MultiPassMasterNodes.NodesList[ j ].Docking ) + { + backTracking += MultiPassMasterNodes.NodesList[ j ].HeightEstimate + 10; + } + } + MasterNode node = MultiPassMasterNodes.NodesList[ i ]; + node.Vec2Position = new Vector2( node.Vec2Position.x, newMasterNode.Position.y + backTracking + 33 * ( dockedElementsAfter ) ); + } + } + + public void CreateNewEmpty( string name ) + { + CleanNodes(); + if( m_masterNodeDefaultType == null ) + m_masterNodeDefaultType = typeof( StandardSurfaceOutputNode ); + + MasterNode newMasterNode = CreateNode( m_masterNodeDefaultType, false ) as MasterNode; + newMasterNode.SetName( name ); + m_masterNodeId = newMasterNode.UniqueId; + + ParentWindow.IsShaderFunctionWindow = false; + CurrentCanvasMode = NodeAvailability.SurfaceShader; + + newMasterNode.OnMaterialUpdatedEvent += OnMaterialUpdatedEvent; + newMasterNode.OnShaderUpdatedEvent += OnShaderUpdatedEvent; + newMasterNode.IsMainOutputNode = true; + LoadedShaderVersion = VersionInfo.FullNumber; + } + + public void CreateNewEmptyTemplate( string templateGUID ) + { + CleanNodes(); + TemplateDataParent templateData = m_parentWindow.TemplatesManagerInstance.GetTemplate( templateGUID ); + if( templateData.TemplateType == TemplateDataType.LegacySinglePass ) + { + TemplateMasterNode newMasterNode = CreateNode( typeof( TemplateMasterNode ), false ) as TemplateMasterNode; + m_masterNodeId = newMasterNode.UniqueId; + + ParentWindow.IsShaderFunctionWindow = false; + CurrentCanvasMode = NodeAvailability.TemplateShader; + m_currentSRPType = TemplateSRPType.BiRP; + newMasterNode.OnMaterialUpdatedEvent += OnMaterialUpdatedEvent; + newMasterNode.OnShaderUpdatedEvent += OnShaderUpdatedEvent; + newMasterNode.IsMainOutputNode = true; + + newMasterNode.SetTemplate( templateData as TemplateData, true, true ); + } + else + { + /*Paulo*/ + TemplateMultiPass multipassData = templateData as TemplateMultiPass; + m_currentSRPType = multipassData.SubShaders[ 0 ].Modules.SRPType; + + Vector2 currentPosition = Vector2.zero; + for( int subShaderIdx = 0; subShaderIdx < multipassData.SubShaders.Count; subShaderIdx++ ) + { + for( int passIdx = 0; passIdx < multipassData.SubShaders[ subShaderIdx ].Passes.Count; passIdx++ ) + { + TemplateMultiPassMasterNode newMasterNode = CreateNode( typeof( TemplateMultiPassMasterNode ), false ) as TemplateMultiPassMasterNode; + if( multipassData.SubShaders[ subShaderIdx ].Passes[ passIdx ].IsMainPass ) + { + m_masterNodeId = newMasterNode.UniqueId; + + ParentWindow.IsShaderFunctionWindow = false; + CurrentCanvasMode = NodeAvailability.TemplateShader; + + newMasterNode.OnMaterialUpdatedEvent += OnMaterialUpdatedEvent; + newMasterNode.OnShaderUpdatedEvent += OnShaderUpdatedEvent; + newMasterNode.IsMainOutputNode = true; + } + newMasterNode.Vec2Position = currentPosition; + newMasterNode.SetTemplate( multipassData, true, true, subShaderIdx, passIdx, SetTemplateSource.NewShader ); + + //currentPosition.y += newMasterNode.HeightEstimate + 10; + } + } + + RefreshLinkedMasterNodes( false ); + OnRefreshLinkedPortsComplete(); + } + + LoadedShaderVersion = VersionInfo.FullNumber; + } + + public void CreateNewEmptyFunction( AmplifyShaderFunction shaderFunction ) + { + CleanNodes(); + FunctionOutput newOutputNode = CreateNode( typeof( FunctionOutput ), false ) as FunctionOutput; + m_masterNodeId = newOutputNode.UniqueId; + + ParentWindow.IsShaderFunctionWindow = true; + CurrentCanvasMode = NodeAvailability.ShaderFunction; + + newOutputNode.IsMainOutputNode = true; + } + + public void ForceCategoryRefresh() { m_forceCategoryRefresh = true; } + public void RefreshExternalReferences() + { + int count = m_nodes.Count; + for( int i = 0; i < count; i++ ) + { + m_nodes[ i ].RefreshExternalReferences(); + } + } + + public Vector2 SelectedNodesCentroid + { + get + { + if( m_selectedNodes.Count == 0 ) + return Vector2.zero; + Vector2 pos = new Vector2( 0, 0 ); + for( int i = 0; i < m_selectedNodes.Count; i++ ) + { + pos += m_selectedNodes[ i ].Vec2Position; + } + + pos /= m_selectedNodes.Count; + return pos; + } + } + + public void AddVirtualTextureCount() + { + m_virtualTextureCount += 1; + } + + public void RemoveVirtualTextureCount() + { + m_virtualTextureCount -= 1; + if( m_virtualTextureCount < 0 ) + { + Debug.LogWarning( "Invalid virtual texture count" ); + } + } + + public bool HasVirtualTexture { get { return m_virtualTextureCount > 0; } } + + public void AddInstancePropertyCount() + { + m_instancePropertyCount += 1; +// Debug.Log( "AddInstancePropertyCount "+this.GetInstanceID() + " " + m_instancePropertyCount ); + } + + public void RemoveInstancePropertyCount() + { + m_instancePropertyCount -= 1; + // Debug.Log( "RemoveInstancePropertyCount " + this.GetInstanceID() + " " + m_instancePropertyCount ); + + if( m_instancePropertyCount < 0 ) + { + Debug.LogWarning( "Invalid property instance count" ); + } + } + + public int InstancePropertyCount { get { return m_instancePropertyCount; } set { m_instancePropertyCount = value; } } + + public bool IsInstancedShader { get { return m_instancePropertyCount > 0; } } + + public void AddNormalDependentCount() { m_normalDependentCount += 1; } + + public void RemoveNormalDependentCount() + { + m_normalDependentCount -= 1; + if( m_normalDependentCount < 0 ) + { + Debug.LogWarning( "Invalid normal dependentCount count" ); + } + } + + public void SetModeFromMasterNode() + { + MasterNode masterNode = CurrentMasterNode; + if( masterNode != null ) + { + switch( masterNode.CurrentMasterNodeCategory ) + { + default: + case AvailableShaderTypes.SurfaceShader: + { + if( masterNode is StandardSurfaceOutputNode ) + CurrentCanvasMode = ParentWindow.CurrentNodeAvailability; + else + CurrentCanvasMode = NodeAvailability.SurfaceShader; + } + break; + case AvailableShaderTypes.Template: + { + CurrentCanvasMode = NodeAvailability.TemplateShader; + } + break; + } + } + else + { + + CurrentCanvasMode = NodeAvailability.SurfaceShader; + } + } + + public void MarkToDelete( ParentNode node ) + { + m_markedForDeletion.Add( node ); + } + public bool IsMasterNode( ParentNode node ) + { + return ( node.UniqueId == m_masterNodeId ) || + m_multiPassMasterNodes.HasNode( node.UniqueId ); + } + + public TemplateMultiPassMasterNode GetMainMasterNodeOfLOD( int lod ) + { + if( lod == -1 ) + return CurrentMasterNode as TemplateMultiPassMasterNode; + + return m_lodMultiPassMasterNodes[ lod ].NodesList.Find( x => x.IsMainOutputNode ); + } + + public TemplateMultiPassMasterNode GetMasterNodeOfPass( string passName, int lod ) + { + if( lod == -1 ) + return m_multiPassMasterNodes.NodesList.Find( x => x.PassName.Equals( passName ) ); + + return m_lodMultiPassMasterNodes[lod].NodesList.Find( x => x.PassName.Equals( passName ) ); + } + + public void ForceMultiPassMasterNodesRefresh() + { + int mainOutputId = 0; + int count = m_multiPassMasterNodes.Count; + for( int i = 0; i < count; i++ ) + { + m_multiPassMasterNodes.NodesList[ i ].ForceTemplateRefresh(); + if( m_multiPassMasterNodes.NodesList[ i ].IsMainOutputNode ) + mainOutputId = i; + } + + int lodCount = m_lodMultiPassMasterNodes.Count; + for( int i = 0; i < lodCount; i++ ) + { + if( m_lodMultiPassMasterNodes[ i ] != null ) + { + count = m_lodMultiPassMasterNodes[ i ].Count; + for( int j = 0; j < count; j++ ) + { + m_lodMultiPassMasterNodes[ i ].NodesList[ j ].ForceTemplateRefresh(); + } + } + } + + m_multiPassMasterNodes.NodesList[ mainOutputId ].CheckTemplateChanges(); + } + + public void SetLateOptionsRefresh() + { + m_lateOptionsRefresh = true; + } + + public void CreateLodMasterNodes( TemplateMultiPass templateMultiPass,int index, Vector2 initialPosition ) + { + for( int lod = 0; lod < m_lodMultiPassMasterNodes.Count; lod++ ) + { + if( m_lodMultiPassMasterNodes[ lod ].Count == 0 ) + { + TemplateMultiPassMasterNode reference = CurrentMasterNode as TemplateMultiPassMasterNode; + + int shaderLod = -1; + if( lod == 0 ) + { + shaderLod = reference.ShaderLOD - MasterNodeLODIncrement; + } + else + { + //index == -2 is when user clicks on +/- buttons over the foldout UI + if( index == -2 ) + { + shaderLod = m_lodMultiPassMasterNodes[ lod - 1 ].NodesList[ reference.PassIdx ].ShaderLOD - MasterNodeLODIncrement; + } + //index == -1 is when user clicks on + button over the main lod master node + else if( index == -1 ) + { + int mainShaderLOD = m_lodMultiPassMasterNodes[ 0 ].NodesList[ reference.PassIdx ].ShaderLOD; + shaderLod = ( reference.ShaderLOD + mainShaderLOD )/2; + } + else + { + if( m_lodMultiPassMasterNodes[ index ].Count > 0 ) + { + if( m_lodMultiPassMasterNodes[ index + 1 ].Count > 0 ) + { + shaderLod = (m_lodMultiPassMasterNodes[ index ].NodesList[ reference.PassIdx ].ShaderLOD + + m_lodMultiPassMasterNodes[ index + 1 ].NodesList[ reference.PassIdx ].ShaderLOD )/2; + } + else + { + shaderLod = m_lodMultiPassMasterNodes[ index ].NodesList[ reference.PassIdx ].ShaderLOD - MasterNodeLODIncrement; + } + } + } + } + + int nodeId = 0; + TemplateMultiPassMasterNode mainMasterNode = null; + for( int subShaderIdx = 0; subShaderIdx < templateMultiPass.SubShaders.Count; subShaderIdx++ ) + { + for( int passIdx = 0; passIdx < templateMultiPass.SubShaders[ subShaderIdx ].Passes.Count; passIdx++ ) + { + TemplateMultiPassMasterNode masterNode = ScriptableObject.CreateInstance( typeof( TemplateMultiPassMasterNode ) ) as TemplateMultiPassMasterNode; + masterNode.LODIndex = lod; + masterNode.ContainerGraph = this; + masterNode.Vec2Position = initialPosition; + AddNode( masterNode, true ); + masterNode.SetTemplate( templateMultiPass, true, true, subShaderIdx, passIdx, SetTemplateSource.NewShader ); + masterNode.CopyOptionsFrom( m_multiPassMasterNodes.NodesList[ nodeId++ ] ); + if( masterNode.IsMainOutputNode || ( subShaderIdx == 0 && passIdx == 0 ) ) + { + masterNode.SetShaderLODValueAndLabel( shaderLod ); + mainMasterNode = masterNode; + } + } + } + + mainMasterNode.ForceOptionsRefresh(); + SortLODMasterNodes(); + if( OnLODMasterNodesAddedEvent != null ) + { + OnLODMasterNodesAddedEvent( lod ); + } + + TemplateMultiPassMasterNode lodMainMasterNode = CurrentMasterNode as TemplateMultiPassMasterNode; + lodMainMasterNode.SetShaderLODValueAndLabel( lodMainMasterNode.ShaderLOD ); + return; + } + } + } + + public void DestroyLodMasterNodes( int index ) + { + if( index < 0 ) + { + for( int lod = m_lodMultiPassMasterNodes.Count - 1; lod >= 0; lod-- ) + { + if( m_lodMultiPassMasterNodes[ lod ].Count > 0 ) + { + while( m_lodMultiPassMasterNodes[ lod ].Count > 0 ) + { + DestroyNode( m_lodMultiPassMasterNodes[ lod ].NodesList[ 0 ], false, true ); + } + break; + } + } + } + else + { + while( m_lodMultiPassMasterNodes[ index ].Count > 0 ) + { + DestroyNode( m_lodMultiPassMasterNodes[ index ].NodesList[ 0 ], false, true ); + } + } + SortLODMasterNodes(); + TemplateMultiPassMasterNode lodMainMasterNode = CurrentMasterNode as TemplateMultiPassMasterNode; + lodMainMasterNode.SetShaderLODValueAndLabel( lodMainMasterNode.ShaderLOD ); + } + + public void SortLODMasterNodes() + { + int idx = (CurrentMasterNode as TemplateMultiPassMasterNode).PassIdx; + m_lodMultiPassMasterNodes.Sort( ( x, y ) => + { + if( x.Count > 0 ) + { + if( y.Count > 0 ) + { + return -x.NodesList[ idx ].ShaderLOD.CompareTo( y.NodesList[ idx ].ShaderLOD ); + } + else + { + return -1; + } + } + else + { + if( y.Count > 0 ) + { + return 1; + } + } + return 0; + }); + + for( int lodIdx = 0; lodIdx < m_lodMultiPassMasterNodes.Count; lodIdx++ ) + { + for( int nodeIdx = 0; nodeIdx < m_lodMultiPassMasterNodes[ lodIdx ].Count; nodeIdx++ ) + { + m_lodMultiPassMasterNodes[ lodIdx ].NodesList[ nodeIdx ].LODIndex = lodIdx; + } + } + } + + public List GetMultiPassMasterNodes( int lod ) + { + if( lod == -1 ) + return m_multiPassMasterNodes.NodesList; + + return m_lodMultiPassMasterNodes[ lod ].NodesList; + } + + public bool IsNormalDependent { get { return m_normalDependentCount > 0; } } + + public void MarkToDeselect() { m_markedToDeSelect = true; } + public void MarkToSelect( int nodeId ) { m_markToSelect = nodeId; } + public void MarkWireHighlights() { m_checkSelectedWireHighlights = true; } + public List SelectedNodes { get { return m_selectedNodes; } } + public List MarkedForDeletionNodes { get { return m_markedForDeletion; } } + public int CurrentMasterNodeId { get { return m_masterNodeId; } set { m_masterNodeId = value; } } + + public Shader CurrentShader + { + get + { + MasterNode masterNode = GetNode( m_masterNodeId ) as MasterNode; + if( masterNode != null ) + return masterNode.CurrentShader; + return null; + } + } + + public Material CurrentMaterial + { + get + { + MasterNode masterNode = GetNode( m_masterNodeId ) as MasterNode; + if( masterNode != null ) + return masterNode.CurrentMaterial; + return null; + } + } + + + + public NodeAvailability CurrentCanvasMode { get { return m_currentCanvasMode; } set { m_currentCanvasMode = value; ParentWindow.LateRefreshAvailableNodes(); } } + public OutputNode CurrentOutputNode { get { return GetNode( m_masterNodeId ) as OutputNode; } } + public FunctionOutput CurrentFunctionOutput { get { return GetNode( m_masterNodeId ) as FunctionOutput; } } + public MasterNode CurrentMasterNode { get { return GetNode( m_masterNodeId ) as MasterNode; } } + public StandardSurfaceOutputNode CurrentStandardSurface { get { return GetNode( m_masterNodeId ) as StandardSurfaceOutputNode; } } + public List AllNodes { get { return m_nodes; } } + public int NodeCount { get { return m_nodes.Count; } } + //public List VisibleNodes { get { return m_visibleNodes; } } + + public int NodeClicked + { + set { m_nodeClicked = value; } + get { return m_nodeClicked; } + } + + public bool IsDirty + { + set { m_isDirty = value && UIUtils.DirtyMask; } + get + { + bool value = m_isDirty; + m_isDirty = false; + return value; + } + } + + public bool SaveIsDirty + { + set { m_saveIsDirty = value && UIUtils.DirtyMask; } + get { return m_saveIsDirty; } + } + public int LoadedShaderVersion + { + get { return m_loadedShaderVersion; } + set { m_loadedShaderVersion = value; } + } + + public AmplifyShaderFunction CurrentShaderFunction + { + get { if( CurrentFunctionOutput != null ) return CurrentFunctionOutput.Function; else return null; } + set { if( CurrentFunctionOutput != null ) CurrentFunctionOutput.Function = value; } + } + + public bool HasUnConnectedNodes { get { return m_hasUnConnectedNodes; } } + public UsageListSamplerNodes SamplerNodes { get { return m_samplerNodes; } } + public UsageListFloatIntNodes FloatIntNodes { get { return m_floatNodes; } } + public UsageListTexturePropertyNodes TexturePropertyNodes { get { return m_texturePropertyNodes; } } + public UsageListTextureArrayNodes TextureArrayNodes { get { return m_textureArrayNodes; } } + public UsageListPropertyNodes PropertyNodes { get { return m_propertyNodes; } } + public UsageListPropertyNodes RawPropertyNodes { get { return m_rawPropertyNodes; } } + public UsageListCustomExpressionsOnFunctionMode CustomExpressionOnFunctionMode { get { return m_customExpressionsOnFunctionMode; } } + public UsageListStaticSwitchNodes StaticSwitchNodes { get { return m_staticSwitchNodes; } } + public UsageListScreenColorNodes ScreenColorNodes { get { return m_screenColorNodes; } } + public UsageListRegisterLocalVarNodes LocalVarNodes { get { return m_localVarNodes; } } + public UsageListGlobalArrayNodes GlobalArrayNodes { get { return m_globalArrayNodes; } } + public UsageListFunctionInputNodes FunctionInputNodes { get { return m_functionInputNodes; } } + public UsageListFunctionNodes FunctionNodes { get { return m_functionNodes; } } + public UsageListFunctionOutputNodes FunctionOutputNodes { get { return m_functionOutputNodes; } } + public UsageListFunctionSwitchNodes FunctionSwitchNodes { get { return m_functionSwitchNodes; } } + public UsageListFunctionSwitchCopyNodes FunctionSwitchCopyNodes { get { return m_functionSwitchCopyNodes; } } + public UsageListTemplateMultiPassMasterNodes MultiPassMasterNodes { get { return m_multiPassMasterNodes; } set { m_multiPassMasterNodes = value; } } + public List LodMultiPassMasternodes { get { return m_lodMultiPassMasterNodes; } } + + + public PrecisionType CurrentPrecision + { + get { return m_currentPrecision; } + set { m_currentPrecision = value; } + } + + public NodeLOD LodLevel + { + get { return m_lodLevel; } + } + + public List NodePreviewList { get { return m_nodePreviewList; } set { m_nodePreviewList = value; } } + + public void SetGraphId( int id ) + { + m_graphId = id; + } + + public int GraphId + { + get { return m_graphId; } + } + + public AmplifyShaderEditorWindow ParentWindow + { + get { return m_parentWindow; } + set { m_parentWindow = value; } + } + + + public bool ChangedLightingModel + { + get { return m_changedLightingModel; } + set { m_changedLightingModel = value; } + } + + public bool ForceRepositionCheck + { + get { return m_forceRepositionCheck; } + set { m_forceRepositionCheck = value; } + } + + public bool IsLoading { get { return m_isLoading; } set { m_isLoading = value; } } + public bool IsDuplicating { get { return m_isDuplicating; } set { m_isDuplicating = value; } } + public TemplateSRPType CurrentSRPType { get { return m_currentSRPType; }set { m_currentSRPType = value; } } + public bool IsSRP { get { return m_currentSRPType == TemplateSRPType.URP || m_currentSRPType == TemplateSRPType.HDRP; } } + public bool IsHDRP { get { return m_currentSRPType == TemplateSRPType.HDRP; } } + public bool IsLWRP { get { return m_currentSRPType == TemplateSRPType.URP; } } + public bool IsStandardSurface { get { return GetNode( m_masterNodeId ) is StandardSurfaceOutputNode; } } + + public bool SamplingMacros { + get { return m_samplingThroughMacros; } + set { m_samplingThroughMacros = value; } + } + public bool HasLODs { get { return m_lodMultiPassMasterNodes[ 0 ].Count > 0; } } + //public bool HasLodMultiPassNodes + //{ + // get + // { + // for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) + // { + // if( m_lodMultiPassMasterNodes[ i ].Count > 0 ) + // return true; + // } + // return false; + // } + //} + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs.meta new file mode 100644 index 00000000..99cdb4b0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 0b814c2a3cbebc047a566a92ed9d4340 +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu.meta new file mode 100644 index 00000000..a6275782 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3b28c70161e2aec4787239fba546bd25 +folderAsset: yes +timeCreated: 1481126944 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs new file mode 100644 index 00000000..d811aace --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs @@ -0,0 +1,6107 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using UnityEditor; +using UnityEditor.Callbacks; +using UnityEngine; +using UnityEngine.Networking; + +namespace AmplifyShaderEditor +{ + // Disabling Substance Deprecated warning + + public class AmplifyShaderEditorWindow : SearchableEditorWindow, ISerializationCallbackReceiver + { + public const string PreviewSizeGlobalVariable = "_ASEPreviewSize"; + + public const double InactivitySaveTime = 1.0; + + public const string ASEFileList = "ASEfileList"; + public const string CopyCommand = "Copy"; + public const string PasteCommand = "Paste"; + public const string SelectAll = "SelectAll"; + public const string Duplicate = "Duplicate"; + public const string ObjectSelectorClosed = "ObjectSelectorClosed"; + public const string LiveShaderError = "Live Shader only works with an assigned Master Node on the graph"; + + private const string OnlineSharingWarning = "Please enable \"Allow downloads over HTTP*\" in Player Settings to use the Online Sharing feature."; + + //public Texture2D MasterNodeOnTexture = null; + //public Texture2D MasterNodeOffTexture = null; + + //public Texture2D GPUInstancedOnTexture = null; + //public Texture2D GPUInstancedOffTexture = null; + + private bool m_initialized = false; + private bool m_checkInvalidConnections = false; + private bool m_afterDeserializeFlag = true; + + + [SerializeField] + private ParentGraph m_customGraph = null; + + // UI + private Rect m_graphArea; + private Texture2D m_graphBgTexture; + private Texture2D m_graphFgTexture; + private GUIStyle m_graphFontStyle; + //private GUIStyle _borderStyle; + private Texture2D m_wireTexture; + + [SerializeField] + TemplatesManager m_templatesManager; + + [SerializeField] + private InnerWindowEditorVariables m_innerEditorVariables; + + [SerializeField] + private string m_lastpath; + + [SerializeField] + private ASESelectionMode m_selectionMode = ASESelectionMode.Shader; + + [SerializeField] + private DuplicatePreventionBuffer m_duplicatePreventionBuffer; + + [SerializeField] + private double m_inactivityTime = 0; + + // Prevent save ops every tick when on live mode + [SerializeField] + private double m_lastTimeSaved = 0; + + [SerializeField] + private bool m_cacheSaveOp = false; + private const double SaveTime = 1; + + private bool m_markedToSave = false; + + // Graph logic + [SerializeField] + private ParentGraph m_mainGraphInstance; + public ParentGraph MainGraphInstance { get { return m_mainGraphInstance; } } + + // Camera control + [SerializeField] + private Vector2 m_cameraOffset; + + private float m_cameraSpeed = 1; + + private Rect m_cameraInfo; + + [SerializeField] + private float m_cameraZoom; + + [SerializeField] + private Vector2 m_minNodePos; + + [SerializeField] + private Vector2 m_maxNodePos; + + [SerializeField] + private bool m_isDirty; + + [SerializeField] + private bool m_saveIsDirty; + + [SerializeField] + private bool m_repaintIsDirty; + + [SerializeField] + private bool m_liveShaderEditing = false; + + [SerializeField] + private bool m_shaderIsModified = false; + + [SerializeField] + private string m_lastOpenedLocation = string.Empty; + + [SerializeField] + private bool m_zoomChanged = true; + + [SerializeField] + private float m_lastWindowWidth = 0; + + [SerializeField] + private int m_graphCount = 0; + + [SerializeField] + private double m_currentInactiveTime = 0; + + private bool m_ctrlSCallback = false; + + private bool m_altBoxSelection = false; + private bool m_altDragStarted = false; + private bool m_altPressDown = false; + private bool m_altAvailable = true; + + // Events + private Vector3 m_currentMousePos; + private Vector2 m_keyEvtMousePos2D; + private Vector2 m_currentMousePos2D; + private Event m_currentEvent; + private string m_currentCommandName = string.Empty; + private bool m_insideEditorWindow; + + private bool m_lostFocus = false; + // Selection box for multiple node selection + private bool m_multipleSelectionActive = false; + private bool m_lmbPressed = false; + private Vector2 m_multipleSelectionStart; + private Rect m_multipleSelectionArea = new Rect( 0, 0, 0, 0 ); + private bool m_autoPanDirActive = false; + private bool m_forceAutoPanDir = false; + private bool m_refreshOnUndo = false; + private bool m_loadShaderOnSelection = false; + private bool m_refreshAvailableNodes = false; + private double m_time; + + //Context Menu + private Vector2 m_rmbStartPos; + private Vector2 m_altKeyStartPos; + private GraphContextMenu m_contextMenu; + private ShortcutsManager m_shortcutManager; + + [SerializeField] + private NodeAvailability m_currentNodeAvailability = NodeAvailability.SurfaceShader; + //Clipboard + private Clipboard m_clipboard; + + //Node Parameters Window + [SerializeField] + private bool m_nodeParametersWindowMaximized = true; + private NodeParametersWindow m_nodeParametersWindow; + + // Tools Window + private ToolsWindow m_toolsWindow; + + private ConsoleLogWindow m_consoleLogWindow; + + //Editor Options + private OptionsWindow m_optionsWindow; + + // Mode Window + private ShaderEditorModeWindow m_modeWindow; + + // Tools Window + private TipsWindow m_tipsWindow; + + //Palette Window + [SerializeField] + private bool m_paletteWindowMaximized = true; + private PaletteWindow m_paletteWindow; + + private ContextPalette m_contextPalette; + private PalettePopUp m_palettePopup; + private System.Type m_paletteChosenType; + private AmplifyShaderFunction m_paletteChosenFunction; + + // In-Editor Message System + GenericMessageUI m_genericMessageUI; + private GUIContent m_genericMessageContent; + + // Drag&Drop Tool + private DragAndDropTool m_dragAndDropTool; + + //Custom Styles + //private CustomStylesContainer m_customStyles; + + private AmplifyShaderFunction m_previousShaderFunction; + + private List m_registeredMenus; + + private PreMadeShaders m_preMadeShaders; + + private AutoPanData[] m_autoPanArea; + + private DrawInfo m_drawInfo; + private KeyCode m_lastKeyPressed = KeyCode.None; + private System.Type m_commentaryTypeNode; + + private int m_onLoadDone = 0; + + private float m_copyPasteDeltaMul = 0; + private Vector2 m_copyPasteInitialPos = Vector2.zero; + private Vector2 m_copyPasteDeltaPos = Vector2.zero; + + private int m_repaintCount = 0; + private bool m_forceUpdateFromMaterialFlag = false; + + private UnityEngine.Object m_delayedLoadObject = null; + private double m_focusOnSelectionTimestamp; + private double m_focusOnMasterNodeTimestamp; + private double m_wiredDoubleTapTimestamp; + + private bool m_globalPreview = false; + private bool m_globalShowInternalData = true; + + private const double AutoZoomTime = 0.25; + private const double ToggleTime = 0.25; + private const double WiredDoubleTapTime = 0.25; + private const double DoubleClickTime = 0.25; + + private Material m_delayedMaterialSet = null; + + private bool m_mouseDownOnValidArea = false; + + private bool m_removedKeyboardFocus = false; + + private int m_lastHotControl = -1; + + [SerializeField] + private bool m_isShaderFunctionWindow = false; + + private string m_currentTitle = string.Empty; + private bool m_currentTitleMod = false; + + //private Material m_maskingMaterial = null; + //private int m_cachedProjectInLinearId = -1; + private int m_cachedEditorTimeId = -1; + private int m_cachedEditorDeltaTimeId = -1; + //private float m_repaintFrequency = 15; + //private double m_repaintTimestamp = 0; + + // Smooth Zoom + private bool m_smoothZoom = false; + private float m_targetZoom; + private double m_zoomTime; + private Vector2 m_zoomPivot; + private float m_targetZoomIncrement; + private float m_zoomVelocity = 0; + + // Smooth Pan + private bool m_smoothOffset = false; + private double m_offsetTime; + private Vector2 m_targetOffset; + private Vector2 m_camVelocity = Vector2.zero; + + // Auto-Compile samples + private bool m_forcingMaterialUpdateFlag = false; + private bool m_forcingMaterialUpdateOp = false; + private List m_materialsToUpdate = new List(); + + private NodeExporterUtils m_nodeExporterUtils; + private bool m_performFullUndoRegister = true; + + //[SerializeField] + //private AmplifyShaderFunction m_openedShaderFunction; + + [SerializeField] + private bool m_openedAssetFromNode = false; + + private bool m_nodesLoadedCorrectly = false; + private GUIContent NodesExceptionMessage = new GUIContent( "ASE is unable to load correctly due to some faulty other classes/plugin in your project. We advise to review all your imported plugins." ); + + + private bool m_outdatedShaderFromTemplateLoaded = false; + private bool m_replaceMasterNode = false; + private AvailableShaderTypes m_replaceMasterNodeType; + private string m_replaceMasterNodeData; + private bool m_replaceMasterNodeDataFromCache; + private NodeWireReferencesUtils m_wireReferenceUtils = new NodeWireReferencesUtils(); + + private ParentNode m_nodeToFocus = null; + private float m_zoomToFocus = 1.0f; + private bool m_selectNodeToFocus = true; + + [NonSerialized] + public Dictionary VisitedChanged = new Dictionary(); + + [SerializeField] + private List m_messages = new List(); + + [SerializeField] + private float m_maxMsgWidth = 100; + + [SerializeField] + private bool m_maximizeMessages = false; + + [NonSerialized] + private Dictionary m_savedList = new Dictionary(); + + public int m_frameCounter = 0; + public double m_fpsTime = 0; + public string m_fpsDisplay = string.Empty; + +#if UNITY_EDITOR_WIN + // ScreenShot vars + IntPtr m_aseHandle; + private Rect m_prevWindowRect; + private Vector2 m_prevCameraOffset; + private float m_prevCameraZoom; + private bool m_openSavedFolder = false; + private bool m_takeScreenShot = false; +#endif + public bool CheckFunctions = false; + + private static System.Diagnostics.Stopwatch m_batchTimer = new System.Diagnostics.Stopwatch(); + + // Unity Menu item + [MenuItem( "Window/Amplify Shader Editor/Open Canvas", false, 1000 )] + static void OpenMainShaderGraph() + { + if( IOUtils.AllOpenedWindows.Count > 0 ) + { + AmplifyShaderEditorWindow currentWindow = CreateTab( "Empty", UIUtils.ShaderIcon ); + UIUtils.CurrentWindow = currentWindow; + currentWindow.CreateNewGraph( "Empty" ); + currentWindow.Show(); + } + else + { + AmplifyShaderEditorWindow currentWindow = OpenWindow( "Empty", UIUtils.ShaderIcon ); + currentWindow.CreateNewGraph( "Empty" ); + //currentWindow.Show(); + } + } + + public static string GenerateTabTitle( string original, bool modified = false ) + { + GUIContent content = new GUIContent( original ); + GUIStyle tabStyle = new GUIStyle( (GUIStyle)"dragtabdropwindow" );// GUI.skin.FindStyle( "dragtabdropwindow" ); + string finalTitle = string.Empty; + bool addEllipsis = false; + for( int i = 1; i <= original.Length; i++ ) + { + content.text = original.Substring( 0, i ); + Vector2 titleSize = tabStyle.CalcSize( content ); + int maxSize = modified ? 62 : 69; + if( titleSize.x > maxSize ) + { + addEllipsis = true; + break; + } + else + { + finalTitle = content.text; + } + } + if( addEllipsis ) + finalTitle += ".."; + if( modified ) + finalTitle += "*"; + return finalTitle; + } + + public static void ConvertShaderToASE( Shader shader, bool OpenOnSeparateWindow = false ) + { + if( UIUtils.IsUnityNativeShader( shader ) ) + { + Debug.LogWarningFormat( "Action not allowed. Attempting to load the native {0} shader into Amplify Shader Editor", shader.name ); + return; + } + if ( IOUtils.IsASEShader( shader ) ) + { + if ( OpenOnSeparateWindow ) + { + AmplifyShaderEditorWindow currentWindow = CreateTab( shader.name , UIUtils.ShaderIcon ); + UIUtils.CurrentWindow = currentWindow; + currentWindow.Show(); + } + else + { + string guid = AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( shader ) ); + if( IOUtils.AllOpenedWindows.Count > 0 ) + { + AmplifyShaderEditorWindow openedTab = null; + for( int i = 0 ; i < IOUtils.AllOpenedWindows.Count ; i++ ) + { + //if( AssetDatabase.GetAssetPath( shader ).Equals( IOUtils.AllOpenedWindows[ i ].LastOpenedLocation ) ) + if( guid.Equals( IOUtils.AllOpenedWindows[ i ].GUID ) ) + { + openedTab = IOUtils.AllOpenedWindows[ i ]; + break; + } + } + + if( openedTab != null ) + { + openedTab.wantsMouseMove = true; + openedTab.ShowTab(); + UIUtils.CurrentWindow = openedTab; + } + else + { + EditorWindow openedWindow = AmplifyShaderEditorWindow.GetWindow(); + AmplifyShaderEditorWindow currentWindow = CreateTab(); + WindowHelper.AddTab( openedWindow , currentWindow ); + UIUtils.CurrentWindow = currentWindow; + } + } + else + { + AmplifyShaderEditorWindow currentWindow = OpenWindow( shader.name , UIUtils.ShaderIcon ); + UIUtils.CurrentWindow = currentWindow; + } + } + + UIUtils.CurrentWindow.LoadProjectSelected( shader ); + } + else + { + Debug.LogWarning( "[AmplifyShaderEditor] Can't open shader " + shader.name + " because it was not created in ASE." ); + + //UIUtils.CreateEmptyFromInvalid( shader ); + //UIUtils.ShowMessage( "Trying to open shader not created on ASE! BEWARE, old data will be lost if saving it here!", MessageSeverity.Warning ); + //if( UIUtils.CurrentWindow.LiveShaderEditing ) + //{ + // UIUtils.ShowMessage( "Disabling Live Shader Editing. Must manually re-enable it.", MessageSeverity.Warning ); + // UIUtils.CurrentWindow.LiveShaderEditing = false; + //} + } + } + + public static void LoadMaterialToASE( Material material ) + { + string guid = AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( material.shader ) ); + + if( IOUtils.AllOpenedWindows.Count > 0 ) + { + AmplifyShaderEditorWindow openedTab = null; + for( int i = 0; i < IOUtils.AllOpenedWindows.Count; i++ ) + { + //if( AssetDatabase.GetAssetPath( material.shader ).Equals( IOUtils.AllOpenedWindows[ i ].LastOpenedLocation ) ) + if( guid.Equals( IOUtils.AllOpenedWindows[ i ].GUID ) ) + { + openedTab = IOUtils.AllOpenedWindows[ i ]; + break; + } + } + + if( openedTab != null ) + { + openedTab.wantsMouseMove = true; + openedTab.ShowTab(); + UIUtils.CurrentWindow = openedTab; + } + else + { + EditorWindow openedWindow = AmplifyShaderEditorWindow.GetWindow(); + AmplifyShaderEditorWindow currentWindow = CreateTab(); + WindowHelper.AddTab( openedWindow, currentWindow ); + UIUtils.CurrentWindow = currentWindow; + } + } + else + { + AmplifyShaderEditorWindow currentWindow = OpenWindow( material.name, UIUtils.MaterialIcon ); + UIUtils.CurrentWindow = currentWindow; + } + + if( IOUtils.IsASEShader( material.shader ) ) + { + UIUtils.CurrentWindow.LoadProjectSelected( material ); + } + else + { + UIUtils.CreateEmptyFromInvalid( material.shader ); + UIUtils.SetDelayedMaterialMode( material ); + } + } + + public static void LoadShaderFunctionToASE( AmplifyShaderFunction shaderFunction, bool openedAssetFromNode , bool OpenOnSeparateWindow = false ) + { + string guid = AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( shaderFunction ) ); + if( OpenOnSeparateWindow ) + { + AmplifyShaderEditorWindow currentWindow = CreateTab( shaderFunction.FunctionName , UIUtils.ShaderFunctionIcon ); + UIUtils.CurrentWindow = currentWindow; + currentWindow.Show(); + } + else + { + if( IOUtils.AllOpenedWindows.Count > 0 ) + { + AmplifyShaderEditorWindow openedTab = null; + for( int i = 0 ; i < IOUtils.AllOpenedWindows.Count ; i++ ) + { + //if( AssetDatabase.GetAssetPath( shaderFunction ).Equals( IOUtils.AllOpenedWindows[ i ].LastOpenedLocation ) ) + if( guid.Equals( IOUtils.AllOpenedWindows[ i ].GUID ) ) + { + openedTab = IOUtils.AllOpenedWindows[ i ]; + break; + } + } + + if( openedTab != null ) + { + openedTab.wantsMouseMove = true; + openedTab.ShowTab(); + UIUtils.CurrentWindow = openedTab; + } + else + { + EditorWindow openedWindow = AmplifyShaderEditorWindow.GetWindow(); + AmplifyShaderEditorWindow currentWindow = CreateTab(); + WindowHelper.AddTab( openedWindow , currentWindow ); + UIUtils.CurrentWindow = currentWindow; + } + } + else + { + AmplifyShaderEditorWindow currentWindow = OpenWindow( shaderFunction.FunctionName , UIUtils.ShaderFunctionIcon ); + UIUtils.CurrentWindow = currentWindow; + } + } + + UIUtils.CurrentWindow.OpenedAssetFromNode = openedAssetFromNode; + if( IOUtils.IsShaderFunction( shaderFunction.FunctionInfo ) ) + { + UIUtils.CurrentWindow.LoadProjectSelected( shaderFunction ); + } + else + { + UIUtils.CurrentWindow.titleContent.text = GenerateTabTitle( shaderFunction.FunctionName ); + UIUtils.CurrentWindow.titleContent.image = UIUtils.ShaderFunctionIcon; + UIUtils.CreateEmptyFunction( shaderFunction ); + } + } + + public static void LoadAndSaveList( string[] assetList ) + { + m_batchTimer.Reset(); + m_batchTimer.Start(); + + EditorPrefs.SetString( ASEFileList , string.Join( ",", assetList ) ); + if( assetList[ 0 ].EndsWith( ".asset" ) ) + { + var obj = AssetDatabase.LoadAssetAtPath( assetList[ 0 ] ); + AmplifyShaderEditorWindow.LoadShaderFunctionToASE( obj, false , true ); + } + else + { + var obj = AssetDatabase.LoadAssetAtPath( assetList[ 0 ] ); + AmplifyShaderEditorWindow.ConvertShaderToASE( obj, true ); + } + + UIUtils.CurrentWindow.State = AmplifyShaderEditorWindow.OpenSaveState.OPEN; + UIUtils.CurrentWindow.Repaint(); + } + + public static AmplifyShaderEditorWindow OpenWindow( string title = null, Texture icon = null ) + { + AmplifyShaderEditorWindow currentWindow = (AmplifyShaderEditorWindow)AmplifyShaderEditorWindow.GetWindow( typeof( AmplifyShaderEditorWindow ), false ); + currentWindow.minSize = new Vector2( ( Constants.MINIMIZE_WINDOW_LOCK_SIZE - 150 ), 270 ); + currentWindow.wantsMouseMove = true; + if( title != null ) + currentWindow.titleContent.text = GenerateTabTitle( title ); + if( icon != null ) + currentWindow.titleContent.image = icon; + return currentWindow; + } + + public static AmplifyShaderEditorWindow CreateTab( string title = null, Texture icon = null ) + { + AmplifyShaderEditorWindow currentWindow = EditorWindow.CreateInstance(); + currentWindow.minSize = new Vector2( ( Constants.MINIMIZE_WINDOW_LOCK_SIZE - 150 ), 270 ); + currentWindow.wantsMouseMove = true; + if( title != null ) + currentWindow.titleContent.text = GenerateTabTitle( title ); + if( icon != null ) + currentWindow.titleContent.image = icon; + return currentWindow; + } + + public double CalculateInactivityTime() + { + double currTime = EditorApplication.timeSinceStartup; + switch( Event.current.type ) + { + case EventType.MouseDown: + case EventType.MouseUp: + //case EventType.MouseMove: + case EventType.MouseDrag: + case EventType.KeyDown: + case EventType.KeyUp: + case EventType.ScrollWheel: + case EventType.DragUpdated: + case EventType.DragPerform: + case EventType.DragExited: + case EventType.ValidateCommand: + case EventType.ExecuteCommand: + { + m_inactivityTime = currTime; + return 0; + } + } + return currTime - m_inactivityTime; + } + + public void ActivatePreviews( bool value ) + { + m_mainGraphInstance.ActivatePreviews( value ); + } + + // Shader Graph window + public override void OnEnable() + { + base.OnEnable(); + + UndoUtils.RegisterUndoRedoCallback( UndoRedoPerformed ); + m_nodeExporterUtils = new NodeExporterUtils( this ); + + ASEPackageManagerHelper.RequestInfo(); + ASEPackageManagerHelper.Update(); + + Shader.SetGlobalVector( PreviewSizeGlobalVariable, new Vector4( Constants.PreviewSize , Constants.PreviewSize , 0, 0 ) ); + + if( m_templatesManager == null ) + { + m_templatesManager = IOUtils.FirstValidTemplatesManager; + if( m_templatesManager == null ) + { + m_templatesManager = ScriptableObject.CreateInstance(); + m_templatesManager.Init(); + if( TemplatesManager.ShowDebugMessages ) + Debug.Log( "Creating Manager" ); + } + else + { + if( TemplatesManager.ShowDebugMessages ) + Debug.Log( "Assigning Manager" ); + } + } + else if( !m_templatesManager.Initialized ) + { + if( TemplatesManager.ShowDebugMessages ) + Debug.Log( "Re-Initializing Manager" ); + m_templatesManager.Init(); + } + TemplatePostProcessor.Destroy(); + if( m_innerEditorVariables == null ) + { + m_innerEditorVariables = new InnerWindowEditorVariables(); + m_innerEditorVariables.Initialize(); + } + + if( m_mainGraphInstance == null ) + { + m_mainGraphInstance = CreateInstance(); + m_mainGraphInstance.Init(); + m_mainGraphInstance.ParentWindow = this; + m_mainGraphInstance.SetGraphId( 0 ); + } + m_mainGraphInstance.ResetEvents(); + m_mainGraphInstance.OnNodeEvent += OnNodeStoppedMovingEvent; + m_mainGraphInstance.OnMaterialUpdatedEvent += OnMaterialUpdated; + m_mainGraphInstance.OnShaderUpdatedEvent += OnShaderUpdated; + m_mainGraphInstance.OnEmptyGraphDetectedEvt += OnEmptyGraphDetected; + m_mainGraphInstance.OnNodeRemovedEvent += m_toolsWindow.OnNodeRemovedFromGraph; + GraphCount = 1; + + IOUtils.Init(); + IOUtils.AllOpenedWindows.Add( this ); + + // Only runs once for multiple windows + EditorApplication.update -= IOUtils.UpdateIO; + EditorApplication.update += IOUtils.UpdateIO; + + //EditorApplication.update -= UpdateTime; + EditorApplication.update -= UpdateNodePreviewListAndTime; + //EditorApplication.update += UpdateTime; + + EditorApplication.update += UpdateNodePreviewListAndTime; + + + if( CurrentSelection == ASESelectionMode.ShaderFunction ) + { + IsShaderFunctionWindow = true; + } + else + { + IsShaderFunctionWindow = false; + } + + m_optionsWindow = new OptionsWindow( this ); + m_optionsWindow.Init(); + + m_contextMenu = new GraphContextMenu( m_mainGraphInstance ); + m_nodesLoadedCorrectly = m_contextMenu.CorrectlyLoaded; + + m_paletteWindow = new PaletteWindow( this ) + { + Resizable = true + }; + m_paletteWindow.OnPaletteNodeCreateEvt += OnPaletteNodeCreate; + m_registeredMenus.Add( m_paletteWindow ); + + m_contextPalette = new ContextPalette( this ); + m_contextPalette.OnPaletteNodeCreateEvt += OnContextPaletteNodeCreate; + m_registeredMenus.Add( m_contextPalette ); + + m_genericMessageUI = new GenericMessageUI(); + m_genericMessageUI.OnMessageDisplayEvent += ShowMessageImmediately; + + Selection.selectionChanged += OnProjectSelectionChanged; + EditorApplication.projectChanged += OnProjectWindowChanged; + + m_focusOnSelectionTimestamp = EditorApplication.timeSinceStartup; + m_focusOnMasterNodeTimestamp = EditorApplication.timeSinceStartup; + + m_nodeParametersWindow.IsMaximized = m_innerEditorVariables.NodeParametersMaximized; + if( DebugConsoleWindow.UseShaderPanelsInfo ) + m_nodeParametersWindow.IsMaximized = m_nodeParametersWindowMaximized; + + m_paletteWindow.IsMaximized = m_innerEditorVariables.NodePaletteMaximized; + if( DebugConsoleWindow.UseShaderPanelsInfo ) + m_paletteWindow.IsMaximized = m_paletteWindowMaximized; + + m_shortcutManager = new ShortcutsManager(); + // REGISTER NODE SHORTCUTS + foreach( KeyValuePair kvp in m_contextMenu.NodeShortcuts ) + { + m_shortcutManager.RegisterNodesShortcuts( kvp.Key, kvp.Value.Name ); + } + + // REGISTER EDITOR SHORTCUTS + + m_shortcutManager.RegisterEditorShortcut( true, EventModifiers.FunctionKey, KeyCode.F1, "Open Selected Node Wiki page", () => + { + List selectedNodes = m_mainGraphInstance.SelectedNodes; + if( selectedNodes != null && selectedNodes.Count == 1 ) + { + FunctionNode shaderFunctionNode = selectedNodes[ 0 ] as FunctionNode; + if( shaderFunctionNode != null ) + { + string url = ( string.IsNullOrEmpty( shaderFunctionNode.Function.URL ) ) ? + Constants.NodeCommonUrl + UIUtils.UrlReplaceInvalidStrings( shaderFunctionNode.Function.FunctionName ) : + shaderFunctionNode.Function.URL; + Application.OpenURL( url ); + } + else + { + if( selectedNodes[ 0 ].Attributes != null ) + { + Application.OpenURL( selectedNodes[ 0 ].Attributes.NodeUrl ); + } + else + { + UIUtils.ShowMessage( "Selected node doesn't have valid attibutes to get URL from." ); + } + + } + } + } ); + + + m_shortcutManager.RegisterEditorShortcut( true, KeyCode.C, "Create Commentary", () => + { + // Create commentary + ParentNode[] selectedNodes = m_mainGraphInstance.SelectedNodes.ToArray(); + UIUtils.MarkUndoAction(); + UndoUtils.RegisterCompleteObjectUndo( this, "Adding Commentary Node" ); + CommentaryNode node = m_mainGraphInstance.CreateNode( m_commentaryTypeNode, true, -1, false ) as CommentaryNode; + node.CreateFromSelectedNodes( TranformedMousePos, selectedNodes ); + node.Focus(); + m_mainGraphInstance.DeSelectAll(); + m_mainGraphInstance.SelectNode( node, false, false ); + SetSaveIsDirty(); + ForceRepaint(); + } ); + + + m_shortcutManager.RegisterEditorShortcut( true, KeyCode.F, "Focus On Selection", () => + { + OnToolButtonPressed( ToolButtonType.FocusOnSelection ); + ForceRepaint(); + } ); + + //m_shortcutManager.RegisterEditorShortcut( true, EventModifiers.None, KeyCode.B, "New Master Node", () => + //{ + // OnToolButtonPressed( ToolButtonType.MasterNode ); + // ForceRepaint(); + //} ); + + m_shortcutManager.RegisterEditorShortcut( true, EventModifiers.None, KeyCode.Space, "Open Node Palette", null, () => + { + m_contextPalette.Show( m_currentMousePos2D, m_cameraInfo ); + } ); + + + m_shortcutManager.RegisterEditorShortcut( true, KeyCode.W, "Toggle Colored Line Mode", () => + { + m_optionsWindow.ColoredPorts = !m_optionsWindow.ColoredPorts; + ForceRepaint(); + + } ); + + m_shortcutManager.RegisterEditorShortcut( true, EventModifiers.Control, KeyCode.W, "Toggle Multi-Line Mode", () => + { + m_optionsWindow.MultiLinePorts = !m_optionsWindow.MultiLinePorts; + ForceRepaint(); + } ); + + m_shortcutManager.RegisterEditorShortcut( true, KeyCode.P, "Global Preview", () => + { + GlobalPreview = !GlobalPreview; + EditorPrefs.SetBool( "GlobalPreview", GlobalPreview ); + + ForceRepaint(); + } ); + + GlobalShowInternalData = EditorPrefs.GetBool( "ASEGlobalShowInternalData", true ); + m_shortcutManager.RegisterEditorShortcut( true, KeyCode.I, "Global Show Internal Data", () => + { + GlobalShowInternalData = !GlobalShowInternalData; + EditorPrefs.SetBool( "ASEGlobalShowInternalData", GlobalShowInternalData ); + ForceRepaint(); + } ); + + m_shortcutManager.RegisterEditorShortcut( true, EventModifiers.FunctionKey, KeyCode.Delete, "Delete selected nodes", DeleteSelectedNodeWithRepaint ); + m_shortcutManager.RegisterEditorShortcut( true, EventModifiers.FunctionKey, KeyCode.Backspace, "Delete selected nodes", DeleteSelectedNodeWithRepaint ); + + m_liveShaderEditing = m_innerEditorVariables.LiveMode; + + UpdateLiveUI(); + } + + public AmplifyShaderEditorWindow() + { + m_minNodePos = new Vector2( float.MaxValue, float.MaxValue ); + m_maxNodePos = new Vector2( float.MinValue, float.MinValue ); + + m_duplicatePreventionBuffer = new DuplicatePreventionBuffer(); + m_commentaryTypeNode = typeof( CommentaryNode ); + titleContent = new GUIContent( "Shader Editor" ); + autoRepaintOnSceneChange = true; + + m_currentMousePos = new Vector3( 0, 0, 0 ); + m_keyEvtMousePos2D = new Vector2( 0, 0 ); + m_multipleSelectionStart = new Vector2( 0, 0 ); + m_initialized = false; + m_graphBgTexture = null; + m_graphFgTexture = null; + + m_cameraOffset = new Vector2( 0, 0 ); + CameraZoom = 1; + + m_registeredMenus = new List(); + + m_nodeParametersWindow = new NodeParametersWindow( this ) + { + Resizable = true + }; + m_registeredMenus.Add( m_nodeParametersWindow ); + + m_modeWindow = new ShaderEditorModeWindow( this ); + //_registeredMenus.Add( _modeWindow ); + + m_toolsWindow = new ToolsWindow( this ); + m_toolsWindow.ToolButtonPressedEvt += OnToolButtonPressed; + + m_consoleLogWindow = new ConsoleLogWindow( this ); + + m_tipsWindow = new TipsWindow( this ); + + m_registeredMenus.Add( m_toolsWindow ); + //m_registeredMenus.Add( m_consoleLogWindow ); + + m_palettePopup = new PalettePopUp(); + + m_clipboard = new Clipboard(); + + m_genericMessageContent = new GUIContent(); + m_dragAndDropTool = new DragAndDropTool(); + m_dragAndDropTool.OnValidDropObjectEvt += OnValidObjectsDropped; + + //_confirmationWindow = new ConfirmationWindow( 100, 100, 300, 100 ); + + m_saveIsDirty = false; + + m_preMadeShaders = new PreMadeShaders(); + + float autoPanSpeed = 2; + m_autoPanArea = new AutoPanData[ 4 ]; + m_autoPanArea[ 0 ] = new AutoPanData( AutoPanLocation.TOP, 25, autoPanSpeed * Vector2.up ); + m_autoPanArea[ 1 ] = new AutoPanData( AutoPanLocation.BOTTOM, 25, autoPanSpeed * Vector2.down ); + m_autoPanArea[ 2 ] = new AutoPanData( AutoPanLocation.LEFT, 25, autoPanSpeed * Vector2.right ); + m_autoPanArea[ 3 ] = new AutoPanData( AutoPanLocation.RIGHT, 25, autoPanSpeed * Vector2.left ); + + m_drawInfo = new DrawInfo(); + UIUtils.CurrentWindow = this; + + m_repaintIsDirty = false; + m_initialized = false; + } + + public void SetStandardShader() + { + m_mainGraphInstance.ReplaceMasterNode( AvailableShaderTypes.SurfaceShader ); + m_mainGraphInstance.FireMasterNodeReplacedEvent(); + } + + public void SetTemplateShader( string templateName, bool writeDefaultData ) + { + TemplateDataParent templateData = m_templatesManager.GetTemplate( ( string.IsNullOrEmpty( templateName ) ? "6e114a916ca3e4b4bb51972669d463bf" : templateName ) ); + m_mainGraphInstance.ReplaceMasterNode( AvailableShaderTypes.Template, writeDefaultData, templateData ); + } + + public void DeleteSelectedNodeWithRepaint() + { + DeleteSelectedNodes(); + SetSaveIsDirty(); + } + + + void UndoRedoPerformed() + { + m_repaintIsDirty = true; + m_saveIsDirty = true; + m_removedKeyboardFocus = true; + m_refreshOnUndo = true; + } + + void Destroy() + { + UndoUtils.ClearUndo( this ); + + m_initialized = false; + + m_nodeExporterUtils.Destroy(); + m_nodeExporterUtils = null; + + m_delayedMaterialSet = null; + + m_materialsToUpdate.Clear(); + m_materialsToUpdate = null; + + GLDraw.Destroy(); + + UIUtils.Destroy(); + m_preMadeShaders.Destroy(); + m_preMadeShaders = null; + + m_registeredMenus.Clear(); + m_registeredMenus = null; + + m_mainGraphInstance.Destroy(); + ScriptableObject.DestroyImmediate( m_mainGraphInstance ); + m_mainGraphInstance = null; + + Resources.UnloadAsset( m_graphBgTexture ); + m_graphBgTexture = null; + + Resources.UnloadAsset( m_graphFgTexture ); + m_graphFgTexture = null; + + Resources.UnloadAsset( m_wireTexture ); + m_wireTexture = null; + + m_contextMenu.Destroy(); + m_contextMenu = null; + + m_shortcutManager.Destroy(); + m_shortcutManager = null; + + m_nodeParametersWindow.Destroy(); + m_nodeParametersWindow = null; + + + m_modeWindow.Destroy(); + m_modeWindow = null; + + m_toolsWindow.Destroy(); + m_toolsWindow = null; + + m_consoleLogWindow.Destroy(); + m_consoleLogWindow = null; + + m_tipsWindow.Destroy(); + m_tipsWindow = null; + + m_optionsWindow.Destroy(); + m_optionsWindow = null; + + m_paletteWindow.Destroy(); + m_paletteWindow = null; + + m_palettePopup.Destroy(); + m_palettePopup = null; + + m_contextPalette.Destroy(); + m_contextPalette = null; + + m_clipboard.ClearClipboard(); + m_clipboard = null; + + m_genericMessageUI.Destroy(); + m_genericMessageUI = null; + m_genericMessageContent = null; + + m_dragAndDropTool.Destroy(); + m_dragAndDropTool = null; + + //m_openedShaderFunction = null; + + UIUtils.CurrentWindow = null; + m_duplicatePreventionBuffer.ReleaseAllData(); + m_duplicatePreventionBuffer = null; + EditorApplication.projectChanged -= OnProjectWindowChanged; + Selection.selectionChanged -= OnProjectSelectionChanged; + + IOUtils.AllOpenedWindows.Remove( this ); + + if( IOUtils.AllOpenedWindows.Count == 0 ) + { + m_templatesManager.Destroy(); + ScriptableObject.DestroyImmediate( m_templatesManager ); + } + m_templatesManager = null; + + IOUtils.Destroy(); + + Resources.UnloadUnusedAssets(); + GC.Collect(); + } + + void Init() + { + // = AssetDatabase.LoadAssetAtPath( Constants.ASEPath + "", typeof( Texture2D ) ) as Texture2D; + m_graphBgTexture = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( IOUtils.GraphBgTextureGUID ), typeof( Texture2D ) ) as Texture2D; + if( m_graphBgTexture != null ) + { + m_graphFgTexture = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( IOUtils.GraphFgTextureGUID ), typeof( Texture2D ) ) as Texture2D; + + //Setup usable area + m_cameraInfo = position; + m_graphArea = new Rect( 0, 0, m_cameraInfo.width, m_cameraInfo.height ); + + // Creating style state to show current selected object + m_graphFontStyle = new GUIStyle() + { + fontSize = 32, + alignment = TextAnchor.MiddleCenter, + fixedWidth = m_cameraInfo.width, + fixedHeight = 50, + stretchWidth = true, + stretchHeight = true + }; + m_graphFontStyle.normal.textColor = Color.white; + + m_wireTexture = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( IOUtils.WireTextureGUID ), typeof( Texture2D ) ) as Texture2D; + + m_initialized = m_graphBgTexture != null && + m_graphFgTexture != null && + m_wireTexture != null; + } + } + + [OnOpenAsset(0)] + static bool OnOpenAsset( int instanceID, int line ) + { + // This test is needed since it is what is used when we both click the button to open generated code inside the canvas + // ( in there we call AssetDatabase.OpenAsset with line set to 1 to let ASE know that we want to ignore normal shader opening ) + // And click on shader errors/warnings over the shader inspector + // ( Line is greater than -1 focusing on where the error/warning is ) + + if( line > -1 ) + { + return false; + } + + UnityEngine.Object selection = EditorUtility.InstanceIDToObject( instanceID ); + + ASEPackageManagerHelper.RequestInfo(); + ASEPackageManagerHelper.Update(); + if( ASEPackageManagerHelper.IsProcessing ) + { + Shader selectedShader = selection as Shader; + if( selectedShader != null ) + { + if( IOUtils.IsASEShader( selectedShader ) ) + { + ASEPackageManagerHelper.SetupLateShader( selectedShader ); + return true; + } + } + else + { + Material mat = selection as Material; + if( mat != null ) + { + if( !Preferences.User.DisableMaterialMode && IOUtils.IsASEShader( mat.shader ) ) + { + ASEPackageManagerHelper.SetupLateMaterial( mat ); + return true; + } + } + else + { + AmplifyShaderFunction shaderFunction = selection as AmplifyShaderFunction; + if( shaderFunction != null ) + { + if( IOUtils.IsShaderFunction( shaderFunction.FunctionInfo ) ) + { + ASEPackageManagerHelper.SetupLateShaderFunction( shaderFunction ); + return true; + } + } + } + } + } + else + { + Shader selectedShader = selection as Shader; + if( selectedShader != null ) + { + if( IOUtils.IsASEShader( selectedShader ) ) + { + ConvertShaderToASE( selectedShader ); + return true; + } + } + else + { + Material mat = selection as Material; + if( mat != null ) + { + if( !Preferences.User.DisableMaterialMode && IOUtils.IsASEShader( mat.shader ) ) + { + LoadMaterialToASE( mat ); + return true; + } + } + else + { + AmplifyShaderFunction shaderFunction = selection as AmplifyShaderFunction; + if( shaderFunction != null ) + { + if( IOUtils.IsShaderFunction( shaderFunction.FunctionInfo ) ) + { + LoadShaderFunctionToASE( shaderFunction, false ); + return true; + } + } + } + } + } + + return false; + } + + [MenuItem( "Assets/Create/Amplify Shader/Surface", false, 84 )] + [MenuItem( "Assets/Create/Shader/Amplify Surface Shader" )] + static void CreateConfirmationStandardShader() + { + //string path = AssetDatabase.GetAssetPath( Selection.activeObject ); + //if( path == "" ) + //{ + // path = "Assets"; + //} + //else if( System.IO.Path.GetExtension( path ) != "" ) + //{ + // path = path.Replace( System.IO.Path.GetFileName( AssetDatabase.GetAssetPath( Selection.activeObject ) ), "" ); + //} + + //string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath( path + "/New Amplify Shader.shader" ); + var endNameEditAction = ScriptableObject.CreateInstance(); + ProjectWindowUtil.StartNameEditingIfProjectWindowExists( 0, endNameEditAction, "New Amplify Shader.shader"/*assetPathAndName*/, AssetPreview.GetMiniTypeThumbnail( typeof( Shader ) ), null ); + } + //static void CreateNewShader( ) + //{ + // CreateNewShader( null, null ); + //} + + static void CreateNewShader( string customPath , string customShaderName ) + { + + string path = string.Empty; + if( string.IsNullOrEmpty( customPath ) ) + { + if( Selection.activeObject != null ) + { + path = ( IOUtils.dataPath + AssetDatabase.GetAssetPath( Selection.activeObject ) ); + } + else + { + UnityEngine.Object[] selection = Selection.GetFiltered( typeof( UnityEngine.Object ), SelectionMode.DeepAssets ); + if( selection.Length > 0 && selection[ 0 ] != null ) + { + path = ( IOUtils.dataPath + AssetDatabase.GetAssetPath( selection[ 0 ] ) ); + } + else + { + path = Application.dataPath; + } + + } + + if( path.IndexOf( '.' ) > -1 ) + { + path = path.Substring( 0, path.LastIndexOf( '/' ) ); + } + path += "/"; + } + else + { + path = customPath; + } + + if( IOUtils.AllOpenedWindows.Count > 0 ) + { + EditorWindow openedWindow = AmplifyShaderEditorWindow.GetWindow(); + AmplifyShaderEditorWindow currentWindow = CreateTab(); + WindowHelper.AddTab( openedWindow, currentWindow ); + UIUtils.CurrentWindow = currentWindow; + Shader shader = UIUtils.CreateNewEmpty( path, customShaderName ); + Selection.activeObject = shader; + } + else + { + AmplifyShaderEditorWindow currentWindow = OpenWindow(); + UIUtils.CurrentWindow = currentWindow; + Shader shader = UIUtils.CreateNewEmpty( path, customShaderName ); + Selection.activeObject = shader; + } + //Selection.objects = new UnityEngine.Object[] { shader }; + } + + public static void CreateConfirmationTemplateShader( string templateGuid ) + { + UIUtils.NewTemplateGUID = templateGuid; + //string path = AssetDatabase.GetAssetPath( Selection.activeObject ); + //if( path == "" ) + //{ + // path = "Assets"; + //} + //else if( System.IO.Path.GetExtension( path ) != "" ) + //{ + // path = path.Replace( System.IO.Path.GetFileName( AssetDatabase.GetAssetPath( Selection.activeObject ) ), "" ); + //} + + //string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath( path + "/New Amplify Shader.shader" ); + var endNameEditAction = ScriptableObject.CreateInstance(); + ProjectWindowUtil.StartNameEditingIfProjectWindowExists( 0, endNameEditAction, "New Amplify Shader.shader"/*assetPathAndName*/, AssetPreview.GetMiniTypeThumbnail( typeof( Shader ) ), null ); + } + + public static Shader CreateNewTemplateShader( string templateGUID , string customPath = null, string customShaderName = null ) + { + string path = string.Empty; + if( string.IsNullOrEmpty( customPath ) ) + { + path = Selection.activeObject == null ? Application.dataPath : ( IOUtils.dataPath + AssetDatabase.GetAssetPath( Selection.activeObject ) ); + if( path.IndexOf( '.' ) > -1 ) + { + path = path.Substring( 0, path.LastIndexOf( '/' ) ); + } + path += "/"; + } + else + { + path = customPath; + } + Shader shader = null; + if( IOUtils.AllOpenedWindows.Count > 0 ) + { + EditorWindow openedWindow = AmplifyShaderEditorWindow.GetWindow(); + AmplifyShaderEditorWindow currentWindow = CreateTab(); + WindowHelper.AddTab( openedWindow, currentWindow ); + UIUtils.CurrentWindow = currentWindow; + shader = UIUtils.CreateNewEmptyTemplate( templateGUID, path, customShaderName ); + Selection.activeObject = shader; + } + else + { + AmplifyShaderEditorWindow currentWindow = OpenWindow(); + UIUtils.CurrentWindow = currentWindow; + shader = UIUtils.CreateNewEmptyTemplate( templateGUID, path, customShaderName ); + Selection.activeObject = shader; + } + + //Selection.objects = new UnityEngine.Object[] { shader }; + return shader; + } + + [MenuItem( "Assets/Create/Amplify Shader Function", false, 84 )] + [MenuItem( "Assets/Create/Shader/Amplify Shader Function" )] + static void CreateNewShaderFunction() + { + AmplifyShaderFunction asset = ScriptableObject.CreateInstance(); + + //string path = AssetDatabase.GetAssetPath( Selection.activeObject ); + //if( path == "" ) + //{ + // path = "Assets"; + //} + //else if( System.IO.Path.GetExtension( path ) != "" ) + //{ + // path = path.Replace( System.IO.Path.GetFileName( AssetDatabase.GetAssetPath( Selection.activeObject ) ), "" ); + //} + + //string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath( path + "/New ShaderFunction.asset" ); + + var endNameEditAction = ScriptableObject.CreateInstance(); + ProjectWindowUtil.StartNameEditingIfProjectWindowExists( asset.GetInstanceID(), endNameEditAction, "New ShaderFunction.asset"/*assetPathAndName*/, AssetPreview.GetMiniThumbnail( asset ), null ); + } + + public void UpdateTabTitle( string newTitle, bool modified ) + { + string[] titleArray = newTitle.Split( '/' ); + newTitle = titleArray[ titleArray.Length - 1 ]; + + if( !( m_currentTitle.Equals( newTitle ) && m_currentTitleMod == modified ) ) + { + this.titleContent.text = GenerateTabTitle( newTitle, modified ); + } + m_currentTitle = newTitle; + m_currentTitleMod = modified; + } + + public void OnProjectWindowChanged() + { + Shader selectedShader = Selection.activeObject as Shader; + if( selectedShader != null ) + { + if( m_mainGraphInstance != null && m_mainGraphInstance.CurrentMasterNode != null && selectedShader == m_mainGraphInstance.CurrentMasterNode.CurrentShader ) + { + m_lastOpenedLocation = AssetDatabase.GetAssetPath( selectedShader ); + } + } + } + + public void LoadProjectSelected( UnityEngine.Object selectedObject = null ) + { + bool hasFocus = true; + if( EditorWindow.focusedWindow != this ) + { + hasFocus = false; + } + + if( hasFocus && m_mainGraphInstance != null && m_mainGraphInstance.CurrentMasterNode != null ) + { + LoadObject( selectedObject ?? Selection.activeObject ); + } + else + { + m_delayedLoadObject = selectedObject ?? Selection.activeObject; + } + + if( !hasFocus ) + Focus(); + } + + public void LoadObject( UnityEngine.Object objToLoad ) + { + Shader selectedShader = objToLoad as Shader; + Material selectedMaterial = objToLoad as Material; + AmplifyShaderFunction selectedFunction = objToLoad as AmplifyShaderFunction; + + if( selectedFunction != null ) + { + IsShaderFunctionWindow = true; + m_mainGraphInstance.CurrentCanvasMode = NodeAvailability.ShaderFunction; + } + else + { + IsShaderFunctionWindow = false; + } + + ASESelectionMode selectedFileType = ASESelectionMode.Shader; + if( selectedShader != null ) + { + selectedFileType = ASESelectionMode.Shader; + } + else if( selectedMaterial != null ) + { + selectedFileType = ASESelectionMode.Material; + } + else if( selectedFunction != null ) + { + selectedFileType = ASESelectionMode.ShaderFunction; + } + + + switch( CurrentSelection ) + { + case ASESelectionMode.Shader: + { + if( ShaderIsModified ) + { + Shader currShader = m_mainGraphInstance.CurrentMasterNode.CurrentShader; + bool savePrevious = UIUtils.DisplayDialog( AssetDatabase.GetAssetPath( currShader ) ); + OnSaveShader( savePrevious, currShader, null, null ); + } + } + break; + case ASESelectionMode.Material: + { + if( ShaderIsModified ) + { + Shader currShader = m_mainGraphInstance.CurrentMasterNode.CurrentShader; + bool savePrevious = UIUtils.DisplayDialog( AssetDatabase.GetAssetPath( currShader ) ); + OnSaveShader( savePrevious, currShader, m_mainGraphInstance.CurrentMasterNode.CurrentMaterial, null ); + } + } + break; + case ASESelectionMode.ShaderFunction: + { + if( ShaderIsModified ) + { + bool savePrevious = UIUtils.DisplayDialog( AssetDatabase.GetAssetPath( m_mainGraphInstance.CurrentShaderFunction ) ); + OnSaveShader( savePrevious, null, null, selectedFunction ); + } + } + break; + } + + switch( selectedFileType ) + { + case ASESelectionMode.Shader: + { + LoadDroppedObject( true, selectedShader, null ); + } + break; + case ASESelectionMode.Material: + { + LoadDroppedObject( true, selectedMaterial.shader, selectedMaterial ); + } + break; + case ASESelectionMode.ShaderFunction: + { + LoadDroppedObject( true, null, null, selectedFunction ); + } + break; + } + + //m_openedShaderFunction = m_mainGraphInstance.CurrentShaderFunction; + + //Need to force one graph draw because it wont call OnGui propertly since its focuses somewhere else + // Focus() doesn't fix this since it only changes keyboard focus + m_drawInfo.InvertedZoom = 1 / m_cameraZoom; + + m_mainGraphInstance.IsLoading = true; + m_mainGraphInstance.Draw( m_drawInfo ); + m_mainGraphInstance.IsLoading = false; + ShaderIsModified = false; + Focus(); + Repaint(); + } + + public void OnProjectSelectionChanged() + { + if( m_loadShaderOnSelection ) + { + LoadProjectSelected(); + } + } + + ShaderLoadResult OnSaveShader( bool value, Shader shader, Material material, AmplifyShaderFunction function ) + { + if( value ) + { + SaveToDisk( false ); + } + + return value ? ShaderLoadResult.LOADED : ShaderLoadResult.FILE_NOT_FOUND; + } + + public void ResetCameraSettings() + { + m_cameraInfo = position; + m_cameraOffset = new Vector2( m_cameraInfo.width * 0.5f, m_cameraInfo.height * 0.5f ); + CameraZoom = 1; + } + + public void Reset() + { + if( m_mainGraphInstance == null ) + { + m_mainGraphInstance = CreateInstance(); + m_mainGraphInstance.Init(); + m_mainGraphInstance.ParentWindow = this; + m_mainGraphInstance.SetGraphId( 0 ); + } + m_mainGraphInstance.ResetEvents(); + m_mainGraphInstance.OnNodeEvent += OnNodeStoppedMovingEvent; + m_mainGraphInstance.OnMaterialUpdatedEvent += OnMaterialUpdated; + m_mainGraphInstance.OnShaderUpdatedEvent += OnShaderUpdated; + m_mainGraphInstance.OnEmptyGraphDetectedEvt += OnEmptyGraphDetected; + m_mainGraphInstance.OnNodeRemovedEvent += m_toolsWindow.OnNodeRemovedFromGraph; + m_outdatedShaderFromTemplateLoaded = false; + GraphCount = 1; + + FullCleanUndoStack(); + m_performFullUndoRegister = true; + m_toolsWindow.BorderStyle = null; + m_selectionMode = ASESelectionMode.Shader; + ResetCameraSettings(); + UIUtils.ResetMainSkin(); + m_duplicatePreventionBuffer.ReleaseAllData(); + if( m_genericMessageUI != null ) + m_genericMessageUI.CleanUpMessageStack(); + } + + + public Shader CreateNewGraph( string name ) + { + Reset(); + UIUtils.DirtyMask = false; + m_mainGraphInstance.CreateNewEmpty( name ); + m_lastOpenedLocation = string.Empty; + UIUtils.DirtyMask = true; + return m_mainGraphInstance.CurrentMasterNode.CurrentShader; + } + + public Shader CreateNewTemplateGraph( string templateGUID ) + { + Reset(); + UIUtils.DirtyMask = false; + m_mainGraphInstance.CreateNewEmptyTemplate( templateGUID ); + m_lastOpenedLocation = string.Empty; + UIUtils.DirtyMask = true; + return m_mainGraphInstance.CurrentMasterNode.CurrentShader; + } + + public Shader CreateNewGraph( Shader shader ) + { + Reset(); + UIUtils.DirtyMask = false; + m_mainGraphInstance.CreateNewEmpty( shader.name ); + m_mainGraphInstance.CurrentMasterNode.CurrentShader = shader; + + m_lastOpenedLocation = string.Empty; + UIUtils.DirtyMask = true; + return m_mainGraphInstance.CurrentMasterNode.CurrentShader; + } + + public void CreateNewFunctionGraph( AmplifyShaderFunction shaderFunction ) + { + Reset(); + UIUtils.DirtyMask = false; + m_mainGraphInstance.CreateNewEmptyFunction( shaderFunction ); + m_mainGraphInstance.CurrentShaderFunction = shaderFunction; + + m_lastOpenedLocation = AssetDatabase.GetAssetPath( shaderFunction ); //string.Empty; + UIUtils.DirtyMask = true; + //return m_mainGraphInstance.CurrentMasterNode.CurrentShader; + } + + private void FinishedShaderCompileLog( double compileTimeInSeconds ) + { + string name = string.Empty; + if ( m_mainGraphInstance.CurrentShader != null ) + { + name = " \"" + AssetDatabase.GetAssetPath( m_mainGraphInstance.CurrentShader ) + "\""; + } + else if ( m_mainGraphInstance.CurrentShaderFunction != null ) + { + name = " \"" + AssetDatabase.GetAssetPath( m_mainGraphInstance.CurrentShaderFunction ) + "\""; + } + Debug.Log( "[AmplifyShaderEditor] Finished compiling" + name + " in " + compileTimeInSeconds.ToString( "0.00" ) + " seconds." ); + } + + public bool SaveToDisk( bool checkTimestamp ) + { + if( checkTimestamp ) + { + if( !m_cacheSaveOp ) + { + m_lastTimeSaved = EditorApplication.timeSinceStartup; + m_cacheSaveOp = true; + } + return false; + } + + FullCleanUndoStack(); + + System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; + + var timer = new System.Diagnostics.Stopwatch(); + timer.Start(); + + m_customGraph = null; + m_cacheSaveOp = false; + ShaderIsModified = false; + m_mainGraphInstance.LoadedShaderVersion = VersionInfo.FullNumber; + m_lastTimeSaved = EditorApplication.timeSinceStartup; + + bool succeeded = false; + + if ( m_mainGraphInstance.CurrentMasterNodeId == Constants.INVALID_NODE_ID ) + { + Shader currentShader = m_mainGraphInstance.CurrentMasterNode != null ? m_mainGraphInstance.CurrentMasterNode.CurrentShader : null; + string newShader; + if( !String.IsNullOrEmpty( m_lastOpenedLocation ) ) + { + newShader = m_lastOpenedLocation; + } + else if( currentShader != null ) + { + newShader = AssetDatabase.GetAssetPath( currentShader ); + } + else + { + newShader = EditorUtility.SaveFilePanel( "Select Shader to save", Application.dataPath, "MyShader", "shader" ); + } + + if( !String.IsNullOrEmpty( newShader ) ) + { + ShowMessage( "No Master node assigned.\nShader file will only have node info" ); + IOUtils.StartSaveThread( GenerateGraphInfo(), newShader ); + AssetDatabase.Refresh(); + LoadFromDisk( newShader ); + succeeded = true; + } + } + else if( m_mainGraphInstance.CurrentMasterNode != null ) + { + //m_mainGraphInstance.CurrentStandardSurface.ForceReordering(); + Shader currShader = m_mainGraphInstance.CurrentMasterNode.CurrentShader; + if( currShader != null ) + { + m_mainGraphInstance.FireMasterNode( currShader ); + Material material = m_mainGraphInstance.CurrentMaterial; + m_lastpath = ( material != null ) ? AssetDatabase.GetAssetPath( material ) : AssetDatabase.GetAssetPath( currShader ); + EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, m_lastpath ); + if( IOUtils.OnShaderSavedEvent != null ) + { + string info = string.Empty; + if( !m_mainGraphInstance.IsStandardSurface ) + { + TemplateMultiPassMasterNode masterNode = m_mainGraphInstance.GetMainMasterNodeOfLOD( -1 ); + if( masterNode != null ) + { + info = masterNode.CurrentTemplate.GUID; + } + } + IOUtils.OnShaderSavedEvent( currShader, !m_mainGraphInstance.IsStandardSurface, info ); + } + succeeded = true; + } + else + { + + string shaderName; + string pathName; + IOUtils.GetShaderName( out shaderName, out pathName, Constants.DefaultShaderName, UIUtils.LatestOpenedFolder ); + if( !String.IsNullOrEmpty( pathName ) ) + { + UIUtils.CurrentWindow.CurrentGraph.CurrentMasterNode.SetName( shaderName ); + m_mainGraphInstance.FireMasterNode( pathName, true ); + m_lastpath = pathName; + EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, pathName ); + succeeded = true; + } + } + } + else + { + //m_nodeParametersWindow.ForceReordering(); + m_mainGraphInstance.ResetNodesLocalVariables(); + + List functionInputNodes = UIUtils.FunctionInputList(); + functionInputNodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + for( int i = 0; i < functionInputNodes.Count; i++ ) + { + functionInputNodes[ i ].OrderIndex = i; + } + + List functionOutputNodes = UIUtils.FunctionOutputList(); + functionOutputNodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + for( int i = 0; i < functionOutputNodes.Count; i++ ) + { + functionOutputNodes[ i ].OrderIndex = i; + } + + m_mainGraphInstance.CurrentShaderFunction.AdditionalDirectives.UpdateSaveItemsFromDirectives(); + m_mainGraphInstance.CurrentShaderFunction.FunctionInfo = GenerateGraphInfo(); + m_mainGraphInstance.CurrentShaderFunction.FunctionInfo = IOUtils.AddAdditionalInfo( m_mainGraphInstance.CurrentShaderFunction.FunctionInfo ); + + if( AssetDatabase.IsMainAsset( m_mainGraphInstance.CurrentShaderFunction ) ) + { + EditorUtility.SetDirty( m_mainGraphInstance.CurrentShaderFunction ); + } + else + { + //Debug.Log( LastOpenedLocation ); + //AssetDatabase.CreateAsset( m_mainGraphInstance.CurrentShaderFunction, LastOpenedLocation ); + } + + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + m_mainGraphInstance.CurrentShaderFunction.AdditionalDirectives.UpdateDirectivesFromSaveItems(); + IOUtils.FunctionNodeChanged = true; + m_lastpath = AssetDatabase.GetAssetPath( m_mainGraphInstance.CurrentShaderFunction ); + //EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, AssetDatabase.GetAssetPath( m_mainGraphInstance.CurrentShaderFunction ) ); + succeeded = true; + } + + timer.Stop(); + if ( Preferences.User.LogShaderCompile ) + { + FinishedShaderCompileLog( timer.Elapsed.TotalSeconds ); + } + + System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; + return succeeded; + } + + public void OnToolButtonPressed( ToolButtonType type ) + { + switch( type ) + { + case ToolButtonType.New: + { + UIUtils.CreateNewEmpty(); + } + break; + case ToolButtonType.Open: + { + UIUtils.OpenFile(); + } + break; + case ToolButtonType.Save: + { + SaveToDisk( false ); + } + break; + case ToolButtonType.Library: + { + ShowShaderLibrary(); + } + break; + case ToolButtonType.Options: { } break; + case ToolButtonType.Update: + { + if( Preferences.User.ClearLog ) + { + m_consoleLogWindow.ClearMessages(); + } + SaveToDisk( false ); + } + break; + case ToolButtonType.Live: + { + m_liveShaderEditing = !m_liveShaderEditing; + m_innerEditorVariables.LiveMode = m_liveShaderEditing; + // 0 off + // 1 on + // 2 pending + if( m_liveShaderEditing && m_mainGraphInstance.CurrentMasterNode != null && m_mainGraphInstance.CurrentMasterNode.CurrentShader == null ) + { + m_liveShaderEditing = false; + m_innerEditorVariables.LiveMode = false; + } + + UpdateLiveUI(); + + if( m_liveShaderEditing ) + { + SaveToDisk( false ); + } + } + break; + case ToolButtonType.OpenSourceCode: + { + AssetDatabase.OpenAsset( m_mainGraphInstance.CurrentMasterNode.CurrentShader, 1 ); + } + break; + case ToolButtonType.MasterNode: + { + m_mainGraphInstance.AssignMasterNode(); + } + break; + + case ToolButtonType.FocusOnMasterNode: + { + double currTime = EditorApplication.timeSinceStartup; + bool autoZoom = ( currTime - m_focusOnMasterNodeTimestamp ) < AutoZoomTime; + m_focusOnMasterNodeTimestamp = currTime; + FocusOnNode( m_mainGraphInstance.CurrentMasterNode, autoZoom ? 1 : m_cameraZoom, true ); + } + break; + + case ToolButtonType.FocusOnSelection: + { + FocusZoom( false, true, true ); + } + break; + case ToolButtonType.ShowInfoWindow: + { + PortLegendInfo.OpenWindow(); + } + break; + case ToolButtonType.ShowTipsWindow: + { + TipsWindow.ShowWindow( true ); + } + break; + case ToolButtonType.ShowConsole: + { + m_consoleLogWindow.Toggle(); + } + break; + case ToolButtonType.Share: + { + List selectedNodes = m_mainGraphInstance.SelectedNodes; + if ( selectedNodes.Count > 0 ) + { + CopyToClipboard(); + StartPasteRequest(); + } + else + { + ShowMessage( "No nodes selected to share" ); + } + } + break; + case ToolButtonType.TakeScreenshot: + { +#if UNITY_EDITOR_WIN + this.Focus(); + m_aseHandle = WindowsUtil.GetActiveWindow(); + //m_aseHandle = FindASEWindowHandle(); + + bool takeit = EditorUtility.DisplayDialog( "Take Screenshot", "This is a work in progress feature that will undock itself if needed, increase the window outside of your screen resolution to take the shot, if something fails (ie: graph too big) you may need to restart Unity, do you wish to continue?", "Yes", "Cancel" ); + if( !takeit ) + break; + + if( this.IsDocked() ) + { + this.Undock(); + this.Focus(); + m_aseHandle = WindowsUtil.GetActiveWindow(); + } + + int windowLong = WindowsUtil.GetWindowLong( m_aseHandle, WindowsUtil.GWL_STYLE ); + + List selectedNodes = m_mainGraphInstance.AllNodes; + + Vector2 minPos = new Vector2( float.MaxValue, float.MaxValue ); + Vector2 maxPos = new Vector2( float.MinValue, float.MinValue ); + Vector2 centroid = Vector2.zero; + + for( int i = 0; i < selectedNodes.Count; i++ ) + { + Rect currPos = selectedNodes[ i ].TruePosition; + minPos.x = ( currPos.x < minPos.x ) ? currPos.x : minPos.x; + minPos.y = ( currPos.y < minPos.y ) ? currPos.y : minPos.y; + + maxPos.x = ( ( currPos.x + currPos.width ) > maxPos.x ) ? ( currPos.x + currPos.width ) : maxPos.x; + maxPos.y = ( ( currPos.y + currPos.height ) > maxPos.y ) ? ( currPos.y + currPos.height ) : maxPos.y; + } + + centroid = ( maxPos - minPos ); + + m_prevCameraOffset = m_cameraOffset; + m_prevCameraZoom = CameraZoom; + + WindowsUtil.SetWindowLong( m_aseHandle, WindowsUtil.GWL_STYLE, (int)( windowLong & ~( WindowsUtil.WS_SIZEBOX ) ) ); + var rect = new WindowsUtil.Rect(); + WindowsUtil.GetWindowRect( m_aseHandle, ref rect ); + m_prevWindowRect = new Rect( rect.Left, rect.Top, rect.Width, rect.Height ); + + WindowsUtil.SetWindowPos( m_aseHandle, 0, (int)m_prevWindowRect.xMin, (int)m_prevWindowRect.yMin, (int)centroid.x, (int)centroid.y, 0x0040 ); + WindowsUtil.SetWindowLong( m_aseHandle, WindowsUtil.GWL_STYLE, (int)( windowLong ) ); + + m_takeScreenShot = true; +#else + EditorUtility.DisplayDialog( "Take Screenshot", "This is a work in progress feature that only works in Windows environment", "Ok" ); +#endif + } + break; + case ToolButtonType.CleanUnusedNodes: + { + m_mainGraphInstance.CleanUnusedNodes(); + } + break; + case ToolButtonType.Help: + { + Application.OpenURL( Constants.HelpURL ); + } + break; + } + } + +#if UNITY_EDITOR_WIN + IntPtr FindASEWindowHandle() + { + System.Diagnostics.Process process = System.Diagnostics.Process.GetCurrentProcess(); + + IntPtr[] winPtrs = WindowsUtil.GetProcessWindows( process.Id ); + m_aseHandle = IntPtr.Zero; + bool found = false; + for( int i = 0; i < winPtrs.Length; i++ ) + { + WindowsUtil.EnumChildWindows( winPtrs[ i ], delegate ( System.IntPtr hwnd, System.IntPtr param ) + { + System.Text.StringBuilder Title = new System.Text.StringBuilder( 256 ); + WindowsUtil.GetWindowText( hwnd, Title, Title.Capacity ); + + if( Title.ToString().Contains( "AmplifyShaderEditor.AmplifyShaderEditorWindow" ) ) + { + if( !found ) + { + m_aseHandle = winPtrs[ i ]; + found = true; + } + } + + return true; + }, System.IntPtr.Zero ); + } + + return m_aseHandle; + } + + void OpenSavedFolder() + { + m_openSavedFolder = false; + + var path = System.IO.Path.GetFullPath( Application.dataPath + "\\..\\ScreenshotASE.png" ); + EditorUtility.RevealInFinder( path ); + GUIUtility.ExitGUI(); + } + + void TakeScreenShot() + { + m_takeScreenShot = false; + + var cacher = RenderTexture.active; + RenderTexture.active = null; + + Texture2D m_screenshotTex2D = new Texture2D( (int)position.width, (int)position.height, TextureFormat.RGB24, false ); + m_screenshotTex2D.ReadPixels( new Rect( 0, 0, m_screenshotTex2D.width, m_screenshotTex2D.height ), 0, 0 ); + m_screenshotTex2D.Apply(); + + byte[] bytes = m_screenshotTex2D.EncodeToPNG(); + + var path = System.IO.Path.GetFullPath( Application.dataPath + "\\..\\ScreenshotASE.png" ); + System.IO.File.WriteAllBytes( path, bytes ); + + RenderTexture.active = cacher; + + ShowMessage( "[AmplifyShaderEditor] Screenshot successfully taken and saved at: " + path, consoleLog:true ); + + WindowsUtil.SetWindowPos( m_aseHandle, 0, (int)m_prevWindowRect.xMin, (int)m_prevWindowRect.yMin, (int)m_prevWindowRect.width, (int)m_prevWindowRect.height, 0x0040 ); + m_cameraOffset = m_prevCameraOffset; + CameraZoom = m_prevCameraZoom; + + m_openSavedFolder = true; + } +#endif + + + void UpdateLiveUI() + { + if( m_toolsWindow != null ) + { + m_toolsWindow.SetStateOnButton( ToolButtonType.Live, ( m_liveShaderEditing ) ? 1 : 0 ); + } + } + + void FocusZoom( bool forceAllNodes, bool doubleTap, bool smooth = true, float maxZoom = float.MaxValue ) + { + List selectedNodes = ( m_mainGraphInstance.SelectedNodes.Count > 0 ) && !forceAllNodes ? m_mainGraphInstance.SelectedNodes : m_mainGraphInstance.AllNodes; + + Vector2 minPos = new Vector2( float.MaxValue, float.MaxValue ); + Vector2 maxPos = new Vector2( float.MinValue, float.MinValue ); + Vector2 centroid = Vector2.zero; + + for( int i = 0; i < selectedNodes.Count; i++ ) + { + Rect currPos = selectedNodes[ i ].TruePosition; + + minPos.x = ( currPos.x < minPos.x ) ? currPos.x : minPos.x; + minPos.y = ( currPos.y < minPos.y ) ? currPos.y : minPos.y; + + maxPos.x = ( ( currPos.x + currPos.width ) > maxPos.x ) ? ( currPos.x + currPos.width ) : maxPos.x; + maxPos.y = ( ( currPos.y + currPos.height ) > maxPos.y ) ? ( currPos.y + currPos.height ) : maxPos.y; + + } + + centroid = ( maxPos - minPos ); + + double currTime = EditorApplication.timeSinceStartup; + bool autoZoom = ( currTime - m_focusOnSelectionTimestamp ) < AutoZoomTime; + if( !doubleTap ) + autoZoom = true; + m_focusOnSelectionTimestamp = currTime; + + float zoom = m_cameraZoom; + if( autoZoom ) + { + zoom = 1f; + float canvasWidth = m_cameraInfo.width; + if( m_nodeParametersWindow.IsMaximized ) + canvasWidth -= m_nodeParametersWindow.RealWidth; + if( m_paletteWindow.IsMaximized ) + canvasWidth -= m_paletteWindow.RealWidth; + canvasWidth -= 40; + //float canvasWidth = AvailableCanvasWidth;// - 20; + float canvasHeight = AvailableCanvasHeight - 60; + if( centroid.x > canvasWidth || + centroid.y > canvasHeight ) + { + float hZoom = float.MinValue; + float vZoom = float.MinValue; + if( centroid.x > canvasWidth ) + { + hZoom = ( centroid.x ) / canvasWidth; + } + + if( centroid.y > canvasHeight ) + { + vZoom = ( centroid.y ) / canvasHeight; + } + zoom = ( hZoom > vZoom ) ? hZoom : vZoom; + } + } + + zoom = Mathf.Min( zoom, maxZoom ); + + minPos.y -= 20 * zoom; + if( m_nodeParametersWindow.IsMaximized ) + minPos.x -= m_nodeParametersWindow.RealWidth * 0.5f * zoom; + if( m_paletteWindow.IsMaximized ) + minPos.x += m_paletteWindow.RealWidth * 0.5f * zoom; + + FocusOnPoint( minPos + centroid * 0.5f, zoom, smooth ); + } + + public void FocusOnNode( int nodeId, float zoom, bool selectNode, bool late = false ) + { + ParentNode node = m_mainGraphInstance.GetNode( nodeId ); + if( node != null ) + { + FocusOnNode( node, zoom, selectNode, late ); + } + } + + public void FocusOnNode( ParentNode node, float zoom, bool selectNode, bool late = false ) + { + if( late ) + { + m_nodeToFocus = node; + m_zoomToFocus = zoom; + m_selectNodeToFocus = selectNode; + return; + } + + if( selectNode ) + { + m_mainGraphInstance.SelectNode( node, false, false ); + } + + Vector2 nodePoint = node.CenterPosition; + nodePoint.x = nodePoint.x - ( m_nodeParametersWindow.RealWidth * 0.5f + m_paletteWindow.RealWidth * 0.5f ) * ( zoom > 0.999f ? zoom : CameraZoom ); + FocusOnPoint( nodePoint, zoom ); + } + + public void FocusOnPoint( Vector2 point, float zoom, bool smooth = true ) + { + if( zoom > 0.999f ) + { + if( smooth ) + SmoothZoom( zoom ); + else + CameraZoom = zoom; + } + + if( smooth ) + SmoothCameraOffset( -point + new Vector2( ( m_cameraInfo.width ) * 0.5f, m_cameraInfo.height * 0.5f ) * CameraZoom ); + else + m_cameraOffset = -point + new Vector2( ( m_cameraInfo.width ) * 0.5f, m_cameraInfo.height * 0.5f ) * CameraZoom; + } + + void SmoothZoom( float newZoom ) + { + m_smoothZoom = true; + m_zoomTime = 0; + m_targetZoom = newZoom; + m_zoomPivot = m_graphArea.center; + } + + void SmoothCameraOffset( Vector2 newOffset ) + { + m_smoothOffset = true; + m_offsetTime = 0; + m_targetOffset = newOffset; + } + + void PreTestLeftMouseDown() + { + if( m_currentEvent.type == EventType.MouseDown && m_currentEvent.button == ButtonClickId.LeftMouseButton ) + { + ParentNode node = m_mainGraphInstance.CheckNodeAt( m_currentMousePos ); + if( node != null ) + { + m_mainGraphInstance.NodeClicked = node.UniqueId; + return; + } + } + + m_mainGraphInstance.NodeClicked = -1; + } + + + + void OnLeftMouseDown() + { + Focus(); + + if( m_lastKeyPressed == KeyCode.Q ) + { + m_rmbStartPos = m_currentMousePos2D; + UseCurrentEvent(); + return; + } + + m_mouseDownOnValidArea = true; + m_lmbPressed = true; + if( m_currentEvent.alt ) + { + m_altBoxSelection = true; + } + + UIUtils.ShowContextOnPick = true; + ParentNode node = ( m_mainGraphInstance.NodeClicked < 0 ) ? m_mainGraphInstance.CheckNodeAt( m_currentMousePos ) : m_mainGraphInstance.GetClickedNode(); + if( node != null ) + { + m_mainGraphInstance.NodeClicked = node.UniqueId; + m_altBoxSelection = false; + + if( m_contextMenu.CheckShortcutKey() ) + { + if( node.ConnStatus == NodeConnectionStatus.Island ) + { + if( !m_multipleSelectionActive ) + { + ParentNode newNode = m_contextMenu.CreateNodeFromShortcutKey(); + if( newNode != null ) + { + newNode.ContainerGraph = m_mainGraphInstance; + newNode.Vec2Position = TranformedMousePos; + m_mainGraphInstance.AddNode( newNode, true ); + m_mainGraphInstance.SelectNode( newNode, false, false ); + ForceRepaint(); + } + ( node as CommentaryNode ).AddNodeToCommentary( newNode ); + } + } + } + else + { + if( node.OnClick( m_currentMousePos2D ) ) + { + if( !node.Selected ) + { + m_mainGraphInstance.SelectNode( node, ( m_currentEvent.modifiers == EventModifiers.Shift || m_currentEvent.modifiers == EventModifiers.Control ), true ); + } + else if( m_currentEvent.modifiers == EventModifiers.Shift || m_currentEvent.modifiers == EventModifiers.Control ) + { + m_mainGraphInstance.DeselectNode( node ); + } + + if( m_currentEvent.alt ) + { + int conn = 0; + for( int i = 0; i < node.InputPorts.Count; i++ ) + { + if( node.InputPorts[ i ].IsConnected ) + conn++; + } + + if( node.InputPorts.Count > 0 && node.OutputPorts.Count > 0 && conn > 0 && node.OutputPorts[ 0 ].IsConnected ) + { + m_altDragStarted = true; + } + } + + } + + if( m_currentEvent.alt ) + { + if( node.InputPorts.Count > 0 && node.OutputPorts.Count > 0 && node.InputPorts[ 0 ].IsConnected && node.OutputPorts[ 0 ].IsConnected ) + { + m_altDragStarted = true; + } + } + + return; + } + } + else if( !m_multipleSelectionActive ) + { + ParentNode newNode = m_contextMenu.CreateNodeFromShortcutKey(); + if( newNode != null ) + { + newNode.ContainerGraph = m_mainGraphInstance; + newNode.Vec2Position = TranformedMousePos; + m_mainGraphInstance.AddNode( newNode, true ); + m_mainGraphInstance.SelectNode( newNode, false, false ); + SetSaveIsDirty(); + ForceRepaint(); + } + else + { + List wireRefs = m_mainGraphInstance.GetWireBezierListInPos( m_currentMousePos2D ); + if( wireRefs != null && wireRefs.Count > 0 ) + { + for( int i = 0; i < wireRefs.Count; i++ ) + { + // Place wire code here + ParentNode outNode = m_mainGraphInstance.GetNode( wireRefs[ i ].OutNodeId ); + ParentNode inNode = m_mainGraphInstance.GetNode( wireRefs[ i ].InNodeId ); + + OutputPort outputPort = outNode.GetOutputPortByUniqueId( wireRefs[ i ].OutPortId ); + InputPort inputPort = inNode.GetInputPortByUniqueId( wireRefs[ i ].InPortId ); + + // Calculate the 4 points for bezier taking into account wire nodes and their automatic tangents + Vector3 endPos = new Vector3( inputPort.Position.x, inputPort.Position.y ); + Vector3 startPos = new Vector3( outputPort.Position.x, outputPort.Position.y ); + + float mag = ( endPos - startPos ).magnitude; + float resizedMag = Mathf.Min( mag, Constants.HORIZONTAL_TANGENT_SIZE * m_drawInfo.InvertedZoom ); + + Vector3 startTangent = new Vector3( startPos.x + resizedMag, startPos.y ); + Vector3 endTangent = new Vector3( endPos.x - resizedMag, endPos.y ); + + if( inNode != null && inNode.GetType() == typeof( WireNode ) ) + endTangent = endPos + ( ( inNode as WireNode ).TangentDirection ) * mag * 0.33f; + + if( outNode != null && outNode.GetType() == typeof( WireNode ) ) + startTangent = startPos - ( ( outNode as WireNode ).TangentDirection ) * mag * 0.33f; + + float dist = HandleUtility.DistancePointBezier( m_currentMousePos, startPos, endPos, startTangent, endTangent ); + if( dist < 10 ) + { + double doubleTapTime = EditorApplication.timeSinceStartup; + bool doubleTap = ( doubleTapTime - m_wiredDoubleTapTimestamp ) < WiredDoubleTapTime; + m_wiredDoubleTapTimestamp = doubleTapTime; + + if( doubleTap ) + { + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoCreateConnectionId ); + UndoUtils.RegisterCompleteObjectUndo( m_mainGraphInstance, Constants.UndoCreateConnectionId ); + UndoUtils.RecordObject( outNode, Constants.UndoCreateConnectionId ); + UndoUtils.RecordObject( inNode, Constants.UndoCreateConnectionId ); + + ParentNode wireNode = m_mainGraphInstance.CreateNode( typeof( WireNode ), true ); + if( wireNode != null ) + { + wireNode.Vec2Position = TranformedMousePos; + + m_mainGraphInstance.CreateConnection( wireNode.InputPorts[ 0 ].NodeId, wireNode.InputPorts[ 0 ].PortId, outputPort.NodeId, outputPort.PortId ); + m_mainGraphInstance.CreateConnection( inputPort.NodeId, inputPort.PortId, wireNode.OutputPorts[ 0 ].NodeId, wireNode.OutputPorts[ 0 ].PortId ); + + SetSaveIsDirty(); + ForceRepaint(); + UndoUtils.IncrementCurrentGroup(); + } + } + + break; + } + } + } + //Reset focus from any textfield which may be selected at this time + GUIUtility.keyboardControl = 0; + } + } + + if( m_currentEvent.modifiers != EventModifiers.Shift && m_currentEvent.modifiers != EventModifiers.Control && !m_altBoxSelection ) + m_mainGraphInstance.DeSelectAll(); + + if( m_wireReferenceUtils.ValidReferences() ) + { + m_wireReferenceUtils.InvalidateReferences(); + return; + } + + if( !m_contextMenu.CheckShortcutKey() && m_currentEvent.modifiers != EventModifiers.Shift && m_currentEvent.modifiers != EventModifiers.Control || m_altBoxSelection ) + { + // Only activate multiple selection if no node is selected and shift key not pressed + m_multipleSelectionActive = true; + + m_multipleSelectionStart = TranformedMousePos; + m_multipleSelectionArea.position = m_multipleSelectionStart; + m_multipleSelectionArea.size = Vector2.zero; + } + + UseCurrentEvent(); + } + + void OnLeftMouseDrag() + { + if( m_lostFocus ) + { + m_lostFocus = false; + return; + } + + if( m_lastKeyPressed == KeyCode.Q ) + { + if( m_currentEvent.alt ) + { + ModifyZoom( Constants.ALT_CAMERA_ZOOM_SPEED * ( m_currentEvent.delta.x + m_currentEvent.delta.y ), m_altKeyStartPos ); + } + else + { + m_cameraOffset += m_cameraZoom * m_currentEvent.delta; + } + UseCurrentEvent(); + return; + } + + if( m_altDragStarted ) + { + m_altDragStarted = false; + + if( m_currentEvent.modifiers == EventModifiers.Alt && CurrentGraph.SelectedNodes.Count == 1 ) + { + ParentNode node = CurrentGraph.SelectedNodes[ 0 ]; + int lastId = 0; + int conn = 0; + for( int i = 0; i < node.InputPorts.Count; i++ ) + { + if( node.InputPorts[ i ].IsConnected ) + { + conn++; + lastId = i; + } + } + + if( conn > 1 ) + lastId = 0; + + + + OutputPort outputPort = node.InputPorts[ lastId ].GetOutputConnection( 0 ); + ParentNode outputNode = m_mainGraphInstance.GetNode( outputPort.NodeId ); + bool outputIsWireNode = outputNode is WireNode; + + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoCreateConnectionId ); + node.RecordObject( Constants.UndoCreateConnectionId ); + outputNode.RecordObject( Constants.UndoCreateConnectionId ); + + List inputPorts = new List(); + for( int i = 0; i < node.OutputPorts[ 0 ].ConnectionCount; i++ ) + { + InputPort inputPort = node.OutputPorts[ 0 ].GetInputConnection( i ); + ParentNode inputNode = m_mainGraphInstance.GetNode( inputPort.NodeId ); + inputNode.RecordObject( Constants.UndoCreateConnectionId ); + inputPorts.Add( inputPort ); + } + + for( int i = 0; i < inputPorts.Count; i++ ) + { + if( outputIsWireNode ) + { + if( i == 0 ) + { + m_mainGraphInstance.CreateConnection( inputPorts[ i ].NodeId, inputPorts[ i ].PortId, outputPort.NodeId, outputPort.PortId ); + } + else + { + UIUtils.DeleteConnection( true, inputPorts[ i ].NodeId, inputPorts[ i ].PortId, false, true ); + } + } + else + { + m_mainGraphInstance.CreateConnection( inputPorts[ i ].NodeId, inputPorts[ i ].PortId, outputPort.NodeId, outputPort.PortId ); + } + } + + UIUtils.DeleteConnection( true, node.UniqueId, node.InputPorts[ lastId ].PortId, false, true ); + + SetSaveIsDirty(); + ForceRepaint(); + } + } + + if( !m_wireReferenceUtils.ValidReferences() && !m_altBoxSelection ) + { + if( m_mouseDownOnValidArea && m_insideEditorWindow ) + { + if( m_currentEvent.control || Preferences.User.AlwaysSnapToGrid ) + { + m_mainGraphInstance.MoveSelectedNodes( m_cameraZoom * m_currentEvent.delta, true ); + } + else + { + m_mainGraphInstance.MoveSelectedNodes( m_cameraZoom * m_currentEvent.delta ); + } + //m_mainGraphInstance.MoveSelectedNodes( m_cameraZoom * m_currentEvent.delta ); + m_autoPanDirActive = true; + } + } + else + { + List nodes = m_mainGraphInstance.GetNodesInGrid( m_drawInfo.TransformedMousePos ); + if( nodes != null && nodes.Count > 0 ) + { + Vector2 currentPortPos = new Vector2(); + Vector2 mousePos = TranformedMousePos; + + if( m_wireReferenceUtils.InputPortReference.IsValid ) + { + OutputPort currentPort = null; + float smallestDistance = float.MaxValue; + Vector2 smallestPosition = Vector2.zero; + for( int nodeIdx = 0; nodeIdx < nodes.Count; nodeIdx++ ) + { + List outputPorts = nodes[ nodeIdx ].OutputPorts; + if( outputPorts != null ) + { + for( int o = 0; o < outputPorts.Count; o++ ) + { + if( outputPorts[ o ].Available ) + { + currentPortPos.x = outputPorts[ o ].Position.x; + currentPortPos.y = outputPorts[ o ].Position.y; + + currentPortPos = currentPortPos * m_cameraZoom - m_cameraOffset; + float dist = ( mousePos - currentPortPos ).sqrMagnitude; + if( dist < smallestDistance ) + { + smallestDistance = dist; + smallestPosition = currentPortPos; + currentPort = outputPorts[ o ]; + } + } + } + } + } + + if( currentPort != null && currentPort.Available && ( smallestDistance < Constants.SNAP_SQR_DIST || currentPort.InsideActiveArea( ( mousePos + m_cameraOffset ) / m_cameraZoom ) ) ) + { + m_wireReferenceUtils.ActivateSnap( smallestPosition, currentPort ); + } + else + { + m_wireReferenceUtils.DeactivateSnap(); + } + } + + if( m_wireReferenceUtils.OutputPortReference.IsValid ) + { + InputPort currentPort = null; + float smallestDistance = float.MaxValue; + Vector2 smallestPosition = Vector2.zero; + for( int nodeIdx = 0; nodeIdx < nodes.Count; nodeIdx++ ) + { + List inputPorts = nodes[ nodeIdx ].InputPorts; + if( inputPorts != null ) + { + for( int i = 0; i < inputPorts.Count; i++ ) + { + if( inputPorts[ i ].Available ) + { + currentPortPos.x = inputPorts[ i ].Position.x; + currentPortPos.y = inputPorts[ i ].Position.y; + + currentPortPos = currentPortPos * m_cameraZoom - m_cameraOffset; + float dist = ( mousePos - currentPortPos ).sqrMagnitude; + if( dist < smallestDistance ) + { + smallestDistance = dist; + smallestPosition = currentPortPos; + currentPort = inputPorts[ i ]; + } + } + } + } + } + if( currentPort != null && currentPort.Available && ( smallestDistance < Constants.SNAP_SQR_DIST || currentPort.InsideActiveArea( ( mousePos + m_cameraOffset ) / m_cameraZoom ) ) ) + { + m_wireReferenceUtils.ActivateSnap( smallestPosition, currentPort ); + } + else + { + m_wireReferenceUtils.DeactivateSnap(); + } + } + } + else if( m_wireReferenceUtils.SnapEnabled ) + { + m_wireReferenceUtils.DeactivateSnap(); + } + } + UseCurrentEvent(); + } + + public void OnLeftMouseUp() + { + m_lmbPressed = false; + if( m_multipleSelectionActive ) + { + //m_multipleSelectionActive = false; + UpdateSelectionArea(); + //m_mainGraphInstance.MultipleSelection( m_multipleSelectionArea, ( m_currentEvent.modifiers == EventModifiers.Shift || m_currentEvent.modifiers == EventModifiers.Control ), true ); + if( m_currentEvent.alt && m_altBoxSelection ) + { + m_mainGraphInstance.MultipleSelection( m_multipleSelectionArea, !m_currentEvent.shift ); + } + else + { + m_mainGraphInstance.DeSelectAll(); + m_mainGraphInstance.MultipleSelection( m_multipleSelectionArea ); + } + } + + if( m_wireReferenceUtils.ValidReferences() ) + { + //Check if there is some kind of port beneath the mouse ... if so connect to it + ParentNode targetNode = m_wireReferenceUtils.SnapEnabled ? m_mainGraphInstance.GetNode( m_wireReferenceUtils.SnapPort.NodeId ) : m_mainGraphInstance.CheckNodeAt( m_currentMousePos ); + if( targetNode != null && targetNode.ConnStatus != NodeConnectionStatus.Island ) + { + if( m_wireReferenceUtils.InputPortReference.IsValid && m_wireReferenceUtils.InputPortReference.NodeId != targetNode.UniqueId ) + { + OutputPort outputPort = m_wireReferenceUtils.SnapEnabled ? targetNode.GetOutputPortByUniqueId( m_wireReferenceUtils.SnapPort.PortId ) : targetNode.CheckOutputPortAt( m_currentMousePos ); + if( outputPort != null && !outputPort.Locked && ( !m_wireReferenceUtils.InputPortReference.TypeLocked || + m_wireReferenceUtils.InputPortReference.DataType == WirePortDataType.OBJECT || + ( m_wireReferenceUtils.InputPortReference.TypeLocked && outputPort.DataType == m_wireReferenceUtils.InputPortReference.DataType ) ) ) + { + + ParentNode originNode = m_mainGraphInstance.GetNode( m_wireReferenceUtils.InputPortReference.NodeId ); + InputPort inputPort = originNode.GetInputPortByUniqueId( m_wireReferenceUtils.InputPortReference.PortId ); + UIUtils.MarkUndoAction(); + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoCreateConnectionId ); + originNode.RecordObject( Constants.UndoCreateConnectionId ); + targetNode.RecordObject( Constants.UndoCreateConnectionId ); + + if( inputPort.NotFreeForAllTypes && outputPort.NotFreeForAllTypes ) + { + if( !inputPort.CheckValidType( outputPort.DataType ) ) + { + UIUtils.ShowIncompatiblePortMessage( true, originNode, inputPort, targetNode, outputPort ); + m_wireReferenceUtils.InvalidateReferences(); + UseCurrentEvent(); + return; + } + + if( !outputPort.CheckValidType( inputPort.DataType ) ) + { + UIUtils.ShowIncompatiblePortMessage( false, targetNode, outputPort, originNode, inputPort ); + m_wireReferenceUtils.InvalidateReferences(); + UseCurrentEvent(); + return; + } + } + + inputPort.DummyAdd( outputPort.NodeId, outputPort.PortId ); + outputPort.DummyAdd( m_wireReferenceUtils.InputPortReference.NodeId, m_wireReferenceUtils.InputPortReference.PortId ); + + if( UIUtils.DetectNodeLoopsFrom( originNode, new Dictionary() ) ) + { + inputPort.DummyRemove(); + outputPort.DummyRemove(); + m_wireReferenceUtils.InvalidateReferences(); + ShowMessage( "Infinite Loop detected" ); + UseCurrentEvent(); + return; + } + + inputPort.DummyRemove(); + outputPort.DummyRemove(); + + if( inputPort.IsConnected ) + { + DeleteConnection( true, m_wireReferenceUtils.InputPortReference.NodeId, m_wireReferenceUtils.InputPortReference.PortId, true, false ); + } + + //link output to input + if( outputPort.ConnectTo( m_wireReferenceUtils.InputPortReference.NodeId, m_wireReferenceUtils.InputPortReference.PortId, m_wireReferenceUtils.InputPortReference.DataType, m_wireReferenceUtils.InputPortReference.TypeLocked ) ) + targetNode.OnOutputPortConnected( outputPort.PortId, m_wireReferenceUtils.InputPortReference.NodeId, m_wireReferenceUtils.InputPortReference.PortId ); + + //link input to output + if( inputPort.ConnectTo( outputPort.NodeId, outputPort.PortId, outputPort.DataType, m_wireReferenceUtils.InputPortReference.TypeLocked ) ) + originNode.OnInputPortConnected( m_wireReferenceUtils.InputPortReference.PortId, targetNode.UniqueId, outputPort.PortId ); + m_mainGraphInstance.MarkWireHighlights(); + } + else if( outputPort != null && m_wireReferenceUtils.InputPortReference.TypeLocked && m_wireReferenceUtils.InputPortReference.DataType != outputPort.DataType ) + { + ShowMessage( "Attempting to connect a port locked to type " + m_wireReferenceUtils.InputPortReference.DataType + " into a port of type " + outputPort.DataType ); + } + ShaderIsModified = true; + SetSaveIsDirty(); + } + + if( m_wireReferenceUtils.OutputPortReference.IsValid && m_wireReferenceUtils.OutputPortReference.NodeId != targetNode.UniqueId ) + { + InputPort inputPort = m_wireReferenceUtils.SnapEnabled ? targetNode.GetInputPortByUniqueId( m_wireReferenceUtils.SnapPort.PortId ) : targetNode.CheckInputPortAt( m_currentMousePos ); + if( inputPort != null && !inputPort.Locked && ( !inputPort.TypeLocked || + inputPort.DataType == WirePortDataType.OBJECT || + ( inputPort.TypeLocked && inputPort.DataType == m_wireReferenceUtils.OutputPortReference.DataType ) ) ) + { + ParentNode originNode = m_mainGraphInstance.GetNode( m_wireReferenceUtils.OutputPortReference.NodeId ); + OutputPort outputPort = originNode.GetOutputPortByUniqueId( m_wireReferenceUtils.OutputPortReference.PortId ); + + UIUtils.MarkUndoAction(); + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoCreateConnectionId ); + originNode.RecordObject( Constants.UndoCreateConnectionId ); + targetNode.RecordObject( Constants.UndoCreateConnectionId ); + + if( inputPort.NotFreeForAllTypes && outputPort.NotFreeForAllTypes ) + { + if( !inputPort.CheckValidType( outputPort.DataType ) ) + { + UIUtils.ShowIncompatiblePortMessage( true, targetNode, inputPort, originNode, outputPort ); + m_wireReferenceUtils.InvalidateReferences(); + UseCurrentEvent(); + return; + } + + if( !outputPort.CheckValidType( inputPort.DataType ) ) + { + UIUtils.ShowIncompatiblePortMessage( false, originNode, outputPort, targetNode, inputPort ); + m_wireReferenceUtils.InvalidateReferences(); + UseCurrentEvent(); + return; + } + } + + inputPort.DummyAdd( m_wireReferenceUtils.OutputPortReference.NodeId, m_wireReferenceUtils.OutputPortReference.PortId ); + outputPort.DummyAdd( inputPort.NodeId, inputPort.PortId ); + if( UIUtils.DetectNodeLoopsFrom( targetNode, new Dictionary() ) ) + { + inputPort.DummyRemove(); + outputPort.DummyRemove(); + m_wireReferenceUtils.InvalidateReferences(); + ShowMessage( "Infinite Loop detected" ); + UseCurrentEvent(); + return; + } + + inputPort.DummyRemove(); + outputPort.DummyRemove(); + + if( inputPort.IsConnected ) + { + if( m_currentEvent.control && m_wireReferenceUtils.SwitchPortReference.IsValid ) + { + ParentNode oldOutputNode = UIUtils.GetNode( inputPort.GetConnection( 0 ).NodeId ); + OutputPort oldOutputPort = oldOutputNode.GetOutputPortByUniqueId( inputPort.GetConnection( 0 ).PortId ); + + ParentNode switchNode = UIUtils.GetNode( m_wireReferenceUtils.SwitchPortReference.NodeId ); + InputPort switchPort = switchNode.GetInputPortByUniqueId( m_wireReferenceUtils.SwitchPortReference.PortId ); + + switchPort.DummyAdd( oldOutputPort.NodeId, oldOutputPort.PortId ); + oldOutputPort.DummyAdd( switchPort.NodeId, switchPort.PortId ); + if( UIUtils.DetectNodeLoopsFrom( switchNode, new Dictionary() ) ) + { + switchPort.DummyRemove(); + oldOutputPort.DummyRemove(); + m_wireReferenceUtils.InvalidateReferences(); + ShowMessage( "Infinite Loop detected" ); + UseCurrentEvent(); + return; + } + + switchPort.DummyRemove(); + oldOutputPort.DummyRemove(); + + DeleteConnection( true, inputPort.NodeId, inputPort.PortId, true, false ); + ConnectInputToOutput( switchPort.NodeId, switchPort.PortId, oldOutputPort.NodeId, oldOutputPort.PortId ); + } + else + { + DeleteConnection( true, inputPort.NodeId, inputPort.PortId, true, false ); + } + } + inputPort.InvalidateAllConnections(); + + + //link input to output + if( inputPort.ConnectTo( m_wireReferenceUtils.OutputPortReference.NodeId, m_wireReferenceUtils.OutputPortReference.PortId, m_wireReferenceUtils.OutputPortReference.DataType, inputPort.TypeLocked ) ) + targetNode.OnInputPortConnected( inputPort.PortId, m_wireReferenceUtils.OutputPortReference.NodeId, m_wireReferenceUtils.OutputPortReference.PortId ); + //link output to input + + if( outputPort.ConnectTo( inputPort.NodeId, inputPort.PortId, inputPort.DataType, inputPort.TypeLocked ) ) + originNode.OnOutputPortConnected( m_wireReferenceUtils.OutputPortReference.PortId, targetNode.UniqueId, inputPort.PortId ); + m_mainGraphInstance.MarkWireHighlights(); + } + else if( inputPort != null && inputPort.TypeLocked && inputPort.DataType != m_wireReferenceUtils.OutputPortReference.DataType ) + { + ShowMessage( "Attempting to connect a " + m_wireReferenceUtils.OutputPortReference.DataType + " to a port locked to type " + inputPort.DataType ); + } + ShaderIsModified = true; + SetSaveIsDirty(); + } + m_wireReferenceUtils.InvalidateReferences(); + } + else + { + if( UIUtils.ShowContextOnPick ) + m_contextPalette.Show( m_currentMousePos2D, m_cameraInfo ); + else + m_wireReferenceUtils.InvalidateReferences(); + } + } + else if( m_currentEvent.modifiers == EventModifiers.Alt && m_altAvailable && CurrentGraph.SelectedNodes.Count == 1 && !m_altBoxSelection && !m_multipleSelectionActive ) + { + List wireRefs = m_mainGraphInstance.GetWireBezierListInPos( m_currentMousePos2D ); + if( wireRefs != null && wireRefs.Count > 0 ) + { + float closestDist = 50; + int closestId = 0; + + for( int i = 0; i < wireRefs.Count; i++ ) + { + ParentNode outNode = m_mainGraphInstance.GetNode( wireRefs[ i ].OutNodeId ); + ParentNode inNode = m_mainGraphInstance.GetNode( wireRefs[ i ].InNodeId ); + + if( outNode == CurrentGraph.SelectedNodes[ 0 ] || inNode == CurrentGraph.SelectedNodes[ 0 ] ) + continue; + + OutputPort outputPort = outNode.GetOutputPortByUniqueId( wireRefs[ i ].OutPortId ); + InputPort inputPort = inNode.GetInputPortByUniqueId( wireRefs[ i ].InPortId ); + + // Calculate the 4 points for bezier taking into account wire nodes and their automatic tangents + Vector3 endPos = new Vector3( inputPort.Position.x, inputPort.Position.y ); + Vector3 startPos = new Vector3( outputPort.Position.x, outputPort.Position.y ); + + float mag = ( endPos - startPos ).magnitude; + float resizedMag = Mathf.Min( mag, Constants.HORIZONTAL_TANGENT_SIZE * m_drawInfo.InvertedZoom ); + + Vector3 startTangent = new Vector3( startPos.x + resizedMag, startPos.y ); + Vector3 endTangent = new Vector3( endPos.x - resizedMag, endPos.y ); + + if( inNode != null && inNode.GetType() == typeof( WireNode ) ) + endTangent = endPos + ( ( inNode as WireNode ).TangentDirection ) * mag * 0.33f; + + if( outNode != null && outNode.GetType() == typeof( WireNode ) ) + startTangent = startPos - ( ( outNode as WireNode ).TangentDirection ) * mag * 0.33f; + + //Vector2 pos = ( CurrentGraph.SelectedNodes[0].CenterPosition + m_cameraOffset ) / m_cameraZoom; + + float dist = HandleUtility.DistancePointBezier( /*pos*/ m_currentMousePos, startPos, endPos, startTangent, endTangent ); + if( dist < 40 ) + { + if( dist < closestDist ) + { + closestDist = dist; + closestId = i; + } + } + } + + if( closestDist < 40 ) + { + ParentNode outNode = m_mainGraphInstance.GetNode( wireRefs[ closestId ].OutNodeId ); + ParentNode inNode = m_mainGraphInstance.GetNode( wireRefs[ closestId ].InNodeId ); + + OutputPort outputPort = outNode.GetOutputPortByUniqueId( wireRefs[ closestId ].OutPortId ); + InputPort inputPort = inNode.GetInputPortByUniqueId( wireRefs[ closestId ].InPortId ); + + ParentNode selectedNode = CurrentGraph.SelectedNodes[ 0 ]; + if( selectedNode.InputPorts.Count > 0 && selectedNode.OutputPorts.Count > 0 ) + { + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoCreateConnectionId ); + selectedNode.RecordObject( Constants.UndoCreateConnectionId ); + inNode.RecordObject( Constants.UndoCreateConnectionId ); + outNode.RecordObject( Constants.UndoCreateConnectionId ); + + m_mainGraphInstance.CreateConnection( selectedNode.UniqueId, selectedNode.InputPorts[ 0 ].PortId, outputPort.NodeId, outputPort.PortId ); + m_mainGraphInstance.CreateConnection( inputPort.NodeId, inputPort.PortId, selectedNode.UniqueId, selectedNode.OutputPorts[ 0 ].PortId ); + } + + SetSaveIsDirty(); + ForceRepaint(); + } + } + } + UIUtils.ShowContextOnPick = true; + m_altBoxSelection = false; + m_multipleSelectionActive = false; + UseCurrentEvent(); + } + + public void ConnectInputToOutput( int inNodeId, int inPortId, int outNodeId, int outPortId, bool registerUndo = true ) + { + ParentNode inNode = m_mainGraphInstance.GetNode( inNodeId ); + ParentNode outNode = m_mainGraphInstance.GetNode( outNodeId ); + if( inNode != null && outNode != null ) + { + InputPort inPort = inNode.GetInputPortByUniqueId( inPortId ); + OutputPort outPort = outNode.GetOutputPortByUniqueId( outPortId ); + if( inPort != null && outPort != null ) + { + if( registerUndo ) + { + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoCreateConnectionId ); + inNode.RecordObject( Constants.UndoCreateConnectionId ); + outNode.RecordObject( Constants.UndoCreateConnectionId ); + } + + if( inPort.ConnectTo( outNodeId, outPortId, outPort.DataType, inPort.TypeLocked ) ) + { + inNode.OnInputPortConnected( inPortId, outNodeId, outPortId ); + } + + if( outPort.ConnectTo( inNodeId, inPortId, inPort.DataType, inPort.TypeLocked ) ) + { + outNode.OnOutputPortConnected( outPortId, inNodeId, inPortId ); + } + } + m_mainGraphInstance.MarkWireHighlights(); + ShaderIsModified = true; + } + } + + void OnRightMouseDown() + { + Focus(); + m_rmbStartPos = m_currentMousePos2D; + UseCurrentEvent(); + } + + void OnRightMouseDrag() + { + // We look at the control to detect when user hits a tooltip ( which has a hot control of 0 ) + // This needs to be checked because on this first "frame" of hitting a tooltip because it generates incorrect mouse delta values + if( GUIUtility.hotControl == 0 && m_lastHotControl != 0 ) + { + m_lastHotControl = GUIUtility.hotControl; + return; + } + + m_lastHotControl = GUIUtility.hotControl; + if( m_currentEvent.alt ) + { + ModifyZoom( Constants.ALT_CAMERA_ZOOM_SPEED * ( m_currentEvent.delta.x + m_currentEvent.delta.y ), m_altKeyStartPos ); + } + else + { + m_cameraOffset += m_cameraZoom * m_currentEvent.delta; + } + UseCurrentEvent(); + } + + void OnRightMouseUp() + { + //Resetting the hot control test variable so it can be used again on right mouse drag detection ( if we did not do this then m_lastHotControl could be left with a a value of 0 and wouldn't be able to be correctly used on rthe drag ) + m_lastHotControl = -1; + + if( ( m_rmbStartPos - m_currentMousePos2D ).sqrMagnitude < Constants.RMB_SCREEN_DIST ) + { + ParentNode node = m_mainGraphInstance.CheckNodeAt( m_currentMousePos, true ); + if( node == null ) + { + m_contextPalette.Show( m_currentMousePos2D, m_cameraInfo ); + } + } + UseCurrentEvent(); + } + + void UpdateSelectionArea() + { + m_multipleSelectionArea.size = TranformedMousePos - m_multipleSelectionStart; + } + + public void OnValidObjectsDropped( UnityEngine.Object[] droppedObjs ) + { + bool propagateDraggedObjsToNode = true; + // Only supporting single drag&drop object selection + if( droppedObjs.Length == 1 ) + { + ShaderIsModified = true; + SetSaveIsDirty(); + // Check if its a shader, material or game object and if so load the shader graph code from it + Shader newShader = droppedObjs[ 0 ] as Shader; + Material newMaterial = null; + if( newShader == null ) + { + newMaterial = droppedObjs[ 0 ] as Material; + bool isProcedural = ( newMaterial != null ); + if( newMaterial != null && !isProcedural ) + { + if( UIUtils.IsUnityNativeShader( AssetDatabase.GetAssetPath( newMaterial.shader ) ) ) + { + return; + } + //newShader = newMaterial.shader; + LoadMaterialToASE( newMaterial ); + //m_mainGraphInstance.UpdateMaterialOnMasterNode( newMaterial ); + } + else + { + GameObject go = droppedObjs[ 0 ] as GameObject; + if( go != null ) + { + Renderer renderer = go.GetComponent(); + if( renderer ) + { + newMaterial = renderer.sharedMaterial; + newShader = newMaterial.shader; + } + } + } + } + + if( newShader != null ) + { + ConvertShaderToASE( newShader ); + + propagateDraggedObjsToNode = false; + } + + // if not shader loading then propagate the seletion to whats below the mouse + if( propagateDraggedObjsToNode ) + { + ParentNode node = m_mainGraphInstance.CheckNodeAt( m_currentMousePos ); + if( node != null ) + { + // if there's a node then pass the object into it to see if there's a setup with it + node.OnObjectDropped( droppedObjs[ 0 ] ); + } + else + { + // If not then check if there's a node that can be created through the dropped object + ParentNode newNode = m_contextMenu.CreateNodeFromCastType( droppedObjs[ 0 ].GetType() ); + if( newNode ) + { + newNode.ContainerGraph = m_mainGraphInstance; + newNode.Vec2Position = TranformedMousePos; + m_mainGraphInstance.AddNode( newNode, true ); + newNode.SetupFromCastObject( droppedObjs[ 0 ] ); + m_mainGraphInstance.SelectNode( newNode, false, false ); + ForceRepaint(); + bool find = false; + if( newNode is FunctionNode && CurrentGraph.CurrentShaderFunction != null ) + find = SearchFunctionNodeRecursively( CurrentGraph.CurrentShaderFunction ); + + if( find ) + { + DestroyNode( newNode, false ); + ShowMessage( "Shader Function loop detected, new node was removed to prevent errors." ); + } + } + } + } + } + } + + public bool SearchFunctionNodeRecursively( AmplifyShaderFunction function ) + { + List graphList = UIUtils.FunctionList(); + + bool nodeFind = false; + + for( int i = 0; i < graphList.Count; i++ ) + { + ParentGraph temp = CustomGraph; + CustomGraph = graphList[ i ].FunctionGraph; + nodeFind = SearchFunctionNodeRecursively( function ); + CustomGraph = temp; + + //Debug.Log( "tested = " + node.Function.FunctionName + " : " + function.FunctionName ); + + if( graphList[ i ].Function == function ) + return true; + } + + return nodeFind; + } + + public void SetDelayedMaterialMode( Material material ) + { + if( material == null ) + return; + m_delayedMaterialSet = material; + } + + public ShaderLoadResult LoadDroppedObject( bool value, Shader shader, Material material, AmplifyShaderFunction shaderFunction = null ) + { + UIUtils.CurrentWindow = this; + ShaderLoadResult result; + if( shaderFunction != null ) + { + string assetDatapath = AssetDatabase.GetAssetPath( shaderFunction ); + string latestOpenedFolder = Application.dataPath + assetDatapath.Substring( 6 ); + UIUtils.LatestOpenedFolder = latestOpenedFolder.Substring( 0, latestOpenedFolder.LastIndexOf( '/' ) + 1 ); + result = LoadFromDisk( assetDatapath, shaderFunction ); + CurrentSelection = ASESelectionMode.ShaderFunction; + IsShaderFunctionWindow = true; + titleContent.text = GenerateTabTitle( shaderFunction.FunctionName ); + titleContent.image = UIUtils.ShaderFunctionIcon; + m_lastpath = assetDatapath; + m_nodeParametersWindow.OnShaderFunctionLoad(); + //EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, assetDatapath ); + } + else if( value && shader != null ) + { + string assetDatapath = AssetDatabase.GetAssetPath( shader ); + string latestOpenedFolder = Application.dataPath + assetDatapath.Substring( 6 ); + UIUtils.LatestOpenedFolder = latestOpenedFolder.Substring( 0, latestOpenedFolder.LastIndexOf( '/' ) + 1 ); + result = LoadFromDisk( assetDatapath ); + switch( result ) + { + case ShaderLoadResult.LOADED: + { + m_mainGraphInstance.UpdateShaderOnMasterNode( shader ); + } + break; + case ShaderLoadResult.ASE_INFO_NOT_FOUND: + { + ShowMessage( "Loaded shader wasn't created with ASE. Saving it will remove previous data." ); + UIUtils.CreateEmptyFromInvalid( shader ); + } + break; + case ShaderLoadResult.FILE_NOT_FOUND: + case ShaderLoadResult.UNITY_NATIVE_PATHS: + { + UIUtils.CreateEmptyFromInvalid( shader ); + } + break; + } + + m_mainGraphInstance.UpdateMaterialOnMasterNode( material ); + m_mainGraphInstance.SetMaterialModeOnGraph( material ); + + if( material != null ) + { + CurrentSelection = ASESelectionMode.Material; + IsShaderFunctionWindow = false; + titleContent.text = GenerateTabTitle( material.name ); + titleContent.image = UIUtils.MaterialIcon; + if( material.HasProperty( IOUtils.DefaultASEDirtyCheckId ) ) + { + material.SetInt( IOUtils.DefaultASEDirtyCheckId, 1 ); + } + m_lastpath = AssetDatabase.GetAssetPath( material ); + EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, m_lastpath ); + } + else + { + CurrentSelection = ASESelectionMode.Shader; + IsShaderFunctionWindow = false; + titleContent.text = GenerateTabTitle( shader.name ); + titleContent.image = UIUtils.ShaderIcon; + m_lastpath = AssetDatabase.GetAssetPath( shader ); + EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, m_lastpath ); + } + } + else + { + result = ShaderLoadResult.FILE_NOT_FOUND; + } + return result; + } + + bool InsideMenus( Vector2 position ) + { + for( int i = 0; i < m_registeredMenus.Count; i++ ) + { + if( m_registeredMenus[ i ].IsInside( position ) ) + { + return true; + } + } + return false; + } + + void HandleGUIEvents() + { + if( m_currentEvent.type == EventType.KeyDown ) + { + m_contextMenu.UpdateKeyPress( m_currentEvent.keyCode ); + } + else if( m_currentEvent.type == EventType.KeyUp ) + { + m_contextMenu.UpdateKeyReleased( m_currentEvent.keyCode ); + } + + if( InsideMenus( m_currentMousePos2D ) ) + { + if( m_currentEvent.type == EventType.Used ) + m_mouseDownOnValidArea = false; + + if( m_currentEvent.type == EventType.MouseDown ) + { + m_mouseDownOnValidArea = false; + UseCurrentEvent(); + } + return; + } + else if( m_nodeParametersWindow.IsResizing || m_paletteWindow.IsResizing ) + { + m_mouseDownOnValidArea = false; + } + + int controlID = GUIUtility.GetControlID( FocusType.Passive ); + switch( m_currentEvent.GetTypeForControl( controlID ) ) + { + case EventType.MouseDown: + { + GUIUtility.hotControl = controlID; + switch( m_currentEvent.button ) + { + case ButtonClickId.LeftMouseButton: + { + OnLeftMouseDown(); + } + break; + case ButtonClickId.RightMouseButton: + case ButtonClickId.MiddleMouseButton: + { + OnRightMouseDown(); + } + break; + } + } + break; + case EventType.MouseMove: + { + m_keyEvtMousePos2D = m_currentEvent.mousePosition; + } + break; + case EventType.MouseUp: + { + GUIUtility.hotControl = 0; + switch( m_currentEvent.button ) + { + case ButtonClickId.LeftMouseButton: + { + OnLeftMouseUp(); + } + break; + case ButtonClickId.MiddleMouseButton: break; + case ButtonClickId.RightMouseButton: + { + OnRightMouseUp(); + } + break; + } + } + break; + case EventType.MouseDrag: + { + switch( m_currentEvent.button ) + { + case ButtonClickId.LeftMouseButton: + { + OnLeftMouseDrag(); + } + break; + case ButtonClickId.MiddleMouseButton: + case ButtonClickId.RightMouseButton: + { + OnRightMouseDrag(); + } + break; + } + } + break; + case EventType.ScrollWheel: + { + OnScrollWheel(); + } + break; + case EventType.KeyDown: + { + OnKeyboardDown(); + } + break; + case EventType.KeyUp: + { + OnKeyboardUp(); + } + break; + case EventType.ValidateCommand: + { + switch( m_currentEvent.commandName ) + { + case CopyCommand: + case PasteCommand: + case SelectAll: + case Duplicate: + { + m_currentEvent.Use(); + } + break; + case ObjectSelectorClosed: + { + m_mouseDownOnValidArea = false; + } + break; + } + } + break; + case EventType.ExecuteCommand: + { + m_currentEvent.Use(); + switch( m_currentEvent.commandName ) + { + case CopyCommand: + { + CopyToClipboard(); + } + break; + case PasteCommand: + { + PasteFromClipboard( true ); + } + break; + case SelectAll: + { + m_mainGraphInstance.SelectAll(); + ForceRepaint(); + } + break; + case Duplicate: + { + CopyToClipboard(); + PasteFromClipboard( true ); + } + break; + case ObjectSelectorClosed: + { + m_mouseDownOnValidArea = false; + } + break; + } + } + break; + case EventType.Repaint: + { + } + break; + } + + m_dragAndDropTool.TestDragAndDrop( m_graphArea ); + + } + + public void DeleteConnection( bool isInput, int nodeId, int portId, bool registerOnLog, bool propagateCallback ) + { + m_mainGraphInstance.DeleteConnection( isInput, nodeId, portId, registerOnLog, propagateCallback ); + } + + void DeleteSelectedNodes() + { + if( m_mainGraphInstance.SelectedNodes.Count == 0 ) + return; + + UIUtils.ClearUndoHelper(); + ParentNode[] selectedNodes = new ParentNode[ m_mainGraphInstance.SelectedNodes.Count ]; + for( int i = 0; i < selectedNodes.Length; i++ ) + { + selectedNodes[ i ] = m_mainGraphInstance.SelectedNodes[ i ]; + selectedNodes[ i ].Rewire(); + UIUtils.CheckUndoNode( selectedNodes[ i ] ); + } + + //Check nodes connected to deleted nodes to preserve connections on undo + List extraNodes = new List(); + for( int selectedNodeIdx = 0; selectedNodeIdx < selectedNodes.Length; selectedNodeIdx++ ) + { + // Check inputs + { + int inputIdxCount = selectedNodes[ selectedNodeIdx ].InputPorts.Count; + if( inputIdxCount > 0 ) + { + for( int inputIdx = 0; inputIdx < inputIdxCount; inputIdx++ ) + { + if( selectedNodes[ selectedNodeIdx ].InputPorts[ inputIdx ].IsConnected ) + { + int nodeIdx = selectedNodes[ selectedNodeIdx ].InputPorts[ inputIdx ].ExternalReferences[ 0 ].NodeId; + if( nodeIdx > -1 ) + { + ParentNode node = m_mainGraphInstance.GetNode( nodeIdx ); + if( node != null && UIUtils.CheckUndoNode( node ) ) + { + extraNodes.Add( node ); + } + } + } + } + } + } + + // Check outputs + int outputIdxCount = selectedNodes[ selectedNodeIdx ].OutputPorts.Count; + if( outputIdxCount > 0 ) + { + for( int outputIdx = 0; outputIdx < outputIdxCount; outputIdx++ ) + { + int inputIdxCount = selectedNodes[ selectedNodeIdx ].OutputPorts[ outputIdx ].ExternalReferences.Count; + if( inputIdxCount > 0 ) + { + for( int inputIdx = 0; inputIdx < inputIdxCount; inputIdx++ ) + { + int nodeIdx = selectedNodes[ selectedNodeIdx ].OutputPorts[ outputIdx ].ExternalReferences[ inputIdx ].NodeId; + if( nodeIdx > -1 ) + { + ParentNode node = m_mainGraphInstance.GetNode( nodeIdx ); + if( UIUtils.CheckUndoNode( node ) ) + { + extraNodes.Add( node ); + } + } + } + } + } + } + } + + UIUtils.ClearUndoHelper(); + //UndoUtils.IncrementCurrentGroup(); + //Record deleted nodes + UIUtils.MarkUndoAction(); + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoDeleteNodeId ); + UndoUtils.RegisterCompleteObjectUndo( m_mainGraphInstance, Constants.UndoDeleteNodeId ); + UndoUtils.RecordObjects( selectedNodes, Constants.UndoDeleteNodeId ); + UndoUtils.RecordObjects( extraNodes.ToArray(), Constants.UndoDeleteNodeId ); + + //Record deleting connections + for( int i = 0; i < selectedNodes.Length; i++ ) + { + selectedNodes[ i ].Alive = false; + m_mainGraphInstance.DeleteAllConnectionFromNode( selectedNodes[ i ], false, true, true ); + } + //Delete + m_mainGraphInstance.DeleteNodesOnArray( ref selectedNodes ); + + + //UndoUtils.IncrementCurrentGroup(); + extraNodes.Clear(); + extraNodes = null; + + EditorUtility.SetDirty( this ); + + ForceRepaint(); + } + + void OnKeyboardUp() + { + CheckKeyboardCameraUp(); + + if( m_altPressDown ) + { + m_altPressDown = false; + } + + if( m_shortcutManager.ActivateShortcut( m_currentEvent.modifiers, m_lastKeyPressed, false ) ) + { + ForceRepaint(); + } + m_lastKeyPressed = KeyCode.None; + } + + bool OnKeyboardPress( KeyCode code ) + { + return ( m_currentEvent.keyCode == code && m_lastKeyPressed == KeyCode.None ); + } + + void CheckKeyboardCameraDown() + { + if( m_contextPalette.IsActive ) + return; + if( m_currentEvent.alt ) + { + bool foundKey = false; + float dir = 0; + switch( m_currentEvent.keyCode ) + { + case KeyCode.UpArrow: foundKey = true; dir = 1; break; + case KeyCode.DownArrow: foundKey = true; dir = -1; break; + case KeyCode.LeftArrow: foundKey = true; dir = 1; break; + case KeyCode.RightArrow: foundKey = true; dir = -1; break; + } + if( foundKey ) + { + ModifyZoom( Constants.ALT_CAMERA_ZOOM_SPEED * dir * m_cameraSpeed, new Vector2( m_cameraInfo.width * 0.5f, m_cameraInfo.height * 0.5f ) ); + if( m_cameraSpeed < 15 ) + m_cameraSpeed += 0.2f; + UseCurrentEvent(); + } + + + } + else + { + bool foundKey = false; + Vector2 dir = Vector2.zero; + switch( m_currentEvent.keyCode ) + { + case KeyCode.UpArrow: foundKey = true; dir = Vector2.up; break; + case KeyCode.DownArrow: foundKey = true; dir = Vector2.down; break; + case KeyCode.LeftArrow: foundKey = true; dir = Vector2.right; break; + case KeyCode.RightArrow: foundKey = true; dir = Vector2.left; break; + } + if( foundKey ) + { + m_cameraOffset += m_cameraZoom * m_cameraSpeed * dir; + if( m_cameraSpeed < 15 ) + m_cameraSpeed += 0.2f; + + UseCurrentEvent(); + } + } + } + + void CheckKeyboardCameraUp() + { + switch( m_currentEvent.keyCode ) + { + case KeyCode.UpArrow: + case KeyCode.DownArrow: + case KeyCode.LeftArrow: + case KeyCode.RightArrow: m_cameraSpeed = 1; break; + } + } + + void OnKeyboardDown() + { + //if( DebugConsoleWindow.DeveloperMode ) + //{ + // if( OnKeyboardPress( KeyCode.F8 ) ) + // { + // Shader currShader = CurrentGraph.CurrentShader; + // ShaderUtilEx.OpenCompiledShader( currShader, ShaderInspectorPlatformsPopupEx.GetCurrentMode(), ShaderInspectorPlatformsPopupEx.GetCurrentPlatformMask(), ShaderInspectorPlatformsPopupEx.GetCurrentVariantStripping() == 0 ); + + // string filename = Application.dataPath; + // filename = filename.Replace( "Assets", "Temp/Compiled-" ); + // string shaderFilename = AssetDatabase.GetAssetPath( currShader ); + // int lastIndex = shaderFilename.LastIndexOf( '/' ) + 1; + // filename = filename + shaderFilename.Substring( lastIndex ); + + // string compiledContents = IOUtils.LoadTextFileFromDisk( filename ); + // Debug.Log( compiledContents ); + // } + + // if( OnKeyboardPress( KeyCode.F9 ) ) + // { + // m_nodeExporterUtils.CalculateShaderInstructions( CurrentGraph.CurrentShader ); + // } + //} + + CheckKeyboardCameraDown(); + + if( m_lastKeyPressed == KeyCode.None ) + { + m_shortcutManager.ActivateShortcut( m_currentEvent.modifiers, m_currentEvent.keyCode, true ); + } + + if( m_currentEvent.control && m_currentEvent.shift && m_currentEvent.keyCode == KeyCode.V ) + { + PasteFromClipboard( false ); + } + + if( !m_altPressDown && ( OnKeyboardPress( KeyCode.LeftAlt ) || OnKeyboardPress( KeyCode.RightAlt ) || OnKeyboardPress( KeyCode.AltGr ) ) ) + { + m_altPressDown = true; + m_altAvailable = true; + m_altKeyStartPos = m_currentMousePos2D; + } + + if( m_currentEvent.keyCode != KeyCode.None && m_currentEvent.modifiers == EventModifiers.None ) + { + m_lastKeyPressed = m_currentEvent.keyCode; + } + } + + IEnumerator m_coroutine; + + private void StartPasteRequest() + { + m_coroutine = SendPostCoroutine( "https://paste.amplify.pt/api/create" ); + EditorApplication.update += PasteRequest; + } + + IEnumerator SendPostCoroutine( string url ) + { + WWWForm form = new WWWForm(); + form.AddField( "text", Clipboard.ClipboardId + ";" + EditorPrefs.GetString( Clipboard.ClipboardId, string.Empty ) ); + form.AddField( "title", "ASE Copy" ); + form.AddField( "name", "ASE" ); + form.AddField( "private", "1" ); + form.AddField( "lang", "text" ); + form.AddField( "expire", "0" ); + + UnityWebRequest www = UnityWebRequest.Post( url, form ); + + www.SendWebRequest(); + + yield return www; + } + + public void PasteRequest() + { + UnityWebRequest www = (UnityWebRequest)m_coroutine.Current; + if( !m_coroutine.MoveNext() && www != null ) + { + if( !www.isDone ) + { + m_coroutine.MoveNext(); + } + else + { +#if UNITY_2020_1_OR_NEWER + if( www.result == UnityWebRequest.Result.ConnectionError ) +#else + if( www.isNetworkError ) +#endif + { + Debug.Log( "[AmplifyShaderEditor]\n" + www.error ); + } + else + { + // Print Body + string finalURL = www.downloadHandler.text; + + if( finalURL.IndexOf( "paste.amplify.pt/view/" ) > -1 ) + { + System.Text.RegularExpressions.Regex parser = new System.Text.RegularExpressions.Regex( @".*(http:\/\/paste.amplify.pt\/view\/)([0-9a-z]*).*", System.Text.RegularExpressions.RegexOptions.Singleline ); + finalURL = parser.Replace( finalURL, "$1raw/$2" ); + + ShowMessage( "Link copied to clipboard\n"+ finalURL, consoleLog:false ); + Debug.Log( "[AmplifyShaderEditor] Link copied to clipboard\n"+ finalURL+"\n" ); + // Copy Paste to clipboard + EditorGUIUtility.systemCopyBuffer = finalURL; + } + else + { + Debug.Log( "[AmplifyShaderEditor] Failed to generate paste:\n" + finalURL ); + } + } + EditorApplication.update -= PasteRequest; + } + } + } + + void OnScrollWheel() + { + ModifyZoomSmooth( m_currentEvent.delta.y, m_currentMousePos2D ); + UseCurrentEvent(); + } + + void ModifyZoom( float zoomIncrement, Vector2 pivot ) + { + float minCam = Mathf.Min( ( m_cameraInfo.width - ( m_nodeParametersWindow.RealWidth + m_paletteWindow.RealWidth ) ), ( m_cameraInfo.height - ( m_toolsWindow.Height ) ) ); + if( minCam < 1 ) + minCam = 1; + + float dynamicMaxZoom = m_mainGraphInstance.MaxNodeDist / minCam; + + Vector2 canvasPos = TranformPosition( pivot ); + if( zoomIncrement < 0 ) + CameraZoom = Mathf.Max( m_cameraZoom + zoomIncrement * Constants.CAMERA_ZOOM_SPEED, Constants.CAMERA_MIN_ZOOM ); + else if( CameraZoom < Mathf.Max( Constants.CAMERA_MAX_ZOOM, dynamicMaxZoom ) ) + CameraZoom = m_cameraZoom + zoomIncrement * Constants.CAMERA_ZOOM_SPEED;// Mathf.Min( m_cameraZoom + zoomIncrement * Constants.CAMERA_ZOOM_SPEED, Mathf.Max( Constants.CAMERA_MAX_ZOOM, dynamicMaxZoom ) ); + m_cameraOffset.x = pivot.x * m_cameraZoom - canvasPos.x; + m_cameraOffset.y = pivot.y * m_cameraZoom - canvasPos.y; + } + + void ModifyZoomSmooth( float zoomIncrement, Vector2 pivot ) + { + if( m_smoothZoom && Mathf.Sign( m_targetZoomIncrement * zoomIncrement ) >= 0 ) + m_targetZoomIncrement += zoomIncrement; + else + m_targetZoomIncrement = zoomIncrement; + + m_smoothZoom = true; + m_zoomTime = 0; + + float minCam = Mathf.Min( ( m_cameraInfo.width - ( m_nodeParametersWindow.RealWidth + m_paletteWindow.RealWidth ) ), ( m_cameraInfo.height - ( m_toolsWindow.Height ) ) ); + if( minCam < 1 ) + minCam = 1; + + float dynamicMaxZoom = m_mainGraphInstance.MaxNodeDist / minCam; + if( m_targetZoomIncrement < 0 ) + m_targetZoom = Mathf.Max( m_cameraZoom + m_targetZoomIncrement * Constants.CAMERA_ZOOM_SPEED, Constants.CAMERA_MIN_ZOOM ); + else if( CameraZoom < Mathf.Max( Constants.CAMERA_MAX_ZOOM, dynamicMaxZoom ) ) + m_targetZoom = m_cameraZoom + m_targetZoomIncrement * Constants.CAMERA_ZOOM_SPEED;// Mathf.Min( m_cameraZoom + zoomIncrement * Constants.CAMERA_ZOOM_SPEED, Mathf.Max( Constants.CAMERA_MAX_ZOOM, dynamicMaxZoom ) ); + + m_zoomPivot = pivot; + } + + void OnSelectionChange() + { + ForceRepaint(); + } + + private void OnFocus() + { + EditorGUI.FocusTextInControl( null ); +// m_fixOnFocus = true; + } + + void OnLostFocus() + { + m_lostFocus = true; + m_multipleSelectionActive = false; + m_wireReferenceUtils.InvalidateReferences(); + if( m_genericMessageUI != null ) + m_genericMessageUI.CleanUpMessageStack(); + m_nodeParametersWindow.OnLostFocus(); + m_paletteWindow.OnLostFocus(); + m_contextMenu.ResetShortcutKeyStates(); + } + + void CopyToClipboard() + { + m_copyPasteDeltaMul = 0; + m_copyPasteDeltaPos = new Vector2( float.MaxValue, float.MaxValue ); + m_clipboard.ClearClipboard(); + m_copyPasteInitialPos = m_mainGraphInstance.SelectedNodesCentroid; + m_clipboard.AddToClipboard( m_mainGraphInstance.SelectedNodes, m_copyPasteInitialPos, m_mainGraphInstance ); + } + + ParentNode CreateNodeFromClipboardData( int clipId ) + { + string[] parameters = m_clipboard.CurrentClipboardStrData[ clipId ].Data.Split( IOUtils.FIELD_SEPARATOR ); + System.Type nodeType = System.Type.GetType( parameters[ IOUtils.NodeTypeId ] ); + NodeAttributes attributes = m_contextMenu.GetNodeAttributesForType( nodeType ); + if( attributes != null && !UIUtils.GetNodeAvailabilityInBitArray( attributes.NodeAvailabilityFlags, m_mainGraphInstance.CurrentCanvasMode ) && !UIUtils.GetNodeAvailabilityInBitArray( attributes.NodeAvailabilityFlags, m_currentNodeAvailability ) ) + return null; + + ParentNode newNode = (ParentNode)ScriptableObject.CreateInstance( nodeType ); + newNode.IsNodeBeingCopied = true; + if( newNode != null ) + { + newNode.ContainerGraph = m_mainGraphInstance; + newNode.ClipboardFullReadFromString( ref parameters ); + m_mainGraphInstance.AddNode( newNode, true, true, true, false ); + newNode.IsNodeBeingCopied = false; + m_clipboard.CurrentClipboardStrData[ clipId ].NewNodeId = newNode.UniqueId; + return newNode; + } + return null; + } + + void CreateConnectionsFromClipboardData( int clipId ) + { + if( String.IsNullOrEmpty( m_clipboard.CurrentClipboardStrData[ clipId ].Connections ) ) + return; + string[] lines = m_clipboard.CurrentClipboardStrData[ clipId ].Connections.Split( IOUtils.LINE_TERMINATOR ); + + for( int lineIdx = 0; lineIdx < lines.Length; lineIdx++ ) + { + string[] parameters = lines[ lineIdx ].Split( IOUtils.FIELD_SEPARATOR ); + + int InNodeId = 0; + int InPortId = 0; + int OutNodeId = 0; + int OutPortId = 0; + + try + { + InNodeId = Convert.ToInt32( parameters[ IOUtils.InNodeId ] ); + InPortId = Convert.ToInt32( parameters[ IOUtils.InPortId ] ); + + OutNodeId = Convert.ToInt32( parameters[ IOUtils.OutNodeId ] ); + OutPortId = Convert.ToInt32( parameters[ IOUtils.OutPortId ] ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + + int newInNodeId = m_clipboard.GeNewNodeId( InNodeId ); + int newOutNodeId = m_clipboard.GeNewNodeId( OutNodeId ); + + if( newInNodeId > -1 && newOutNodeId > -1 ) + { + ParentNode inNode = m_mainGraphInstance.GetNode( newInNodeId ); + ParentNode outNode = m_mainGraphInstance.GetNode( newOutNodeId ); + + InputPort inputPort = null; + OutputPort outputPort = null; + + if( inNode != null && outNode != null ) + { + inNode.IsNodeBeingCopied = true; + outNode.IsNodeBeingCopied = true; + inputPort = inNode.GetInputPortByUniqueId( InPortId ); + outputPort = outNode.GetOutputPortByUniqueId( OutPortId ); + if( inputPort != null && outputPort != null ) + { + inputPort.ConnectTo( newOutNodeId, OutPortId, outputPort.DataType, false ); + outputPort.ConnectTo( newInNodeId, InPortId, inputPort.DataType, inputPort.TypeLocked ); + + inNode.OnInputPortConnected( InPortId, newOutNodeId, OutPortId ); + outNode.OnOutputPortConnected( OutPortId, newInNodeId, InPortId ); + } + + inNode.IsNodeBeingCopied = false; + outNode.IsNodeBeingCopied = false; + } + } + } + } + + private void StartGetRequest( string url ) + { + m_coroutine = SendGetCoroutine( url ); + EditorApplication.update += GetRequest; + } + + IEnumerator SendGetCoroutine( string url ) + { + UnityWebRequest www = UnityWebRequest.Get( url ); + www.SendWebRequest(); + yield return www; + } + + public void GetRequest() + { + UnityWebRequest www = (UnityWebRequest)m_coroutine.Current; + if( !m_coroutine.MoveNext() ) + { + if( !www.isDone ) + { + m_coroutine.MoveNext(); + } + else + { +#if UNITY_2020_1_OR_NEWER + if( www.result == UnityWebRequest.Result.ConnectionError ) +#else + if( www.isNetworkError ) +#endif + { + Debug.Log( "[AmplifyShaderEditor]\n" + www.error ); + } + else + { + string data = www.downloadHandler.text; + if( data.IndexOf( Clipboard.ClipboardId + ";" ) > -1 ) + { + data = www.downloadHandler.text.Replace( Clipboard.ClipboardId + ";", "" ); + if( data.IndexOf( "
-1 ) + { + System.Text.RegularExpressions.Regex parser = new System.Text.RegularExpressions.Regex( @"(.*)
-1 ) + { + StartGetRequest( result ); + return; + } + + if( result.IndexOf( Clipboard.ClipboardId + ";" ) > -1 ) + { + result = result.Replace( Clipboard.ClipboardId + ";", "" ); + EditorPrefs.SetString( Clipboard.ClipboardId, result ); + } + + m_mainGraphInstance.IsDuplicating = true; + m_copyPasteInitialPos = m_clipboard.GetDataFromEditorPrefs(); + if( m_clipboard.CurrentClipboardStrData.Count == 0 ) + { + return; + } + + Vector2 deltaPos = TranformedKeyEvtMousePos - m_copyPasteInitialPos; + if( ( m_copyPasteDeltaPos - deltaPos ).magnitude > 5.0f ) + { + m_copyPasteDeltaMul = 0; + } + else + { + m_copyPasteDeltaMul += 1; + } + m_copyPasteDeltaPos = deltaPos; + + m_mainGraphInstance.DeSelectAll(); + UIUtils.InhibitMessages = true; + + if( m_clipboard.CurrentClipboardStrData.Count > 0 ) + { + UIUtils.MarkUndoAction(); + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoPasteNodeId ); + } + + List createdNodes = new List(); + for( int i = 0; i < m_clipboard.CurrentClipboardStrData.Count; i++ ) + { + ParentNode node = CreateNodeFromClipboardData( i ); + if( node != null ) + { + m_clipboard.CurrentClipboardStrData[ i ].NewNodeId = node.UniqueId; + Vector2 pos = node.Vec2Position; + node.Vec2Position = pos + deltaPos + m_copyPasteDeltaMul * Constants.CopyPasteDeltaPos; + //node.RefreshExternalReferences(); + node.AfterDuplication(); + createdNodes.Add( node ); + m_mainGraphInstance.SelectNode( node, true, false ); + } + } + + if( copyConnections ) + { + for( int i = 0; i < m_clipboard.CurrentClipboardStrData.Count; i++ ) + { + CreateConnectionsFromClipboardData( i ); + } + } + + // Refresh external references must always be called after all nodes are created + for( int i = 0; i < createdNodes.Count; i++ ) + { + createdNodes[ i ].RefreshExternalReferences(); + } + createdNodes.Clear(); + createdNodes = null; + //Need to force increment on Undo because if not Undo may incorrectly group consecutive pastes + UndoUtils.IncrementCurrentGroup(); + + UIUtils.InhibitMessages = false; + ShaderIsModified = true; + SetSaveIsDirty(); + ForceRepaint(); + m_mainGraphInstance.IsDuplicating = false; + } + + public string GenerateGraphInfo() + { + EditorPrefs.SetString( GUID, + m_cameraInfo.x.ToString() + IOUtils.FIELD_SEPARATOR + + m_cameraInfo.y.ToString() + IOUtils.FIELD_SEPARATOR + + m_cameraInfo.width.ToString() + IOUtils.FIELD_SEPARATOR + + m_cameraInfo.height.ToString() + IOUtils.FIELD_SEPARATOR + + m_cameraOffset.x.ToString() + IOUtils.FIELD_SEPARATOR + + m_cameraOffset.y.ToString() + IOUtils.FIELD_SEPARATOR + + m_cameraZoom.ToString() + IOUtils.FIELD_SEPARATOR + + m_nodeParametersWindow.IsMaximized + IOUtils.FIELD_SEPARATOR + + m_paletteWindow.IsMaximized + '\n' ); + + string graphInfo = IOUtils.ShaderBodyBegin + '\n'; + string nodesInfo = ""; + string connectionsInfo = ""; + + graphInfo += VersionInfo.FullLabel + '\n'; + + m_mainGraphInstance.OrderNodesByGraphDepth(); + m_mainGraphInstance.WriteToString( ref nodesInfo, ref connectionsInfo ); + + graphInfo += nodesInfo; + graphInfo += connectionsInfo; + graphInfo += IOUtils.ShaderBodyEnd + '\n'; + + return graphInfo; + } + + // TODO: this need to be fused to the main load function somehow + public static void LoadFromMeta( ref ParentGraph graph, GraphContextMenu contextMenu, string meta ) + { + graph.IsLoading = true; + graph.CleanNodes(); + + string[] cameraParams = new string[ 0 ]; + int checksumId = meta.IndexOf( IOUtils.CHECKSUM ); + if( checksumId > -1 ) + { + string checkSumStoredValue = meta.Substring( checksumId ); + string trimmedBuffer = meta.Remove( checksumId ); + + string[] typeValuePair = checkSumStoredValue.Split( IOUtils.VALUE_SEPARATOR ); + if( typeValuePair != null && typeValuePair.Length == 2 ) + { + // Check read checksum and compare with the actual shader body to detect external changes + string currentChecksumValue = IOUtils.CreateChecksum( trimmedBuffer ); + if( DebugConsoleWindow.DeveloperMode && !currentChecksumValue.Equals( typeValuePair[ 1 ] ) ) + { + //ShowMessage( "Wrong checksum" ); + } + + trimmedBuffer = trimmedBuffer.Replace( "\r", string.Empty ); + // find node info body + int shaderBodyId = trimmedBuffer.IndexOf( IOUtils.ShaderBodyBegin ); + if( shaderBodyId > -1 ) + { + trimmedBuffer = trimmedBuffer.Substring( shaderBodyId ); + //Find set of instructions + string[] instructions = trimmedBuffer.Split( IOUtils.LINE_TERMINATOR ); + // First line is to be ignored and second line contains version + string[] versionParams = instructions[ 1 ].Split( IOUtils.VALUE_SEPARATOR ); + if( versionParams.Length == 2 ) + { + int version = 0; + try + { + version = Convert.ToInt32( versionParams[ 1 ] ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + //if( version > versionInfo.FullNumber ) + //{ + //ShowMessage( "This shader was created on a new ASE version\nPlease install v." + version ); + //} + + if( DebugConsoleWindow.DeveloperMode ) + { + //if( version < versionInfo.FullNumber ) + //{ + //ShowMessage( "This shader was created on a older ASE version\nSaving will update it to the new one." ); + //} + } + + graph.LoadedShaderVersion = version; + } + else + { + //ShowMessage( "Corrupted version" ); + } + + // valid instructions are only between the line after version and the line before the last one ( which contains ShaderBodyEnd ) + for ( int instructionIdx = 0; instructionIdx < instructions.Length - 1; instructionIdx++ ) + { + //TODO: After all is working, convert string parameters to ints in order to speed up reading + string[] parameters = instructions[ instructionIdx ].Split( IOUtils.FIELD_SEPARATOR ); + + // All nodes must be created before wiring the connections ... + // Since all nodes on the save op are written before the wires, we can safely create them + // If that order is not maintained the it's because of external editing and its the users responsability + switch( parameters[ 0 ] ) + { + case IOUtils.NodeParam: + { + string typeStr = parameters[ IOUtils.NodeTypeId ]; + typeStr = IOUtils.NodeTypeReplacer.ContainsKey( typeStr ) ? IOUtils.NodeTypeReplacer[ typeStr ] : typeStr; + System.Type type = System.Type.GetType( typeStr ); + if( type == null ) + { + try + { + var editorAssembly = System.Reflection.Assembly.Load( "Assembly-CSharp-Editor" ); + if( editorAssembly != null ) + { + type = editorAssembly.GetType( typeStr ); + } + } + catch( Exception ) + { + + } + if( type == null ) + { + type = IOUtils.GetAssemblyType( typeStr ); + } + } + if( type != null ) + { + System.Type oldType = type; + NodeAttributes attribs = contextMenu.GetNodeAttributesForType( type ); + if( attribs == null ) + { + attribs = contextMenu.GetDeprecatedNodeAttributesForType( type ); + if( attribs != null ) + { + if( attribs.Deprecated && attribs.DeprecatedAlternativeType != null ) + { + type = attribs.DeprecatedAlternativeType; + //ShowMessage( string.Format( "Node {0} is deprecated and was replaced by {1} ", attribs.Name, attribs.DeprecatedAlternative ) ); + } + } + } + + ParentNode newNode = (ParentNode)ScriptableObject.CreateInstance( type ); + if( newNode != null ) + { + try + { + newNode.ContainerGraph = graph; + if( oldType != type ) + { + newNode.ParentReadFromString( ref parameters ); + newNode.ReadFromDeprecated( ref parameters, oldType ); + newNode.WasDeprecated = true; + } + else + newNode.ReadFromString( ref parameters ); + + + if( oldType == type ) + { + newNode.ReadInputDataFromString( ref parameters ); + if( UIUtils.CurrentShaderVersion() > 5107 ) + { + newNode.ReadOutputDataFromString( ref parameters ); + } + } + } + catch( Exception e ) + { + Debug.LogException( e, newNode ); + } + graph.AddNode( newNode, false, true, false ); + } + } + else + { + UIUtils.ShowMessage( string.Format( "{0} is not a valid ASE node ", parameters[ IOUtils.NodeTypeId ] ), MessageSeverity.Error ); + } + } + break; + case IOUtils.WireConnectionParam: + { + int InNodeId = 0; + int InPortId = 0; + int OutNodeId = 0; + int OutPortId = 0; + + try + { + InNodeId = Convert.ToInt32( parameters[ IOUtils.InNodeId ] ); + InPortId = Convert.ToInt32( parameters[ IOUtils.InPortId ] ); + OutNodeId = Convert.ToInt32( parameters[ IOUtils.OutNodeId ] ); + OutPortId = Convert.ToInt32( parameters[ IOUtils.OutPortId ] ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + ParentNode inNode = graph.GetNode( InNodeId ); + ParentNode outNode = graph.GetNode( OutNodeId ); + + //if ( UIUtils.CurrentShaderVersion() < 5002 ) + //{ + // InPortId = inNode.VersionConvertInputPortId( InPortId ); + // OutPortId = outNode.VersionConvertOutputPortId( OutPortId ); + //} + + InputPort inputPort = null; + OutputPort outputPort = null; + if( inNode != null && outNode != null ) + { + + if( UIUtils.CurrentShaderVersion() < 5002 ) + { + InPortId = inNode.VersionConvertInputPortId( InPortId ); + OutPortId = outNode.VersionConvertOutputPortId( OutPortId ); + + if( inNode.WasDeprecated ) + InPortId = inNode.InputIdFromDeprecated( InPortId ); + if( outNode.WasDeprecated ) + OutPortId = outNode.OutputIdFromDeprecated( OutPortId ); + + inputPort = inNode.GetInputPortByArrayId( InPortId ); + outputPort = outNode.GetOutputPortByArrayId( OutPortId ); + } + else + { + if( inNode.WasDeprecated ) + InPortId = inNode.InputIdFromDeprecated( InPortId ); + if( outNode.WasDeprecated ) + OutPortId = outNode.OutputIdFromDeprecated( OutPortId ); + + inputPort = inNode.GetInputPortByUniqueId( InPortId ); + outputPort = outNode.GetOutputPortByUniqueId( OutPortId ); + } + + if( inputPort != null && outputPort != null ) + { + bool inputCompatible = inputPort.CheckValidType( outputPort.DataType ); + bool outputCompatible = outputPort.CheckValidType( inputPort.DataType ); + if( inputCompatible && outputCompatible ) + { + inputPort.ConnectTo( OutNodeId, OutPortId, outputPort.DataType, false ); + outputPort.ConnectTo( InNodeId, InPortId, inputPort.DataType, inputPort.TypeLocked ); + + inNode.OnInputPortConnected( InPortId, OutNodeId, OutPortId, false ); + outNode.OnOutputPortConnected( OutPortId, InNodeId, InPortId ); + } + else if( DebugConsoleWindow.DeveloperMode ) + { + if( !inputCompatible ) + UIUtils.ShowIncompatiblePortMessage( true, inNode, inputPort, outNode, outputPort ); + + if( !outputCompatible ) + UIUtils.ShowIncompatiblePortMessage( true, outNode, outputPort, inNode, inputPort ); + } + } + else if( DebugConsoleWindow.DeveloperMode ) + { + if( inputPort == null ) + { + UIUtils.ShowMessage( "Input Port " + InPortId + " doesn't exist on node " + InNodeId, MessageSeverity.Error ); + } + else + { + UIUtils.ShowMessage( "Output Port " + OutPortId + " doesn't exist on node " + OutNodeId, MessageSeverity.Error ); + } + } + } + else if( DebugConsoleWindow.DeveloperMode ) + { + if( inNode == null ) + { + UIUtils.ShowMessage( "Input node " + InNodeId + " doesn't exist", MessageSeverity.Error ); + } + else + { + UIUtils.ShowMessage( "Output node " + OutNodeId + " doesn't exist", MessageSeverity.Error ); + } + } + } + break; + } + } + } + } + } + + graph.CheckForDuplicates(); + graph.UpdateRegisters(); + graph.RefreshExternalReferences(); + graph.ForceSignalPropagationOnMasterNode(); + graph.LoadedShaderVersion = VersionInfo.FullNumber; + //Reset(); + graph.IsLoading = false; + } + + public ShaderLoadResult LoadFromDisk( string pathname, AmplifyShaderFunction shaderFunction = null ) + { + m_mainGraphInstance.IsLoading = true; + System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; + + FullCleanUndoStack(); + m_performFullUndoRegister = true; + + InlinePropertyTable.Initialize(); + + UIUtils.DirtyMask = false; + if( UIUtils.IsUnityNativeShader( pathname ) ) + { + ShowMessage( "Cannot edit native unity shaders.\nReplacing by a new one." ); + return ShaderLoadResult.UNITY_NATIVE_PATHS; + } + + m_lastOpenedLocation = pathname; + Lastpath = pathname; + + string buffer = string.Empty; + if( shaderFunction == null ) + buffer = IOUtils.LoadTextFileFromDisk( pathname ); + else + buffer = shaderFunction.FunctionInfo; + + if( String.IsNullOrEmpty( buffer ) ) + { + ShowMessage( "Could not open file " + pathname ); + return ShaderLoadResult.FILE_NOT_FOUND; + } + + if( !IOUtils.HasValidShaderBody( ref buffer ) ) + { + return ShaderLoadResult.ASE_INFO_NOT_FOUND; + } + + m_mainGraphInstance.CleanNodes(); + Reset(); + + string[] cameraParams = new string[ 0 ]; + Shader shader = null; + ShaderLoadResult loadResult = ShaderLoadResult.LOADED; + // Find checksum value on body + int checksumId = buffer.IndexOf( IOUtils.CHECKSUM ); + if( checksumId > -1 ) + { + string checkSumStoredValue = buffer.Substring( checksumId ); + string trimmedBuffer = buffer.Remove( checksumId ); + + string[] typeValuePair = checkSumStoredValue.Split( IOUtils.VALUE_SEPARATOR ); + if( typeValuePair != null && typeValuePair.Length == 2 ) + { + // Check read checksum and compare with the actual shader body to detect external changes + string currentChecksumValue = IOUtils.CreateChecksum( trimmedBuffer ); + if( DebugConsoleWindow.DeveloperMode && !currentChecksumValue.Equals( typeValuePair[ 1 ] ) ) + { + ShowMessage( "Wrong checksum" ); + } + + trimmedBuffer = trimmedBuffer.Replace( "\r", string.Empty ); + // find node info body + int shaderBodyId = trimmedBuffer.IndexOf( IOUtils.ShaderBodyBegin ); + if( shaderBodyId > -1 ) + { + trimmedBuffer = trimmedBuffer.Substring( shaderBodyId ); + //Find set of instructions + string[] instructions = trimmedBuffer.Split( IOUtils.LINE_TERMINATOR ); + // First line is to be ignored and second line contains version + string[] versionParams = instructions[ 1 ].Split( IOUtils.VALUE_SEPARATOR ); + if( versionParams.Length == 2 ) + { + int version = 0; + try + { + version = Convert.ToInt32( versionParams[ 1 ] ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + if( version > VersionInfo.FullNumber ) + { + ShowMessage( "This shader was created on a new ASE version\nPlease install v." + version ); + } + + if( DebugConsoleWindow.DeveloperMode ) + { + if( version < VersionInfo.FullNumber ) + { + ShowMessage( "This shader was created on a older ASE version\nSaving will update it to the new one." ); + } + } + + m_mainGraphInstance.LoadedShaderVersion = version; + } + else + { + ShowMessage( "Corrupted version" ); + } + + // @diogo: second line MAY contain camera information ( position, size, offset and zoom ) + string[] split = instructions[ 2 ].Split( IOUtils.FIELD_SEPARATOR ); + if ( split.Length == 9 && float.TryParse( split[ 0 ], NumberStyles.Any, CultureInfo.InvariantCulture, out float value ) ) + { + // @diogo: valid camera parameter serialization + cameraParams = split; + } + + // valid instructions are only between the line after version and the line before the last one ( which contains ShaderBodyEnd ) + for ( int instructionIdx = 0; instructionIdx < instructions.Length - 1; instructionIdx++ ) + { + //TODO: After all is working, convert string parameters to ints in order to speed up reading + string[] parameters = instructions[ instructionIdx ].Split( IOUtils.FIELD_SEPARATOR ); + + // All nodes must be created before wiring the connections ... + // Since all nodes on the save op are written before the wires, we can safely create them + // If that order is not maintained the it's because of external editing and its the users responsability + switch( parameters[ 0 ] ) + { + case IOUtils.NodeParam: + { + string typeStr = parameters[ IOUtils.NodeTypeId ]; + typeStr = IOUtils.NodeTypeReplacer.ContainsKey( typeStr ) ? IOUtils.NodeTypeReplacer[ typeStr ] : typeStr; + System.Type type = System.Type.GetType( typeStr ); + if( type == null ) + { + try + { + var editorAssembly = System.Reflection.Assembly.Load( "Assembly-CSharp-Editor" ); + if( editorAssembly != null ) + { + type = editorAssembly.GetType( typeStr ); + } + } + catch( Exception ) + { + + } + + if( type == null ) + { + type = IOUtils.GetAssemblyType( typeStr ); + } + } + + if( type != null ) + { + System.Type oldType = type; + NodeAttributes attribs = m_contextMenu.GetNodeAttributesForType( type ); + if( attribs == null ) + { + attribs = m_contextMenu.GetDeprecatedNodeAttributesForType( type ); + if( attribs != null ) + { + if( attribs.Deprecated ) + { + if( attribs.DeprecatedAlternativeType != null ) + { + type = attribs.DeprecatedAlternativeType; + ShowMessage( string.Format( "Node {0} is deprecated and was replaced by {1} ", attribs.Name, attribs.DeprecatedAlternative ) ); + } + else + { + if( string.IsNullOrEmpty( attribs.DeprecatedAlternative ) ) + ShowMessage( string.Format( Constants.DeprecatedNoAlternativeMessageStr, attribs.Name, attribs.DeprecatedAlternative ), MessageSeverity.Normal, false ); + else + ShowMessage( string.Format( Constants.DeprecatedMessageStr, attribs.Name, attribs.DeprecatedAlternative ), MessageSeverity.Normal, false ); + } + } + } + } + + ParentNode newNode = (ParentNode)ScriptableObject.CreateInstance( type ); + if( newNode != null ) + { + try + { + newNode.ContainerGraph = m_mainGraphInstance; + if( oldType != type ) + { + newNode.ParentReadFromString( ref parameters ); + newNode.ReadFromDeprecated( ref parameters, oldType ); + newNode.WasDeprecated = true; + } + else + newNode.ReadFromString( ref parameters ); + + + if( oldType == type ) + { + newNode.ReadInputDataFromString( ref parameters ); + if( UIUtils.CurrentShaderVersion() > 5107 ) + { + newNode.ReadOutputDataFromString( ref parameters ); + } + } + } + catch( Exception e ) + { + Debug.LogException( e, newNode ); + } + m_mainGraphInstance.AddNode( newNode, false, true, false ); + } + } + else + { + ShowMessage( string.Format( "{0} is not a valid ASE node ", parameters[ IOUtils.NodeTypeId ] ), MessageSeverity.Error ); + } + } + break; + case IOUtils.WireConnectionParam: + { + int InNodeId = 0; + int InPortId = 0; + int OutNodeId = 0; + int OutPortId = 0; + + try + { + InNodeId = Convert.ToInt32( parameters[ IOUtils.InNodeId ] ); + InPortId = Convert.ToInt32( parameters[ IOUtils.InPortId ] ); + OutNodeId = Convert.ToInt32( parameters[ IOUtils.OutNodeId ] ); + OutPortId = Convert.ToInt32( parameters[ IOUtils.OutPortId ] ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + ParentNode inNode = m_mainGraphInstance.GetNode( InNodeId ); + ParentNode outNode = m_mainGraphInstance.GetNode( OutNodeId ); + + //if ( UIUtils.CurrentShaderVersion() < 5002 ) + //{ + // InPortId = inNode.VersionConvertInputPortId( InPortId ); + // OutPortId = outNode.VersionConvertOutputPortId( OutPortId ); + //} + + InputPort inputPort = null; + OutputPort outputPort = null; + if( inNode != null && outNode != null ) + { + + if( UIUtils.CurrentShaderVersion() < 5002 ) + { + InPortId = inNode.VersionConvertInputPortId( InPortId ); + OutPortId = outNode.VersionConvertOutputPortId( OutPortId ); + + if( inNode.WasDeprecated ) + InPortId = inNode.InputIdFromDeprecated( InPortId ); + if( outNode.WasDeprecated ) + OutPortId = outNode.OutputIdFromDeprecated( OutPortId ); + + inputPort = inNode.GetInputPortByArrayId( InPortId ); + outputPort = outNode.GetOutputPortByArrayId( OutPortId ); + } + else + { + if( inNode.WasDeprecated ) + InPortId = inNode.InputIdFromDeprecated( InPortId ); + if( outNode.WasDeprecated ) + OutPortId = outNode.OutputIdFromDeprecated( OutPortId ); + + inputPort = inNode.GetInputPortByUniqueId( InPortId ); + outputPort = outNode.GetOutputPortByUniqueId( OutPortId ); + } + + if( inputPort != null && outputPort != null ) + { + bool inputCompatible = inputPort.CheckValidType( outputPort.DataType ); + bool outputCompatible = outputPort.CheckValidType( inputPort.DataType ); + if( inputCompatible && outputCompatible ) + { + inputPort.ConnectTo( OutNodeId, OutPortId, outputPort.DataType, false ); + outputPort.ConnectTo( InNodeId, InPortId, inputPort.DataType, inputPort.TypeLocked ); + + inNode.OnInputPortConnected( InPortId, OutNodeId, OutPortId, false ); + outNode.OnOutputPortConnected( OutPortId, InNodeId, InPortId ); + } + else if( DebugConsoleWindow.DeveloperMode ) + { + if( !inputCompatible ) + UIUtils.ShowIncompatiblePortMessage( true, inNode, inputPort, outNode, outputPort ); + + if( !outputCompatible ) + UIUtils.ShowIncompatiblePortMessage( true, outNode, outputPort, inNode, inputPort ); + } + } + else if( DebugConsoleWindow.DeveloperMode ) + { + if( inputPort == null ) + { + UIUtils.ShowMessage( "Input Port " + InPortId + " doesn't exist on node " + InNodeId, MessageSeverity.Error ); + } + else + { + UIUtils.ShowMessage( "Output Port " + OutPortId + " doesn't exist on node " + OutNodeId, MessageSeverity.Error ); + } + } + } + else if( DebugConsoleWindow.DeveloperMode ) + { + if( inNode == null ) + { + UIUtils.ShowMessage( "Input node " + InNodeId + " doesn't exist", MessageSeverity.Error ); + } + else + { + UIUtils.ShowMessage( "Output node " + OutNodeId + " doesn't exist", MessageSeverity.Error ); + } + } + } + break; + } + } + + if ( shaderFunction != null ) + { + m_onLoadDone = 2; + } + else + { + shader = AssetDatabase.LoadAssetAtPath( pathname ); + if ( shader ) + { + + m_onLoadDone = 2; + } + else + { + ShowMessage( "Could not load shader asset" ); + } + } + } + else + { + ShowMessage( "Graph info not found" ); + } + } + else + { + ShowMessage( "Corrupted checksum" ); + } + } + else + { + ShowMessage( "Checksum not found" ); + } + + //m_mainGraphInstance.LoadedShaderVersion = m_versionInfo.FullNumber; + if( UIUtils.CurrentMasterNode() ) + UIUtils.CurrentMasterNode().ForcePortType(); + + UIUtils.DirtyMask = true; + m_checkInvalidConnections = true; + + m_mainGraphInstance.CheckForDuplicates(); + m_mainGraphInstance.UpdateRegisters(); + m_mainGraphInstance.RefreshExternalReferences(); + m_mainGraphInstance.ForceSignalPropagationOnMasterNode(); + + InlinePropertyTable.ResolveDependencies(); + + if( shaderFunction != null ) + { + //if( CurrentGraph.CurrentFunctionOutput == null ) + //{ + // //Fix in case a function output node is not marked as main node + // CurrentGraph.AssignMasterNode( UIUtils.FunctionOutputList()[ 0 ], false ); + //} + shaderFunction.ResetDirectivesOrigin(); + CurrentGraph.CurrentShaderFunction = shaderFunction; + } + else + { + if( shader != null ) + { + m_mainGraphInstance.UpdateShaderOnMasterNode( shader ); + if( m_mainGraphInstance.CurrentCanvasMode == NodeAvailability.TemplateShader ) + { + m_mainGraphInstance.RefreshLinkedMasterNodes( false ); + m_mainGraphInstance.OnRefreshLinkedPortsComplete(); + //m_mainGraphInstance.SetLateOptionsRefresh(); + } + } + } + + // @diogo: set camera parameters + if ( shaderFunction != null || shader != null ) + { + cameraParams = ( cameraParams.Length != 0 ) ? cameraParams : EditorPrefs.GetString( GUID, "" ).Split( IOUtils.FIELD_SEPARATOR ); + + if ( cameraParams.Length == 9 ) + { + try + { + var cameraInfo = new Rect( Convert.ToSingle( cameraParams[ 0 ] ), Convert.ToSingle( cameraParams[ 1 ] ), Convert.ToSingle( cameraParams[ 2 ] ), Convert.ToSingle( cameraParams[ 3 ] ) ); + var cameraOffset = new Vector2( Convert.ToSingle( cameraParams[ 4 ] ), Convert.ToSingle( cameraParams[ 5 ] ) ); + float cameraZoom = Convert.ToSingle( cameraParams[ 6 ] ); + + float centerWidth = ( this.position.width - cameraInfo.width ) * 0.5f * cameraZoom; + float centerHeight = ( this.position.height - cameraInfo.height ) * 0.5f * cameraZoom; + + cameraInfo.x += centerWidth; + cameraInfo.y += centerHeight; + + cameraOffset.x += centerWidth; + cameraOffset.y += centerHeight; + + bool nodeParametersWindowMaximized = Convert.ToBoolean( cameraParams[ 7 ] ); + bool paletteWindowMaximized = Convert.ToBoolean( cameraParams[ 8 ] ); + + m_cameraInfo = cameraInfo; + m_cameraOffset = cameraOffset; + CameraZoom = cameraZoom; + + if ( DebugConsoleWindow.UseShaderPanelsInfo ) + { + m_nodeParametersWindowMaximized = m_nodeParametersWindow.IsMaximized = nodeParametersWindowMaximized; + m_paletteWindowMaximized = m_paletteWindow.IsMaximized = paletteWindowMaximized; + } + } + catch ( Exception ) + { + FocusZoom( true, false, false ); + } + } + else + { + FocusZoom( true, false, false ); + } + } + + m_mainGraphInstance.LoadedShaderVersion = VersionInfo.FullNumber; + + System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; + + m_mainGraphInstance.IsLoading = false; + //Remove focus from UI elements so no UI is incorrectly selected from previous loads + //Shader Name textfield was sometimes incorrectly selected + GUI.FocusControl( null ); + return loadResult; + } + + public void FullCleanUndoStack() + { + UndoUtils.ClearUndo( this ); + m_mainGraphInstance.FullCleanUndoStack(); + } + + public void FullRegisterOnUndoStack() + { + UndoUtils.RegisterCompleteObjectUndo( this, Constants.UndoRegisterFullGrapId ); + m_mainGraphInstance.FullRegisterOnUndoStack(); + } + + public void ShowPortInfo() + { + GetWindow(); + } + + public void ShowShaderLibrary() + { + GetWindow(); + } + + public void ShowMessage( string message, MessageSeverity severity = MessageSeverity.Normal, bool registerTimestamp = true, bool consoleLog = false ) + { + ShowMessage( -1, message, severity, registerTimestamp, consoleLog ); + } + + public void ShowMessage( int messageOwner, string message, MessageSeverity severity = MessageSeverity.Normal, bool registerTimestamp = true, bool consoleLog = false ) + { + if( UIUtils.InhibitMessages || m_genericMessageUI == null ) + return; + + m_consoleLogWindow.AddMessage( severity, message , messageOwner); + + MarkToRepaint(); + + if( consoleLog ) + { + switch( severity ) + { + case MessageSeverity.Normal: + { + Debug.Log( message ); + } + break; + case MessageSeverity.Warning: + { + Debug.LogWarning( message ); + } + break; + case MessageSeverity.Error: + { + Debug.LogError( message ); + } + break; + } + } + } + + // NOTE: this can probably be removed safely + public void ShowMessageImmediately( string message, MessageSeverity severity = MessageSeverity.Normal, bool consoleLog = true ) + { + if( UIUtils.InhibitMessages ) + return; + + switch( severity ) + { + case MessageSeverity.Normal: + { + m_genericMessageContent.text = message; + if( consoleLog ) + { + Debug.Log( message ); + } + } + break; + case MessageSeverity.Warning: + { + m_genericMessageContent.text = "Warning!\n" + message; + if( consoleLog ) + { + Debug.LogWarning( message ); + } + } + break; + case MessageSeverity.Error: + { + m_genericMessageContent.text = "Error!!!\n" + message; + if( consoleLog ) + { + Debug.LogError( message ); + } + } + break; + } + + try + { + ShowNotification( m_genericMessageContent ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + + public bool MouseInteracted = false; + + void OnGUI() + { + if( ASEPackageManagerHelper.CheckImporter ) + return; + +#if UNITY_EDITOR_WIN + if( m_openSavedFolder && Event.current.type == EventType.Repaint ) + { + OpenSavedFolder(); + return; + } +#endif + AmplifyShaderEditorWindow cacheWindow = UIUtils.CurrentWindow; + UIUtils.CurrentWindow = this; + + if( !m_initialized || (object)UIUtils.MainSkin == null || !UIUtils.Initialized ) + { + UIUtils.InitMainSkin(); + Init(); + } + + m_currentEvent = Event.current; + if( m_currentEvent.type == EventType.ExecuteCommand || m_currentEvent.type == EventType.ValidateCommand ) + m_currentCommandName = m_currentEvent.commandName; + else + m_currentCommandName = string.Empty; + + System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; + + MouseInteracted = false; + + if( m_refreshOnUndo ) + { + m_refreshOnUndo = false; + m_mainGraphInstance.RefreshOnUndo(); + } + + if( m_refreshAvailableNodes ) + { + RefreshAvaibleNodes(); + } + + if( m_previousShaderFunction != CurrentGraph.CurrentShaderFunction ) + { + m_nodeParametersWindow.ForceUpdate = true; + m_previousShaderFunction = CurrentGraph.CurrentShaderFunction; + } + + if( m_nodeToFocus != null && m_currentEvent.type == EventType.Layout ) + { + FocusOnNode( m_nodeToFocus, m_zoomToFocus, m_selectNodeToFocus ); + m_nodeToFocus = null; + } + + m_mainGraphInstance.OnDuplicateEventWrapper(); + + m_currentInactiveTime = CalculateInactivityTime(); + + if( m_nodeParametersWindow != null && m_innerEditorVariables.NodeParametersMaximized != m_nodeParametersWindow.IsMaximized ) + m_innerEditorVariables.NodeParametersMaximized = m_nodeParametersWindow.IsMaximized; + if( m_paletteWindow != null && m_innerEditorVariables.NodePaletteMaximized != m_paletteWindow.IsMaximized ) + m_innerEditorVariables.NodePaletteMaximized = m_paletteWindow.IsMaximized; + + if( m_checkInvalidConnections ) + { + m_checkInvalidConnections = false; + m_mainGraphInstance.DeleteInvalidConnections(); + } + + //if ( m_repaintIsDirty ) + //{ + // m_repaintIsDirty = false; + // ForceRepaint(); + //} + + if( m_forcingMaterialUpdateFlag ) + { + Focus(); + if( m_materialsToUpdate.Count > 0 ) + { + float percentage = 100.0f * (float)( UIUtils.TotalExampleMaterials - m_materialsToUpdate.Count ) / (float)UIUtils.TotalExampleMaterials; + if( m_forcingMaterialUpdateOp ) // Read + { + Debug.Log( percentage + "% Recompiling " + m_materialsToUpdate[ 0 ].name ); + LoadDroppedObject( true, m_materialsToUpdate[ 0 ].shader, m_materialsToUpdate[ 0 ] ); + } + else // Write + { + Debug.Log( percentage + "% Saving " + m_materialsToUpdate[ 0 ].name ); + SaveToDisk( false ); + m_materialsToUpdate.RemoveAt( 0 ); + } + m_forcingMaterialUpdateOp = !m_forcingMaterialUpdateOp; + } + else + { + Debug.Log( "100% - All Materials compiled " ); + m_forcingMaterialUpdateFlag = false; + } + } + + + if( m_removedKeyboardFocus ) + { + m_removedKeyboardFocus = false; + GUIUtility.keyboardControl = 0; + } + + + Vector2 pos = m_currentEvent.mousePosition; + pos.x += position.x; + pos.y += position.y; + m_insideEditorWindow = position.Contains( pos ); + + if( m_delayedLoadObject != null && m_mainGraphInstance.CurrentMasterNode != null ) + { + m_mainGraphInstance.SetLateOptionsRefresh(); + LoadObject( m_delayedLoadObject ); + m_delayedLoadObject = null; + } + else if( m_delayedLoadObject != null && m_mainGraphInstance.CurrentOutputNode != null ) + { + m_mainGraphInstance.SetLateOptionsRefresh(); + LoadObject( m_delayedLoadObject ); + m_delayedLoadObject = null; + } + + if( m_delayedMaterialSet != null && m_mainGraphInstance.CurrentMasterNode != null ) + { + m_mainGraphInstance.UpdateMaterialOnMasterNode( m_delayedMaterialSet ); + m_mainGraphInstance.SetMaterialModeOnGraph( m_delayedMaterialSet ); + CurrentSelection = ASESelectionMode.Material; + IsShaderFunctionWindow = false; + m_delayedMaterialSet = null; + } + + Material currentMaterial = m_mainGraphInstance.CurrentMaterial; + if( m_forceUpdateFromMaterialFlag ) + { + Focus(); + m_forceUpdateFromMaterialFlag = false; + if( currentMaterial != null ) + { + m_mainGraphInstance.CopyValuesFromMaterial( currentMaterial ); + m_repaintIsDirty = true; + } + } + + m_repaintCount = 0; + m_cameraInfo = position; + + //if( m_currentEvent.type == EventType.keyDown ) + if( m_currentEvent.type == EventType.Repaint ) + m_keyEvtMousePos2D = m_currentEvent.mousePosition; + + m_currentMousePos2D = m_currentEvent.mousePosition; + m_currentMousePos.x = m_currentMousePos2D.x; + m_currentMousePos.y = m_currentMousePos2D.y; + + m_graphArea.width = m_cameraInfo.width; + m_graphArea.height = m_cameraInfo.height; + + m_autoPanDirActive = m_lmbPressed || m_forceAutoPanDir || m_multipleSelectionActive || m_wireReferenceUtils.ValidReferences(); + + + // Need to use it in order to prevent Mismatched LayoutGroup on ValidateCommand when rendering nodes + //if( Event.current.type == EventType.ValidateCommand ) + //{ + // Event.current.Use(); + //} + + // Nodes Graph background area + //GUILayout.BeginArea( m_graphArea, "Nodes" ); + { + // Camera movement is simulated by grabing the current camera offset, transforming it into texture space and manipulating the tiled texture uv coords + GUI.DrawTextureWithTexCoords( m_graphArea, m_graphBgTexture, + new Rect( ( -m_cameraOffset.x / m_graphBgTexture.width ), + ( m_cameraOffset.y / m_graphBgTexture.height ) - m_cameraZoom * m_cameraInfo.height / m_graphBgTexture.height, + m_cameraZoom * m_cameraInfo.width / m_graphBgTexture.width, + m_cameraZoom * m_cameraInfo.height / m_graphBgTexture.height ) ); + + Color col = GUI.color; + GUI.color = new Color( 1, 1, 1, 0.7f ); + GUI.DrawTexture( m_graphArea, m_graphFgTexture, ScaleMode.StretchToFill, true ); + GUI.color = col; + } + //GUILayout.EndArea(); + + if( DebugConsoleWindow.DeveloperMode && m_currentEvent.type == EventType.Repaint ) + { + GUI.Label( new Rect(Screen.width - 60, 40, 60, 50), m_fpsDisplay ); + } + + bool restoreMouse = false; + if( InsideMenus( m_currentMousePos2D ) /*|| _confirmationWindow.IsActive*/ ) + { + if( Event.current.type == EventType.MouseDown ) + { + restoreMouse = true; + Event.current.type = EventType.Ignore; + } + + // Must guarantee that mouse up ops on menus will reset auto pan if it is set + if( m_currentEvent.type == EventType.MouseUp && m_currentEvent.button == ButtonClickId.LeftMouseButton ) + { + m_lmbPressed = false; + } + + } + // Nodes + //GUILayout.BeginArea( m_graphArea ); + { + m_drawInfo.CameraArea = m_cameraInfo; + m_drawInfo.TransformedCameraArea = m_graphArea; + + m_drawInfo.MousePosition = m_currentMousePos2D; + m_drawInfo.CameraOffset = m_cameraOffset; + m_drawInfo.InvertedZoom = 1 / m_cameraZoom; + m_drawInfo.LeftMouseButtonPressed = m_currentEvent.button == ButtonClickId.LeftMouseButton; + m_drawInfo.CurrentEventType = m_currentEvent.type; + m_drawInfo.ZoomChanged = m_zoomChanged; + + m_drawInfo.TransformedMousePos = m_currentMousePos2D * m_cameraZoom - m_cameraOffset; + + if( m_drawInfo.CurrentEventType == EventType.Repaint ) + UIUtils.UpdateMainSkin( m_drawInfo ); + + // Draw mode indicator + m_modeWindow.Draw( m_graphArea, m_currentMousePos2D, m_mainGraphInstance.CurrentShader, currentMaterial, + 0.5f * ( m_graphArea.width - m_paletteWindow.RealWidth - m_nodeParametersWindow.RealWidth ), + ( m_nodeParametersWindow.IsMaximized ? m_nodeParametersWindow.RealWidth : 0 ), + ( m_paletteWindow.IsMaximized ? m_paletteWindow.RealWidth : 0 )/*, m_openedAssetFromNode*/ ); + + PreTestLeftMouseDown(); + //m_consoleLogWindow.Draw( m_graphArea, m_currentMousePos2D, m_currentEvent.button, false, m_paletteWindow.IsMaximized ? m_paletteWindow.RealWidth : 0 ); + //m_mainGraphInstance.DrawBezierBoundingBox(); + //CheckNodeReplacement(); + + // Main Graph Draw + m_repaintIsDirty = m_mainGraphInstance.Draw( m_drawInfo ) || m_repaintIsDirty; + + m_mainGraphInstance.DrawGrid( m_drawInfo ); + bool hasUnusedConnNodes = m_mainGraphInstance.HasUnConnectedNodes; + m_toolsWindow.SetStateOnButton( ToolButtonType.CleanUnusedNodes, hasUnusedConnNodes ? 1 : 0 ); + + m_zoomChanged = false; + + MasterNode masterNode = m_mainGraphInstance.CurrentMasterNode; + if( masterNode != null ) + { + m_toolsWindow.DrawShaderTitle( m_nodeParametersWindow, m_paletteWindow, AvailableCanvasWidth, m_graphArea.height, masterNode.CroppedShaderName ); + } + else if( m_mainGraphInstance.CurrentOutputNode != null ) + { + string functionName = string.Empty; + + if( m_mainGraphInstance.CurrentShaderFunction != null ) + functionName = m_mainGraphInstance.CurrentShaderFunction.FunctionName; + m_toolsWindow.DrawShaderTitle( m_nodeParametersWindow, m_paletteWindow, AvailableCanvasWidth, m_graphArea.height, functionName ); + } + } + //m_consoleLogWindow.Draw( m_graphArea, m_currentMousePos2D, m_currentEvent.button, false, m_paletteWindow.IsMaximized ? m_paletteWindow.RealWidth : 0 ); + //GUILayout.EndArea(); + + if( restoreMouse ) + { + Event.current.type = EventType.MouseDown; + m_drawInfo.CurrentEventType = EventType.MouseDown; + } + + m_toolsWindow.InitialX = m_nodeParametersWindow.RealWidth; + m_toolsWindow.Width = m_cameraInfo.width - ( m_nodeParametersWindow.RealWidth + m_paletteWindow.RealWidth ); + m_toolsWindow.Draw( m_cameraInfo, m_currentMousePos2D, m_currentEvent.button, false ); + + m_tipsWindow.Draw( m_cameraInfo, m_currentMousePos2D, m_currentEvent.button, false ); + + bool autoMinimize = false; + if( position.width < m_lastWindowWidth && position.width < Constants.MINIMIZE_WINDOW_LOCK_SIZE ) + { + autoMinimize = true; + } + + if( autoMinimize ) + m_nodeParametersWindow.IsMaximized = false; + + ParentNode selectedNode = ( m_mainGraphInstance.SelectedNodes.Count == 1 ) ? m_mainGraphInstance.SelectedNodes[ 0 ] : m_mainGraphInstance.CurrentMasterNode; + m_repaintIsDirty = m_nodeParametersWindow.Draw( m_cameraInfo, selectedNode, m_currentMousePos2D, m_currentEvent.button, false ) || m_repaintIsDirty; //TODO: If multiple nodes from the same type are selected also show a parameters window which modifies all of them + if( m_nodeParametersWindow.IsResizing ) + m_repaintIsDirty = true; + + // Test to ignore mouse on main palette when inside context palette ... IsInside also takes active state into account + bool ignoreMouseForPalette = m_contextPalette.IsInside( m_currentMousePos2D ); + if( ignoreMouseForPalette && Event.current.type == EventType.MouseDown ) + { + Event.current.type = EventType.Ignore; + m_drawInfo.CurrentEventType = EventType.Ignore; + } + if( autoMinimize ) + m_paletteWindow.IsMaximized = false; + + m_paletteWindow.Draw( m_cameraInfo, m_currentMousePos2D, m_currentEvent.button, !m_contextPalette.IsActive ); + if( m_paletteWindow.IsResizing ) + { + m_repaintIsDirty = true; + } + + if( ignoreMouseForPalette ) + { + if( restoreMouse ) + { + Event.current.type = EventType.MouseDown; + m_drawInfo.CurrentEventType = EventType.MouseDown; + } + } + + m_consoleLogWindow.Draw( m_graphArea, m_currentMousePos2D, m_currentEvent.button, false, m_paletteWindow.IsMaximized ? m_paletteWindow.RealWidth : 0 ); + + if( m_contextPalette.IsActive ) + { + m_contextPalette.Draw( m_cameraInfo, m_currentMousePos2D, m_currentEvent.button, m_contextPalette.IsActive ); + } + + if( m_palettePopup.IsActive ) + { + m_palettePopup.Draw( m_currentMousePos2D ); + m_repaintIsDirty = true; + int controlID = GUIUtility.GetControlID( FocusType.Passive ); + if( m_currentEvent.GetTypeForControl( controlID ) == EventType.MouseUp ) + { + if( m_currentEvent.button == ButtonClickId.LeftMouseButton ) + { + m_palettePopup.Deactivate(); + if( !InsideMenus( m_currentMousePos2D ) ) + { + ParentNode newNode = CreateNode( m_paletteChosenType, TranformedMousePos, m_paletteChosenFunction ); + //Debug.Log("created menu"); + m_mainGraphInstance.SelectNode( newNode, false, false ); + + bool find = false; + if( newNode is FunctionNode && CurrentGraph.CurrentShaderFunction != null ) + find = SearchFunctionNodeRecursively( CurrentGraph.CurrentShaderFunction ); + + if( find ) + { + DestroyNode( newNode, false ); + ShowMessage( "Shader Function loop detected, new node was removed to prevent errors." ); + } + else + { + newNode.RefreshExternalReferences(); + } + } + } + } + } + + // Handle all events ( mouse interaction + others ) + if( !MouseInteracted ) + HandleGUIEvents(); + + if( m_currentEvent.type == EventType.Repaint ) + { + m_mainGraphInstance.UpdateMarkForDeletion(); + } + // UI Overlay + // Selection Box + if( m_multipleSelectionActive ) + { + UpdateSelectionArea(); + Rect transformedArea = m_multipleSelectionArea; + transformedArea.position = ( transformedArea.position + m_cameraOffset ) / m_cameraZoom; + transformedArea.size /= m_cameraZoom; + + if( transformedArea.width < 0 ) + { + transformedArea.width = -transformedArea.width; + transformedArea.x -= transformedArea.width; + } + + if( transformedArea.height < 0 ) + { + transformedArea.height = -transformedArea.height; + transformedArea.y -= transformedArea.height; + } + Color original = GUI.color; + GUI.color = Constants.BoxSelectionColor; + GUI.Label( transformedArea, "", UIUtils.Box ); + GUI.color = original; + //GUI.backgroundColor = original; + } + + bool isResizing = m_nodeParametersWindow.IsResizing || m_paletteWindow.IsResizing; + //Test boundaries for auto-pan + if( !isResizing && m_autoPanDirActive ) + { + m_autoPanArea[ (int)AutoPanLocation.LEFT ].AdjustInitialX = m_nodeParametersWindow.IsMaximized ? m_nodeParametersWindow.RealWidth : 0; + m_autoPanArea[ (int)AutoPanLocation.RIGHT ].AdjustInitialX = m_paletteWindow.IsMaximized ? -m_paletteWindow.RealWidth : 0; + Vector2 autoPanDir = Vector2.zero; + for( int i = 0; i < m_autoPanArea.Length; i++ ) + { + if( m_autoPanArea[ i ].CheckArea( m_currentMousePos2D, m_cameraInfo, false ) ) + { + autoPanDir += m_autoPanArea[ i ].Velocity; + } + } + m_cameraOffset += autoPanDir; + if( !m_wireReferenceUtils.ValidReferences() && m_insideEditorWindow && !m_altBoxSelection ) + { + m_mainGraphInstance.MoveSelectedNodes( -autoPanDir ); + } + + m_repaintIsDirty = true; + } + + m_isDirty = m_isDirty || m_mainGraphInstance.IsDirty; + if( m_isDirty ) + { + m_isDirty = false; + //ShaderIsModified = true; + EditorUtility.SetDirty( this ); + } + + m_saveIsDirty = m_saveIsDirty || m_mainGraphInstance.SaveIsDirty; + if( m_liveShaderEditing ) + { + if( m_saveIsDirty ) + { + if( focusedWindow == this && m_currentInactiveTime > InactivitySaveTime && !(EditorGUIUtility.editingTextField && EditorGUIUtility.keyboardControl!=0) ) + { + m_saveIsDirty = false; + if( m_mainGraphInstance.CurrentMasterNodeId != Constants.INVALID_NODE_ID ) + { + SaveToDisk( true ); + } + else + { + ShowMessage( LiveShaderError ); + } + } + } + } + else if( m_saveIsDirty ) + { + ShaderIsModified = true; + m_saveIsDirty = false; + } + + if( m_onLoadDone > 0 ) + { + m_onLoadDone--; + if( m_onLoadDone == 0 ) + { + ShaderIsModified = false; + } + } + + if( m_cacheSaveOp ) + { + if( ( EditorApplication.timeSinceStartup - m_lastTimeSaved ) > SaveTime ) + { + SaveToDisk( false ); + } + } + m_genericMessageUI.CheckForMessages(); + + if( m_ctrlSCallback ) + { + m_ctrlSCallback = false; + OnToolButtonPressed( ToolButtonType.Update ); + } + + m_lastWindowWidth = position.width; + m_nodeExporterUtils.Update(); + + if( m_markedToSave ) + { + m_markedToSave = false; + SaveToDisk( false ); + } + if( m_performFullUndoRegister ) + { + m_performFullUndoRegister = false; + FullRegisterOnUndoStack(); + } + + if( CheckFunctions ) + CheckFunctions = false; + + System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; + + UIUtils.CurrentWindow = cacheWindow; + if( !m_nodesLoadedCorrectly ) + { + try + { + ShowNotification( NodesExceptionMessage ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + + CheckNodeReplacement(); +#if UNITY_EDITOR_WIN + if( m_takeScreenShot ) + FocusZoom( true, false, false ); + + if( m_takeScreenShot && Event.current.type == EventType.Repaint ) + TakeScreenShot(); +#endif + + if( Event.current.type == EventType.Layout ) + { + switch( State ) + { + default: + case OpenSaveState.NONE: + break; + case OpenSaveState.OPEN: + { + State = OpenSaveState.WAIT; + string list = EditorPrefs.GetString( ASEFileList , "" ); + m_assetPaths = new List( list.Split( ',' ) ); + Repaint(); + } + break; + case OpenSaveState.WAIT: + { + // we wait one frame to give time for the editor to properly initialize everything + State = OpenSaveState.SAVE; + Repaint(); + } + break; + case OpenSaveState.SAVE: + { + State = OpenSaveState.CLOSE; + try + { + SaveToDisk( false ); + } + catch( Exception e ) + { + State = OpenSaveState.NONE; + EditorPrefs.DeleteKey( ASEFileList ); + throw e; + } + + Repaint(); + } + break; + case OpenSaveState.CLOSE: + { + State = OpenSaveState.NONE; + m_assetPaths.RemoveAt( 0 ); + if( m_assetPaths.Count > 0 ) + { + AmplifyShaderEditorWindow.LoadAndSaveList( m_assetPaths.ToArray() ); + } + else + { + EditorPrefs.DeleteKey( ASEFileList ); + + m_batchTimer.Stop(); + if ( Preferences.User.LogBatchCompile ) + { + Debug.Log( "[AmplifyShaderEditor] Finished batch compilation in " + m_batchTimer.Elapsed.TotalSeconds.ToString( "0.00" ) + " seconds." ); + } + } + this.Close(); + } + break; + } + } + } + + bool m_markToClose = false; + private List m_assetPaths = new List(); + public OpenSaveState State = OpenSaveState.NONE; + public enum OpenSaveState + { + NONE, + OPEN, + WAIT, + SAVE, + CLOSE + } + + void OnInspectorUpdate() + { + ASEPackageManagerHelper.Update(); + + if( m_afterDeserializeFlag ) + { + m_afterDeserializeFlag = false; + //m_mainGraphInstance.ParentWindow = this; + } + + if( (IsShaderFunctionWindow && CurrentGraph.CurrentShaderFunction == null) || m_markToClose ) + { + Close(); + } + } + + public void SetCtrlSCallback( bool imediate ) + { + //MasterNode node = _mainGraphInstance.CurrentMasterNode; + if( /*node != null && node.CurrentShader != null && */m_shaderIsModified ) + { + if( imediate ) + { + OnToolButtonPressed( ToolButtonType.Update ); + } + else + { + m_ctrlSCallback = true; + } + } + } + + public void SetSaveIsDirty() + { + m_saveIsDirty = true && UIUtils.DirtyMask; + } + + public void OnPaletteNodeCreate( System.Type type, string name, AmplifyShaderFunction function ) + { + m_mainGraphInstance.DeSelectAll(); + m_paletteChosenType = type; + m_paletteChosenFunction = function; + m_palettePopup.Activate( name ); + } + + public void OnContextPaletteNodeCreate( System.Type type, string name, AmplifyShaderFunction function ) + { + m_mainGraphInstance.DeSelectAll(); + ParentNode newNode = CreateNode( type, m_contextPalette.StartDropPosition * m_cameraZoom - m_cameraOffset, function ); + //Debug.Log( "created context" ); + m_mainGraphInstance.SelectNode( newNode, false, false ); + bool find = false; + if( newNode is FunctionNode && CurrentGraph.CurrentShaderFunction != null ) + find = SearchFunctionNodeRecursively( CurrentGraph.CurrentShaderFunction ); + + if( find ) + { + DestroyNode( newNode, false ); + ShowMessage( "Shader Function loop detected, new node was removed to prevent errors." ); + } + else + { + newNode.RefreshExternalReferences(); + } + } + + void OnNodeStoppedMovingEvent( ParentNode node ) + { + CheckZoomBoundaries( node.Vec2Position ); + //ShaderIsModified = true; + } + + void OnRefreshFunctionNodeEvent( FunctionNode node ) + { + Debug.Log( node ); + } + + private const string ShaderIsModifiedMessage = "Click to save changes."; + private const string ShaderIsNotModified = "No changes to save, up-to-date."; + void OnMaterialUpdated( MasterNode masterNode ) + { + if( masterNode != null ) + { + if( masterNode.CurrentMaterial ) + { + m_toolsWindow.SetStateOnButton( ToolButtonType.Update, ShaderIsModified ? 0 : 2, ShaderIsModified ? ShaderIsModifiedMessage : ShaderIsNotModified); + } + else + { + m_toolsWindow.SetStateOnButton( ToolButtonType.Update, 1, "Set an active Material in the Master Node." ); + } + UpdateLiveUI(); + } + else + { + m_toolsWindow.SetStateOnButton( ToolButtonType.Update, 1, "Set an active Material in the Master Node." ); + } + } + + void OnShaderUpdated( MasterNode masterNode ) + { + m_toolsWindow.SetStateOnButton( ToolButtonType.OpenSourceCode, masterNode.CurrentShader != null ? 1 : 0 ); + } + + public void CheckZoomBoundaries( Vector2 newPosition ) + { + if( newPosition.x < m_minNodePos.x ) + { + m_minNodePos.x = newPosition.x; + } + else if( newPosition.x > m_maxNodePos.x ) + { + m_maxNodePos.x = newPosition.x; + } + + if( newPosition.y < m_minNodePos.y ) + { + m_minNodePos.y = newPosition.y; + } + else if( newPosition.y > m_maxNodePos.y ) + { + m_maxNodePos.y = newPosition.y; + } + } + public void DestroyNode( ParentNode node, bool registerUndo = true ) { m_mainGraphInstance.DestroyNode( node, registerUndo ); } + public ParentNode CreateNode( System.Type type, Vector2 position, AmplifyShaderFunction function = null, bool selectNode = true ) + { + ParentNode node; + if( function == null ) + node = m_mainGraphInstance.CreateNode( type, true ); + else + node = m_mainGraphInstance.CreateNode( function, true ); + + Vector2 newPosition = position; + node.Vec2Position = newPosition; + CheckZoomBoundaries( newPosition ); + + // Connect node if a wire is active + if( m_wireReferenceUtils.ValidReferences() ) + { + if( m_wireReferenceUtils.InputPortReference.IsValid ) + { + ParentNode originNode = m_mainGraphInstance.GetNode( m_wireReferenceUtils.InputPortReference.NodeId ); + InputPort originPort = originNode.GetInputPortByUniqueId( m_wireReferenceUtils.InputPortReference.PortId ); + OutputPort outputPort = node.GetFirstOutputPortOfType( m_wireReferenceUtils.InputPortReference.DataType, true ); + if( outputPort != null && originPort.CheckValidType( outputPort.DataType ) && ( !m_wireReferenceUtils.InputPortReference.TypeLocked || + m_wireReferenceUtils.InputPortReference.DataType == WirePortDataType.OBJECT || + ( m_wireReferenceUtils.InputPortReference.TypeLocked && outputPort.DataType == m_wireReferenceUtils.InputPortReference.DataType ) ) ) + { + + //link output to input + if( outputPort.ConnectTo( m_wireReferenceUtils.InputPortReference.NodeId, m_wireReferenceUtils.InputPortReference.PortId, m_wireReferenceUtils.InputPortReference.DataType, m_wireReferenceUtils.InputPortReference.TypeLocked ) ) + node.OnOutputPortConnected( outputPort.PortId, m_wireReferenceUtils.InputPortReference.NodeId, m_wireReferenceUtils.InputPortReference.PortId ); + + //link input to output + if( originPort.ConnectTo( outputPort.NodeId, outputPort.PortId, outputPort.DataType, m_wireReferenceUtils.InputPortReference.TypeLocked ) ) + originNode.OnInputPortConnected( m_wireReferenceUtils.InputPortReference.PortId, node.UniqueId, outputPort.PortId ); + } + } + + if( m_wireReferenceUtils.OutputPortReference.IsValid ) + { + ParentNode originNode = m_mainGraphInstance.GetNode( m_wireReferenceUtils.OutputPortReference.NodeId ); + InputPort inputPort = node.GetFirstInputPortOfType( m_wireReferenceUtils.OutputPortReference.DataType, true ); + + if( inputPort != null && ( !inputPort.TypeLocked || + inputPort.DataType == WirePortDataType.OBJECT || + ( inputPort.TypeLocked && inputPort.DataType == m_wireReferenceUtils.OutputPortReference.DataType ) ) ) + { + + inputPort.InvalidateAllConnections(); + //link input to output + if( inputPort.ConnectTo( m_wireReferenceUtils.OutputPortReference.NodeId, m_wireReferenceUtils.OutputPortReference.PortId, m_wireReferenceUtils.OutputPortReference.DataType, inputPort.TypeLocked ) ) + node.OnInputPortConnected( inputPort.PortId, m_wireReferenceUtils.OutputPortReference.NodeId, m_wireReferenceUtils.OutputPortReference.PortId ); + //link output to input + + if( originNode.GetOutputPortByUniqueId( m_wireReferenceUtils.OutputPortReference.PortId ).ConnectTo( inputPort.NodeId, inputPort.PortId, m_wireReferenceUtils.OutputPortReference.DataType, inputPort.TypeLocked ) ) + originNode.OnOutputPortConnected( m_wireReferenceUtils.OutputPortReference.PortId, node.UniqueId, inputPort.PortId ); + } + } + m_wireReferenceUtils.InvalidateReferences(); + + //for ( int i = 0; i < m_mainGraphInstance.VisibleNodes.Count; i++ ) + //{ + // m_mainGraphInstance.VisibleNodes[ i ].OnNodeInteraction( node ); + //} + } + + if( selectNode ) + m_mainGraphInstance.SelectNode( node, false, false ); + //_repaintIsDirty = true + + SetSaveIsDirty(); + ForceRepaint(); + return node; + } + + public void UpdateNodePreviewListAndTime() + { + if( UIUtils.CurrentWindow != this ) + return; + + double deltaTime = Time.realtimeSinceStartup - m_time; + m_time = Time.realtimeSinceStartup; + + if( DebugConsoleWindow.DeveloperMode ) + { + m_frameCounter++; + if( m_frameCounter >= 60 ) + { + m_fpsDisplay = ( 60 / ( Time.realtimeSinceStartup - m_fpsTime ) ).ToString( "N2" ); + m_fpsTime = Time.realtimeSinceStartup; + m_frameCounter = 0; + } + } + + if( m_smoothZoom ) + { + m_repaintIsDirty = true; + if( Mathf.Abs( m_targetZoom - m_cameraZoom ) < 0.001f ) + { + m_smoothZoom = false; + m_cameraZoom = m_targetZoom; + m_zoomTime = 0; + } + else + { + m_zoomTime += deltaTime; + Vector2 canvasPos = m_zoomPivot * m_cameraZoom; + m_cameraZoom = Mathf.SmoothDamp( m_cameraZoom, m_targetZoom, ref m_zoomVelocity, 0.1f, 10000, (float)deltaTime * 1.5f ); + canvasPos = canvasPos - m_zoomPivot * m_cameraZoom; + m_cameraOffset = m_cameraOffset - canvasPos; + m_targetOffset = m_targetOffset - canvasPos; + } + + } + + if( m_smoothOffset ) + { + m_repaintIsDirty = true; + if( ( m_targetOffset - m_cameraOffset ).SqrMagnitude() < 1f ) + { + m_smoothOffset = false; + m_offsetTime = 0; + } + else + { + m_offsetTime += deltaTime; + m_cameraOffset = Vector2.SmoothDamp( m_cameraOffset, m_targetOffset, ref m_camVelocity, 0.1f, 100000, (float)deltaTime * 1.5f ); + } + } + + if( m_cachedEditorTimeId == -1 ) + m_cachedEditorTimeId = Shader.PropertyToID( "_EditorTime" ); + + if( m_cachedEditorDeltaTimeId == -1 ) + m_cachedEditorDeltaTimeId = Shader.PropertyToID( "_EditorDeltaTime" ); + + //Update Game View? + //Shader.SetGlobalVector( "_Time", new Vector4( Time.realtimeSinceStartup / 20, Time.realtimeSinceStartup, Time.realtimeSinceStartup * 2, Time.realtimeSinceStartup * 3 ) ); + + //System.Type T = System.Type.GetType( "UnityEditor.GameView,UnityEditor" ); + //UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll( T ); + //EditorWindow gameView = ( array.Length <= 0 ) ? null : ( ( EditorWindow ) array[ 0 ] ); + //gameView.Repaint(); + + if( RenderSettings.sun != null ) + { + Vector3 lightdir = -RenderSettings.sun.transform.forward;//.rotation.eulerAngles; + + Shader.SetGlobalVector( "_EditorWorldLightPos", new Vector4( lightdir.x, lightdir.y, lightdir.z, 0 ) ); + Shader.SetGlobalColor( "_EditorLightColor", RenderSettings.sun.color.linear ); + } + Shader.SetGlobalFloat( "_EditorTime", (float)m_time ); + Shader.SetGlobalFloat( "_EditorDeltaTime", (float)deltaTime ); + + /////////// UPDATE PREVIEWS ////////////// + UIUtils.CheckNullMaterials(); + UIUtils.SetPreviewShaderConstants(); + //CurrentGraph.AllNodes.Sort( ( x, y ) => { return x.Depth.CompareTo( y.Depth ); } ); + int nodeCount = CurrentGraph.AllNodes.Count; + for( int i = nodeCount - 1; i >= 0; i-- ) + { + ParentNode node = CurrentGraph.AllNodes[ i ]; + if( node != null && !VisitedChanged.ContainsKey( node.OutputId ) ) + { + bool result = node.RecursivePreviewUpdate(); + if( result ) + m_repaintIsDirty = true; + } + } + + VisitedChanged.Clear(); + if( m_repaintIsDirty ) + { + m_repaintIsDirty = false; + Repaint(); + } + } + + public void ForceRepaint() + { + m_repaintCount += 1; + m_repaintIsDirty = true; + //Repaint(); + } + + public void ForceUpdateFromMaterial() { m_forceUpdateFromMaterialFlag = true; } + void UseCurrentEvent() + { + m_currentEvent.Use(); + } + + + + public void OnBeforeSerialize() + { + //if ( !UIUtils.SerializeFromUndo() ) + //{ + // m_mainGraphInstance.DeSelectAll(); + //} + + if( DebugConsoleWindow.UseShaderPanelsInfo ) + { + if( m_nodeParametersWindow != null ) + m_nodeParametersWindowMaximized = m_nodeParametersWindow.IsMaximized; + + if( m_paletteWindow != null ) + m_paletteWindowMaximized = m_paletteWindow.IsMaximized; + } + } + + public void OnAfterDeserialize() + { + m_afterDeserializeFlag = true; + + //m_customGraph = null; + if( DebugConsoleWindow.UseShaderPanelsInfo ) + { + if( m_nodeParametersWindow != null ) + m_nodeParametersWindow.IsMaximized = m_nodeParametersWindowMaximized; + + if( m_paletteWindow != null ) + m_paletteWindow.IsMaximized = m_paletteWindowMaximized; + } + } + + void OnDestroy() + { + m_ctrlSCallback = false; + Destroy(); + } + + public override void OnDisable() + { + base.OnDisable(); + m_ctrlSCallback = false; + //EditorApplication.update -= UpdateTime; + EditorApplication.update -= UpdateNodePreviewListAndTime; + + EditorApplication.update -= IOUtils.UpdateIO; + + for( int i = 0; i < IOUtils.AllOpenedWindows.Count; i++ ) + { + if( IOUtils.AllOpenedWindows[ i ] != this ) + { + EditorApplication.update += IOUtils.UpdateIO; + break; + } + } + } + + void OnEmptyGraphDetected( ParentGraph graph ) + { + if( m_delayedLoadObject != null ) + { + LoadObject( m_delayedLoadObject ); + m_delayedLoadObject = null; + Repaint(); + } + else + { + if( !string.IsNullOrEmpty( Lastpath ) ) + { + Shader shader = AssetDatabase.LoadAssetAtPath( Lastpath ); + if( shader == null ) + { + Material material = AssetDatabase.LoadAssetAtPath( Lastpath ); + if( material != null ) + { + LoadDroppedObject( true, material.shader, material, null ); + } + else + { + AmplifyShaderFunction function = AssetDatabase.LoadAssetAtPath( Lastpath ); + if( function != null ) + { + LoadDroppedObject( true, null, null, function ); + } + } + } + else + { + LoadDroppedObject( true, shader, null, null ); + } + Repaint(); + } + } + } + + + public void ForceMaterialsToUpdate( ref Dictionary availableMaterials ) + { + m_forcingMaterialUpdateOp = true; + m_forcingMaterialUpdateFlag = true; + m_materialsToUpdate.Clear(); + foreach( KeyValuePair kvp in availableMaterials ) + { + Material material = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( kvp.Value ) ); + if( material != null ) + { + m_materialsToUpdate.Add( material ); + } + } + } + + public void SetOutdatedShaderFromTemplate() + { + m_outdatedShaderFromTemplateLoaded = true; + } + + public void ReplaceMasterNode( MasterNodeCategoriesData data, bool cacheMasterNodes ) + { + // save connection list before switching + m_savedList.Clear(); + int count = m_mainGraphInstance.CurrentMasterNode.InputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( m_mainGraphInstance.CurrentMasterNode.InputPorts[ i ].IsConnected ) + { + string name = m_mainGraphInstance.CurrentMasterNode.InputPorts[ i ].Name; + OutputPort op = m_mainGraphInstance.CurrentMasterNode.InputPorts[ i ].GetOutputConnection(); + if( !m_savedList.ContainsKey( name ) ) + { + m_savedList.Add( name, op ); + } + } + } + + m_replaceMasterNodeType = data.Category; + m_replaceMasterNode = true; + m_replaceMasterNodeData = data.Name; + m_replaceMasterNodeDataFromCache = cacheMasterNodes; + if( cacheMasterNodes ) + { + m_clipboard.AddMultiPassNodesToClipboard( m_mainGraphInstance.MultiPassMasterNodes.NodesList, true, -1 ); + for( int i = 0; i < m_mainGraphInstance.LodMultiPassMasternodes.Count; i++ ) + { + if( m_mainGraphInstance.LodMultiPassMasternodes[ i ].Count > 0 ) + m_clipboard.AddMultiPassNodesToClipboard( m_mainGraphInstance.LodMultiPassMasternodes[ i ].NodesList, false, i ); + } + } + } + + void CheckNodeReplacement() + { + if( m_replaceMasterNode ) + { + m_replaceMasterNode = false; + switch( m_replaceMasterNodeType ) + { + default: + case AvailableShaderTypes.SurfaceShader: + { + SetStandardShader(); + if( IOUtils.OnShaderTypeChangedEvent != null ) + { + IOUtils.OnShaderTypeChangedEvent( m_mainGraphInstance.CurrentShader, false, string.Empty ); + } + } + break; + case AvailableShaderTypes.Template: + { + + TemplateDataParent templateData = m_templatesManager.GetTemplate( m_replaceMasterNodeData ); + if( m_replaceMasterNodeDataFromCache ) + { + m_mainGraphInstance.CrossCheckTemplateNodes( templateData, m_mainGraphInstance.MultiPassMasterNodes.NodesList , -1 ); + for( int i = 0; i < m_mainGraphInstance.LodMultiPassMasternodes.Count; i++ ) + { + if( m_mainGraphInstance.LodMultiPassMasternodes[ i ].Count > 0 ) + m_mainGraphInstance.CrossCheckTemplateNodes( templateData, m_mainGraphInstance.LodMultiPassMasternodes[ i ].NodesList, i ); + } + + //Getting data from clipboard must be done after cross check all lists + m_clipboard.GetMultiPassNodesFromClipboard( m_mainGraphInstance.MultiPassMasterNodes.NodesList,-1 ); + for( int i = 0; i < m_mainGraphInstance.LodMultiPassMasternodes.Count; i++ ) + { + if( m_mainGraphInstance.LodMultiPassMasternodes[ i ].Count > 0 ) + m_clipboard.GetMultiPassNodesFromClipboard( m_mainGraphInstance.LodMultiPassMasternodes[i].NodesList, i ); + } + m_clipboard.ResetMultipassNodesData(); + } + else + { + SetTemplateShader( m_replaceMasterNodeData, false ); + } + + if( IOUtils.OnShaderTypeChangedEvent != null ) + { + IOUtils.OnShaderTypeChangedEvent( m_mainGraphInstance.CurrentShader, true, templateData.GUID ); + } + } + break; + } + } + else if( m_outdatedShaderFromTemplateLoaded ) + { + m_outdatedShaderFromTemplateLoaded = false; + TemplateMultiPassMasterNode masterNode = m_mainGraphInstance.CurrentMasterNode as TemplateMultiPassMasterNode; + if( masterNode != null ) + { + ReplaceMasterNode( masterNode.CurrentCategoriesData, true ); + } + } + + // restore possible connections by name + if( m_savedList.Count > 0 ) + { + foreach( var item in m_savedList ) + { + string name = item.Key; + OutputPort op = item.Value; + InputPort ip = m_mainGraphInstance.CurrentMasterNode.InputPorts.Find( x => x.Name == name ); + + if( op != null && ip != null && ip.Visible ) + { + var iNode = UIUtils.GetNode( ip.NodeId ); + var oNode = UIUtils.GetNode( op.NodeId ); + ip.ConnectTo( oNode.UniqueId, op.PortId, op.DataType, false ); + op.ConnectTo( iNode.UniqueId, ip.PortId, ip.DataType, ip.TypeLocked ); + + iNode.OnInputPortConnected( ip.PortId, oNode.UniqueId, op.PortId ); + oNode.OnOutputPortConnected( op.PortId, iNode.UniqueId, ip.PortId ); + } + } + } + m_savedList.Clear(); + } + + public Vector2 TranformPosition( Vector2 pos ) + { + return pos * m_cameraZoom - m_cameraOffset; + } + + public void UpdateTabTitle() + { + if( m_isShaderFunctionWindow ) + { + AmplifyShaderFunction openedShaderFunction = m_mainGraphInstance.CurrentShaderFunction; + if( openedShaderFunction != null ) + { + this.titleContent.text = GenerateTabTitle( openedShaderFunction.FunctionName ); + } + } + else + { + if( m_selectionMode == ASESelectionMode.Material ) + { + this.titleContent.text = GenerateTabTitle( m_mainGraphInstance.CurrentMaterial.name ); + } + else + { + this.titleContent.text = GenerateTabTitle( m_mainGraphInstance.CurrentShader.name ); + } + } + } + + public ParentGraph CustomGraph + { + get { return m_customGraph; } + set { m_customGraph = value; } + } + + public ParentGraph CurrentGraph + { + get + { + if( m_customGraph != null ) + return m_customGraph; + + return m_mainGraphInstance; + } + } + + public void RefreshAvaibleNodes() + { + if( m_contextMenu != null && m_mainGraphInstance != null ) + { + m_contextMenu.RefreshNodes( m_mainGraphInstance ); + m_paletteWindow.ForceUpdate = true; + m_contextPalette.ForceUpdate = true; + m_refreshAvailableNodes = false; + } + } + + public void LateRefreshAvailableNodes() + { + m_refreshAvailableNodes = true; + } + + public ParentGraph OutsideGraph { get { return m_mainGraphInstance; } } + + public bool ShaderIsModified + { + get { return m_shaderIsModified; } + set + { + m_shaderIsModified = value && UIUtils.DirtyMask; + + m_toolsWindow.SetStateOnButton( ToolButtonType.Save, m_shaderIsModified ? 1 : 0 ); + if( !IsShaderFunctionWindow ) + { + MasterNode masterNode = m_mainGraphInstance.CurrentMasterNode; + if( masterNode != null && masterNode.CurrentShader != null ) + { + m_toolsWindow.SetStateOnButton( ToolButtonType.Update, ShaderIsModified ? 0 : 2, ShaderIsModified ? ShaderIsModifiedMessage : ShaderIsNotModified ); + UpdateTabTitle( masterNode.ShaderName, m_shaderIsModified ); + } + else + { + m_toolsWindow.SetStateOnButton( ToolButtonType.Update, 1 ); + } + + //if( m_mainGraphInstance.CurrentStandardSurface != null ) + // UpdateTabTitle( m_mainGraphInstance.CurrentStandardSurface.ShaderName, m_shaderIsModified ); + } + else + { + m_toolsWindow.SetStateOnButton( ToolButtonType.Update, m_shaderIsModified ? 0 : 2 ); + if( m_mainGraphInstance.CurrentShaderFunction != null ) + UpdateTabTitle( m_mainGraphInstance.CurrentShaderFunction.FunctionName, m_shaderIsModified ); + } + + } + } + public void MarkToRepaint() { m_repaintIsDirty = true; } + public void RequestSave() { m_markedToSave = true; } + public void RequestRepaint() { m_repaintIsDirty = true; } + public OptionsWindow Options { get { return m_optionsWindow; } } + public GraphContextMenu ContextMenuInstance { get { return m_contextMenu; } set { m_contextMenu = value; } } + public ShortcutsManager ShortcutManagerInstance { get { return m_shortcutManager; } } + + public bool GlobalPreview + { + get { return m_globalPreview; } + set { m_globalPreview = value; } + } + + public bool GlobalShowInternalData + { + get { return m_globalShowInternalData; } + set { m_globalShowInternalData = value; } + } + + public double EditorTime + { + get { return m_time; } + set { m_time = value; } + } + + public ASESelectionMode CurrentSelection + { + get { return m_selectionMode; } + set + { + m_selectionMode = value; + switch( m_selectionMode ) + { + default: + case ASESelectionMode.Shader: + { + m_toolsWindow.BorderStyle = UIUtils.GetCustomStyle( CustomStyle.ShaderBorder ); + } + break; + case ASESelectionMode.Material: + { + m_toolsWindow.BorderStyle = UIUtils.GetCustomStyle( CustomStyle.MaterialBorder ); + } + break; + case ASESelectionMode.ShaderFunction: + { + m_toolsWindow.BorderStyle = UIUtils.GetCustomStyle( CustomStyle.ShaderFunctionBorder ); + } + break; + } + } + } + + public bool LiveShaderEditing + { + get { return m_liveShaderEditing; } + set + { + m_liveShaderEditing = value; + m_innerEditorVariables.LiveMode = m_liveShaderEditing; + UpdateLiveUI(); + } + } + + public NodeAvailability CurrentNodeAvailability + { + get { return m_currentNodeAvailability; } + set + { + NodeAvailability cache = m_currentNodeAvailability; + m_currentNodeAvailability = value; + + if( cache != value ) + RefreshAvaibleNodes(); + } + } + public string GUID + { + get + { + if( m_isShaderFunctionWindow ) + { + AmplifyShaderFunction openedShaderFunction = m_mainGraphInstance.CurrentShaderFunction; + return openedShaderFunction != null ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( openedShaderFunction ) ) : string.Empty; + } + else + { + return m_mainGraphInstance.CurrentShader != null ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_mainGraphInstance.CurrentShader ) ) : string.Empty; + } + } + } + public List Messages { get { return m_messages; } set { m_messages = value; } } + public float MaxMsgWidth { get { return m_maxMsgWidth; } set { m_maxMsgWidth = value; } } + public bool MaximizeMessages { get { return m_maximizeMessages; } set { m_maximizeMessages = value; } } + public void InvalidateAlt() { m_altAvailable = false; } + public PaletteWindow CurrentPaletteWindow { get { return m_paletteWindow; } } + public PreMadeShaders PreMadeShadersInstance { get { return m_preMadeShaders; } } + public Rect CameraInfo { get { return m_cameraInfo; } } + public Vector2 TranformedMousePos { get { return m_currentMousePos2D * m_cameraZoom - m_cameraOffset; } } + public Vector2 TranformedKeyEvtMousePos { get { return m_keyEvtMousePos2D * m_cameraZoom - m_cameraOffset; } } + public PalettePopUp PalettePopUpInstance { get { return m_palettePopup; } } + public DuplicatePreventionBuffer DuplicatePrevBufferInstance { get { return m_duplicatePreventionBuffer; } } + public NodeParametersWindow ParametersWindow { get { return m_nodeParametersWindow; } } + public NodeExporterUtils CurrentNodeExporterUtils { get { return m_nodeExporterUtils; } } + public AmplifyShaderFunction OpenedShaderFunction { get { return m_mainGraphInstance.CurrentShaderFunction; } } + public DrawInfo CameraDrawInfo { get { return m_drawInfo; } } + public string Lastpath { get { return m_lastpath; } set { m_lastpath = value; } } + public string LastOpenedLocation { get { return m_lastOpenedLocation; } set { m_lastOpenedLocation = value; } } + public float AvailableCanvasWidth { get { return ( m_cameraInfo.width - m_paletteWindow.RealWidth - m_nodeParametersWindow.RealWidth ); } } + public float AvailableCanvasHeight { get { return ( m_cameraInfo.height ); } } + public float CameraZoom { get { return m_cameraZoom; } set { m_cameraZoom = value; m_zoomChanged = true; } } + public int GraphCount { get { return m_graphCount; } set { m_graphCount = value; } } + public bool ForceAutoPanDir { get { return m_forceAutoPanDir; } set { m_forceAutoPanDir = value; } } + public bool OpenedAssetFromNode { get { return m_openedAssetFromNode; } set { m_openedAssetFromNode = value; } } + public bool IsShaderFunctionWindow { get { return m_isShaderFunctionWindow; } set { m_isShaderFunctionWindow = value; } } + public bool NodesLoadedCorrectly { get { return m_nodesLoadedCorrectly; } set { m_nodesLoadedCorrectly = value; } } + public double CurrentInactiveTime { get { return m_currentInactiveTime; } } + public string ReplaceMasterNodeData { get { return m_replaceMasterNodeData; } } + public AvailableShaderTypes ReplaceMasterNodeType { get { return m_replaceMasterNodeType; } } + public NodeWireReferencesUtils WireReferenceUtils { get { return m_wireReferenceUtils; } } + public ContextPalette WindowContextPallete { get { return m_contextPalette; } } + // This needs to go to UIUtils + public Texture2D WireTexture { get { return m_wireTexture; } } + public Event CurrentEvent { get { return m_currentEvent; } } + public string CurrentCommandName { get { return m_currentCommandName; } } + public InnerWindowEditorVariables InnerWindowVariables { get { return m_innerEditorVariables; } } + public TemplatesManager TemplatesManagerInstance { get { return m_templatesManager; } } + public Material CurrentMaterial { get { return CurrentGraph.CurrentMaterial; } } + public Shader CurrentShader { get { return CurrentGraph.CurrentShader; } } + public Clipboard ClipboardInstance { get { return m_clipboard; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs.meta new file mode 100644 index 00000000..b18e4791 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c8bcac0d66f920e49803925a85beb0ed +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs new file mode 100644 index 00000000..595ffff2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs @@ -0,0 +1,221 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class AmplifyShaderFunction : ScriptableObject + { + [SerializeField] + private string m_functionInfo = string.Empty; + public string FunctionInfo + { + get { return m_functionInfo; } + set { m_functionInfo = value; } + } + + [SerializeField] + private string m_functionName = string.Empty; + public string FunctionName + { + get { if( m_functionName.Length == 0 ) return name; else return m_functionName; } + set { m_functionName = value; } + } + + [SerializeField] + [TextArea( 5, 15 )] + private string m_description = string.Empty; + public string Description + { + get { return m_description; } + set { m_description = value; } + } + + [SerializeField] + private AdditionalIncludesHelper m_additionalIncludes = new AdditionalIncludesHelper(); + //public AdditionalIncludesHelper AdditionalIncludes + //{ + // get { return m_additionalIncludes; } + // set { m_additionalIncludes = value; } + //} + + [SerializeField] + private AdditionalPragmasHelper m_additionalPragmas = new AdditionalPragmasHelper(); + //public AdditionalPragmasHelper AdditionalPragmas + //{ + // get { return m_additionalPragmas; } + // set { m_additionalPragmas = value; } + //} + + [SerializeField] + private TemplateAdditionalDirectivesHelper m_additionalDirectives = new TemplateAdditionalDirectivesHelper( " Additional Directives" ); + public TemplateAdditionalDirectivesHelper AdditionalDirectives + { + get { return m_additionalDirectives; } + set { m_additionalDirectives = value; } + } + + [SerializeField] + private FunctionNodeCategories m_nodeCategory = FunctionNodeCategories.Functions; + public FunctionNodeCategories NodeCategory + { + get { return m_nodeCategory; } + set { m_nodeCategory = value; } + } + + public enum HeaderStyle + { + Default, + Category, + Custom + } + + [SerializeField] + private HeaderStyle m_headerStyle = HeaderStyle.Default; + public HeaderStyle Header + { + get { return m_headerStyle; } + set { m_headerStyle = value; } + } + + [SerializeField] + private Color m_headerColor = new Color( 1.00f, 0.4f, 0.0f, 1.0f ); + public Color HeaderColor + { + get { return m_headerColor; } + set { m_headerColor = value; } + } + + [SerializeField] + private string m_customNodeCategory = string.Empty; + public string CustomNodeCategory + { + get + { + if( m_nodeCategory == FunctionNodeCategories.Custom ) + { + if( string.IsNullOrEmpty( m_customNodeCategory ) ) + return "Functions"; + else + return m_customNodeCategory; + } + else + { + return UIUtils.CategoryPresets[ (int)m_nodeCategory ]; + //return new SerializedObject( this ).FindProperty( "m_nodeCategory" ).enumDisplayNames[ (int)m_nodeCategory ]; + } + } + } + + [SerializeField] + private PreviewLocation m_previewPosition = PreviewLocation.Auto; + public PreviewLocation PreviewPosition + { + get { return m_previewPosition; } + set { m_previewPosition = value; } + } + + [SerializeField] + private bool m_hidden = false; + public bool Hidden + { + get { return m_hidden; } + set { m_hidden = value; } + } + + [SerializeField] + private string m_url = string.Empty; + public string URL + { + get { return m_url; } + set { m_url = value; } + } + + public void UpdateDirectivesList() + { + m_additionalDirectives.CleanNullDirectives(); + m_additionalDirectives.UpdateDirectivesFromSaveItems(); + + if( m_additionalIncludes.IncludeList.Count > 0 ) + { + m_additionalDirectives.AddItems( AdditionalLineType.Include, m_additionalIncludes.IncludeList ); + m_additionalIncludes.IncludeList.Clear(); + } + + if( m_additionalPragmas.PragmaList.Count > 0 ) + { + m_additionalDirectives.AddItems( AdditionalLineType.Pragma, m_additionalPragmas.PragmaList ); + m_additionalPragmas.PragmaList.Clear(); + } + } + + public void ResetDirectivesOrigin() + { + //if( UIUtils.CurrentShaderVersion() < 16807 ) + // Although the correct version was 1.6.7 rev 07 this issue was only detected on v1.7.1. rev 00 + // So to avoid potential incorrect saves over shader functions, I decided to broaden up the version range + if( UIUtils.CurrentShaderVersion() < 17101 ) + { + m_additionalDirectives.ResetDirectivesOrigin(); + } + } + } + + public class ShaderFunctionDetector : AssetPostprocessor + { + static void OnPostprocessAllAssets( string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths ) + { + if( UIUtils.CurrentWindow == null ) + return; + + bool markForRefresh = false; + AmplifyShaderFunction function = null; + for( int i = 0; i < importedAssets.Length; i++ ) + { + function = AssetDatabase.LoadAssetAtPath( importedAssets[ i ] ); + if( function != null ) + { + markForRefresh = true; + break; + } + } + + if( deletedAssets.Length > 0 ) + markForRefresh = true; + + for( int i = 0; i < movedAssets.Length; i++ ) + { + function = AssetDatabase.LoadAssetAtPath( movedAssets[ i ] ); + if( function != null ) + { + markForRefresh = true; + break; + } + } + + for( int i = 0; i < movedFromAssetPaths.Length; i++ ) + { + function = AssetDatabase.LoadAssetAtPath( movedFromAssetPaths[ i ] ); + if( function != null ) + { + markForRefresh = true; + break; + } + } + + if( markForRefresh ) + { + markForRefresh = false; + if( function != null ) + { + IOUtils.UpdateSFandRefreshWindows( function ); + } + UIUtils.CurrentWindow.LateRefreshAvailableNodes(); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs.meta new file mode 100644 index 00000000..32bdfcf9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 78b2425a2284af743826c689403a4924 +timeCreated: 1492703397 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 50be8291f9514914aa55c66c49da67cf, type: 3} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs new file mode 100644 index 00000000..6d70c791 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs @@ -0,0 +1,164 @@ +using UnityEngine; +using UnityEditor; +using System; +using System.Text.RegularExpressions; +using System.IO; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [CustomEditor( typeof( AmplifyShaderFunction ) )] + public class AmplifyShaderFunctionEditor : Editor + { + class FunctionDependency + { + public string AssetName; + public string AssetPath; + public FunctionDependency(string name, string path) + { + AssetName = name; + AssetPath = path; + } + } + + AmplifyShaderFunction m_target; + List m_dependencies = new List(); + + void OnEnable() + { + m_target = ( target as AmplifyShaderFunction ); + } + + public override void OnInspectorGUI() + { + //base.OnInspectorGUI(); + //base.serializedObject.Update(); + if( GUILayout.Button( "Open in Shader Editor" ) ) + { + ASEPackageManagerHelper.SetupLateShaderFunction( m_target ); + } + //EditorGUILayout.Separator(); + //m_target.FunctionInfo = EditorGUILayout.TextArea( m_target.FunctionInfo ); + + if( m_target.Description.Length > 0 ) + { + EditorGUILayout.HelpBox( m_target.Description, MessageType.Info ); + } + + EditorGUILayout.Space(); + if( GUILayout.Button( "Search Direct Dependencies" ) ) + { + m_dependencies.Clear(); + string guid = AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_target ) ); + + string[] allSFs = AssetDatabase.FindAssets( "t:AmplifyShaderFunction", null ); + foreach( string guid1 in allSFs ) + { + string sfPath = AssetDatabase.GUIDToAssetPath( guid1 ); + bool found = SearchForGUID( guid, sfPath ); + if( found ) + { + //string n = Regex.Replace( sfPath, @"(\.\w+|[\w\d\/]+\/)", "" ); + string n = Regex.Replace( sfPath, @"[\w\d\/]+\/", "" ); + m_dependencies.Add(new FunctionDependency( n, sfPath ) ); + } + } + + string[] allSHs = AssetDatabase.FindAssets( "t:Shader", null ); + foreach( string guid1 in allSHs ) + { + string shPath = AssetDatabase.GUIDToAssetPath( guid1 ); + bool found = SearchForGUID( guid, shPath ); + if( found ) + { + string n = Regex.Replace( shPath, @"[\w\d\/]+\/", "" ); + m_dependencies.Add( new FunctionDependency( n, shPath ) ); + } + } + } + EditorGUILayout.Space(); + for( int i = 0; i < m_dependencies.Count; i++ ) + { + EditorGUILayout.BeginHorizontal(); + if( GUILayout.Button( m_dependencies[ i ].AssetName, "minibuttonleft" ) ) + { + SelectAtPath( m_dependencies[ i ].AssetPath ); + } + if( GUILayout.Button( "edit", "minibuttonright", GUILayout.Width(100) ) ) + { + if( m_dependencies[ i ].AssetName.EndsWith( ".asset" ) ) + { + var obj = AssetDatabase.LoadAssetAtPath( m_dependencies[ i ].AssetPath ); + AmplifyShaderEditorWindow.LoadShaderFunctionToASE( obj, false ); + } + else + { + var obj = AssetDatabase.LoadAssetAtPath( m_dependencies[ i ].AssetPath ); + AmplifyShaderEditorWindow.ConvertShaderToASE( obj ); + } + } + EditorGUILayout.EndHorizontal(); + } + + if( m_dependencies.Count > 0 ) + { + List assetPaths = new List(); + for( int i = 0; i < m_dependencies.Count; i++ ) + { + assetPaths.Add( m_dependencies[ i ].AssetPath ); + } + + if( GUILayout.Button( "Open and Save All" ) ) + { + bool doit = EditorUtility.DisplayDialog( "Open and Save All", "This will try to open all shader function and shaders that use this shader function and save them in quick succession, this may irreversibly break your files if something goes wrong. Are you sure you want to try?", "Yes, I'll take the risk", "No, I'll do it myself" ); + if( doit ) + AmplifyShaderEditorWindow.LoadAndSaveList( assetPaths.ToArray() ); + } + } + } + + public void SelectAtPath( string path ) + { + var obj = AssetDatabase.LoadAssetAtPath( path ); + EditorGUIUtility.PingObject( obj ); + } + + public static bool SearchForGUID( string guid, string pathName ) + { + bool result = false; + int count = 0; + if( !string.IsNullOrEmpty( pathName ) && File.Exists( pathName ) ) + { + StreamReader fileReader = null; + try + { + fileReader = new StreamReader( pathName ); + + string line; + int index = -1; + while( ( line = fileReader.ReadLine() ) != null ) + { + index = line.IndexOf( guid ); + count++; + + if( index > -1 ) + { + result = true; + break; + } + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + finally + { + if( fileReader != null ) + fileReader.Close(); + } + } + return result; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs.meta new file mode 100644 index 00000000..12d8a80e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 8b2d6d1320661374db53aeb8057312b2 +timeCreated: 1491909065 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs new file mode 100644 index 00000000..9f028f3f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs @@ -0,0 +1,94 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public enum AutoPanLocation + { + TOP = 0, + BOTTOM, + LEFT, + RIGHT + } + + public class AutoPanData + { + private Rect m_area; + private float m_size; + private Vector2 m_velocity; + + private GUIStyle m_style; + private Color m_color = new Color( 1f, 0f, 0f, 0.5f ); + + private AutoPanLocation m_location; + private float m_adjustWidth = 0; + private float m_adjustInitialX = 0; + + public AutoPanData( AutoPanLocation location, float size, Vector2 vel ) + { + m_area = new Rect(); + m_size = size; + m_velocity = vel; + m_location = location; + } + + public bool CheckArea( Vector2 mousePosition, Rect window, bool draw ) + { + float totalSize = m_size + m_adjustWidth; + switch ( m_location ) + { + case AutoPanLocation.TOP: + { + m_area.x = m_adjustInitialX; + m_area.y = 0; + m_area.width = window.width; + m_area.height = totalSize; + } + break; + case AutoPanLocation.BOTTOM: + { + m_area.x = m_adjustInitialX; + m_area.y = window.height - totalSize; + m_area.width = window.width; + m_area.height = totalSize; + } + break; + case AutoPanLocation.LEFT: + { + m_area.x = m_adjustInitialX; + m_area.y = 0; + m_area.width = totalSize; + m_area.height = window.height; + } + break; + case AutoPanLocation.RIGHT: + { + m_area.x = m_adjustInitialX + window.width - totalSize; + m_area.y = 0; + m_area.width = totalSize; + m_area.height = window.height; + } + break; + } + + if ( draw ) + { + if ( m_style == null ) + { + m_style = UIUtils.Box; + } + Color bufferedColor = GUI.color; + GUI.color = m_color; + GUI.Label( m_area, string.Empty, m_style ); + GUI.color = bufferedColor; + } + return m_area.Contains( mousePosition ); + } + + public float AdjustWidth { set { m_adjustWidth = value; } } + public float AdjustInitialX { set { m_adjustInitialX = value; } } + public Vector2 Velocity { get { return m_velocity; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs.meta new file mode 100644 index 00000000..f9a9d8ef --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 711db07e8265cb740940568c4bc7345f +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs new file mode 100644 index 00000000..1b4d4fa9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs @@ -0,0 +1,262 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; +using UnityEngine; +using System.Collections.Generic; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + + public class ClipboardData + { + public string Data = string.Empty; + public string Connections = string.Empty; + public int OldNodeId = -1; + public int NewNodeId = -1; + + public ClipboardData( string data, string connections, int oldNodeId ) + { + Data = data; + Connections = connections; + OldNodeId = oldNodeId; + } + + public override string ToString() + { + return Data + IOUtils.CLIPBOARD_DATA_SEPARATOR + Connections + IOUtils.CLIPBOARD_DATA_SEPARATOR + OldNodeId + IOUtils.CLIPBOARD_DATA_SEPARATOR + NewNodeId; + } + } + + public class Clipboard + { + public const string ClipboardId = "AMPLIFY_CLIPBOARD_ID"; + private readonly string[] ClipboardTagId = { "#CLIP_ITEM#" }; + private List m_clipboardStrData; + private Dictionary m_clipboardAuxData; + private Dictionary m_multiPassMasterNodeData; + + public Clipboard() + { + m_clipboardStrData = new List(); + m_clipboardAuxData = new Dictionary(); + m_multiPassMasterNodeData = new Dictionary(); + } + + public void ResetMultipassNodesData() + { + m_multiPassMasterNodeData.Clear(); + } + + public void AddMultiPassNodesToClipboard( List masterNodes, bool resetList, int lodId ) + { + if( resetList ) + m_multiPassMasterNodeData.Clear(); + + int templatesAmount = masterNodes.Count; + for( int i = 0; i < templatesAmount; i++ ) + { + if( !masterNodes[ i ].InvalidNode ) + { + string data = string.Empty; + string connection = string.Empty; + System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; + masterNodes[ i ].FullWriteToString( ref data, ref connection ); + System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; + ClipboardData clipboardData = new ClipboardData( data, connection, masterNodes[ i ].UniqueId ); + m_multiPassMasterNodeData.Add( masterNodes[ i ].PassUniqueName + lodId, clipboardData ); + } + } + } + + public void GetMultiPassNodesFromClipboard( List masterNodes, int lodId ) + { + int templatesAmount = masterNodes.Count; + for( int i = 0; i < templatesAmount; i++ ) + { + string clipboardDataId = masterNodes[ i ].PassUniqueName + lodId; + if( m_multiPassMasterNodeData.ContainsKey( clipboardDataId ) ) + { + ClipboardData nodeData = m_multiPassMasterNodeData[ clipboardDataId ]; + string[] nodeParams = nodeData.Data.Split( IOUtils.FIELD_SEPARATOR ); + System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; + masterNodes[ i ].FullReadFromString( ref nodeParams ); + System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; + } + } + + for( int i = 0; i < templatesAmount; i++ ) + { + string clipboardDataId = masterNodes[ i ].PassUniqueName + lodId; + if( m_multiPassMasterNodeData.ContainsKey( clipboardDataId ) ) + { + masterNodes[ i ].SetReadOptions(); + masterNodes[ i ].ForceOptionsRefresh(); + } + } + + } + + public void AddToClipboard( List selectedNodes , Vector3 initialPosition, ParentGraph graph ) + { + //m_clipboardStrData.Clear(); + //m_clipboardAuxData.Clear(); + + string clipboardData = IOUtils.Vector3ToString( initialPosition ) + ClipboardTagId[ 0 ]; + int masterNodeId = UIUtils.CurrentWindow.CurrentGraph.CurrentMasterNodeId; + int count = selectedNodes.Count; + for ( int i = 0; i < count; i++ ) + { + if ( UIUtils.CurrentWindow.IsShaderFunctionWindow || !graph.IsMasterNode( selectedNodes[ i ] )) + { + string nodeData = string.Empty; + string connections = string.Empty; + selectedNodes[ i ].ClipboardFullWriteToString( ref nodeData, ref connections ); + clipboardData += nodeData; + if ( !string.IsNullOrEmpty( connections ) ) + { + connections = connections.Substring( 0, connections.Length - 1 ); + clipboardData += "\n" + connections; + } + if ( i < count - 1 ) + clipboardData += ClipboardTagId[ 0 ]; + + //ClipboardData data = new ClipboardData( nodeData, connections, selectedNodes[ i ].UniqueId ); + //m_clipboardStrData.Add( data ); + //m_clipboardAuxData.Add( selectedNodes[ i ].UniqueId, data ); + } + } + + if ( !string.IsNullOrEmpty( clipboardData ) ) + { + EditorPrefs.SetString( ClipboardId, clipboardData ); + } + //for ( int i = 0; i < selectedNodes.Count; i++ ) + //{ + // if ( selectedNodes[ i ].UniqueId != masterNodeId ) + // { + // WireNode wireNode = selectedNodes[ i ] as WireNode; + // if ( wireNode != null ) + // { + // if ( !IsNodeChainValid( selectedNodes[ i ], true ) || !IsNodeChainValid( selectedNodes[ i ], false ) ) + // { + // UnityEngine.Debug.Log( "found invalid wire port" ); + // } + // } + // } + //} + } + + public Vector3 GetDataFromEditorPrefs() + { + Vector3 initialPos = Vector3.zero; + m_clipboardStrData.Clear(); + m_clipboardAuxData.Clear(); + string clipboardData = EditorPrefs.GetString( ClipboardId, string.Empty ); + if ( !string.IsNullOrEmpty( clipboardData ) ) + { + string[] clipboardDataArray = clipboardData.Split( ClipboardTagId, StringSplitOptions.None ); + initialPos = IOUtils.StringToVector3( clipboardDataArray[0] ); + for ( int i = 1; i < clipboardDataArray.Length; i++ ) + { + if ( !string.IsNullOrEmpty( clipboardDataArray[ i ] ) ) + { + int wiresIndex = clipboardDataArray[ i ].IndexOf( IOUtils.LINE_TERMINATOR ); + string nodeData = string.Empty; + string connections = string.Empty; + if ( wiresIndex < 0 ) + { + nodeData = clipboardDataArray[ i ]; + } + else + { + nodeData = clipboardDataArray[ i ].Substring( 0, wiresIndex ); + connections = clipboardDataArray[ i ].Substring( wiresIndex + 1 ); + } + string[] nodeDataArr = nodeData.Split( IOUtils.FIELD_SEPARATOR ); + if ( nodeDataArr.Length > 2 ) + { + int nodeId = Convert.ToInt32( nodeDataArr[ 2 ] ); + ClipboardData data = new ClipboardData( nodeData, connections, nodeId ); + m_clipboardStrData.Add( data ); + m_clipboardAuxData.Add( nodeId, data ); + } + + } + } + } + return initialPos; + } + + public bool IsNodeChainValid( ParentNode currentNode, bool forward ) + { + WireNode wireNode = currentNode as WireNode; + if ( wireNode == null ) + { + return m_clipboardAuxData.ContainsKey( currentNode.UniqueId ); + } + + if ( forward ) + { + if ( wireNode.InputPorts[ 0 ].ExternalReferences.Count > 0 ) + { + int nodeId = wireNode.InputPorts[ 0 ].ExternalReferences[ 0 ].NodeId; + if ( m_clipboardAuxData.ContainsKey( nodeId ) ) + { + return IsNodeChainValid( UIUtils.GetNode( nodeId ), forward ); + } + } + } + else + { + int nodeId = wireNode.OutputPorts[ 0 ].ExternalReferences[ 0 ].NodeId; + if ( m_clipboardAuxData.ContainsKey( nodeId ) ) + { + return IsNodeChainValid( UIUtils.GetNode( nodeId ), forward ); + } + } + return false; + } + + public void GenerateFullString() + { + string data = string.Empty; + for ( int i = 0; i < m_clipboardStrData.Count; i++ ) + { + data += m_clipboardStrData[ i ].ToString(); + if ( i < m_clipboardStrData.Count - 1 ) + { + data += IOUtils.LINE_TERMINATOR; + } + } + } + + public void ClearClipboard() + { + m_clipboardStrData.Clear(); + m_clipboardAuxData.Clear(); + m_multiPassMasterNodeData.Clear(); + } + + public ClipboardData GetClipboardData( int oldNodeId ) + { + if ( m_clipboardAuxData.ContainsKey( oldNodeId ) ) + return m_clipboardAuxData[ oldNodeId ]; + return null; + } + + public int GeNewNodeId( int oldNodeId ) + { + if ( m_clipboardAuxData.ContainsKey( oldNodeId ) ) + return m_clipboardAuxData[ oldNodeId ].NewNodeId; + return -1; + } + + public List CurrentClipboardStrData + { + get { return m_clipboardStrData; } + } + + public bool HasCachedMasterNodes { get { return m_multiPassMasterNodeData.Count > 0; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs.meta new file mode 100644 index 00000000..bee461e0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 8850a8c4f3ca99f42bbf602c671ffb7f +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs new file mode 100644 index 00000000..896c432b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs @@ -0,0 +1,120 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public class ConfirmationWindow + { + public delegate ShaderLoadResult OnConfirmationSelected( bool value, Shader shader, Material material ); + public event OnConfirmationSelected OnConfirmationSelectedEvt; + + private const string m_yesStr = "Yes"; + private const string m_noStr = "No"; + private bool m_isActive = false; + private string m_currentMessage; + + private GUIStyle m_areaStyle; + private GUIContent m_content; + private GUIStyle m_buttonStyle; + private GUIStyle m_labelStyle; + + + private Shader m_shader; + private Material m_material; + private Rect m_area; + private bool m_autoDeactivate = true; + + + public ConfirmationWindow( float x, float y, float width, float height ) + { + m_content = new GUIContent( GUIContent.none ); + m_area = new Rect( x, y, width, height ); + } + + public void Destroy() + { + m_shader = null; + OnConfirmationSelectedEvt = null; + } + + public void ActivateConfirmation( Shader shader, Material material, string message, OnConfirmationSelected evt, bool autoDeactivate = true ) + { + OnConfirmationSelectedEvt = evt; + m_currentMessage = message; + m_shader = shader; + m_material = material; + m_autoDeactivate = autoDeactivate; + m_isActive = true; + } + + public void OnGUI() + { + if ( m_areaStyle == null ) + { + m_areaStyle = new GUIStyle( UIUtils.TextArea ); + m_areaStyle.stretchHeight = true; + m_areaStyle.stretchWidth = true; + m_areaStyle.fontSize = ( int ) Constants.DefaultTitleFontSize; + } + + if ( m_buttonStyle == null ) + { + m_buttonStyle = UIUtils.Button; + } + + if ( m_labelStyle == null ) + { + m_labelStyle = new GUIStyle( UIUtils.Label ); + m_labelStyle.alignment = TextAnchor.MiddleCenter; + m_labelStyle.wordWrap = true; + } + + m_area.x = ( int ) ( 0.5f * UIUtils.CurrentWindow.CameraInfo.width ); + m_area.y = ( int ) ( 0.5f * UIUtils.CurrentWindow.CameraInfo.height ); + + GUILayout.BeginArea( m_area, m_content, m_areaStyle ); + { + EditorGUILayout.BeginVertical(); + { + EditorGUILayout.Separator(); + EditorGUILayout.LabelField( m_currentMessage, m_labelStyle ); + + EditorGUILayout.Separator(); + EditorGUILayout.Separator(); + EditorGUILayout.BeginHorizontal(); + { + if ( GUILayout.Button( m_yesStr, m_buttonStyle ) ) + { + if ( OnConfirmationSelectedEvt != null ) + OnConfirmationSelectedEvt( true, m_shader, m_material ); + + if ( m_autoDeactivate ) + Deactivate(); + } + + if ( GUILayout.Button( m_noStr, m_buttonStyle ) ) + { + if ( OnConfirmationSelectedEvt != null ) + OnConfirmationSelectedEvt( false, m_shader, m_material ); + if ( m_autoDeactivate ) + Deactivate(); + } + } + EditorGUILayout.EndHorizontal(); + } + EditorGUILayout.EndVertical(); + } + GUILayout.EndArea(); + } + + public void Deactivate() + { + m_isActive = false; + OnConfirmationSelectedEvt = null; + } + public bool IsActive { get { return m_isActive; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs.meta new file mode 100644 index 00000000..08fa34b7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 291cb40a04f835a4d89037cf3053c6a3 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs new file mode 100644 index 00000000..2f47884c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs @@ -0,0 +1,309 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [System.Serializable] + public class Toast + { + public MessageSeverity ItemType; + public string ItemMessage; + public double ItemTime; + public int ItemOwnerId; + public Toast( MessageSeverity itemType, string itemMessage, double itemTime,int itemOwnerId ) + { + ItemType = itemType; + ItemMessage = itemMessage; + ItemTime = itemTime; + ItemOwnerId = itemOwnerId; + } + } + + public class ConsoleLogWindow + { + public const int MAXWIDTH = 500; + public const float FADETIME = 7; + + private readonly GUIContent m_boxToggleContent = new GUIContent( "\u2261", "Toggle Message Box" ); + private readonly GUIContent m_clearContent = new GUIContent( "\u00D7", "Clear Messages" ); + + protected AmplifyShaderEditorWindow m_parentWindow = null; + + // needs to be serialized + private Vector2 m_currentScrollPos; + + int lastCall = -1; + + public ConsoleLogWindow( AmplifyShaderEditorWindow parentWindow ) + { + m_parentWindow = parentWindow; + } + + public void AddMessage( MessageSeverity itemType, string itemMessage , int itemOwnerId ) + { + var toast = new Toast( itemType, itemMessage, Time.realtimeSinceStartup, itemOwnerId ); + m_parentWindow.Messages.Insert( 0, toast ); + m_currentScrollPos.y = Mathf.Infinity; + + if( !m_parentWindow.MaximizeMessages ) + lastCall = Mathf.Max( (int)itemType, lastCall ); + + GUIContent gc = new GUIContent( m_parentWindow.Messages.Count + ": " + itemMessage ); + float maxWidth = m_parentWindow.MaxMsgWidth; + maxWidth = Mathf.Max( UIUtils.ConsoleLogLabel.CalcSize( gc ).x + 16, maxWidth ); + maxWidth = Mathf.Min( maxWidth, MAXWIDTH ); + m_parentWindow.MaxMsgWidth = maxWidth; + } + + public void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus, float rightSide ) + { + EventType currentEventType = Event.current.type; + var messages = m_parentWindow.Messages; + var maximize = m_parentWindow.MaximizeMessages; + + Rect button = parentPosition; + button.width = 22; + button.height = 22; + button.x = parentPosition.x + parentPosition.width - button.width - rightSide - 8; + button.y = parentPosition.y + parentPosition.height - button.height - ( m_parentWindow.CurrentSelection == ASESelectionMode.Material ? 52 : 8 ); + + Rect toolbarArea = button; + toolbarArea.y -= 5; + if( maximize ) + { + toolbarArea.xMin -= m_parentWindow.MaxMsgWidth; + toolbarArea.yMin -= 66; + } + toolbarArea.x -= 6; + + bool needsRepaint = false; + if( maximize ) + { + GUIStyle labelStyle = UIUtils.ConsoleLogLabel; + toolbarArea.y -= 16 + 8; + GUILayout.BeginArea( toolbarArea, UIUtils.ConsoleLogMessage ); + EditorGUILayout.BeginVertical(); + m_currentScrollPos = EditorGUILayout.BeginScrollView( m_currentScrollPos ); + { + int count = messages.Count; + for( int i = count - 1; i >= 0; i-- ) + { + switch( messages[ i ].ItemType ) + { + case MessageSeverity.Error: + labelStyle.normal.textColor = Color.red; + break; + case MessageSeverity.Warning: + labelStyle.normal.textColor = Color.yellow; + break; + default: + case MessageSeverity.Normal: + labelStyle.normal.textColor = Color.white; + break; + } + + if( messages[ i ].ItemOwnerId < 0 ) + { + if( Event.current.control && Event.current.shift ) + { + if( GUILayout.Button( ( count - i ) + ": " + messages[ i ].ItemMessage, labelStyle ) ) + { + if( Event.current.button == 1 ) + { + EditorGUIUtility.systemCopyBuffer = messages[ i ].ItemMessage; + } + } + } + else + { + GUILayout.Label( ( count - i ) + ": " + messages[ i ].ItemMessage, labelStyle ); + } + } + else + { + if( GUILayout.Button( ( count - i ) + ": " + messages[ i ].ItemMessage, labelStyle ) ) + { + UIUtils.CurrentWindow.FocusOnNode( messages[ i ].ItemOwnerId, 1, true ); + if( Event.current.button == 1 ) + { + EditorGUIUtility.systemCopyBuffer = messages[ i ].ItemMessage; + } + } + } + } + } + EditorGUILayout.EndScrollView(); + EditorGUILayout.EndVertical(); + + GUILayout.EndArea(); + } + else + { + // draw toaster + int count = messages.Count; + Rect rect = toolbarArea; + rect.xMin -= 200; + + float startFade = FADETIME - 1; + for( int i = 0; i < count; i++ ) + { + GUIStyle msgstyle = UIUtils.ConsoleLogMessage; + float delta = (float)(Time.realtimeSinceStartup - messages[ i ].ItemTime); + if( delta > FADETIME ) + continue; + + if( delta < 0.1f ) + { + msgstyle.normal.textColor = Color.cyan; + } + else if( delta < startFade ) + { + switch( messages[ i ].ItemType ) + { + case MessageSeverity.Error: + msgstyle.normal.textColor = Color.red; + break; + case MessageSeverity.Warning: + msgstyle.normal.textColor = Color.yellow; + break; + default: + case MessageSeverity.Normal: + msgstyle.normal.textColor = Color.white; + break; + } + } + else + { + switch( messages[ i ].ItemType ) + { + case MessageSeverity.Error: + msgstyle.normal.textColor = new Color( 1, 0, 0, FADETIME - delta ); + break; + case MessageSeverity.Warning: + msgstyle.normal.textColor = new Color( 1, 1, 0, FADETIME - delta ); + break; + default: + case MessageSeverity.Normal: + msgstyle.normal.textColor = new Color( 1, 1, 1, FADETIME - delta ); + break; + } + } + + needsRepaint = true; + + GUIContent gc = new GUIContent( messages[ i ].ItemMessage ); + var sizes = msgstyle.CalcSize( gc ); + rect.xMin -= sizes.x - rect.width; + rect.height = sizes.y; + rect.y -= rect.height + 2; + if( messages[ i ].ItemOwnerId < 0 ) + { + GUI.Label( rect, gc, msgstyle ); + } + else + { + if( GUI.Button( rect, gc, msgstyle )) + { + UIUtils.CurrentWindow.FocusOnNode( messages[ i ].ItemOwnerId, 1, true ); + if( Event.current.button == 1 ) + { + EditorGUIUtility.systemCopyBuffer = messages[ i ].ItemMessage; + } + } + } + } + } + //GUI.color = cached; + + if( needsRepaint ) + m_parentWindow.MarkToRepaint(); + + GUIStyle style = UIUtils.ConsoleLogCircle; + + button.size = Vector2.one * 16; + + switch( lastCall ) + { + case 0: + style.normal.textColor = Color.cyan; + break; + case 1: + style.normal.textColor = Color.yellow; + break; + case 2: + style.normal.textColor = Color.red; + break; + default: + style.normal.textColor = new Color( 1, 1, 1, 0.5f ); + break; + } + + if( GUI.Button( button, m_boxToggleContent, style ) ) + { + maximize = !maximize; + m_parentWindow.MaximizeMessages = maximize; + m_currentScrollPos.y = Mathf.Infinity; + lastCall = -1; + } + + style.normal.textColor = new Color( 1, 1, 1, 0.5f ); + //GUI.color = cached; + button.x -= button.width + 2; + + if( maximize && GUI.Button( button, m_clearContent, style ) ) + { + if( messages.Count == 0 ) + { + maximize = false; + m_parentWindow.MaximizeMessages = maximize; + } + ClearMessages(); + } + + button.width += button.width + 2; + bool mouseOnTop = button.Contains( mousePosition ); + + if( currentEventType == EventType.MouseMove && mouseOnTop ) + m_parentWindow.MarkToRepaint(); + + if( DebugConsoleWindow.DeveloperMode ) + { + if( Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Alpha1 ) + { + UIUtils.ShowMessage( "This is an info message\nwith two lines" ); + } + + if( Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Alpha2 ) + { + UIUtils.ShowMessage( "This is a warning message", MessageSeverity.Warning ); + } + + if( Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Alpha3 ) + { + + UIUtils.ShowMessage( "THIS IS AN ERROR MESSAGE!!", MessageSeverity.Error ); + } + } + } + + public void ClearMessages() + { + m_parentWindow.Messages.Clear(); + m_parentWindow.MaxMsgWidth = MAXWIDTH; + } + + public void Toggle() + { + + } + + public void Destroy() + { + m_parentWindow = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs.meta new file mode 100644 index 00000000..70837739 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ed706353a579cbb46b300406107108b1 +timeCreated: 1506345180 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs new file mode 100644 index 00000000..4834ee1f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs @@ -0,0 +1,81 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public class ContextMenuItem + { + private const string PALETTE_NAME_MOD_STR = " "; + + private string m_paletteName; + private string m_name; + private string m_tags; + private string m_category; + private string m_description; + private System.Type m_type; + private GUIContent m_guiContent; + private string m_nameWithShortcut; + private AmplifyShaderFunction m_function; + private NodeAttributes m_nodeAttributes; + + public ContextMenuItem( NodeAttributes nodeAttributes, System.Type type, string name, string tags, string category, string description, AmplifyShaderFunction function, KeyCode shortcut ) + { + m_nodeAttributes = nodeAttributes; + m_name = name; + m_tags = name + ( string.IsNullOrEmpty( tags ) ? "" : " " + tags ); + m_tags = m_tags.ToLower(); + m_nameWithShortcut = shortcut != KeyCode.None ? ( name + " [ " + UIUtils.KeyCodeToString( shortcut ) + " ]" ) : name; + m_paletteName = PALETTE_NAME_MOD_STR + m_name; + m_type = type; + m_category = category; + m_description = description; + m_function = function; + m_guiContent = new GUIContent( m_nameWithShortcut, m_description ); + } + + public int CompareTo( ContextMenuItem item , bool useWeights ) + { + if ( useWeights && NodeAttributes.SortOrderPriority > -1 && item.NodeAttributes.SortOrderPriority > -1 ) + { + if ( NodeAttributes.SortOrderPriority > item.NodeAttributes.SortOrderPriority ) + { + return 1; + } + else if ( NodeAttributes.SortOrderPriority == item.NodeAttributes.SortOrderPriority ) + { + return m_name.CompareTo( item.Name ); + } + else + { + return -1; + } + } + return m_name.CompareTo( item.Name ); + } + + public string PaletteName { get { return m_paletteName; } } + public string Name { get { return m_name; } } + public string Tags { get { return m_tags; } } + public string NameWithShortcut { get { return m_nameWithShortcut; } } + public string Category { get { return m_category; } } + public string Description { get { return m_description; } } + public AmplifyShaderFunction Function { get { return m_function; } } + public System.Type NodeType { get { return m_type; } } + public GUIContent ItemUIContent { get { return m_guiContent; } } + public NodeAttributes NodeAttributes { get { return m_nodeAttributes; } } + + public override string ToString() + { + return m_name + ":" + m_category + ":" + m_description; + } + + public void Destroy() + { + m_guiContent = null; + m_nodeAttributes = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs.meta new file mode 100644 index 00000000..124fb32b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 417f409230c530b468b8ab67dd6e3b8b +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs new file mode 100644 index 00000000..0de8b80a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs @@ -0,0 +1,53 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +//using UnityEditor; +//using UnityEngine; +//namespace AmplifyShaderEditor +//{ +// //EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector) +// // this might be a bit nonsense since I could use the GetBuiltinSkin directly but this way will bea easier to change to some custom visuals on some near future +// [System.Serializable] +// public class CustomStylesContainer +// { +// public GUIStyle FoldoutStyle +// { +// get { return EditorStyles.foldout; } +// } + +// public GUIStyle Label +// { +// get { return GUI.skin.label; } +// } + +// public GUIStyle Button +// { +// get { return GUI.skin.button; } +// } + +// public GUIStyle TextArea +// { +// get { return GUI.skin.textArea; } +// } + +// public GUIStyle Toggle +// { +// get { return GUI.skin.toggle; } +// } + +// public GUIStyle Window +// { +// get { return GUI.skin.window; } +// } + +// public GUIStyle Textfield +// { +// get { return GUI.skin.textField; } +// } + +// public GUIStyle Box +// { +// get { return GUI.skin.box; } +// } +// } +//} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs.meta new file mode 100644 index 00000000..b9df8d8e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 79d0d783b532b474192b191547bee1c1 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs new file mode 100644 index 00000000..eca0b54a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs @@ -0,0 +1,213 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +//#define ASE_CONSOLE_WINDOW + +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; +using System.IO; +namespace AmplifyShaderEditor +{ + public sealed class DebugConsoleWindow : EditorWindow + { + private const float WindowSizeX = 250; + private const float WindowSizeY = 250; + private const float WindowPosX = 5; + private const float WindowPosY = 5; + private Rect m_availableArea; + + private bool m_wikiAreaFoldout = true; + private bool m_miscAreaFoldout = true; + private Vector2 m_currentScrollPos; + + private int m_minURLNode = 0; + private int m_maxURLNode = -1; + private string m_root = string.Empty; +#if ASE_CONSOLE_WINDOW + public readonly static bool DeveloperMode = true; + public static bool UseShaderPanelsInfo = true; + [MenuItem( "Window/Amplify Shader Editor/Open Debug Console" )] + static void OpenMainShaderGraph() + { + OpenWindow(); + } + [MenuItem( "Window/Amplify Shader Editor/Create Template Menu Items" )] + public static void CreateTemplateMenuItems() + { + UIUtils.CurrentWindow.TemplatesManagerInstance.CreateTemplateMenuItems(); + } + +#else + public readonly static bool DeveloperMode = false; + public static bool UseShaderPanelsInfo = false; +#endif + + public static DebugConsoleWindow OpenWindow() + { + if ( DeveloperMode ) + { + DebugConsoleWindow currentWindow = ( DebugConsoleWindow ) DebugConsoleWindow.GetWindow( typeof( DebugConsoleWindow ), false, "ASE Debug Console" ); + currentWindow.titleContent.tooltip = "Debug Options for ASE. Intented only for ASE development team"; + currentWindow.minSize = new Vector2( WindowSizeX, WindowSizeY ); + currentWindow.maxSize = new Vector2( WindowSizeX, 2 * WindowSizeY ); ; + currentWindow.wantsMouseMove = true; + return currentWindow; + } + return null; + } + private void OnEnable() + { + m_root = Application.dataPath + "/../NodesInfo/"; + if( !Directory.Exists( m_root ) ) + Directory.CreateDirectory( m_root ); + } + void OnGUI() + { + m_availableArea = new Rect( WindowPosX, WindowPosY, position.width - 2 * WindowPosX, position.height - 2 * WindowPosY ); + GUILayout.BeginArea( m_availableArea ); + { + m_currentScrollPos = EditorGUILayout.BeginScrollView( m_currentScrollPos, GUILayout.Width( 0 ), GUILayout.Height( 0 ) ); + { + EditorGUILayout.BeginVertical(); + { + AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; + if ( window != null ) + { + EditorGUILayout.Separator(); + + NodeUtils.DrawPropertyGroup( ref m_wikiAreaFoldout, "Wiki Helper", ShowWikiHelperFunctions ); + + EditorGUILayout.Separator(); + + NodeUtils.DrawPropertyGroup( ref m_miscAreaFoldout, "Misc", ShowMiscFuntions ); + + EditorGUILayout.Separator(); + } + else + { + EditorGUILayout.LabelField( "Please open an ASE window to access debug options" ); + } + } + EditorGUILayout.EndVertical(); + } + EditorGUILayout.EndScrollView(); + } + GUILayout.EndArea(); + } + + void ShowWikiHelperFunctions() + { + AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; + EditorGUILayout.Separator(); + + if ( GUILayout.Button( "Nodes Screen Shots" ) ) + { + window.CurrentNodeExporterUtils.ActivateAutoScreenShot( m_root+"Shots/" ,0,-1 ); + } + + GUILayout.BeginHorizontal(); + if( GUILayout.Button( "Nodes URLs" ) ) + { + window.CurrentNodeExporterUtils.ActivateNodesURL( m_minURLNode, m_maxURLNode ); + } + m_minURLNode = EditorGUILayout.IntField( m_minURLNode ); + m_maxURLNode = EditorGUILayout.IntField( m_maxURLNode ); + GUILayout.EndHorizontal(); + EditorGUILayout.Separator(); + + if( GUILayout.Button( "Nodes CSV Export" ) ) + { + window.CurrentNodeExporterUtils.GenerateNodesCSV( m_root ); + } + EditorGUILayout.Separator(); + + if( GUILayout.Button( "Nodes Undo Test" ) ) + { + window.CurrentNodeExporterUtils.ActivateAutoUndo(); + } + + EditorGUILayout.Separator(); + + if ( GUILayout.Button( "Nodes Info" ) ) + { + window.CurrentPaletteWindow.DumpAvailableNodes( false, m_root ); + window.CurrentPaletteWindow.DumpAvailableNodes( true, m_root ); + } + + EditorGUILayout.Separator(); + + if ( GUILayout.Button( "Shortcuts Info" ) ) + { + window.ShortcutManagerInstance.DumpShortcutsToDisk( Application.dataPath + "/../NodesInfo/" ); + } + } + + void ShowMiscFuntions() + { + AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; + if ( GUILayout.Button( "Force Example Shader Compilation" ) ) + { + UIUtils.ForceExampleShaderCompilation(); + } + EditorGUILayout.Separator(); + + if ( GUILayout.Button( "Refresh Available Nodes" ) ) + { + window.RefreshAvaibleNodes(); + } + + EditorGUILayout.Separator(); + + if ( GUILayout.Button( "Dump Uniform Names" ) ) + { + //window.CurrentPaletteWindow.NewList() + window.DuplicatePrevBufferInstance.DumpUniformNames(); + } + + EditorGUILayout.Separator(); + + if ( GUILayout.Button( "Force Palette Update" ) ) + { + Debug.Log( UIUtils.CurrentWindow.IsShaderFunctionWindow ); + window.CurrentPaletteWindow.ForceUpdate = true; + } + + EditorGUILayout.Separator(); + + if( GUILayout.Button( "Detect Infinite Loops" ) ) + { + if( window.IsShaderFunctionWindow ) + { + Debug.Log( "Starting infinite loop detection over shader functions" ); + List nodes = window.OutsideGraph.FunctionOutputNodes.NodesList; + for( int i = 0; i < nodes.Count; i++ ) + { + UIUtils.DetectNodeLoopsFrom( nodes[ i ], new Dictionary() ); + } + } + else + { + if( window.OutsideGraph.MultiPassMasterNodes.Count > 0 ) + { + Debug.Log( "Starting infinite loop detection over shader from template" ); + List nodes = window.OutsideGraph.MultiPassMasterNodes.NodesList; + for( int i = 0; i < nodes.Count; i++ ) + { + UIUtils.DetectNodeLoopsFrom( nodes[ i ], new Dictionary() ); + } + } + else + { + Debug.Log( "Starting infinite loop detection over standard shader" ); + UIUtils.DetectNodeLoopsFrom( window.OutsideGraph.CurrentMasterNode, new Dictionary() ); + } + } + Debug.Log( "End infinite loop detection" ); + } + } + } +} + + + diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs.meta new file mode 100644 index 00000000..892358fc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 52308890136cd7746a5a073c9be8f028 +timeCreated: 1487850100 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs new file mode 100644 index 00000000..4bd450b8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs @@ -0,0 +1,47 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public class DragAndDropTool + { + public delegate void OnValidDropObject(params UnityEngine.Object[] draggedObjs ); + public event OnValidDropObject OnValidDropObjectEvt; + + public void Destroy() + { + OnValidDropObjectEvt = null; + } + + public void TestDragAndDrop( Rect dropArea ) + { + Event currentEvent = Event.current; + EventType currentEventType = currentEvent.type; + + switch (currentEventType) + { + case EventType.DragUpdated: + case EventType.DragPerform: + { + + if (!dropArea.Contains(currentEvent.mousePosition)) + return; + + DragAndDrop.visualMode = DragAndDropVisualMode.Copy; + if (currentEvent.type == EventType.DragPerform) + { + DragAndDrop.AcceptDrag(); + if (OnValidDropObjectEvt != null) + { + OnValidDropObjectEvt(DragAndDrop.objectReferences); + } + } + }break; + //case EventType.DragExited:DragAndDrop.PrepareStartDrag();break; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs.meta new file mode 100644 index 00000000..4a2ef52b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 41c9bd09aea1377459c7e62910711c22 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs new file mode 100644 index 00000000..6f763338 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs @@ -0,0 +1,375 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class DuplicatePreventionBuffer + { + private const string VectorNameStr = "Vector "; + private const string TextureSampleNameStr = "Texture Sample "; + private const string MatrixNameStr = "Matrix "; + private const string IntNameStr = "Int "; + private const string FloatNameStr = "Float "; + private const string ColorNameStr = "Color "; + + [SerializeField] + private int[] m_availableUVChannelsArray = { -1, -1, -1, -1 }; + private string[] m_availableUVChannelsNamesArray = { "null", + "null", + "null", + "null" }; + + private Dictionary m_availablePropertyNames = new Dictionary(); + private Dictionary m_availableUniformNames = new Dictionary(); + private Dictionary m_availableLocalVariableNames = new Dictionary(); + + public void ReleaseAllUVChannels() + { + for ( int i = 0; i < m_availableUVChannelsArray.Length; i++ ) + { + m_availableUVChannelsArray[ i ] = -1; + } + } + + public bool RegisterUVChannel( int nodeId, int channelId, string name ) + { + if ( channelId < 0 || + channelId > ( m_availableUVChannelsArray.Length - 1 ) || + m_availableUVChannelsArray[ channelId ] >= 0 ) + { + return false; + } + + m_availableUVChannelsArray[ channelId ] = nodeId; + m_availableUVChannelsNamesArray[ channelId ] = name; + return true; + } + + + public bool ReleaseUVChannel( int nodeId, int channelId ) + { + if ( channelId < 0 || + channelId > ( m_availableUVChannelsArray.Length - 1 ) ) + { + return false; + } + + if ( m_availableUVChannelsArray[ channelId ] == nodeId ) + { + m_availableUVChannelsArray[ channelId ] = -1; + return true; + } + return false; + } + + public int RegisterFirstAvailableChannel( int nodeId , string name) + { + for ( int i = 0; i < m_availableUVChannelsArray.Length; i++ ) + { + if ( m_availableUVChannelsArray[ i ] == -1 ) + { + m_availableUVChannelsArray[ i ] = nodeId; + m_availableUVChannelsNamesArray[ i ] = name; + return i; + } + } + return -1; + } + + public bool IsChannelAvailable( int channelId ) + { + if ( channelId < 0 || + channelId > ( m_availableUVChannelsArray.Length - 1 ) ) + { + return false; + } + + return ( m_availableUVChannelsArray[ channelId ] < 0 ); + } + + public int GetFirstOccupiedChannel() + { + for ( int i = 0; i < 4; i++ ) + { + if ( m_availableUVChannelsArray[ i ] > -1 ) + return i; + } + return -1; + } + + public string GetChannelName( int channelId ) + { + if ( channelId < 0 || + channelId > ( m_availableUVChannelsArray.Length - 1 ) ) + { + return string.Empty; + } + + return m_availableUVChannelsNamesArray[ channelId ] ; + } + + public void SetChannelName( int channelId , string name ) + { + if ( channelId < 0 || + channelId > ( m_availableUVChannelsArray.Length - 1 ) ) + { + return; + } + m_availableUVChannelsNamesArray[ channelId ] = name; + } + + public bool RegisterLocalVariableName( int nodeId, string name ) + { + if ( name.Length == 0 ) + return false; + + if ( m_availableLocalVariableNames.ContainsKey( name ) ) + { + if ( m_availableLocalVariableNames[ name ] > -1 ) + { + return false; + } + else + { + m_availableLocalVariableNames[ name ] = nodeId; + return true; + } + } + + m_availableLocalVariableNames.Add( name, nodeId ); + return true; + } + + public int CheckUniformNameOwner( string name ) + { + if ( name.Length == 0 ) + return -1; + + if ( m_availableUniformNames.ContainsKey( name ) ) + { + return m_availableUniformNames[ name ]; + } + + return -1; + } + + public bool RegisterUniformName( int nodeId, string name ) + { + if ( name.Length == 0 ) + return false; + + if ( m_availableUniformNames.ContainsKey( name ) ) + { + if ( m_availableUniformNames[ name ] > -1 ) + { + return false; + } + else + { + m_availableUniformNames[ name ] = nodeId; + return true; + } + } + + m_availableUniformNames.Add( name, nodeId ); + return true; + } + + public void DumpUniformNames() + { + string val = "CONTENTS\n"; + foreach ( KeyValuePair kvp in m_availableUniformNames ) + { + val += ( "key " + kvp.Key + " : value " + kvp.Value + "\n" ); + } + } + + public void DumpLocalVariableNames() + { + string val = "CONTENTS\n"; + foreach ( KeyValuePair kvp in m_availableLocalVariableNames ) + { + val += ( "key " + kvp.Key + " : value " + kvp.Value + "\n" ); + } + } + + + public bool ReleaseUniformName( int nodeId, string name ) + { + if ( !string.IsNullOrEmpty(name) && name.Length == 0 ) + return false; + + if ( m_availableUniformNames.ContainsKey( name ) ) + { + if ( m_availableUniformNames[ name ] == nodeId ) + { + m_availableUniformNames.Remove( name ); + return true; + } + } + return false; + } + + public bool ReleaseLocalVariableName( int nodeId, string name ) + { + if ( name.Length == 0 ) + return false; + + if ( m_availableLocalVariableNames.ContainsKey( name ) ) + { + if ( m_availableLocalVariableNames[ name ] == nodeId ) + { + m_availableLocalVariableNames.Remove( name ); + return true; + } + } + return false; + } + + public void ReleaseAllUniformNames() + { + m_availableUniformNames.Clear(); + } + + public void ReleaseAllLocalVariableNames() + { + m_availableLocalVariableNames.Clear(); + } + + public void GetFirstAvailableName( int nodeId, WirePortDataType type , out string outProperty , out string outInspector, bool useCustomPrefix = false, string customPrefix = null) + { + string name = string.Empty; + if ( useCustomPrefix && customPrefix != null ) + { + name = customPrefix; + } + else + { + switch ( type ) + { + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT: + { + name = FloatNameStr; + } + break; + case WirePortDataType.INT: + { + name = IntNameStr; + } + break; + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + { + name = VectorNameStr; + } + break; + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + name = MatrixNameStr; + } + break; + case WirePortDataType.COLOR: + { + name = ColorNameStr; + } + break; + } + } + + int count = 0; + bool foundName = false; + while ( !foundName ) + { + string inspectorName = name + count; + string propertyName = UIUtils.GeneratePropertyName( inspectorName , PropertyType.Property ); + + if ( IsUniformNameAvailable( propertyName ) ) + { + outInspector = inspectorName; + outProperty = propertyName; + RegisterUniformName( nodeId, propertyName ); + return; + } + count += 1; + } + outProperty = string.Empty; + outInspector = string.Empty; + UIUtils.ShowMessage( "Could not find a valid name " + MessageSeverity.Warning ); + } + + public bool IsUniformNameAvailable( string name ) + { + if ( m_availableUniformNames.ContainsKey( name ) && m_availableUniformNames[ name ] > -1 ) + return false; + return true; + } + + public bool IsLocalvariableNameAvailable( string name ) + { + if ( m_availableLocalVariableNames.ContainsKey( name ) && m_availableLocalVariableNames[ name ] > -1 ) + return false; + return true; + } + + public bool GetPropertyName( int nodeId, string name ) + { + if ( m_availablePropertyNames.ContainsKey( name ) ) + { + if ( m_availablePropertyNames[ name ] > -1 ) + { + return false; + } + else + { + m_availablePropertyNames[ name ] = nodeId; + return true; + } + } + + m_availablePropertyNames.Add( name, nodeId ); + return true; + } + + + public bool ReleasePropertyName( int nodeId, string name ) + { + if ( m_availablePropertyNames.ContainsKey( name ) ) + { + if ( m_availablePropertyNames[ name ] == nodeId ) + { + m_availablePropertyNames[ name ] = -1; + return true; + } + } + return false; + } + + public void ReleaseAllPropertyNames() + { + m_availablePropertyNames.Clear(); + } + + public bool IsPropertyNameAvailable( string name ) + { + if ( m_availablePropertyNames.ContainsKey( name ) && m_availablePropertyNames[ name ] > -1 ) + return false; + return true; + } + + public void ReleaseAllData() + { + ReleaseAllUVChannels(); + ReleaseAllUniformNames(); + ReleaseAllPropertyNames(); + ReleaseAllLocalVariableNames(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs.meta new file mode 100644 index 00000000..08463fe4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a4cfbb4204c63ca4e8f7cec73f6b3ef8 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs new file mode 100644 index 00000000..cf6869f4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs @@ -0,0 +1,396 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using System.Text; +using System.Linq; +using System.Collections.Generic; +using System.Reflection; + +namespace AmplifyShaderEditor +{ + public class ShortcutKeyData + { + public bool IsPressed; + public System.Type NodeType; + public string Name; + public ShortcutKeyData( System.Type type, string name ) + { + NodeType = type; + Name = name; + IsPressed = false; + } + } + + public class GraphContextMenu + { + private List m_items; + private List m_itemFunctions; + private Dictionary m_itemsDict; + private Dictionary m_deprecatedItemsDict; + private Dictionary m_castTypes; + private Dictionary m_shortcutTypes; + + private KeyCode m_lastKeyPressed; + private ParentGraph m_currentGraph; + private bool m_correctlyLoaded = false; + + public GraphContextMenu( ParentGraph currentGraph ) + { + m_currentGraph = currentGraph; + m_correctlyLoaded = RefreshNodes( currentGraph ); + } + + public bool RefreshNodes( ParentGraph currentGraph ) + { + if( m_items != null ) + { + m_items.Clear(); + m_items = null; + } + + if( m_itemFunctions != null ) + { + m_itemFunctions.Clear(); + m_itemFunctions = null; + } + + m_items = new List(); + m_itemFunctions = new List(); + + if( m_itemsDict != null ) + m_itemsDict.Clear(); + + m_itemsDict = new Dictionary(); + + if( m_deprecatedItemsDict != null ) + m_deprecatedItemsDict.Clear(); + + m_deprecatedItemsDict = new Dictionary(); + + if( m_castTypes != null ) + m_castTypes.Clear(); + + m_castTypes = new Dictionary(); + + if( m_shortcutTypes != null ) + m_shortcutTypes.Clear(); + + m_shortcutTypes = new Dictionary(); + + m_lastKeyPressed = KeyCode.None; + + // Fetch all available nodes by their attributes + try + { + //IEnumerable availableTypes = AppDomain.CurrentDomain.GetAssemblies().ToList().SelectMany( type => type.GetTypes() ); + var mainAssembly = Assembly.GetExecutingAssembly(); + Type[] availableTypes = IOUtils.GetTypesInNamespace( mainAssembly, "AmplifyShaderEditor" ); + + try + { + var editorAssembly = Assembly.Load( "Assembly-CSharp-Editor" ); + if( mainAssembly != editorAssembly ) + { + Type[] extraTypes = IOUtils.GetTypesInNamespace( editorAssembly, "AmplifyShaderEditor" ); + availableTypes = availableTypes.Concat( extraTypes ).ToArray(); + } + } + catch( Exception ) + { + // quiet catch because we don't care if it fails to find the assembly, we'll just skip it + } + + Type[] asmdefTypes = IOUtils.GetAssemblyTypesArray(); + if( asmdefTypes != null && asmdefTypes.Length > 0 ) + { + availableTypes = availableTypes.Concat( asmdefTypes ).ToArray(); + } + + foreach( System.Type type in availableTypes ) + { + if( !m_itemsDict.ContainsKey( type ) ) + { + foreach( NodeAttributes attribute in Attribute.GetCustomAttributes( type ).OfType() ) + { + if( attribute.Available && !attribute.Deprecated ) + { + //if ( !UIUtils.CurrentWindow.IsShaderFunctionWindow && attribute.AvailableInFunctionsOnly ) + // continue; + + if( !UIUtils.HasColorCategory( attribute.Category ) ) + { + if( !String.IsNullOrEmpty( attribute.CustomCategoryColor ) ) + { + try + { + Color color = new Color(); + ColorUtility.TryParseHtmlString( attribute.CustomCategoryColor , out color ); + UIUtils.AddColorCategory( attribute.Category , color ); + } + catch( Exception e ) + { + Debug.LogException( e ); + UIUtils.AddColorCategory( attribute.Category , Constants.DefaultCategoryColor ); + } + } + //else + //{ + // UIUtils.AddColorCategory( attribute.Category, Constants.DefaultCategoryColor ); + //} + } + + if( attribute.CastType != null && attribute.CastType.Length > 0 && type != null ) + { + for( int i = 0 ; i < attribute.CastType.Length ; i++ ) + { + m_castTypes.Add( attribute.CastType[ i ] , type ); + } + } + + if( attribute.ShortcutKey != KeyCode.None && type != null ) + m_shortcutTypes.Add( attribute.ShortcutKey , new ShortcutKeyData( type , attribute.Name ) ); + + ContextMenuItem newItem = new ContextMenuItem( attribute , type , attribute.Name , attribute.Tags , attribute.Category , attribute.Description , null , attribute.ShortcutKey ); + if( UIUtils.GetNodeAvailabilityInBitArray( attribute.NodeAvailabilityFlags , NodeAvailability.SurfaceShader ) ) + m_items.Add( newItem ); + else if( UIUtils.GetNodeAvailabilityInBitArray( attribute.NodeAvailabilityFlags , currentGraph.ParentWindow.CurrentNodeAvailability ) ) + m_items.Add( newItem ); + else if( UIUtils.GetNodeAvailabilityInBitArray( attribute.NodeAvailabilityFlags , currentGraph.CurrentCanvasMode ) ) + m_items.Add( newItem ); + + m_itemsDict.Add( type , attribute ); + m_itemFunctions.Add( newItem ); + } + else + { + if( !m_deprecatedItemsDict.ContainsKey(type)) + m_deprecatedItemsDict.Add( type , attribute ); + } + } + } + } + } + catch( ReflectionTypeLoadException exception ) + { + Debug.LogException( exception ); + return false; + } + + string[] guids = AssetDatabase.FindAssets( "t:AmplifyShaderFunction" ); + List allFunctions = new List(); + + for( int i = 0; i < guids.Length; i++ ) + { + allFunctions.Add( AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( guids[ i ] ) ) ); + } + + int functionCount = allFunctions.Count; + if( functionCount > 0 ) + { + m_castTypes.Add( typeof( AmplifyShaderFunction ), typeof( FunctionNode ) ); + } + + for( int i = 0; i < functionCount; i++ ) + { + if( !allFunctions[ i ].Hidden ) + { + NodeAttributes attribute = new NodeAttributes( allFunctions[ i ].FunctionName, allFunctions[ i ].CustomNodeCategory, allFunctions[ i ].Description, KeyCode.None, true, 0, int.MaxValue, typeof( AmplifyShaderFunction ) ); + System.Type type = typeof( FunctionNode ); + + ContextMenuItem newItem = new ContextMenuItem( attribute, type, AddSpacesToSentence( attribute.Name ), attribute.Tags, attribute.Category, attribute.Description, allFunctions[ i ], attribute.ShortcutKey ); + m_items.Add( newItem ); + m_itemFunctions.Add( newItem ); + } + } + + //Sort out the final list by name + m_items.Sort( ( x, y ) => x.Category.CompareTo( y.Category ) ); + m_itemFunctions.Sort( ( x, y ) => x.Category.CompareTo( y.Category ) ); + return true; + } + + public void Destroy() + { + for( int i = 0; i < m_items.Count; i++ ) + { + m_items[ i ].Destroy(); + } + + for( int i = 0; i < m_itemFunctions.Count; i++ ) + { + if( m_itemFunctions[ i ] != null ) + m_itemFunctions[ i ].Destroy(); + } + + m_items.Clear(); + m_items = null; + + m_itemFunctions.Clear(); + m_itemFunctions = null; + + m_itemsDict.Clear(); + m_itemsDict = null; + + m_deprecatedItemsDict.Clear(); + m_deprecatedItemsDict = null; + + m_castTypes.Clear(); + m_castTypes = null; + + m_shortcutTypes.Clear(); + m_shortcutTypes = null; + + } + + public static string AddSpacesToSentence( string text ) + { + if( string.IsNullOrEmpty( text ) ) + return string.Empty; + + bool lastIsUpper = char.IsUpper( text, 0 ); + bool lastIsLetter = char.IsLetter( text, 0 ); + StringBuilder title = new StringBuilder(); + title.Append( text[ 0 ] ); + for( int i = 1; i < text.Length; i++ ) + { + bool currIsUpper = char.IsUpper( text, i ); + bool currIsLetter = char.IsLetter( text, i ); + if( currIsUpper && !lastIsUpper && lastIsLetter ) + { + title.Append( " " ); + } + + // if current is a number and previous is a letter we space it (ie: Rotation2D = Rotation 2D) + if( lastIsLetter && char.IsNumber( text, i ) ) + { + title.Append( " " ); + } + + // if previous is upper, current is upper and the next two following are lower then we space it (ie: UVDistortion = UV Distortion) + if( i < text.Length - 1 ) + { + bool nextIsLower = char.IsLower( text, i + 1 ) && char.IsLetter( text, i + 1 ); + bool lastIsLower = i < text.Length - 2 ? char.IsLower( text, i + 2 ) && char.IsLetter( text, i + 2 ) : false; + if( lastIsUpper && currIsUpper && currIsLetter && nextIsLower && lastIsLower ) + { + title.Append( " " ); + } + } + lastIsUpper = currIsUpper; + lastIsLetter = currIsLetter; + title.Append( text[ i ] ); + } + return title.ToString(); + } + + public NodeAttributes GetNodeAttributesForType( System.Type type ) + { + if( type == null ) + { + Debug.LogError( "Invalid type detected" ); + return null; + } + + if( m_itemsDict.ContainsKey( type ) ) + return m_itemsDict[ type ]; + return null; + } + + public NodeAttributes GetDeprecatedNodeAttributesForType( System.Type type ) + { + if( m_deprecatedItemsDict.ContainsKey( type ) ) + return m_deprecatedItemsDict[ type ]; + return null; + } + + public void UpdateKeyPress( KeyCode key ) + { + if( key == KeyCode.None ) + return; + + m_lastKeyPressed = key; + if( m_shortcutTypes.ContainsKey( key ) ) + { + m_shortcutTypes[ key ].IsPressed = true; + } + } + + public void UpdateKeyReleased( KeyCode key ) + { + if( key == KeyCode.None ) + return; + + if( m_shortcutTypes.ContainsKey( key ) ) + { + m_shortcutTypes[ key ].IsPressed = false; + } + } + + public void ResetShortcutKeyStates() + { + foreach( KeyValuePair kvp in m_shortcutTypes ) + { + kvp.Value.IsPressed = false; + } + } + + public ParentNode CreateNodeFromCastType( System.Type type ) + { + if( m_castTypes.ContainsKey( type ) ) + { + ParentNode newNode = (ParentNode)ScriptableObject.CreateInstance( m_castTypes[ type ] ); + return newNode; + } + return null; + } + + + public ParentNode CreateNodeFromShortcutKey() + { + if( m_lastKeyPressed == KeyCode.None ) + return null; + + if( m_shortcutTypes.ContainsKey( m_lastKeyPressed ) && m_shortcutTypes[ m_lastKeyPressed ].IsPressed ) + { + ParentNode newNode = (ParentNode)ScriptableObject.CreateInstance( m_shortcutTypes[ m_lastKeyPressed ].NodeType ); + return newNode; + } + return null; + } + + public bool CheckShortcutKey() + { + if( m_lastKeyPressed == KeyCode.None ) + return false; + + if( m_shortcutTypes.ContainsKey( m_lastKeyPressed ) && m_shortcutTypes[ m_lastKeyPressed ].IsPressed ) + { + return true; + } + return false; + } + + public List MenuItems + { + get + { + if( m_currentGraph.ParentWindow.IsShaderFunctionWindow ) + return m_itemFunctions; + else + return m_items; + } + } + + public List ItemFunctions { get { return m_itemFunctions; } } + public KeyCode LastKeyPressed + { + get { return m_lastKeyPressed; } + } + + public Dictionary NodeShortcuts { get { return m_shortcutTypes; } } + public bool CorrectlyLoaded { get { return m_correctlyLoaded; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs.meta new file mode 100644 index 00000000..44f22b4e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5c34fc95a1ddd7d42bc74151061035f4 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs new file mode 100644 index 00000000..b4a40e78 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs @@ -0,0 +1,448 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public enum MenuAnchor + { + TOP_LEFT = 0, + TOP_CENTER, + TOP_RIGHT, + MIDDLE_LEFT, + MIDDLE_CENTER, + MIDDLE_RIGHT, + BOTTOM_LEFT, + BOTTOM_CENTER, + BOTTOM_RIGHT, + NONE + } + + public enum MenuAutoSize + { + MATCH_VERTICAL = 0, + MATCH_HORIZONTAL, + NONE + } + + public class MenuParent + { + protected AmplifyShaderEditorWindow m_parentWindow = null; + + protected const float MinimizeButtonXSpacing = 5; + protected const float MinimizeButtonYSpacing = 5.5f; + protected const float ResizeAreaWidth = 5; + + protected const float MinimizeCollisionAdjust = 5; + + protected GUIStyle m_style; + protected GUIContent m_content; + protected Rect m_maximizedArea; + protected Rect m_transformedArea; + protected Rect m_resizeArea; + protected MenuAnchor m_anchor; + protected MenuAutoSize m_autoSize; + protected bool m_isActive = true; + protected bool m_isMaximized = true; + + protected bool m_lockOnMinimize = false; + protected bool m_preLockState = false; + + protected Rect m_minimizedArea; + protected Rect m_minimizeButtonPos; + protected float m_realWidth; + protected GUIStyle m_empty = new GUIStyle(); + + protected float m_resizeDelta; + + protected bool m_isResizing = false; + protected bool m_resizable = false; + protected GUIStyle m_resizeAreaStyle; + protected bool m_isMouseInside = false; + protected Vector2 m_currentScrollPos; + public MenuParent( AmplifyShaderEditorWindow parentWindow, float x, float y, float width, float height, string name, MenuAnchor anchor = MenuAnchor.NONE, MenuAutoSize autoSize = MenuAutoSize.NONE ) + { + m_parentWindow = parentWindow; + m_anchor = anchor; + m_autoSize = autoSize; + m_maximizedArea = new Rect( x, y, width, height ); + m_content = new GUIContent( GUIContent.none ); + m_content.text = name; + m_transformedArea = new Rect(); + m_resizeArea = new Rect(); + m_resizeArea.width = ResizeAreaWidth; + m_resizeAreaStyle = GUIStyle.none; + m_currentScrollPos = Vector2.zero; + } + + public void SetMinimizedArea( float x, float y, float width, float height ) + { + m_minimizedArea = new Rect( x, y, width, height ); + } + + protected void InitDraw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId ) + { + if ( m_style == null ) + { + m_style = new GUIStyle( UIUtils.TextArea ); + m_style.normal.background = m_style.normal.scaledBackgrounds[ 0 ]; + m_style.normal.scaledBackgrounds = null; + m_style.border = new RectOffset( 4, 4, 4, 4 ); + m_style.stretchHeight = true; + m_style.stretchWidth = true; + m_style.fontSize = ( int ) Constants.DefaultTitleFontSize; + m_style.fontStyle = FontStyle.Normal; + Texture minimizeTex = UIUtils.GetCustomStyle( CustomStyle.MaximizeButton ).normal.background; + m_minimizeButtonPos = new Rect( 0, 0, minimizeTex.width, minimizeTex.height ); + } + + Rect currentArea = m_isMaximized ? m_maximizedArea : m_minimizedArea; + + if ( m_isMaximized ) + { + if ( m_resizable ) + { + if ( m_isResizing ) + { + if ( m_anchor == MenuAnchor.TOP_LEFT ) + m_resizeDelta = ( ParentWindow.CurrentEvent.mousePosition.x - m_maximizedArea.width ); + else if ( m_anchor == MenuAnchor.TOP_RIGHT ) + m_resizeDelta = ParentWindow.CurrentEvent.mousePosition.x - ( parentPosition.width - m_maximizedArea.width); + } + } + + m_realWidth = m_maximizedArea.width; + if ( m_resizable ) + { + if ( m_anchor == MenuAnchor.TOP_LEFT ) + { + currentArea.width += m_resizeDelta; + m_realWidth += m_resizeDelta; + } + else if ( m_anchor == MenuAnchor.TOP_RIGHT ) + { + currentArea.width -= m_resizeDelta; + m_realWidth -= m_resizeDelta; + } + } + } + else + { + if ( currentArea.x < 0 ) + { + m_realWidth = currentArea.width + currentArea.x; + } + else if ( ( currentArea.x + currentArea.width ) > parentPosition.width ) + { + m_realWidth = parentPosition.width - currentArea.x; + } + if ( m_realWidth < 0 ) + m_realWidth = 0; + } + + switch ( m_anchor ) + { + case MenuAnchor.TOP_LEFT: + { + m_transformedArea.x = currentArea.x; + m_transformedArea.y = currentArea.y; + if ( m_isMaximized ) + { + m_minimizeButtonPos.x = m_transformedArea.x + m_transformedArea.width - m_minimizeButtonPos.width - MinimizeButtonXSpacing; + m_minimizeButtonPos.y = m_transformedArea.y + MinimizeButtonYSpacing; + + m_resizeArea.x = m_transformedArea.x + m_transformedArea.width; + m_resizeArea.y = m_minimizeButtonPos.y; + m_resizeArea.height = m_transformedArea.height; + } + else + { + float width = ( m_transformedArea.width - m_transformedArea.x ); + m_minimizeButtonPos.x = m_transformedArea.x + width * 0.5f - m_minimizeButtonPos.width * 0.5f; + m_minimizeButtonPos.y = m_transformedArea.height * 0.5f - m_minimizeButtonPos.height * 0.5f; + } + } + break; + case MenuAnchor.TOP_CENTER: + { + m_transformedArea.x = parentPosition.width * 0.5f + currentArea.x; + m_transformedArea.y = currentArea.y; + } + break; + case MenuAnchor.TOP_RIGHT: + { + m_transformedArea.x = parentPosition.width - currentArea.x - currentArea.width; + m_transformedArea.y = currentArea.y; + if ( m_isMaximized ) + { + m_minimizeButtonPos.x = m_transformedArea.x + MinimizeButtonXSpacing; + m_minimizeButtonPos.y = m_transformedArea.y + MinimizeButtonYSpacing; + + m_resizeArea.x = m_transformedArea.x - ResizeAreaWidth; + m_resizeArea.y = m_minimizeButtonPos.y; + m_resizeArea.height = m_transformedArea.height; + } + else + { + float width = ( parentPosition.width - m_transformedArea.x ); + m_minimizeButtonPos.x = m_transformedArea.x + width * 0.5f - m_minimizeButtonPos.width * 0.5f; + m_minimizeButtonPos.y = m_transformedArea.height * 0.5f - m_minimizeButtonPos.height * 0.5f; + } + } + break; + case MenuAnchor.MIDDLE_LEFT: + { + m_transformedArea.x = currentArea.x; + m_transformedArea.y = parentPosition.height * 0.5f + currentArea.y; + } + break; + case MenuAnchor.MIDDLE_CENTER: + { + m_transformedArea.x = parentPosition.width * 0.5f + currentArea.x; + m_transformedArea.y = parentPosition.height * 0.5f + currentArea.y; + } + break; + case MenuAnchor.MIDDLE_RIGHT: + { + m_transformedArea.x = parentPosition.width - currentArea.x - currentArea.width; + m_transformedArea.y = parentPosition.height * 0.5f + currentArea.y; + } + break; + case MenuAnchor.BOTTOM_LEFT: + { + m_transformedArea.x = currentArea.x; + m_transformedArea.y = parentPosition.height - currentArea.y - currentArea.height; + } + break; + case MenuAnchor.BOTTOM_CENTER: + { + m_transformedArea.x = parentPosition.width * 0.5f + currentArea.x; + m_transformedArea.y = parentPosition.height - currentArea.y - currentArea.height; + } + break; + case MenuAnchor.BOTTOM_RIGHT: + { + m_transformedArea.x = parentPosition.width - currentArea.x - currentArea.width; + m_transformedArea.y = parentPosition.height - currentArea.y - currentArea.height; + } + break; + + case MenuAnchor.NONE: + { + m_transformedArea.x = currentArea.x; + m_transformedArea.y = currentArea.y; + } + break; + } + + switch ( m_autoSize ) + { + case MenuAutoSize.MATCH_HORIZONTAL: + { + m_transformedArea.width = parentPosition.width - m_transformedArea.x; + m_transformedArea.height = currentArea.height; + } + break; + + case MenuAutoSize.MATCH_VERTICAL: + { + m_transformedArea.width = currentArea.width; + m_transformedArea.height = parentPosition.height - m_transformedArea.y; + } + break; + case MenuAutoSize.NONE: + { + m_transformedArea.width = currentArea.width; + m_transformedArea.height = currentArea.height; + } + break; + } + + } + public virtual void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus ) + { + InitDraw( parentPosition, mousePosition, mouseButtonId ); + if ( ParentWindow.CurrentEvent.type == EventType.MouseDrag && ParentWindow.CurrentEvent.button > 0 /*catches both middle and right mouse button*/ ) + { + m_isMouseInside = IsInside( mousePosition ); + if ( m_isMouseInside ) + { + m_currentScrollPos.x += Constants.MenuDragSpeed * ParentWindow.CurrentEvent.delta.x; + if ( m_currentScrollPos.x < 0 ) + m_currentScrollPos.x = 0; + m_currentScrollPos.y += Constants.MenuDragSpeed * ParentWindow.CurrentEvent.delta.y; + if ( m_currentScrollPos.y < 0 ) + m_currentScrollPos.y = 0; + + } + } + } + + public void PostDraw() + { + if ( !m_isMaximized ) + { + m_transformedArea.height = 35; + GUI.Label( m_transformedArea, m_content, m_style ); + } + + Color colorBuffer = GUI.color; + GUI.color = EditorGUIUtility.isProSkin ? Color.white : Color.black; + bool guiEnabledBuffer = GUI.enabled; + GUI.enabled = !m_lockOnMinimize; + Rect buttonArea = m_minimizeButtonPos; + + buttonArea.x -= MinimizeCollisionAdjust; + buttonArea.width += 2 * MinimizeCollisionAdjust; + + buttonArea.y -= MinimizeCollisionAdjust; + buttonArea.height += 2 * MinimizeCollisionAdjust; + + if ( m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.Repaint ) + GUI.Label( m_minimizeButtonPos, string.Empty, UIUtils.GetCustomStyle( m_isMaximized ? CustomStyle.MinimizeButton : CustomStyle.MaximizeButton ) ); + + if( m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.MouseDown && buttonArea.Contains( m_parentWindow.CameraDrawInfo.MousePosition ) ) + //if ( GUI.Button( buttonArea, string.Empty, m_empty ) ) + { + m_isMaximized = !m_isMaximized; + m_resizeDelta = 0; + } + + if ( m_resizable && m_isMaximized ) + { + EditorGUIUtility.AddCursorRect( m_resizeArea, MouseCursor.ResizeHorizontal ); + if ( !m_isResizing && GUI.RepeatButton( m_resizeArea, string.Empty, m_resizeAreaStyle ) ) + { + m_isResizing = true; + } + else + { + if ( m_isResizing ) + { + if ( ParentWindow.CurrentEvent.isMouse && ParentWindow.CurrentEvent.type != EventType.MouseDrag ) + { + m_isResizing = false; + } + } + } + + if ( m_realWidth < buttonArea.width ) + { + // Auto-minimize + m_isMaximized = false; + m_resizeDelta = 0; + m_isResizing = false; + } + else + { + float halfSizeWindow = 0.5f * ParentWindow.position.width; + if ( m_realWidth > halfSizeWindow ) + { + m_realWidth = 0.5f * ParentWindow.position.width; + if ( m_resizeDelta > 0 ) + { + m_resizeDelta = m_realWidth - m_maximizedArea.width; + } + else + { + m_resizeDelta = m_maximizedArea.width - m_realWidth; + } + } + } + } + + GUI.enabled = guiEnabledBuffer; + GUI.color = colorBuffer; + + } + + public void OnLostFocus() + { + if ( m_isResizing ) + { + m_isResizing = false; + } + } + + virtual public void Destroy() + { + m_empty = null; + m_resizeAreaStyle = null; + } + + public float InitialX + { + get { return m_maximizedArea.x; } + set { m_maximizedArea.x = value; } + } + + public float Width + { + get { return m_maximizedArea.width; } + set { m_maximizedArea.width = value; } + } + + public float RealWidth + { + get { return m_realWidth; } + } + public float Height + { + get { return m_maximizedArea.height; } + set { m_maximizedArea.height = value; } + } + + public Rect Size + { + get { return m_maximizedArea; } + } + + public virtual bool IsInside( Vector2 position ) + { + if ( !m_isActive ) + return false; + + return m_transformedArea.Contains( position ); + } + + public bool IsMaximized + { + get { return m_isMaximized; } + set { m_isMaximized = value; } + } + + public Rect TransformedArea + { + get { return m_transformedArea; } + } + + public bool Resizable { set { m_resizable = value; } } + public bool IsResizing { get { return m_isResizing; } } + public bool LockOnMinimize + { + set + { + if ( m_lockOnMinimize == value ) + return; + + m_lockOnMinimize = value; + if ( value ) + { + m_preLockState = m_isMaximized; + m_isMaximized = false; + } + else + { + m_isMaximized = m_preLockState; + } + } + } + public bool IsActive + { + get { return m_isActive; } + } + public AmplifyShaderEditorWindow ParentWindow { get { return m_parentWindow; } set { m_parentWindow = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs.meta new file mode 100644 index 00000000..b0427835 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5d535d3799a3ef547aea607fdc8b947b +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs new file mode 100644 index 00000000..f57738b7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs @@ -0,0 +1,569 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; +using UnityEditorInternal; + +namespace AmplifyShaderEditor +{ + public sealed class NodeParametersWindow : MenuParent + { + private int m_lastSelectedNode = -1; + private const string TitleStr = "Node Properties"; + private GUIStyle m_nodePropertiesStyle; + private GUIContent m_dummyContent = new GUIContent(); + private GUIStyle m_propertyAdjustment; + + private ReorderableList m_functionInputsReordableList = null; + private int m_functionInputsLastCount = 0; + + private ReorderableList m_functionSwitchesReordableList = null; + private int m_functionSwitchesLastCount = 0; + + private ReorderableList m_functionOutputsReordableList = null; + private int m_functionOutputsLastCount = 0; + + private ReorderableList m_propertyReordableList = null; + private int m_lastCount = 0; + + private bool m_forceUpdate = false; + + [SerializeField] + private List m_propertyReordableNodes = new List(); + + // width and height are between [0,1] and represent a percentage of the total screen area + public NodeParametersWindow( AmplifyShaderEditorWindow parentWindow ) : base( parentWindow, 0, 0, 285, 0, string.Empty, MenuAnchor.TOP_LEFT, MenuAutoSize.MATCH_VERTICAL ) + { + SetMinimizedArea( -225, 0, 260, 0 ); + } + + public void OnShaderFunctionLoad() + { + m_functionInputsReordableList = null; + m_functionSwitchesReordableList = null; + m_functionOutputsReordableList = null; + } + + public bool Draw( Rect parentPosition, ParentNode selectedNode, Vector2 mousePosition, int mouseButtonId, bool hasKeyboardFocus ) + { + bool changeCheck = false; + base.Draw( parentPosition, mousePosition, mouseButtonId, hasKeyboardFocus ); + if ( m_nodePropertiesStyle == null ) + { + m_nodePropertiesStyle = UIUtils.GetCustomStyle( CustomStyle.NodePropertiesTitle ); + m_nodePropertiesStyle.normal.textColor = m_nodePropertiesStyle.active.textColor = EditorGUIUtility.isProSkin ? new Color( 1f, 1f, 1f ) : new Color( 0f, 0f, 0f ); + } + + if ( m_isMaximized ) + { + KeyCode key = Event.current.keyCode; + if ( m_isMouseInside || hasKeyboardFocus ) + { + if ( key == ShortcutsManager.ScrollUpKey ) + { + m_currentScrollPos.y -= 10; + if ( m_currentScrollPos.y < 0 ) + { + m_currentScrollPos.y = 0; + } + Event.current.Use(); + } + + if ( key == ShortcutsManager.ScrollDownKey ) + { + m_currentScrollPos.y += 10; + Event.current.Use(); + } + } + + if( m_forceUpdate ) + { + if( m_propertyReordableList != null ) + m_propertyReordableList.ReleaseKeyboardFocus(); + m_propertyReordableList = null; + + if ( m_functionInputsReordableList != null ) + m_functionInputsReordableList.ReleaseKeyboardFocus(); + m_functionInputsReordableList = null; + + if( m_functionSwitchesReordableList != null ) + m_functionSwitchesReordableList.ReleaseKeyboardFocus(); + m_functionSwitchesReordableList = null; + + if ( m_functionOutputsReordableList != null ) + m_functionOutputsReordableList.ReleaseKeyboardFocus(); + m_functionOutputsReordableList = null; + m_forceUpdate = false; + } + + GUILayout.BeginArea( m_transformedArea, m_content, m_style ); + { + //Draw selected node parameters + if ( selectedNode != null ) + { + // this hack is need because without it the several FloatFields/Textfields/... would show wrong values ( different from the ones they were assigned to show ) + if ( m_lastSelectedNode != selectedNode.UniqueId ) + { + m_lastSelectedNode = selectedNode.UniqueId; + GUI.FocusControl( "" ); + } + + EditorGUILayout.BeginVertical(); + { + EditorGUILayout.Separator(); + if ( selectedNode.UniqueId == ParentWindow.CurrentGraph.CurrentMasterNodeId ) + { + m_dummyContent.text = "Output Node"; + } + else + { + if ( selectedNode.Attributes != null ) + { + + m_dummyContent.text = selectedNode.Attributes.Name; + } + else if ( selectedNode is CommentaryNode ) + { + m_dummyContent.text = "Commentary"; + } + else + { + m_dummyContent.text = TitleStr; + } + } + + EditorGUILayout.LabelField( m_dummyContent, m_nodePropertiesStyle ); + + EditorGUILayout.Separator(); + //UIUtils.RecordObject( selectedNode , "Changing properties on node " + selectedNode.UniqueId); + m_currentScrollPos = EditorGUILayout.BeginScrollView( m_currentScrollPos, GUILayout.Width( 0 ), GUILayout.Height( 0 ) ); + float labelWidth = EditorGUIUtility.labelWidth; + //if( selectedNode.TextLabelWidth > 0 ) + // EditorGUIUtility.labelWidth = selectedNode.TextLabelWidth; + //else + EditorGUIUtility.labelWidth = TransformedArea.width * 0.42f; + + changeCheck = selectedNode.SafeDrawProperties(); + EditorGUIUtility.labelWidth = labelWidth; + EditorGUILayout.EndScrollView(); + } + EditorGUILayout.EndVertical(); + + if ( changeCheck ) + { + if ( selectedNode.ConnStatus == NodeConnectionStatus.Connected ) + ParentWindow.SetSaveIsDirty(); + } + } + else + { + //Draw Graph Params + EditorGUILayout.BeginVertical(); + { + EditorGUILayout.Separator(); + EditorGUILayout.LabelField( "Graph Properties", m_nodePropertiesStyle ); + EditorGUILayout.Separator(); + + m_currentScrollPos = EditorGUILayout.BeginScrollView( m_currentScrollPos, GUILayout.Width( 0 ), GUILayout.Height( 0 ) ); + float labelWidth = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 90; + + bool generalIsVisible = m_parentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions; + NodeUtils.DrawPropertyGroup( ref generalIsVisible, " General", DrawGeneralFunction ); + m_parentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions = generalIsVisible; + AmplifyShaderFunction function = ParentWindow.CurrentGraph.CurrentShaderFunction; + if( function != null ) + { + //function.AdditionalIncludes.Draw( ParentWindow.CurrentGraph.CurrentOutputNode ); + //function.AdditionalPragmas.Draw( ParentWindow.CurrentGraph.CurrentOutputNode ); + function.AdditionalDirectives.Draw( ParentWindow.CurrentGraph.CurrentOutputNode ); + } + + bool inputIsVisible = m_parentWindow.InnerWindowVariables.ExpandedFunctionInputs; + NodeUtils.DrawPropertyGroup( ref inputIsVisible, " Function Inputs", DrawFunctionInputs ); + m_parentWindow.InnerWindowVariables.ExpandedFunctionInputs = inputIsVisible; + + bool swicthIsVisible = m_parentWindow.InnerWindowVariables.ExpandedFunctionSwitches; + NodeUtils.DrawPropertyGroup( ref swicthIsVisible, " Function Switches", DrawFunctionSwitches ); + m_parentWindow.InnerWindowVariables.ExpandedFunctionSwitches = swicthIsVisible; + + bool outputIsVisible = m_parentWindow.InnerWindowVariables.ExpandedFunctionOutputs; + NodeUtils.DrawPropertyGroup( ref outputIsVisible, " Function Outputs", DrawFunctionOutputs ); + m_parentWindow.InnerWindowVariables.ExpandedFunctionOutputs = outputIsVisible; + + bool properties = ParentWindow.InnerWindowVariables.ExpandedProperties; + NodeUtils.DrawPropertyGroup( ref properties, " Material Properties", DrawFunctionProperties ); + ParentWindow.InnerWindowVariables.ExpandedProperties = properties; + + EditorGUIUtility.labelWidth = labelWidth; + EditorGUILayout.EndScrollView(); + } + EditorGUILayout.EndVertical(); + } + } + // Close window area + GUILayout.EndArea(); + } + + PostDraw(); + return changeCheck; + } + + public void DrawGeneralFunction() + { + AmplifyShaderFunction function = ParentWindow.CurrentGraph.CurrentShaderFunction; + if ( function == null ) + return; + + float cacheWidth = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 115; + + SerializedObject serializedObject = new UnityEditor.SerializedObject( function ); + + if ( serializedObject != null ) + { + SerializedProperty temo = serializedObject.FindProperty( "m_description" ); + EditorGUILayout.PropertyField( temo, new GUIContent( " Description" ) ); + + SerializedProperty url = serializedObject.FindProperty( "m_url" ); + EditorGUILayout.PropertyField( url , new GUIContent( "Custom URL" ) ); + + SerializedProperty cat = serializedObject.FindProperty( "m_nodeCategory" ); + SerializedProperty ppos = serializedObject.FindProperty( "m_previewPosition" ); + + EditorGUILayout.PropertyField( ppos, new GUIContent( "Preview Position" ) ); + cat.intValue = ParentWindow.CurrentGraph.CurrentOutputNode.EditorGUILayoutPopup( "Category", cat.intValue, UIUtils.CategoryPresets ); + + if( cat.enumValueIndex == 0 ) + { + SerializedProperty custCat = serializedObject.FindProperty( "m_customNodeCategory" ); + EditorGUILayout.PropertyField( custCat, new GUIContent( "Custom" ) ); + } + SerializedProperty hidden = serializedObject.FindProperty( "m_hidden" ); + EditorGUILayout.PropertyField( hidden, new GUIContent( "Hidden" ) ); + + SerializedProperty customHeader = serializedObject.FindProperty( "m_headerStyle" ); + EditorGUILayout.PropertyField( customHeader, new GUIContent( "Header Style" ) ); + if ( customHeader.intValue == ( int )AmplifyShaderFunction.HeaderStyle.Custom ) + { + SerializedProperty headerColor = serializedObject.FindProperty( "m_headerColor" ); + EditorGUILayout.PropertyField( headerColor, new GUIContent( "Header Color" ) ); + } + + serializedObject.ApplyModifiedProperties(); + } + EditorGUIUtility.labelWidth = cacheWidth; + } + + + public void DrawFunctionInputs() + { + List functionInputNodes = UIUtils.FunctionInputList(); + + if ( m_functionInputsReordableList == null || functionInputNodes.Count != m_functionInputsLastCount ) + { + functionInputNodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + + m_functionInputsReordableList = new ReorderableList( functionInputNodes, typeof( FunctionInput ), true, false, false, false ); + m_functionInputsReordableList.headerHeight = 0; + m_functionInputsReordableList.footerHeight = 0; + m_functionInputsReordableList.showDefaultBackground = false; + + m_functionInputsReordableList.drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => + { + EditorGUI.LabelField( rect, functionInputNodes[ index ].InputName ); + }; + + m_functionInputsReordableList.onChangedCallback = ( list ) => + { + //for ( int i = 0; i < functionInputNodes.Count; i++ ) + //{ + // functionInputNodes[ i ].OrderIndex = i; + //} + ForceInputReorder( ref functionInputNodes ); + }; + + m_functionInputsLastCount = m_functionInputsReordableList.count; + } + + if ( m_functionInputsReordableList != null ) + { + if ( m_propertyAdjustment == null ) + { + m_propertyAdjustment = new GUIStyle(); + m_propertyAdjustment.padding.left = 17; + } + EditorGUILayout.BeginVertical( m_propertyAdjustment ); + m_functionInputsReordableList.DoLayoutList(); + EditorGUILayout.EndVertical(); + } + } + + public void ForceInputReorder( ref List functionInputNodes ) + { + for( int i = 0; i < functionInputNodes.Count; i++ ) + { + functionInputNodes[ i ].OrderIndex = i; + } + } + + public void DrawFunctionSwitches() + { + List functionSwitchNodes = UIUtils.FunctionSwitchList(); + + if( m_functionSwitchesReordableList == null || functionSwitchNodes.Count != m_functionSwitchesLastCount ) + { + functionSwitchNodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + + UIUtils.UpdateFunctionSwitchArr(); + + m_functionSwitchesReordableList = new ReorderableList( functionSwitchNodes, typeof( FunctionSwitch ), true, false, false, false ); + m_functionSwitchesReordableList.headerHeight = 0; + m_functionSwitchesReordableList.footerHeight = 0; + m_functionSwitchesReordableList.showDefaultBackground = false; + + m_functionSwitchesReordableList.drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => + { + EditorGUI.LabelField( rect, functionSwitchNodes[ index ].OptionLabel ); + }; + + m_functionSwitchesReordableList.onChangedCallback = ( list ) => + { + ForceSwitchesReorder(ref functionSwitchNodes ); + }; + + m_functionSwitchesLastCount = m_functionSwitchesReordableList.count; + } + + if( m_functionSwitchesReordableList != null ) + { + if( m_propertyAdjustment == null ) + { + m_propertyAdjustment = new GUIStyle(); + m_propertyAdjustment.padding.left = 17; + } + EditorGUILayout.BeginVertical( m_propertyAdjustment ); + m_functionSwitchesReordableList.DoLayoutList(); + EditorGUILayout.EndVertical(); + } + } + + public void ForceSwitchesReorder( ref List functionSwitchNodes ) + { + for( int i = 0; i < functionSwitchNodes.Count; i++ ) + { + functionSwitchNodes[ i ].OrderIndex = i; + } + + UIUtils.UpdateFunctionSwitchArr(); + } + + public void DrawFunctionOutputs() + { + List functionOutputNodes = UIUtils.FunctionOutputList(); + + if ( m_functionOutputsReordableList == null || functionOutputNodes.Count != m_functionOutputsLastCount ) + { + functionOutputNodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + + m_functionOutputsReordableList = new ReorderableList( functionOutputNodes, typeof( FunctionOutput ), true, false, false, false ); + m_functionOutputsReordableList.headerHeight = 0; + m_functionOutputsReordableList.footerHeight = 0; + m_functionOutputsReordableList.showDefaultBackground = false; + + m_functionOutputsReordableList.drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => + { + EditorGUI.LabelField( rect, functionOutputNodes[ index ].OutputName ); + }; + + m_functionOutputsReordableList.onChangedCallback = ( list ) => + { + for ( int i = 0; i < functionOutputNodes.Count; i++ ) + { + functionOutputNodes[ i ].OrderIndex = i; + } + }; + + m_functionOutputsLastCount = m_functionOutputsReordableList.count; + } + + if ( m_functionOutputsReordableList != null ) + { + if ( m_propertyAdjustment == null ) + { + m_propertyAdjustment = new GUIStyle(); + m_propertyAdjustment.padding.left = 17; + } + EditorGUILayout.BeginVertical( m_propertyAdjustment ); + m_functionOutputsReordableList.DoLayoutList(); + EditorGUILayout.EndVertical(); + } + } + + private void RefreshVisibleList( ref List allNodes ) + { + // temp reference for lambda expression + List nodes = allNodes; + m_propertyReordableNodes.Clear(); + + for( int i = 0; i < nodes.Count; i++ ) + { + ReordenatorNode rnode = nodes[ i ] as ReordenatorNode; + if( ( rnode == null || !rnode.IsInside ) && ( !m_propertyReordableNodes.Exists( x => x.PropertyName.Equals( nodes[ i ].PropertyName ) ) ) ) + m_propertyReordableNodes.Add( nodes[ i ] ); + } + + m_propertyReordableNodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + } + + public void DrawFunctionProperties() + { + List nodes = UIUtils.PropertyNodesList(); + + if( nodes.Count != m_lastCount ) + { + RefreshVisibleList( ref nodes ); + m_lastCount = nodes.Count; + } + + if( m_propertyReordableList == null ) + { + m_propertyReordableList = new ReorderableList( m_propertyReordableNodes, typeof( PropertyNode ), true, false, false, false ) + { + headerHeight = 0, + footerHeight = 0, + showDefaultBackground = false, + + drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => + { + var first = rect; + first.width *= 0.60f; + EditorGUI.LabelField( first, m_propertyReordableNodes[ index ].PropertyInspectorName ); + var second = rect; + second.width *= 0.4f; + second.x += first.width; + if( GUI.Button( second, m_propertyReordableNodes[ index ].PropertyName, new GUIStyle( "AssetLabel Partial" ) ) ) + { + UIUtils.FocusOnNode( m_propertyReordableNodes[ index ], 1, false ); + } + }, + + onReorderCallback = ( list ) => + { + ReorderList( ref nodes ); + } + }; + ReorderList( ref nodes ); + } + + if( m_propertyReordableList != null ) + { + if( m_propertyAdjustment == null ) + { + m_propertyAdjustment = new GUIStyle(); + m_propertyAdjustment.padding.left = 17; + } + EditorGUILayout.BeginVertical( m_propertyAdjustment ); + m_propertyReordableList.DoLayoutList(); + EditorGUILayout.EndVertical(); + } + } + + public void ForceReordering() + { + List nodes = UIUtils.PropertyNodesList(); + ReorderList( ref nodes ); + + List functionInputNodes = UIUtils.FunctionInputList(); + ForceInputReorder( ref functionInputNodes ); + + List functionSwitchNodes = UIUtils.FunctionSwitchList(); + ForceSwitchesReorder( ref functionSwitchNodes ); + //RecursiveLog(); + } + + private void RecursiveLog() + { + List nodes = UIUtils.PropertyNodesList(); + nodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + for( int i = 0; i < nodes.Count; i++ ) + { + if( ( nodes[ i ] is ReordenatorNode ) ) + ( nodes[ i ] as ReordenatorNode ).RecursiveLog(); + else + Debug.Log( nodes[ i ].OrderIndex + " " + nodes[ i ].PropertyName ); + } + } + + + private void ReorderList( ref List nodes ) + { + // clear lock list before reordering because of multiple sf being used + for( int i = 0; i < nodes.Count; i++ ) + { + ReordenatorNode rnode = nodes[ i ] as ReordenatorNode; + if ( rnode != null ) + rnode.RecursiveClear(); + } + + int propoffset = 0; + int count = 0; + for ( int i = 0; i < m_propertyReordableNodes.Count; i++ ) + { + ReordenatorNode renode = m_propertyReordableNodes[ i ] as ReordenatorNode; + if ( renode != null ) + { + if ( !renode.IsInside ) + { + m_propertyReordableNodes[ i ].OrderIndex = count + propoffset; + + if ( renode.PropertyListCount > 0 ) + { + propoffset += renode.RecursiveCount(); + + // the same reordenator can exist multiple times, apply ordering to all of them + for( int j = 0; j < nodes.Count; j++ ) + { + ReordenatorNode pnode = ( nodes[ j ] as ReordenatorNode ); + if ( pnode != null && pnode.PropertyName.Equals( renode.PropertyName ) ) + { + pnode.OrderIndex = renode.RawOrderIndex; + pnode.RecursiveSetOrderOffset( renode.RawOrderIndex, true ); + } + } + } + else + { + count++; + } + } + else + { + m_propertyReordableNodes[ i ].OrderIndex = 0; + } + } + else + { + m_propertyReordableNodes[ i ].OrderIndex = count + propoffset; + count++; + } + } + } + + public override void Destroy() + { + base.Destroy(); + m_functionInputsReordableList = null; + m_functionOutputsReordableList = null; + m_propertyReordableList = null; + } + + public bool ForceUpdate + { + get { return m_forceUpdate; } + set { m_forceUpdate = value; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs.meta new file mode 100644 index 00000000..969f7562 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d09f21096aa7c9f438e91a6e7f2621fb +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs new file mode 100644 index 00000000..f1793a24 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs @@ -0,0 +1,56 @@ +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public class NodeWireReferencesUtils + { + public WireReference InputPortReference = new WireReference(); + public WireReference SwitchPortReference = new WireReference(); + public WireReference OutputPortReference = new WireReference(); + + public Vector2 SnapPosition = Vector2.zero; + public bool SnapEnabled = false; + public WireReference SnapPort = new WireReference(); + + public bool ValidReferences() + { + return ( InputPortReference.IsValid || OutputPortReference.IsValid ); + } + + public void InvalidateReferences() + { + InputPortReference.Invalidate(); + OutputPortReference.Invalidate(); + SnapPort.Invalidate(); + SnapEnabled = false; + } + + + public void SetOutputReference( int nodeId, int portId, WirePortDataType dataType, bool typeLocked ) + { + if( InputPortReference.IsValid ) + InputPortReference.Invalidate(); + OutputPortReference.SetReference( nodeId, portId, dataType, typeLocked ); + } + + public void SetInputReference( int nodeId, int portId, WirePortDataType dataType, bool typeLocked ) + { + if( OutputPortReference.IsValid ) + OutputPortReference.Invalidate(); + InputPortReference.SetReference( nodeId, portId, dataType, typeLocked ); + } + + public void ActivateSnap( Vector2 position, WirePort port ) + { + SnapPort.SetReference( port ); + SnapEnabled = true; + SnapPosition = position; + } + + public void DeactivateSnap() + { + SnapEnabled = false; + SnapPort.Invalidate(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs.meta new file mode 100644 index 00000000..a7ed1777 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: bfbc736093c900c418a7668e3003663a +timeCreated: 1500289690 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette.meta new file mode 100644 index 00000000..71c42517 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a89b03eb735b82a4da19a8381846935f +folderAsset: yes +timeCreated: 1481126946 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs new file mode 100644 index 00000000..ae870612 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs @@ -0,0 +1,101 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System.Collections.Generic; +using System; + +namespace AmplifyShaderEditor +{ + public sealed class ContextPalette : PaletteParent + { + private Vector3 m_position; + private Vector2 m_startDropPosition; + public ContextPalette( AmplifyShaderEditorWindow parentWindow ) : base( parentWindow, 0, 0, 250, 250, string.Empty, MenuAnchor.NONE, MenuAutoSize.NONE ) + { + m_isActive = false; + OnPaletteNodeCreateEvt += OnOptionSelected; + m_searchFilterControl += "CONTEXTPALETTE"; + } + + public override void OnEnterPressed(int index = 0) + { + if ( m_searchFilter.Length > 0 && m_currentItems.Count > 0 ) + { + FireNodeCreateEvent( m_currentItems[ index ].NodeType, m_currentItems[ index ].Name, m_currentItems[ index ].Function ); + } + else + { + Disable(); + } + } + + public override void OnEscapePressed() + { + Disable(); + if ( m_parentWindow.WireReferenceUtils.ValidReferences() ) + { + m_parentWindow.WireReferenceUtils.InvalidateReferences(); + } + } + + public override void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus ) + { + //if ( !_isActive ) + // return; + + if ( Event.current.type == EventType.MouseDown && !IsInside( Event.current.mousePosition ) ) + { + Disable(); + return; + } + base.Draw( parentPosition, mousePosition, mouseButtonId, hasKeyboadFocus ); + } + + + public void Show( Vector2 position, Rect cameraInfo ) + { + m_startDropPosition = position; + m_maximizedArea.x = ( position.x + m_maximizedArea.width ) > cameraInfo.width ? ( cameraInfo.width - 1.1f * m_maximizedArea.width ) : position.x; + m_maximizedArea.y = ( position.y + m_maximizedArea.height ) > cameraInfo.height ? ( cameraInfo.height - 1.1f * m_maximizedArea.height ) : position.y; + m_position = new Vector3( m_maximizedArea.x, m_maximizedArea.y, 0f ); + m_isActive = true; + m_focusOnSearch = true; + } + + + // This override is removing focus from our window ... need to figure out a workaround before re-using it + //public override bool CheckButton( GUIContent content, GUIStyle style, int buttonId ) + //{ + // if ( buttonId != m_validButtonId ) + // return false; + + // return GUILayout.Button( content, style ); + //} + + void OnOptionSelected( System.Type type, string name, AmplifyShaderFunction function ) + { + Disable(); + } + + public void Disable() + { + m_isActive = false; + } + + public Vector2 StartDropPosition + { + get { return m_startDropPosition; } + } + + public Vector3 CurrentPosition + { + get { return m_position; } + } + + public Vector2 CurrentPosition2D + { + get { return new Vector2( m_position.x, m_position.y ); } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs.meta new file mode 100644 index 00000000..8b46096a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 15597b146a1fc154abd63ac75cffb73f +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs new file mode 100644 index 00000000..67ce6e14 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs @@ -0,0 +1,573 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System.Collections.Generic; +using UnityEditor; +using System; +using System.Text.RegularExpressions; + +namespace AmplifyShaderEditor +{ + public class PaletteFilterData + { + public bool Visible; + public bool HasCommunityData; + public List Contents; + public PaletteFilterData( bool visible ) + { + Visible = visible; + Contents = new List(); + } + } + + public class PaletteParent : MenuParent + { + private const float ItemSize = 18; + public delegate void OnPaletteNodeCreate( System.Type type, string name, AmplifyShaderFunction function ); + public event OnPaletteNodeCreate OnPaletteNodeCreateEvt; + + private string m_searchFilterStr = "Search"; + protected string m_searchFilterControl = "SHADERNAMETEXTFIELDCONTROLNAME"; + protected bool m_focusOnSearch = false; + protected bool m_defaultCategoryVisible = false; + + //protected List m_allItems; + protected List m_currentItems; + protected Dictionary m_currentCategories; + private bool m_forceUpdate = true; + + + protected string m_searchFilter = string.Empty; + + private float m_searchLabelSize = -1; + private GUIStyle m_buttonStyle; + private GUIStyle m_foldoutStyle; + + protected bool m_previousWindowIsFunction = false; + + protected int m_validButtonId = 0; + protected int m_initialSeparatorAmount = 1; + + private Vector2 m_currScrollBarDims = new Vector2( 1, 1 ); + + public PaletteParent( AmplifyShaderEditorWindow parentWindow, float x, float y, float width, float height, string name, MenuAnchor anchor = MenuAnchor.NONE, MenuAutoSize autoSize = MenuAutoSize.NONE ) : base( parentWindow, x, y, width, height, name, anchor, autoSize ) + { + m_searchFilter = string.Empty; + m_currentCategories = new Dictionary(); + //m_allItems = items; + m_currentItems = new List(); + } + + public virtual void OnEnterPressed( int index = 0 ) { } + public virtual void OnEscapePressed() { } + + public void FireNodeCreateEvent( System.Type type, string name, AmplifyShaderFunction function ) + { + OnPaletteNodeCreateEvt( type, name, function ); + } + + public override void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus ) + { + base.Draw( parentPosition, mousePosition, mouseButtonId, hasKeyboadFocus ); + if( m_previousWindowIsFunction != ParentWindow.IsShaderFunctionWindow ) + { + m_forceUpdate = true; + } + + m_previousWindowIsFunction = ParentWindow.IsShaderFunctionWindow; + + List allItems = ParentWindow.ContextMenuInstance.MenuItems; + + if( m_searchLabelSize < 0 ) + { + m_searchLabelSize = GUI.skin.label.CalcSize( new GUIContent( m_searchFilterStr ) ).x; + } + + if( m_foldoutStyle == null ) + { + m_foldoutStyle = new GUIStyle( GUI.skin.GetStyle( "foldout" ) ); + m_foldoutStyle.fontStyle = FontStyle.Bold; + } + + if( m_buttonStyle == null ) + { + m_buttonStyle = UIUtils.Label; + } + + Event currenEvent = Event.current; + + GUILayout.BeginArea( m_transformedArea, m_content, m_style ); + { + for( int i = 0; i < m_initialSeparatorAmount; i++ ) + { + EditorGUILayout.Separator(); + } + + if( currenEvent.type == EventType.KeyDown ) + { + KeyCode key = currenEvent.keyCode; + //if ( key == KeyCode.Return || key == KeyCode.KeypadEnter ) + // OnEnterPressed(); + + if( ( currenEvent.keyCode == KeyCode.KeypadEnter || currenEvent.keyCode == KeyCode.Return ) && currenEvent.type == EventType.KeyDown ) + { + int index = m_currentItems.FindIndex( x => GUI.GetNameOfFocusedControl().Equals( x.ItemUIContent.text + m_resizable ) ); + if( index > -1 ) + OnEnterPressed( index ); + else + OnEnterPressed(); + } + + if( key == KeyCode.Escape ) + OnEscapePressed(); + + if( m_isMouseInside || hasKeyboadFocus ) + { + if( key == ShortcutsManager.ScrollUpKey ) + { + m_currentScrollPos.y -= 10; + if( m_currentScrollPos.y < 0 ) + { + m_currentScrollPos.y = 0; + } + currenEvent.Use(); + } + + if( key == ShortcutsManager.ScrollDownKey ) + { + m_currentScrollPos.y += 10; + currenEvent.Use(); + } + } + + } + + float width = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = m_searchLabelSize; + EditorGUI.BeginChangeCheck(); + { + GUI.SetNextControlName( m_searchFilterControl + m_resizable ); + m_searchFilter = EditorGUILayout.TextField( m_searchFilterStr, m_searchFilter ); + if( m_focusOnSearch ) + { + m_focusOnSearch = false; + EditorGUI.FocusTextInControl( m_searchFilterControl + m_resizable ); + } + } + if( EditorGUI.EndChangeCheck() ) + m_forceUpdate = true; + + EditorGUIUtility.labelWidth = width; + bool usingSearchFilter = ( m_searchFilter.Length == 0 ); + m_currScrollBarDims.x = m_transformedArea.width; + m_currScrollBarDims.y = m_transformedArea.height - 2 - 16 - 2 - 7 * m_initialSeparatorAmount - 2; + m_currentScrollPos = EditorGUILayout.BeginScrollView( m_currentScrollPos/*, GUILayout.Width( 242 ), GUILayout.Height( 250 - 2 - 16 - 2 - 7 - 2) */); + { + if( m_forceUpdate ) + { + m_forceUpdate = false; + + //m_currentItems.Clear(); + m_currentCategories.Clear(); + + if( usingSearchFilter ) + { + for( int i = 0; i < allItems.Count; i++ ) + { + //m_currentItems.Add( allItems[ i ] ); + if( !m_currentCategories.ContainsKey( allItems[ i ].Category ) ) + { + m_currentCategories.Add( allItems[ i ].Category, new PaletteFilterData( m_defaultCategoryVisible ) ); + //m_currentCategories[ allItems[ i ].Category ].HasCommunityData = allItems[ i ].NodeAttributes.FromCommunity || m_currentCategories[ allItems[ i ].Category ].HasCommunityData; + } + m_currentCategories[ allItems[ i ].Category ].Contents.Add( allItems[ i ] ); + } + } + else + { + for( int i = 0; i < allItems.Count; i++ ) + { + var searchList = m_searchFilter.Trim( ' ' ).ToLower().Split(' '); + + int matchesFound = 0; + for( int k = 0; k < searchList.Length; k++ ) + { + MatchCollection wordmatch = Regex.Matches( allItems[ i ].Tags, "\\b"+searchList[ k ] ); + if( wordmatch.Count > 0 ) + matchesFound++; + else + break; + } + + if( searchList.Length == matchesFound ) + { + //m_currentItems.Add( allItems[ i ] ); + if( !m_currentCategories.ContainsKey( allItems[ i ].Category ) ) + { + m_currentCategories.Add( allItems[ i ].Category, new PaletteFilterData( m_defaultCategoryVisible ) ); + //m_currentCategories[ allItems[ i ].Category ].HasCommunityData = allItems[ i ].NodeAttributes.FromCommunity || m_currentCategories[ allItems[ i ].Category ].HasCommunityData; + } + m_currentCategories[ allItems[ i ].Category ].Contents.Add( allItems[ i ] ); + } + } + } + var categoryEnumerator = m_currentCategories.GetEnumerator(); + while( categoryEnumerator.MoveNext() ) + { + categoryEnumerator.Current.Value.Contents.Sort( ( x, y ) => x.CompareTo( y, usingSearchFilter ) ); + } + + //sort current list respecting categories + m_currentItems.Clear(); + foreach( var item in m_currentCategories ) + { + for( int i = 0; i < item.Value.Contents.Count; i++ ) + { + m_currentItems.Add( item.Value.Contents[ i ] ); + } + } + } + + string watching = string.Empty; + + // unselect the main search field so it can focus list elements next + if( ( currenEvent.keyCode == KeyCode.DownArrow || currenEvent.keyCode == KeyCode.UpArrow ) && m_searchFilter.Length > 0 ) + { + if( GUI.GetNameOfFocusedControl().Equals( m_searchFilterControl + m_resizable ) ) + { + EditorGUI.FocusTextInControl( null ); + } + } + + if( currenEvent.keyCode == KeyCode.DownArrow && currenEvent.type == EventType.KeyDown ) + { + currenEvent.Use(); + + int nextIndex = m_currentItems.FindIndex( x => GUI.GetNameOfFocusedControl().Equals( x.ItemUIContent.text + m_resizable ) ) + 1; + if( nextIndex == m_currentItems.Count ) + nextIndex = 0; + + watching = m_currentItems[ nextIndex ].ItemUIContent.text + m_resizable; + GUI.FocusControl( watching ); + + } + + if( currenEvent.keyCode == KeyCode.UpArrow && currenEvent.type == EventType.KeyDown ) + { + currenEvent.Use(); + + int nextIndex = m_currentItems.FindIndex( x => GUI.GetNameOfFocusedControl().Equals( x.ItemUIContent.text + m_resizable ) ) - 1; + if( nextIndex < 0 ) + nextIndex = m_currentItems.Count - 1; + + watching = m_currentItems[ nextIndex ].ItemUIContent.text + m_resizable; + GUI.FocusControl( watching ); + } + + if( currenEvent.keyCode == KeyCode.Tab ) + { + ContextMenuItem item = m_currentItems.Find( x => GUI.GetNameOfFocusedControl().Equals( x.ItemUIContent.text + m_resizable ) ); + if( item != null ) + { + watching = item.ItemUIContent.text + m_resizable; + } + } + + float currPos = 0; + var enumerator = m_currentCategories.GetEnumerator(); + + float cache = EditorGUIUtility.labelWidth; + while( enumerator.MoveNext() ) + { + var current = enumerator.Current; + bool visible = GUILayout.Toggle( current.Value.Visible, current.Key, m_foldoutStyle ); + if( m_validButtonId == mouseButtonId ) + { + current.Value.Visible = visible; + } + + currPos += ItemSize; + if( m_searchFilter.Length > 0 || current.Value.Visible ) + { + for( int i = 0; i < current.Value.Contents.Count; i++ ) + { + //if ( !IsItemVisible( currPos ) ) + //{ + // // Invisible + // GUILayout.Space( ItemSize ); + //} + //else + { + currPos += ItemSize; + // Visible + EditorGUILayout.BeginHorizontal(); + GUILayout.Space( 16 ); + //if ( m_isMouseInside ) + //{ + // //GUI.SetNextControlName( current.Value.Contents[ i ].ItemUIContent.text ); + // if ( CheckButton( current.Value.Contents[ i ].ItemUIContent, m_buttonStyle, mouseButtonId ) ) + // { + // int controlID = GUIUtility.GetControlID( FocusType.Passive ); + // GUIUtility.hotControl = controlID; + // OnPaletteNodeCreateEvt( current.Value.Contents[ i ].NodeType, current.Value.Contents[ i ].Name, current.Value.Contents[ i ].Function ); + // } + //} + //else + { + Rect thisRect = EditorGUILayout.GetControlRect( false, 16f, EditorStyles.label ); + //if ( m_resizable ) + { + if( GUI.RepeatButton( thisRect, string.Empty, EditorStyles.label ) ) + { + int controlID = GUIUtility.GetControlID( FocusType.Passive ); + GUIUtility.hotControl = controlID; + OnPaletteNodeCreateEvt( current.Value.Contents[ i ].NodeType, current.Value.Contents[ i ].Name, current.Value.Contents[ i ].Function ); + //unfocus to make it focus the next text field correctly + GUI.FocusControl( null ); + } + } + GUI.SetNextControlName( current.Value.Contents[ i ].ItemUIContent.text + m_resizable ); + //EditorGUI.SelectableLabel( thisRect, current.Value.Contents[ i ].ItemUIContent.text, EditorStyles.label ); + //float cache = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = thisRect.width; + EditorGUI.Toggle( thisRect, current.Value.Contents[ i ].ItemUIContent.text, false, EditorStyles.label ); + EditorGUIUtility.labelWidth = cache; + if( watching == current.Value.Contents[ i ].ItemUIContent.text + m_resizable ) + { + bool boundBottom = currPos - m_currentScrollPos.y > m_currScrollBarDims.y; + bool boundTop = currPos - m_currentScrollPos.y - 4 <= 0; + + if( boundBottom ) + m_currentScrollPos.y = currPos - m_currScrollBarDims.y + 2; + else if( boundTop ) + m_currentScrollPos.y = currPos - 18; + //else if ( boundBottom && !downDirection ) + // m_currentScrollPos.y = currPos - m_currScrollBarDims.y + 2; + //else if ( boundTop && downDirection ) + // m_currentScrollPos.y = currPos - 18; + } + } + EditorGUILayout.EndHorizontal(); + } + //currPos += ItemSize; + } + } + } + EditorGUIUtility.labelWidth = cache; + } + EditorGUILayout.EndScrollView(); + } + GUILayout.EndArea(); + + } + public void CheckCommunityNodes() + { + var enumerator = m_currentCategories.GetEnumerator(); + while( enumerator.MoveNext() ) + { + var current = enumerator.Current; + current.Value.HasCommunityData = false; + int count = current.Value.Contents.Count; + for( int i = 0; i < count; i++ ) + { + if( current.Value.Contents[ i ].NodeAttributes.FromCommunity ) + { + current.Value.HasCommunityData = true; + break; + } + } + } + } + + public void DumpAvailableNodes( bool fromCommunity, string pathname ) + { + string noTOCHeader = "__NOTOC__\n"; + string nodesHeader = "== Available Node Categories ==\n"; + string InitialCategoriesFormat = "[[#{0}|{0}]]
\n"; + string InitialCategories = string.Empty; + string CurrentCategoryFormat = "\n== {0} ==\n\n"; + //string NodesFootFormat = "[[Unity Products:Amplify Shader Editor/{0} | Learn More]] -\n[[#Top|Back to Categories]]\n"; + string NodesFootFormatSep = "[[#Top|Back to Top]]\n----\n"; + string OverallFoot = "[[Category:Nodes]]"; + + string NodeInfoBeginFormat = "
\n"; + string nodeInfoBodyFormat = "{{| id=\"{2}\" class=\"wikitable\" |\n" + + "|- \n" + + "|
[[Unity Products:Amplify Shader Editor/{1}|]]
\n" + + "
\n" + + "{{| style=\"width: 100%; height: 150px;\"\n" + + "|-\n" + + "| [[Unity Products:Amplify Shader Editor/{1}|'''{2}''']]\n" + + "|- style=\"vertical-align:top; height: 100%;\" |\n" + + "|

{3}

\n" + + "|- style=\"text-align:right;\" |\n" + + "|{4}[[Unity Products:Amplify Shader Editor/{1} | Learn More]]\n" + + "|}}
\n" + + "|}}\n"; + string NodeInfoEndFormat = "
\n"; + + //string NodeInfoBeginFormat = "This page is under construction!\n\n"; + //string nodeInfoBodyFormat = "\n[[Unity Products:Amplify Shader Editor/{1}|'''{2}''']]\n\n{3}"; + //string NodeInfoEndFormat = "\n\n[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List ]]\n[[Category:Nodes]][[Category:{0}]]\n\n\n"; + + //string NodeInfoBeginFormat = "{| cellpadding=\"10\"\n"; + //string nodeInfoBodyFormat = "|- style=\"vertical-align:top;\"\n| http://amplify.pt/Nodes/{0}.jpg\n| [[Unity Products:Amplify Shader Editor/{1} | '''{2}''' ]]
{3}\n"; + //string NodeInfoEndFormat = "|}\n"; + + string nodesInfo = string.Empty; + BuildFullList( true ); + CheckCommunityNodes(); + var enumerator = m_currentCategories.GetEnumerator(); + while( enumerator.MoveNext() ) + { + var current = enumerator.Current; + if( fromCommunity && current.Value.HasCommunityData || !fromCommunity ) + { + InitialCategories += string.Format( InitialCategoriesFormat, current.Key ); + nodesInfo += string.Format( CurrentCategoryFormat, current.Key ); + int count = current.Value.Contents.Count; + for( int i = 0; i < count; i++ ) + { + if( ( fromCommunity && current.Value.Contents[ i ].NodeAttributes.FromCommunity ) + || !fromCommunity + //|| ( !fromCommunity && !current.Value.Contents[ i ].NodeAttributes.FromCommunity ) + ) + { + string nodeFullName = current.Value.Contents[ i ].Name; + string pictureFilename = UIUtils.ReplaceInvalidStrings( nodeFullName ); + + string pageFilename = UIUtils.RemoveWikiInvalidCharacters( pictureFilename ); + + pictureFilename = UIUtils.RemoveInvalidCharacters( pictureFilename ); + + string nodeDescription = current.Value.Contents[ i ].ItemUIContent.tooltip; + string communityText = string.Empty; + if( current.Value.Contents[ i ].NodeAttributes.FromCommunity ) + communityText = "( originally by "+ current.Value.Contents[ i ].NodeAttributes.Community + " ) "; + + string nodeInfoBody = string.Format( nodeInfoBodyFormat, pictureFilename, pageFilename, nodeFullName, nodeDescription, communityText ); + //string nodeInfoFoot = string.Format( NodesFootFormat, pageFilename ); + + nodesInfo += ( NodeInfoBeginFormat + nodeInfoBody + NodeInfoEndFormat ); + //nodesInfo += ( NodeInfoBeginFormat + nodeInfoBody + string.Format( NodeInfoEndFormat, current.Key ) ); + //if ( i != ( count - 1 ) ) + //{ + // nodesInfo += NodesFootFormatSep; + //} + } + } + nodesInfo += NodesFootFormatSep; + } + } + + string finalText = noTOCHeader + nodesHeader + InitialCategories + nodesInfo + OverallFoot; + + if( !System.IO.Directory.Exists( pathname ) ) + { + System.IO.Directory.CreateDirectory( pathname ); + } + // Save file + string nodesPathname = pathname + ( fromCommunity ? "AvailableNodesFromCommunity.txt" : "AvailableNodes.txt" ); + Debug.Log( " Creating nodes file at " + nodesPathname ); + IOUtils.SaveTextfileToDisk( finalText, nodesPathname, false ); + BuildFullList( false ); + } + + public virtual bool CheckButton( GUIContent content, GUIStyle style, int buttonId ) + { + if( buttonId != m_validButtonId ) + { + GUILayout.Label( content, style ); + return false; + } + + return GUILayout.RepeatButton( content, style ); + } + + public void FillList( ref List list, bool forceAllItems ) + { + List allList = forceAllItems ? ParentWindow.ContextMenuInstance.ItemFunctions : ParentWindow.ContextMenuInstance.MenuItems; + + list.Clear(); + int count = allList.Count; + for( int i = 0; i < count; i++ ) + { + list.Add( allList[ i ] ); + } + } + + public Dictionary BuildFullList( bool forceAllNodes = false ) + { + //Only need to build if search filter is active and list is set according to it + if( m_searchFilter.Length > 0 || !m_isActive || m_currentCategories.Count == 0 ) + { + m_currentItems.Clear(); + m_currentCategories.Clear(); + + List allItems = forceAllNodes ? ParentWindow.ContextMenuInstance.ItemFunctions : ParentWindow.ContextMenuInstance.MenuItems; + + for( int i = 0; i < allItems.Count; i++ ) + { + if( allItems[ i ].Name.IndexOf( m_searchFilter, StringComparison.InvariantCultureIgnoreCase ) >= 0 || + allItems[ i ].Category.IndexOf( m_searchFilter, StringComparison.InvariantCultureIgnoreCase ) >= 0 + ) + { + m_currentItems.Add( allItems[ i ] ); + if( !m_currentCategories.ContainsKey( allItems[ i ].Category ) ) + { + m_currentCategories.Add( allItems[ i ].Category, new PaletteFilterData( m_defaultCategoryVisible ) ); + //m_currentCategories[ allItems[ i ].Category ].HasCommunityData = allItems[ i ].NodeAttributes.FromCommunity || m_currentCategories[ allItems[ i ].Category ].HasCommunityData; + } + m_currentCategories[ allItems[ i ].Category ].Contents.Add( allItems[ i ] ); + } + } + + var categoryEnumerator = m_currentCategories.GetEnumerator(); + while( categoryEnumerator.MoveNext() ) + { + categoryEnumerator.Current.Value.Contents.Sort( ( x, y ) => x.CompareTo( y, false ) ); + } + + //mark to force update and take search filter into account + m_forceUpdate = true; + } + return m_currentCategories; + } + + private bool IsItemVisible( float currPos ) + { + if( ( currPos < m_currentScrollPos.y && ( currPos + ItemSize ) < m_currentScrollPos.y ) || + ( currPos > ( m_currentScrollPos.y + m_currScrollBarDims.y ) && + ( currPos + ItemSize ) > ( m_currentScrollPos.y + m_currScrollBarDims.y ) ) ) + { + return false; + } + return true; + } + + public override void Destroy() + { + base.Destroy(); + + //m_allItems = null; + + m_currentItems.Clear(); + m_currentItems = null; + + m_currentCategories.Clear(); + m_currentCategories = null; + + OnPaletteNodeCreateEvt = null; + m_buttonStyle = null; + m_foldoutStyle = null; + } + + //public void Clear() { + // m_allItems.Clear(); + // m_allItems = new List(); + //} + + public bool ForceUpdate { get { return m_forceUpdate; } set { m_forceUpdate = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs.meta new file mode 100644 index 00000000..7ee4a6a5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: df4c2f840dca60a4cb118325ce2febfa +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs new file mode 100644 index 00000000..84cfbc4a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs @@ -0,0 +1,73 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public class PalettePopUp + { + private const int DeltaX = 5; + private Rect m_areaSettings; + private Vector2 m_mouseDeltaPos = new Vector2( 10, -10 ); + private bool m_isActive = false; + private GUIContent m_content; + private GUIStyle m_style; + private GUIStyle m_fontStyle; + private GUIContent m_labelContent; + + public PalettePopUp() + { + m_content = new GUIContent( GUIContent.none ); + m_areaSettings = new Rect( 0, 0, 100, 30 ); + m_labelContent = new GUIContent( "Test Label" ); + } + + public void Activate( string label ) + { + m_labelContent.text = label; + m_areaSettings.width = -1; + m_isActive = true; + } + + public void Deactivate() + { + m_isActive = false; + } + + public void Draw( Vector2 mousePos ) + { + if ( m_style == null ) + { + m_style = UIUtils.TextArea; + } + + if ( m_fontStyle == null ) + { + m_fontStyle = new GUIStyle( UIUtils.Label ); + m_fontStyle.fontSize = 15; + } + + if ( m_areaSettings.width < 0 ) + { + m_areaSettings.width = m_fontStyle.CalcSize( m_labelContent ).x + 2 * DeltaX; + } + + m_areaSettings.position = mousePos + m_mouseDeltaPos; + GUI.Label( m_areaSettings, m_content, m_style ); + m_areaSettings.position += new Vector2( DeltaX,DeltaX); + GUI.Label( m_areaSettings, m_labelContent, m_fontStyle ); + } + + public void Destroy() + { + m_content = null; + m_style = null; + } + + public bool IsActive + { + get { return m_isActive; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs.meta new file mode 100644 index 00000000..33e701ff --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: bc4f137f15efe1d42b7bcbf984ec1545 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs new file mode 100644 index 00000000..f0b6960f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs @@ -0,0 +1,33 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System.Collections.Generic; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public sealed class PaletteWindow : PaletteParent + { + public PaletteWindow( AmplifyShaderEditorWindow parentWindow ) : base( parentWindow, 0, 0, 250, 0, string.Empty, MenuAnchor.TOP_RIGHT, MenuAutoSize.MATCH_VERTICAL ) + { + m_searchFilterControl += "PALETTEWINDOW"; + m_initialSeparatorAmount = 4; + SetMinimizedArea( -225, 0, 260, 0 ); + } + + public override void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus ) + { + if ( m_isMaximized ) + { + base.Draw( parentPosition, mousePosition, mouseButtonId, hasKeyboadFocus ); + } + else + { + InitDraw( parentPosition, mousePosition, mouseButtonId ); + } + PostDraw(); + } + } +} + + diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs.meta new file mode 100644 index 00000000..ca615557 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 63408b264ef8cb346a5ce9e559a5ed22 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs new file mode 100644 index 00000000..9f76a512 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs @@ -0,0 +1,469 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEditor; +using UnityEngine; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + class NodeDescriptionInfo + { + public bool FoldoutValue; + public string Category; + public string[,] Contents; + } + + public sealed class PortLegendInfo : EditorWindow + { + private const string NoASEWindowWarning = "Please Open the ASE to get access to shortcut info"; + private const float PixelSeparator = 5; + private const string EditorShortcutsTitle = "Editor Shortcuts"; + private const string MenuShortcutsTitle = "Menu Shortcuts"; + private const string NodesShortcutsTitle = "Nodes Shortcuts"; + private const string PortShortcutsTitle = "Port Shortcuts"; + private const string PortLegendTitle = "Port Legend"; + private const string NodesDescTitle = "Node Info"; + private const string CompatibleAssetsTitle = "Compatible Assets"; + + private const string KeyboardUsageTemplate = "[{0}] - {1}"; + private const string m_lockedStr = "Locked Port"; + + private const float WindowSizeX = 350; + private const float WindowSizeY = 300; + private const float WindowPosX = 5; + private const float WindowPosY = 5; + + private int TitleLabelWidth = 150; + private Rect m_availableArea; + + private bool m_portAreaFoldout = true; + private bool m_editorShortcutAreaFoldout = true; + private bool m_menuShortcutAreaFoldout = true; + private bool m_nodesShortcutAreaFoldout = true; + private bool m_nodesDescriptionAreaFoldout = true; + private bool m_compatibleAssetsFoldout = true; + + private Vector2 m_currentScrollPos; + + private GUIStyle m_portStyle; + private GUIStyle m_labelStyleBold; + private GUIStyle m_labelStyle; + + private GUIStyle m_nodeInfoLabelStyleBold; + private GUIStyle m_nodeInfoLabelStyle; + + private GUIStyle m_nodeInfoFoldoutStyle; + + private GUIContent m_content = new GUIContent( "Helper", "Shows helper info for ASE users" ); + private bool m_init = true; + + private List m_editorShortcuts = null; + private List m_nodesShortcuts = null; + private List m_nodeDescriptionsInfo = null; + private List m_compatibleAssetsInfo = null; + + public static PortLegendInfo OpenWindow() + { + PortLegendInfo currentWindow = ( PortLegendInfo ) PortLegendInfo.GetWindow( typeof( PortLegendInfo ), false ); + currentWindow.minSize = new Vector2( WindowSizeX, WindowSizeY ); + currentWindow.maxSize = new Vector2( WindowSizeX * 2, 2 * WindowSizeY ); ; + currentWindow.wantsMouseMove = true; + return currentWindow; + } + + public void Init() + { + m_init = false; + wantsMouseMove = false; + titleContent = m_content; + m_portStyle = new GUIStyle( UIUtils.GetCustomStyle( CustomStyle.PortEmptyIcon ) ); + m_portStyle.alignment = TextAnchor.MiddleLeft; + m_portStyle.imagePosition = ImagePosition.ImageOnly; + m_portStyle.margin = new RectOffset( 5, 0, 5, 0 ); + + m_labelStyleBold = new GUIStyle( UIUtils.InputPortLabel ); + m_labelStyleBold.fontStyle = FontStyle.Bold; + m_labelStyleBold.fontSize = ( int ) ( Constants.TextFieldFontSize ); + + + m_labelStyle = new GUIStyle( UIUtils.InputPortLabel ); + m_labelStyle.clipping = TextClipping.Overflow; + m_labelStyle.imagePosition = ImagePosition.TextOnly; + m_labelStyle.contentOffset = new Vector2( -10, 0 ); + m_labelStyle.fontSize = ( int ) ( Constants.TextFieldFontSize ); + + m_nodeInfoLabelStyleBold = new GUIStyle( UIUtils.InputPortLabel ); + m_nodeInfoLabelStyleBold.fontStyle = FontStyle.Bold; + m_nodeInfoLabelStyleBold.fontSize = ( int ) ( Constants.TextFieldFontSize ); + + m_nodeInfoLabelStyle = new GUIStyle( UIUtils.InputPortLabel ); + m_nodeInfoLabelStyle.clipping = TextClipping.Clip; + m_nodeInfoLabelStyle.imagePosition = ImagePosition.TextOnly; + m_nodeInfoLabelStyle.fontSize = ( int ) ( Constants.TextFieldFontSize ); + + + m_nodeInfoFoldoutStyle = new GUIStyle( ( GUIStyle ) "foldout" ); + m_nodeInfoFoldoutStyle.fontStyle = FontStyle.Bold; + + if ( !EditorGUIUtility.isProSkin ) + { + m_labelStyleBold.normal.textColor = m_labelStyle.normal.textColor = Color.black; + m_nodeInfoLabelStyleBold.normal.textColor = m_labelStyle.normal.textColor = Color.black; + m_nodeInfoLabelStyle.normal.textColor = m_labelStyle.normal.textColor = Color.black; + } + + m_availableArea = new Rect( WindowPosX, WindowPosY, WindowSizeX - 2 * WindowPosX, WindowSizeY - 2 * WindowPosY ); + } + + void DrawPort( WirePortDataType type ) + { + EditorGUILayout.BeginHorizontal(); + { + GUI.color = UIUtils.GetColorForDataType( type, false ); + GUILayout.Box( string.Empty, m_portStyle, GUILayout.Width( UIUtils.PortsSize.x ), GUILayout.Height( UIUtils.PortsSize.y ) ); + GUI.color = Color.white; + EditorGUILayout.LabelField( UIUtils.GetNameForDataType( type ), m_labelStyle ); + } + EditorGUILayout.EndHorizontal(); + EditorGUILayout.Separator(); + } + + void OnGUI() + { + if ( !UIUtils.Initialized || UIUtils.CurrentWindow == null ) + { + EditorGUILayout.LabelField( NoASEWindowWarning ); + return; + } + + if ( m_init ) + { + Init(); + } + + TitleLabelWidth = (int)(this.position.width * 0.42f); + + KeyCode key = Event.current.keyCode; + if ( key == ShortcutsManager.ScrollUpKey ) + { + m_currentScrollPos.y -= 10; + if ( m_currentScrollPos.y < 0 ) + { + m_currentScrollPos.y = 0; + } + Event.current.Use(); + } + + if ( key == ShortcutsManager.ScrollDownKey ) + { + m_currentScrollPos.y += 10; + Event.current.Use(); + } + + if ( Event.current.type == EventType.MouseDrag && Event.current.button > 0 ) + { + m_currentScrollPos.x += Constants.MenuDragSpeed * Event.current.delta.x; + if ( m_currentScrollPos.x < 0 ) + { + m_currentScrollPos.x = 0; + } + + m_currentScrollPos.y += Constants.MenuDragSpeed * Event.current.delta.y; + if ( m_currentScrollPos.y < 0 ) + { + m_currentScrollPos.y = 0; + } + } + + m_availableArea = new Rect( WindowPosX, WindowPosY, position.width - 2 * WindowPosX, position.height - 2 * WindowPosY ); + GUILayout.BeginArea( m_availableArea ); + { + if ( GUILayout.Button( "Wiki Page" ) ) + { + Application.OpenURL( Constants.HelpURL ); + } + + m_currentScrollPos = GUILayout.BeginScrollView( m_currentScrollPos ); + { + EditorGUILayout.BeginVertical(); + { + NodeUtils.DrawPropertyGroup( ref m_portAreaFoldout, PortLegendTitle, DrawPortInfo ); + float currLabelWidth = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 1; + NodeUtils.DrawPropertyGroup( ref m_editorShortcutAreaFoldout, EditorShortcutsTitle, DrawEditorShortcuts ); + NodeUtils.DrawPropertyGroup( ref m_menuShortcutAreaFoldout, MenuShortcutsTitle, DrawMenuShortcuts ); + NodeUtils.DrawPropertyGroup( ref m_nodesShortcutAreaFoldout, NodesShortcutsTitle, DrawNodesShortcuts ); + NodeUtils.DrawPropertyGroup( ref m_compatibleAssetsFoldout, CompatibleAssetsTitle, DrawCompatibleAssets ); + NodeUtils.DrawPropertyGroup( ref m_nodesDescriptionAreaFoldout, NodesDescTitle, DrawNodeDescriptions ); + EditorGUIUtility.labelWidth = currLabelWidth; + } + EditorGUILayout.EndVertical(); + } + GUILayout.EndScrollView(); + } + GUILayout.EndArea(); + + } + + void DrawPortInfo() + { + Color originalColor = GUI.color; + + DrawPort( WirePortDataType.OBJECT ); + DrawPort( WirePortDataType.INT ); + DrawPort( WirePortDataType.FLOAT ); + DrawPort( WirePortDataType.FLOAT2 ); + DrawPort( WirePortDataType.FLOAT3 ); + DrawPort( WirePortDataType.FLOAT4 ); + DrawPort( WirePortDataType.COLOR ); + DrawPort( WirePortDataType.SAMPLER2D ); + DrawPort( WirePortDataType.FLOAT3x3 ); + DrawPort( WirePortDataType.FLOAT4x4 ); + + EditorGUILayout.BeginHorizontal(); + { + GUI.color = Constants.LockedPortColor; + GUILayout.Box( string.Empty, m_portStyle, GUILayout.Width( UIUtils.PortsSize.x ), GUILayout.Height( UIUtils.PortsSize.y ) ); + GUI.color = Color.white; + EditorGUILayout.LabelField( m_lockedStr, m_labelStyle ); + } + EditorGUILayout.EndHorizontal(); + + GUI.color = originalColor; + } + + public void DrawEditorShortcuts() + { + AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; + if ( window != null ) + { + if ( m_editorShortcuts == null ) + { + m_editorShortcuts = window.ShortcutManagerInstance.AvailableEditorShortcutsList; + } + + EditorGUI.indentLevel--; + int count = m_editorShortcuts.Count; + for ( int i = 0; i < count; i++ ) + { + DrawItem( m_editorShortcuts[ i ].Name, m_editorShortcuts[ i ].Description ); + } + DrawItem( "Q", "Alternative Pan modifier" ); + DrawItem( "Ctrl + F", "Find nodes" ); + DrawItem( "LMB Drag", "Box selection" ); + DrawItem( "MMB/RMB Drag", "Camera pan" ); + DrawItem( "Alt + MMB/RMB Drag", "Zoom graph" ); + DrawItem( "Shift/Ctrl + Node Select", "Add/Remove from selection" ); + DrawItem( "Shift + Node Drag", "Node move with offset" ); + DrawItem( "Ctrl + Node Drag", "Node move with snap" ); + DrawItem( "MMB/RMB + Drag Panel", "Scroll panel" ); + DrawItem( "Alt + LMB Drag", "Additive box selection" ); + DrawItem( "Alt + Shift + Drag", "Subtractive box selection" ); + DrawItem( "Alt + Node Drag", "Auto-(Dis)Connect node on existing wire connection" ); + EditorGUI.indentLevel++; + + } + else + { + EditorGUILayout.LabelField( NoASEWindowWarning ); + } + } + + public void DrawMenuShortcuts() + { + AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; + if ( window != null ) + { + EditorGUI.indentLevel--; + DrawItem( ShortcutsManager.ScrollUpKey.ToString(), "Scroll Up Menu" ); + DrawItem( ShortcutsManager.ScrollDownKey.ToString(), "Scroll Down Menu" ); + DrawItem( "RMB Drag", "Scroll Menu" ); + EditorGUI.indentLevel++; + } + else + { + EditorGUILayout.LabelField( NoASEWindowWarning ); + } + } + + void DrawItem( string name, string description ) + { + GUILayout.BeginHorizontal(); + GUILayout.Label( name, m_labelStyleBold , GUILayout.Width( TitleLabelWidth ) ); + GUILayout.Label( description, m_labelStyle ); + GUILayout.EndHorizontal(); + GUILayout.Space( PixelSeparator ); + } + + public void DrawNodesShortcuts() + { + AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; + if ( window != null ) + { + if ( m_nodesShortcuts == null || m_nodesShortcuts.Count == 0 ) + { + m_nodesShortcuts = window.ShortcutManagerInstance.AvailableNodesShortcutsList; + } + + EditorGUI.indentLevel--; + int count = m_nodesShortcuts.Count; + for ( int i = 0; i < count; i++ ) + { + DrawItem( m_nodesShortcuts[ i ].Name, m_nodesShortcuts[ i ].Description ); + } + EditorGUI.indentLevel++; + } + else + { + EditorGUILayout.LabelField( NoASEWindowWarning ); + } + } + string CreateCompatibilityString( string source ) + { + string[] split = source.Split( '.' ); + if ( split != null && split.Length > 1 ) + { + return split[ 1 ]; + } + else + { + return source; + } + } + public void DrawCompatibleAssets() + { + AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; + if ( window != null ) + { + if ( m_compatibleAssetsInfo == null ) + { + m_compatibleAssetsInfo = new List(); + List items = window.ContextMenuInstance.MenuItems; + int count = items.Count; + for ( int i = 0; i < count; i++ ) + { + if ( items[ i ].NodeAttributes != null && items[ i ].NodeAttributes.CastType != null ) + { + string types = string.Empty; + if ( items[ i ].NodeAttributes.CastType.Length > 1 ) + { + for ( int j = 0; j < items[ i ].NodeAttributes.CastType.Length; j++ ) + { + types += CreateCompatibilityString( items[ i ].NodeAttributes.CastType[ j ].ToString() ); + + + if ( j < items[ i ].NodeAttributes.CastType.Length - 1 ) + { + types += ", "; + } + } + } + else + { + types = CreateCompatibilityString( items[ i ].NodeAttributes.CastType[ 0 ].ToString() ); + } + m_compatibleAssetsInfo.Add( new string[] { items[ i ].NodeAttributes.Name + ": ", types } ); + } + } + } + EditorGUI.indentLevel--; + int nodeCount = m_compatibleAssetsInfo.Count; + for ( int j = 0; j < nodeCount; j++ ) + { + DrawItem( m_compatibleAssetsInfo[ j ][ 0 ], m_compatibleAssetsInfo[ j ][ 1 ] ); + } + EditorGUI.indentLevel++; + } + else + { + EditorGUILayout.LabelField( NoASEWindowWarning ); + } + } + + public void DrawNodeDescriptions() + { + AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; + if ( window != null ) + { + if ( m_nodeDescriptionsInfo == null ) + { + //fetch node info + m_nodeDescriptionsInfo = new List(); + Dictionary nodeData = window.CurrentPaletteWindow.BuildFullList(); + var enumerator = nodeData.GetEnumerator(); + while ( enumerator.MoveNext() ) + { + List nodes = enumerator.Current.Value.Contents; + int count = nodes.Count; + + NodeDescriptionInfo currInfo = new NodeDescriptionInfo(); + currInfo.Contents = new string[ count, 2 ]; + currInfo.Category = enumerator.Current.Key; + + for ( int i = 0; i < count; i++ ) + { + currInfo.Contents[ i, 0 ] = nodes[ i ].Name + ':'; + currInfo.Contents[ i, 1 ] = nodes[ i ].Description; + } + m_nodeDescriptionsInfo.Add( currInfo ); + } + } + + //draw + { + GUILayout.Space( 5 ); + int count = m_nodeDescriptionsInfo.Count; + EditorGUI.indentLevel--; + for ( int i = 0; i < count; i++ ) + { + m_nodeDescriptionsInfo[ i ].FoldoutValue = EditorGUILayout.Foldout( m_nodeDescriptionsInfo[ i ].FoldoutValue, m_nodeDescriptionsInfo[ i ].Category, m_nodeInfoFoldoutStyle ); + if ( m_nodeDescriptionsInfo[ i ].FoldoutValue ) + { + EditorGUI.indentLevel++; + int nodeCount = m_nodeDescriptionsInfo[ i ].Contents.GetLength( 0 ); + for ( int j = 0; j < nodeCount; j++ ) + { + GUILayout.Label( m_nodeDescriptionsInfo[ i ].Contents[ j, 0 ], m_nodeInfoLabelStyleBold ); + GUILayout.Label( m_nodeDescriptionsInfo[ i ].Contents[ j, 1 ], m_nodeInfoLabelStyle ); + GUILayout.Space( PixelSeparator ); + } + EditorGUI.indentLevel--; + } + GUILayout.Space( PixelSeparator ); + } + EditorGUI.indentLevel++; + } + } + else + { + EditorGUILayout.LabelField( NoASEWindowWarning ); + } + } + + private void OnDestroy() + { + m_nodesShortcuts = null; + m_editorShortcuts = null; + m_portStyle = null; + m_labelStyle = null; + m_labelStyleBold = null; + m_nodeInfoLabelStyle = null; + m_nodeInfoLabelStyleBold = null; + m_nodeInfoFoldoutStyle = null; + m_init = false; + + if ( m_nodeDescriptionsInfo != null ) + { + m_nodeDescriptionsInfo.Clear(); + m_nodeDescriptionsInfo = null; + } + + if( m_compatibleAssetsInfo != null ) + { + m_compatibleAssetsInfo.Clear(); + m_compatibleAssetsInfo = null; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs.meta new file mode 100644 index 00000000..4701f9eb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 20dad8f4196f0e643a9c56d1202e74dc +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs new file mode 100644 index 00000000..8265273d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs @@ -0,0 +1,40 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + // Catch when scene is saved (Ctr+S) and also save ase shader + public class SceneSaveCallback : UnityEditor.AssetModificationProcessor + { + private const string UnityStr = ".unity"; + + static string[] OnWillSaveAssets( string[] paths ) + { + if( !Preferences.User.UpdateOnSceneSave ) + return paths; + + bool canSave = false; + + if ( paths.Length == 0 ) + { + canSave = true; + } + else + { + for ( int i = 0; i < paths.Length; i++ ) + { + // Only save shader when saving scenes + if ( !string.IsNullOrEmpty( paths[ i ] ) && paths[ i ].Contains( UnityStr ) ) + { + canSave = true; + break; + } + } + } + if ( canSave && UIUtils.CurrentWindow ) + UIUtils.CurrentWindow.SetCtrlSCallback( false ); + + return paths; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs.meta new file mode 100644 index 00000000..5323f622 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 708e90c98affcb04aa2fcfedf4329a7c +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs new file mode 100644 index 00000000..6a987d42 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs @@ -0,0 +1,192 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public sealed class ShaderEditorModeWindow : MenuParent + { + private static readonly Color OverallColorOn = new Color( 1f, 1f, 1f, 0.9f ); + private static readonly Color OverallColorOff = new Color( 1f, 1f, 1f, 0.3f ); + private static readonly Color FontColorOff = new Color( 1f, 1f, 1f, 0.4f ); + private const float DeltaY = 15; + private const float DeltaX = 10; + + private const float CollSizeX = 180; + private const float CollSizeY = 70; + + //private static string MatFormat = "MATERIAL\n{0}"; + //private static string ShaderFormat = "SHADER\n{0}"; + //private const string CurrMatStr = "MATERIAL"; + //private const string CurrShaderStr = "SHADER"; + + private const string NoMaterialStr = "No Material"; + private const string NoShaderStr = "No Shader"; + + private bool m_init = true; + private string m_previousShaderName = string.Empty; + private string m_previousMaterialName = string.Empty; + private string m_previousShaderFunctionName = string.Empty; + + private Vector2 m_auxVector2; + private GUIContent m_leftAuxContent = new GUIContent(); + private GUIContent m_rightAuxContent = new GUIContent(); + private GUIStyle m_leftButtonStyle = null; + private GUIStyle m_rightButtonStyle = null; + private Rect m_leftButtonRect; + private Rect m_rightButtonRect; + + public ShaderEditorModeWindow( AmplifyShaderEditorWindow parentWindow ) : base( parentWindow, 0, 0, 0, 0, "ShaderEditorModeWindow", MenuAnchor.BOTTOM_CENTER, MenuAutoSize.NONE ) { } + + public void ConfigStyle( GUIStyle style ) + { + style.normal.textColor = FontColorOff; + style.hover.textColor = FontColorOff; + style.active.textColor = FontColorOff; + style.focused.textColor = FontColorOff; + + style.onNormal.textColor = FontColorOff; + style.onHover.textColor = FontColorOff; + style.onActive.textColor = FontColorOff; + style.onFocused.textColor = FontColorOff; + } + + + public void Draw( Rect graphArea, Vector2 mousePos, Shader currentShader, Material currentMaterial, float usableArea, float leftPos, float rightPos /*, bool showLastSelection*/ ) + { + EventType currentEventType = Event.current.type; + + if( !( currentEventType == EventType.Repaint || currentEventType == EventType.MouseDown || currentEventType == EventType.MouseMove ) ) + return; + + if ( m_init ) + { + m_init = false; + GUIStyle shaderModeTitle = UIUtils.GetCustomStyle( CustomStyle.ShaderModeTitle ); + GUIStyle shaderModeNoShader = UIUtils.GetCustomStyle( CustomStyle.ShaderModeNoShader ); + GUIStyle materialModeTitle = UIUtils.GetCustomStyle( CustomStyle.MaterialModeTitle ); + GUIStyle shaderNoMaterialModeTitle = UIUtils.GetCustomStyle( CustomStyle.ShaderNoMaterialModeTitle ); + + ConfigStyle( shaderModeTitle ); + ConfigStyle( shaderModeNoShader ); + ConfigStyle( materialModeTitle ); + ConfigStyle( shaderNoMaterialModeTitle ); + } + Color buffereredColor = GUI.color; + + MasterNode currentMasterNode = ParentWindow.CurrentGraph.CurrentMasterNode; + // Shader Mode + if ( currentMasterNode != null ) + { + m_leftButtonStyle = UIUtils.GetCustomStyle( currentShader == null ? CustomStyle.ShaderModeNoShader : CustomStyle.ShaderModeTitle ); + m_leftButtonRect = graphArea; + m_leftButtonRect.x = 10 + leftPos; + m_leftButtonRect.y += m_leftButtonRect.height - 38 - 15; + string shaderName = ( currentShader != null ) ? ( currentShader.name ) : NoShaderStr; + + if ( m_previousShaderName != shaderName ) + { + m_previousShaderName = shaderName; + m_leftAuxContent.text = "SHADER\n" + shaderName; + } + + m_auxVector2 = m_leftButtonStyle.CalcSize( m_leftAuxContent ); + m_leftButtonRect.width = m_auxVector2.x + 30 + 4; + m_leftButtonRect.height = 38; + + bool mouseOnTop = m_leftButtonRect.Contains( mousePos ); + GUI.color = mouseOnTop ? OverallColorOn : OverallColorOff; + GUI.Label( m_leftButtonRect, m_leftAuxContent, m_leftButtonStyle ); + + if( currentEventType == EventType.MouseMove && mouseOnTop ) + m_parentWindow.MarkToRepaint(); + + if ( currentEventType == EventType.MouseDown && mouseOnTop && currentShader != null ) + { + Event.current.Use(); + Selection.activeObject = currentShader; + EditorGUIUtility.PingObject( Selection.activeObject ); + } + + // Material Mode + if ( currentMaterial != null ) + { + m_rightButtonStyle = UIUtils.GetCustomStyle( CustomStyle.MaterialModeTitle ); + m_rightButtonRect = graphArea; + string matName = ( currentMaterial != null ) ? ( currentMaterial.name ) : NoMaterialStr; + + if ( m_previousMaterialName != matName ) + { + m_previousMaterialName = matName; + m_rightAuxContent.text = "MATERIAL\n" + matName; + } + + m_auxVector2 = m_rightButtonStyle.CalcSize( m_rightAuxContent ); + m_rightButtonRect.width = m_auxVector2.x + 30 + 4; + m_rightButtonRect.height = 38; + + m_rightButtonRect.x = graphArea.xMax - m_rightButtonRect.width - rightPos - 10; + m_rightButtonRect.y = graphArea.yMax - 38 - 15; + + bool mouseOnTopRight = m_rightButtonRect.Contains( mousePos ); + GUI.color = mouseOnTopRight ? OverallColorOn : OverallColorOff; + GUI.Label( m_rightButtonRect, m_rightAuxContent, m_rightButtonStyle ); + + if( currentEventType == EventType.MouseMove && mouseOnTopRight ) + m_parentWindow.MarkToRepaint(); + + if ( currentEventType == EventType.MouseDown && mouseOnTopRight ) + { + Event.current.Use(); + Selection.activeObject = currentMaterial; + EditorGUIUtility.PingObject( Selection.activeObject ); + } + } + } + + // Shader Function + else if ( currentMasterNode == null && ParentWindow.CurrentGraph.CurrentOutputNode != null ) + { + m_leftButtonStyle = UIUtils.GetCustomStyle( CustomStyle.ShaderFunctionMode ); + m_leftButtonRect = graphArea; + m_leftButtonRect.x = 10 + leftPos; + m_leftButtonRect.y += m_leftButtonRect.height - 38 - 15; + string functionName = ( ParentWindow.CurrentGraph.CurrentShaderFunction != null ) ? ( ParentWindow.CurrentGraph.CurrentShaderFunction.name ) : "No Shader Function"; + + if ( m_previousShaderFunctionName != functionName ) + { + m_previousShaderFunctionName = functionName; + m_leftAuxContent.text = "SHADER FUNCTION\n" + functionName; + } + + m_auxVector2 = m_leftButtonStyle.CalcSize( m_leftAuxContent ); + m_leftButtonRect.width = m_auxVector2.x + 30 + 4; + m_leftButtonRect.height = 38; + + bool mouseOnTop = m_leftButtonRect.Contains( mousePos ); + GUI.color = mouseOnTop ? OverallColorOn : OverallColorOff; + GUI.Label( m_leftButtonRect, m_leftAuxContent, m_leftButtonStyle ); + + if ( currentEventType == EventType.MouseDown && mouseOnTop && ParentWindow.CurrentGraph.CurrentShaderFunction != null ) + { + Event.current.Use(); + Selection.activeObject = ParentWindow.CurrentGraph.CurrentShaderFunction; + EditorGUIUtility.PingObject( Selection.activeObject ); + } + } + + GUI.color = buffereredColor; + } + + public override void Destroy() + { + base.Destroy(); + m_leftAuxContent = null; + m_rightAuxContent = null; + m_leftButtonStyle = null; + m_rightButtonStyle = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs.meta new file mode 100644 index 00000000..0ba4ede8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 672d96e3a4f68d44f9456d2fc53d4d73 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs new file mode 100644 index 00000000..e405e2e2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs @@ -0,0 +1,91 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEditor; +using System.Collections.Generic; +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class ShaderLibrary : EditorWindow + { + private const string SHADER_LIB_FILE = "/AmplifyShaderEditor/Resources/ShaderLibrary/ShaderLibrary.txt"; + private bool m_init = false; + private Vector2 m_scrollPos = new Vector2(); + [SerializeField] + private List m_shaders = new List(); + void Init() + { + m_init = true; + string list = IOUtils.LoadTextFileFromDisk( Application.dataPath + SHADER_LIB_FILE ); + if ( String.IsNullOrEmpty( list ) ) + return; + + string[] listArr = list.Split( IOUtils.FIELD_SEPARATOR ); + for ( int i = 0; i < listArr.Length; i++ ) + { + m_shaders.Add( listArr[ i ] ); + } + + UIUtils.MainSkin.customStyles[ 10 ].active.background = Texture2D.whiteTexture; + + UIUtils.MainSkin.customStyles[ 6 ].fixedHeight = UIUtils.MainSkin.customStyles[ 6 ].normal.background.height; + UIUtils.MainSkin.customStyles[ 6 ].fixedWidth = UIUtils.MainSkin.customStyles[ 6 ].normal.background.width; + + UIUtils.MainSkin.customStyles[ 7 ].fixedHeight = UIUtils.MainSkin.customStyles[ 7 ].normal.background.height; + UIUtils.MainSkin.customStyles[ 7 ].fixedWidth = UIUtils.MainSkin.customStyles[ 7 ].normal.background.width; + + UIUtils.MainSkin.customStyles[ 8 ].fixedHeight = UIUtils.MainSkin.customStyles[ 8 ].normal.background.height; + UIUtils.MainSkin.customStyles[ 8 ].fixedWidth = UIUtils.MainSkin.customStyles[ 8 ].normal.background.width; + + UIUtils.MainSkin.customStyles[ 9 ].fixedHeight = UIUtils.MainSkin.customStyles[ 9 ].normal.background.height; + UIUtils.MainSkin.customStyles[ 9 ].fixedWidth = UIUtils.MainSkin.customStyles[ 9 ].normal.background.width; + + } + + void OnGUI() + { + if ( !m_init ) + { + Init(); + } + + Rect availableArea = position; + + availableArea.y = 100f; + availableArea.x = 0.05f * availableArea.width; + availableArea.height *= 0.5f; + availableArea.width *= 0.9f; + EditorGUILayout.BeginVertical(); + { + EditorGUILayout.LabelField( "Shader Library", UIUtils.MainSkin.customStyles[ 5 ] ); + GUILayout.Space( 10 ); + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Space( 0.05f * position.width ); + GUILayout.Button( string.Empty, UIUtils.MainSkin.customStyles[ 8 ] ); + GUILayout.Button( string.Empty, UIUtils.MainSkin.customStyles[ 9 ] ); + GUILayout.Space( 0.8f*position.width ); + GUILayout.Button( string.Empty, UIUtils.MainSkin.customStyles[ 7 ] ); + GUILayout.Button( string.Empty, UIUtils.MainSkin.customStyles[ 6 ] ); + } + EditorGUILayout.EndHorizontal(); + + GUILayout.BeginArea( availableArea ); + m_scrollPos = EditorGUILayout.BeginScrollView( m_scrollPos, UIUtils.MainSkin.box ); + { + for ( int i = 0; i < m_shaders.Count; i++ ) + { + GUILayout.Button( m_shaders[ i ], UIUtils.MainSkin.customStyles[ 10 ] ); + } + } + EditorGUILayout.EndScrollView(); + GUILayout.EndArea(); + } + EditorGUILayout.EndVertical(); + + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs.meta new file mode 100644 index 00000000..a8402a29 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: cbdd03f297692584391b9dc0625a80ed +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools.meta new file mode 100644 index 00000000..4f191887 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3857a2f02c659104fa6f0fe94cfe00dd +folderAsset: yes +timeCreated: 1481126945 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs new file mode 100644 index 00000000..a1994638 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs @@ -0,0 +1,249 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + public sealed class ToolsMenuButton : ToolsMenuButtonParent + { + public delegate void ToolButtonPressed( ToolButtonType type ); + public event ToolButtonPressed ToolButtonPressedEvt; + + private Rect m_buttonArea; + private List m_buttonTexture; + private string m_buttonTexturePath; + private ToolButtonType m_buttonType; + private GUIStyle m_style; + private bool m_enabled = true; + private bool m_drawOnFunction = true; + + private List m_cachedStates; + private int m_bufferedState = -1; + private string m_bufferedTooltip = string.Empty; + + public ToolsMenuButton( AmplifyShaderEditorWindow parentWindow, ToolButtonType type, float x, float y, float width, float height, string texturePath, string text, string tooltip, float buttonSpacing = -1, bool drawOnFunction = true ) : base( parentWindow, text, tooltip, buttonSpacing ) + { + m_buttonArea = new Rect( x, y, width, height ); + m_buttonType = type; + + m_buttonTexturePath = texturePath; + m_cachedStates = new List(); + m_drawOnFunction = drawOnFunction; + } + + public void AddState( string state ) + { + m_cachedStates.Add( state ); + } + + public override void Destroy() + { + ToolButtonPressedEvt = null; + if ( m_buttonTexture != null ) + { + for ( int i = 0; i < m_buttonTexture.Count; i++ ) + { + Resources.UnloadAsset( m_buttonTexture[ i ] ); + } + m_buttonTexture.Clear(); + } + m_buttonTexture = null; + } + protected override void Init() + { + base.Init(); + if ( m_buttonTexture == null ) + { + m_buttonTexturePath = AssetDatabase.GUIDToAssetPath( m_buttonTexturePath ); + m_buttonTexture = new List(); + m_buttonTexture.Add( AssetDatabase.LoadAssetAtPath( m_buttonTexturePath, typeof( Texture2D ) ) as Texture2D ); + } + + if ( m_cachedStates.Count > 0 ) + { + for ( int i = 0; i < m_cachedStates.Count; i++ ) + { + m_cachedStates[ i ] = AssetDatabase.GUIDToAssetPath( m_cachedStates[ i ] ); + m_buttonTexture.Add( AssetDatabase.LoadAssetAtPath( m_cachedStates[ i ], typeof( Texture2D ) ) as Texture2D ); + } + m_cachedStates.Clear(); + } + + if ( m_style == null ) + { + m_style = new GUIStyle( /*UIUtils.Button*/ GUIStyle.none ); + m_style.normal.background = m_buttonTexture[ 0 ]; + + m_style.hover.background = m_buttonTexture[ 0 ]; + m_style.hover.textColor = m_style.normal.textColor; + + m_style.active.background = m_buttonTexture[ 0 ]; + m_style.active.textColor = m_style.normal.textColor; + + m_style.onNormal.background = m_buttonTexture[ 0 ]; + m_style.onNormal.textColor = m_style.normal.textColor; + + m_style.onHover.background = m_buttonTexture[ 0 ]; + m_style.onHover.textColor = m_style.normal.textColor; + + m_style.onActive.background = m_buttonTexture[ 0 ]; + m_style.onActive.textColor = m_style.normal.textColor; + + m_style.clipping = TextClipping.Overflow; + m_style.fontStyle = FontStyle.Bold; + m_style.alignment = TextAnchor.LowerCenter; + m_style.contentOffset = new Vector2( 0, 15 ); + m_style.fontSize = 10; + bool resizeFromTexture = false; + if ( m_buttonArea.width > 0 ) + { + m_style.fixedWidth = m_buttonArea.width; + } + else + { + resizeFromTexture = true; + } + + if ( m_buttonArea.height > 0 ) + { + m_style.fixedHeight = m_buttonArea.height; + } + else + { + resizeFromTexture = true; + } + + if ( resizeFromTexture ) + { + m_buttonArea.width = m_style.fixedWidth = m_buttonTexture[ 0 ].width; + m_buttonArea.height = m_style.fixedHeight = m_buttonTexture[ 0 ].height; + } + } + + } + public override void Draw() + { + base.Draw(); + bool guiEnabledBuffer = GUI.enabled; + GUI.enabled = m_enabled; + + if ( GUILayout.Button( m_content, m_style ) && ToolButtonPressedEvt != null ) + { + ToolButtonPressedEvt( m_buttonType ); + } + GUI.enabled = guiEnabledBuffer; + } + + public override void Draw( float x, float y ) + { + if ( !(m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.MouseDown || m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.Repaint ) ) + return; + + if ( m_parentWindow.CurrentGraph.CurrentMasterNode == null && !m_drawOnFunction) + return; + + + base.Draw( x, y ); + + if ( m_bufferedState > -1 ) + { + if ( string.IsNullOrEmpty( m_bufferedTooltip ) ) + { + SetStateOnButton( m_bufferedState ); + } + else + { + SetStateOnButton( m_bufferedState, m_bufferedTooltip ); + } + + m_bufferedState = -1; + m_bufferedTooltip = string.Empty; + } + + + m_buttonArea.x = x; + m_buttonArea.y = y; + + if ( m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.MouseDown && m_buttonArea.Contains( m_parentWindow.CameraDrawInfo.MousePosition ) && ToolButtonPressedEvt != null ) + { + ToolButtonPressedEvt( m_buttonType ); + Event.current.Use(); + m_parentWindow.CameraDrawInfo.CurrentEventType = EventType.Used; + } + else if ( m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.Repaint ) + { + GUI.Label( m_buttonArea, m_content, m_style ); + } + + //if ( GUI.Button( m_buttonArea, m_content, m_style ) && ToolButtonPressedEvt != null ) + //{ + // ToolButtonPressedEvt( m_buttonType ); + //} + } + + public override void Draw( Vector2 pos ) + { + Draw( pos.x, pos.y ); + } + + public override void SetStateOnButton( int state, string tooltip ) + { + + if ( m_buttonTexture == null || m_style == null ) + { + m_bufferedState = state; + m_bufferedTooltip = tooltip; + return; + } + + + if ( state < 0 || state >= m_buttonTexture.Count ) + { + return; + } + + base.SetStateOnButton( state, tooltip ); + m_style.normal.background = m_buttonTexture[ state ]; + m_style.hover.background = m_buttonTexture[ state ]; + m_style.active.background = m_buttonTexture[ state ]; + m_style.onNormal.background = m_buttonTexture[ state ]; + m_style.onHover.background = m_buttonTexture[ state ]; + m_style.onActive.background = m_buttonTexture[ state ]; + } + + public override void SetStateOnButton( int state ) + { + if ( m_buttonTexture == null || m_style == null ) + { + m_bufferedState = state; + return; + } + + if ( state < 0 || state >= m_buttonTexture.Count ) + { + return; + } + base.SetStateOnButton( state ); + m_style.normal.background = m_buttonTexture[ state ]; + m_style.hover.background = m_buttonTexture[ state ]; + m_style.active.background = m_buttonTexture[ state ]; + m_style.onNormal.background = m_buttonTexture[ state ]; + m_style.onHover.background = m_buttonTexture[ state ]; + m_style.onActive.background = m_buttonTexture[ state ]; + } + + public bool IsInside( Vector2 pos ) + { + return m_buttonArea.Contains( pos ); + } + + public bool Enabled + { + get { return m_enabled; } + set { m_enabled = value; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs.meta new file mode 100644 index 00000000..ca522007 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 890f4ed5c9f62af43bda6584705fa0be +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs new file mode 100644 index 00000000..b3136b4c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs @@ -0,0 +1,75 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public class ToolsMenuButtonParent + { + protected AmplifyShaderEditorWindow m_parentWindow = null; + private float m_buttonSpacing = 10; + private int m_currentState = 0; + private bool m_isInitialized = false; + protected GUIContent m_content; + public ToolsMenuButtonParent( AmplifyShaderEditorWindow parentWindow, string text, string tooltip, float buttonSpacing ) + { + m_parentWindow = parentWindow; + m_content = new GUIContent( text, tooltip ); + + if ( buttonSpacing > 0 ) + m_buttonSpacing = buttonSpacing; + } + + public virtual void Draw() + { + if ( !m_isInitialized ) + { + Init(); + } + + //GUILayout.Space( m_buttonSpacing ); + } + + public virtual void Draw( Vector2 pos ) + { + Draw( pos.x, pos.y ); + } + + public virtual void Draw( float x ,float y ) + { + if ( !m_isInitialized ) + { + Init(); + } + } + + protected virtual void Init() + { + m_isInitialized = false; + } + + public virtual void SetStateOnButton( int state, string tooltip ) + { + m_currentState = state; + m_content.tooltip = tooltip; + } + + public virtual void SetStateOnButton( int state ) + { + m_currentState = state; + } + + public virtual void Destroy() { } + + public float ButtonSpacing + { + get { return m_buttonSpacing; } + } + + public int CurrentState + { + get { return m_currentState; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs.meta new file mode 100644 index 00000000..7c5687e4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a3bf3644c2c2fbb4fa0dd8b86effc6e1 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs new file mode 100644 index 00000000..69d11eb1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs @@ -0,0 +1,41 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public sealed class ToolsMenuButtonSep : ToolsMenuButtonParent + { + private Color m_splitterColor = EditorGUIUtility.isProSkin ? new Color( 0.157f, 0.157f, 0.157f ) : new Color( 0.5f, 0.5f, 0.5f ); + [SerializeField] + private GUIStyle m_sepStyle; + public ToolsMenuButtonSep( AmplifyShaderEditorWindow parentWindow = null, string text = null, string tooltip = null, float buttonSpacing = -1 ) : base( parentWindow, text, tooltip, buttonSpacing ) { } + + public override void Draw() + { + base.Draw(); + if ( m_sepStyle == null ) + { + m_sepStyle = new GUIStyle(); + m_sepStyle.normal.background = Texture2D.whiteTexture; + m_sepStyle.hover.background = Texture2D.whiteTexture; + m_sepStyle.active.background = Texture2D.whiteTexture; + m_sepStyle.onNormal.background = Texture2D.whiteTexture; + m_sepStyle.onHover.background = Texture2D.whiteTexture; + m_sepStyle.onActive.background = Texture2D.whiteTexture; + m_sepStyle.stretchHeight = true; + } + Color originalColor = GUI.color; + GUI.color = m_splitterColor; + GUILayout.Box( string.Empty, m_sepStyle, GUILayout.MaxWidth( 2 ), GUILayout.ExpandHeight( true ) ); + GUI.color = originalColor; + } + + public override void Destroy() + { + m_sepStyle = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs.meta new file mode 100644 index 00000000..369f06fa --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b4c65a9d96791c34eb587cea9662161f +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs new file mode 100644 index 00000000..ccb0f4b0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs @@ -0,0 +1,632 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + public enum ToolButtonType + { + Update = 0, + Live, + OpenSourceCode, + CleanUnusedNodes, + //SelectShader, + New, + Open, + Save, + Library, + Options, + Help, + MasterNode, + FocusOnMasterNode, + FocusOnSelection, + ShowInfoWindow, + ShowTipsWindow, + ShowConsole, + TakeScreenshot, + Share + } + + public enum ToolbarType + { + File, + Help + } + + public class ToolbarMenuTab + { + private Rect m_tabArea; + private GenericMenu m_tabMenu; + public ToolbarMenuTab( float x, float y, float width, float height ) + { + m_tabMenu = new GenericMenu(); + m_tabArea = new Rect( x, y, width, height ); + } + + public void ShowMenu() + { + m_tabMenu.DropDown( m_tabArea ); + } + + public void AddItem( string itemName, GenericMenu.MenuFunction callback ) + { + m_tabMenu.AddItem( new GUIContent( itemName ), false, callback ); + } + } + + [Serializable] + public sealed class ToolsWindow : MenuParent + { + private static readonly Color RightIconsColorOff = new Color( 1f, 1f, 1f, 0.8f ); + private static readonly Color LeftIconsColorOff = new Color( 1f, 1f, 1f, 0.5f ); + + private static readonly Color RightIconsColorOn = new Color( 1f, 1f, 1f, 1.0f ); + private static readonly Color LeftIconsColorOn = new Color( 1f, 1f, 1f, 0.8f ); + + private const float TabY = 9; + private const float TabX = 5; + private const string ShaderFileTitleStr = "Current Shader"; + private const string FileToolbarStr = "File"; + private const string HelpToolbarStr = "Help"; + private const string LiveShaderStr = "Live Shader"; + private const string LoadOnSelectionStr = "Load on selection"; + private const string CurrentObjectStr = "Current Object: "; + + + public ToolsMenuButton.ToolButtonPressed ToolButtonPressedEvt; + //private GUIStyle m_toolbarButtonStyle; + private GUIStyle m_toggleStyle; + private GUIStyle m_borderStyle; + + // left + private ToolsMenuButton m_updateButton; + private ToolsMenuButton m_liveButton; + private ToolsMenuButton m_openSourceCodeButton; + + //middle right + private ToolsMenuButton m_cleanUnusedNodesButton; + private ToolsMenuButton m_focusOnMasterNodeButton; + private ToolsMenuButton m_focusOnSelectionButton; + + // right + private ToolsMenuButton m_shareButton; + private ToolsMenuButton m_takeScreenshotButton; + private ToolsMenuButton m_showInfoWindowButton; + + // hidden + private ToolsMenuButton m_showTipsWindowButton; + private ToolsMenuButton m_showConsoleWindowButton; + + //Used for collision detection to invalidate inputs on graph area + private Rect m_areaLeft = new Rect( 0, 0, 140, 40 ); + private Rect m_areaRight = new Rect( 0, 0, 75, 40 ); + private Rect m_boxRect; + private Rect m_borderRect; + + public const double InactivityRefreshTime = 0.25; + private int m_currentSelected = 0; + + //Search Bar + private const string SearchBarId = "ASE_SEARCH_BAR"; + private bool m_searchBarVisible = false; + private bool m_selectSearchBarTextfield = false; + private bool m_refreshSearchResultList = false; + + private Rect m_searchBarSize; + private string m_searchBarValue = string.Empty; + private List m_searchResultNodes = new List(); + + // width and height are between [0,1] and represent a percentage of the total screen area + public ToolsWindow( AmplifyShaderEditorWindow parentWindow ) : base( parentWindow, 0, 0, 0, 64, "Tools", MenuAnchor.TOP_LEFT, MenuAutoSize.NONE ) + { + m_updateButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.Update, 0, 0, -1, -1, IOUtils.UpdateOutdatedGUID, string.Empty, "Create and apply shader to material.", 5 ); + m_updateButton.ToolButtonPressedEvt += OnButtonPressedEvent; + m_updateButton.AddState( IOUtils.UpdateOFFGUID ); + m_updateButton.AddState( IOUtils.UpdateUpToDatedGUID ); + + m_liveButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.Live, 0, 0, -1, -1, IOUtils.LiveOffGUID, string.Empty, "Automatically saves shader when canvas is changed.", 50 ); + m_liveButton.ToolButtonPressedEvt += OnButtonPressedEvent; + m_liveButton.AddState( IOUtils.LiveOnGUID ); + m_liveButton.AddState( IOUtils.LivePendingGUID ); + + //ToolsMenuButton cleanUnusedNodesButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.CleanUnusedNodes, 0, 0, -1, -1, IOUtils.CleanupOFFGUID, string.Empty, "Remove all nodes not connected to the master node.", 77 ); + //cleanUnusedNodesButton.ToolButtonPressedEvt += OnButtonPressedEvent; + //cleanUnusedNodesButton.AddState( IOUtils.CleanUpOnGUID ); + //m_list[ ( int ) ToolButtonType.CleanUnusedNodes ] = cleanUnusedNodesButton; + + m_openSourceCodeButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.OpenSourceCode, 0, 0, -1, -1, IOUtils.OpenSourceCodeOFFGUID, string.Empty, "Open shader file in your default shader editor.", 80, false ); + m_openSourceCodeButton.ToolButtonPressedEvt += OnButtonPressedEvent; + m_openSourceCodeButton.AddState( IOUtils.OpenSourceCodeONGUID ); + + + // middle right + m_cleanUnusedNodesButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.CleanUnusedNodes, 0, 0, -1, -1, IOUtils.CleanupOFFGUID, string.Empty, "Remove all nodes not connected to the master node.", 77 ); + m_cleanUnusedNodesButton.ToolButtonPressedEvt += OnButtonPressedEvent; + m_cleanUnusedNodesButton.AddState( IOUtils.CleanUpOnGUID ); + + m_focusOnMasterNodeButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.FocusOnMasterNode, 0, 0, -1, -1, IOUtils.FocusNodeGUID, string.Empty, "Focus on active master node.", -1, false ); + m_focusOnMasterNodeButton.ToolButtonPressedEvt += OnButtonPressedEvent; + + m_focusOnSelectionButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.FocusOnSelection, 0, 0, -1, -1, IOUtils.FitViewGUID, string.Empty, "Focus on selection or fit to screen if none selected." ); + m_focusOnSelectionButton.ToolButtonPressedEvt += OnButtonPressedEvent; + + + // right + m_shareButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.Share, 0, 0, -1, -1, IOUtils.ShareOFFGUID, string.Empty, "Share selection", 100 ); + m_shareButton.ToolButtonPressedEvt += OnButtonPressedEvent; + m_shareButton.AddState( IOUtils.ShareONGUID ); + + m_takeScreenshotButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.TakeScreenshot, 0, 0, -1, -1, IOUtils.TakeScreenshotOFFGUID, string.Empty, "Take ScreenShot (WINDOWS ONLY).", 100 ); + m_takeScreenshotButton.ToolButtonPressedEvt += OnButtonPressedEvent; + m_takeScreenshotButton.AddState( IOUtils.TakeScreenshotONGUID ); + + m_showInfoWindowButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.ShowInfoWindow, 0, 0, -1, -1, IOUtils.ShowInfoWindowGUID, string.Empty, "Open Helper Window." ); + m_showInfoWindowButton.ToolButtonPressedEvt += OnButtonPressedEvent; + + + // hidden + m_showTipsWindowButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.ShowTipsWindow, 0, 0, -1, -1, IOUtils.ShowTipsWindowGUID, string.Empty, "Open Quick Tips!" ); + m_showTipsWindowButton.ToolButtonPressedEvt += OnButtonPressedEvent; + + m_showConsoleWindowButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.ShowConsole, 0, 0, -1, -1, IOUtils.ShowConsoleWindowGUID, string.Empty, "Show internal console", 74 ); + m_showConsoleWindowButton.ToolButtonPressedEvt += OnButtonPressedEvent; + m_showConsoleWindowButton.AddState( IOUtils.ShowConsoleWindowGUID ); + + m_searchBarSize = new Rect( 0, TabY + 4, 110, 60 ); + } + + void OnShowPortLegend() + { + ParentWindow.ShowPortInfo(); + } + + override public void Destroy() + { + base.Destroy(); + //for ( int i = 0; i < m_list.Length; i++ ) + //{ + // m_list[ i ].Destroy(); + //} + //m_list = null; + + m_searchResultNodes.Clear(); + m_searchResultNodes = null; + + m_updateButton.Destroy(); + m_updateButton = null; + + m_liveButton.Destroy(); + m_liveButton = null; + + m_openSourceCodeButton.Destroy(); + m_openSourceCodeButton = null; + + m_focusOnMasterNodeButton.Destroy(); + m_focusOnMasterNodeButton = null; + + m_focusOnSelectionButton.Destroy(); + m_focusOnSelectionButton = null; + + m_showInfoWindowButton.Destroy(); + m_showInfoWindowButton = null; + + m_takeScreenshotButton.Destroy(); + m_takeScreenshotButton = null; + + m_shareButton.Destroy(); + m_shareButton = null; + + m_showTipsWindowButton.Destroy(); + m_showTipsWindowButton = null; + + m_cleanUnusedNodesButton.Destroy(); + m_cleanUnusedNodesButton = null; + + m_showConsoleWindowButton.Destroy(); + m_showConsoleWindowButton = null; + } + + void OnButtonPressedEvent( ToolButtonType type ) + { + if ( ToolButtonPressedEvt != null ) + ToolButtonPressedEvt( type ); + } + + public override void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus ) + { + base.Draw( parentPosition, mousePosition, mouseButtonId, hasKeyboadFocus ); + + Color bufferedColor = GUI.color; + m_areaLeft.x = m_transformedArea.x + TabX; + m_areaRight.x = m_transformedArea.x + m_transformedArea.width - 75 - TabX; + + //if ( m_toolbarButtonStyle == null ) + //{ + // m_toolbarButtonStyle = new GUIStyle( UIUtils.Button ); + // m_toolbarButtonStyle.fixedWidth = 100; + //} + + if ( m_toggleStyle == null ) + { + m_toggleStyle = UIUtils.Toggle; + } + + //for ( int i = 0; i < m_list.Length; i++ ) + //{ + // GUI.color = m_list[ i ].IsInside( mousePosition ) ? LeftIconsColorOn : LeftIconsColorOff; + // m_list[ i ].Draw( TabX + m_transformedArea.x + m_list[ i ].ButtonSpacing, TabY ); + //} + GUI.color = m_updateButton.IsInside( mousePosition ) ? LeftIconsColorOn : LeftIconsColorOff; + m_updateButton.Draw( TabX + m_transformedArea.x + m_updateButton.ButtonSpacing, TabY ); + + GUI.color = m_liveButton.IsInside( mousePosition ) ? LeftIconsColorOn : LeftIconsColorOff; + m_liveButton.Draw( TabX + m_transformedArea.x + m_liveButton.ButtonSpacing, TabY ); + + GUI.color = m_openSourceCodeButton.IsInside( mousePosition ) ? LeftIconsColorOn : LeftIconsColorOff; + m_openSourceCodeButton.Draw( TabX + m_transformedArea.x + m_openSourceCodeButton.ButtonSpacing, TabY ); + + if ( m_searchBarVisible ) + { + m_searchBarSize.x = m_transformedArea.x + m_transformedArea.width - 320 - TabX; + string currentFocus = GUI.GetNameOfFocusedControl(); + + if ( Event.current.type == EventType.KeyDown ) + { + KeyCode keyCode = Event.current.keyCode; + if ( Event.current.shift ) + { + if ( keyCode == KeyCode.F3 || + ( ( keyCode == KeyCode.KeypadEnter || keyCode == KeyCode.Return ) && + ( currentFocus.Equals( SearchBarId ) || string.IsNullOrEmpty( currentFocus ) ) ) ) + SelectPrevious(); + } + else + { + if ( keyCode == KeyCode.F3 || + ( ( keyCode == KeyCode.KeypadEnter || keyCode == KeyCode.Return ) && + ( currentFocus.Equals( SearchBarId ) || string.IsNullOrEmpty( currentFocus ) ) ) ) + SelectNext(); + } + } + + if( currentFocus.Equals( SearchBarId ) || ( m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.MouseDown && m_searchBarSize.Contains( m_parentWindow.CameraDrawInfo.MousePosition ) ) || m_selectSearchBarTextfield ) + { + EditorGUI.BeginChangeCheck(); + { + GUI.SetNextControlName( SearchBarId ); + m_searchBarValue = EditorGUI.TextField( m_searchBarSize, m_searchBarValue, UIUtils.ToolbarSearchTextfield ); + } + if ( EditorGUI.EndChangeCheck() ) + { + m_refreshSearchResultList = true; + } + } else + { + GUI.Label( m_searchBarSize, m_searchBarValue, UIUtils.ToolbarSearchTextfield ); + } + + m_searchBarSize.x += m_searchBarSize.width; + if ( m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.MouseDown && m_searchBarSize.Contains( m_parentWindow.CameraDrawInfo.MousePosition ) ) + { + if ( string.IsNullOrEmpty( m_searchBarValue ) ) + { + m_searchBarVisible = false; + m_refreshSearchResultList = false; + } + else + { + m_searchBarValue = string.Empty; + m_searchResultNodes.Clear(); + m_currentSelected = -1; + } + } + + GUI.Label( m_searchBarSize, string.Empty, UIUtils.ToolbarSearchCancelButton ); + + + + if ( Event.current.isKey && Event.current.keyCode == KeyCode.Escape ) + { + m_searchBarVisible = false; + m_refreshSearchResultList = false; + GUI.FocusControl( null ); + m_selectSearchBarTextfield = false; + } + + if ( m_refreshSearchResultList && ( m_parentWindow.CurrentInactiveTime > InactivityRefreshTime ) ) + { + RefreshList(); + } + } + + if ( m_selectSearchBarTextfield ) + { + m_selectSearchBarTextfield = false; + EditorGUI.FocusTextInControl( SearchBarId ); + //GUI.FocusControl( SearchBarId ); + } + + //if ( Event.current.control && Event.current.isKey && Event.current.keyCode == KeyCode.F && Event.current.type == EventType.KeyDown ) + if( m_parentWindow.CurrentCommandName.Equals("Find") ) + { + if ( !m_searchBarVisible ) + { + m_searchBarVisible = true; + m_refreshSearchResultList = false; + } + m_selectSearchBarTextfield = true; + } + + GUI.color = m_shareButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; + m_shareButton.Draw( m_transformedArea.x + m_transformedArea.width - 195 - TabX, TabY ); + + GUI.color = m_takeScreenshotButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; + m_takeScreenshotButton.Draw( m_transformedArea.x + m_transformedArea.width - 165 - TabX, TabY ); + + + + GUI.color = m_focusOnSelectionButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; + m_focusOnSelectionButton.Draw( m_transformedArea.x + m_transformedArea.width - 120 - TabX, TabY ); + + GUI.color = m_focusOnMasterNodeButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; + m_focusOnMasterNodeButton.Draw( m_transformedArea.x + m_transformedArea.width - 85 - TabX, TabY ); + + GUI.color = m_cleanUnusedNodesButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; + m_cleanUnusedNodesButton.Draw( m_transformedArea.x + m_transformedArea.width - 50 - TabX, TabY ); + + GUI.color = m_showInfoWindowButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; + m_showInfoWindowButton.Draw( m_transformedArea.x + m_transformedArea.width - 25 - TabX, TabY ); + + + //GUI.color = m_showTipsWindowButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; + //m_showTipsWindowButton.Draw( m_transformedArea.x + m_transformedArea.width - 190 - TabX, TabY ); + + //GUI.color = m_showConsoleWindowButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; + //m_showConsoleWindowButton.Draw( m_transformedArea.x + m_transformedArea.width - 195 - TabX, TabY ); + + GUI.color = bufferedColor; + + } + + public void OnNodeRemovedFromGraph( ParentNode node ) + { + m_searchResultNodes.Remove( node ); + } + + int m_previousNodeCount = 0; + + void RefreshList() + { + m_refreshSearchResultList = false; + m_currentSelected = -1; + m_searchResultNodes.Clear(); + if ( !string.IsNullOrEmpty( m_searchBarValue ) ) + { + List nodes = m_parentWindow.CurrentGraph.AllNodes; + int count = nodes.Count; + m_previousNodeCount = count; + for ( int i = 0; i < count; i++ ) + { + if ( nodes[ i ].CheckFindText( m_searchBarValue ) ) + { + m_searchResultNodes.Add( nodes[ i ] ); + } + } + } + } + + void SelectNext() + { + if ( m_refreshSearchResultList || m_parentWindow.CurrentGraph.AllNodes.Count != m_previousNodeCount ) + { + RefreshList(); + } + + if ( m_searchResultNodes.Count > 0 ) + { + m_currentSelected = ( m_currentSelected + 1 ) % m_searchResultNodes.Count; + m_parentWindow.FocusOnNode( m_searchResultNodes[ m_currentSelected ], 1, true ,true); + } + } + + void SelectPrevious() + { + if ( m_refreshSearchResultList || m_parentWindow.CurrentGraph.AllNodes.Count != m_previousNodeCount ) + { + RefreshList(); + } + + if ( m_searchResultNodes.Count > 0 ) + { + m_currentSelected = ( m_currentSelected > 1 ) ? ( m_currentSelected - 1 ) : ( m_searchResultNodes.Count - 1 ); + m_parentWindow.FocusOnNode( m_searchResultNodes[ m_currentSelected ], 1, true ); + } + } + + + public void SetStateOnButton( ToolButtonType button, int state, string tooltip ) + { + switch ( button ) + { + case ToolButtonType.New: + case ToolButtonType.Open: + case ToolButtonType.Save: + case ToolButtonType.Library: + case ToolButtonType.Options: + case ToolButtonType.Help: + case ToolButtonType.MasterNode: break; + case ToolButtonType.OpenSourceCode: + { + m_openSourceCodeButton.SetStateOnButton( state, tooltip ); + } + break; + case ToolButtonType.Update: + { + m_updateButton.SetStateOnButton( state, tooltip ); + } + break; + case ToolButtonType.Live: + { + m_liveButton.SetStateOnButton( state, tooltip ); + } + break; + case ToolButtonType.TakeScreenshot: + { + m_takeScreenshotButton.SetStateOnButton( state, tooltip ); + } + break; + case ToolButtonType.CleanUnusedNodes: + //case eToolButtonType.SelectShader: + { + m_cleanUnusedNodesButton.SetStateOnButton( state, tooltip ); + } + break; + case ToolButtonType.FocusOnMasterNode: + { + m_focusOnMasterNodeButton.SetStateOnButton( state, tooltip ); + } + break; + case ToolButtonType.FocusOnSelection: + { + m_focusOnSelectionButton.SetStateOnButton( state, tooltip ); + } + break; + case ToolButtonType.Share: + { + m_shareButton.SetStateOnButton( state, tooltip ); + } + break; + case ToolButtonType.ShowInfoWindow: + { + m_showInfoWindowButton.SetStateOnButton( state, tooltip ); + } + break; + case ToolButtonType.ShowTipsWindow: + { + m_showTipsWindowButton.SetStateOnButton( state, tooltip ); + } + break; + case ToolButtonType.ShowConsole: + { + m_showConsoleWindowButton.SetStateOnButton( state, tooltip ); + } + break; + } + } + + public void SetStateOnButton( ToolButtonType button, int state ) + { + switch ( button ) + { + case ToolButtonType.New: + case ToolButtonType.Open: + case ToolButtonType.Save: + case ToolButtonType.Library: + case ToolButtonType.Options: + case ToolButtonType.Help: + case ToolButtonType.MasterNode: break; + case ToolButtonType.OpenSourceCode: + { + m_openSourceCodeButton.SetStateOnButton( state ); + } + break; + case ToolButtonType.Update: + { + m_updateButton.SetStateOnButton( state ); + } + break; + case ToolButtonType.Live: + { + m_liveButton.SetStateOnButton( state ); + } + break; + case ToolButtonType.TakeScreenshot: + { + m_takeScreenshotButton.SetStateOnButton( state ); + } + break; + case ToolButtonType.CleanUnusedNodes: + //case eToolButtonType.SelectShader: + { + m_cleanUnusedNodesButton.SetStateOnButton( state ); + } + break; + case ToolButtonType.FocusOnMasterNode: + { + m_focusOnMasterNodeButton.SetStateOnButton( state ); + } + break; + case ToolButtonType.FocusOnSelection: + { + m_focusOnSelectionButton.SetStateOnButton( state ); + } + break; + case ToolButtonType.Share: + { + m_shareButton.SetStateOnButton( state ); + } + break; + case ToolButtonType.ShowInfoWindow: + { + m_showInfoWindowButton.SetStateOnButton( state ); + } + break; + case ToolButtonType.ShowTipsWindow: + { + m_showTipsWindowButton.SetStateOnButton( state ); + }break; + case ToolButtonType.ShowConsole: + { + m_showConsoleWindowButton.SetStateOnButton( state ); + } + break; + } + } + + public void DrawShaderTitle( MenuParent nodeParametersWindow, MenuParent paletteWindow, float availableCanvasWidth, float graphAreaHeight, string shaderName ) + { + float leftAdjust = nodeParametersWindow.IsMaximized ? nodeParametersWindow.RealWidth : 0; + float rightAdjust = paletteWindow.IsMaximized ? 0 : paletteWindow.RealWidth; + + m_boxRect = new Rect( leftAdjust + rightAdjust, 0, availableCanvasWidth, 35 ); + m_boxRect.x += paletteWindow.IsMaximized ? 0 : -paletteWindow.RealWidth; + m_boxRect.width += nodeParametersWindow.IsMaximized ? 0 : nodeParametersWindow.RealWidth; + m_boxRect.width += paletteWindow.IsMaximized ? 0 : paletteWindow.RealWidth; + m_borderRect = new Rect( m_boxRect ); + m_borderRect.height = graphAreaHeight; + + int extra = m_searchBarVisible ? (int)m_searchBarSize.width + 20: 0; + //m_boxRect.xMax -= ( paletteWindow.IsMaximized ? 195 : 230 ) + extra; + //m_boxRect.xMin += nodeParametersWindow.IsMaximized ? 95 : 145; + + UIUtils.ToolbarMainTitle.padding.right = ( paletteWindow.IsMaximized ? 195 : 230 ) + extra; + UIUtils.ToolbarMainTitle.padding.left = nodeParametersWindow.IsMaximized ? 110 : 145; + + if ( m_borderStyle == null ) + { + m_borderStyle = ( ParentWindow.CurrentGraph.CurrentMasterNode == null ) ? UIUtils.GetCustomStyle( CustomStyle.ShaderFunctionBorder ) : UIUtils.GetCustomStyle( CustomStyle.ShaderBorder ); + } + + GUI.Label( m_borderRect, shaderName, m_borderStyle ); + GUI.Label( m_boxRect, shaderName, UIUtils.ToolbarMainTitle ); + } + + public override bool IsInside( Vector2 position ) + { + if ( !m_isActive ) + return false; + + return m_boxRect.Contains( position ) || m_areaLeft.Contains( position ) || m_areaRight.Contains( position ); + } + + public GUIStyle BorderStyle + { + get { return m_borderStyle; } + set { m_borderStyle = value; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs.meta new file mode 100644 index 00000000..078b9ba8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b1c1f3bedf849cb41a1648bf895bc0f7 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native.meta new file mode 100644 index 00000000..c3ec23a0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 08d94054f82fc06498060596f83da0ba +folderAsset: yes +timeCreated: 1481126943 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs new file mode 100644 index 00000000..aeafb2a3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs @@ -0,0 +1,55 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class FallbackColor : IFallbackVars + { + [SerializeField] + private Color m_current; + [SerializeField] + private Color m_previous; + + public FallbackColor() + { + m_current = new Color(0, 0, 0, 0); + m_previous = new Color(0, 0, 0, 0); + } + + public FallbackColor(Color data) + { + m_current = data; + m_previous = data; + } + + public void Revert() + { + Color aux = m_current; + m_current = m_previous; + m_previous = aux; + } + + public Color Current + { + get + { + return m_current; + } + + set + { + m_previous = m_current; + m_current = value; + } + } + + public override string ToString() + { + return m_current.ToString(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs.meta new file mode 100644 index 00000000..371c84f4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 8c6dccc523e2ad440a82edd582b84a45 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs new file mode 100644 index 00000000..69d6f39b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs @@ -0,0 +1,56 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class FallbackFloat : IFallbackVars + { + [SerializeField] + private float m_current; + [SerializeField] + private float m_previous; + + public FallbackFloat() + { + m_current = 0; + m_previous = 0; + } + + public FallbackFloat( float data ) + { + m_current = data; + m_previous = data; + } + + public void Revert() + { + float aux = m_current; + m_current = m_previous; + m_previous = aux; + } + + + public float Current + { + get + { + return m_current; + } + + set + { + m_previous = m_current; + m_current = value; + } + } + + public override string ToString() + { + return m_current.ToString(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs.meta new file mode 100644 index 00000000..7341e09f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a957e66c7a41d6848966d526c9687347 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs new file mode 100644 index 00000000..bd9b8a7d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs @@ -0,0 +1,56 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class FallbackInt : IFallbackVars + { + [SerializeField] + private int m_current; + [SerializeField] + private int m_previous; + + public FallbackInt() + { + m_current = 0; + m_previous = 0; + } + + public FallbackInt( int data ) + { + m_current = data; + m_previous = data; + } + + public void Revert() + { + int aux = m_current; + m_current = m_previous; + m_previous = aux; + } + + + public int Current + { + get + { + return m_current; + } + + set + { + m_previous = m_current; + m_current = value; + } + } + + public override string ToString() + { + return m_current.ToString(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs.meta new file mode 100644 index 00000000..77cb4afe --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 09c28ab321caf3b47839606e37d3cdd2 +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs new file mode 100644 index 00000000..8405790d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs @@ -0,0 +1,55 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class FallbackMatrix4x4 : IFallbackVars + { + [SerializeField] + private Matrix4x4 m_current; + [SerializeField] + private Matrix4x4 m_previous; + + public FallbackMatrix4x4() + { + m_current = new Matrix4x4(); + m_previous = new Matrix4x4(); + } + + public FallbackMatrix4x4( Matrix4x4 data ) + { + m_current = data; + m_previous = data; + } + + public void Revert() + { + Matrix4x4 aux = m_current; + m_current = m_previous; + m_previous = aux; + } + + public Matrix4x4 Current + { + get + { + return m_current; + } + + set + { + m_previous = m_current; + m_current = value; + } + } + + public override string ToString() + { + return m_current.ToString(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs.meta new file mode 100644 index 00000000..4b0b419a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 48af68670bdba9147b4ed55138e4edf6 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs new file mode 100644 index 00000000..e33e096b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs @@ -0,0 +1,56 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class FallbackString : IFallbackVars + { + [SerializeField] + private string m_current; + [SerializeField] + private string m_previous; + + public FallbackString() + { + m_current = string.Empty; + m_previous = string.Empty; + } + + public FallbackString( string data ) + { + m_current = data; + m_previous = data; + } + + public void Revert() + { + string aux = m_current; + m_current = m_previous; + m_previous = aux; + } + + + public string Current + { + get + { + return m_current; + } + + set + { + m_previous = m_current; + m_current = value; + } + } + + public override string ToString() + { + return m_current; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs.meta new file mode 100644 index 00000000..122f8164 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: cc2e25b7c55e9284699ccad75e79a075 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs new file mode 100644 index 00000000..afee1e74 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs @@ -0,0 +1,55 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class FallbackTexture : IFallbackVars + { + [SerializeField] + private Texture m_current; + [SerializeField] + private Texture m_previous; + + public FallbackTexture() + { + m_current = null; + m_previous = null; + } + + public FallbackTexture( Texture data ) + { + m_current = data; + m_previous = data; + } + + public void Revert() + { + Texture aux = m_current; + m_current = m_previous; + m_previous = aux; + } + + public Texture Current + { + get + { + return m_current; + } + + set + { + m_previous = m_current; + m_current = value; + } + } + + public override string ToString() + { + return m_current.ToString(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs.meta new file mode 100644 index 00000000..5b7211e0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 309e413cfa89510429c67fa82c557da7 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs new file mode 100644 index 00000000..c6d3eaf2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs @@ -0,0 +1,36 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + //GENERICS DON'T WORK WITH HOT CODE RELOAD + [Serializable] + public class FallbackVariable + { + [SerializeField] + private T m_current; + [SerializeField] + private T m_last; + + public void Revert() + { + m_current = m_last; + } + + public T Current + { + get + { + return m_current; + } + set + { + m_last = m_current; + m_current = value; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs.meta new file mode 100644 index 00000000..2288ec24 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ec850a4093c249d449f22e0483040b9c +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs new file mode 100644 index 00000000..adad9d05 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs @@ -0,0 +1,56 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class FallbackVector2 : IFallbackVars + { + [SerializeField] + private Vector2 m_current; + [SerializeField] + private Vector2 m_previous; + + public FallbackVector2() + { + m_current = new Vector2( 0, 0 ); + m_previous = new Vector2( 0, 0 ); + } + + public FallbackVector2( Vector2 data ) + { + m_current = data; + m_previous = data; + } + + public void Revert() + { + Vector2 aux = m_current; + m_current = m_previous; + m_previous = aux; + } + + + public Vector2 Current + { + get + { + return m_current; + } + + set + { + m_previous = m_current; + m_current = value; + } + } + + public override string ToString() + { + return m_current.ToString(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs.meta new file mode 100644 index 00000000..d610b34f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ab3a976b3cb79ad41986d2f7d4439642 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs new file mode 100644 index 00000000..f2fe1325 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs @@ -0,0 +1,56 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class FallbackVector3 : IFallbackVars + { + [SerializeField] + private Vector3 m_current; + [SerializeField] + private Vector3 m_previous; + + public FallbackVector3() + { + m_current = new Vector3( 0, 0, 0 ); + m_previous = new Vector3( 0, 0, 0 ); + } + + public FallbackVector3( Vector3 data ) + { + m_current = data; + m_previous = data; + } + + public void Revert() + { + Vector3 aux = m_current; + m_current = m_previous; + m_previous = aux; + } + + + public Vector3 Current + { + get + { + return m_current; + } + + set + { + m_previous = m_current; + m_current = value; + } + } + + public override string ToString() + { + return m_current.ToString(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs.meta new file mode 100644 index 00000000..77145ebe --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 0e681455d27d2264fbc2683a1510df2c +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs new file mode 100644 index 00000000..63be6588 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs @@ -0,0 +1,48 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class FallbackVector4 : IFallbackVars + { + [SerializeField] + private Vector4 m_current; + [SerializeField] + private Vector4 m_previous; + + public FallbackVector4() + { + m_current = new Vector4( 0, 0, 0, 0 ); + m_previous = new Vector4( 0, 0, 0, 0 ); + } + + public FallbackVector4( Vector4 data ) + { + m_current = data; + m_previous = data; + } + + public void Revert() + { + Vector4 aux = m_current; + m_current = m_previous; + m_previous = aux; + } + + public Vector4 Current + { + get { return m_current; } + set + { + m_previous = m_current; + m_current = value; + } + } + + public override string ToString() { return m_current.ToString(); } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs.meta new file mode 100644 index 00000000..430c8471 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4e23c25f035ba604ea999f214c0a7833 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs new file mode 100644 index 00000000..17f7fcf0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs @@ -0,0 +1,10 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + interface IFallbackVars + { + void Revert(); + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs.meta new file mode 100644 index 00000000..e62fab61 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 8b0dda023474c6e41a39c36e48af72b2 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes.meta new file mode 100644 index 00000000..1847e2b4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: dd2ad7a1ab86e9344b83b2a88cc030cf +folderAsset: yes +timeCreated: 1481126944 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs new file mode 100644 index 00000000..141fea0d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs @@ -0,0 +1,692 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using System.Collections.Generic; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public enum eResizeAxis + { + X_AXIS, + Y_AXIS, + ALL + } + + [Serializable] + public sealed class CommentaryNode : ParentNode, ISerializationCallbackReceiver + { + private const string InfoText = "Press Alt + Left Mouse Click/Drag to make all Comment node area interactable.\nDouble click on the Comment at the node body to modify it directly from there."; + + private const string CommentaryTitle = "Comment"; + private const float BORDER_SIZE_X = 50; + private const float BORDER_SIZE_Y = 50; + private const float MIN_SIZE_X = 100; + private const float MIN_SIZE_Y = 100; + private const float COMMENTARY_BOX_HEIGHT = 30; + + private readonly Vector2 ResizeButtonPos = new Vector2( 1, 1 ); + + [SerializeField] + private string m_commentText = "Comment"; + + [SerializeField] + private string m_titleText = string.Empty; + + [SerializeField] + private eResizeAxis m_resizeAxis = eResizeAxis.ALL; + + [SerializeField] + private List m_nodesOnCommentary = new List(); + private Dictionary m_nodesOnCommentaryDict = new Dictionary(); + private bool m_reRegisterNodes = false; + + [SerializeField] + private Rect m_resizeLeftIconCoords; + + [SerializeField] + private Rect m_resizeRightIconCoords; + + [SerializeField] + private Rect m_auxHeaderPos; + + [SerializeField] + private Rect m_commentArea; + + private Texture2D m_resizeIconTex; + + private bool m_isResizingRight = false; + private bool m_isResizingLeft = false; + + private Vector2 m_resizeStartPoint = Vector2.zero; + + private string m_focusName = "CommentaryNode"; + private bool m_focusOnTitle = false; + private bool m_graphDepthAnalized = false; + + private bool m_checkCommentText = true; + private bool m_checkTitleText = true; + + public Color m_frameColor = Color.white; + + private List m_nodesIds = new List(); + private bool m_checkContents = false; + + private bool m_isEditing; + private bool m_stopEditing; + private bool m_startEditing; + private double m_clickTime; + private double m_doubleClickTime = 0.3; + + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_reorderLocked = true; + m_rmbIgnore = true; + m_defaultInteractionMode = InteractionMode.Both; + m_headerColor = UIUtils.GetColorFromCategory( "Commentary" ); + m_connStatus = NodeConnectionStatus.Island; + m_textLabelWidth = 90; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_focusName = CommentaryTitle + OutputId; + } + + public void CreateFromSelectedNodes( Vector2 mousePosOnCanvasCoords, ParentNode[] selectedNodes ) + { + if ( selectedNodes.Length == 0 ) + { + m_position = new Rect( mousePosOnCanvasCoords, new Vector2( 100, 100 ) ); + return; + } + + Vector2 minPos = new Vector2( float.MaxValue, float.MaxValue ); + Vector2 maxPos = new Vector2( float.MinValue, float.MinValue ); + + for ( int i = 0; i < selectedNodes.Length; i++ ) + { + //Check min + if ( selectedNodes[ i ].Position.x < minPos.x ) + minPos.x = selectedNodes[ i ].Position.x; + + if ( selectedNodes[ i ].Position.y < minPos.y ) + minPos.y = selectedNodes[ i ].Position.y; + + //check max + float nodeXMax = selectedNodes[ i ].Position.x + selectedNodes[ i ].Position.width; + if ( nodeXMax > maxPos.x ) + { + maxPos.x = nodeXMax; + } + + float nodeYMax = selectedNodes[ i ].Position.y + selectedNodes[ i ].Position.height; + if ( nodeYMax > maxPos.y ) + { + maxPos.y = nodeYMax; + } + + //_nodesOnCommentary.Add( selectedNodes[ i ] ); + //selectedNodes[ i ].OnNodeStoppedMovingEvent += NodeStoppedMoving; + AddNodeToCommentary( selectedNodes[ i ] ); + } + + Vector2 dims = maxPos - minPos + new Vector2( 2 * BORDER_SIZE_X, 2 * BORDER_SIZE_Y ); + m_position = new Rect( minPos.x - BORDER_SIZE_X, minPos.y - BORDER_SIZE_Y, dims.x, dims.y ); + } + + public override void Move( Vector2 delta, bool snap ) + { + if ( m_isResizingRight || m_isResizingLeft ) + return; + + base.Move( delta, snap ); + for ( int i = 0; i < m_nodesOnCommentary.Count; i++ ) + { + if ( !m_nodesOnCommentary[ i ].Selected ) + { + m_nodesOnCommentary[ i ].RecordObject( Constants.UndoMoveNodesId ); + m_nodesOnCommentary[ i ].Move( delta, snap ); + } + } + } + + public void NodeStoppedMoving( ParentNode node, bool testOnlySelected, InteractionMode useTargetInteraction ) + { + if ( !m_position.Contains( node.Vec2Position ) && !m_position.Contains( node.Corner ) ) + { + RemoveNode( node ); + } + } + + public void NodeDestroyed( ParentNode node ) + { + RemoveNode( node ); + } + + public void RemoveNode( ParentNode node ) + { + if ( m_nodesOnCommentaryDict.ContainsKey( node.UniqueId ) ) + { + UIUtils.MarkUndoAction(); + RecordObject( Constants.UndoRemoveNodeFromCommentaryId ); + node.RecordObject( Constants.UndoRemoveNodeFromCommentaryId ); + m_nodesOnCommentary.Remove( node ); + m_nodesOnCommentaryDict.Remove( node.UniqueId ); + node.OnNodeStoppedMovingEvent -= NodeStoppedMoving; + node.OnNodeDestroyedEvent -= NodeDestroyed; + node.CommentaryParent = -1; + } + } + + public void RemoveAllNodes() + { + UIUtils.MarkUndoAction(); + for ( int i = 0; i < m_nodesOnCommentary.Count; i++ ) + { + RecordObject( Constants.UndoRemoveNodeFromCommentaryId ); + m_nodesOnCommentary[ i ].RecordObject( Constants.UndoRemoveNodeFromCommentaryId ); + m_nodesOnCommentary[ i ].OnNodeStoppedMovingEvent -= NodeStoppedMoving; + m_nodesOnCommentary[ i ].OnNodeDestroyedEvent -= NodeDestroyed; + m_nodesOnCommentary[ i ].CommentaryParent = -1; + } + m_nodesOnCommentary.Clear(); + m_nodesOnCommentaryDict.Clear(); + } + + public override void Destroy() + { + base.Destroy(); + RemoveAllNodes(); + } + + public void AddNodeToCommentary( ParentNode node ) + { + if( node.UniqueId == UniqueId ) + return; + + if ( !m_nodesOnCommentaryDict.ContainsKey( node.UniqueId ) ) + { + bool addToNode = false; + + if ( node.CommentaryParent < 0 ) + { + addToNode = true; + if ( node.Depth <= m_depth ) + { + ActivateNodeReordering( node.Depth ); + } + } + else + { + CommentaryNode other = UIUtils.GetNode( node.CommentaryParent ) as CommentaryNode; + if ( other != null ) + { + if ( other.Depth < Depth ) + { + other.RemoveNode( node ); + addToNode = true; + } + + } + } + + if ( addToNode ) + { + UIUtils.MarkUndoAction(); + RecordObject( Constants.UndoAddNodeToCommentaryId ); + node.RecordObject( Constants.UndoAddNodeToCommentaryId ); + + m_nodesOnCommentary.Add( node ); + m_nodesOnCommentaryDict.Add( node.UniqueId, node ); + node.OnNodeStoppedMovingEvent += NodeStoppedMoving; + node.OnNodeDestroyedEvent += NodeDestroyed; + node.CommentaryParent = UniqueId; + } + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr,()=> + { + EditorGUI.BeginChangeCheck(); + m_titleText = EditorGUILayoutTextField( "Frame Title", m_titleText ); + if ( EditorGUI.EndChangeCheck() ) + { + m_checkTitleText = true; + } + EditorGUI.BeginChangeCheck(); + m_commentText = EditorGUILayoutTextField( CommentaryTitle, m_commentText ); + if ( EditorGUI.EndChangeCheck() ) + { + m_checkCommentText = true; + } + + m_frameColor = EditorGUILayoutColorField( "Frame Color", m_frameColor ); + } ); + EditorGUILayout.HelpBox( InfoText, MessageType.Info ); + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + if ( m_nodesIds.Count > 0 ) + { + for ( int i = 0; i < m_nodesIds.Count; i++ ) + { + ParentNode node = ContainerGraph.GetNode( m_nodesIds[ i ] ); + if ( node ) + { + AddNodeToCommentary( node ); + } + } + m_nodesIds.Clear(); + } + + if ( m_reRegisterNodes ) + { + m_reRegisterNodes = false; + m_nodesOnCommentaryDict.Clear(); + for ( int i = 0; i < m_nodesOnCommentary.Count; i++ ) + { + if ( m_nodesOnCommentary[ i ] != null ) + { + m_nodesOnCommentary[ i ].OnNodeStoppedMovingEvent += NodeStoppedMoving; + m_nodesOnCommentary[ i ].OnNodeDestroyedEvent += NodeDestroyed; + m_nodesOnCommentaryDict.Add( m_nodesOnCommentary[ i ].UniqueId, m_nodesOnCommentary[ i ] ); + } + } + } + + //base.OnLayout( drawInfo ); + CalculatePositionAndVisibility( drawInfo ); + + m_headerPosition = m_globalPosition; + m_headerPosition.height = UIUtils.CurrentHeaderHeight; + + m_auxHeaderPos = m_position; + m_auxHeaderPos.height = UIUtils.HeaderMaxHeight; + + m_commentArea = m_globalPosition; + m_commentArea.height = COMMENTARY_BOX_HEIGHT * drawInfo.InvertedZoom; + m_commentArea.xMin += 10 * drawInfo.InvertedZoom; + m_commentArea.xMax -= 10 * drawInfo.InvertedZoom; + + if ( m_resizeIconTex == null ) + { + m_resizeIconTex = UIUtils.GetCustomStyle( CustomStyle.CommentaryResizeButton ).normal.background; + } + + // LEFT RESIZE BUTTON + m_resizeLeftIconCoords = m_globalPosition; + m_resizeLeftIconCoords.x = m_globalPosition.x + 2; + m_resizeLeftIconCoords.y = m_globalPosition.y + m_globalPosition.height - 2 - ( m_resizeIconTex.height + ResizeButtonPos.y ) * drawInfo.InvertedZoom; + m_resizeLeftIconCoords.width = m_resizeIconTex.width * drawInfo.InvertedZoom; + m_resizeLeftIconCoords.height = m_resizeIconTex.height * drawInfo.InvertedZoom; + + // RIGHT RESIZE BUTTON + m_resizeRightIconCoords = m_globalPosition; + m_resizeRightIconCoords.x = m_globalPosition.x + m_globalPosition.width - 1 - ( m_resizeIconTex.width + ResizeButtonPos.x ) * drawInfo.InvertedZoom; + m_resizeRightIconCoords.y = m_globalPosition.y + m_globalPosition.height - 2 - ( m_resizeIconTex.height + ResizeButtonPos.y ) * drawInfo.InvertedZoom; + m_resizeRightIconCoords.width = m_resizeIconTex.width * drawInfo.InvertedZoom; + m_resizeRightIconCoords.height = m_resizeIconTex.height * drawInfo.InvertedZoom; + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + if ( !m_isVisible ) + return; + + m_colorBuffer = GUI.color; + // Background + GUI.color = Constants.NodeBodyColor * m_frameColor; + GUI.Label( m_globalPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.CommentaryBackground ) ); + + // Header + GUI.color = m_headerColor * m_headerColorModifier * m_frameColor; + GUI.Label( m_headerPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeHeader ) ); + GUI.color = m_colorBuffer; + + // Fixed Title ( only renders when not editing ) + if ( !m_isEditing && !m_startEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + GUI.Label( m_commentArea, m_commentText, UIUtils.CommentaryTitle ); + } + + // Buttons + GUI.Label( m_resizeLeftIconCoords, string.Empty, UIUtils.GetCustomStyle( CustomStyle.CommentaryResizeButtonInv ) ); + GUI.Label( m_resizeRightIconCoords, string.Empty, UIUtils.GetCustomStyle( CustomStyle.CommentaryResizeButton ) ); + + // Selection Box + if ( m_selected ) + { + GUI.color = Constants.NodeSelectedColor; + RectOffset cache = UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ).border; + UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ).border = UIUtils.RectOffsetSix; + GUI.Label( m_globalPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ) ); + UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ).border = cache; + GUI.color = m_colorBuffer; + } + + if ( !string.IsNullOrEmpty( m_titleText ) ) + { + Rect titleRect = m_globalPosition; + titleRect.y -= 24; + titleRect.height = 24; + GUI.Label( titleRect, m_titleText, UIUtils.GetCustomStyle( CustomStyle.CommentarySuperTitle ) ); + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + // Custom Editable Title + if ( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + if ( !m_isEditing && ( ( !ContainerGraph.ParentWindow.MouseInteracted && drawInfo.CurrentEventType == EventType.MouseDown && m_commentArea.Contains( drawInfo.MousePosition ) ) ) ) + { + if ( ( EditorApplication.timeSinceStartup - m_clickTime ) < m_doubleClickTime ) + m_startEditing = true; + else + GUI.FocusControl( null ); + m_clickTime = EditorApplication.timeSinceStartup; + } + else if ( m_isEditing && ( ( drawInfo.CurrentEventType == EventType.MouseDown && !m_commentArea.Contains( drawInfo.MousePosition ) ) || !EditorGUIUtility.editingTextField ) ) + { + m_stopEditing = true; + } + + if ( m_isEditing || m_startEditing ) + { + EditorGUI.BeginChangeCheck(); + GUI.SetNextControlName( m_focusName ); + m_commentText = EditorGUITextField( m_commentArea, string.Empty, m_commentText, UIUtils.CommentaryTitle ); + if ( EditorGUI.EndChangeCheck() ) + { + m_checkCommentText = true; + } + + if ( m_startEditing ) + EditorGUI.FocusTextInControl( m_focusName ); + } + + if ( drawInfo.CurrentEventType == EventType.Repaint ) + { + if ( m_startEditing ) + { + m_startEditing = false; + m_isEditing = true; + } + + if ( m_stopEditing ) + { + m_stopEditing = false; + m_isEditing = false; + GUI.FocusControl( null ); + } + } + } + + if ( drawInfo.CurrentEventType == EventType.MouseDown && drawInfo.LeftMouseButtonPressed ) + { + // Left Button + if( m_resizeLeftIconCoords.Contains( drawInfo.MousePosition ) && ContainerGraph.ParentWindow.CurrentEvent.modifiers != EventModifiers.Shift ) + { + if ( !m_isResizingLeft ) + { + m_isResizingLeft = true; + ContainerGraph.ParentWindow.ForceAutoPanDir = true; + m_resizeStartPoint = drawInfo.TransformedMousePos; + } + } + + // Right Button + if ( m_resizeRightIconCoords.Contains( drawInfo.MousePosition ) && ContainerGraph.ParentWindow.CurrentEvent.modifiers != EventModifiers.Shift ) + { + if ( !m_isResizingRight ) + { + m_isResizingRight = true; + ContainerGraph.ParentWindow.ForceAutoPanDir = true; + m_resizeStartPoint = drawInfo.TransformedMousePos; + } + } + } + + if ( drawInfo.CurrentEventType == EventType.Repaint || drawInfo.CurrentEventType == EventType.MouseUp ) + { + // Left Button + EditorGUIUtility.AddCursorRect( m_resizeLeftIconCoords, MouseCursor.ResizeUpRight ); + if ( m_isResizingLeft ) + { + if ( drawInfo.CurrentEventType == EventType.MouseUp ) + { + m_isResizingLeft = false; + ContainerGraph.ParentWindow.ForceAutoPanDir = false; + RemoveAllNodes(); + FireStoppedMovingEvent( false, InteractionMode.Target ); + } + else + { + Vector2 currSize = ( drawInfo.TransformedMousePos - m_resizeStartPoint ) /*/ drawInfo.InvertedZoom*/; + m_resizeStartPoint = drawInfo.TransformedMousePos; + if ( m_resizeAxis != eResizeAxis.Y_AXIS ) + { + m_position.x += currSize.x; + m_position.width -= currSize.x; + if ( m_position.width < MIN_SIZE_X ) + { + m_position.x -= ( MIN_SIZE_X - m_position.width ); + m_position.width = MIN_SIZE_X; + } + } + + if ( m_resizeAxis != eResizeAxis.X_AXIS ) + { + m_position.height += currSize.y; + if ( m_position.height < MIN_SIZE_Y ) + { + m_position.height = MIN_SIZE_Y; + } + } + } + } + + // Right Button + EditorGUIUtility.AddCursorRect( m_resizeRightIconCoords, MouseCursor.ResizeUpLeft ); + if ( m_isResizingRight ) + { + if ( drawInfo.CurrentEventType == EventType.MouseUp ) + { + m_isResizingRight = false; + ContainerGraph.ParentWindow.ForceAutoPanDir = false; + RemoveAllNodes(); + FireStoppedMovingEvent( false, InteractionMode.Target ); + } + else + { + Vector2 currSize = ( drawInfo.TransformedMousePos - m_resizeStartPoint ) /*/ drawInfo.InvertedZoom*/; + m_resizeStartPoint = drawInfo.TransformedMousePos; + if ( m_resizeAxis != eResizeAxis.Y_AXIS ) + { + m_position.width += currSize.x; + if ( m_position.width < MIN_SIZE_X ) + { + m_position.width = MIN_SIZE_X; + } + } + + if ( m_resizeAxis != eResizeAxis.X_AXIS ) + { + m_position.height += currSize.y; + if ( m_position.height < MIN_SIZE_Y ) + { + m_position.height = MIN_SIZE_Y; + } + } + } + } + } + + if ( m_checkCommentText ) + { + m_checkCommentText = false; + m_commentText = m_commentText.Replace( IOUtils.FIELD_SEPARATOR, ' ' ); + } + + if ( m_checkTitleText ) + { + m_checkTitleText = false; + m_titleText = m_titleText.Replace( IOUtils.FIELD_SEPARATOR, ' ' ); + } + + if ( m_focusOnTitle && drawInfo.CurrentEventType == EventType.KeyUp ) + { + m_focusOnTitle = false; + m_startEditing = true; + } + } + + public void Focus() + { + m_focusOnTitle = true; + } + + public override void OnAfterDeserialize() + { + base.OnAfterDeserialize(); + m_reRegisterNodes = true; + } + + public override bool OnNodeInteraction( ParentNode node ) + { + if ( node == null || UniqueId == node.UniqueId ) + return false; + + for( int i = 0; i < m_nodesOnCommentary.Count; i++ ) + { + if( m_nodesOnCommentary[ i ] && m_nodesOnCommentary[ i ] != this && m_nodesOnCommentary[ i ].OnNodeInteraction( node ) ) + { + return false; + } + } + + if( m_position.Contains( node.Vec2Position ) && m_position.Contains( node.Corner ) ) + { + AddNodeToCommentary( node ); + return true; + } + return false; + } + + public override void OnSelfStoppedMovingEvent() + { + FireStoppedMovingEvent( false, InteractionMode.Both ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_position.width = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + m_position.height = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + m_commentText = GetCurrentParam( ref nodeParams ); + int count = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + for ( int i = 0; i < count; i++ ) + { + m_nodesIds.Add( Convert.ToInt32( GetCurrentParam( ref nodeParams ) ) ); + } + + if ( UIUtils.CurrentShaderVersion() > 5004 ) + m_titleText = GetCurrentParam( ref nodeParams ); + + if ( UIUtils.CurrentShaderVersion() > 12002 ) + { + string[] colorChannels = GetCurrentParam( ref nodeParams ).Split( IOUtils.VECTOR_SEPARATOR ); + if ( colorChannels.Length == 4 ) + { + m_frameColor.r = Convert.ToSingle( colorChannels[ 0 ] ); + m_frameColor.g = Convert.ToSingle( colorChannels[ 1 ] ); + m_frameColor.b = Convert.ToSingle( colorChannels[ 2 ] ); + m_frameColor.a = Convert.ToSingle( colorChannels[ 3 ] ); + } + else + { + UIUtils.ShowMessage( UniqueId, "Incorrect number of color values", MessageSeverity.Error ); + } + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_position.width ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_position.height ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_commentText ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_nodesOnCommentary.Count ); + for ( int i = 0; i < m_nodesOnCommentary.Count; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_nodesOnCommentary[ i ].UniqueId ); + } + + IOUtils.AddFieldValueToString( ref nodeInfo, m_titleText ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_frameColor.r.ToString() + IOUtils.VECTOR_SEPARATOR + m_frameColor.g.ToString() + IOUtils.VECTOR_SEPARATOR + m_frameColor.b.ToString() + IOUtils.VECTOR_SEPARATOR + m_frameColor.a.ToString() ); + } + + public override void ResetNodeData() + { + base.ResetNodeData(); + m_graphDepthAnalized = false; + } + + public override void ReadAdditionalClipboardData( ref string[] nodeParams ) + { + base.ReadAdditionalClipboardData( ref nodeParams ); + m_nodesIds.Clear(); + m_checkContents = true; + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( m_checkContents ) + { + m_checkContents = false; + OnSelfStoppedMovingEvent(); + } + } + + public override void CalculateCustomGraphDepth() + { + if ( m_graphDepthAnalized ) + return; + + m_graphDepth = int.MinValue; + int count = m_nodesOnCommentary.Count; + for ( int i = 0; i < count; i++ ) + { + if ( m_nodesOnCommentary[ i ].ConnStatus == NodeConnectionStatus.Island ) + { + m_nodesOnCommentary[ i ].CalculateCustomGraphDepth(); + } + + if ( m_nodesOnCommentary[ i ].GraphDepth >= m_graphDepth ) + { + m_graphDepth = m_nodesOnCommentary[ i ].GraphDepth + 1; + } + } + m_graphDepthAnalized = true; + } + + public override Rect Position { get { return Event.current.alt ? m_position : m_auxHeaderPos; } } + public override bool Contains( Vector3 pos ) + { + return Event.current.alt ? m_globalPosition.Contains( pos ) : ( m_headerPosition.Contains( pos ) || m_resizeRightIconCoords.Contains( pos ) || m_resizeLeftIconCoords.Contains( pos ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs.meta new file mode 100644 index 00000000..089a7669 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 08f1d9c1d8cbe5841a6429d565096eab +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants.meta new file mode 100644 index 00000000..8706d1a2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e7354e1a2beece044944bc1cba85aebc +folderAsset: yes +timeCreated: 1481126946 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs new file mode 100644 index 00000000..9bcddb3c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs @@ -0,0 +1,551 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Color", "Constants And Properties", "Color property", null, KeyCode.Alpha5 )] + public sealed class ColorNode : PropertyNode + { + private const string ColorSpaceStr = "Color Space"; + + [SerializeField] + [ColorUsage( true, true )] + private Color m_defaultValue = new Color( 0, 0, 0, 0 ); + + [SerializeField] + [ColorUsage( true, true )] + private Color m_materialValue = new Color( 0, 0, 0, 0 ); + + [SerializeField] + private bool m_isHDR = false; + + //[SerializeField] + //private ASEColorSpace m_colorSpace = ASEColorSpace.Auto; + private GUIContent m_dummyContent; + + private int m_cachedPropertyId = -1; + + private bool m_isEditingFields; + + [SerializeField] + private bool m_autoGammaToLinearConversion = true; + + [SerializeField] + private bool m_useAlpha = true; + + private const string AutoGammaToLinearConversion = "IsGammaSpace() ? {0} : {1}"; + private const string AutoGammaToLinearStr = "Auto Gamma To Linear"; + private const string ShowAlphaStr = "Use Alpha"; + + private Rect m_frameDrawPos0; + private Rect m_frameDrawPos1; + + public ColorNode() : base() { } + public ColorNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Color" ); + m_insideSize.Set( 100, 50 ); + m_dummyContent = new GUIContent(); + AddOutputColorPorts( m_useAlpha ? "RGBA" : "RGB", m_useAlpha, m_useAlpha ); + m_sortOutputPorts = true; + m_drawPreview = false; + m_drawPreviewExpander = false; + m_canExpand = false; + m_showHybridInstancedUI = true; + m_selectedLocation = PreviewLocation.BottomCenter; + m_previewShaderGUID = "6cf365ccc7ae776488ae8960d6d134c3"; + m_srpBatcherCompatible = true; + } + + void UpdateOutputPorts() + { + ChangeOutputProperties( 0, m_useAlpha ? "RGBA" : "RGB", m_useAlpha ? WirePortDataType.COLOR : WirePortDataType.FLOAT3, false ); + m_outputPorts[ 4 ].Visible = m_useAlpha; + m_outputPorts[ 5 ].Visible = m_useAlpha; + m_sizeIsDirty = true; + m_propertyNameIsDirty = true; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_cachedPropertyId == -1 ) + m_cachedPropertyId = Shader.PropertyToID( "_InputColor" ); + + if( m_materialMode && m_currentParameterType != PropertyType.Constant ) + PreviewMaterial.SetColor( m_cachedPropertyId, m_materialValue ); + else + PreviewMaterial.SetColor( m_cachedPropertyId, m_defaultValue ); + } + + public override void CopyDefaultsToMaterial() + { + m_materialValue = m_defaultValue; + } + + public override void DrawSubProperties() + { + m_textLabelWidth = ( m_currentParameterType == PropertyType.Constant ) ? 152 : 105; + + m_defaultValue = EditorGUILayoutColorField( Constants.DefaultValueLabelContent, m_defaultValue, false, m_useAlpha, m_isHDR, GUILayout.Height( 20 ) ); + + if ( m_currentParameterType == PropertyType.Constant ) + { + m_autoGammaToLinearConversion = EditorGUILayoutToggle( AutoGammaToLinearStr, m_autoGammaToLinearConversion ); + } + + EditorGUI.BeginChangeCheck(); + bool wasUsingAlpha = m_useAlpha; + m_useAlpha = EditorGUILayoutToggle( ShowAlphaStr, m_useAlpha ); + if ( EditorGUI.EndChangeCheck() ) + { + if ( wasUsingAlpha && m_outputPorts[ 5 ].IsConnected ) + { + WireReference connection = m_outputPorts[ 5 ].GetConnection(); + m_containerGraph.CreateConnection( connection.NodeId, connection.PortId, UniqueId, 0 ); + } + else if ( !wasUsingAlpha && m_outputPorts[ 0 ].IsConnected ) + { + WireReference connection = m_outputPorts[ 0 ].GetConnection(); + m_containerGraph.CreateConnection( connection.NodeId, connection.PortId, UniqueId, 5 ); + m_containerGraph.DeleteConnection( false, UniqueId, 0, true, false ); + } + + UpdateOutputPorts(); + } + } + + //public override void DrawMainPropertyBlock() + //{ + // EditorGUILayout.BeginVertical(); + // { + + // PropertyType parameterType = (PropertyType)EditorGUILayoutEnumPopup( ParameterTypeStr, m_currentParameterType ); + // if( parameterType != m_currentParameterType ) + // { + // ChangeParameterType( parameterType ); + // BeginPropertyFromInspectorCheck(); + // } + + // switch( m_currentParameterType ) + // { + // case PropertyType.Property: + // case PropertyType.InstancedProperty: + // { + // ShowPropertyInspectorNameGUI(); + // ShowPropertyNameGUI( true ); + // ShowVariableMode(); + // ShowPrecision(); + // ShowToolbar(); + // } + // break; + // case PropertyType.Global: + // { + // ShowPropertyInspectorNameGUI(); + // ShowPropertyNameGUI( false ); + // ShowVariableMode(); + // ShowPrecision(); + // ShowDefaults(); + // } + // break; + // case PropertyType.Constant: + // { + // ShowPropertyInspectorNameGUI(); + // ShowPrecision(); + // m_colorSpace = (ASEColorSpace)EditorGUILayoutEnumPopup( ColorSpaceStr, m_colorSpace ); + // ShowDefaults(); + // } + // break; + // } + // } + // EditorGUILayout.EndVertical(); + //} + + public override void DrawMaterialProperties() + { + if( m_materialMode ) + EditorGUI.BeginChangeCheck(); + m_materialValue = EditorGUILayoutColorField( Constants.MaterialValueLabelContent, m_materialValue, false, m_useAlpha, m_isHDR ); + if( m_materialMode && EditorGUI.EndChangeCheck() ) + m_requireMaterialUpdate = true; + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + + int maxWidth = 80; + + m_propertyDrawPos = m_globalPosition; + m_propertyDrawPos.x = m_remainingBox.x; + m_propertyDrawPos.y = m_remainingBox.y; + m_propertyDrawPos.width = maxWidth * drawInfo.InvertedZoom; + m_propertyDrawPos.height = Mathf.Min( m_remainingBox.height, ( ( maxWidth + ( m_useAlpha ? 20 : 0 ) ) * drawInfo.InvertedZoom ) ); + + m_frameDrawPos0 = new Rect( m_propertyDrawPos.x, m_propertyDrawPos.y - 1, m_propertyDrawPos.width + 1, m_propertyDrawPos.height + 1 ); + m_frameDrawPos1 = new Rect( m_propertyDrawPos.x, m_propertyDrawPos.y + m_propertyDrawPos.height - 1, m_propertyDrawPos.width, 1 ); + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if( drawInfo.CurrentEventType != EventType.MouseDown ) + return; + + Rect hitBox = m_remainingBox; + //hitBox.xMin -= LabelWidth * drawInfo.InvertedZoom; + bool insideBox = hitBox.Contains( drawInfo.MousePosition ); + + if( insideBox ) + { + m_isEditingFields = true; + } + else if( m_isEditingFields && !insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = false; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( !m_isVisible ) + return; + + if ( m_isEditingFields && m_currentParameterType != PropertyType.Global ) + { + if( m_materialMode && m_currentParameterType != PropertyType.Constant ) + { + EditorGUI.BeginChangeCheck(); + m_materialValue = EditorGUIColorField( m_propertyDrawPos, m_dummyContent, m_materialValue, false, m_useAlpha, m_isHDR ); + if( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + m_requireMaterialUpdate = true; + if( m_currentParameterType != PropertyType.Constant ) + { + BeginDelayedDirtyProperty(); + } + } + } + else + { + EditorGUI.BeginChangeCheck(); + m_defaultValue = EditorGUIColorField( m_propertyDrawPos, m_dummyContent, m_defaultValue, false, m_useAlpha, m_isHDR ); + if( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + BeginDelayedDirtyProperty(); + } + } + } + else if( drawInfo.CurrentEventType == EventType.Repaint ) + { + var value = ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? m_materialValue : m_defaultValue; + UIUtils.DrawColorSwatch( m_propertyDrawPos, value, m_useAlpha, m_isHDR ); + } + + GUI.Label( m_frameDrawPos0, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); + // @diogo: to prevent gaps in frame; thanks, Unity!... + EditorGUI.DrawRect( m_frameDrawPos1, Color.black ); + } + + public override void ConfigureLocalVariable( ref MasterNodeDataCollector dataCollector ) + { + Color color = m_defaultValue; + //switch( m_colorSpace ) + //{ + // default: + // case ASEColorSpace.Auto: color = m_defaultValue; break; + // case ASEColorSpace.Gamma: color = m_defaultValue.gamma; break; + // case ASEColorSpace.Linear: color = m_defaultValue.linear; break; + //} + + dataCollector.AddLocalVariable( UniqueId, CreateLocalVarDec( color.r + "," + color.g + "," + color.b + ( m_useAlpha ? "," + color.a : string.Empty ) ) ); + + m_outputPorts[ 0 ].SetLocalValue( m_propertyName , dataCollector.PortCategory); + m_outputPorts[ 1 ].SetLocalValue( m_propertyName + ".r", dataCollector.PortCategory ); + m_outputPorts[ 2 ].SetLocalValue( m_propertyName + ".g", dataCollector.PortCategory ); + m_outputPorts[ 3 ].SetLocalValue( m_propertyName + ".b", dataCollector.PortCategory ); + if ( m_useAlpha ) + { + m_outputPorts[ 4 ].SetLocalValue( m_propertyName + ".a", dataCollector.PortCategory ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + if( m_currentParameterType != PropertyType.Constant ) + return GetOutputVectorItem( 0, outputId, PropertyData( dataCollector.PortCategory ) ); + + // Constant Only Code + + if( m_outputPorts[ outputId ].IsLocalValue(dataCollector.PortCategory) ) + { + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + if( m_autoGammaToLinearConversion ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue(dataCollector.PortCategory) ); + + Color linear = m_defaultValue.linear; + + string colorGamma = m_precisionString + "(" + m_defaultValue.r + "," + m_defaultValue.g + "," + m_defaultValue.b + + ( m_useAlpha ? "," + m_defaultValue.a : string.Empty ) + ")"; + + string colorLinear = m_precisionString + "(" + linear.r + "," + linear.g + "," + linear.b + + ( m_useAlpha ? "," + m_defaultValue.a : string.Empty ) + ")"; + + string result = string.Format( AutoGammaToLinearConversion, colorGamma, colorLinear ); + RegisterLocalVariable( 0, result, ref dataCollector, "color" + OutputId ); + return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + else + { + if( CheckLocalVariable( ref dataCollector ) ) + { + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + + Color color = m_defaultValue; + //switch( m_colorSpace ) + //{ + // default: + // case ASEColorSpace.Auto: color = m_defaultValue; break; + // case ASEColorSpace.Gamma: color = m_defaultValue.gamma; break; + // case ASEColorSpace.Linear: color = m_defaultValue.linear; break; + //} + string result = string.Empty; + + switch( outputId ) + { + case 0: + { + result = m_precisionString + "(" + color.r + "," + color.g + "," + color.b + ( m_useAlpha ? "," + color.a : string.Empty ) + ")"; + } + break; + + case 1: + { + result = color.r.ToString(); + } + break; + case 2: + { + result = color.g.ToString(); + } + break; + case 3: + { + result = color.b.ToString(); + } + break; + case 4: + { + result = color.a.ToString(); + } + break; + } + return result; + } + } + + protected override void OnAtrributesChanged() + { + CheckIfHDR(); + CheckHeaderAttribute(); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + CheckIfHDR(); + } + + void CheckIfHDR() + { + int count = m_selectedAttribs.Count; + bool hdrBuffer = m_isHDR; + m_isHDR = false; + for( int i = 0; i < count; i++ ) + { + if( m_selectedAttribs[ i ] == 1 /*HDR Property ID*/) + { + m_isHDR = true; + break; + } + } + + if( hdrBuffer && !m_isHDR ) + { + bool fireDirtyProperty = false; + + if( m_defaultValue.r > 1 || m_defaultValue.g > 1 || m_defaultValue.b > 1 ) + { + float defaultColorLength = Mathf.Sqrt( m_defaultValue.r * m_defaultValue.r + m_defaultValue.g * m_defaultValue.g + m_defaultValue.b * m_defaultValue.b ); + m_defaultValue.r /= defaultColorLength; + m_defaultValue.g /= defaultColorLength; + m_defaultValue.b /= defaultColorLength; + fireDirtyProperty = true; + } + + if( m_materialValue.r > 1 || m_materialValue.g > 1 || m_materialValue.b > 1 ) + { + float materialColorLength = Mathf.Sqrt( m_materialValue.r * m_materialValue.r + m_materialValue.g * m_materialValue.g + m_materialValue.b * m_materialValue.b ); + m_materialValue.r /= materialColorLength; + m_materialValue.g /= materialColorLength; + m_materialValue.b /= materialColorLength; + fireDirtyProperty = true; + } + + if( fireDirtyProperty ) + BeginDelayedDirtyProperty(); + } + } + + public override string GetPropertyValue() + { + string r = UIUtils.PropertyFloatToString( m_defaultValue.r ); + string g = UIUtils.PropertyFloatToString( m_defaultValue.g ); + string b = UIUtils.PropertyFloatToString( m_defaultValue.b ); + string a = UIUtils.PropertyFloatToString( m_defaultValue.a ); + return PropertyAttributes + m_propertyName + "(\"" + m_propertyInspectorName + "\", Color) = (" + r + "," + g + "," + b + + ( m_useAlpha ? "," + a : string.Empty ) + ")"; + } + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + + if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) + { + mat.SetColor( m_propertyName, m_materialValue ); + } + } + + public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) + { + base.SetMaterialMode( mat, fetchMaterialValues ); + if( m_materialMode && fetchMaterialValues ) + { + if( UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) + MaterialValue = mat.GetColor( m_propertyName ); + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) + { + MaterialValue = material.GetColor( m_propertyName ); + PreviewIsDirty = true; + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_defaultValue = IOUtils.StringToColor( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 14101 ) + { + m_materialValue = IOUtils.StringToColor( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 15900 ) + { + m_autoGammaToLinearConversion = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + else + { + m_autoGammaToLinearConversion = false; + } + + if ( UIUtils.CurrentShaderVersion() >= 19500 ) + { + m_useAlpha = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + else + { + m_useAlpha = true; + } + UpdateOutputPorts(); + + //if( UIUtils.CurrentShaderVersion() > 14202 ) + //{ + // m_colorSpace = (ASEColorSpace)Enum.Parse( typeof( ASEColorSpace ), GetCurrentParam( ref nodeParams ) ); + //} + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.ColorToString( m_defaultValue ) ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.ColorToString( m_materialValue ) ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_autoGammaToLinearConversion ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_useAlpha ); + //IOUtils.AddFieldValueToString( ref nodeInfo, m_colorSpace ); + } + + public override void SetGlobalValue() { Shader.SetGlobalColor( m_propertyName, m_defaultValue ); } + public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalColor( m_propertyName ); } + + public override string GetPropertyValStr() + { + if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) + { + return m_materialValue.r.ToString( Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_materialValue.g.ToString( Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_materialValue.b.ToString( Constants.PropertyVectorFormatLabel ) + + ( m_useAlpha ? IOUtils.VECTOR_SEPARATOR + m_materialValue.a.ToString( Constants.PropertyVectorFormatLabel ) : string.Empty ); + } + else + { + return m_defaultValue.r.ToString( Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_defaultValue.g.ToString( Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_defaultValue.b.ToString( Constants.PropertyVectorFormatLabel ) + + ( m_useAlpha ? IOUtils.VECTOR_SEPARATOR + m_defaultValue.a.ToString( Constants.PropertyVectorFormatLabel ) : string.Empty ); + } + } + + private Color MaterialValue + { + set + { + if( !m_isHDR && ( value.r > 1 || value.g > 1 || value.r > 1 ) ) + { + float materialColorLength = Mathf.Sqrt( value.r * value.r + value.g * value.g + value.b * value.b ); + m_materialValue.r = value.r / materialColorLength; + m_materialValue.g = value.g / materialColorLength; + m_materialValue.b = value.b / materialColorLength; + m_materialValue.a = value.a; + } + else + { + m_materialValue = value; + } + } + } + + public Color Value + { + get { return m_defaultValue; } + set { m_defaultValue = value; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs.meta new file mode 100644 index 00000000..37c4afd3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4b99bcf4cd965c648bbbc1de0d1b152a +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs new file mode 100644 index 00000000..1e6b924c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs @@ -0,0 +1,489 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Global Array +// Donated by Johann van Berkel + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Global Array" , "Constants And Properties" , "The node returns a value from a global array, which you can configure by entering the name of the array in the node's settings." , null , KeyCode.None , true , false , null , null , "Johann van Berkel" )] + public sealed class GlobalArrayNode : ParentNode + { + private const string DefaultArrayName = "MyGlobalArray"; + private const string TypeStr = "Type"; + private const string AutoRangeCheckStr = "Range Check"; + private const string ArrayFormatStr = "{0}[{1}]"; + private const string JaggedArrayFormatStr = "{0}[{1}][{2}]"; + private const string IsJaggedStr = "Is Jagged"; + private const string AutoRegisterStr = "Auto-Register"; + + private readonly string[] AvailableTypesLabel = { "Float" , "Color" , "Vector4" , "Matrix4x4" }; + private readonly WirePortDataType[] AvailableTypesValues = { WirePortDataType.FLOAT , WirePortDataType.COLOR , WirePortDataType.FLOAT4 , WirePortDataType.FLOAT4x4 }; + + [SerializeField] + private string m_name = DefaultArrayName; + + [SerializeField] + private int m_indexX = 0; + + [SerializeField] + private int m_indexY = 0; + + [SerializeField] + private int m_arrayLengthX = 1; + + [SerializeField] + private int m_arrayLengthY = 1; + + [SerializeField] + private int m_type = 0; + + [SerializeField] + private bool m_autoRangeCheck = false; + + [SerializeField] + private bool m_isJagged = false; + + [SerializeField] + private bool m_autoRegister = false; + + ////////////////////////////////////////////////////////////////// + private readonly Color ReferenceHeaderColor = new Color( 0.6f , 3.0f , 1.25f , 1.0f ); + + [SerializeField] + private TexReferenceType m_referenceType = TexReferenceType.Object; + + [SerializeField] + private int m_referenceArrayId = -1; + + [SerializeField] + private int m_referenceNodeId = -1; + + private GlobalArrayNode m_referenceNode = null; + + private bool m_updated = false; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + + AddInputPort( WirePortDataType.INT , false , "Index" , -1 , MasterNodePortCategory.Fragment , 0 ); + AddInputPort( WirePortDataType.INT , false , "Index Y" , -1 , MasterNodePortCategory.Fragment , 2 ); + AddInputPort( WirePortDataType.INT , false , "Array Length" , -1 , MasterNodePortCategory.Fragment , 1 ); + AddInputPort( WirePortDataType.INT , false , "Array Length Y" , -1 , MasterNodePortCategory.Fragment , 3 ); + + AddOutputPort( WirePortDataType.FLOAT , "Out" ); + + m_textLabelWidth = 95; + m_autoWrapProperties = true; + SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr , m_name ) ); + UpdatePorts(); + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + UIUtils.CurrentWindow.OutsideGraph.GlobalArrayNodes.AddNode( this ); + } + + public override void Destroy() + { + base.Destroy(); + UIUtils.CurrentWindow.OutsideGraph.GlobalArrayNodes.RemoveNode( this ); + } + + void UpdatePorts() + { + InputPort indexXPort = GetInputPortByUniqueId( 0 ); + InputPort arrayLengthPortX = GetInputPortByUniqueId( 1 ); + InputPort indexYPort = GetInputPortByUniqueId( 2 ); + InputPort arrayLengthPortY = GetInputPortByUniqueId( 3 ); + if( m_referenceType == TexReferenceType.Object ) + { + m_headerColorModifier = Color.white; + SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr , m_name ) ); + arrayLengthPortX.Visible = true; + if( m_isJagged ) + { + indexXPort.Name = "Index X"; + arrayLengthPortX.Name = "Array Length X"; + indexYPort.Visible = true; + arrayLengthPortY.Visible = true; + } + else + { + indexXPort.Name = "Index"; + arrayLengthPortX.Name = "Array Length"; + indexYPort.Visible = false; + arrayLengthPortY.Visible = false; + } + } + else if( m_referenceNodeId > -1 ) + { + m_headerColorModifier = ReferenceHeaderColor; + if( m_referenceNode == null ) + m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as GlobalArrayNode; + + if( m_referenceNode != null ) + { + SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr , m_referenceNode.DataToArray ) ); + arrayLengthPortX.Visible = false; + arrayLengthPortY.Visible = false; + if( m_referenceNode.IsJagged ) + { + indexXPort.Name = "Index X"; + indexYPort.Visible = true; + } + else + { + indexXPort.Name = "Index"; + indexYPort.Visible = false; + } + } + } + m_sizeIsDirty = true; + } + + void DrawObjectProperties() + { + EditorGUI.BeginChangeCheck(); + m_name = EditorGUILayoutStringField( "Name" , m_name ); + if( EditorGUI.EndChangeCheck() ) + { + m_updated = true; + m_name = UIUtils.RemoveInvalidCharacters( m_name ); + if( string.IsNullOrEmpty( m_name ) ) + m_name = DefaultArrayName; + UIUtils.UpdateGlobalArrayDataNode( UniqueId , m_name ); + SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr , m_name ) ); + } + + + m_autoRegister = EditorGUILayoutToggle( AutoRegisterStr , m_autoRegister ); + + EditorGUI.BeginChangeCheck(); + m_isJagged = EditorGUILayoutToggle( IsJaggedStr , m_isJagged ); + if( EditorGUI.EndChangeCheck() ) + { + m_updated = true; + UpdatePorts(); + } + + InputPort indexXPort = GetInputPortByUniqueId( 0 ); + if( !indexXPort.IsConnected ) + { + EditorGUI.BeginChangeCheck(); + m_indexX = EditorGUILayoutIntField( indexXPort.Name , m_indexX ); + if( EditorGUI.EndChangeCheck() ) + { + m_indexX = Mathf.Clamp( m_indexX , 0 , ( ArrayLengthX - 1 ) ); + } + } + + if( m_isJagged ) + { + InputPort indexYPort = GetInputPortByUniqueId( 2 ); + if( !indexYPort.IsConnected ) + { + EditorGUI.BeginChangeCheck(); + m_indexY = EditorGUILayoutIntField( indexYPort.Name , m_indexY ); + if( EditorGUI.EndChangeCheck() ) + { + m_indexY = Mathf.Clamp( m_indexY , 0 , ( ArrayLengthY - 1 ) ); + } + } + } + + InputPort arrayLengthXPort = GetInputPortByUniqueId( 1 ); + if( !arrayLengthXPort.IsConnected ) + { + EditorGUI.BeginChangeCheck(); + m_arrayLengthX = EditorGUILayoutIntField( arrayLengthXPort.Name , m_arrayLengthX ); + if( EditorGUI.EndChangeCheck() ) + { + m_arrayLengthX = Mathf.Max( 1 , m_arrayLengthX ); + } + } + + if( m_isJagged ) + { + InputPort arrayLengthYPort = GetInputPortByUniqueId( 3 ); + if( !arrayLengthYPort.IsConnected ) + { + EditorGUI.BeginChangeCheck(); + m_arrayLengthY = EditorGUILayoutIntField( arrayLengthYPort.Name , m_arrayLengthY ); + if( EditorGUI.EndChangeCheck() ) + { + m_arrayLengthY = Mathf.Max( 1 , m_arrayLengthY ); + } + } + } + + EditorGUI.BeginChangeCheck(); + m_type = EditorGUILayoutPopup( TypeStr , m_type , AvailableTypesLabel ); + if( EditorGUI.EndChangeCheck() ) + { + m_outputPorts[ 0 ].ChangeType( (WirePortDataType)AvailableTypesValues[ m_type ] , false ); + } + + m_autoRangeCheck = EditorGUILayoutToggle( AutoRangeCheckStr , m_autoRangeCheck ); + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + m_updated = false; + if( m_referenceType == TexReferenceType.Instance ) + { + if( m_referenceNodeId > -1 && m_referenceNode == null ) + { + m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as GlobalArrayNode; + if( m_referenceNode == null ) + { + m_referenceNodeId = -1; + } + } + if( m_referenceNode != null && m_referenceNode.Updated ) + { + UpdatePorts(); + } + } + } + + void DrawInstancedProperties() + { + string[] arr = UIUtils.GlobalArrayNodeArr(); + bool guiEnabledBuffer = GUI.enabled; + if( arr != null && arr.Length > 0 ) + { + GUI.enabled = true; + } + else + { + m_referenceArrayId = -1; + m_referenceNodeId = -1; + m_referenceNode = null; + GUI.enabled = false; + } + EditorGUI.BeginChangeCheck(); + m_referenceArrayId = EditorGUILayoutPopup( Constants.AvailableReferenceStr , m_referenceArrayId , arr ); + if( EditorGUI.EndChangeCheck() ) + { + m_referenceNode = UIUtils.GetGlobalArrayNode( m_referenceArrayId ); + if( m_referenceNode != null ) + { + m_referenceNodeId = m_referenceNode.UniqueId; + } + UpdatePorts(); + } + + GUI.enabled = guiEnabledBuffer; + + InputPort indexXPort = GetInputPortByUniqueId( 0 ); + if( !indexXPort.IsConnected ) + { + EditorGUI.BeginChangeCheck(); + m_indexX = EditorGUILayoutIntField( indexXPort.Name , m_indexX ); + if( EditorGUI.EndChangeCheck() ) + { + m_indexX = Mathf.Clamp( m_indexX , 0 , ( ArrayLengthX - 1 ) ); + } + } + + if( m_isJagged ) + { + InputPort indexYPort = GetInputPortByUniqueId( 2 ); + if( !indexYPort.IsConnected ) + { + EditorGUI.BeginChangeCheck(); + m_indexY = EditorGUILayoutIntField( indexYPort.Name , m_indexY ); + if( EditorGUI.EndChangeCheck() ) + { + m_indexY = Mathf.Clamp( m_indexY , 0 , ( ArrayLengthY - 1 ) ); + } + } + } + } + + public override void DrawProperties() + { + EditorGUI.BeginChangeCheck(); + m_referenceType = (TexReferenceType)EditorGUILayoutPopup( Constants.ReferenceTypeStr , (int)m_referenceType , Constants.ReferenceArrayLabels ); + if( EditorGUI.EndChangeCheck() ) + { + UpdatePorts(); + } + + if( m_referenceType == TexReferenceType.Object ) + DrawObjectProperties(); + else + DrawInstancedProperties(); + } + + public string GetArrayValue( string indexX , string indexY = null ) + { + if( m_isJagged ) + return string.Format( JaggedArrayFormatStr , m_name , indexX , indexY ); + + return string.Format( ArrayFormatStr , m_name , indexX ); + } + + public string GenerateInstancedShaderForOutput( int outputId , ref MasterNodeDataCollector dataCollector , bool ignoreLocalvar ) + { + string result = string.Empty; + if( m_referenceNode != null ) + { + InputPort indexXPort = GetInputPortByUniqueId( 0 ); + if( m_referenceNode.IsJagged ) + { + InputPort indexYPort = GetInputPortByUniqueId( 2 ); + string arrayIndexX = indexXPort.IsConnected ? indexXPort.GeneratePortInstructions( ref dataCollector ) : m_indexX.ToString(); + string arrayIndexY = indexYPort.IsConnected ? indexYPort.GeneratePortInstructions( ref dataCollector ) : m_indexY.ToString(); + result = m_referenceNode.GetArrayValue( arrayIndexX , arrayIndexY ); + } + else + { + string arrayIndexX = indexXPort.IsConnected ? indexXPort.GeneratePortInstructions( ref dataCollector ) : m_indexX.ToString(); + result = m_referenceNode.GetArrayValue( arrayIndexX ); + } + } + m_outputPorts[ 0 ].SetLocalValue( result , dataCollector.PortCategory ); + return result; + } + + public override string GenerateShaderForOutput( int outputId , ref MasterNodeDataCollector dataCollector , bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + if( m_referenceType == TexReferenceType.Instance ) + return GenerateInstancedShaderForOutput( outputId , ref dataCollector , ignoreLocalvar ); + + string dataType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType , AvailableTypesValues[ m_type ] ); + + InputPort indexXPort = GetInputPortByUniqueId( 0 ); + InputPort arrayLengthXPort = GetInputPortByUniqueId( 1 ); + string result = string.Empty; + + if( m_isJagged ) + { + InputPort indexYPort = GetInputPortByUniqueId( 2 ); + InputPort arrayLengthYPort = GetInputPortByUniqueId( 3 ); + + string arrayIndexX = indexXPort.IsConnected ? indexXPort.GeneratePortInstructions( ref dataCollector ) : m_indexX.ToString(); + string arrayLengthX = arrayLengthXPort.IsConnected ? arrayLengthXPort.GeneratePortInstructions( ref dataCollector ) : ArrayLengthX.ToString(); + + string arrayIndexY = indexYPort.IsConnected ? indexYPort.GeneratePortInstructions( ref dataCollector ) : m_indexY.ToString(); + string arrayLengthY = arrayLengthYPort.IsConnected ? arrayLengthYPort.GeneratePortInstructions( ref dataCollector ) : ArrayLengthY.ToString(); + + dataCollector.AddToUniforms( UniqueId , dataType , string.Format( JaggedArrayFormatStr , m_name , arrayLengthX , arrayLengthY ) ); + if( m_autoRangeCheck ) + { + arrayIndexX = string.Format( "clamp({0},0,({1} - 1))" , arrayIndexX , arrayLengthX ); + arrayIndexY = string.Format( "clamp({0},0,({1} - 1))" , arrayIndexY , arrayLengthY ); + } + result = string.Format( JaggedArrayFormatStr , m_name , arrayIndexX , arrayIndexY ); + } + else + { + + string arrayIndex = indexXPort.IsConnected ? indexXPort.GeneratePortInstructions( ref dataCollector ) : m_indexX.ToString(); + string arrayLength = arrayLengthXPort.IsConnected ? arrayLengthXPort.GeneratePortInstructions( ref dataCollector ) : ArrayLengthX.ToString(); + + + dataCollector.AddToUniforms( UniqueId , dataType , string.Format( ArrayFormatStr , m_name , arrayLength ) ); + + if( m_autoRangeCheck ) + arrayIndex = string.Format( "clamp({0},0,({1} - 1))" , arrayIndex , arrayLength ); + + result = string.Format( ArrayFormatStr , m_name , arrayIndex ); + } + + m_outputPorts[ 0 ].SetLocalValue( result , dataCollector.PortCategory ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public void CheckIfAutoRegister( ref MasterNodeDataCollector dataCollector ) + { + if( m_referenceType == TexReferenceType.Object && m_autoRegister && m_connStatus != NodeConnectionStatus.Connected ) + { + string dataType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType , AvailableTypesValues[ m_type ] ); + if( m_isJagged ) + { + dataCollector.AddToUniforms( UniqueId , dataType , string.Format( JaggedArrayFormatStr , m_name , ArrayLengthX , ArrayLengthY ) ); + } + else + { + dataCollector.AddToUniforms( UniqueId , dataType , string.Format( ArrayFormatStr , m_name , ArrayLengthX ) ); + } + } + } + + public override void WriteToString( ref string nodeInfo , ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo , ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_name ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_indexX ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_arrayLengthX ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_type ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_autoRangeCheck ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_isJagged ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_indexY ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_arrayLengthY ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_autoRegister ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_referenceType ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_referenceNodeId ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_name = GetCurrentParam( ref nodeParams ); + m_indexX = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_arrayLengthX = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_type = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_autoRangeCheck = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 15801 ) + { + m_isJagged = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_indexY = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_arrayLengthY = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_autoRegister = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_referenceType = (TexReferenceType)Enum.Parse( typeof( TexReferenceType ) , GetCurrentParam( ref nodeParams ) ); + m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr , m_name ) ); + UpdatePorts(); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( m_referenceType == TexReferenceType.Instance && m_referenceNodeId > -1 ) + { + m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as GlobalArrayNode; + if( m_referenceNode != null ) + { + m_referenceArrayId = UIUtils.GetGlobalArrayNodeRegisterId( m_referenceNodeId ); + UpdatePorts(); + } + else + { + m_referenceNodeId = -1; + } + } + } + public int ArrayLengthX { get { return ( m_referenceNode != null ) ? m_referenceNode.ArrayLengthX : m_arrayLengthX; } } + public int ArrayLengthY { get { return ( m_referenceNode != null ) ? m_referenceNode.ArrayLengthY : m_arrayLengthY; } } + + public bool AutoRegister { get { return m_autoRegister; } } + public bool IsJagged { get { return m_isJagged; } } + public bool Updated { get { return m_updated; } } + public override string DataToArray { get { return m_name; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs.meta new file mode 100644 index 00000000..cbe14796 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 833b18e1479dbd24c80c5b990e16e2bb +timeCreated: 1499769855 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs new file mode 100644 index 00000000..4e1b503e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs @@ -0,0 +1,206 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using System.Reflection; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Gradient", "Constants And Properties", "Gradient property" )] + public sealed class GradientNode : ParentNode + { + [SerializeField] + private Gradient m_gradient = new Gradient(); + + private string m_functionHeader = "NewGradient( {0}, {1}, {2}," + + " {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}," + + " {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18} )"; + private string m_functionBody = string.Empty; + + private string m_functionHeaderStruct = "Gradient( {0} )"; + private string m_functionBodyStruct = string.Empty; + + public Gradient Gradient { get { return m_gradient; } } + + public GradientNode() : base() { } + public GradientNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_insideSize.Set( 128, m_insideSize.y ); + AddOutputPort( WirePortDataType.OBJECT, Constants.EmptyPortValue ); + m_autoWrapProperties = true; + m_textLabelWidth = 100; + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + { + m_gradient = EditorGUILayoutEx.GradientField( "Gradient" , m_gradient ); + } + if( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( !m_isVisible ) + return; + + EditorGUI.BeginChangeCheck(); + { + m_gradient = EditorGUIEx.GradientField( m_remainingBox , m_gradient ); + } + if( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + m_functionBodyStruct = string.Empty; + m_functionBody = string.Empty; + if( !dataCollector.IsSRP ) + { + GenerateGradientStruct( ref m_functionBodyStruct ); + dataCollector.AddFunctions( m_functionHeaderStruct, m_functionBodyStruct, "0" ); + GenerateGradient( ref m_functionBody ); + } + else + { + dataCollector.AddToIncludes( UniqueId, "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" ); + } + + string[] colors = new string[ 8 ]; + for( int i = 0; i < 8; i++ ) + { + if( i < m_gradient.colorKeys.Length ) + { + colors[ i ] = "float4( " + m_gradient.colorKeys[ i ].color.r + ", " + m_gradient.colorKeys[ i ].color.g + ", " + m_gradient.colorKeys[ i ].color.b + ", " + m_gradient.colorKeys[ i ].time + " )"; + } + else + { + colors[ i ] = "0"; + } + } + + string[] alphas = new string[ 8 ]; + for( int i = 0; i < 8; i++ ) + { + if( i < m_gradient.alphaKeys.Length ) + { + alphas[ i ] = "float2( " + m_gradient.alphaKeys[ i ].alpha + ", " + m_gradient.alphaKeys[ i ].time + " )"; + } + else + { + alphas[ i ] = "0"; + } + } + + string functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, (int)m_gradient.mode, m_gradient.colorKeys.Length, m_gradient.alphaKeys.Length + , colors[ 0 ], colors[ 1 ], colors[ 2 ], colors[ 3 ], colors[ 4 ], colors[ 5 ], colors[ 6 ], colors[ 7 ] + , alphas[ 0 ], alphas[ 1 ], alphas[ 2 ], alphas[ 3 ], alphas[ 4 ], alphas[ 5 ], alphas[ 6 ], alphas[ 7 ] ); + + dataCollector.AddLocalVariable( UniqueId, "Gradient gradient" + OutputId + " = " + functionResult + ";" ); + + return "gradient" + OutputId; + } + + public static void GenerateGradientStruct( ref string body ) + { + body = string.Empty; + IOUtils.AddFunctionHeader( ref body, "struct Gradient" ); + IOUtils.AddFunctionLine( ref body, "int type;" ); + IOUtils.AddFunctionLine( ref body, "int colorsLength;" ); + IOUtils.AddFunctionLine( ref body, "int alphasLength;" ); + IOUtils.AddFunctionLine( ref body, "float4 colors[8];" ); + IOUtils.AddFunctionLine( ref body, "float2 alphas[8];" ); + IOUtils.AddSingleLineFunction( ref body, "};\n" ); + } + + public static void GenerateGradient( ref string body ) + { + body = string.Empty; + IOUtils.AddFunctionHeader( ref body, "Gradient NewGradient(int type, int colorsLength, int alphasLength, \n\t\tfloat4 colors0, float4 colors1, float4 colors2, float4 colors3, float4 colors4, float4 colors5, float4 colors6, float4 colors7,\n\t\tfloat2 alphas0, float2 alphas1, float2 alphas2, float2 alphas3, float2 alphas4, float2 alphas5, float2 alphas6, float2 alphas7)" ); + IOUtils.AddFunctionLine( ref body, "Gradient g;" ); + IOUtils.AddFunctionLine( ref body, "g.type = type;" ); + IOUtils.AddFunctionLine( ref body, "g.colorsLength = colorsLength;" ); + IOUtils.AddFunctionLine( ref body, "g.alphasLength = alphasLength;" ); + IOUtils.AddFunctionLine( ref body, "g.colors[ 0 ] = colors0;" ); + IOUtils.AddFunctionLine( ref body, "g.colors[ 1 ] = colors1;" ); + IOUtils.AddFunctionLine( ref body, "g.colors[ 2 ] = colors2;" ); + IOUtils.AddFunctionLine( ref body, "g.colors[ 3 ] = colors3;" ); + IOUtils.AddFunctionLine( ref body, "g.colors[ 4 ] = colors4;" ); + IOUtils.AddFunctionLine( ref body, "g.colors[ 5 ] = colors5;" ); + IOUtils.AddFunctionLine( ref body, "g.colors[ 6 ] = colors6;" ); + IOUtils.AddFunctionLine( ref body, "g.colors[ 7 ] = colors7;" ); + IOUtils.AddFunctionLine( ref body, "g.alphas[ 0 ] = alphas0;" ); + IOUtils.AddFunctionLine( ref body, "g.alphas[ 1 ] = alphas1;" ); + IOUtils.AddFunctionLine( ref body, "g.alphas[ 2 ] = alphas2;" ); + IOUtils.AddFunctionLine( ref body, "g.alphas[ 3 ] = alphas3;" ); + IOUtils.AddFunctionLine( ref body, "g.alphas[ 4 ] = alphas4;" ); + IOUtils.AddFunctionLine( ref body, "g.alphas[ 5 ] = alphas5;" ); + IOUtils.AddFunctionLine( ref body, "g.alphas[ 6 ] = alphas6;" ); + IOUtils.AddFunctionLine( ref body, "g.alphas[ 7 ] = alphas7;" ); + IOUtils.AddFunctionLine( ref body, "return g;" ); + IOUtils.CloseFunctionBody( ref body ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_gradient.mode = (GradientMode)Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + int colorCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + int alphaCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + + var colorKeys = new GradientColorKey[ colorCount ]; + for( int i = 0; i < colorCount; i++ ) + { + Vector4 colorKey = IOUtils.StringToVector4( GetCurrentParam( ref nodeParams ) ); + colorKeys[ i ].color = colorKey; + colorKeys[ i ].time = colorKey.w; + } + m_gradient.colorKeys = colorKeys; + + var alphaKeys = new GradientAlphaKey[ alphaCount ]; + for( int i = 0; i < alphaCount; i++ ) + { + Vector2 alphaKey = IOUtils.StringToVector2( GetCurrentParam( ref nodeParams ) ); + alphaKeys[ i ].alpha = alphaKey.x; + alphaKeys[ i ].time = alphaKey.y; + } + m_gradient.alphaKeys = alphaKeys; + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, (int)m_gradient.mode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_gradient.colorKeys.Length ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_gradient.alphaKeys.Length ); + + for( int i = 0; i < m_gradient.colorKeys.Length; i++ ) + { + Vector4 colorKey = new Vector4( m_gradient.colorKeys[ i ].color.r, m_gradient.colorKeys[ i ].color.g, m_gradient.colorKeys[ i ].color.b, m_gradient.colorKeys[ i ].time ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector4ToString( colorKey ) ); + } + + for( int i = 0; i < m_gradient.alphaKeys.Length; i++ ) + { + Vector2 alphaKey = new Vector4( m_gradient.alphaKeys[ i ].alpha, m_gradient.alphaKeys[ i ].time ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector2ToString( alphaKey ) ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs.meta new file mode 100644 index 00000000..acbd3d18 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 98100a8a545b8ce42bc5657fd40a24a5 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs new file mode 100644 index 00000000..f90df632 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs @@ -0,0 +1,300 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Int", "Constants And Properties", "Int property", null, KeyCode.Alpha0 )] + public sealed class IntNode : PropertyNode + { + [SerializeField] + private int m_defaultValue; + + [SerializeField] + private int m_materialValue; + + [SerializeField] + private bool m_setAsUINT = false; + + private const float LabelWidth = 8; + + private int m_cachedPropertyId = -1; + + private bool m_isEditingFields; + private int m_previousValue; + private string m_fieldText = "0"; + + public IntNode() : base() { } + public IntNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Int" ); + AddOutputPort( WirePortDataType.INT, Constants.EmptyPortValue ); + m_insideSize.Set( 50, 10 ); + m_selectedLocation = PreviewLocation.BottomCenter; + m_drawPrecisionUI = false; + m_showHybridInstancedUI = true; + m_availableAttribs.Add( new PropertyAttributes( "Enum", "[Enum]" ) ); + m_previewShaderGUID = "0f64d695b6ffacc469f2dd31432a232a"; + m_srpBatcherCompatible = true; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + UIUtils.RegisterFloatIntNode( this ); + } + + public override void Destroy() + { + base.Destroy(); + UIUtils.UnregisterFloatIntNode( this ); + } + + public override void OnDirtyProperty() + { + UIUtils.UpdateFloatIntDataNode( UniqueId, PropertyInspectorName ); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + OnPropertyNameChanged(); + OnDirtyProperty(); + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_cachedPropertyId == -1 ) + m_cachedPropertyId = Shader.PropertyToID( "_InputInt" ); + + if( m_materialMode && m_currentParameterType != PropertyType.Constant ) + PreviewMaterial.SetInt( m_cachedPropertyId, m_materialValue ); + else + PreviewMaterial.SetInt( m_cachedPropertyId, m_defaultValue ); + } + + + public override void CopyDefaultsToMaterial() + { + m_materialValue = m_defaultValue; + DrawSetAsUINT(); + } + + public override void DrawSubProperties() + { + m_defaultValue = EditorGUILayoutIntField( Constants.DefaultValueLabel, m_defaultValue ); + DrawSetAsUINT(); + } + + private void DrawSetAsUINT() + { + EditorGUI.BeginChangeCheck(); + m_setAsUINT = EditorGUILayoutToggle( "Set as UINT", m_setAsUINT ); + if( EditorGUI.EndChangeCheck() ) + { + WirePortDataType portType = m_setAsUINT ? WirePortDataType.UINT : WirePortDataType.INT; + m_outputPorts[ 0 ].ChangeType( portType, false ); + } + } + + public override void DrawMaterialProperties() + { + if( m_materialMode ) + EditorGUI.BeginChangeCheck(); + + m_materialValue = EditorGUILayoutIntField( Constants.MaterialValueLabel, m_materialValue ); + + if( m_materialMode && EditorGUI.EndChangeCheck() ) + { + m_requireMaterialUpdate = true; + } + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + + m_propertyDrawPos = m_remainingBox; + m_propertyDrawPos.x = m_remainingBox.x - LabelWidth * drawInfo.InvertedZoom; + m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; + m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if( drawInfo.CurrentEventType != EventType.MouseDown ) + return; + + Rect hitBox = m_remainingBox; + hitBox.xMin -= LabelWidth * drawInfo.InvertedZoom; + bool insideBox = hitBox.Contains( drawInfo.MousePosition ); + + if( insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = true; + } + else if( m_isEditingFields && !insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = false; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( !m_isVisible ) + return; + + if( m_isEditingFields && m_currentParameterType != PropertyType.Global ) + { + float labelWidth = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = LabelWidth * drawInfo.InvertedZoom; + + if( m_materialMode && m_currentParameterType != PropertyType.Constant ) + { + EditorGUI.BeginChangeCheck(); + m_materialValue = EditorGUIIntField( m_propertyDrawPos, " ", m_materialValue, UIUtils.MainSkin.textField ); + if( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + m_requireMaterialUpdate = true; + if( m_currentParameterType != PropertyType.Constant ) + BeginDelayedDirtyProperty(); + } + } + else + { + EditorGUI.BeginChangeCheck(); + + m_defaultValue = EditorGUIIntField( m_propertyDrawPos, " ", m_defaultValue, UIUtils.MainSkin.textField ); + + if( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + BeginDelayedDirtyProperty(); + } + } + EditorGUIUtility.labelWidth = labelWidth; + } + else if( drawInfo.CurrentEventType == EventType.Repaint ) + { + bool guiEnabled = GUI.enabled; + GUI.enabled = m_currentParameterType != PropertyType.Global; + Rect fakeField = m_propertyDrawPos; + fakeField.xMin += LabelWidth * drawInfo.InvertedZoom; + if( GUI.enabled ) + { + Rect fakeLabel = m_propertyDrawPos; + fakeLabel.xMax = fakeField.xMin; + EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); + EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); + } + bool currMode = m_materialMode && m_currentParameterType != PropertyType.Constant; + int value = currMode ? m_materialValue : m_defaultValue; + + if( m_previousValue != value ) + { + m_previousValue = value; + m_fieldText = value.ToString(); + } + + GUI.Label( fakeField, m_fieldText, UIUtils.MainSkin.textField ); + GUI.enabled = guiEnabled; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + + if( m_currentParameterType != PropertyType.Constant ) + return PropertyData( dataCollector.PortCategory ); + + return m_defaultValue.ToString(); + } + + public override string GetPropertyValue() + { + return PropertyAttributes + m_propertyName + "(\"" + m_propertyInspectorName + "\", Int) = " + m_defaultValue; + } + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) + { + mat.SetInt( m_propertyName, m_materialValue ); + } + } + + public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) + { + base.SetMaterialMode( mat, fetchMaterialValues ); + if( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) + { + m_materialValue = mat.GetInt( m_propertyName ); + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) + { + m_materialValue = material.GetInt( m_propertyName ); + PreviewIsDirty = true; + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_defaultValue = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 14101 ) + m_materialValue = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 18500 ) + m_setAsUINT = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_materialValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_setAsUINT ); + } + + public override string GetPropertyValStr() + { + return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? + m_materialValue.ToString( Mathf.Abs( m_materialValue ) > 1000 ? Constants.PropertyBigIntFormatLabel : Constants.PropertyIntFormatLabel ) : + m_defaultValue.ToString( Mathf.Abs( m_defaultValue ) > 1000 ? Constants.PropertyBigIntFormatLabel : Constants.PropertyIntFormatLabel ); + } + + public override void SetGlobalValue() { Shader.SetGlobalInt( m_propertyName, m_defaultValue ); } + public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalInt( m_propertyName ); } + public int Value + { + get { return m_defaultValue; } + set { m_defaultValue = value; } + } + + public void SetMaterialValueFromInline( int val ) + { + m_materialValue = val; + m_requireMaterialUpdate = true; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs.meta new file mode 100644 index 00000000..582ba56b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 86df2da3da3b1eb4493b968b47030b17 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs new file mode 100644 index 00000000..e86bae59 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs @@ -0,0 +1,262 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Matrix3X3", "Constants And Properties", "Matrix3X3 property" )] + public sealed class Matrix3X3Node : MatrixParentNode + { + private string[,] m_fieldText = new string[ 3, 3 ] { { "0", "0", "0" }, { "0", "0", "0" }, { "0", "0", "0" } }; + public Matrix3X3Node() : base() { } + public Matrix3X3Node( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Matrix" ); + AddOutputPort( WirePortDataType.FLOAT3x3, Constants.EmptyPortValue ); + m_insideSize.Set( Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE * 3 + Constants.FLOAT_WIDTH_SPACING * 2, Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE * 3 + Constants.FLOAT_WIDTH_SPACING * 2 + Constants.OUTSIDE_WIRE_MARGIN ); + //m_defaultValue = new Matrix4x4(); + //m_materialValue = new Matrix4x4(); + m_drawPreview = false; + } + + public override void CopyDefaultsToMaterial() + { + m_materialValue = m_defaultValue; + } + + public override void DrawSubProperties() + { + EditorGUILayout.LabelField( Constants.DefaultValueLabel ); + for( int row = 0; row < 3; row++ ) + { + EditorGUILayout.BeginHorizontal(); + for( int column = 0; column < 3; column++ ) + { + m_defaultValue[ row, column ] = EditorGUILayoutFloatField( string.Empty, m_defaultValue[ row, column ], GUILayout.MaxWidth( 76 ) ); + } + EditorGUILayout.EndHorizontal(); + } + } + + public override void DrawMaterialProperties() + { + if( m_materialMode ) + EditorGUI.BeginChangeCheck(); + + EditorGUILayout.LabelField( Constants.MaterialValueLabel ); + for( int row = 0; row < 3; row++ ) + { + EditorGUILayout.BeginHorizontal(); + for( int column = 0; column < 3; column++ ) + { + m_materialValue[ row, column ] = EditorGUILayoutFloatField( string.Empty, m_materialValue[ row, column ], GUILayout.MaxWidth( 76 ) ); + } + EditorGUILayout.EndHorizontal(); + } + + if( m_materialMode && EditorGUI.EndChangeCheck() ) + m_requireMaterialUpdate = true; + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + + m_propertyDrawPos.position = m_remainingBox.position; + m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; + m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if( drawInfo.CurrentEventType != EventType.MouseDown ) + return; + + Rect hitBox = m_remainingBox; + hitBox.height = m_insideSize.y * drawInfo.InvertedZoom; + bool insideBox = hitBox.Contains( drawInfo.MousePosition ); + + if( insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = true; + } + else if( m_isEditingFields && !insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = false; + } + } + + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( !m_isVisible ) + return; + + if( m_isEditingFields && m_currentParameterType != PropertyType.Global ) + { + bool currMode = m_materialMode && m_currentParameterType != PropertyType.Constant; + Matrix4x4 value = currMode ? m_materialValue : m_defaultValue; + + EditorGUI.BeginChangeCheck(); + for( int row = 0; row < 3; row++ ) + { + for( int column = 0; column < 3; column++ ) + { + m_propertyDrawPos.position = m_remainingBox.position + Vector2.Scale( m_propertyDrawPos.size, new Vector2( column, row ) ) + new Vector2( Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * column, Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * row ); + value[ row, column ] = EditorGUIFloatField( m_propertyDrawPos, string.Empty, value[ row, column ], UIUtils.MainSkin.textField ); + } + } + + if( currMode ) + { + m_materialValue = value; + } + else + { + m_defaultValue = value; + } + + if( EditorGUI.EndChangeCheck() ) + { + m_requireMaterialUpdate = m_materialMode; + BeginDelayedDirtyProperty(); + } + } + else if( drawInfo.CurrentEventType == EventType.Repaint ) + { + bool guiEnabled = GUI.enabled; + //redundant ternary conditional but this makes easier to read that only when m_showCuffer is on that we need to take PropertyType.Property into account + GUI.enabled = ( m_showCBuffer )? m_currentParameterType != PropertyType.Global&& m_currentParameterType != PropertyType.Property : m_currentParameterType != PropertyType.Global; + + bool currMode = m_materialMode && m_currentParameterType != PropertyType.Constant; + Matrix4x4 value = currMode ? m_materialValue : m_defaultValue; + for( int row = 0; row < 3; row++ ) + { + for( int column = 0; column < 3; column++ ) + { + Rect fakeField = m_propertyDrawPos; + fakeField.position = m_remainingBox.position + Vector2.Scale( m_propertyDrawPos.size, new Vector2( column, row ) ) + new Vector2( Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * column, Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * row ); + if( GUI.enabled ) + EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); + + if( m_previousValue[ row, column ] != value[ row, column ] ) + { + m_previousValue[ row, column ] = value[ row, column ]; + m_fieldText[ row, column ] = value[ row, column ].ToString(); + } + + GUI.Label( fakeField, m_fieldText[ row, column ], UIUtils.MainSkin.textField ); + } + } + GUI.enabled = guiEnabled; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + if( m_currentParameterType != PropertyType.Constant ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + string localVarName = PropertyData( dataCollector.PortCategory ) + "Local3x3"; + string localVarValue = string.Format( "float3x3({0}._m00,{0}._m01,{0}._m02,{0}._m10,{0}._m11,{0}._m12,{0}._m20,{0}._m21,{0}._m22 )", PropertyData( dataCollector.PortCategory ) ); + RegisterLocalVariable( 0, localVarValue, ref dataCollector, localVarName ); + return localVarName; + } + + Matrix4x4 value = m_defaultValue; + + return m_precisionString + "(" + value[ 0, 0 ] + "," + value[ 0, 1 ] + "," + value[ 0, 2 ] + "," + + +value[ 1, 0 ] + "," + value[ 1, 1 ] + "," + value[ 1, 2 ] + "," + + +value[ 2, 0 ] + "," + value[ 2, 1 ] + "," + value[ 2, 2 ] + ")"; + + } + + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) + { + Shader.SetGlobalMatrix( m_propertyName, m_materialValue ); + //mat.SetMatrix( m_propertyName, m_materialValue ); + } + } + + public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) + { + dataType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT4x4 ); + dataName = m_propertyName; + return true; + } + + public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) + { + base.SetMaterialMode( mat, fetchMaterialValues ); + if( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) + { + m_materialValue = mat.GetMatrix( m_propertyName ); + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) + { + m_materialValue = material.GetMatrix( m_propertyName ); + PreviewIsDirty = true; + } + } + + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_defaultValue = IOUtils.StringToMatrix3x3( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Matrix3x3ToString( m_defaultValue ) ); + } + + public override void ReadAdditionalClipboardData( ref string[] nodeParams ) + { + base.ReadAdditionalClipboardData( ref nodeParams ); + m_materialValue = IOUtils.StringToMatrix3x3( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteAdditionalClipboardData( ref string nodeInfo ) + { + base.WriteAdditionalClipboardData( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Matrix3x3ToString( m_materialValue ) ); + } + + public override string GetPropertyValStr() + { + return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? m_materialValue[ 0, 0 ].ToString( Mathf.Abs( m_materialValue[ 0, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 0, 1 ].ToString( Mathf.Abs( m_materialValue[ 0, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 0, 2 ].ToString( Mathf.Abs( m_materialValue[ 0, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + + m_materialValue[ 1, 0 ].ToString( Mathf.Abs( m_materialValue[ 1, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 1, 1 ].ToString( Mathf.Abs( m_materialValue[ 1, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 1, 2 ].ToString( Mathf.Abs( m_materialValue[ 1, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + + m_materialValue[ 2, 0 ].ToString( Mathf.Abs( m_materialValue[ 2, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 2, 1 ].ToString( Mathf.Abs( m_materialValue[ 2, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 2, 2 ].ToString( Mathf.Abs( m_materialValue[ 2, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) : + + m_defaultValue[ 0, 0 ].ToString( Mathf.Abs( m_defaultValue[ 0, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 0, 1 ].ToString( Mathf.Abs( m_defaultValue[ 0, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 0, 2 ].ToString( Mathf.Abs( m_defaultValue[ 0, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + + m_defaultValue[ 1, 0 ].ToString( Mathf.Abs( m_defaultValue[ 1, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 1, 1 ].ToString( Mathf.Abs( m_defaultValue[ 1, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 1, 2 ].ToString( Mathf.Abs( m_defaultValue[ 1, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + + m_defaultValue[ 2, 0 ].ToString( Mathf.Abs( m_defaultValue[ 2, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 2, 1 ].ToString( Mathf.Abs( m_defaultValue[ 2, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 2, 2 ].ToString( Mathf.Abs( m_defaultValue[ 2, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ); + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs.meta new file mode 100644 index 00000000..b6edaabc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 01e5a5829caac674fa819ed229de31b6 +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs new file mode 100644 index 00000000..72af5570 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs @@ -0,0 +1,249 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Matrix4X4", "Constants And Properties", "Matrix4X4 property" )] + public sealed class Matrix4X4Node : MatrixParentNode + { + private string[,] m_fieldText = new string[ 4, 4 ] { { "0", "0", "0", "0" }, { "0", "0", "0", "0" }, { "0", "0", "0", "0" }, { "0", "0", "0", "0" } }; + public Matrix4X4Node() : base() { } + public Matrix4X4Node( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Matrix" ); + AddOutputPort( WirePortDataType.FLOAT4x4, Constants.EmptyPortValue ); + m_insideSize.Set( Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE * 4 + Constants.FLOAT_WIDTH_SPACING * 3, Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE * 4 + Constants.FLOAT_WIDTH_SPACING * 3 + Constants.OUTSIDE_WIRE_MARGIN ); + //m_defaultValue = new Matrix4x4(); + //m_materialValue = new Matrix4x4(); + m_drawPreview = false; + } + + public override void CopyDefaultsToMaterial() + { + m_materialValue = m_defaultValue; + } + + public override void DrawSubProperties() + { + EditorGUILayout.LabelField( Constants.DefaultValueLabel ); + for ( int row = 0; row < 4; row++ ) + { + EditorGUILayout.BeginHorizontal(); + for ( int column = 0; column < 4; column++ ) + { + m_defaultValue[ row, column ] = EditorGUILayoutFloatField( string.Empty, m_defaultValue[ row, column ], GUILayout.MaxWidth( 55 ) ); + } + EditorGUILayout.EndHorizontal(); + } + } + + public override void DrawMaterialProperties() + { + if ( m_materialMode ) + EditorGUI.BeginChangeCheck(); + + EditorGUILayout.LabelField( Constants.MaterialValueLabel ); + for ( int row = 0; row < 4; row++ ) + { + EditorGUILayout.BeginHorizontal(); + for ( int column = 0; column < 4; column++ ) + { + m_materialValue[ row, column ] = EditorGUILayoutFloatField( string.Empty, m_materialValue[ row, column ], GUILayout.MaxWidth( 55 ) ); + } + EditorGUILayout.EndHorizontal(); + } + + if ( m_materialMode && EditorGUI.EndChangeCheck() ) + m_requireMaterialUpdate = true; + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + + m_propertyDrawPos.position = m_remainingBox.position; + m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; + m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if ( drawInfo.CurrentEventType != EventType.MouseDown ) + return; + + Rect hitBox = m_remainingBox; + hitBox.height = m_insideSize.y * drawInfo.InvertedZoom; + bool insideBox = hitBox.Contains( drawInfo.MousePosition ); + + if ( insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = true; + } + else if ( m_isEditingFields && !insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = false; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if ( !m_isVisible ) + return; + + if ( m_isEditingFields && m_currentParameterType != PropertyType.Global ) + { + bool currMode = m_materialMode && m_currentParameterType != PropertyType.Constant; + Matrix4x4 value = currMode ? m_materialValue : m_defaultValue; + + EditorGUI.BeginChangeCheck(); + for ( int row = 0; row < 4; row++ ) + { + for ( int column = 0; column < 4; column++ ) + { + m_propertyDrawPos.position = m_remainingBox.position + Vector2.Scale( m_propertyDrawPos.size, new Vector2( column, row ) ) + new Vector2( Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * column, Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * row ); + value[ row, column ] = EditorGUIFloatField( m_propertyDrawPos, string.Empty, value[ row, column ], UIUtils.MainSkin.textField ); + } + } + + if ( currMode ) + { + m_materialValue = value; + } + else + { + m_defaultValue = value; + } + + if ( EditorGUI.EndChangeCheck() ) + { + m_requireMaterialUpdate = m_materialMode; + BeginDelayedDirtyProperty(); + } + } + else if ( drawInfo.CurrentEventType == EventType.Repaint ) + { + bool guiEnabled = GUI.enabled; + //redundant ternary conditional but this makes easier to read that only when m_showCuffer is on that we need to take PropertyType.Property into account + GUI.enabled = ( m_showCBuffer ) ? m_currentParameterType != PropertyType.Global && m_currentParameterType != PropertyType.Property : m_currentParameterType != PropertyType.Global; + + bool currMode = m_materialMode && m_currentParameterType != PropertyType.Constant; + Matrix4x4 value = currMode ? m_materialValue : m_defaultValue; + for ( int row = 0; row < 4; row++ ) + { + for ( int column = 0; column < 4; column++ ) + { + Rect fakeField = m_propertyDrawPos; + fakeField.position = m_remainingBox.position + Vector2.Scale( m_propertyDrawPos.size, new Vector2( column, row ) ) + new Vector2( Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * column, Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * row ); + if( GUI.enabled ) + EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); + + if ( m_previousValue[ row, column ] != value[ row, column ] ) + { + m_previousValue[ row, column ] = value[ row, column ]; + m_fieldText[ row, column ] = value[ row, column ].ToString(); + } + + GUI.Label( fakeField, m_fieldText[ row, column ], UIUtils.MainSkin.textField ); + } + } + GUI.enabled = guiEnabled; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + if ( m_currentParameterType != PropertyType.Constant ) + return PropertyData( dataCollector.PortCategory ); + + Matrix4x4 value = m_defaultValue; + + return m_precisionString+"(" + value[ 0, 0 ] + "," + value[ 0, 1 ] + "," + value[ 0, 2 ] + "," + value[ 0, 3 ] + "," + + +value[ 1, 0 ] + "," + value[ 1, 1 ] + "," + value[ 1, 2 ] + "," + value[ 1, 3 ] + "," + + +value[ 2, 0 ] + "," + value[ 2, 1 ] + "," + value[ 2, 2 ] + "," + value[ 2, 3 ] + "," + + +value[ 3, 0 ] + "," + value[ 3, 1 ] + "," + value[ 3, 2 ] + "," + value[ 3, 3 ] + ")"; + + } + + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + if ( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) + { + mat.SetMatrix( m_propertyName, m_materialValue ); + } + } + + public override void SetMaterialMode( Material mat , bool fetchMaterialValues ) + { + base.SetMaterialMode( mat , fetchMaterialValues ); + if ( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) + { + m_materialValue = mat.GetMatrix( m_propertyName ); + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) + { + m_materialValue = material.GetMatrix( m_propertyName ); + PreviewIsDirty = true; + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_defaultValue = IOUtils.StringToMatrix4x4( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Matrix4x4ToString( m_defaultValue ) ); + } + + public override void ReadAdditionalClipboardData( ref string[] nodeParams ) + { + base.ReadAdditionalClipboardData( ref nodeParams ); + m_materialValue = IOUtils.StringToMatrix4x4( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteAdditionalClipboardData( ref string nodeInfo ) + { + base.WriteAdditionalClipboardData( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Matrix4x4ToString( m_materialValue ) ); + } + + + public override string GetPropertyValStr() + { + return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? m_materialValue[ 0, 0 ].ToString( Mathf.Abs( m_materialValue[ 0, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 0, 1 ].ToString( Mathf.Abs( m_materialValue[ 0, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 0, 2 ].ToString( Mathf.Abs( m_materialValue[ 0, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 0, 3 ].ToString( Mathf.Abs( m_materialValue[ 0, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + + m_materialValue[ 1, 0 ].ToString( Mathf.Abs( m_materialValue[ 1, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 1, 1 ].ToString( Mathf.Abs( m_materialValue[ 1, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 1, 2 ].ToString( Mathf.Abs( m_materialValue[ 1, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 1, 3 ].ToString( Mathf.Abs( m_materialValue[ 1, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + + m_materialValue[ 2, 0 ].ToString( Mathf.Abs( m_materialValue[ 2, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 2, 1 ].ToString( Mathf.Abs( m_materialValue[ 2, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 2, 2 ].ToString( Mathf.Abs( m_materialValue[ 2, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 2, 3 ].ToString( Mathf.Abs( m_materialValue[ 2, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + + m_materialValue[ 3, 0 ].ToString( Mathf.Abs( m_materialValue[ 3, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 3, 1 ].ToString( Mathf.Abs( m_materialValue[ 3, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 3, 2 ].ToString( Mathf.Abs( m_materialValue[ 3, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 3, 3 ].ToString( Mathf.Abs( m_materialValue[ 3, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) : + + m_defaultValue[ 0, 0 ].ToString( Mathf.Abs( m_defaultValue[ 0, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 0, 1 ].ToString( Mathf.Abs( m_defaultValue[ 0, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 0, 2 ].ToString( Mathf.Abs( m_defaultValue[ 0, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 0, 3 ].ToString( Mathf.Abs( m_defaultValue[ 0, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + + m_defaultValue[ 1, 0 ].ToString( Mathf.Abs( m_defaultValue[ 1, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 1, 1 ].ToString( Mathf.Abs( m_defaultValue[ 1, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 1, 2 ].ToString( Mathf.Abs( m_defaultValue[ 1, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 1, 3 ].ToString( Mathf.Abs( m_defaultValue[ 1, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + + m_defaultValue[ 2, 0 ].ToString( Mathf.Abs( m_defaultValue[ 2, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 2, 1 ].ToString( Mathf.Abs( m_defaultValue[ 2, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 2, 2 ].ToString( Mathf.Abs( m_defaultValue[ 2, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 2, 3 ].ToString( Mathf.Abs( m_defaultValue[ 2, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + + m_defaultValue[ 3, 0 ].ToString( Mathf.Abs( m_defaultValue[ 3, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 3, 1 ].ToString( Mathf.Abs( m_defaultValue[ 3, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 3, 2 ].ToString( Mathf.Abs( m_defaultValue[ 3, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 3, 3 ].ToString( Mathf.Abs( m_defaultValue[ 3, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ); + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs.meta new file mode 100644 index 00000000..40d2eba7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4fa5db614b9379b4da27edafa0a8f4e9 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs new file mode 100644 index 00000000..6bae9989 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs @@ -0,0 +1,129 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class MatrixParentNode : PropertyNode + { + private readonly string[] AvailablePropertyTypeLabels = { PropertyType.Constant.ToString(), PropertyType.Global.ToString(), "Instanced" }; + private readonly int[] AvailablePropertyTypeValues = { (int)PropertyType.Constant, (int)PropertyType.Global , (int)PropertyType.InstancedProperty }; + + private readonly string[] AvailablePropertyTypeLabelsSRP = { PropertyType.Constant.ToString() ,"CBuffer", PropertyType.Global.ToString() , "Instanced" }; + private readonly int[] AvailablePropertyTypeValuesSRP = { (int)PropertyType.Constant , (int)PropertyType.Property,( int)PropertyType.Global , (int)PropertyType.InstancedProperty }; + + + protected bool m_isEditingFields; + + protected bool m_showCBuffer = false; + + [SerializeField] + protected Matrix4x4 m_defaultValue = Matrix4x4.identity; + + [SerializeField] + protected Matrix4x4 m_materialValue = Matrix4x4.identity; + + [NonSerialized] + protected Matrix4x4 m_previousValue; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + public MatrixParentNode() : base() { } + public MatrixParentNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_freeType = false; + m_showVariableMode = true; + m_srpBatcherCompatible = true; + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + m_hasLeftDropdown = true; + m_drawAttributes = false; + m_availableAttribs.Clear(); + + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + m_showCBuffer = m_containerGraph.IsSRP || m_containerGraph.CurrentShaderFunction != null; + } + + protected void DrawParameterType() + { + PropertyType parameterType; + if( m_showCBuffer ) + { + parameterType = (PropertyType)EditorGUILayoutIntPopup( ParameterTypeStr , (int)m_currentParameterType , AvailablePropertyTypeLabelsSRP , AvailablePropertyTypeValuesSRP ); + } + else + { + parameterType = (PropertyType)EditorGUILayoutIntPopup( ParameterTypeStr , (int)m_currentParameterType , AvailablePropertyTypeLabels , AvailablePropertyTypeValues ); + } + + if( parameterType != m_currentParameterType ) + { + ChangeParameterType( parameterType ); + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + PropertyType parameterType; + if( m_showCBuffer ) + { + parameterType = (PropertyType)m_upperLeftWidget.DrawWidget( this , (int)m_currentParameterType , AvailablePropertyTypeLabelsSRP , AvailablePropertyTypeValuesSRP ); + } + else + { + parameterType = (PropertyType)m_upperLeftWidget.DrawWidget( this , (int)m_currentParameterType , AvailablePropertyTypeLabels , AvailablePropertyTypeValues ); + } + + if( parameterType != m_currentParameterType ) + { + ChangeParameterType( parameterType ); + } + } + + public override void DrawMainPropertyBlock() + { + DrawParameterType(); + base.DrawMainPropertyBlock(); + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override void OnMasterNodeReplaced( MasterNode newMasterNode ) + { + base.OnMasterNodeReplaced( newMasterNode ); + if( m_containerGraph.IsStandardSurface || !m_containerGraph.IsSRP ) + { + if( m_currentParameterType == PropertyType.Property ) + { + m_currentParameterType = PropertyType.Global; + } + } + } + + public override void SetGlobalValue() { Shader.SetGlobalMatrix( m_propertyName, m_defaultValue ); } + public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalMatrix( m_propertyName ); } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs.meta new file mode 100644 index 00000000..bd9ac18c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d31dc25864c509a4f967e32079a27d6f +timeCreated: 1507902748 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs new file mode 100644 index 00000000..659a128c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs @@ -0,0 +1,63 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "PI", "Constants And Properties", "PI constant : 3.14159265359" )] + public sealed class PiNode : ParentNode + { + public PiNode() : base() { } + public PiNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, true, "Multiplier" ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_textLabelWidth = 70; + InputPorts[ 0 ].FloatInternalData = 1; + m_useInternalPortData = true; + m_previewShaderGUID = "bf4a65726dab3d445a69fb1d0945c33e"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + string finalValue = string.Empty; + string piString = dataCollector.IsSRP ? "PI" : "UNITY_PI"; + if( !InputPorts[ 0 ].IsConnected && InputPorts[ 0 ].FloatInternalData == 1 ) + { + finalValue = piString; + } else + { + string multiplier = InputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + finalValue = "( " + multiplier + " * " + piString + " )"; + } + + + if ( finalValue.Equals( string.Empty ) ) + { + UIUtils.ShowMessage( UniqueId, "PINode generating empty code", MessageSeverity.Warning ); + } + return finalValue; + } + + //public override void ReadFromString( ref string[] nodeParams ) + //{ + // base.ReadFromString( ref nodeParams ); + + // Removed on version 5004 + //m_value = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + //} + + //public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + //{ + // base.WriteToString( ref nodeInfo, ref connectionsInfo ); + //} + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs.meta new file mode 100644 index 00000000..fd68aa09 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7a8a03953b97a594b81b2fb71d4a57ec +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs new file mode 100644 index 00000000..d9f60b13 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs @@ -0,0 +1,1927 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public enum PropertyType + { + Constant = 0, + Property, + InstancedProperty, + Global + } + + public enum VariableMode + { + Create = 0, + Fetch + } + + [Serializable] + public class PropertyAttributes + { + public string Name; + public string Attribute; + public bool HasDeprecatedValue; + public string DeprecatedValue; + public PropertyAttributes( string name, string attribute , string deprecated = null ) + { + Name = name; + Attribute = attribute; + DeprecatedValue = deprecated; + HasDeprecatedValue = deprecated != null; + } + } + + [Serializable] + public class PropertyNode : ParentNode + { + private const string LongNameEnder = "... )"; + protected int m_longNameSize = 200; + //private const string InstancedPropertyWarning = "Instanced Property option shouldn't be used on official SRP templates as all property variables are already declared as instanced inside a CBuffer.\nPlease consider changing to Property option."; + private const string TooltipFormatter = "{0}\n\nName: {1}\nValue: {2}"; + private const string InvalidAttributeFormatter = "Attribute {0} not found on node {1}. Please click on this message to select node and review its attributes section"; + protected string GlobalTypeWarningText = "Global variables must be set via a C# script using the Shader.SetGlobal{0}(...) method.\nPlease note that setting a global variable will affect all shaders which are using it."; + private const string HybridInstancedStr = "Hybrid Instanced"; + private const string AutoRegisterStr = "Auto-Register"; + private const string IgnoreVarDeclarationStr = "Variable Mode"; + private const string IsPropertyStr = "Is Property"; + private const string PropertyNameStr = "Property Name"; + private const string PropertyInspectorStr = "Name"; + protected const string EnumsStr = "Enums"; + protected const string CustomAttrStr = "Custom Attributes"; + protected const string HeaderAttrStr = "Headers"; + protected const string ParameterTypeStr = "Type"; + private const string PropertyTextfieldControlName = "PropertyName"; + private const string PropertyInspTextfieldControlName = "PropertyInspectorName"; + private const string OrderIndexStr = "Order Index"; + protected const double MaxTimestamp = 2; + private const double MaxPropertyTimestamp = 2; + private const double MaxGlobalFetchTimestamp = 2; + protected readonly string[] LabelToolbarTitle = { "Material", "Default" }; + protected readonly string[] EnumModesStr = { "Create Enums", "Use Engine Enum Class" }; + protected readonly int[] EnumModeIntValues = { 0, 1 }; + private const string FetchToCreateDuplicatesMsg = "Reverting property name from '{0}' to '{1}' as it is registered to another property node."; + private const string FetchToCreateOnDuplicateNodeMsg = "Setting new property name '{0}' as '{1}' is registered to another property node."; + private const string HeaderId = "Header"; + private const string EnumId = "Enum"; + + [SerializeField] + protected PropertyType m_currentParameterType; + + [SerializeField] + private PropertyType m_lastParameterType; + + [SerializeField] + protected string m_propertyName = string.Empty; + + [SerializeField] + protected string m_propertyInspectorName = string.Empty; + + [SerializeField] + protected string m_precisionString; + protected bool m_drawPrecisionUI = true; + + [SerializeField] + private int m_orderIndex = -1; + + [SerializeField] + protected VariableMode m_variableMode = VariableMode.Create; + + [SerializeField] + protected bool m_autoGlobalName = true; + + [SerializeField] + protected bool m_hybridInstanced = false; + + [SerializeField] + protected bool m_autoRegister = false; + + [SerializeField] + protected bool m_registerPropertyOnInstancing = true; + + [SerializeField] + private List m_enumNames = new List(); + + [SerializeField] + private List m_enumValues = new List(); + + [SerializeField] + private int m_enumCount = 0; + + [SerializeField] + private int m_enumModeInt = 0; + + [SerializeField] + private int m_customAttrCount = 0; + + [SerializeField] + private List m_customAttr = new List(); + + [SerializeField] + private bool m_hasHeaders = false; + + [SerializeField] + private List m_headerAttributeValues = new List(); + + + [SerializeField] + private string m_enumClassName = string.Empty; + + private bool m_hasEnum = false; + + protected bool m_showTitleWhenNotEditing = true; + + private int m_orderIndexOffset = 0; + + protected bool m_drawAttributes = true; + + protected bool m_underscoredGlobal = false; + protected bool m_globalDefaultBehavior = true; + + protected bool m_freeName; + protected bool m_freeType; + protected bool m_showVariableMode = false; + protected bool m_propertyNameIsDirty; + + protected bool m_showAutoRegisterUI = true; + + protected bool m_showHybridInstancedUI = false; + + protected bool m_useVarSubtitle = false; + + protected bool m_propertyFromInspector; + protected double m_propertyFromInspectorTimestamp; + + protected bool m_checkDuplicateProperty; + protected double m_checkDuplicatePropertyTimestamp; + + protected double m_globalFetchTimestamp; + + protected bool m_delayedDirtyProperty; + protected double m_delayedDirtyPropertyTimestamp; + + protected string m_defaultPropertyName; + protected string m_oldName = string.Empty; + + private bool m_reRegisterName = false; + protected bool m_allowPropertyDuplicates = false; + //protected bool m_useCustomPrefix = false; + protected string m_customPrefix = null; + + protected int m_propertyTab = 0; + + [SerializeField] + private string m_uniqueName; + + // Property Attributes + private const float ButtonLayoutWidth = 15; + + protected bool m_visibleAttribsFoldout; + protected bool m_visibleEnumsFoldout; + protected bool m_visibleCustomAttrFoldout; + protected bool m_visibleHeaderAttrFoldout; + protected List m_availableAttribs = new List(); + private string[] m_availableAttribsArr; + + [SerializeField] + private bool[] m_selectedAttribsArr; + + [SerializeField] + protected List m_selectedAttribs = new List(); + + //Title editing + protected bool m_isEditing; + protected bool m_stopEditing; + protected bool m_startEditing; + protected double m_clickTime; + protected double m_doubleClickTime = 0.3; + private Rect m_titleClickArea; + + protected bool m_srpBatcherCompatible = false; + protected bool m_excludeUniform = false; + + [SerializeField] + private bool m_addGlobalToSRPBatcher = false; + + public PropertyNode() : base() { } + public PropertyNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_textLabelWidth = 105; + if( UIUtils.CurrentWindow != null && UIUtils.CurrentWindow.CurrentGraph != null ) + m_orderIndex = UIUtils.GetPropertyNodeAmount(); + m_currentParameterType = PropertyType.Constant; + m_freeType = true; + m_freeName = true; + m_propertyNameIsDirty = true; + m_customPrecision = true; + m_availableAttribs.Add( new PropertyAttributes( "Hide in Inspector", "[HideInInspector]" ) ); + m_availableAttribs.Add( new PropertyAttributes( "HDR", "[HDR]" ) ); + m_availableAttribs.Add( new PropertyAttributes( "Gamma", "[Gamma]" ) ); + m_availableAttribs.Add( new PropertyAttributes( "Per Renderer Data", "[PerRendererData]" ) ); + m_availableAttribs.Add( new PropertyAttributes( "Header", "[Header]" ) ); + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + + if( PaddingTitleLeft == 0 && m_freeType ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + + m_hasLeftDropdown = m_freeType; + } + + protected void BeginDelayedDirtyProperty() + { + m_delayedDirtyProperty = true; + m_delayedDirtyPropertyTimestamp = EditorApplication.timeSinceStartup; + } + + public void CheckDelayedDirtyProperty() + { + if( m_delayedDirtyProperty ) + { + if( ( EditorApplication.timeSinceStartup - m_delayedDirtyPropertyTimestamp ) > MaxPropertyTimestamp ) + { + m_delayedDirtyProperty = false; + m_propertyNameIsDirty = true; + m_sizeIsDirty = true; + } + } + } + + public void BeginPropertyFromInspectorCheck() + { + m_propertyFromInspector = true; + m_propertyFromInspectorTimestamp = EditorApplication.timeSinceStartup; + } + + public virtual void CheckPropertyFromInspector( bool forceUpdate = false ) + { + if( m_propertyFromInspector ) + { + if( forceUpdate || ( EditorApplication.timeSinceStartup - m_propertyFromInspectorTimestamp ) > MaxTimestamp ) + { + m_propertyFromInspector = false; + bool autoGlobal = m_autoGlobalName || m_currentParameterType == PropertyType.Global; + RegisterPropertyName( true, m_propertyInspectorName, autoGlobal, m_underscoredGlobal ); + m_propertyNameIsDirty = true; + } + } + } + + public void CheckDuplicateProperty() + { + if( m_checkDuplicateProperty && + ( EditorApplication.timeSinceStartup - m_checkDuplicatePropertyTimestamp ) > MaxTimestamp ) + { + m_checkDuplicateProperty = false; + m_propertyName = UIUtils.GeneratePropertyName( m_propertyName, PropertyType.Global, false ); + + if( UIUtils.IsNumericName( m_propertyName ) ) + { + UIUtils.ShowMessage( UniqueId, string.Format( "Invalid property name '{0}' as it cannot start with numbers. Reverting to last valid name '{1}'", m_propertyName, m_oldName ), MessageSeverity.Warning ); + m_propertyName = m_oldName; + GUI.FocusControl( string.Empty ); + return; + } + + if( !m_propertyName.Equals( m_oldName ) ) + { + if( UIUtils.IsUniformNameAvailable( m_propertyName ) || m_allowPropertyDuplicates ) + { + UIUtils.ReleaseUniformName( UniqueId, m_oldName ); + + m_oldName = m_propertyName; + m_propertyNameIsDirty = true; + m_reRegisterName = false; + UIUtils.RegisterUniformName( UniqueId, m_propertyName ); + OnPropertyNameChanged(); + } + else + { + GUI.FocusControl( string.Empty ); + RegisterFirstAvailablePropertyName( true, true ); + UIUtils.ShowMessage( UniqueId, string.Format( "Property name '{0}' is already in use. Reverting to last valid name '{1}'", m_propertyName, m_oldName ) ); + } + } + } + } + + protected override void OnUniqueIDAssigned() + { + if( m_variableMode == VariableMode.Create ) + RegisterFirstAvailablePropertyName( false ); + + if( m_nodeAttribs != null ) + m_uniqueName = m_nodeAttribs.Name + UniqueId; + + UIUtils.RegisterRawPropertyNode( this ); + } + + public bool CheckLocalVariable( ref MasterNodeDataCollector dataCollector ) + { + bool addToLocalValue = false; + int count = 0; + for( int i = 0; i < m_outputPorts.Count; i++ ) + { + if( m_outputPorts[ i ].IsConnected ) + { + if( m_outputPorts[ i ].ConnectionCount > 1 ) + { + addToLocalValue = true; + break; + } + count += 1; + if( count > 1 ) + { + addToLocalValue = true; + break; + } + } + } + + if( addToLocalValue ) + { + ConfigureLocalVariable( ref dataCollector ); + } + + return addToLocalValue; + } + + public virtual void ConfigureLocalVariable( ref MasterNodeDataCollector dataCollector ) { } + public virtual void CopyDefaultsToMaterial() { } + + public override void SetupFromCastObject( UnityEngine.Object obj ) + { + RegisterPropertyName( true, obj.name, true, m_underscoredGlobal ); + } + + public void ChangeParameterType( PropertyType parameterType ) + { + UndoUtils.RegisterCompleteObjectUndo( m_containerGraph.ParentWindow, Constants.UndoChangePropertyTypeNodesId ); + UndoUtils.RegisterCompleteObjectUndo( m_containerGraph, Constants.UndoChangePropertyTypeNodesId ); + UndoUtils.RecordObject( this, Constants.UndoChangePropertyTypeNodesId ); + + if( m_currentParameterType == PropertyType.Constant || m_currentParameterType == PropertyType.Global ) + { + CopyDefaultsToMaterial(); + } + + if( parameterType == PropertyType.InstancedProperty ) + { + //if( m_containerGraph.IsSRP ) + //{ + // UIUtils.ShowMessage( InstancedPropertyWarning,MessageSeverity.Warning ); + //} + + UIUtils.CurrentWindow.OutsideGraph.AddInstancePropertyCount(); + } + else if( m_currentParameterType == PropertyType.InstancedProperty ) + { + UIUtils.CurrentWindow.OutsideGraph.RemoveInstancePropertyCount(); + } + + if( ( parameterType == PropertyType.Property || parameterType == PropertyType.InstancedProperty ) + && m_currentParameterType != PropertyType.Property && m_currentParameterType != PropertyType.InstancedProperty ) + { + UIUtils.RegisterPropertyNode( this ); + } + + if( ( parameterType != PropertyType.Property && parameterType != PropertyType.InstancedProperty ) + && ( m_currentParameterType == PropertyType.Property || m_currentParameterType == PropertyType.InstancedProperty ) ) + { + UIUtils.UnregisterPropertyNode( this ); + } + + m_currentParameterType = parameterType; + if( parameterType == PropertyType.Constant ) + { + CurrentVariableMode = VariableMode.Create; + } + + } + + void InitializeAttribsArray() + { + m_availableAttribsArr = new string[ m_availableAttribs.Count ]; + m_selectedAttribsArr = new bool[ m_availableAttribs.Count ]; + for( int i = 0; i < m_availableAttribsArr.Length; i++ ) + { + m_availableAttribsArr[ i ] = m_availableAttribs[ i ].Name; + m_selectedAttribsArr[ i ] = false; + + if( m_selectedAttribs.FindIndex( x => x == i ) > -1 ) + { + m_selectedAttribsArr[ i ] = true; + m_visibleAttribsFoldout = true; + } + } + } + + protected virtual void OnAtrributesChanged() { CheckEnumAttribute(); CheckHeaderAttribute(); } + void DrawAttributesAddRemoveButtons() + { + if( m_availableAttribsArr == null ) + { + InitializeAttribsArray(); + } + + int attribCount = m_selectedAttribs.Count; + // Add new port + if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) + { + m_visibleAttribsFoldout = true; + m_selectedAttribs.Add( 0 ); + OnAtrributesChanged(); + } + + //Remove port + if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) + { + if( attribCount > 0 ) + { + m_selectedAttribs.RemoveAt( attribCount - 1 ); + OnAtrributesChanged(); + } + } + } + + void CheckEnumAttribute() + { + m_hasEnum = false; + foreach( var item in m_selectedAttribs ) + { + if( m_availableAttribsArr[ item ].Equals( "Enum" ) ) + m_hasEnum = true; + } + } + + + + protected void CheckHeaderAttribute() + { + m_hasHeaders = false; + foreach( var item in m_selectedAttribs ) + { + if( m_availableAttribsArr[ item ].Equals( HeaderId ) ) + { + m_hasHeaders = true; + } + } + } + + void DrawEnumAddRemoveButtons() + { + // Add new port + if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ButtonLayoutWidth ) ) && m_enumModeInt == 0 ) + { + m_enumNames.Add( "Option" + ( m_enumValues.Count + 1 ) ); + m_enumValues.Add( m_enumValues.Count ); + m_enumCount++; + m_visibleEnumsFoldout = true; + } + + //Remove port + if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ButtonLayoutWidth ) ) && m_enumModeInt == 0 ) + { + if( m_enumNames.Count - 1 > -1 ) + { + m_enumNames.RemoveAt( m_enumNames.Count - 1 ); + m_enumValues.RemoveAt( m_enumValues.Count - 1 ); + m_enumCount--; + } + } + } + + protected void DrawEnums() + { + m_enumModeInt = EditorGUILayout.IntPopup( "Mode", m_enumModeInt, EnumModesStr, EnumModeIntValues ); + + if( m_enumModeInt == 0 ) + { + if( m_enumNames.Count == 0 ) + EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add more.", MessageType.Info ); + + float cacheLabelSize = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 50; + + for( int i = 0; i < m_enumNames.Count; i++ ) + { + EditorGUI.BeginChangeCheck(); + EditorGUILayout.BeginHorizontal(); + m_enumNames[ i ] = EditorGUILayoutTextField( "Name", m_enumNames[ i ] ); + m_enumValues[ i ] = Mathf.Max( 0, EditorGUILayoutIntField( "Value", m_enumValues[ i ], GUILayout.Width( 100 ) ) ); + EditorGUILayout.EndHorizontal(); + if( EditorGUI.EndChangeCheck() ) + { + m_enumNames[ i ] = UIUtils.RemoveInvalidEnumCharacters( m_enumNames[ i ] ); + if( string.IsNullOrEmpty( m_enumNames[ i ] ) ) + { + m_enumNames[ i ] = "Option" + ( i + 1 ); + } + } + } + + EditorGUIUtility.labelWidth = cacheLabelSize; + if( m_enumNames.Count > 0 ) + { + EditorGUILayout.BeginHorizontal(); + GUILayout.Label( " " ); + DrawEnumAddRemoveButtons(); + EditorGUILayout.EndHorizontal(); + } + } + else + { + EditorGUILayout.BeginHorizontal(); + m_enumClassName = EditorGUILayoutTextField( "Class Name", m_enumClassName ); + + if( GUILayout.Button( string.Empty, UIUtils.InspectorPopdropdownFallback, GUILayout.Width( 17 ), GUILayout.Height( 19 ) ) ) + { + GenericMenu menu = new GenericMenu(); + AddMenuItem( menu, "UnityEngine.Rendering.CullMode" ); + AddMenuItem( menu, "UnityEngine.Rendering.ColorWriteMask" ); + AddMenuItem( menu, "UnityEngine.Rendering.CompareFunction" ); + AddMenuItem( menu, "UnityEngine.Rendering.StencilOp" ); + AddMenuItem( menu, "UnityEngine.Rendering.BlendMode" ); + AddMenuItem( menu, "UnityEngine.Rendering.BlendOp" ); + menu.ShowAsContext(); + } + EditorGUILayout.EndHorizontal(); + } + } + + private void AddMenuItem( GenericMenu menu, string newClass ) + { + menu.AddItem( new GUIContent( newClass ), m_enumClassName.Equals( newClass ), OnSelection, newClass ); + } + + private void OnSelection( object newClass ) + { + m_enumClassName = (string)newClass; + } + + protected void DrawCustomAttrAddRemoveButtons() + { + // Add new port + if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) + { + m_customAttr.Add( "" ); + m_customAttrCount++; + //m_enumCount++; + m_visibleCustomAttrFoldout = true; + } + + //Remove port + if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) + { + if( m_customAttr.Count - 1 > -1 ) + { + m_customAttr.RemoveAt( m_customAttr.Count - 1 ); + m_customAttrCount--; + } + } + } + + protected void DrawCustomAttributes() + { + for( int i = 0; i < m_customAttrCount; i++ ) + { + EditorGUI.BeginChangeCheck(); + m_customAttr[ i ] = EditorGUILayoutTextField( "Attribute " + i, m_customAttr[ i ] ); + if( EditorGUI.EndChangeCheck() ) + { + m_customAttr[ i ] = UIUtils.RemoveInvalidAttrCharacters( m_customAttr[ i ] ); + } + } + + if( m_customAttrCount <= 0 ) + { + EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add more.", MessageType.Info ); + return; + } + + EditorGUILayout.BeginHorizontal(); + GUILayout.Label( " " ); + DrawCustomAttrAddRemoveButtons(); + EditorGUILayout.EndHorizontal(); + } + + protected void DrawHeaderAttrAddRemoveButtons() + { + // Add new port + if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) + { + m_headerAttributeValues.Add( "" ); + m_visibleHeaderAttrFoldout = true; + } + + //Remove port + if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) + { + if( m_headerAttributeValues.Count > 0 ) + { + m_headerAttributeValues.RemoveAt( m_headerAttributeValues.Count - 1 ); + } + } + } + + protected void DrawHeaderAttributes() + { + int count = m_headerAttributeValues.Count; + for( int i = 0; i < count; i++ ) + { + EditorGUI.BeginChangeCheck(); + m_headerAttributeValues[ i ] = EditorGUILayoutTextField( "Header " + i, m_headerAttributeValues[ i ] ); + if( EditorGUI.EndChangeCheck() ) + { + m_headerAttributeValues[ i ] = UIUtils.RemoveHeaderAttrCharacters( m_headerAttributeValues[ i ] ); + } + } + + + + + if( count <= 0 ) + { + EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add more.", MessageType.Info ); + return; + } + + EditorGUILayout.BeginHorizontal(); + GUILayout.Label( " " ); + DrawHeaderAttrAddRemoveButtons(); + EditorGUILayout.EndHorizontal(); + } + + + public virtual void DrawAttributes() + { + int attribCount = m_selectedAttribs.Count; + EditorGUI.BeginChangeCheck(); + if( m_availableAttribsArr == null ) + { + InitializeAttribsArray(); + } + for( int i = 0; i < m_availableAttribsArr.Length; i++ ) + { + m_selectedAttribsArr[ i ] = EditorGUILayoutToggleLeft( m_availableAttribsArr[ i ], m_selectedAttribsArr[ i ] ); + } + if( EditorGUI.EndChangeCheck() ) + { + m_selectedAttribs.Clear(); + for( int i = 0; i < m_selectedAttribsArr.Length; i++ ) + { + if( m_selectedAttribsArr[ i ] ) + m_selectedAttribs.Add( i ); + } + + OnAtrributesChanged(); + } + + bool customAttr = EditorGUILayoutToggleLeft( "Custom", m_customAttrCount == 0 ? false : true ); + if( !customAttr ) + { + m_customAttrCount = 0; + } + else if( customAttr && m_customAttrCount < 1 ) + { + if( m_customAttr.Count == 0 ) + m_customAttr.Add( "" ); + + m_customAttrCount = m_customAttr.Count; + } + //m_customAttrCount = EditorGUILayoutToggleLeft( "Custom Attribute", m_customAttrCount == 0 ? false : true ) == 0 ? false : true; + + //if( attribCount == 0 ) + //{ + // EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add more.", MessageType.Info ); + //} + + //bool actionAllowed = true; + //int deleteItem = -1; + + //for ( int i = 0; i < attribCount; i++ ) + //{ + // EditorGUI.BeginChangeCheck(); + // { + // m_selectedAttribs[ i ] = EditorGUILayoutPopup( m_selectedAttribs[ i ], m_availableAttribsArr ); + // } + // if ( EditorGUI.EndChangeCheck() ) + // { + // OnAtrributesChanged(); + // } + + // EditorGUILayout.BeginHorizontal(); + // GUILayout.Label( " " ); + // // Add After + // if ( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) + // { + // if ( actionAllowed ) + // { + // m_selectedAttribs.Insert( i, m_selectedAttribs[ i ] ); + // actionAllowed = false; + // OnAtrributesChanged(); + // } + // } + + // // Remove Current + // if ( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) + // { + // if ( actionAllowed ) + // { + // actionAllowed = false; + // deleteItem = i; + // } + // } + // EditorGUILayout.EndHorizontal(); + //} + //if ( deleteItem > -1 ) + //{ + // m_selectedAttribs.RemoveAt( deleteItem ); + // OnAtrributesChanged(); + //} + } + public virtual void DrawMainPropertyBlock() + { + EditorGUILayout.BeginVertical(); + { + if( m_freeType ) + { + PropertyType parameterType = (PropertyType)EditorGUILayoutEnumPopup( ParameterTypeStr, m_currentParameterType ); + if( parameterType != m_currentParameterType ) + { + ChangeParameterType( parameterType ); + BeginPropertyFromInspectorCheck(); + } + } + + if( m_freeName ) + { + switch( m_currentParameterType ) + { + case PropertyType.Property: + case PropertyType.InstancedProperty: + { + ShowPropertyInspectorNameGUI(); + ShowPropertyNameGUI( true ); + ShowVariableMode(); + ShowHybridInstanced(); + ShowAutoRegister(); + ShowPrecision(); + ShowToolbar(); + } + break; + case PropertyType.Global: + { + ShowPropertyInspectorNameGUI(); + ShowPropertyNameGUI( false ); + ShowVariableMode(); + ShowAutoRegister(); + ShowPrecision(); + ShowDefaults(); + } + break; + case PropertyType.Constant: + { + ShowPropertyInspectorNameGUI(); + ShowPrecision(); + ShowDefaults(); + } + break; + } + } + } + EditorGUILayout.EndVertical(); + } + + public void DrawMainPropertyBlockNoPrecision() + { + EditorGUILayout.BeginVertical(); + { + if( m_freeType ) + { + PropertyType parameterType = (PropertyType)EditorGUILayoutEnumPopup( ParameterTypeStr, m_currentParameterType ); + if( parameterType != m_currentParameterType ) + { + ChangeParameterType( parameterType ); + BeginPropertyFromInspectorCheck(); + } + } + + if( m_freeName ) + { + switch( m_currentParameterType ) + { + case PropertyType.Property: + case PropertyType.InstancedProperty: + { + ShowPropertyInspectorNameGUI(); + ShowPropertyNameGUI( true ); + ShowToolbar(); + } + break; + case PropertyType.Global: + { + ShowPropertyInspectorNameGUI(); + ShowPropertyNameGUI( false ); + ShowDefaults(); + } + break; + case PropertyType.Constant: + { + ShowPropertyInspectorNameGUI(); + ShowDefaults(); + } + break; + } + } + } + EditorGUILayout.EndVertical(); + } + + public override void DrawProperties() + { + base.DrawProperties(); + if( m_freeType || m_freeName ) + { + NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, DrawMainPropertyBlock ); + if( m_drawAttributes ) + NodeUtils.DrawPropertyGroup( ref m_visibleAttribsFoldout, Constants.AttributesLaberStr, DrawAttributes ); + + if( m_hasEnum ) + { + if( m_enumModeInt == 0 ) + NodeUtils.DrawPropertyGroup( ref m_visibleEnumsFoldout, EnumsStr, DrawEnums, DrawEnumAddRemoveButtons ); + else + NodeUtils.DrawPropertyGroup( ref m_visibleEnumsFoldout, EnumsStr, DrawEnums ); + } + + if( m_drawAttributes ) + { + if( m_hasHeaders ) + NodeUtils.DrawPropertyGroup( ref m_visibleHeaderAttrFoldout, HeaderAttrStr, DrawHeaderAttributes, DrawHeaderAttrAddRemoveButtons ); + + if( m_customAttrCount > 0 ) + NodeUtils.DrawPropertyGroup( ref m_visibleCustomAttrFoldout, CustomAttrStr, DrawCustomAttributes, DrawCustomAttrAddRemoveButtons ); + } + + CheckPropertyFromInspector(); + } + } + + public void ShowPrecision() + { + if( m_drawPrecisionUI ) + { + bool guiEnabled = GUI.enabled; + GUI.enabled = m_currentParameterType == PropertyType.Constant || m_variableMode == VariableMode.Create; + EditorGUI.BeginChangeCheck(); + DrawPrecisionProperty(); + if( EditorGUI.EndChangeCheck() ) + m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + GUI.enabled = guiEnabled; + + } + } + + public void ShowToolbar() + { + //if ( !CanDrawMaterial ) + //{ + // ShowDefaults(); + // return; + //} + + EditorGUILayout.BeginHorizontal(); + GUILayout.Space( 20 ); + m_propertyTab = GUILayout.Toolbar( m_propertyTab, LabelToolbarTitle ); + EditorGUILayout.EndHorizontal(); + switch( m_propertyTab ) + { + default: + case 0: + { + EditorGUI.BeginChangeCheck(); + DrawMaterialProperties(); + if( EditorGUI.EndChangeCheck() ) + { + BeginDelayedDirtyProperty(); + } + } + break; + case 1: + { + ShowDefaults(); + } + break; + } + } + + public void ShowDefaults() + { + EditorGUI.BeginChangeCheck(); + DrawSubProperties(); + if( EditorGUI.EndChangeCheck() ) + { + BeginDelayedDirtyProperty(); + } + if( m_currentParameterType == PropertyType.Global && m_globalDefaultBehavior ) + { + if( DebugConsoleWindow.DeveloperMode ) + { + ShowGlobalValueButton(); + } + EditorGUILayout.HelpBox( GlobalTypeWarningText, MessageType.Warning ); + } + } + + public void ShowPropertyInspectorNameGUI() + { + EditorGUI.BeginChangeCheck(); + m_propertyInspectorName = EditorGUILayoutTextField( PropertyInspectorStr, m_propertyInspectorName ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_propertyInspectorName.Length > 0 ) + { + BeginPropertyFromInspectorCheck(); + } + } + } + + public void ShowPropertyNameGUI( bool isProperty ) + { + bool guiEnabledBuffer = GUI.enabled; + if( isProperty ) + { + EditorGUILayout.BeginHorizontal(); + GUI.enabled = !m_autoGlobalName; + EditorGUI.BeginChangeCheck(); + m_propertyName = EditorGUILayoutTextField( PropertyNameStr, m_propertyName ); + if( EditorGUI.EndChangeCheck() ) + { + //BeginPropertyFromInspectorCheck(); + m_checkDuplicateProperty = true; + m_checkDuplicatePropertyTimestamp = EditorApplication.timeSinceStartup; + } + GUI.enabled = guiEnabledBuffer; + EditorGUI.BeginChangeCheck(); + m_autoGlobalName = GUILayout.Toggle( m_autoGlobalName, ( m_autoGlobalName ? UIUtils.LockIconOpen : UIUtils.LockIconClosed ), "minibutton", GUILayout.Width( 22 ) ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_autoGlobalName ) + BeginPropertyFromInspectorCheck(); + } + EditorGUILayout.EndHorizontal(); + } + else + { + GUI.enabled = false; + m_propertyName = EditorGUILayoutTextField( PropertyNameStr, m_propertyName ); + GUI.enabled = guiEnabledBuffer; + } + } + + public void ShowVariableMode() + { + if( m_showVariableMode || m_freeType ) + CurrentVariableMode = (VariableMode)EditorGUILayoutEnumPopup( IgnoreVarDeclarationStr, m_variableMode ); + } + + public void ShowHybridInstanced() + { + if( m_showHybridInstancedUI && CurrentParameterType == PropertyType.Property && ( m_containerGraph.IsSRP || m_containerGraph.CurrentShaderFunction != null ) ) + { + m_hybridInstanced = EditorGUILayoutToggle( HybridInstancedStr, m_hybridInstanced ); + } + } + + public void ShowAutoRegister() + { + if( m_showAutoRegisterUI && CurrentParameterType != PropertyType.Constant ) + { + m_autoRegister = EditorGUILayoutToggle( AutoRegisterStr, m_autoRegister ); + } + } + + public virtual string GetPropertyValStr() { return string.Empty; } + public virtual string GetSubTitleVarNameFormatStr() { return Constants.SubTitleVarNameFormatStr; } + + public override bool OnClick( Vector2 currentMousePos2D ) + { + bool singleClick = base.OnClick( currentMousePos2D ); + m_propertyTab = m_materialMode ? 0 : 1; + return singleClick; + } + + public override void OnNodeDoubleClicked( Vector2 currentMousePos2D ) + { + if( currentMousePos2D.y - m_globalPosition.y > ( Constants.NODE_HEADER_HEIGHT + Constants.NODE_HEADER_EXTRA_HEIGHT ) * ContainerGraph.ParentWindow.CameraDrawInfo.InvertedZoom ) + { + ContainerGraph.ParentWindow.ParametersWindow.IsMaximized = !ContainerGraph.ParentWindow.ParametersWindow.IsMaximized; + } + } + + public override void DrawTitle( Rect titlePos ) + { + //base.DrawTitle( titlePos ); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + // Custom Editable Title + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + if( !m_isEditing && ( ( !ContainerGraph.ParentWindow.MouseInteracted && drawInfo.CurrentEventType == EventType.MouseDown && m_titleClickArea.Contains( drawInfo.MousePosition ) ) ) ) + { + if( ( EditorApplication.timeSinceStartup - m_clickTime ) < m_doubleClickTime ) + m_startEditing = true; + else + GUI.FocusControl( null ); + m_clickTime = EditorApplication.timeSinceStartup; + } + else if( m_isEditing && ( ( drawInfo.CurrentEventType == EventType.MouseDown && !m_titleClickArea.Contains( drawInfo.MousePosition ) ) || !EditorGUIUtility.editingTextField ) ) + { + m_stopEditing = true; + } + + if( m_isEditing || m_startEditing ) + { + EditorGUI.BeginChangeCheck(); + GUI.SetNextControlName( m_uniqueName ); + m_propertyInspectorName = EditorGUITextField( m_titleClickArea, string.Empty, m_propertyInspectorName, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); + if( EditorGUI.EndChangeCheck() ) + { + SetClippedTitle( m_propertyInspectorName, m_longNameSize ); + m_sizeIsDirty = true; + m_isDirty = true; + if( m_propertyInspectorName.Length > 0 ) + { + BeginPropertyFromInspectorCheck(); + } + } + + if( m_startEditing ) + EditorGUI.FocusTextInControl( m_uniqueName ); + //if( m_stopEditing ) + // GUI.FocusControl( null ); + } + + if( drawInfo.CurrentEventType == EventType.Repaint ) + { + if( m_startEditing ) + { + m_startEditing = false; + m_isEditing = true; + } + + if( m_stopEditing ) + { + m_stopEditing = false; + m_isEditing = false; + GUI.FocusControl( null ); + } + } + + + if( m_freeType ) + { + if( m_dropdownEditing ) + { + PropertyType parameterType = (PropertyType)EditorGUIEnumPopup( m_dropdownRect, m_currentParameterType, UIUtils.PropertyPopUp ); + if( parameterType != m_currentParameterType ) + { + ChangeParameterType( parameterType ); + BeginPropertyFromInspectorCheck(); + DropdownEditing = false; + } + } + } + } + + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + //base.OnNodeLayout( drawInfo ); + if( m_reRegisterName ) + { + m_reRegisterName = false; + UIUtils.RegisterUniformName( UniqueId, m_propertyName ); + } + + CheckDelayedDirtyProperty(); + + if( m_currentParameterType != m_lastParameterType || m_propertyNameIsDirty ) + { + m_lastParameterType = m_currentParameterType; + m_propertyNameIsDirty = false; + OnDirtyProperty(); + if( m_currentParameterType != PropertyType.Constant ) + { + SetClippedTitle( m_propertyInspectorName, m_longNameSize ); + //bool globalHandler = false; + //if( globalHandler ) + //{ + string currValue = ( m_currentParameterType == PropertyType.Global && m_globalDefaultBehavior ) ? "" : GetPropertyValStr(); + SetClippedAdditionalTitle( string.Format( m_useVarSubtitle ? GetSubTitleVarNameFormatStr() : Constants.SubTitleValueFormatStr, currValue ), m_longNameSize, LongNameEnder ); + //} + //else + //{ + // if( m_currentParameterType == PropertyType.Global ) + // { + // SetAdditonalTitleText( "Global" ); + // } + // else + // { + // SetAdditonalTitleText( string.Format( m_useVarSubtitle ? GetSubTitleVarNameFormatStr() : Constants.SubTitleValueFormatStr, GetPropertyValStr() ) ); + // } + //} + } + else + { + SetClippedTitle( m_propertyInspectorName, m_longNameSize ); + SetClippedAdditionalTitle( string.Format( Constants.SubTitleConstFormatStr, GetPropertyValStr() ), m_longNameSize, LongNameEnder ); + } + } + + CheckPropertyFromInspector(); + CheckDuplicateProperty(); + // RUN LAYOUT CHANGES AFTER TITLES CHANGE + base.OnNodeLayout( drawInfo ); + + m_titleClickArea = m_titlePos; + m_titleClickArea.height = Constants.NODE_HEADER_HEIGHT; + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + base.OnNodeRepaint( drawInfo ); + + if( !m_isVisible ) + return; + + // Fixed Title ( only renders when not editing ) + if( m_showTitleWhenNotEditing && !m_isEditing && !m_startEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + GUI.Label( m_titleClickArea, m_content, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); + } + } + + public void RegisterFirstAvailablePropertyName( bool releaseOldOne, bool appendIndexToCurrOne = false ) + { + if( releaseOldOne ) + UIUtils.ReleaseUniformName( UniqueId, m_oldName ); + + if( m_isNodeBeingCopied || appendIndexToCurrOne ) + { + if( string.IsNullOrEmpty( m_propertyName ) ) + return; + + string newPropertyName = UIUtils.GetUniqueUniformName( m_propertyName ); + if( newPropertyName != m_propertyName ) + { + UIUtils.RegisterUniformName( UniqueId, newPropertyName ); + m_propertyName = newPropertyName; + } + else + { + if( UIUtils.IsUniformNameAvailable( m_propertyName ) ) + UIUtils.RegisterUniformName( UniqueId, m_propertyName ); + else + UIUtils.GetFirstAvailableName( UniqueId, m_outputPorts[ 0 ].DataType, out m_propertyName, out m_propertyInspectorName, !string.IsNullOrEmpty( m_customPrefix ), m_customPrefix ); + } + + } + else + { + UIUtils.GetFirstAvailableName( UniqueId, m_outputPorts[ 0 ].DataType, out m_propertyName, out m_propertyInspectorName, !string.IsNullOrEmpty( m_customPrefix ), m_customPrefix ); + } + m_oldName = m_propertyName; + m_propertyNameIsDirty = true; + m_reRegisterName = false; + OnPropertyNameChanged(); + } + + public void SetRawPropertyName( string name ) + { + m_propertyName = name; + } + + public void RegisterPropertyName( bool releaseOldOne, string newName, bool autoGlobal = true, bool forceUnderscore = false ) + { + if( m_currentParameterType != PropertyType.Constant && m_variableMode == VariableMode.Fetch ) + { + string localPropertyName = string.Empty; + if( autoGlobal ) + localPropertyName = UIUtils.GeneratePropertyName( newName, m_currentParameterType, forceUnderscore ); + else + { + localPropertyName = UIUtils.GeneratePropertyName( m_propertyName, PropertyType.Global, forceUnderscore ); + if( UIUtils.IsNumericName( localPropertyName ) ) + { + m_propertyName = m_oldName; + } + + } + + m_propertyName = localPropertyName; + m_propertyInspectorName = newName; + m_propertyNameIsDirty = true; + m_reRegisterName = false; + OnPropertyNameChanged(); + return; + } + + string propertyName = string.Empty; + if( autoGlobal ) + propertyName = UIUtils.GeneratePropertyName( newName, m_currentParameterType, forceUnderscore ); + else + { + propertyName = UIUtils.GeneratePropertyName( m_propertyName, PropertyType.Global, forceUnderscore ); + if( UIUtils.IsNumericName( propertyName ) ) + { + m_propertyName = m_oldName; + } + } + + if( m_propertyName.Equals( propertyName ) ) + return; + + if( UIUtils.IsUniformNameAvailable( propertyName ) || m_allowPropertyDuplicates ) + { + if( releaseOldOne ) + UIUtils.ReleaseUniformName( UniqueId, m_oldName ); + + m_oldName = propertyName; + m_propertyName = propertyName; + if( autoGlobal ) + m_propertyInspectorName = newName; + m_propertyNameIsDirty = true; + m_reRegisterName = false; + UIUtils.RegisterUniformName( UniqueId, propertyName ); + OnPropertyNameChanged(); + } + else + { + GUI.FocusControl( string.Empty ); + RegisterFirstAvailablePropertyName( releaseOldOne ); + UIUtils.ShowMessage( UniqueId, string.Format( "Property name '{0}' is already in use. Reverting to last valid name '{1}'", propertyName, m_oldName ) ); + } + } + + protected string CreateLocalVarDec( string value ) + { + return string.Format( Constants.PropertyLocalVarDec, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ), m_propertyName, value ); + } + + public virtual void CheckIfAutoRegister( ref MasterNodeDataCollector dataCollector ) + { + // Also testing inside shader function because node can be used indirectly over a custom expression and directly over a Function Output node + // That isn't being used externaly making it to not be registered ( since m_connStatus it set to Connected by being connected to an output node + if( CurrentParameterType != PropertyType.Constant && m_autoRegister && ( m_connStatus != NodeConnectionStatus.Connected || InsideShaderFunction ) ) + { + RegisterProperty( ref dataCollector ); + } + } + + virtual protected void RegisterProperty( ref MasterNodeDataCollector dataCollector ) + { + CheckPropertyFromInspector( true ); + if( m_propertyName.Length == 0 ) + { + RegisterFirstAvailablePropertyName( false ); + } + + switch( CurrentParameterType ) + { + case PropertyType.Property: + { + //Debug.Log( this.GetInstanceID()+" "+ OrderIndex+" "+GetPropertyValue() ); + dataCollector.AddToProperties( UniqueId, GetPropertyValue(), OrderIndex ); + string dataType = string.Empty; + string dataName = string.Empty; + bool fullValue = false; + if( m_variableMode == VariableMode.Create && GetUniformData( out dataType, out dataName, ref fullValue ) ) + { + if( fullValue ) + { + dataCollector.AddToUniforms( UniqueId, dataName, m_srpBatcherCompatible ); + } + else + { + dataCollector.AddToUniforms( UniqueId, dataType, dataName, m_srpBatcherCompatible, m_excludeUniform ); + } + } + + if( m_hybridInstanced && dataCollector.IsTemplate && dataCollector.IsSRP ) + { + dataCollector.AddToDotsProperties( m_outputPorts[ 0 ].DataType, UniqueId, m_propertyName, OrderIndex, CurrentPrecisionType ); + } + //dataCollector.AddToUniforms( m_uniqueId, GetUniformValue() ); + } + break; + case PropertyType.InstancedProperty: + { + dataCollector.AddToPragmas( UniqueId, IOUtils.InstancedPropertiesHeader ); + + if( m_registerPropertyOnInstancing ) + dataCollector.AddToProperties( UniqueId, GetPropertyValue(), OrderIndex ); + + dataCollector.AddToInstancedProperties( m_outputPorts[ 0 ].DataType, UniqueId, GetInstancedUniformValue( dataCollector.IsTemplate, dataCollector.IsSRP ), OrderIndex ); + } + break; + case PropertyType.Global: + { + string dataType = string.Empty; + string dataName = string.Empty; + bool fullValue = false; + if( m_variableMode == VariableMode.Create && GetUniformData( out dataType, out dataName, ref fullValue ) ) + { + if( fullValue ) + { + dataCollector.AddToUniforms( UniqueId, dataName, m_addGlobalToSRPBatcher ); + } + else + { + dataCollector.AddToUniforms( UniqueId, dataType, dataName, m_addGlobalToSRPBatcher, m_excludeUniform ); + } + } + //dataCollector.AddToUniforms( m_uniqueId, GetUniformValue() ); + } + break; + case PropertyType.Constant: break; + } + dataCollector.AddPropertyNode( this ); + if( m_currentParameterType == PropertyType.InstancedProperty && !m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + { + string instancedVar = dataCollector.IsSRP ? + //m_propertyName : + string.Format( IOUtils.LWSRPInstancedPropertiesData, dataCollector.InstanceBlockName, m_propertyName ) : + string.Format( IOUtils.InstancedPropertiesData, m_propertyName ); + + bool insideSF = InsideShaderFunction; + ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; + if( insideSF ) + ContainerGraph.ParentWindow.CustomGraph = this.ContainerGraph; + + RegisterLocalVariable( 0, instancedVar, ref dataCollector, m_propertyName + "_Instance" ); + + if( insideSF ) + ContainerGraph.ParentWindow.CustomGraph = cachedGraph; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + RegisterProperty( ref dataCollector ); + return string.Empty; + } + + public override void Destroy() + { + base.Destroy(); + UIUtils.UnregisterRawPropertyNode( this ); + if( !string.IsNullOrEmpty( m_propertyName ) && UniqueId >= 0 ) + UIUtils.ReleaseUniformName( UniqueId, m_propertyName ); + + if( m_currentParameterType == PropertyType.InstancedProperty ) + { + UIUtils.CurrentWindow.OutsideGraph.RemoveInstancePropertyCount(); + UIUtils.UnregisterPropertyNode( this ); + } + + if( m_currentParameterType == PropertyType.Property ) + { + UIUtils.UnregisterPropertyNode( this ); + } + + if( m_availableAttribs != null ) + m_availableAttribs.Clear(); + + m_availableAttribs = null; + } + private const string HeaderFormatStr = "[Header({0})]"; + string BuildHeader() + { + string result = string.Empty; + for( int i = 0; i < m_headerAttributeValues.Count; i++ ) + { + result += string.Format( HeaderFormatStr, m_headerAttributeValues[ i ] ); + } + return result; + } + + string BuildEnum() + { + string result = "[Enum("; + if( m_enumModeInt == 0 ) + { + for( int i = 0; i < m_enumNames.Count; i++ ) + { + result += m_enumNames[ i ] + "," + m_enumValues[ i ]; + if( i + 1 < m_enumNames.Count ) + result += ","; + } + } + else + { + result += m_enumClassName; + } + result += ")]"; + return result; + } + + public string PropertyAttributes + { + get + { + int attribCount = m_selectedAttribs.Count; + + if( m_selectedAttribs.Count == 0 && m_customAttrCount == 0 ) + return string.Empty; + + string attribs = string.Empty; + for( int i = 0; i < attribCount; i++ ) + { + if( m_availableAttribs[ m_selectedAttribs[ i ] ].Name.Equals( "Enum" ) ) + attribs += BuildEnum(); + else if( m_availableAttribs[ m_selectedAttribs[ i ] ].Name.Equals( HeaderId ) ) + attribs += BuildHeader(); + else + attribs += m_availableAttribs[ m_selectedAttribs[ i ] ].Attribute; + } + + for( int i = 0; i < m_customAttrCount; i++ ) + { + if( !string.IsNullOrEmpty( m_customAttr[ i ] ) ) + attribs += "[" + m_customAttr[ i ] + "]"; + } + return attribs; + } + } + public virtual void OnDirtyProperty() { } + public virtual void OnPropertyNameChanged() { UIUtils.UpdatePropertyDataNode( UniqueId, PropertyInspectorName ); } + public virtual void DrawSubProperties() { } + public virtual void DrawMaterialProperties() { } + + public virtual string GetPropertyValue() { return string.Empty; } + + public string GetInstancedUniformValue( bool isTemplate, bool isSRP ) + { + if( isTemplate ) + { + if( isSRP ) + { + return string.Format( IOUtils.LWSRPInstancedPropertiesElement, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ), m_propertyName ); + //return GetUniformValue(); + } + else + { + return string.Format( IOUtils.InstancedPropertiesElement, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ), m_propertyName ); + } + } + else + return string.Format( IOUtils.InstancedPropertiesElementTabs, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ), m_propertyName ); + } + + public string GetInstancedUniformValue( bool isTemplate, bool isSRP, WirePortDataType dataType, string value ) + { + if( isTemplate ) + { + if( isSRP ) + { + //return GetUniformValue( dataType, value ); + return string.Format( IOUtils.LWSRPInstancedPropertiesElement, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, dataType ), value ); + } + else + { + return string.Format( IOUtils.InstancedPropertiesElement, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, dataType ), value ); + } + } + else + return string.Format( IOUtils.InstancedPropertiesElementTabs, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, dataType ), value ); + } + + public virtual string GetUniformValue() + { + bool excludeUniformKeyword = ( m_currentParameterType == PropertyType.InstancedProperty ) || + m_containerGraph.IsSRP; + int index = excludeUniformKeyword ? 1 : 0; + return string.Format( Constants.UniformDec[ index ], UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ), m_propertyName ); + } + + public string GetUniformValue( WirePortDataType dataType, string value ) + { + bool excludeUniformKeyword = ( m_currentParameterType == PropertyType.InstancedProperty ) || + m_containerGraph.IsSRP; + int index = excludeUniformKeyword ? 1 : 0; + return string.Format( Constants.UniformDec[ index ], UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, dataType ), value ); + } + + public virtual bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) + { + dataType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + dataName = m_propertyName; + fullValue = false; + return true; + } + + public PropertyType CurrentParameterType + { + get { return m_currentParameterType; } + set { m_currentParameterType = value; } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentParameterType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_propertyName ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_propertyInspectorName ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_orderIndex ); + int attribCount = m_selectedAttribs.Count; + IOUtils.AddFieldValueToString( ref nodeInfo, attribCount ); + if( attribCount > 0 ) + { + for( int i = 0; i < attribCount; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_availableAttribs[ m_selectedAttribs[ i ] ].Attribute ); + } + } + IOUtils.AddFieldValueToString( ref nodeInfo, m_variableMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_autoGlobalName ); + + int headerCount = m_headerAttributeValues.Count; + IOUtils.AddFieldValueToString( ref nodeInfo, headerCount ); + for( int i = 0; i < headerCount; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_headerAttributeValues[ i ] ); + } + + IOUtils.AddFieldValueToString( ref nodeInfo, m_enumCount ); + for( int i = 0; i < m_enumCount; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_enumNames[ i ] ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_enumValues[ i ] ); + } + IOUtils.AddFieldValueToString( ref nodeInfo, m_enumModeInt ); + if( m_enumModeInt == 1 ) + IOUtils.AddFieldValueToString( ref nodeInfo, m_enumClassName ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_autoRegister ); + + IOUtils.AddFieldValueToString( ref nodeInfo, m_customAttrCount ); + if( m_customAttrCount > 0 ) + { + for( int i = 0; i < m_customAttrCount; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_customAttr[ i ] ); + } + } + + IOUtils.AddFieldValueToString( ref nodeInfo, m_hybridInstanced ); + } + + int IdForAttrib( string name ) + { + int attribCount = m_availableAttribs.Count; + for( int i = 0; i < attribCount; i++ ) + { + if( m_availableAttribs[ i ].Attribute.Equals( name ) || + (m_availableAttribs[ i ].HasDeprecatedValue && m_availableAttribs[ i ].DeprecatedValue.Equals( name ) ) ) + return i; + } + return -1; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() < 2505 ) + { + string property = GetCurrentParam( ref nodeParams ); + m_currentParameterType = property.Equals( "Uniform" ) ? PropertyType.Global : (PropertyType)Enum.Parse( typeof( PropertyType ), property ); + } + else + { + m_currentParameterType = (PropertyType)Enum.Parse( typeof( PropertyType ), GetCurrentParam( ref nodeParams ) ); + } + + if( m_currentParameterType == PropertyType.InstancedProperty ) + { + UIUtils.CurrentWindow.OutsideGraph.AddInstancePropertyCount(); + UIUtils.RegisterPropertyNode( this ); + } + + if( m_currentParameterType == PropertyType.Property ) + { + UIUtils.RegisterPropertyNode( this ); + } + + m_propertyName = GetCurrentParam( ref nodeParams ); + m_propertyInspectorName = GetCurrentParam( ref nodeParams ); + + if( UIUtils.CurrentShaderVersion() > 13 ) + { + m_orderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 4102 ) + { + int attribAmount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( attribAmount > 0 ) + { + for( int i = 0; i < attribAmount; i++ ) + { + string attribute = GetCurrentParam( ref nodeParams ); + int idForAttribute = IdForAttrib( attribute ); + if( idForAttribute >= 0 ) + { + m_selectedAttribs.Add( idForAttribute ); + } + else + { + UIUtils.ShowMessage( UniqueId, string.Format( InvalidAttributeFormatter, attribute,m_propertyInspectorName ) , MessageSeverity.Warning ); + } + } + + m_visibleAttribsFoldout = true; + } + InitializeAttribsArray(); + } + + + if( UIUtils.CurrentShaderVersion() > 14003 ) + { + m_variableMode = (VariableMode)Enum.Parse( typeof( VariableMode ), GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 14201 ) + { + m_autoGlobalName = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 18707 ) + { + if( UIUtils.CurrentShaderVersion() == 18708 ) + { + m_headerAttributeValues.Add( GetCurrentParam( ref nodeParams ) ); + } + else + { + int headerCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + for( int i = 0; i < headerCount; i++ ) + { + m_headerAttributeValues.Add( GetCurrentParam( ref nodeParams ) ); + } + } + } + + if( UIUtils.CurrentShaderVersion() > 14403 ) + { + m_enumCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + for( int i = 0; i < m_enumCount; i++ ) + { + m_enumNames.Add( GetCurrentParam( ref nodeParams ) ); + m_enumValues.Add( Convert.ToInt32( GetCurrentParam( ref nodeParams ) ) ); + } + } + + if( UIUtils.CurrentShaderVersion() > 14501 ) + { + m_enumModeInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( m_enumModeInt == 1 ) + m_enumClassName = GetCurrentParam( ref nodeParams ); + m_autoRegister = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + + m_customAttrCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + for( int i = 0; i < m_customAttrCount; i++ ) + { + m_customAttr.Add( GetCurrentParam( ref nodeParams ) ); + } + if( m_customAttrCount > 0 ) + { + m_visibleCustomAttrFoldout = true; + m_visibleAttribsFoldout = true; + } + } + + if( UIUtils.CurrentShaderVersion() > 18003 ) + { + m_hybridInstanced = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + CheckEnumAttribute(); + CheckHeaderAttribute(); + if( m_enumCount > 0 ) + m_visibleEnumsFoldout = true; + + m_propertyNameIsDirty = true; + m_reRegisterName = false; + + if( !m_isNodeBeingCopied ) + { + if( m_variableMode != VariableMode.Fetch || m_currentParameterType == PropertyType.Constant ) + { + UIUtils.ReleaseUniformName( UniqueId, m_oldName ); + UIUtils.RegisterUniformName( UniqueId, m_propertyName ); + m_oldName = m_propertyName; + } + } + else + { + m_oldName = m_propertyName; + } + + ReleaseRansomedProperty(); + + } + + public virtual void ReleaseRansomedProperty() + { + if( m_variableMode == VariableMode.Fetch/* && m_autoGlobalName */) + { + //Fooling setter to have a different value + m_variableMode = VariableMode.Create; + CurrentVariableMode = VariableMode.Fetch; + } + } + + void UpdateTooltip() + { + string currValue = string.Empty; + if( m_currentParameterType != PropertyType.Constant ) + { + currValue = ( m_currentParameterType == PropertyType.Global && m_globalDefaultBehavior ) ? "" : GetPropertyValStr(); + } + else + { + currValue = GetPropertyValStr(); + } + + m_tooltipText = string.Format( TooltipFormatter, m_nodeAttribs.Description, m_propertyInspectorName, currValue ); + } + + public override void SetClippedTitle( string newText, int maxSize = 170, string endString = "..." ) + { + base.SetClippedTitle( newText, maxSize, endString ); + UpdateTooltip(); + } + + public override void SetClippedAdditionalTitle( string newText, int maxSize = 170, string endString = "..." ) + { + base.SetClippedAdditionalTitle( newText, maxSize, endString ); + UpdateTooltip(); + } + + public override void OnEnable() + { + base.OnEnable(); + m_reRegisterName = true; + } + + public bool CanDrawMaterial { get { return m_materialMode && m_currentParameterType != PropertyType.Constant; } } + public int RawOrderIndex + { + get { return m_orderIndex; } + } + + public int OrderIndex + { + get { return m_orderIndex + m_orderIndexOffset; } + set { m_orderIndex = value; } + } + + public int OrderIndexOffset + { + get { return m_orderIndexOffset; } + set { m_orderIndexOffset = value; } + } + + public VariableMode CurrentVariableMode + { + get { return m_variableMode; } + set + { + if( value != m_variableMode ) + { + m_variableMode = value; + if( value == VariableMode.Fetch ) + { + // Release ownership on name + if( UIUtils.CheckUniformNameOwner( m_oldName ) == UniqueId ) + { + UIUtils.ReleaseUniformName( UniqueId , m_oldName ); + } + m_oldName = m_propertyName; + } + else + { + if( !m_propertyName.Equals( m_oldName ) ) + { + if( UIUtils.IsUniformNameAvailable( m_propertyName ) ) + { + UIUtils.ReleaseUniformName( UniqueId, m_oldName ); + UIUtils.RegisterUniformName( UniqueId, m_propertyName ); + } + else + { + UIUtils.ShowMessage( UniqueId, string.Format( FetchToCreateDuplicatesMsg, m_propertyName, m_oldName ), MessageSeverity.Warning ); + m_propertyName = m_oldName; + } + m_propertyNameIsDirty = true; + OnPropertyNameChanged(); + } + else + { + if( UIUtils.IsUniformNameAvailable( m_propertyName ) ) + { + UIUtils.RegisterUniformName( UniqueId , m_propertyName ); + } + else if( UIUtils.CheckUniformNameOwner( m_propertyName ) != UniqueId ) + { + string oldProperty = m_propertyName; + RegisterFirstAvailablePropertyName( false ); + UIUtils.ShowMessage( UniqueId, string.Format( FetchToCreateOnDuplicateNodeMsg, m_propertyName, oldProperty ), MessageSeverity.Warning ); + } + } + } + } + } + } + + public string PropertyData( MasterNodePortCategory portCategory ) + { + return ( m_currentParameterType == PropertyType.InstancedProperty ) ? m_outputPorts[ 0 ].LocalValue( portCategory ) : m_propertyName; + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + if( m_currentParameterType == PropertyType.Global && m_globalDefaultBehavior && ( EditorApplication.timeSinceStartup - m_globalFetchTimestamp ) > MaxGlobalFetchTimestamp ) + { + FetchGlobalValue(); + m_globalFetchTimestamp = EditorApplication.timeSinceStartup; + } + } + + public void ShowGlobalValueButton() + { + if( GUILayout.Button( "Set Global Value" ) ) + { + SetGlobalValue(); + } + } + + public override bool CheckFindText( string text ) + { + return base.CheckFindText( text ) || + m_propertyName.IndexOf( text, StringComparison.CurrentCultureIgnoreCase ) >= 0 || + m_propertyInspectorName.IndexOf( text, StringComparison.CurrentCultureIgnoreCase ) >= 0; + } + + //This should only be used on template internal properties + public void PropertyNameFromTemplate( TemplateShaderPropertyData data ) + { + m_propertyName = data.PropertyName; + m_propertyInspectorName = data.PropertyInspectorName; + } + public virtual void GeneratePPSInfo( ref string propertyDeclaration, ref string propertySet ) { } + public virtual void SetGlobalValue() { } + public virtual void FetchGlobalValue() { } + + public virtual string PropertyName { get { return m_propertyName; } } + public virtual string PropertyInspectorName { get { return m_propertyInspectorName; } } + public bool FreeType { get { return m_freeType; } set { m_freeType = value; } } + public bool ReRegisterName { get { return m_reRegisterName; } set { m_reRegisterName = value; } } + public string CustomPrefix { get { return m_customPrefix; } set { m_customPrefix = value; } } + public override void RefreshOnUndo() + { + base.RefreshOnUndo(); + BeginPropertyFromInspectorCheck(); + } + public override string DataToArray { get { return PropertyInspectorName; } } + public bool RegisterPropertyOnInstancing { get { return m_registerPropertyOnInstancing; } set { m_registerPropertyOnInstancing = value; } } + public bool SrpBatcherCompatible { get { return m_srpBatcherCompatible; } } + public bool AddGlobalToSRPBatcher { get { return m_addGlobalToSRPBatcher; } set { m_addGlobalToSRPBatcher = value; } } + public bool AutoRegister { get { return m_autoRegister; } set { m_autoRegister = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs.meta new file mode 100644 index 00000000..5b8389da --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5bbfd66571b12f84983b398231271694 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs new file mode 100644 index 00000000..616c66d7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs @@ -0,0 +1,534 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Float", "Constants And Properties", "Float property", null, KeyCode.Alpha1 )] + public sealed class RangedFloatNode : PropertyNode + { + private const int OriginalFontSize = 11; + + private const string MinValueStr = "Min"; + private const string MaxValueStr = "Max"; + + private const float LabelWidth = 8; + + [SerializeField] + private float m_defaultValue = 0; + + [SerializeField] + private float m_materialValue = 0; + + [SerializeField] + private float m_min = 0; + + [SerializeField] + private float m_max = 0; + + [SerializeField] + private bool m_floatMode = true; + + private int m_cachedPropertyId = -1; + + private bool m_isEditingFields; + private Vector3 m_previousValue = Vector3.zero; + private string[] m_fieldText = new string[] { "0", "0", "0" }; + + public RangedFloatNode() : base() { } + public RangedFloatNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Float" ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_insideSize.Set( 50, 0 ); + m_showPreview = false; + m_showHybridInstancedUI = true; + m_selectedLocation = PreviewLocation.BottomCenter; + m_availableAttribs.Add( new PropertyAttributes( "Toggle", "[Toggle]" ) ); + m_availableAttribs.Add( new PropertyAttributes( "No Keyword Toggle", "[ToggleUI]","[NoKeywordToggle]" ) ); + m_availableAttribs.Add( new PropertyAttributes( "Int Range", "[IntRange]" ) ); + m_availableAttribs.Add( new PropertyAttributes( "Enum", "[Enum]" ) ); + m_previewShaderGUID = "d9ca47581ac157145bff6f72ac5dd73e"; + m_srpBatcherCompatible = true; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + UIUtils.RegisterFloatIntNode( this ); + } + + public override void Destroy() + { + base.Destroy(); + UIUtils.UnregisterFloatIntNode( this ); + } + + public override void OnDirtyProperty() + { + UIUtils.UpdateFloatIntDataNode( UniqueId, PropertyInspectorName ); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + OnPropertyNameChanged(); + OnDirtyProperty(); + } + + public void SetFloatMode( bool value ) + { + if ( m_floatMode == value ) + return; + + m_floatMode = value; + if ( value ) + { + m_insideSize.x = 50;// + ( m_showPreview ? 50 : 0 ); + //m_firstPreviewDraw = true; + } + else + { + m_insideSize.x = 200;// + ( m_showPreview ? 0 : 0 ); + //m_firstPreviewDraw = true; + } + m_sizeIsDirty = true; + } + + public override void CopyDefaultsToMaterial() + { + m_materialValue = m_defaultValue; + } + + void DrawMinMaxUI() + { + EditorGUI.BeginChangeCheck(); + m_min = EditorGUILayoutFloatField( MinValueStr, m_min ); + m_max = EditorGUILayoutFloatField( MaxValueStr, m_max ); + if ( m_min > m_max ) + m_min = m_max; + + if ( m_max < m_min ) + m_max = m_min; + + if ( EditorGUI.EndChangeCheck() ) + { + SetFloatMode( m_min == m_max ); + } + } + public override void DrawSubProperties() + { + DrawMinMaxUI(); + + if ( m_floatMode ) + { + m_defaultValue = EditorGUILayoutFloatField( Constants.DefaultValueLabel, m_defaultValue ); + } + else + { + m_defaultValue = EditorGUILayoutSlider( Constants.DefaultValueLabel, m_defaultValue, m_min, m_max ); + } + } + + public override void DrawMaterialProperties() + { + DrawMinMaxUI(); + + EditorGUI.BeginChangeCheck(); + + if ( m_floatMode ) + { + m_materialValue = EditorGUILayoutFloatField( Constants.MaterialValueLabel, m_materialValue ); + } + else + { + m_materialValue = EditorGUILayoutSlider( Constants.MaterialValueLabel, m_materialValue, m_min, m_max ); + } + if ( EditorGUI.EndChangeCheck() ) + { + //MarkForPreviewUpdate(); + if ( m_materialMode ) + m_requireMaterialUpdate = true; + } + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if ( m_cachedPropertyId == -1 ) + m_cachedPropertyId = Shader.PropertyToID( "_InputFloat" ); + + if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) + PreviewMaterial.SetFloat( m_cachedPropertyId, m_materialValue ); + else + PreviewMaterial.SetFloat( m_cachedPropertyId, m_defaultValue ); + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + + if ( m_floatMode ) + { + m_propertyDrawPos = m_remainingBox; + m_propertyDrawPos.x = m_remainingBox.x - LabelWidth * drawInfo.InvertedZoom; + m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; + m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; + } + else + { + m_propertyDrawPos = m_remainingBox; + m_propertyDrawPos.width = m_outputPorts[ 0 ].Position.x - m_propertyDrawPos.x - (m_outputPorts[ 0 ].LabelSize.x + (Constants.PORT_TO_LABEL_SPACE_X + 3) * drawInfo.InvertedZoom + 2); + m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; + } + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if ( drawInfo.CurrentEventType != EventType.MouseDown ) + return; + + Rect hitBox = m_remainingBox; + hitBox.xMin -= LabelWidth * drawInfo.InvertedZoom; + bool insideBox = hitBox.Contains( drawInfo.MousePosition ); + + if ( insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = true; + } + else if ( m_isEditingFields && !insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = false; + } + } + void DrawFakeFloatMaterial( DrawInfo drawInfo ) + { + if( m_floatMode ) + { + //UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_materialValue, LabelWidth * drawInfo.InvertedZoom ); + Rect fakeField = m_propertyDrawPos; + fakeField.xMin += LabelWidth * drawInfo.InvertedZoom; + if( GUI.enabled ) + { + Rect fakeLabel = m_propertyDrawPos; + fakeLabel.xMax = fakeField.xMin; + EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); + EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); + } + if( m_previousValue[ 0 ] != m_materialValue ) + { + m_previousValue[ 0 ] = m_materialValue; + m_fieldText[ 0 ] = m_materialValue.ToString(); + } + + GUI.Label( fakeField, m_fieldText[ 0 ], UIUtils.MainSkin.textField ); + } + else + { + DrawFakeSlider( ref m_materialValue, drawInfo ); + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if ( !m_isVisible ) + return; + + if ( m_isEditingFields && m_currentParameterType != PropertyType.Global ) + { + if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) + { + EditorGUI.BeginChangeCheck(); + if ( m_floatMode ) + { + UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_materialValue, LabelWidth * drawInfo.InvertedZoom ); + } + else + { + DrawSlider( ref m_materialValue, drawInfo ); + } + if ( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + m_requireMaterialUpdate = true; + if ( m_currentParameterType != PropertyType.Constant ) + { + BeginDelayedDirtyProperty(); + } + } + } + else + { + EditorGUI.BeginChangeCheck(); + + if ( m_floatMode ) + { + UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_defaultValue, LabelWidth * drawInfo.InvertedZoom ); + } + else + { + DrawSlider( ref m_defaultValue, drawInfo ); + } + if ( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + BeginDelayedDirtyProperty(); + } + + } + } + else if ( drawInfo.CurrentEventType == EventType.Repaint && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) + { + if( m_currentParameterType == PropertyType.Global ) + { + bool guiEnabled = GUI.enabled; + GUI.enabled = false; + DrawFakeFloatMaterial( drawInfo ); + GUI.enabled = guiEnabled; + } + else if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) + { + DrawFakeFloatMaterial( drawInfo ); + } + else + { + if ( m_floatMode ) + { + //UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_defaultValue, LabelWidth * drawInfo.InvertedZoom ); + Rect fakeField = m_propertyDrawPos; + fakeField.xMin += LabelWidth * drawInfo.InvertedZoom; + Rect fakeLabel = m_propertyDrawPos; + fakeLabel.xMax = fakeField.xMin; + EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); + EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); + + if ( m_previousValue[ 0 ] != m_defaultValue ) + { + m_previousValue[ 0 ] = m_defaultValue; + m_fieldText[ 0 ] = m_defaultValue.ToString(); + } + + GUI.Label( fakeField, m_fieldText[ 0 ], UIUtils.MainSkin.textField ); + } + else + { + DrawFakeSlider( ref m_defaultValue, drawInfo ); + } + } + } + } + + void DrawFakeSlider( ref float value, DrawInfo drawInfo ) + { + float rangeWidth = 30 * drawInfo.InvertedZoom; + float rangeSpacing = 5 * drawInfo.InvertedZoom; + + //Min + Rect minRect = m_propertyDrawPos; + minRect.width = rangeWidth; + EditorGUIUtility.AddCursorRect( minRect, MouseCursor.Text ); + if ( m_previousValue[ 1 ] != m_min ) + { + m_previousValue[ 1 ] = m_min; + m_fieldText[ 1 ] = m_min.ToString(); + } + GUI.Label( minRect, m_fieldText[ 1 ], UIUtils.MainSkin.textField ); + + //Value Area + Rect valRect = m_propertyDrawPos; + valRect.width = rangeWidth; + valRect.x = m_propertyDrawPos.xMax - rangeWidth - rangeWidth - rangeSpacing; + EditorGUIUtility.AddCursorRect( valRect, MouseCursor.Text ); + if ( m_previousValue[ 0 ] != value ) + { + m_previousValue[ 0 ] = value; + m_fieldText[ 0 ] = value.ToString(); + } + GUI.Label( valRect, m_fieldText[ 0 ], UIUtils.MainSkin.textField ); + + //Max + Rect maxRect = m_propertyDrawPos; + maxRect.width = rangeWidth; + maxRect.x = m_propertyDrawPos.xMax - rangeWidth; + EditorGUIUtility.AddCursorRect( maxRect, MouseCursor.Text ); + if ( m_previousValue[ 2 ] != m_max ) + { + m_previousValue[ 2 ] = m_max; + m_fieldText[ 2 ] = m_max.ToString(); + } + GUI.Label( maxRect, m_fieldText[ 2 ], UIUtils.MainSkin.textField ); + + Rect sliderValRect = m_propertyDrawPos; + sliderValRect.x = minRect.xMax + rangeSpacing; + sliderValRect.xMax = valRect.xMin - rangeSpacing; + Rect sliderBackRect = sliderValRect; + sliderBackRect.height = 5 * drawInfo.InvertedZoom; + sliderBackRect.center = new Vector2( sliderValRect.center.x, Mathf.Round( sliderValRect.center.y ) ); + + + GUI.Label( sliderBackRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SliderStyle ) ); + + sliderValRect.width = 10; + float percent = ( value - m_min) / ( m_max-m_min ); + percent = Mathf.Clamp01( percent ); + sliderValRect.x += percent * (sliderBackRect.width - 10 * drawInfo.InvertedZoom ); + GUI.Label( sliderValRect, string.Empty, UIUtils.RangedFloatSliderThumbStyle ); + } + + void DrawSlider( ref float value, DrawInfo drawInfo ) + { + float rangeWidth = 30 * drawInfo.InvertedZoom; + float rangeSpacing = 5 * drawInfo.InvertedZoom; + + //Min + Rect minRect = m_propertyDrawPos; + minRect.width = rangeWidth; + m_min = EditorGUIFloatField( minRect, m_min, UIUtils.MainSkin.textField ); + + //Value Area + Rect valRect = m_propertyDrawPos; + valRect.width = rangeWidth; + valRect.x = m_propertyDrawPos.xMax - rangeWidth - rangeWidth - rangeSpacing; + value = EditorGUIFloatField( valRect, value, UIUtils.MainSkin.textField ); + + //Max + Rect maxRect = m_propertyDrawPos; + maxRect.width = rangeWidth; + maxRect.x = m_propertyDrawPos.xMax - rangeWidth; + m_max = EditorGUIFloatField( maxRect, m_max, UIUtils.MainSkin.textField ); + + //Value Slider + Rect sliderValRect = m_propertyDrawPos; + sliderValRect.x = minRect.xMax + rangeSpacing; + sliderValRect.xMax = valRect.xMin - rangeSpacing; + Rect sliderBackRect = sliderValRect; + sliderBackRect.height = 5 * drawInfo.InvertedZoom; + sliderBackRect.center = new Vector2( sliderValRect.center.x, Mathf.Round( sliderValRect.center.y )); + GUI.Label( sliderBackRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SliderStyle ) ); + value = GUIHorizontalSlider( sliderValRect, value, m_min, m_max, GUIStyle.none, UIUtils.RangedFloatSliderThumbStyle ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + if ( m_currentParameterType != PropertyType.Constant ) + return PropertyData( dataCollector.PortCategory ); + + return IOUtils.Floatify( m_defaultValue ); + } + + public override string GetPropertyValue() + { + string value = UIUtils.PropertyFloatToString( m_defaultValue ); + if ( m_floatMode ) + { + return PropertyAttributes + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + value; + } + else + { + string min = UIUtils.PropertyFloatToString( m_min ); + string max = UIUtils.PropertyFloatToString( m_max ); + return PropertyAttributes + m_propertyName + "(\"" + m_propertyInspectorName + "\", Range( " + min + " , " + max + ")) = " + value; + } + } + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + if ( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) + { + mat.SetFloat( m_propertyName, m_materialValue ); + } + } + + public override void SetMaterialMode( Material mat , bool fetchMaterialValues ) + { + base.SetMaterialMode( mat , fetchMaterialValues ); + if ( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) + { + m_materialValue = mat.GetFloat( m_propertyName ); + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) + { + m_materialValue = material.GetFloat( m_propertyName ); + PreviewIsDirty = true; + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_defaultValue = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 14101 ) + { + m_materialValue = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + } + + m_min = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + m_max = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + SetFloatMode( m_min == m_max ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_materialValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_min ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_max ); + } + + public override string GetPropertyValStr() + { + return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? + m_materialValue.ToString( Mathf.Abs( m_materialValue ) > 1000 ? Constants.PropertyBigFloatFormatLabel : Constants.PropertyFloatFormatLabel ) : + m_defaultValue.ToString( Mathf.Abs( m_defaultValue ) > 1000 ? Constants.PropertyBigFloatFormatLabel : Constants.PropertyFloatFormatLabel ); + } + + public override void SetGlobalValue() { Shader.SetGlobalFloat( m_propertyName, m_defaultValue ); } + public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalFloat( m_propertyName ); } + public float Value + { + get { return m_defaultValue; } + set { m_defaultValue = value; } + } + + public void SetMaterialValueFromInline( float val ) + { + m_materialValue = val; + m_requireMaterialUpdate = true; + } + public override void GeneratePPSInfo( ref string propertyDeclaration, ref string propertySet ) + { + string additionalHeaders = string.Empty; + if( !m_floatMode ) + { + additionalHeaders = string.Format( "Range( {0}, {1} ),", m_min, m_max ); + } + propertyDeclaration += string.Format( ASEPPSHelperTool.PPSPropertyDecFormat, additionalHeaders, PropertyInspectorName, + ASEPPSHelperTool.WireToPPSType[ WirePortDataType.FLOAT ], PropertyName, m_defaultValue ); + + propertySet += string.Format( ASEPPSHelperTool.PPSPropertySetFormat, "Float", PropertyName ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs.meta new file mode 100644 index 00000000..444a37a9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e81453c5ad3b8224db874b56bf00cad2 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables.meta new file mode 100644 index 00000000..22447d40 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 92f993d3ba8b1394eaf8c4fe308cab11 +folderAsset: yes +timeCreated: 1481126946 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen.meta new file mode 100644 index 00000000..e1fbf68d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8c4b0845954941d4d9809abaa67bdc2b +folderAsset: yes +timeCreated: 1481126947 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs new file mode 100644 index 00000000..0591ba12 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs @@ -0,0 +1,100 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + public enum BuiltInShaderCameraTypes + { + unity_CameraProjection = 0, + unity_CameraInvProjection + } + + [Serializable] + [NodeAttributes( "Projection Matrices", "Camera And Screen", "Camera's Projection/Inverse Projection matrix" )] + public sealed class CameraProjectionNode : ShaderVariablesNode + { + private const string _projMatrixLabelStr = "Projection Matrix"; + private readonly string[] _projMatrixValuesStr = { "Camera Projection", + "Inverse Camera Projection"}; + + + [SerializeField] + private BuiltInShaderCameraTypes m_selectedType = BuiltInShaderCameraTypes.unity_CameraProjection; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, _projMatrixValuesStr[ (int)m_selectedType ], WirePortDataType.FLOAT4x4 ); + m_textLabelWidth = 115; + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_selectedType = (BuiltInShaderCameraTypes)m_upperLeftWidget.DrawWidget( this, (int)m_selectedType, _projMatrixValuesStr ); + if( EditorGUI.EndChangeCheck() ) + { + ChangeOutputName( 0, _projMatrixValuesStr[ (int)m_selectedType ] ); + SetSaveIsDirty(); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_selectedType = (BuiltInShaderCameraTypes)EditorGUILayoutPopup( _projMatrixLabelStr, (int)m_selectedType, _projMatrixValuesStr ); + if( EditorGUI.EndChangeCheck() ) + { + ChangeOutputName( 0, _projMatrixValuesStr[ (int)m_selectedType ] ); + SetSaveIsDirty(); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + GeneratorUtils.RegisterUnity2019MatrixDefines( ref dataCollector ); + return m_selectedType.ToString(); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_selectedType = (BuiltInShaderCameraTypes)Enum.Parse( typeof( BuiltInShaderCameraTypes ), GetCurrentParam( ref nodeParams ) ); + ChangeOutputName( 0, _projMatrixValuesStr[ (int)m_selectedType ] ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedType ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs.meta new file mode 100644 index 00000000..8eda7f72 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f776bdd36b750304c8e0de8ee1f31fc0 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs new file mode 100644 index 00000000..429c915d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs @@ -0,0 +1,130 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public enum BuiltInShaderClipPlanesTypes + { + Left = 0, + Right, + Bottom, + Top, + Near, + Far + } + + [Serializable] + [NodeAttributes( "Clip Planes", "Camera And Screen", "Camera World Clip Planes" )] + public sealed class CameraWorldClipPlanes : ShaderVariablesNode + { + [SerializeField] + private BuiltInShaderClipPlanesTypes m_selectedType = BuiltInShaderClipPlanesTypes.Left; + + private const string LabelStr = "Plane"; + + private const string ValueStr = "unity_CameraWorldClipPlanes";//L,R,B,T,N,F + + private const string ValueHDRPStr = "_FrustumPlanes";// L,R,T,B,N,F + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + private int m_planeId; + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "ABCD", WirePortDataType.FLOAT4 ); + m_textLabelWidth = 55; + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_selectedType ) ); + m_previewShaderGUID = "6afe5a4ad7bbd0e4ab352c758f543a09"; + } + + public override void OnEnable() + { + base.OnEnable(); + m_planeId = Shader.PropertyToID( "_PlaneId" ); + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + m_upperLeftWidget.DrawWidget(ref m_selectedType, this, OnWidgetUpdate ); + } + + private readonly Action OnWidgetUpdate = ( x ) => { + x.SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, ( x as CameraWorldClipPlanes ).Type ) ); + }; + + public BuiltInShaderClipPlanesTypes Type { get { return m_selectedType; } } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_selectedType = ( BuiltInShaderClipPlanesTypes ) EditorGUILayoutEnumPopup( LabelStr, m_selectedType ); + if ( EditorGUI.EndChangeCheck() ) + { + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_selectedType ) ); + SetSaveIsDirty(); + } + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + PreviewMaterial.SetInt( m_planeId, (int)m_selectedType ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + if( dataCollector.TemplateDataCollectorInstance.IsHDRP ) + { + switch( m_selectedType ) + { + case BuiltInShaderClipPlanesTypes.Left: return ValueHDRPStr + "[0]"; + case BuiltInShaderClipPlanesTypes.Right: return ValueHDRPStr + "[1]"; + case BuiltInShaderClipPlanesTypes.Bottom: return ValueHDRPStr + "[3]"; + case BuiltInShaderClipPlanesTypes.Top: return ValueHDRPStr + "[2]"; + case BuiltInShaderClipPlanesTypes.Near: return ValueHDRPStr + "[4]"; + case BuiltInShaderClipPlanesTypes.Far: return ValueHDRPStr + "[5]"; + } + } + return ValueStr + "[" + ( int ) m_selectedType + "]"; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_selectedType = ( BuiltInShaderClipPlanesTypes ) Enum.Parse( typeof( BuiltInShaderClipPlanesTypes ), GetCurrentParam( ref nodeParams ) ); + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_selectedType ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedType ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs.meta new file mode 100644 index 00000000..f0e9d451 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e5a9a010f1c8dda449c8ca7ee9e25869 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs new file mode 100644 index 00000000..c2e93c26 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs @@ -0,0 +1,38 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Ortho Params", "Camera And Screen", "Orthographic Parameters" )] + public sealed class OrthoParams : ConstVecShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputName( 1, "Ortho Cam Width" ); + ChangeOutputName( 2, "Ortho Cam Height" ); + ChangeOutputName( 3, "Unused" ); + ChangeOutputName( 4, "Projection Mode" ); + m_value = "unity_OrthoParams"; + m_previewShaderGUID = "88a910ece3dce224793e669bb1bc158d"; + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( !m_outputPorts[ 0 ].IsConnected ) + { + m_outputPorts[ 0 ].Visible = false; + m_sizeIsDirty = true; + } + + if( !m_outputPorts[ 3 ].IsConnected ) + { + m_outputPorts[ 3 ].Visible = false; + m_sizeIsDirty = true; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs.meta new file mode 100644 index 00000000..102847ea --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f9431cdf8e81c1d4f902b3fa7d04f7ac +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs new file mode 100644 index 00000000..9e4357b7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs @@ -0,0 +1,32 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Projection Params", "Camera And Screen", "Projection Near/Far parameters" )] + public sealed class ProjectionParams : ConstVecShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputName( 1, "Flipped" ); + ChangeOutputName( 2, "Near Plane" ); + ChangeOutputName( 3, "Far Plane" ); + ChangeOutputName( 4, "1/Far Plane" ); + m_value = "_ProjectionParams"; + m_previewShaderGUID = "97ae846cb0a6b044388fad3bc03bb4c2"; + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( !m_outputPorts[ 0 ].IsConnected ) + { + m_outputPorts[ 0 ].Visible = false; + m_sizeIsDirty = true; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs.meta new file mode 100644 index 00000000..6be857ac --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ba1ca8bace2c2dd4dafac6f73f4dfb1b +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs new file mode 100644 index 00000000..5446ac2f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs @@ -0,0 +1,32 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Screen Params", "Camera And Screen", "Camera's Render Target size parameters" )] + public sealed class ScreenParams : ConstVecShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputName( 1, "RT Width" ); + ChangeOutputName( 2, "RT Height" ); + ChangeOutputName( 3, "1+1/Width" ); + ChangeOutputName( 4, "1+1/Height" ); + m_value = "_ScreenParams"; + m_previewShaderGUID = "78173633b803de4419206191fed3d61e"; + } + + //public override void RefreshExternalReferences() + //{ + // base.RefreshExternalReferences(); + // if( !m_outputPorts[ 0 ].IsConnected ) + // { + // m_outputPorts[ 0 ].Visible = false; + // m_sizeIsDirty = true; + // } + //} + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs.meta new file mode 100644 index 00000000..06ca78c8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2e593f23857d59643b5b5f6dd6264e1b +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs new file mode 100644 index 00000000..2342f158 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs @@ -0,0 +1,28 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "World Space Camera Pos", "Camera And Screen", "World Space Camera position" )] + public sealed class WorldSpaceCameraPos : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "XYZ", WirePortDataType.FLOAT3 ); + AddOutputPort( WirePortDataType.FLOAT, "X" ); + AddOutputPort( WirePortDataType.FLOAT, "Y" ); + AddOutputPort( WirePortDataType.FLOAT, "Z" ); + + m_value = "_WorldSpaceCameraPos"; + m_previewShaderGUID = "6b0c78411043dd24dac1152c84bb63ba"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + return GetOutputVectorItem( 0, outputId, base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs.meta new file mode 100644 index 00000000..ad409a55 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 972d92a6008896f4292a61726e18f667 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs new file mode 100644 index 00000000..4fcb5e19 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs @@ -0,0 +1,31 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Z-Buffer Params", "Camera And Screen", "Linearized Z buffer values" )] + public sealed class ZBufferParams : ConstVecShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputName( 1, "1-far/near" ); + ChangeOutputName( 2, "far/near" ); + ChangeOutputName( 3, "[0]/far" ); + ChangeOutputName( 4, "[1]/far" ); + m_value = "_ZBufferParams"; + m_previewShaderGUID = "56c42c106bcb497439187f5bb6b6f94d"; + } + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( !m_outputPorts[ 0 ].IsConnected ) + { + m_outputPorts[ 0 ].Visible = false; + m_sizeIsDirty = true; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs.meta new file mode 100644 index 00000000..ea6565c5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2765a41106f478f4982e859b978bdec4 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs new file mode 100644 index 00000000..d74d8a5f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs @@ -0,0 +1,39 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + public class ConstVecShaderVariable : ShaderVariablesNode + { + [SerializeField] + protected string m_value; + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, " ", WirePortDataType.FLOAT4 ); + AddOutputPort( WirePortDataType.FLOAT, "0" ); + AddOutputPort( WirePortDataType.FLOAT, "1" ); + AddOutputPort( WirePortDataType.FLOAT, "2" ); + AddOutputPort( WirePortDataType.FLOAT, "3" ); + } + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + switch ( outputId ) + { + case 0: return m_value; + case 1: return ( m_value + ".x" ); + case 2: return ( m_value + ".y" ); + case 3: return ( m_value + ".z" ); + case 4: return ( m_value + ".w" ); + } + + UIUtils.ShowMessage( UniqueId, "ConstVecShaderVariable generating empty code", MessageSeverity.Warning ); + return string.Empty; + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs.meta new file mode 100644 index 00000000..70bb3cd3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 9102c0b554fd5ad4785acf870dcc17eb +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs new file mode 100644 index 00000000..f30ec173 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs @@ -0,0 +1,35 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class ConstantShaderVariable : ShaderVariablesNode + { + [SerializeField] + protected string m_value; + + [SerializeField] + protected string m_valueHDRP = string.Empty; + + [SerializeField] + protected string m_valueURP = string.Empty; + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + if( dataCollector.IsTemplate ) + { + if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP && !string.IsNullOrEmpty( m_valueHDRP ) ) + return m_valueHDRP; + + if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.URP && !string.IsNullOrEmpty( m_valueURP )) + return m_valueURP; + } + return m_value; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs.meta new file mode 100644 index 00000000..8dd92aab --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 266391c3c4308014e9ce246e5484b917 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient.meta new file mode 100644 index 00000000..e0c69e86 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 78eb7b1e34d423c40a949c9e75b5f24a +folderAsset: yes +timeCreated: 1481126946 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs new file mode 100644 index 00000000..f0eced12 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs @@ -0,0 +1,126 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + public enum BuiltInFogAndAmbientColors + { + UNITY_LIGHTMODEL_AMBIENT = 0, + unity_AmbientSky, + unity_AmbientEquator, + unity_AmbientGround, + unity_FogColor + } + + [Serializable] + [NodeAttributes( "Fog And Ambient Colors", "Lighting", "Fog and Ambient colors" )] + public sealed class FogAndAmbientColorsNode : ShaderVariablesNode + { + private const string ColorLabelStr = "Color"; + private readonly string[] ColorValuesStr = { + "Ambient light ( Legacy )", + "Sky ambient light", + "Equator ambient light", + "Ground ambient light", + "Fog" + }; + + [SerializeField] + private BuiltInFogAndAmbientColors m_selectedType = BuiltInFogAndAmbientColors.UNITY_LIGHTMODEL_AMBIENT; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, ColorValuesStr[ ( int ) m_selectedType ], WirePortDataType.COLOR ); + m_textLabelWidth = 50; + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + m_previewShaderGUID = "937c7bde062f0f942b600d9950d2ebb2"; + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + m_previewMaterialPassId = (int)m_selectedType; + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_selectedType = (BuiltInFogAndAmbientColors)m_upperLeftWidget.DrawWidget( this, (int)m_selectedType, ColorValuesStr ); + if( EditorGUI.EndChangeCheck() ) + { + ChangeOutputName( 0, ColorValuesStr[ (int)m_selectedType ] ); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_selectedType = ( BuiltInFogAndAmbientColors ) EditorGUILayoutPopup( ColorLabelStr, ( int ) m_selectedType, ColorValuesStr ); + + if ( EditorGUI.EndChangeCheck() ) + { + ChangeOutputName( 0, ColorValuesStr[ ( int ) m_selectedType ] ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + if( dataCollector.IsTemplate && dataCollector.CurrentSRPType == TemplateSRPType.HDRP ) + { + switch( m_selectedType ) + { + case BuiltInFogAndAmbientColors.unity_AmbientSky: + return "_Ambient_ColorSky"; + case BuiltInFogAndAmbientColors.unity_AmbientEquator: + return "_Ambient_Equator"; + case BuiltInFogAndAmbientColors.unity_AmbientGround: + return "_Ambient_Ground"; + case BuiltInFogAndAmbientColors.unity_FogColor: + return "_FogColor"; + } + } + return m_selectedType.ToString(); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_selectedType = ( BuiltInFogAndAmbientColors ) Enum.Parse( typeof( BuiltInFogAndAmbientColors ), GetCurrentParam( ref nodeParams ) ); + ChangeOutputName( 0, ColorValuesStr[ ( int ) m_selectedType ] ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedType ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs.meta new file mode 100644 index 00000000..dd6093b1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e2bdfc2fa6fcd0640b01a8b7448a1a11 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs new file mode 100644 index 00000000..60b763c9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs @@ -0,0 +1,32 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Fog Params", "Lighting", "Parameters for fog calculation" )] + public sealed class FogParamsNode : ConstVecShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputName( 1, "Density/Sqrt(Ln(2))" ); + ChangeOutputName( 2, "Density/Ln(2)" ); + ChangeOutputName( 3, "-1/(End-Start)" ); + ChangeOutputName( 4, "End/(End-Start))" ); + m_value = "unity_FogParams"; + m_previewShaderGUID = "42abde3281b1848438c3b53443c91a1e"; + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( !m_outputPorts[ 0 ].IsConnected ) + { + m_outputPorts[ 0 ].Visible = false; + m_sizeIsDirty = true; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs.meta new file mode 100644 index 00000000..121ed3ea --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a3d8c31159e07bc419a7484ab5e894ed +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting.meta new file mode 100644 index 00000000..86287e65 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 47f503bcb5935b649beee3296dd40260 +folderAsset: yes +timeCreated: 1481126946 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs new file mode 100644 index 00000000..8c6557a0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs @@ -0,0 +1,208 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + + public enum ASEStandardSurfaceWorkflow + { + Metallic = 0, + Specular + } + + [Serializable] + [NodeAttributes( "Standard Surface Light", "Lighting", "Provides a way to create a standard surface light model in custom lighting mode", NodeAvailabilityFlags = (int)NodeAvailability.CustomLighting )] + public sealed class CustomStandardSurface : ParentNode + { + private const string WorkflowStr = "Workflow"; + + [SerializeField] + private ASEStandardSurfaceWorkflow m_workflow = ASEStandardSurfaceWorkflow.Metallic; + + [SerializeField] + private ViewSpace m_normalSpace = ViewSpace.Tangent; + + [SerializeField] + private bool m_normalize = true; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "Albedo" ); + AddInputPort( WirePortDataType.FLOAT3, false, "Normal" ); + m_inputPorts[ 1 ].Vector3InternalData = Vector3.forward; + AddInputPort( WirePortDataType.FLOAT3, false, "Emission" ); + AddInputPort( WirePortDataType.FLOAT, false, "Metallic" ); + AddInputPort( WirePortDataType.FLOAT, false, "Smoothness" ); + AddInputPort( WirePortDataType.FLOAT, false, "Occlusion" ); + m_inputPorts[ 5 ].FloatInternalData = 1; + AddOutputPort( WirePortDataType.FLOAT3, "RGB" ); + m_autoWrapProperties = true; + m_textLabelWidth = 100; + m_errorMessageTypeIsError = NodeMessageType.Warning; + m_errorMessageTooltip = "This node only returns correct information using a custom light model, otherwise returns 0"; + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + if( m_inputPorts[ 1 ].IsConnected && m_normalSpace == ViewSpace.Tangent ) + dataCollector.DirtyNormal = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_workflow = (ASEStandardSurfaceWorkflow)EditorGUILayoutEnumPopup( WorkflowStr, m_workflow ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateSpecularMetallicPorts(); + } + + EditorGUI.BeginChangeCheck(); + m_normalSpace = (ViewSpace)EditorGUILayoutEnumPopup( "Normal Space", m_normalSpace ); + if( m_normalSpace != ViewSpace.World || !m_inputPorts[ 1 ].IsConnected ) + { + m_normalize = EditorGUILayoutToggle("Normalize", m_normalize); + } + if( EditorGUI.EndChangeCheck() ) + { + UpdatePort(); + } + } + + private void UpdatePort() + { + if( m_normalSpace == ViewSpace.World ) + m_inputPorts[ 1 ].Name = "World Normal"; + else + m_inputPorts[ 1 ].Name = "Normal"; + + m_sizeIsDirty = true; + } + + void UpdateSpecularMetallicPorts() + { + if( m_workflow == ASEStandardSurfaceWorkflow.Specular ) + m_inputPorts[ 3 ].ChangeProperties( "Specular", WirePortDataType.FLOAT3, false ); + else + m_inputPorts[ 3 ].ChangeProperties( "Metallic", WirePortDataType.FLOAT, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.GenType == PortGenType.NonCustomLighting || dataCollector.CurrentCanvasMode != NodeAvailability.CustomLighting ) + return "float3(0,0,0)"; + + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string specularMode = string.Empty; + if( m_workflow == ASEStandardSurfaceWorkflow.Specular ) + specularMode = "Specular"; + + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + + if( dataCollector.DirtyNormal ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + dataCollector.ForceNormal = true; + } + + dataCollector.AddLocalVariable( UniqueId, "SurfaceOutputStandard" + specularMode + " s" + OutputId + " = (SurfaceOutputStandard" + specularMode + " ) 0;" ); + dataCollector.AddLocalVariable( UniqueId, "s" + OutputId + ".Albedo = " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + ";" ); + + string normal = string.Empty; + + if( m_inputPorts[ 1 ].IsConnected ) + { + normal = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + if( m_normalSpace == ViewSpace.Tangent ) + { + normal = "WorldNormalVector( " + Constants.InputVarStr + " , " + normal + " )"; + if( m_normalize ) + { + normal = "normalize( " + normal + " )"; + } + } + } + else + { + normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, m_normalize ); + } + + + + dataCollector.AddLocalVariable( UniqueId, "s" + OutputId + ".Normal = "+ normal + ";" ); + dataCollector.AddLocalVariable( UniqueId, "s" + OutputId + ".Emission = " + m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ) + ";" ); + if( m_workflow == ASEStandardSurfaceWorkflow.Specular ) + dataCollector.AddLocalVariable( UniqueId, "s" + OutputId + ".Specular = " + m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ) + ";" ); + else + dataCollector.AddLocalVariable( UniqueId, "s" + OutputId + ".Metallic = " + m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ) + ";" ); + dataCollector.AddLocalVariable( UniqueId, "s" + OutputId + ".Smoothness = " + m_inputPorts[ 4 ].GeneratePortInstructions( ref dataCollector ) + ";" ); + dataCollector.AddLocalVariable( UniqueId, "s" + OutputId + ".Occlusion = " + m_inputPorts[ 5 ].GeneratePortInstructions( ref dataCollector ) + ";\n" ); + + dataCollector.AddLocalVariable( UniqueId, "data.light = gi.light;\n", true ); + + dataCollector.AddLocalVariable( UniqueId, "UnityGI gi" + OutputId + " = gi;" ); + dataCollector.AddLocalVariable( UniqueId, "#ifdef UNITY_PASS_FORWARDBASE", true ); + + dataCollector.AddLocalVariable( UniqueId, "Unity_GlossyEnvironmentData g" + OutputId + " = UnityGlossyEnvironmentSetup( s" + OutputId + ".Smoothness, data.worldViewDir, s" + OutputId + ".Normal, float3(0,0,0));" ); + dataCollector.AddLocalVariable( UniqueId, "gi" + OutputId + " = UnityGlobalIllumination( data, s" + OutputId + ".Occlusion, s" + OutputId + ".Normal, g" + OutputId + " );" ); + dataCollector.AddLocalVariable( UniqueId, "#endif\n", true ); + dataCollector.AddLocalVariable( UniqueId, "float3 surfResult" + OutputId + " = LightingStandard" + specularMode + " ( s" + OutputId + ", viewDir, gi" + OutputId + " ).rgb;" ); + //Emission must be always added to trick Unity, so it knows what needs to be created p.e. world pos + dataCollector.AddLocalVariable( UniqueId, "surfResult" + OutputId + " += s" + OutputId + ".Emission;\n" ); + + m_outputPorts[ 0 ].SetLocalValue( "surfResult" + OutputId, dataCollector.PortCategory ); + + //Remove emission contribution from Forward Add + dataCollector.AddLocalVariable( UniqueId, "#ifdef UNITY_PASS_FORWARDADD//" + OutputId ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "surfResult{0} -= s{0}.Emission;", OutputId )); + dataCollector.AddLocalVariable( UniqueId, "#endif//" + OutputId ); + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + if( ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader || ( ContainerGraph.CurrentStandardSurface != null && ContainerGraph.CurrentStandardSurface.CurrentLightingModel != StandardShaderLightModel.CustomLighting ) ) + m_showErrorMessage = true; + else + m_showErrorMessage = false; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() < 13204 ) + { + m_workflow = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ) ? ASEStandardSurfaceWorkflow.Specular : ASEStandardSurfaceWorkflow.Metallic; + } + else + { + m_workflow = (ASEStandardSurfaceWorkflow)Enum.Parse( typeof( ASEStandardSurfaceWorkflow ), GetCurrentParam( ref nodeParams ) ); + } + UpdateSpecularMetallicPorts(); + + if( UIUtils.CurrentShaderVersion() >= 14402 ) + { + m_normalSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ); + } + UpdatePort(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_workflow ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_normalSpace ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs.meta new file mode 100644 index 00000000..d7d92fc1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 78916999fd7bc3c4e9767bc9cf0698c0 +timeCreated: 1500054866 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs new file mode 100644 index 00000000..5d193e03 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs @@ -0,0 +1,484 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Indirect Diffuse Light", "Lighting", "Indirect Lighting", NodeAvailabilityFlags = (int)( NodeAvailability.CustomLighting | NodeAvailability.TemplateShader ) )] + public sealed class IndirectDiffuseLighting : ParentNode + { + [SerializeField] + private ViewSpace m_normalSpace = ViewSpace.Tangent; + [SerializeField] + private bool m_normalize = true; + + private int m_cachedIntensityId = -1; + + private const string FwdBasePragma = "#pragma multi_compile_fwdbase"; + + private readonly string IndirectDiffuseHeaderURP10 = "ASEIndirectDiffuse( {0}, {1} )"; + private readonly string[] IndirectDiffuseBodyURP10 = + { + "half3 ASEIndirectDiffuse( PackedVaryings input, half3 normalWS, float3 positionWS = 0, half3 viewDirWS = 0 )\n", + "{\n", + "#if defined( LIGHTMAP_ON )\n", + "\treturn SampleLightmap( input.lightmapUVOrVertexSH.xy, normalWS );\n", + "#else\n", + "\treturn SampleSH( normalWS );\n", + "#endif\n", + "}\n" + }; + + private readonly string IndirectDiffuseHeaderURP12 = "ASEIndirectDiffuse( {0}, {1} )"; + private readonly string[] IndirectDiffuseBodyURP12 = + { + "half3 ASEIndirectDiffuse( PackedVaryings input, half3 normalWS, float3 positionWS = 0, half3 viewDirWS = 0 )\n", + "{\n", + "#if defined( DYNAMICLIGHTMAP_ON )\n", + "\treturn SAMPLE_GI( input.lightmapUVOrVertexSH.xy, input.dynamicLightmapUV.xy, 0, normalWS );\n", + "#elif defined( LIGHTMAP_ON )\n", + "\treturn SAMPLE_GI( input.lightmapUVOrVertexSH.xy, 0, normalWS );\n", + "#else\n", + "\treturn SampleSH( normalWS );\n", + "#endif\n", + "}\n" + }; + + private readonly string IndirectDiffuseHeaderURP15 = "ASEIndirectDiffuse( {0}, {1}, {2}, {3} )"; + private readonly string[] IndirectDiffuseBodyURP15 = + { + "half3 ASEIndirectDiffuse( PackedVaryings input, half3 normalWS, float3 positionWS, half3 viewDirWS )\n", + "{\n", + "#if defined( DYNAMICLIGHTMAP_ON )\n", + "\treturn SAMPLE_GI( input.lightmapUVOrVertexSH.xy, input.dynamicLightmapUV.xy, 0, normalWS );\n", + "#elif defined( LIGHTMAP_ON )\n", + "\treturn SAMPLE_GI( input.lightmapUVOrVertexSH.xy, 0, normalWS );\n", + "#elif defined( PROBE_VOLUMES_L1 ) || defined( PROBE_VOLUMES_L2 )\n", + "\return SAMPLE_GI( SampleSH( normalWS ), positionWS, normalWS, viewDirWS, input.positionCS.xy );\n", + "#else\n", + "\treturn SampleSH( normalWS );\n", + "#endif\n", + "}\n" + }; + + private readonly string IndirectDiffuseHeaderURP17 = "ASEIndirectDiffuse( {0}, {1}, {2}, {3} )"; + private readonly string[] IndirectDiffuseBodyURP17 = + { + "half3 ASEIndirectDiffuse( PackedVaryings input, half3 normalWS, float3 positionWS, half3 viewDirWS )\n", + "{\n", + "#if defined( DYNAMICLIGHTMAP_ON )\n", + "\treturn SAMPLE_GI( input.lightmapUVOrVertexSH.xy, input.dynamicLightmapUV.xy, 0, normalWS );\n", + "#elif defined( LIGHTMAP_ON )\n", + "\treturn SAMPLE_GI( input.lightmapUVOrVertexSH.xy, 0, normalWS );\n", + "#elif defined( PROBE_VOLUMES_L1 ) || defined( PROBE_VOLUMES_L2 )\n", + "\return SampleProbeVolumePixel( SampleSH( normalWS ), positionWS, normalWS, viewDirWS, input.positionCS.xy );\n", + "#else\n", + "\treturn SampleSH( normalWS );\n", + "#endif\n", + "}\n" + }; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "Normal" ); + AddOutputPort( WirePortDataType.FLOAT3, "RGB" ); + m_inputPorts[ 0 ].Vector3InternalData = Vector3.forward; + m_autoWrapProperties = true; + m_errorMessageTypeIsError = NodeMessageType.Warning; + m_errorMessageTooltip = "This node only returns correct information using a custom light model, otherwise returns 0"; + m_previewShaderGUID = "b45d57fa606c1ea438fe9a2c08426bc7"; + m_drawPreviewAsSphere = true; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_inputPorts[ 0 ].IsConnected ) + { + if( m_normalSpace == ViewSpace.Tangent ) + m_previewMaterialPassId = 1; + else + m_previewMaterialPassId = 2; + } + else + { + m_previewMaterialPassId = 0; + } + + if( m_cachedIntensityId == -1 ) + m_cachedIntensityId = Shader.PropertyToID( "_Intensity" ); + + PreviewMaterial.SetFloat( m_cachedIntensityId, RenderSettings.ambientIntensity ); + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + // This needs to be rechecked + //if( m_inputPorts[ 0 ].IsConnected ) + dataCollector.DirtyNormal = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + + EditorGUI.BeginChangeCheck(); + m_normalSpace = (ViewSpace)EditorGUILayoutEnumPopup( "Normal Space", m_normalSpace ); + if( m_normalSpace != ViewSpace.World || !m_inputPorts[ 0 ].IsConnected ) + { + m_normalize = EditorGUILayoutToggle("Normalize", m_normalize); + } + if( EditorGUI.EndChangeCheck() ) + { + UpdatePort(); + } + } + + private void UpdatePort() + { + if( m_normalSpace == ViewSpace.World ) + m_inputPorts[ 0 ].ChangeProperties( "World Normal", m_inputPorts[ 0 ].DataType, false ); + else + m_inputPorts[ 0 ].ChangeProperties( "Normal", m_inputPorts[ 0 ].DataType, false ); + + m_sizeIsDirty = true; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + if( ( ContainerGraph.CurrentStandardSurface != null && ContainerGraph.CurrentStandardSurface.CurrentLightingModel != StandardShaderLightModel.CustomLighting ) ) + m_showErrorMessage = true; + else + m_showErrorMessage = false; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + string finalValue = string.Empty; + + if( dataCollector.IsTemplate && dataCollector.IsFragmentCategory ) + { + if( !dataCollector.IsSRP ) + { + dataCollector.AddToIncludes( UniqueId, Constants.UnityLightingLib ); + dataCollector.AddToDirectives( FwdBasePragma ); + string texcoord1 = string.Empty; + string texcoord2 = string.Empty; + + if( dataCollector.TemplateDataCollectorInstance.HasInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES1, false, MasterNodePortCategory.Vertex ) ) + texcoord1 = dataCollector.TemplateDataCollectorInstance.GetInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES1, false, MasterNodePortCategory.Vertex ).VarName; + else + texcoord1 = dataCollector.TemplateDataCollectorInstance.RegisterInfoOnSemantic( MasterNodePortCategory.Vertex, TemplateInfoOnSematics.TEXTURE_COORDINATES1, TemplateSemantics.TEXCOORD1, "texcoord1", WirePortDataType.FLOAT4, PrecisionType.Float, false ); + + if( dataCollector.TemplateDataCollectorInstance.HasInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES2, false, MasterNodePortCategory.Vertex ) ) + texcoord2 = dataCollector.TemplateDataCollectorInstance.GetInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES2, false, MasterNodePortCategory.Vertex ).VarName; + else + texcoord2 = dataCollector.TemplateDataCollectorInstance.RegisterInfoOnSemantic( MasterNodePortCategory.Vertex, TemplateInfoOnSematics.TEXTURE_COORDINATES2, TemplateSemantics.TEXCOORD2, "texcoord2", WirePortDataType.FLOAT4, PrecisionType.Float, false ); + + string vOutName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData.OutVarName; + string fInName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.FragmentFunctionData.InVarName; + TemplateVertexData data = dataCollector.TemplateDataCollectorInstance.RequestNewInterpolator( WirePortDataType.FLOAT4, false, "ase_lmap" ); + + string varName = "ase_lmap"; + if( data != null ) + varName = data.VarName; + + dataCollector.AddToVertexLocalVariables( UniqueId, "#ifdef DYNAMICLIGHTMAP_ON //dynlm" ); + dataCollector.AddToVertexLocalVariables( UniqueId, vOutName + "." + varName + ".zw = " + texcoord2 + ".xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;" ); + dataCollector.AddToVertexLocalVariables( UniqueId, "#endif //dynlm" ); + dataCollector.AddToVertexLocalVariables( UniqueId, "#ifdef LIGHTMAP_ON //stalm" ); + dataCollector.AddToVertexLocalVariables( UniqueId, vOutName + "." + varName + ".xy = " + texcoord1 + ".xy * unity_LightmapST.xy + unity_LightmapST.zw;" ); + dataCollector.AddToVertexLocalVariables( UniqueId, "#endif //stalm" ); + + TemplateVertexData shdata = dataCollector.TemplateDataCollectorInstance.RequestNewInterpolator( WirePortDataType.FLOAT3, false, "ase_sh" ); + string worldPos = dataCollector.TemplateDataCollectorInstance.GetWorldPos( false, MasterNodePortCategory.Vertex ); + string worldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( PrecisionType.Float, false, MasterNodePortCategory.Vertex ); + //Debug.Log( shdata ); + string shVarName = "ase_sh"; + if( shdata != null ) + shVarName = shdata.VarName; + string outSH = vOutName + "." + shVarName + ".xyz"; + dataCollector.AddToVertexLocalVariables( UniqueId, "#ifndef LIGHTMAP_ON //nstalm" ); + dataCollector.AddToVertexLocalVariables( UniqueId, "#if UNITY_SHOULD_SAMPLE_SH //sh" ); + dataCollector.AddToVertexLocalVariables( UniqueId, outSH + " = 0;" ); + dataCollector.AddToVertexLocalVariables( UniqueId, "#ifdef VERTEXLIGHT_ON //vl" ); + dataCollector.AddToVertexLocalVariables( UniqueId, outSH + " += Shade4PointLights (" ); + dataCollector.AddToVertexLocalVariables( UniqueId, "unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0," ); + dataCollector.AddToVertexLocalVariables( UniqueId, "unity_LightColor[0].rgb, unity_LightColor[1].rgb, unity_LightColor[2].rgb, unity_LightColor[3].rgb," ); + dataCollector.AddToVertexLocalVariables( UniqueId, "unity_4LightAtten0, " + worldPos + ", " + worldNormal + ");" ); + dataCollector.AddToVertexLocalVariables( UniqueId, "#endif //vl" ); + dataCollector.AddToVertexLocalVariables( UniqueId, outSH + " = ShadeSHPerVertex (" + worldNormal + ", " + outSH + ");" ); + dataCollector.AddToVertexLocalVariables( UniqueId, "#endif //sh" ); + dataCollector.AddToVertexLocalVariables( UniqueId, "#endif //nstalm" ); + + //dataCollector.AddToPragmas( UniqueId, "multi_compile_fwdbase" ); + + string fragWorldNormal = string.Empty; + if( m_inputPorts[ 0 ].IsConnected ) + { + if( m_normalSpace == ViewSpace.Tangent ) + fragWorldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), OutputId ); + else + fragWorldNormal = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + } + else + { + fragWorldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( PrecisionType.Float, false, MasterNodePortCategory.Fragment ); + } + + dataCollector.AddLocalVariable( UniqueId, "UnityGIInput data" + OutputId + ";" ); + dataCollector.AddLocalVariable( UniqueId, "UNITY_INITIALIZE_OUTPUT( UnityGIInput, data" + OutputId + " );" ); + + dataCollector.AddLocalVariable( UniqueId, "#if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) //dylm" + OutputId ); + dataCollector.AddLocalVariable( UniqueId, "data" + OutputId + ".lightmapUV = " + fInName + "." + varName + ";" ); + dataCollector.AddLocalVariable( UniqueId, "#endif //dylm" + OutputId ); + + dataCollector.AddLocalVariable( UniqueId, "#if UNITY_SHOULD_SAMPLE_SH //fsh" + OutputId ); + dataCollector.AddLocalVariable( UniqueId, "data" + OutputId + ".ambient = " + fInName + "." + shVarName + ";" ); + dataCollector.AddLocalVariable( UniqueId, "#endif //fsh" + OutputId ); + + dataCollector.AddToFragmentLocalVariables( UniqueId, "UnityGI gi" + OutputId + " = UnityGI_Base(data" + OutputId + ", 1, " + fragWorldNormal + ");" ); + + finalValue = "gi" + OutputId + ".indirect.diffuse"; + m_outputPorts[ 0 ].SetLocalValue( finalValue, dataCollector.PortCategory ); + return finalValue; + } + else + { + if( dataCollector.CurrentSRPType == TemplateSRPType.URP ) + { + string texcoord1 = string.Empty; + + if( dataCollector.TemplateDataCollectorInstance.HasInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES1, false, MasterNodePortCategory.Vertex ) ) + texcoord1 = dataCollector.TemplateDataCollectorInstance.GetInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES1, false, MasterNodePortCategory.Vertex ).VarName; + else + texcoord1 = dataCollector.TemplateDataCollectorInstance.RegisterInfoOnSemantic( MasterNodePortCategory.Vertex, TemplateInfoOnSematics.TEXTURE_COORDINATES1, TemplateSemantics.TEXCOORD1, "texcoord1", WirePortDataType.FLOAT4, PrecisionType.Float, false ); + + string vOutName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData.OutVarName; + string fInName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.FragmentFunctionData.InVarName; + + if( !dataCollector.TemplateDataCollectorInstance.HasRawInterpolatorOfName( "lightmapUVOrVertexSH" ) ) + { + string worldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( PrecisionType.Float, false, MasterNodePortCategory.Vertex ); + dataCollector.TemplateDataCollectorInstance.RequestNewInterpolator( WirePortDataType.FLOAT4, false, "lightmapUVOrVertexSH" ); + + dataCollector.AddToVertexLocalVariables( UniqueId, "OUTPUT_LIGHTMAP_UV( " + texcoord1 + ", unity_LightmapST, " + vOutName + ".lightmapUVOrVertexSH.xy );", true ); + + if ( ASEPackageManagerHelper.PackageSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_15 ) + { + string worldPos = dataCollector.TemplateDataCollectorInstance.GetWorldPos( false, MasterNodePortCategory.Vertex ); + dataCollector.AddToVertexLocalVariables( UniqueId, "#if !defined( OUTPUT_SH4 )", true ); + dataCollector.AddToVertexLocalVariables( UniqueId, "OUTPUT_SH( " + worldPos + ", " + worldNormal + ", GetWorldSpaceNormalizeViewDir( " + worldPos + " ), " + vOutName + ".lightmapUVOrVertexSH.xyz );", true ); + dataCollector.AddToVertexLocalVariables( UniqueId, "#elif UNITY_VERSION > 60000009", true ); + dataCollector.AddToVertexLocalVariables( UniqueId, "OUTPUT_SH4( " + worldPos + ", " + worldNormal + ", GetWorldSpaceNormalizeViewDir( " + worldPos + " ), " + vOutName + ".lightmapUVOrVertexSH.xyz, " + vOutName + ".probeOcclusion );", true ); + dataCollector.AddToVertexLocalVariables( UniqueId, "#else", true ); + dataCollector.AddToVertexLocalVariables( UniqueId, "OUTPUT_SH4( " + worldPos + ", " + worldNormal + ", GetWorldSpaceNormalizeViewDir( " + worldPos + " ), " + vOutName + ".lightmapUVOrVertexSH.xyz );", true ); + dataCollector.AddToVertexLocalVariables( UniqueId, "#endif", true ); + } + else + { + dataCollector.AddToVertexLocalVariables( UniqueId, "OUTPUT_SH( " + worldNormal + ", " + vOutName + ".lightmapUVOrVertexSH.xyz );", true ); + } + + dataCollector.AddToPragmas( UniqueId, "multi_compile _ DIRLIGHTMAP_COMBINED" ); + dataCollector.AddToPragmas( UniqueId, "multi_compile _ LIGHTMAP_ON" ); + dataCollector.AddToPragmas( UniqueId , "multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE" ); + + dataCollector.AddToPragmas( UniqueId , "multi_compile _ _MAIN_LIGHT_SHADOWS" ); + dataCollector.AddToPragmas( UniqueId , "multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE" ); + dataCollector.AddToPragmas( UniqueId , "multi_compile _ _SHADOWS_SOFT" ); + + } + + string fragWorldNormal = string.Empty; + if( m_inputPorts[ 0 ].IsConnected ) + { + if( m_normalSpace == ViewSpace.Tangent ) + fragWorldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), OutputId ); + else + fragWorldNormal = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + } + else + { + fragWorldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( PrecisionType.Float, false, MasterNodePortCategory.Fragment ); + } + + //SAMPLE_GI + finalValue = "bakedGI" + OutputId; + + string result; + if ( ASEPackageManagerHelper.CurrentSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_15 ) + { + string positionWS = dataCollector.TemplateDataCollectorInstance.GetWorldPos(); + string viewDirWS = dataCollector.TemplateDataCollectorInstance.GetViewDir(); + + if ( ASEPackageManagerHelper.CurrentSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_17 ) + { + dataCollector.AddFunction( IndirectDiffuseBodyURP17[ 0 ], IndirectDiffuseBodyURP17, false ); + result = string.Format( IndirectDiffuseHeaderURP17, fInName, fragWorldNormal, positionWS, viewDirWS ); + } + else + { + dataCollector.AddFunction( IndirectDiffuseBodyURP15[ 0 ], IndirectDiffuseBodyURP15, false ); + result = string.Format( IndirectDiffuseHeaderURP15, fInName, fragWorldNormal, positionWS, viewDirWS ); + } + } + else if ( ASEPackageManagerHelper.CurrentSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_12 ) + { + dataCollector.AddFunction( IndirectDiffuseBodyURP12[ 0 ], IndirectDiffuseBodyURP12, false ); + result = string.Format( IndirectDiffuseHeaderURP12, fInName, fragWorldNormal ); + } + else // ASE_SRP_10 + { + dataCollector.AddFunction( IndirectDiffuseBodyURP10[ 0 ], IndirectDiffuseBodyURP10, false ); + result = string.Format( IndirectDiffuseHeaderURP10, fInName, fragWorldNormal ); + } + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, finalValue, result ); + + string mainLight = dataCollector.TemplateDataCollectorInstance.GetURPMainLight(UniqueId); + dataCollector.AddLocalVariable( UniqueId , string.Format( "MixRealtimeAndBakedGI( {0}, {1}, {2}, half4( 0, 0, 0, 0 ) );", mainLight, fragWorldNormal, finalValue ) ); + + m_outputPorts[ 0 ].SetLocalValue( finalValue, dataCollector.PortCategory ); + return finalValue; + } + else if( dataCollector.CurrentSRPType == TemplateSRPType.HDRP ) + { + string texcoord1 = string.Empty; + string texcoord2 = string.Empty; + + + if( dataCollector.TemplateDataCollectorInstance.HasInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES1, false, MasterNodePortCategory.Vertex ) ) + texcoord1 = dataCollector.TemplateDataCollectorInstance.GetInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES1, false, MasterNodePortCategory.Vertex ).VarName; + else + texcoord1 = dataCollector.TemplateDataCollectorInstance.RegisterInfoOnSemantic( MasterNodePortCategory.Vertex, TemplateInfoOnSematics.TEXTURE_COORDINATES1, TemplateSemantics.TEXCOORD1, "texcoord1", WirePortDataType.FLOAT4, PrecisionType.Float, false ); + + if( dataCollector.TemplateDataCollectorInstance.HasInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES2, false, MasterNodePortCategory.Vertex ) ) + texcoord2 = dataCollector.TemplateDataCollectorInstance.GetInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES2, false, MasterNodePortCategory.Vertex ).VarName; + else + texcoord2 = dataCollector.TemplateDataCollectorInstance.RegisterInfoOnSemantic( MasterNodePortCategory.Vertex, TemplateInfoOnSematics.TEXTURE_COORDINATES2, TemplateSemantics.TEXCOORD2, "texcoord2", WirePortDataType.FLOAT4, PrecisionType.Float, false ); + + dataCollector.TemplateDataCollectorInstance.RequestNewInterpolator( WirePortDataType.FLOAT4, false, "ase_lightmapUVs" ); + + string vOutName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData.OutVarName; + string fInName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.FragmentFunctionData.InVarName; + + dataCollector.AddToVertexLocalVariables( UniqueId, vOutName + ".ase_lightmapUVs.xy = " + texcoord1 + ".xy * unity_LightmapST.xy + unity_LightmapST.zw;" ); + dataCollector.AddToVertexLocalVariables( UniqueId, vOutName + ".ase_lightmapUVs.zw = " + texcoord2 + ".xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;" ); + + string worldPos = dataCollector.TemplateDataCollectorInstance.GetWorldPos( false, MasterNodePortCategory.Fragment ); + + dataCollector.AddToPragmas( UniqueId, "multi_compile _ LIGHTMAP_ON" ); + dataCollector.AddToPragmas( UniqueId, "multi_compile _ DIRLIGHTMAP_COMBINED" ); + dataCollector.AddToPragmas( UniqueId, "multi_compile _ DYNAMICLIGHTMAP_ON" ); + + string fragWorldNormal = string.Empty; + if( m_inputPorts[ 0 ].IsConnected ) + { + if( m_normalSpace == ViewSpace.Tangent ) + fragWorldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), OutputId ); + else + fragWorldNormal = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + } + else + { + fragWorldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( PrecisionType.Float, false, MasterNodePortCategory.Fragment ); + } + + //SAMPLE_GI + if ( ASEPackageManagerHelper.CurrentSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_17 ) + { + string screenPos = GeneratorUtils.GenerateScreenPositionRaw( ref dataCollector, UniqueId, CurrentPrecisionType ); + string positionSS = string.Format( "( uint2 )( {0}.xy / {0}.w * _ScreenSize.xy )", screenPos ); + + dataCollector.AddLocalVariable( UniqueId, "float3 bakedGI" + OutputId + " = SampleBakedGI( " + worldPos + ", " + fragWorldNormal + ", " + positionSS + ", " + fInName + ".ase_lightmapUVs.xy, " + fInName + ".ase_lightmapUVs.zw );" ); + } + else + { + dataCollector.AddLocalVariable( UniqueId, "float3 bakedGI" + OutputId + " = SampleBakedGI( " + worldPos + ", " + fragWorldNormal + ", " + fInName + ".ase_lightmapUVs.xy, " + fInName + ".ase_lightmapUVs.zw );" ); + } + finalValue = "bakedGI" + OutputId; + m_outputPorts[ 0 ].SetLocalValue( finalValue, dataCollector.PortCategory ); + return finalValue; + } + } + } + if( dataCollector.GenType == PortGenType.NonCustomLighting || dataCollector.CurrentCanvasMode != NodeAvailability.CustomLighting ) + return "float3(0,0,0)"; + + string normal = string.Empty; + if( m_inputPorts[ 0 ].IsConnected ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + dataCollector.ForceNormal = true; + + normal = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + if( m_normalSpace == ViewSpace.Tangent ) + { + normal = "WorldNormalVector( " + Constants.InputVarStr + " , " + normal + " )"; + if( m_normalize ) + { + normal = "normalize( " + normal + " )"; + } + } + } + else + { + if( dataCollector.IsFragmentCategory ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + if( dataCollector.DirtyNormal ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + dataCollector.ForceNormal = true; + } + } + + normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, m_normalize ); + } + + + if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, "indirectDiffuse" + OutputId, "ShadeSH9( float4( " + normal + ", 1 ) )" ); + } + else + { + dataCollector.AddLocalVariable( UniqueId, "UnityGI gi" + OutputId + " = gi;" ); + dataCollector.AddLocalVariable( UniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, "diffNorm" + OutputId, normal ); + dataCollector.AddLocalVariable( UniqueId, "gi" + OutputId + " = UnityGI_Base( data, 1, diffNorm" + OutputId + " );" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, "indirectDiffuse" + OutputId, "gi" + OutputId + ".indirect.diffuse + diffNorm" + OutputId + " * 0.0001" ); + } + + finalValue = "indirectDiffuse" + OutputId; + m_outputPorts[ 0 ].SetLocalValue( finalValue, dataCollector.PortCategory ); + return finalValue; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 13002 ) + m_normalSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ); + + UpdatePort(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_normalSpace ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs.meta new file mode 100644 index 00000000..b34ee136 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 11bf17b0757d57c47add2eb50c62c75e +timeCreated: 1495726164 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs new file mode 100644 index 00000000..0e5aef94 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs @@ -0,0 +1,310 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Indirect Specular Light", "Lighting", "Indirect Specular Light", NodeAvailabilityFlags = (int)( NodeAvailability.CustomLighting | NodeAvailability.TemplateShader ) )] + public sealed class IndirectSpecularLight : ParentNode + { + [SerializeField] + private ViewSpace m_normalSpace = ViewSpace.Tangent; + [SerializeField] + private bool m_normalize = true; + + private const string DefaultErrorMessage = "This node only returns correct information using a custom light model, otherwise returns 0."; + private const string UpgradeErrorMessage = "Smoothness port was previously being used as Roughness, please check if you are correctly using it and save to confirm."; + private const string UnsupportedMessage = "Only valid on BiRP and URP templates."; + private bool m_upgradeMessage = false; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "Normal" ); + AddInputPort( WirePortDataType.FLOAT, false, "Smoothness" ); + AddInputPort( WirePortDataType.FLOAT, false, "Occlusion" ); + m_inputPorts[ 0 ].Vector3InternalData = Vector3.forward; + m_inputPorts[ 1 ].FloatInternalData = 0.5f; + m_inputPorts[ 2 ].FloatInternalData = 1; + m_inputPorts[ 1 ].AutoDrawInternalData = true; + m_inputPorts[ 2 ].AutoDrawInternalData = true; + m_autoWrapProperties = true; + AddOutputPort( WirePortDataType.FLOAT3, "RGB" ); + m_errorMessageTypeIsError = NodeMessageType.Warning; + m_errorMessageTooltip = DefaultErrorMessage; + m_previewShaderGUID = "d6e441d0a8608954c97fa347d3735e92"; + m_drawPreviewAsSphere = true; + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + if( m_inputPorts[ 0 ].IsConnected ) + dataCollector.DirtyNormal = true; + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + + if ( m_upgradeMessage || ( ContainerGraph.CurrentStandardSurface != null && ContainerGraph.CurrentStandardSurface.CurrentLightingModel != StandardShaderLightModel.CustomLighting ) ) + { + m_errorMessageTypeIsError = m_upgradeMessage ? NodeMessageType.Warning : NodeMessageType.Error; + m_errorMessageTooltip = m_upgradeMessage ? UpgradeErrorMessage : DefaultErrorMessage; + m_showErrorMessage = true; + } + else if ( ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader && ( ContainerGraph.CurrentSRPType != TemplateSRPType.URP && ContainerGraph.CurrentSRPType != TemplateSRPType.BiRP ) ) + { + m_errorMessageTypeIsError = NodeMessageType.Error; + m_errorMessageTooltip = UnsupportedMessage; + m_showErrorMessage = true; + } + else + { + m_showErrorMessage = false; + } + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_inputPorts[ 0 ].IsConnected ) + { + if( m_normalSpace == ViewSpace.Tangent ) + m_previewMaterialPassId = 1; + else + m_previewMaterialPassId = 2; + } + else + { + m_previewMaterialPassId = 0; + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + + EditorGUI.BeginChangeCheck(); + m_normalSpace = (ViewSpace)EditorGUILayoutEnumPopup( "Normal Space", m_normalSpace ); + if( m_normalSpace != ViewSpace.World || !m_inputPorts[ 0 ].IsConnected ) + { + m_normalize = EditorGUILayoutToggle("Normalize", m_normalize); + } + if( EditorGUI.EndChangeCheck() ) + { + UpdatePort(); + } + if( !m_inputPorts[ 1 ].IsConnected ) + m_inputPorts[ 1 ].FloatInternalData = EditorGUILayout.FloatField( m_inputPorts[ 1 ].Name, m_inputPorts[ 1 ].FloatInternalData ); + if( !m_inputPorts[ 2 ].IsConnected ) + m_inputPorts[ 2 ].FloatInternalData = EditorGUILayout.FloatField( m_inputPorts[ 2 ].Name, m_inputPorts[ 2 ].FloatInternalData ); + + if ( m_showErrorMessage ) + { + EditorGUILayout.HelpBox( m_errorMessageTooltip, ( m_errorMessageTypeIsError == NodeMessageType.Error ) ? MessageType.Error : MessageType.Warning ); + } + } + + private void UpdatePort() + { + if( m_normalSpace == ViewSpace.World ) + m_inputPorts[ 0 ].ChangeProperties( "World Normal", m_inputPorts[ 0 ].DataType, false ); + else + m_inputPorts[ 0 ].ChangeProperties( "Normal", m_inputPorts[ 0 ].DataType, false ); + + m_sizeIsDirty = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.IsTemplate ) + { + if( !dataCollector.IsSRP ) + { + dataCollector.AddToIncludes( UniqueId, Constants.UnityLightingLib ); + string worldPos = dataCollector.TemplateDataCollectorInstance.GetWorldPos(); + string worldViewDir = dataCollector.TemplateDataCollectorInstance.GetViewDir( useMasterNodeCategory:false, customCategory:MasterNodePortCategory.Fragment ); + + string worldNormal = string.Empty; + if( m_inputPorts[ 0 ].IsConnected ) + { + if( m_normalSpace == ViewSpace.Tangent ) + worldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), OutputId ); + else + worldNormal = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + } + else + { + worldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( PrecisionType.Float, false, MasterNodePortCategory.Fragment ); + } + + string tempsmoothness = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string tempocclusion = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + + dataCollector.AddLocalVariable( UniqueId, "UnityGIInput data;" ); + dataCollector.AddLocalVariable( UniqueId, "UNITY_INITIALIZE_OUTPUT( UnityGIInput, data );" ); + dataCollector.AddLocalVariable( UniqueId, "data.worldPos = " + worldPos + ";" ); + dataCollector.AddLocalVariable( UniqueId, "data.worldViewDir = " + worldViewDir + ";" ); + dataCollector.AddLocalVariable( UniqueId, "data.probeHDR[0] = unity_SpecCube0_HDR;" ); + dataCollector.AddLocalVariable( UniqueId, "data.probeHDR[1] = unity_SpecCube1_HDR;" ); + dataCollector.AddLocalVariable( UniqueId, "#if UNITY_SPECCUBE_BLENDING || UNITY_SPECCUBE_BOX_PROJECTION //specdataif0" ); + dataCollector.AddLocalVariable( UniqueId, "\tdata.boxMin[0] = unity_SpecCube0_BoxMin;" ); + dataCollector.AddLocalVariable( UniqueId, "#endif //specdataif0" ); + dataCollector.AddLocalVariable( UniqueId, "#if UNITY_SPECCUBE_BOX_PROJECTION //specdataif1" ); + dataCollector.AddLocalVariable( UniqueId, "\tdata.boxMax[0] = unity_SpecCube0_BoxMax;" ); + dataCollector.AddLocalVariable( UniqueId, "\tdata.probePosition[0] = unity_SpecCube0_ProbePosition;" ); + dataCollector.AddLocalVariable( UniqueId, "\tdata.boxMax[1] = unity_SpecCube1_BoxMax;" ); + dataCollector.AddLocalVariable( UniqueId, "\tdata.boxMin[1] = unity_SpecCube1_BoxMin;" ); + dataCollector.AddLocalVariable( UniqueId, "\tdata.probePosition[1] = unity_SpecCube1_ProbePosition;" ); + dataCollector.AddLocalVariable( UniqueId, "#endif //specdataif1" ); + + dataCollector.AddLocalVariable( UniqueId, "Unity_GlossyEnvironmentData g" + OutputId + " = UnityGlossyEnvironmentSetup( " + tempsmoothness + ", " + worldViewDir + ", " + worldNormal + ", float3(0,0,0));" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, "indirectSpecular" + OutputId, "UnityGI_IndirectSpecular( data, " + tempocclusion + ", " + worldNormal + ", g" + OutputId + " )" ); + return "indirectSpecular" + OutputId; + } + else + { + if( dataCollector.CurrentSRPType == TemplateSRPType.URP ) + { + string worldViewDir = dataCollector.TemplateDataCollectorInstance.GetViewDir( useMasterNodeCategory: false, customCategory: MasterNodePortCategory.Fragment ); + string worldNormal = string.Empty; + if( m_inputPorts[ 0 ].IsConnected ) + { + if( m_normalSpace == ViewSpace.Tangent ) + worldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), OutputId ); + else + worldNormal = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + } + else + { + worldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( precisionType:PrecisionType.Float, useMasterNodeCategory: false, customCategory: MasterNodePortCategory.Fragment ); + } + + string tempsmoothness = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string tempocclusion = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + + dataCollector.AddLocalVariable( UniqueId, "half3 reflectVector" + OutputId + " = reflect( -" + worldViewDir + ", " + worldNormal + " );" ); + if ( ASEPackageManagerHelper.PackageSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_14 ) + { + dataCollector.AddToPragmas( UniqueId, "multi_compile _ _FORWARD_PLUS" ); + + string worldPos = dataCollector.TemplateDataCollectorInstance.GetWorldPos( useMasterNodeCategory: false, customCategory: MasterNodePortCategory.Fragment ); + string normalizedScreenUV = dataCollector.TemplateDataCollectorInstance.GetScreenPosNormalized( CurrentPrecisionType, useMasterNodeCategory: false, customCategory: MasterNodePortCategory.Fragment ); + + dataCollector.AddLocalVariable( UniqueId, string.Format( "float3 indirectSpecular{0} = GlossyEnvironmentReflection( reflectVector{0}, {1}, 1.0 - {2}, {3}, {4}.xy );", + OutputId, worldPos, tempsmoothness, tempocclusion, normalizedScreenUV ) ); + } + else + { + dataCollector.AddLocalVariable( UniqueId, "float3 indirectSpecular" + OutputId + " = GlossyEnvironmentReflection( reflectVector" + OutputId + ", 1.0 - " + tempsmoothness + ", " + tempocclusion + " );" ); + } + return "indirectSpecular" + OutputId; + } + else if( dataCollector.CurrentSRPType == TemplateSRPType.HDRP ) + { + UIUtils.ShowMessage( UniqueId, "Indirect Specular Light node currently not supported on HDRP" ); + return m_outputPorts[0].ErrorValue; + } + } + } + + if( dataCollector.GenType == PortGenType.NonCustomLighting || dataCollector.CurrentCanvasMode != NodeAvailability.CustomLighting ) + return m_outputPorts[0].ErrorValue; + + string normal = string.Empty; + if( m_inputPorts[ 0 ].IsConnected ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + dataCollector.ForceNormal = true; + + normal = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + if( m_normalSpace == ViewSpace.Tangent ) + { + normal = "WorldNormalVector( " + Constants.InputVarStr + " , " + normal + " )"; + if( m_normalize ) + { + normal = "normalize( " + normal + " )"; + } + } + + dataCollector.AddLocalVariable( UniqueId, "float3 indirectNormal" + OutputId + " = " + normal + ";" ); + normal = "indirectNormal" + OutputId; + } + else + { + if( dataCollector.IsFragmentCategory ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + if( dataCollector.DirtyNormal ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + dataCollector.ForceNormal = true; + } + } + + normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, m_normalize ); + } + + string smoothness = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string occlusion = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + string viewDir = "data.worldViewDir"; + + if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + string worldPos = GeneratorUtils.GenerateWorldPosition( ref dataCollector, UniqueId ); + viewDir = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId ); + + dataCollector.AddLocalVariable( UniqueId, "UnityGIInput data;" ); + dataCollector.AddLocalVariable( UniqueId, "UNITY_INITIALIZE_OUTPUT( UnityGIInput, data );" ); + dataCollector.AddLocalVariable( UniqueId, "data.worldPos = " + worldPos + ";" ); + dataCollector.AddLocalVariable( UniqueId, "data.worldViewDir = " + viewDir + ";" ); + dataCollector.AddLocalVariable( UniqueId, "data.probeHDR[0] = unity_SpecCube0_HDR;" ); + dataCollector.AddLocalVariable( UniqueId, "data.probeHDR[1] = unity_SpecCube1_HDR;" ); + dataCollector.AddLocalVariable( UniqueId, "#if UNITY_SPECCUBE_BLENDING || UNITY_SPECCUBE_BOX_PROJECTION //specdataif0" ); + dataCollector.AddLocalVariable( UniqueId, "data.boxMin[0] = unity_SpecCube0_BoxMin;" ); + dataCollector.AddLocalVariable( UniqueId, "#endif //specdataif0" ); + dataCollector.AddLocalVariable( UniqueId, "#if UNITY_SPECCUBE_BOX_PROJECTION //specdataif1" ); + dataCollector.AddLocalVariable( UniqueId, "data.boxMax[0] = unity_SpecCube0_BoxMax;" ); + dataCollector.AddLocalVariable( UniqueId, "data.probePosition[0] = unity_SpecCube0_ProbePosition;" ); + dataCollector.AddLocalVariable( UniqueId, "data.boxMax[1] = unity_SpecCube1_BoxMax;" ); + dataCollector.AddLocalVariable( UniqueId, "data.boxMin[1] = unity_SpecCube1_BoxMin;" ); + dataCollector.AddLocalVariable( UniqueId, "data.probePosition[1] = unity_SpecCube1_ProbePosition;" ); + dataCollector.AddLocalVariable( UniqueId, "#endif //specdataif1" ); + } + + dataCollector.AddLocalVariable( UniqueId, "Unity_GlossyEnvironmentData g" + OutputId + " = UnityGlossyEnvironmentSetup( " + smoothness + ", " + viewDir + ", " + normal + ", float3(0,0,0));" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, "indirectSpecular" + OutputId, "UnityGI_IndirectSpecular( data, " + occlusion + ", " + normal + ", g" + OutputId + " )" ); + + return "indirectSpecular" + OutputId; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 13002 ) + m_normalSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ); + + if( UIUtils.CurrentShaderVersion() < 13804 ) + { + m_upgradeMessage = true; + UIUtils.ShowMessage( UniqueId, "Indirect Specular Light node: Smoothness port was previously being used as Roughness, please check if you are correctly using it and save to confirm." ); + } + + UpdatePort(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_normalSpace ); + m_upgradeMessage = false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs.meta new file mode 100644 index 00000000..80124877 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 0820850e74009954188ff84e2f5cc4f2 +timeCreated: 1495817589 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs new file mode 100644 index 00000000..111168d7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs @@ -0,0 +1,210 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Main Light Attenuation", "Lighting", "Attenuation/shadow of main Directional light.", NodeAvailabilityFlags = (int)( NodeAvailability.CustomLighting | NodeAvailability.TemplateShader ) )] + public sealed class LightAttenuation : ParentNode + { + static readonly string SurfaceError = "This node only returns correct information using a custom light model, otherwise returns 1"; + static readonly string TemplateError = "This node will only produce proper attenuation if the template contains a shadow caster pass"; + + private const string ASEAttenVarName = "ase_lightAtten"; + + //private readonly string[] LightweightVertexInstructions = + //{ + // /*local vertex position*/"VertexPositionInputs ase_vertexInput = GetVertexPositionInputs ({0});", + // "#ifdef _MAIN_LIGHT_SHADOWS//ase_lightAtten_vert", + // /*available interpolator*/"{0} = GetShadowCoord( ase_vertexInput );", + // "#endif//ase_lightAtten_vert" + //}; + private const string LightweightLightAttenDecl = "float ase_lightAtten = 0;"; + private readonly string[] LightweightFragmentInstructions = + { + /*shadow coords*/"Light ase_lightAtten_mainLight = GetMainLight( {0} );", + //"ase_lightAtten = ase_lightAtten_mainLight.distanceAttenuation * ase_lightAtten_mainLight.shadowAttenuation;" + "ase_lightAtten = {0}.distanceAttenuation * {0}.shadowAttenuation;" + }; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.FLOAT, "Out" ); + m_errorMessageTypeIsError = NodeMessageType.Warning; + m_errorMessageTooltip = SurfaceError; + m_previewShaderGUID = "4b12227498a5c8d46b6c44ea018e5b56"; + m_drawPreviewAsSphere = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.IsTemplate ) + { + if( !dataCollector.IsSRP ) + { + string result = string.Empty; + if( dataCollector.TemplateDataCollectorInstance.ContainsSpecialLocalFragVar( TemplateInfoOnSematics.SHADOWCOORDS, WirePortDataType.FLOAT4, ref result ) ) + { + return result; + } + + return dataCollector.TemplateDataCollectorInstance.GetLightAtten( UniqueId ); + } + else + { + if( dataCollector.CurrentSRPType == TemplateSRPType.URP ) + { + if( dataCollector.HasLocalVariable( LightweightLightAttenDecl )) + return ASEAttenVarName; + + bool isForward = dataCollector.CurrentPassName.Contains( "Forward" ); + bool isGBuffer = dataCollector.CurrentPassName.Contains( "GBuffer" ); + + // Pragmas + var pragmas = new List(); + if ( ASEPackageManagerHelper.CurrentSRPVersion >= 140009 ) + { + if ( isForward || isGBuffer ) + { + pragmas.Add( "multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN" ); + pragmas.Add( "multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH" ); + } + + if ( isForward ) + { + pragmas.Add( "multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS" ); + pragmas.Add( "multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS" ); + pragmas.Add( "multi_compile _ _FORWARD_PLUS" ); + } + } + else if ( ASEPackageManagerHelper.CurrentURPBaseline >= ASESRPBaseline.ASE_SRP_14 ) + { + if ( isForward || isGBuffer ) + { + pragmas.Add( "multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN" ); + pragmas.Add( "multi_compile_fragment _ _SHADOWS_SOFT" ); + } + + if ( isForward ) + { + pragmas.Add( "multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS" ); + pragmas.Add( "multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS" ); + pragmas.Add( "multi_compile _ _FORWARD_PLUS" ); + } + } + else if ( ASEPackageManagerHelper.CurrentURPBaseline >= ASESRPBaseline.ASE_SRP_12 ) + { + if ( isForward || isGBuffer ) + { + pragmas.Add( "multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN" ); + pragmas.Add( "multi_compile_fragment _ _SHADOWS_SOFT" ); + } + + if ( isForward ) + { + pragmas.Add( "multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS" ); + pragmas.Add( "multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS" ); + } + } + else if ( ASEPackageManagerHelper.CurrentURPBaseline >= ASESRPBaseline.ASE_SRP_11 ) + { + if ( isForward || isGBuffer ) + { + pragmas.Add( "multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN" ); + pragmas.Add( "multi_compile_fragment _ _SHADOWS_SOFT" ); + } + + if ( isForward ) + { + pragmas.Add( "multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS" ); + pragmas.Add( "multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS" ); + } + } + else + { + if ( isForward || isGBuffer ) + { + pragmas.Add( "multi_compile _ _MAIN_LIGHT_SHADOWS" ); + pragmas.Add( "multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE" ); + pragmas.Add( "multi_compile_fragment _ _SHADOWS_SOFT" ); + } + + if ( isForward ) + { + pragmas.Add( "multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS" ); + pragmas.Add( "multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS" ); + } + } + + for ( int i = 0; i < pragmas.Count; i++ ) + { + dataCollector.AddToPragmas( UniqueId, pragmas[ i ] ); + } + + //string shadowCoords = dataCollector.TemplateDataCollectorInstance.GetShadowCoords( UniqueId/*, false, dataCollector.PortCategory*/ ); + //return shadowCoords; + // Vertex Instructions + //TemplateVertexData shadowCoordsData = dataCollector.TemplateDataCollectorInstance.RequestNewInterpolator( WirePortDataType.FLOAT4, false ); + //string vertexInterpName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData.OutVarName; + //string vertexShadowCoords = vertexInterpName + "." + shadowCoordsData.VarNameWithSwizzle; + //string vertexPos = dataCollector.TemplateDataCollectorInstance.GetVertexPosition( WirePortDataType.FLOAT3, PrecisionType.Float ,false,MasterNodePortCategory.Vertex ); + + //dataCollector.AddToVertexLocalVariables( UniqueId, string.Format( LightweightVertexInstructions[ 0 ], vertexPos )); + //dataCollector.AddToVertexLocalVariables( UniqueId, LightweightVertexInstructions[ 1 ]); + //dataCollector.AddToVertexLocalVariables( UniqueId, string.Format( LightweightVertexInstructions[ 2 ], vertexShadowCoords ) ); + //dataCollector.AddToVertexLocalVariables( UniqueId, LightweightVertexInstructions[ 3 ]); + + // Fragment Instructions + //string fragmentInterpName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.FragmentFunctionData.InVarName; + //string fragmentShadowCoords = fragmentInterpName + "." + shadowCoordsData.VarNameWithSwizzle; + + dataCollector.AddLocalVariable( UniqueId, LightweightLightAttenDecl ); + string mainLight = dataCollector.TemplateDataCollectorInstance.GetURPMainLight( UniqueId ); + //dataCollector.AddLocalVariable( UniqueId, string.Format( LightweightFragmentInstructions[ 0 ], shadowCoords ) ); + dataCollector.AddLocalVariable( UniqueId, string.Format( LightweightFragmentInstructions[ 1 ], mainLight) ); + return ASEAttenVarName; + } + else + { + UIUtils.ShowMessage( UniqueId, "Light Attenuation node currently not supported on HDRP" ); + return "1"; + } + } + } + + if ( dataCollector.GenType == PortGenType.NonCustomLighting || dataCollector.CurrentCanvasMode != NodeAvailability.CustomLighting ) + { + UIUtils.ShowMessage( UniqueId, "Light Attenuation node currently not supported on non-custom lighting surface shaders" ); + return "1"; + } + + dataCollector.UsingLightAttenuation = true; + return ASEAttenVarName; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + if( ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader && ContainerGraph.CurrentSRPType != TemplateSRPType.URP ) + { + m_showErrorMessage = true; + m_errorMessageTypeIsError = NodeMessageType.Warning; + m_errorMessageTooltip = TemplateError; + } else + { + m_errorMessageTypeIsError = NodeMessageType.Error; + m_errorMessageTooltip = SurfaceError; + if ( ( ContainerGraph.CurrentStandardSurface != null && ContainerGraph.CurrentStandardSurface.CurrentLightingModel != StandardShaderLightModel.CustomLighting ) ) + m_showErrorMessage = true; + else + m_showErrorMessage = false; + } + + + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs.meta new file mode 100644 index 00000000..5b271df2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4e205b44d56609f459ffc558febe2792 +timeCreated: 1495449979 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs new file mode 100644 index 00000000..140f262d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs @@ -0,0 +1,99 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Main Light Color", "Lighting", "Light color of main Directional light. RGB value already contains light intensity while A only contains light intensity." )] + public sealed class LightColorNode : ShaderVariablesNode + { + private const string m_lightColorValue = "_LightColor0"; + + private const string m_localIntensityVar = "ase_lightIntensity"; + private const string m_localColorVar = "ase_lightColor"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "RGBA", WirePortDataType.COLOR ); + AddOutputPort( WirePortDataType.FLOAT3, "Color" ); + AddOutputPort( WirePortDataType.FLOAT, "Intensity" ); + m_previewShaderGUID = "43f5d3c033eb5044e9aeb40241358349"; + } + + public override void RenderNodePreview() + { + //Runs at least one time + if( !m_initialized ) + { + // nodes with no preview don't update at all + PreviewIsDirty = false; + return; + } + + if( !PreviewIsDirty ) + return; + if( !Preferences.User.DisablePreviews ) + { + int count = m_outputPorts.Count; + for( int i = 0 ; i < count ; i++ ) + { + RenderTexture temp = RenderTexture.active; + RenderTexture.active = m_outputPorts[ i ].OutputPreviewTexture; + Graphics.Blit( null , m_outputPorts[ i ].OutputPreviewTexture , PreviewMaterial , i ); + RenderTexture.active = temp; + } + } + + PreviewIsDirty = m_continuousPreviewRefresh; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.IsTemplate && !dataCollector.IsSRP ) + dataCollector.AddToIncludes( -1, Constants.UnityLightingLib ); + + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + + if ( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + string constantVar; + if ( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + { + dataCollector.TemplateDataCollectorInstance.AddHDLightInfo(); + constantVar = string.Format( TemplateHelperFunctions.HDLightInfoFormat, "0", "color" ); ; + } + else + { + constantVar = "_MainLightColor"; + } + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, m_localIntensityVar, + string.Format( "max( max( {0}.r, {0}.g ), {0}.b ) + 1e-7", constantVar ) ); + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, m_localColorVar, + string.Format( "float4( {0}.rgb / {1}, {1} )", constantVar, m_localIntensityVar ) ); + } + else + { + dataCollector.AddLocalVariable( UniqueId, "#if defined(LIGHTMAP_ON) && ( UNITY_VERSION < 560 || ( defined(LIGHTMAP_SHADOW_MIXING) && !defined(SHADOWS_SHADOWMASK) && defined(SHADOWS_SCREEN) ) )//aselc" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, m_localColorVar, "0" ); + dataCollector.AddLocalVariable( UniqueId, "#else //aselc" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, m_localColorVar, m_lightColorValue ); + dataCollector.AddLocalVariable( UniqueId, "#endif //aselc" ); + } + //else if( ContainerGraph.CurrentStandardSurface.CurrentLightingModel == StandardShaderLightModel.CustomLighting ) + // finalVar = "gi.light.color"; + + switch ( outputId ) + { + default: + case 0: return m_localColorVar; + case 1: return m_localColorVar + ".rgb"; + case 2: return m_localColorVar + ".a"; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs.meta new file mode 100644 index 00000000..c31e2a65 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 275270020c577924caf04492f73b2ea6 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs new file mode 100644 index 00000000..cbc11308 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs @@ -0,0 +1,93 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEditor; +using UnityEngine; +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "World Space Light Pos", "Lighting", "Light Position" )] + public sealed class WorldSpaceLightPos : ShaderVariablesNode + { + private const string HelperText = + "This node will behave differently according to light type." + + "\n\n- For directional lights the Dir/Pos output will specify a world space direction and Type will be set to 0." + + "\n\n- For other light types the Dir/Pos output will specify a world space position and Type will be set to 1."; + private const string m_lightPosValue = "_WorldSpaceLightPos0"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, Constants.EmptyPortValue, WirePortDataType.FLOAT4 ); + AddOutputPort( WirePortDataType.FLOAT3, "Dir/Pos" ); + AddOutputPort( WirePortDataType.FLOAT, "Type" ); + m_previewShaderGUID = "2292a614672283c41a367b22cdde4620"; + m_drawPreviewAsSphere = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUILayout.HelpBox( HelperText, MessageType.Info ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); + string finalVar = m_lightPosValue; + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.IsSRP ) + finalVar = "_MainLightPosition"; + if( outputId == 1 ) + { + return finalVar + ".xyz"; + } + else if( outputId == 2 ) + { + return finalVar + ".w"; + } + else + { + return finalVar; + } + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( !m_outputPorts[ 0 ].IsConnected ) + { + m_outputPorts[ 0 ].Visible = false; + m_sizeIsDirty = true; + } + } + + public override void RenderNodePreview() + { + //Runs at least one time + if( !m_initialized ) + { + // nodes with no preview don't update at all + PreviewIsDirty = false; + return; + } + + if( !PreviewIsDirty ) + return; + + SetPreviewInputs(); + if( !Preferences.User.DisablePreviews ) + { + RenderTexture temp = RenderTexture.active; + + RenderTexture.active = m_outputPorts[ 0 ].OutputPreviewTexture; + Graphics.Blit( null , m_outputPorts[ 0 ].OutputPreviewTexture , PreviewMaterial , 0 ); + Graphics.Blit( m_outputPorts[ 0 ].OutputPreviewTexture , m_outputPorts[ 1 ].OutputPreviewTexture ); + + RenderTexture.active = m_outputPorts[ 2 ].OutputPreviewTexture; + Graphics.Blit( null , m_outputPorts[ 2 ].OutputPreviewTexture , PreviewMaterial , 1 ); + RenderTexture.active = temp; + } + PreviewIsDirty = m_continuousPreviewRefresh; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs.meta new file mode 100644 index 00000000..39e9fffd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: db94d973647dae9488d3ef5ee2fd95a4 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs new file mode 100644 index 00000000..499999f1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs @@ -0,0 +1,27 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class ShaderVariablesNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.OBJECT, "Out" ); + } + public override string GetIncludes() + { + return Constants.UnityShaderVariables; + } + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( !( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.IsSRP ) ) + dataCollector.AddToIncludes( UniqueId, Constants.UnityShaderVariables ); + return string.Empty; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs.meta new file mode 100644 index 00000000..07b1110f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1eb723e6ceff9a345a9dbfe04aa3dc11 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time.meta new file mode 100644 index 00000000..bfd7fd96 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7c77e88b33fec7c429412624a7b2c620 +folderAsset: yes +timeCreated: 1481126947 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs new file mode 100644 index 00000000..332e7336 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs @@ -0,0 +1,51 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Cos Time", "Time", "Cosine of time" )] + public sealed class CosTime : ConstVecShaderVariable + { + private readonly string[] SRPTime = + { + "cos( _TimeParameters.x * 0.125 )", + "cos( _TimeParameters.x * 0.25 )", + "cos( _TimeParameters.x * 0.5 )", + "_TimeParameters.z", + }; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputName( 1, "t/8" ); + ChangeOutputName( 2, "t/4" ); + ChangeOutputName( 3, "t/2" ); + ChangeOutputName( 4, "t" ); + m_value = "_CosTime"; + m_previewShaderGUID = "3093999b42c3c0940a71799511d7781c"; + m_continuousPreviewRefresh = true; + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( !m_outputPorts[ 0 ].IsConnected ) + { + m_outputPorts[ 0 ].Visible = false; + m_sizeIsDirty = true; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( outputId > 0 && dataCollector.IsTemplate ) + { + if( dataCollector.TemplateDataCollectorInstance.IsHDRP || dataCollector.TemplateDataCollectorInstance.IsLWRP ) + return SRPTime[ outputId - 1 ]; + } + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs.meta new file mode 100644 index 00000000..9708a899 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 447e504f2ca5aaf4bbf0fdbce33596bc +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs new file mode 100644 index 00000000..a1f3380f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs @@ -0,0 +1,33 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Delta Time", "Time", "Delta time" )] + public sealed class DeltaTime : ConstVecShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputName( 1, "dt" ); + ChangeOutputName( 2, "1/dt" ); + ChangeOutputName( 3, "smoothDt" ); + ChangeOutputName( 4, "1/smoothDt" ); + m_value = "unity_DeltaTime"; + m_previewShaderGUID = "9d69a693042c443498f96d6da60535eb"; + m_continuousPreviewRefresh = true; + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( !m_outputPorts[ 0 ].IsConnected ) + { + m_outputPorts[ 0 ].Visible = false; + m_sizeIsDirty = true; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs.meta new file mode 100644 index 00000000..77b92ca3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3ddde7ed1ab4f8044a9a6aa3891f5ca4 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs new file mode 100644 index 00000000..f16c24a7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs @@ -0,0 +1,46 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Time", "Time", "Time in seconds with a scale multiplier" )] + public sealed class SimpleTimeNode : ShaderVariablesNode + { + private const string TimeStandard = "_Time.y"; + private const string TimeSRP = "_TimeParameters.x"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT ); + AddInputPort( WirePortDataType.FLOAT, false, "Scale" ); + m_inputPorts[ 0 ].FloatInternalData = 1; + m_useInternalPortData = true; + m_previewShaderGUID = "45b7107d5d11f124fad92bcb1fa53661"; + m_continuousPreviewRefresh = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + string multiplier = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string timeGlobalVar = TimeStandard; + + if( dataCollector.IsTemplate ) + { + if( dataCollector.TemplateDataCollectorInstance.IsHDRP || dataCollector.TemplateDataCollectorInstance.IsLWRP ) + timeGlobalVar = TimeSRP; + } + + if( multiplier == "1.0" ) + return timeGlobalVar; + + string scaledVarName = "mulTime" + OutputId; + string scaledVarValue = timeGlobalVar + " * " + multiplier; + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, scaledVarName, scaledVarValue ); + return scaledVarName; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs.meta new file mode 100644 index 00000000..82865638 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f36e4491ee33fe74fa51cfb5ad450c6e +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs new file mode 100644 index 00000000..4f00822f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs @@ -0,0 +1,55 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEditor; +using UnityEngine; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Sin Time", "Time", "Unity sin time" )] + public sealed class SinTimeNode : ConstVecShaderVariable + { + //double m_time; + private readonly string[] SRPTime = + { + "sin( _TimeParameters.x * 0.125 )", + "sin( _TimeParameters.x * 0.25 )", + "sin( _TimeParameters.x * 0.5 )", + "_TimeParameters.y", + }; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputName( 1, "t/8" ); + ChangeOutputName( 2, "t/4" ); + ChangeOutputName( 3, "t/2" ); + ChangeOutputName( 4, "t" ); + m_value = "_SinTime"; + m_previewShaderGUID = "e4ba809e0badeb94994170b2cbbbba10"; + m_continuousPreviewRefresh = true; + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( !m_outputPorts[ 0 ].IsConnected ) + { + m_outputPorts[ 0 ].Visible = false; + m_sizeIsDirty = true; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( outputId > 0 && dataCollector.IsTemplate ) + { + if( dataCollector.TemplateDataCollectorInstance.IsHDRP || dataCollector.TemplateDataCollectorInstance.IsLWRP ) + return SRPTime[ outputId - 1 ]; + } + + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs.meta new file mode 100644 index 00000000..30c97d6e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 796acd44fcf330e4e921855630007b9b +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs new file mode 100644 index 00000000..1d974c2d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs @@ -0,0 +1,52 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Time Parameters", "Time", "Time since level load" )] + public sealed class TimeNode : ConstVecShaderVariable + { + private readonly string[] SRPTime = + { + "( _TimeParameters.x * 0.05 )", + "( _TimeParameters.x )", + "( _TimeParameters.x * 2 )", + "( _TimeParameters.x * 3 )", + }; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputName( 1, "t/20" ); + ChangeOutputName( 2, "t" ); + ChangeOutputName( 3, "t*2" ); + ChangeOutputName( 4, "t*3" ); + m_value = "_Time"; + m_previewShaderGUID = "73abc10c8d1399444827a7eeb9c24c2a"; + m_continuousPreviewRefresh = true; + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( !m_outputPorts[ 0 ].IsConnected ) + { + m_outputPorts[ 0 ].Visible = false; + m_sizeIsDirty = true; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( outputId > 0 && dataCollector.IsTemplate ) + { + if( dataCollector.TemplateDataCollectorInstance.IsHDRP || dataCollector.TemplateDataCollectorInstance.IsLWRP ) + return SRPTime[ outputId - 1 ]; + } + + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs.meta new file mode 100644 index 00000000..702ca2c0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d8c6b7bfb7784e14d8708ab6fb981268 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform.meta new file mode 100644 index 00000000..008be40e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2ce97203c4871664493f8760d88d0d4d +folderAsset: yes +timeCreated: 1481126946 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs new file mode 100644 index 00000000..1238566a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs @@ -0,0 +1,24 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Camera To World Matrix", "Matrix Transform", "Current camera to world matrix" )] + public sealed class CameraToWorldMatrix : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "unity_CameraToWorld"; + m_drawPreview = false; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + GeneratorUtils.RegisterUnity2019MatrixDefines( ref dataCollector ); + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs.meta new file mode 100644 index 00000000..42feb2c0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6accfe0f350cf064dae07041fe90446b +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/IMMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/IMMatrixNode.cs new file mode 100644 index 00000000..a2d26093 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/IMMatrixNode.cs @@ -0,0 +1,25 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Inverse Model Matrix", "Matrix Transform", "Inverse of current model matrix" )] + public sealed class IMMatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "unity_WorldToObject"; + m_valueHDRP = "GetWorldToObjectMatrix()"; + m_valueURP = "GetWorldToObjectMatrix()"; + m_drawPreview = false; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/IMMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/IMMatrixNode.cs.meta new file mode 100644 index 00000000..eee7981c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/IMMatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4d327dba1ad1f314e93ee246c376684b +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/IMMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs new file mode 100644 index 00000000..4d80a9e1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs @@ -0,0 +1,24 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Inverse Projection Matrix", "Matrix Transform", "Current inverse projection matrix" )] + public sealed class InverseProjectionMatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "UNITY_MATRIX_I_P"; + m_drawPreview = false; + m_matrixId = 1; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + return GeneratorUtils.GenerateInverseProjection( ref dataCollector, UniqueId, CurrentPrecisionType ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs.meta new file mode 100644 index 00000000..d6dfa9f0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 0fdbc380972c44b489c5f948a40b8e69 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs new file mode 100644 index 00000000..e4071ba0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs @@ -0,0 +1,18 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Inverse Transpose Model View Matrix", "Matrix Transform", "All Transformation types" )] + public sealed class InverseTranspMVMatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "UNITY_MATRIX_IT_MV"; + m_drawPreview = false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs.meta new file mode 100644 index 00000000..3fcfd03a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3a71f1e560487aa4c8484c4153941884 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs new file mode 100644 index 00000000..c21aa195 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs @@ -0,0 +1,19 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Inverse View Matrix", "Matrix Transform", "Current inverse view matrix" )] + public sealed class InverseViewMatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "UNITY_MATRIX_I_V"; + m_drawPreview = false; + m_matrixId = 0; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs.meta new file mode 100644 index 00000000..b9272b89 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: dd0c1c252c062184e9ad592b91e7fcd2 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs new file mode 100644 index 00000000..17c73e38 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs @@ -0,0 +1,24 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Inverse View Projection Matrix", "Matrix Transform", "Current view inverse projection matrix" )] + public sealed class InverseViewProjectionMatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "UNITY_MATRIX_I_VP"; + m_drawPreview = false; + m_matrixId = 1; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + return GeneratorUtils.GenerateInverseViewProjection( ref dataCollector, UniqueId, CurrentPrecisionType ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs.meta new file mode 100644 index 00000000..9c985e4b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: f6f151774e252dd4fb2b9ee440ec8eed +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs new file mode 100644 index 00000000..dca4d0e2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs @@ -0,0 +1,18 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Model Matrix", "Matrix Transform", "Current model matrix" )] + public sealed class MMatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "unity_ObjectToWorld"; + m_drawPreview = false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs.meta new file mode 100644 index 00000000..ce4196bf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 503a386043991354eaca2410683d836a +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs new file mode 100644 index 00000000..a99d8518 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs @@ -0,0 +1,18 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Model View Matrix", "Matrix Transform", "Current model * view matrix" )] + public sealed class MVMatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "UNITY_MATRIX_MV"; + m_drawPreview = false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs.meta new file mode 100644 index 00000000..3822f16c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 30c7936db4e6fe5488076d799841f857 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs new file mode 100644 index 00000000..324a1532 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs @@ -0,0 +1,18 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Model View Projection Matrix", "Matrix Transform", "Current model * view * projection matrix" )] + public sealed class MVPMatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "UNITY_MATRIX_MVP"; + m_drawPreview = false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs.meta new file mode 100644 index 00000000..486a0cc8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 74e00fb3d8e161f498c078795184bae4 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs new file mode 100644 index 00000000..c327ae06 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs @@ -0,0 +1,19 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Object To World Matrix", "Matrix Transform", "Current model matrix" )] + public sealed class ObjectToWorldMatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "unity_ObjectToWorld"; + m_valueHDRP = "GetObjectToWorldMatrix()"; + m_valueURP = "GetObjectToWorldMatrix()"; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs.meta new file mode 100644 index 00000000..a8a2f02e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a0c0180a327eba54c832fbb695dd282f +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs new file mode 100644 index 00000000..a80058d2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs @@ -0,0 +1,19 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Projection Matrix", "Matrix Transform", "Current projection matrix" )] + public sealed class ProjectionMatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "UNITY_MATRIX_P"; + m_drawPreview = false; + m_matrixId = 1; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs.meta new file mode 100644 index 00000000..b88fceb2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 008fd07cf3f9a7140a9e23be43733f7c +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs new file mode 100644 index 00000000..4f568726 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs @@ -0,0 +1,18 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Texture 0 Matrix", "Matrix Transform", "Texture 0 Matrix", null, UnityEngine.KeyCode.None, true, true )] + public sealed class Texture0MatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "UNITY_MATRIX_TEXTURE0"; + m_drawPreview = false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs.meta new file mode 100644 index 00000000..16313ced --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f57a1d05f7a9c5847912566ff1605c6d +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs new file mode 100644 index 00000000..a9debbe5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs @@ -0,0 +1,18 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Texture 1 Matrix", "Matrix Transform", "Texture 1 Matrix", null, UnityEngine.KeyCode.None, true, true )] + public sealed class Texture1MatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "UNITY_MATRIX_TEXTURE1"; + m_drawPreview = false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs.meta new file mode 100644 index 00000000..1fc78296 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 9ef360a7c6005ad479d7a3e6db1d32f4 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs new file mode 100644 index 00000000..c0938e7a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs @@ -0,0 +1,18 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Texture 2 Matrix", "Matrix Transform", "Texture 2 Matrix", null, UnityEngine.KeyCode.None, true, true )] + public sealed class Texture2MatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "UNITY_MATRIX_TEXTURE2"; + m_drawPreview = false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs.meta new file mode 100644 index 00000000..cefc6ba6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6cf4950dda0f6e6438ace404fbef19a7 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs new file mode 100644 index 00000000..8b5f86ae --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs @@ -0,0 +1,18 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Texture 3 Matrix", "Matrix Transform", "Texture 3 Matrix", null, UnityEngine.KeyCode.None, true, true )] + public sealed class Texture3MatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "UNITY_MATRIX_TEXTURE3"; + m_drawPreview = false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs.meta new file mode 100644 index 00000000..c1af8f9f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 02a9fb7a3a104974e941f4109567b97f +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs new file mode 100644 index 00000000..46959326 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs @@ -0,0 +1,579 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public enum InverseTangentType + { + Fast, + Precise + } + + [Serializable] + [NodeAttributes( "Transform Direction", "Vector Operators", "Transforms a direction vector from one space to another" )] + public sealed class TransformDirectionNode : ParentNode + { + + [SerializeField] + private TransformSpaceFrom m_from = TransformSpaceFrom.Object; + + [SerializeField] + private TransformSpaceTo m_to = TransformSpaceTo.World; + + [SerializeField] + private bool m_normalize = false; + + [SerializeField] + private bool m_safeNormalize = false; + + [SerializeField] + private InverseTangentType m_inverseTangentType = InverseTangentType.Fast; + + private string InverseTBNStr = "Inverse TBN"; + + private const string NormalizeOptionStr = "Normalize"; + private const string SafeNormalizeOptionStr = "Safe"; + + private const string AseObjectToWorldDirVarName = "objToWorldDir"; + private const string AseObjectToWorldDirFormat = "mul( unity_ObjectToWorld, float4( {0}, 0.0 ) ).xyz"; + private const string AseSRPObjectToWorldDirFormat = "mul( GetObjectToWorldMatrix(), float4( {0}, 0.0 ) ).xyz"; + + private const string AseObjectToViewDirVarName = "objToViewDir"; + private const string AseObjectToViewDirFormat = "mul( UNITY_MATRIX_IT_MV, float4( {0}, 0.0 ) ).xyz"; + private const string AseHDObjectToViewDirFormat = "TransformWorldToViewDir( TransformObjectToWorldDir( {0} ) )"; + + private const string AseWorldToObjectDirVarName = "worldToObjDir"; + private const string AseWorldToObjectDirFormat = "mul( unity_WorldToObject, float4( {0}, 0.0 ) ).xyz"; + private const string AseSRPWorldToObjectDirFormat = "mul( GetWorldToObjectMatrix(), float4( {0}, 0.0 ) ).xyz"; + + + private const string AseWorldToViewDirVarName = "worldToViewDir"; + private const string AseWorldToViewDirFormat = "mul( UNITY_MATRIX_V, float4( {0}, 0.0 ) ).xyz"; + + private const string AseViewToObjectDirVarName = "viewToObjDir"; + private const string AseViewToObjectDirFormat = "mul( UNITY_MATRIX_T_MV, float4( {0}, 0.0 ) ).xyz"; + + private const string AseViewToWorldDirVarName = "viewToWorldDir"; + private const string AseViewToWorldDirFormat = "mul( UNITY_MATRIX_I_V, float4( {0}, 0.0 ) ).xyz"; + + /////////////////////////////////////////////////////////// + private const string AseObjectToClipDirVarName = "objectToClipDir"; + private const string AseObjectToClipDirFormat = "mul( UNITY_MATRIX_VP, mul( unity_ObjectToWorld, float4( {0}, 0.0 ) ) ).xyz"; + private const string AseSRPObjectToClipDirFormat = "TransformWorldToHClipDir( TransformObjectToWorldDir( {0} ) )"; + + private const string AseWorldToClipDirVarName = "worldToClipDir"; + private const string AseWorldToClipDirFormat = "mul( UNITY_MATRIX_VP, float4( {0}, 0.0 ) ).xyz"; + private const string AseSRPWorldToClipDirFormat = "TransformWorldToHClipDir( {0} )"; + + private const string AseViewToClipDirVarName = "viewToClipDir"; + private const string AseViewToClipDirFormat = "mul( UNITY_MATRIX_P, float4( {0}, 0.0 ) ).xyz"; + private const string AseSRPViewToClipDirFormat = "mul( GetViewToHClipMatrix(), float4( {0}, 1.0 ) ).xyz"; + // + private const string AseClipToObjectDirVarName = "clipToObjectDir"; + + private const string AseClipToObjectDirFormat = "mul( UNITY_MATRIX_IT_MV, mul( unity_CameraInvProjection, float4( {0}, 0.0 ) ) ).xyz"; + private const string AseClipToWorldDirFormat = "mul( UNITY_MATRIX_I_V, mul( unity_CameraInvProjection, float4( {0}, 0.0 ) ) ).xyz"; + private const string AseClipToViewDirFormat = " mul( unity_CameraInvProjection, float4( {0}, 0.0 ) ).xyz"; + private const string AseHDClipToObjectDirFormat = "mul( UNITY_MATRIX_I_M, mul( UNITY_MATRIX_I_VP, float4( {0}, 0.0) ) ).xyz"; + + private const string AseClipToWorldDirVarName = "clipToWorldDir"; + private const string AseHDClipToWorldDirFormat = "mul( UNITY_MATRIX_I_VP, float4( {0}, 0.0 ) ).xyz"; + + private const string AseClipToViewDirVarName = "clipToViewDir"; + private const string AseHDClipToViewDirFormat = " mul( UNITY_MATRIX_I_P,float4( {0}, 0.0 ) ).xyz"; + private const string AseClipToNDC = "{0}.xyz / {0}.w"; + + ///////////////////////////////////////////////////// + private const string AseObjectToTangentDirVarName = "objectToTangentDir"; + private const string AseWorldToTangentDirVarName = "worldToTangentDir"; + private const string AseViewToTangentDirVarName = "viewToTangentDir"; + private const string AseClipToTangentDirVarName = "clipToTangentDir"; + private const string ASEWorldToTangentFormat = "mul( ase_worldToTangent, {0} )"; + + + private const string AseTangentToObjectDirVarName = "tangentTobjectDir"; + private const string AseTangentToWorldDirVarName = "tangentToWorldDir"; + private const string AseTangentToViewDirVarName = "tangentToViewDir"; + private const string AseTangentToClipDirVarName = "tangentToClipDir"; + private const string ASEMulOpFormat = "mul( {0}, {1} )"; + + + + /////////////////////////////////////////////////////////// + private const string FromStr = "From"; + private const string ToStr = "To"; + private const string SubtitleFormat = "{0} to {1}"; + + private readonly string[] m_spaceOptionsFrom = + { + "Object", + "World", + "View", + "Tangent" + }; + + private readonly string[] m_spaceOptionsTo = + { + "Object", + "World", + "View", + "Tangent", + "Clip" + }; + + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, Constants.EmptyPortValue ); + AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); + m_useInternalPortData = true; + m_autoWrapProperties = true; + m_previewShaderGUID = "74e4d859fbdb2c0468de3612145f4929"; + m_textLabelWidth = 100; + UpdateSubtitle(); + } + + private void UpdateSubtitle() + { + SetAdditonalTitleText( string.Format( SubtitleFormat, m_from, m_to ) ); + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_from = (TransformSpaceFrom)EditorGUILayoutPopup( FromStr, (int)m_from, m_spaceOptionsFrom ); + m_to = (TransformSpaceTo)EditorGUILayoutPopup( ToStr, (int)m_to, m_spaceOptionsTo ); + if( m_from == TransformSpaceFrom.Tangent ) + { + m_inverseTangentType = (InverseTangentType)EditorGUILayoutEnumPopup( InverseTBNStr, m_inverseTangentType ); + } + + m_normalize = EditorGUILayoutToggle( NormalizeOptionStr, m_normalize ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateSubtitle(); + } + + if( m_normalize ) + { + EditorGUI.indentLevel++; + m_safeNormalize = EditorGUILayoutToggle( SafeNormalizeOptionStr , m_safeNormalize ); + EditorGUILayout.HelpBox( Constants.SafeNormalizeInfoStr , MessageType.Info ); + EditorGUI.indentLevel--; + } + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + if( (int)m_from != (int)m_to && ( m_from == TransformSpaceFrom.Tangent || m_to == TransformSpaceTo.Tangent ) ) + dataCollector.DirtyNormal = true; + } + + void CalculateTransform( TransformSpaceFrom from, TransformSpaceTo to, ref MasterNodeDataCollector dataCollector, ref string varName, ref string result ) + { + switch( from ) + { + case TransformSpaceFrom.Object: + { + switch( to ) + { + default: case TransformSpaceTo.Object: break; + case TransformSpaceTo.World: + { + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BiRP ) + result = string.Format( AseSRPObjectToWorldDirFormat, result ); + else + result = string.Format( AseObjectToWorldDirFormat, result ); + varName = AseObjectToWorldDirVarName + OutputId; + } + break; + case TransformSpaceTo.View: + { + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + result = string.Format( AseHDObjectToViewDirFormat, result ); + else + result = string.Format( AseObjectToViewDirFormat, result ); + varName = AseObjectToViewDirVarName + OutputId; + } + break; + case TransformSpaceTo.Clip: + { + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BiRP ) + { + result = string.Format( AseSRPObjectToClipDirFormat, result ); + } + else + { + result = string.Format( AseObjectToClipDirFormat, result ); + } + varName = AseObjectToClipDirVarName + OutputId; + } + break; + } + } + break; + case TransformSpaceFrom.World: + { + switch( to ) + { + case TransformSpaceTo.Object: + { + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BiRP ) + result = string.Format( AseSRPWorldToObjectDirFormat, result ); + else + result = string.Format( AseWorldToObjectDirFormat, result ); + varName = AseWorldToObjectDirVarName + OutputId; + } + break; + default: + case TransformSpaceTo.World: break; + case TransformSpaceTo.View: + { + result = string.Format( AseWorldToViewDirFormat, result ); + varName = AseWorldToViewDirVarName + OutputId; + } + break; + case TransformSpaceTo.Clip: + { + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BiRP ) + { + result = string.Format( AseSRPWorldToClipDirFormat, result ); + } + else + { + result = string.Format( AseWorldToClipDirFormat, result ); + } + varName = AseWorldToClipDirVarName + OutputId; + } + break; + } + } + break; + case TransformSpaceFrom.View: + { + switch( to ) + { + case TransformSpaceTo.Object: + { + result = string.Format( AseViewToObjectDirFormat, result ); + varName = AseViewToObjectDirVarName + OutputId; + } + break; + case TransformSpaceTo.World: + { + result = string.Format( AseViewToWorldDirFormat, result ); + varName = AseViewToWorldDirVarName + OutputId; + } + break; + default: case TransformSpaceTo.View: break; + case TransformSpaceTo.Clip: + { + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BiRP ) + { + result = string.Format( AseSRPViewToClipDirFormat, result ); + } + else + { + result = string.Format( AseViewToClipDirFormat, result ); + } + varName = AseViewToClipDirVarName + OutputId; + } + break; + } + } + break; + //case TransformSpace.Clip: + //{ + // switch( to ) + // { + // case TransformSpace.Object: + // { + // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + // { + // result = string.Format( AseHDClipToObjectDirFormat, result ); + // } + // else + // { + // result = string.Format( AseClipToObjectDirFormat, result ); + // } + // varName = AseClipToObjectDirVarName + OutputId; + // } + // break; + // case TransformSpace.World: + // { + // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + // { + // result = string.Format( AseHDClipToWorldDirFormat, result ); + // } + // else + // { + // result = string.Format( AseClipToWorldDirFormat, result ); + // } + // varName = AseClipToWorldDirVarName + OutputId; + // } + // break; + // case TransformSpace.View: + // { + // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + // { + // result = string.Format( AseHDClipToViewDirFormat, result ); + // } + // else + // { + // result = string.Format( AseClipToViewDirFormat, result ); + // } + // varName = AseClipToViewDirVarName + OutputId; + // } + // break; + // case TransformSpace.Clip: break; + // default: + // break; + // } + //} + //break; + default: break; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + GeneratorUtils.RegisterUnity2019MatrixDefines( ref dataCollector ); + + string result = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string varName = string.Empty; + + if( (int)m_from == (int)m_to ) + { + RegisterLocalVariable( 0, result, ref dataCollector ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + + switch( m_from ) + { + case TransformSpaceFrom.Object: + { + switch( m_to ) + { + default: case TransformSpaceTo.Object: break; + case TransformSpaceTo.World: + { + CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + } + break; + case TransformSpaceTo.View: + { + CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + } + break; + case TransformSpaceTo.Clip: + { + CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + } + break; + case TransformSpaceTo.Tangent: + { + GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); + CalculateTransform( m_from, TransformSpaceTo.World, ref dataCollector, ref varName, ref result ); + result = string.Format( ASEWorldToTangentFormat, result ); + varName = AseObjectToTangentDirVarName + OutputId; + } + break; + } + } + break; + case TransformSpaceFrom.World: + { + switch( m_to ) + { + case TransformSpaceTo.Object: + { + CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + } + break; + default: + case TransformSpaceTo.World: break; + case TransformSpaceTo.View: + { + CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + } + break; + case TransformSpaceTo.Clip: + { + CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + } + break; + case TransformSpaceTo.Tangent: + { + GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); + result = string.Format( ASEWorldToTangentFormat, result ); + varName = AseWorldToTangentDirVarName + OutputId; + } + break; + } + } + break; + case TransformSpaceFrom.View: + { + switch( m_to ) + { + case TransformSpaceTo.Object: + { + CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + } + break; + case TransformSpaceTo.World: + { + CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + } + break; + default: case TransformSpaceTo.View: break; + case TransformSpaceTo.Clip: + { + CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + } + break; + case TransformSpaceTo.Tangent: + { + GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); + CalculateTransform( m_from, TransformSpaceTo.World, ref dataCollector, ref varName, ref result ); + result = string.Format( ASEWorldToTangentFormat, result ); + varName = AseViewToTangentDirVarName + OutputId; + } + break; + } + } + break; + //case TransformSpace.Clip: + //{ + // switch( m_to ) + // { + // case TransformSpace.Object: + // { + // CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + // } + // break; + // case TransformSpace.World: + // { + // CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + // } + // break; + // case TransformSpace.View: + // { + // CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + // } + // break; + // case TransformSpace.Clip: break; + // case TransformSpace.Tangent: + // { + // GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); + // CalculateTransform( m_from, TransformSpace.World, ref dataCollector, ref varName, ref result ); + // result = string.Format( ASEWorldToTangentFormat, result ); + // varName = AseClipToTangentDirVarName + OutputId; + // } + // break; + // default: + // break; + // } + //}break; + case TransformSpaceFrom.Tangent: + { + string matrixVal = string.Empty; + if( m_inverseTangentType == InverseTangentType.Fast ) + matrixVal = GeneratorUtils.GenerateTangentToWorldMatrixFast( ref dataCollector, UniqueId, CurrentPrecisionType ); + else + matrixVal = GeneratorUtils.GenerateTangentToWorldMatrixPrecise( ref dataCollector, UniqueId, CurrentPrecisionType ); + + switch( m_to ) + { + case TransformSpaceTo.Object: + { + result = string.Format( ASEMulOpFormat, matrixVal, result ); + CalculateTransform( TransformSpaceFrom.World, m_to, ref dataCollector, ref varName, ref result ); + varName = AseTangentToObjectDirVarName + OutputId; + } + break; + case TransformSpaceTo.World: + { + result = string.Format( ASEMulOpFormat, matrixVal, result ); + varName = AseTangentToWorldDirVarName + OutputId; + } + break; + case TransformSpaceTo.View: + { + result = string.Format( ASEMulOpFormat, matrixVal, result ); + CalculateTransform( TransformSpaceFrom.World, m_to, ref dataCollector, ref varName, ref result ); + varName = AseTangentToViewDirVarName + OutputId; + } + break; + case TransformSpaceTo.Clip: + { + result = string.Format( ASEMulOpFormat, matrixVal, result ); + CalculateTransform( TransformSpaceFrom.World, m_to, ref dataCollector, ref varName, ref result ); + varName = AseTangentToClipDirVarName + OutputId; + } + break; + case TransformSpaceTo.Tangent: + default: + break; + } + } + break; + default: break; + } + + if( m_normalize ) + { + result = GeneratorUtils.NormalizeValue( ref dataCollector , m_safeNormalize , m_inputPorts[ 0 ].DataType , result ); + } + + RegisterLocalVariable( 0, result, ref dataCollector, varName ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + string from = GetCurrentParam( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() < 17500 && from.Equals( "Clip" ) ) + { + UIUtils.ShowMessage( UniqueId, "Clip Space no longer supported on From field over Transform Direction node" ); + } + else + { + m_from = (TransformSpaceFrom)Enum.Parse( typeof( TransformSpaceFrom ), from ); + } + m_to = (TransformSpaceTo)Enum.Parse( typeof( TransformSpaceTo ), GetCurrentParam( ref nodeParams ) ); + m_normalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 15800 ) + { + m_inverseTangentType = (InverseTangentType)Enum.Parse( typeof( InverseTangentType ), GetCurrentParam( ref nodeParams ) ); + } + if( UIUtils.CurrentShaderVersion() > 18814 ) + { + m_safeNormalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + UpdateSubtitle(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_from ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_to ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_normalize ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_inverseTangentType ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_safeNormalize ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs.meta new file mode 100644 index 00000000..825a8e38 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5088261e4c0031f4aba961a253707b80 +timeCreated: 1525857790 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs new file mode 100644 index 00000000..233314a9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs @@ -0,0 +1,638 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Transform Position", "Object Transform", "Transforms a position value from one space to another" )] + public sealed class TransformPositionNode : ParentNode + { + [SerializeField] + private TransformSpaceFrom m_from = TransformSpaceFrom.Object; + + [SerializeField] + private TransformSpaceTo m_to = TransformSpaceTo.World; + + [SerializeField] + private bool m_perspectiveDivide = false; + + [SerializeField] + private InverseTangentType m_inverseTangentType = InverseTangentType.Fast; + + [SerializeField] + private bool m_absoluteWorldPos = true; + + private string InverseTBNStr = "Inverse TBN"; + + private const string AseObjectToWorldPosVarName = "objToWorld"; + private const string AseObjectToWorldPosFormat = "mul( unity_ObjectToWorld, float4( {0}, 1 ) ).xyz"; + private const string AseHDObjectToWorldPosFormat = "mul( GetObjectToWorldMatrix(), float4( {0}, 1 ) ).xyz"; + private const string ASEHDAbsoluteWordPos = "GetAbsolutePositionWS( {0} )"; + private const string ASEHDRelaviveCameraPos = "GetCameraRelativePositionWS( {0} )"; + private const string AseObjectToViewPosVarName = "objToView"; + private const string AseObjectToViewPosFormat = "mul( UNITY_MATRIX_MV, float4( {0}, 1 ) ).xyz"; + private const string AseHDObjectToViewPosFormat = "TransformWorldToView( TransformObjectToWorld({0}) )"; + + private const string AseWorldToObjectPosVarName = "worldToObj"; + private const string AseWorldToObjectPosFormat = "mul( unity_WorldToObject, float4( {0}, 1 ) ).xyz"; + private const string AseSRPWorldToObjectPosFormat = "mul( GetWorldToObjectMatrix(), float4( {0}, 1 ) ).xyz"; + + + private const string AseWorldToViewPosVarName = "worldToView"; + private const string AseWorldToViewPosFormat = "mul( UNITY_MATRIX_V, float4( {0}, 1 ) ).xyz"; + + private const string AseViewToObjectPosVarName = "viewToObj"; + private const string AseViewToObjectPosFormat = "mul( unity_WorldToObject, mul( UNITY_MATRIX_I_V, float4( {0}, 1 ) ) ).xyz"; + private const string AseHDViewToObjectPosFormat = "mul( GetWorldToObjectMatrix(), mul( UNITY_MATRIX_I_V, float4( {0}, 1 ) ) ).xyz"; + + private const string AseViewToWorldPosVarName = "viewToWorld"; + private const string AseViewToWorldPosFormat = "mul( UNITY_MATRIX_I_V, float4( {0}, 1.0 ) ).xyz"; + + /////////////////////////////////////////////////////////// + // ToClipPos + private const string AseObjectToClipPosVarName = "objectToClip"; + private const string AseObjectToClipPosFormat = "UnityObjectToClipPos( {0} )"; + private const string AseSRPObjectToClipPosFormat = "TransformObjectToHClip( {0} )"; + + private const string AseWorldToClipPosVarName = "worldToClip"; + private const string AseWorldToClipPosFormat = "mul( UNITY_MATRIX_VP, float4({0}, 1.0 ) )"; + private const string AseSRPWorldToClipPosFormat = "TransformWorldToHClip( {0} )"; + + private const string AseViewToClipPosVarName = "viewToClip"; + private const string AseViewToClipPosFormat = "mul( UNITY_MATRIX_P, float4( {0}, 1.0 ) )"; + private const string AseSRPViewToClipPosFormat = "TransformWViewToHClip( {0} )"; + + /////////////////////////////////////////////////////////// + // ToScreenPos + private const string AseObjectToScreenVarName = "objectToScreen"; + private const string AseWorldToScreenVarName = "worldToScreen"; + private const string AseViewToScreenVarName = "viewToScreen"; + + private const string AseToScreenFormat = "ComputeScreenPos( {0} )"; + private const string AseHDRPToScreenFormat = "ComputeScreenPos( {0}, _ProjectionParams.x )"; + + // + private const string AseClipToNDC = "{0}{1}/{0}.w"; + ///////////////////////////////////////////////////// + private const string AseObjectToTangentPosVarName = "objectToTangentPos"; + private const string AseWorldToTangentPosVarName = "worldToTangentPos"; + private const string AseViewToTangentPosVarName = "viewToTangentPos"; + private const string ASEWorldToTangentFormat = "mul( ase_worldToTangent, {0} )"; + + + private const string AseTangentToObjectVarName = "tangentToObject"; + private const string AseTangentToWorldVarName = "tangentToWorld"; + private const string AseTangentToViewVarName = "tangentToView"; + private const string AseTangentToClipVarName = "tangentToClip"; + private const string AseTangentToScreenVarName = "tangentToScreen"; + private const string ASEMulOpFormat = "mul( {0}, {1} )"; + + + /////////////////////////////////////////////////////////// + private const string FromStr = "From"; + private const string ToStr = "To"; + private const string PerpectiveDivideStr = "Perspective Divide"; + private const string SubtitleFormat = "{0} to {1}"; + + private readonly string[] m_spaceOptionsFrom = + { + "Object", + "World", + "View", + "Tangent" + }; + + private readonly string[] m_spaceOptionsTo = + { + "Object", + "World", + "View", + "Tangent", + "Clip", + "Screen" + }; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, Constants.EmptyPortValue ); + AddOutputVectorPorts( WirePortDataType.FLOAT4, "XYZ" ); + m_outputPorts[ 4 ].Visible = false; + m_useInternalPortData = true; + m_autoWrapProperties = true; + m_previewShaderGUID = "74e4d859fbdb2c0468de3612145f4929"; + m_textLabelWidth = 120; + UpdateSubtitle(); + UpdateOutputPort(); + } + + private void UpdateSubtitle() + { + SetAdditonalTitleText( string.Format( SubtitleFormat, m_from, m_to ) ); + } + public override void OnOutputPortConnected( int portId, int otherNodeId, int otherPortId ) + { + base.OnOutputPortConnected( portId, otherNodeId, otherPortId ); + UpdateOutputPort(); + } + + void UpdateOutputPort() + { + switch ( m_to ) + { + case TransformSpaceTo.Clip: + { + m_outputPorts[ 0 ].ChangeProperties( "XYZW", WirePortDataType.FLOAT4, false ); + var wire = m_outputPorts[ 0 ].GetConnection(); + if ( wire != null && wire.DataType != WirePortDataType.FLOAT4 ) + { + wire.DataType = WirePortDataType.FLOAT4; + } + m_outputPorts[ 4 ].Visible = true; + break; + } + default: + { + m_outputPorts[ 0 ].ChangeProperties( "XYZ", WirePortDataType.FLOAT3, false ); + m_outputPorts[ 4 ].Visible = false; + break; + } + } + m_sizeIsDirty = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_from = (TransformSpaceFrom)EditorGUILayoutPopup( FromStr, (int)m_from, m_spaceOptionsFrom ); + m_to = (TransformSpaceTo)EditorGUILayoutPopup( ToStr, (int)m_to, m_spaceOptionsTo ); + if( m_from == TransformSpaceFrom.Tangent ) + { + m_inverseTangentType = (InverseTangentType)EditorGUILayoutEnumPopup( InverseTBNStr, m_inverseTangentType ); + } + if( EditorGUI.EndChangeCheck() ) + { + UpdateSubtitle(); + UpdateOutputPort(); + } + + if( m_to == TransformSpaceTo.Clip ) + { + m_perspectiveDivide = EditorGUILayoutToggle( PerpectiveDivideStr, m_perspectiveDivide ); + } + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + if( (int)m_from != (int)m_to && ( m_from == TransformSpaceFrom.Tangent || m_to == TransformSpaceTo.Tangent ) ) + dataCollector.DirtyNormal = true; + } + + void CalculateTransform( TransformSpaceFrom from, TransformSpaceTo to, ref MasterNodeDataCollector dataCollector, ref string varName, ref string result ) + { + switch( from ) + { + case TransformSpaceFrom.Object: + { + switch( to ) + { + default: + case TransformSpaceTo.Object: + { + // no transform + break; + } + case TransformSpaceTo.World: + { + if( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + { + result = string.Format( AseHDObjectToWorldPosFormat, result ); + if( m_absoluteWorldPos ) + { + result = string.Format( ASEHDAbsoluteWordPos, result ); + } + } + else if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.URP ) + { + result = string.Format( AseHDObjectToWorldPosFormat, result ); + } + } + else + { + result = string.Format( AseObjectToWorldPosFormat, result ); + } + varName = AseObjectToWorldPosVarName + OutputId; + break; + } + case TransformSpaceTo.View: + { + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + result = string.Format( AseHDObjectToViewPosFormat, result ); + else + result = string.Format( AseObjectToViewPosFormat, result ); + varName = AseObjectToViewPosVarName + OutputId; + break; + } + case TransformSpaceTo.Clip: + case TransformSpaceTo.Screen: + { + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BiRP ) + { + result = string.Format( AseSRPObjectToClipPosFormat, result ); + } + else + { + result = string.Format( AseObjectToClipPosFormat, result ); + } + + if ( to == TransformSpaceTo.Screen ) + { + if ( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + { + result = string.Format( AseHDRPToScreenFormat, result ); + } + else + { + result = string.Format( AseToScreenFormat, result ); + } + varName = AseObjectToScreenVarName + OutputId; + } + else // TransformSpaceTo.Clip + { + varName = AseObjectToClipPosVarName + OutputId; + } + break; + } + } + break; + } + case TransformSpaceFrom.World: + { + switch( to ) + { + default: + case TransformSpaceTo.World: + { + // no transform + break; + } + case TransformSpaceTo.Object: + { + if( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + { + if( m_absoluteWorldPos ) + { + result = string.Format( ASEHDRelaviveCameraPos, result ); + } + result = string.Format( AseSRPWorldToObjectPosFormat, result ); + } + else if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.URP ) + { + result = string.Format( AseSRPWorldToObjectPosFormat, result ); + } + + } + else + result = string.Format( AseWorldToObjectPosFormat, result ); + varName = AseWorldToObjectPosVarName + OutputId; + break; + } + case TransformSpaceTo.View: + { + result = string.Format( AseWorldToViewPosFormat, result ); + varName = AseWorldToViewPosVarName + OutputId; + break; + } + case TransformSpaceTo.Clip: + case TransformSpaceTo.Screen: + { + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BiRP ) + { + result = string.Format( AseSRPWorldToClipPosFormat, result ); + } + else + { + result = string.Format( AseWorldToClipPosFormat, result ); + } + + if ( to == TransformSpaceTo.Screen ) + { + if ( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + { + result = string.Format( AseHDRPToScreenFormat, result ); + } + else + { + result = string.Format( AseToScreenFormat, result ); + } + varName = AseWorldToScreenVarName + OutputId; + } + else // TransformSpaceTo.Clip + { + varName = AseWorldToClipPosVarName + OutputId; + } + break; + } + } + break; + } + case TransformSpaceFrom.View: + { + switch( to ) + { + default: + case TransformSpaceTo.View: + { + // no transform + break; + } + case TransformSpaceTo.Object: + { + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + result = string.Format( AseHDViewToObjectPosFormat, result ); + else + result = string.Format( AseViewToObjectPosFormat, result ); + varName = AseViewToObjectPosVarName + OutputId; + } + break; + case TransformSpaceTo.World: + { + result = string.Format( AseViewToWorldPosFormat, result ); + if( dataCollector.IsTemplate && + dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP && + m_absoluteWorldPos ) + { + result = string.Format( ASEHDAbsoluteWordPos , result ); + } + varName = AseViewToWorldPosVarName + OutputId; + break; + } + case TransformSpaceTo.Clip: + case TransformSpaceTo.Screen: + { + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BiRP ) + { + result = string.Format( AseSRPViewToClipPosFormat, result ); + } + else + { + result = string.Format( AseViewToClipPosFormat, result ); + } + + if ( to == TransformSpaceTo.Screen ) + { + if ( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + { + result = string.Format( AseHDRPToScreenFormat, result ); + } + else + { + result = string.Format( AseToScreenFormat, result ); + } + varName = AseViewToScreenVarName + OutputId; + } + else // TransformSpaceTo.Clip + { + varName = AseViewToClipPosVarName + OutputId; + } + break; + } + } + break; + } + default: + { + break; + } + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + GeneratorUtils.RegisterUnity2019MatrixDefines( ref dataCollector ); + + string result = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string varName = string.Empty; + + if( (int)m_from == (int)m_to ) + { + RegisterLocalVariable( 0, result, ref dataCollector ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + + switch( m_from ) + { + case TransformSpaceFrom.Object: + { + switch( m_to ) + { + default: + case TransformSpaceTo.Object: + { + // no transform + break; + } + case TransformSpaceTo.World: + case TransformSpaceTo.View: + case TransformSpaceTo.Clip: + case TransformSpaceTo.Screen: + { + CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + break; + } + case TransformSpaceTo.Tangent: + { + GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); + CalculateTransform( m_from, TransformSpaceTo.World, ref dataCollector, ref varName, ref result ); + result = string.Format( ASEWorldToTangentFormat, result ); + varName = AseObjectToTangentPosVarName + OutputId; + break; + } + } + } + break; + case TransformSpaceFrom.World: + { + switch( m_to ) + { + default: + case TransformSpaceTo.World: + { + // no transform + break; + } + case TransformSpaceTo.Object: + case TransformSpaceTo.View: + case TransformSpaceTo.Clip: + case TransformSpaceTo.Screen: + { + CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + break; + } + case TransformSpaceTo.Tangent: + { + GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); + result = string.Format( ASEWorldToTangentFormat, result ); + varName = AseWorldToTangentPosVarName + OutputId; + } + break; + } + break; + } + case TransformSpaceFrom.View: + { + switch( m_to ) + { + default: + case TransformSpaceTo.View: + { + // no transform + break; + } + case TransformSpaceTo.Object: + case TransformSpaceTo.World: + case TransformSpaceTo.Clip: + case TransformSpaceTo.Screen: + { + CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); + break; + } + case TransformSpaceTo.Tangent: + { + GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); + CalculateTransform( m_from, TransformSpaceTo.World, ref dataCollector, ref varName, ref result ); + result = string.Format( ASEWorldToTangentFormat, result ); + varName = AseViewToTangentPosVarName + OutputId; + } + break; + } + break; + } + case TransformSpaceFrom.Tangent: + { + string matrixVal = string.Empty; + if( m_inverseTangentType == InverseTangentType.Fast ) + matrixVal = GeneratorUtils.GenerateTangentToWorldMatrixFast( ref dataCollector, UniqueId, CurrentPrecisionType ); + else + matrixVal = GeneratorUtils.GenerateTangentToWorldMatrixPrecise( ref dataCollector, UniqueId, CurrentPrecisionType ); + + switch( m_to ) + { + default: + case TransformSpaceTo.Tangent: + { + // no transform + break; + } + case TransformSpaceTo.World: + { + result = string.Format( ASEMulOpFormat, matrixVal, result ); + varName = AseTangentToWorldVarName + OutputId; + break; + } + case TransformSpaceTo.Object: + case TransformSpaceTo.View: + case TransformSpaceTo.Clip: + case TransformSpaceTo.Screen: + { + result = string.Format( ASEMulOpFormat, matrixVal, result ); + CalculateTransform( TransformSpaceFrom.World, m_to, ref dataCollector, ref varName, ref result ); + + if ( m_to == TransformSpaceTo.Object ) + { + varName = AseTangentToObjectVarName + OutputId; + } + else if ( m_to == TransformSpaceTo.View ) + { + varName = AseTangentToViewVarName + OutputId; + } + else if ( m_to == TransformSpaceTo.Screen ) + { + varName = AseTangentToScreenVarName + OutputId; + } + else if ( m_to == TransformSpaceTo.Clip ) + { + varName = AseTangentToClipVarName + OutputId; + } + break; + } + } + break; + } + default: + { + break; + } + } + + if ( m_to == TransformSpaceTo.Clip || m_to == TransformSpaceTo.Screen ) + { + if ( m_perspectiveDivide || m_to == TransformSpaceTo.Screen ) + { + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, varName, result ); + result = string.Format( AseClipToNDC, varName, ( m_to == TransformSpaceTo.Screen ) ? ".xyz" : string.Empty ); + varName += "NDC"; + } + else if ( m_to != TransformSpaceTo.Clip ) + { + result += ".xyz"; + } + } + + RegisterLocalVariable( 0, result, ref dataCollector, varName ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + string from = GetCurrentParam( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() < 17500 && from.Equals( "Clip" ) ) + { + UIUtils.ShowMessage( UniqueId, "Clip Space no longer supported on From field over Transform Position node" ); + } + else + { + m_from = (TransformSpaceFrom)Enum.Parse( typeof( TransformSpaceFrom ), from ); + } + m_to = (TransformSpaceTo)Enum.Parse( typeof( TransformSpaceTo ), GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 15701 ) + { + m_perspectiveDivide = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + if( UIUtils.CurrentShaderVersion() > 15800 ) + { + m_inverseTangentType = (InverseTangentType)Enum.Parse( typeof( InverseTangentType ), GetCurrentParam( ref nodeParams ) ); + } + if( UIUtils.CurrentShaderVersion() > 16103 ) + { + m_absoluteWorldPos = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + UpdateSubtitle(); + UpdateOutputPort(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_from ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_to ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_perspectiveDivide ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_inverseTangentType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_absoluteWorldPos ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs.meta new file mode 100644 index 00000000..32065702 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 274dde08d42e4b041b9be7a22a8c09d6 +timeCreated: 1525857790 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs new file mode 100644 index 00000000..00dac829 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs @@ -0,0 +1,193 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + public enum BuiltInShaderTransformTypes + { + UNITY_MATRIX_MVP = 0, + UNITY_MATRIX_MV, + UNITY_MATRIX_V, + UNITY_MATRIX_P, + UNITY_MATRIX_VP, + UNITY_MATRIX_T_MV, + UNITY_MATRIX_IT_MV, + unity_ObjectToWorld, + unity_WorldToObject, + UNITY_MATRIX_I_V, + UNITY_MATRIX_I_P, + UNITY_MATRIX_I_VP, + UNITY_MATRIX_I_MVP + } + + [Serializable] + [NodeAttributes( "Common Transform Matrices", "Matrix Transform", "All Transformation types" )] + public sealed class TransformVariables : ShaderVariablesNode + { + [SerializeField] + private BuiltInShaderTransformTypes m_selectedType = BuiltInShaderTransformTypes.UNITY_MATRIX_MVP; + + private const string MatrixLabelStr = "Matrix"; + private readonly string[] ValuesStr = + { + "Model View Projection", + "Model View", + "View", + "Projection", + "View Projection", + "Transpose Model View", + "Inverse Transpose Model View", + "Object to World", + "Word to Object", + "Inverse View", + "Inverse Projection", + "Inverse View Projection", + "Inverse Model View Projection" + }; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, ValuesStr[ ( int ) m_selectedType ], WirePortDataType.FLOAT4x4 ); + m_textLabelWidth = 60; + m_hasLeftDropdown = true; + m_autoWrapProperties = true; + m_drawPreview = false; + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_selectedType = (BuiltInShaderTransformTypes)m_upperLeftWidget.DrawWidget( this, (int)m_selectedType, ValuesStr ); + if( EditorGUI.EndChangeCheck() ) + { + ChangeOutputName( 0, ValuesStr[ (int)m_selectedType ] ); + m_sizeIsDirty = true; + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_selectedType = ( BuiltInShaderTransformTypes ) EditorGUILayoutPopup( MatrixLabelStr, ( int ) m_selectedType, ValuesStr ); + if ( EditorGUI.EndChangeCheck() ) + { + ChangeOutputName( 0, ValuesStr[ ( int ) m_selectedType ] ); + m_sizeIsDirty = true; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + + if ( m_selectedType == BuiltInShaderTransformTypes.UNITY_MATRIX_I_P ) + { + return GeneratorUtils.GenerateInverseProjection( ref dataCollector, UniqueId, CurrentPrecisionType ); + } + else if ( m_selectedType == BuiltInShaderTransformTypes.UNITY_MATRIX_I_VP ) + { + return GeneratorUtils.GenerateInverseViewProjection( ref dataCollector, UniqueId, CurrentPrecisionType ); + } + else if ( m_selectedType == BuiltInShaderTransformTypes.UNITY_MATRIX_I_MVP ) + { + return GeneratorUtils.GenerateInverseModelViewProjection( ref dataCollector, UniqueId, CurrentPrecisionType ); + } + else + { + if ( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + switch ( m_selectedType ) + { + case BuiltInShaderTransformTypes.UNITY_MATRIX_MVP: + return "mul( GetWorldToHClipMatrix(), GetObjectToWorldMatrix() )"; + case BuiltInShaderTransformTypes.UNITY_MATRIX_I_MVP: + return "mul( GetWorldToObjectMatrix(), mul( GetViewToWorldMatrix(), UNITY_MATRIX_I_P ) )"; + case BuiltInShaderTransformTypes.UNITY_MATRIX_MV: + return "mul( GetWorldToViewMatrix(), GetObjectToWorldMatrix() )"; + case BuiltInShaderTransformTypes.UNITY_MATRIX_V: + return "GetWorldToViewMatrix()"; + case BuiltInShaderTransformTypes.UNITY_MATRIX_I_V: + return "GetViewToWorldMatrix()"; + case BuiltInShaderTransformTypes.UNITY_MATRIX_P: + return "GetViewToHClipMatrix()"; + case BuiltInShaderTransformTypes.UNITY_MATRIX_I_P: + return "UNITY_MATRIX_I_P"; + case BuiltInShaderTransformTypes.UNITY_MATRIX_VP: + return "GetWorldToHClipMatrix()"; + case BuiltInShaderTransformTypes.UNITY_MATRIX_I_VP: + return "mul( GetViewToWorldMatrix(), UNITY_MATRIX_I_P )"; + case BuiltInShaderTransformTypes.unity_ObjectToWorld: + return "GetObjectToWorldMatrix()"; + case BuiltInShaderTransformTypes.unity_WorldToObject: + return "GetWorldToObjectMatrix()"; + case BuiltInShaderTransformTypes.UNITY_MATRIX_T_MV: + case BuiltInShaderTransformTypes.UNITY_MATRIX_IT_MV: + default: + { + UIUtils.ShowMessage( UniqueId, "Matrix not declared natively on SRP. Must create it manually inside ASE" ); + return "float4x4(" + + "1,0,0,0," + + "0,1,0,0," + + "0,0,1,0," + + "0,0,0,1)"; + } + } + } + else + { + return m_selectedType.ToString(); + } + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + string selectedTypeStr = GetCurrentParam( ref nodeParams ); + try + { + BuiltInShaderTransformTypes selectedType = (BuiltInShaderTransformTypes)Enum.Parse( typeof( BuiltInShaderTransformTypes ), selectedTypeStr ); + m_selectedType = selectedType; + } + catch( Exception e ) + { + switch( selectedTypeStr ) + { + default: Debug.LogException( e );break; + case "UNITY_MATRIX_TEXTURE0":UIUtils.ShowMessage( UniqueId, "Texture 0 matrix is no longer supported",MessageSeverity.Warning);break; + case "UNITY_MATRIX_TEXTURE1":UIUtils.ShowMessage( UniqueId, "Texture 1 matrix is no longer supported",MessageSeverity.Warning);break; + case "UNITY_MATRIX_TEXTURE2":UIUtils.ShowMessage( UniqueId, "Texture 2 matrix is no longer supported",MessageSeverity.Warning);break; + case "UNITY_MATRIX_TEXTURE3":UIUtils.ShowMessage( UniqueId, "Texture 3 matrix is no longer supported",MessageSeverity.Warning); break; + case "unity_Scale": UIUtils.ShowMessage( UniqueId, "Scale matrix is no longer supported", MessageSeverity.Warning ); break; + } + } + + ChangeOutputName( 0, ValuesStr[ ( int ) m_selectedType ] ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedType ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs.meta new file mode 100644 index 00000000..f1533927 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 04aad5172ee1d4d4795e20bfae0ff64d +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs new file mode 100644 index 00000000..c7c46fe8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs @@ -0,0 +1,18 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Transpose Model View Matrix", "Matrix Transform", "Transpose of model * view matrix" )] + public sealed class TransposeMVMatrix : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "UNITY_MATRIX_T_MV"; + m_drawPreview = false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs.meta new file mode 100644 index 00000000..af9bcc54 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5762b195353d629448631bfb15fb8372 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs new file mode 100644 index 00000000..09325ec7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs @@ -0,0 +1,23 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Projector Clip Matrix", "Matrix Transform", "Current Projector Clip matrix. To be used when working with Unity projector." )] + public sealed class UnityProjectorClipMatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "unity_ProjectorClip"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + dataCollector.AddToUniforms( UniqueId, "float4x4 unity_ProjectorClip;" ); + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs.meta new file mode 100644 index 00000000..421aa44b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6095e3e4dc186f146bc109813901ccc8 +timeCreated: 1512062884 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs new file mode 100644 index 00000000..4cfb63c8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs @@ -0,0 +1,23 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Projector Matrix", "Matrix Transform", "Current Projector Clip matrix. To be used when working with Unity projector." )] + public sealed class UnityProjectorMatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "unity_Projector"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + dataCollector.AddToUniforms( UniqueId, "float4x4 unity_Projector;" ); + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs.meta new file mode 100644 index 00000000..21d95d78 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c3efd02b48473d94b92302654b671ddc +timeCreated: 1512062884 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs new file mode 100644 index 00000000..2d2f00c9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs @@ -0,0 +1,18 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Scale Matrix", "Matrix Transform", "Scale Matrix",null, UnityEngine.KeyCode.None, true, true, "Object Scale" )] + public sealed class UnityScaleMatrix : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "unity_Scale"; + m_drawPreview = false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs.meta new file mode 100644 index 00000000..40ca9d94 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 28a04286716e19f4aa58954888374428 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs new file mode 100644 index 00000000..2291bc32 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs @@ -0,0 +1,19 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "View Matrix", "Matrix Transform", "Current view matrix" )] + public sealed class ViewMatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "UNITY_MATRIX_V"; + m_drawPreview = false; + m_matrixId = 0; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs.meta new file mode 100644 index 00000000..46a1ece3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5aa75cc5e6044a44a9a4439eac1d948b +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs new file mode 100644 index 00000000..23e53e40 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs @@ -0,0 +1,18 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "View Projection Matrix", "Matrix Transform", "Current view * projection matrix." )] + public sealed class ViewProjectionMatrixNode : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "UNITY_MATRIX_VP"; + m_drawPreview = false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs.meta new file mode 100644 index 00000000..a1899f67 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: fe26c99932382e047aebc05b7e67a3d0 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs new file mode 100644 index 00000000..65d9e082 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs @@ -0,0 +1,23 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "World To Camera Matrix", "Matrix Transform", "Inverse of current camera to world matrix" )] + public sealed class WorldToCameraMatrix : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "unity_WorldToCamera"; + m_drawPreview = false; + } + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + GeneratorUtils.RegisterUnity2019MatrixDefines( ref dataCollector ); + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs.meta new file mode 100644 index 00000000..9a12b9c8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 584bea5554dc1b64c8965d8fcfc54e23 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs new file mode 100644 index 00000000..17c0119e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs @@ -0,0 +1,20 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "World To Object Matrix", "Matrix Transform", "Inverse of current world matrix" )] + public sealed class WorldToObjectMatrix : ConstantShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); + m_value = "unity_WorldToObject"; + m_valueHDRP = "GetWorldToObjectMatrix()"; + m_valueURP = "GetWorldToObjectMatrix()"; + m_drawPreview = false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs.meta new file mode 100644 index 00000000..6583e3c1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d9e2a5077cc29de439d5c845eac35a04 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs new file mode 100644 index 00000000..9ad7e5c7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs @@ -0,0 +1,47 @@ +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "World To Tangent Matrix", "Matrix Transform", "World to tangent transform matrix" )] + public sealed class WorldToTangentMatrix : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.FLOAT3x3, "Out" ); + //UIUtils.AddNormalDependentCount(); + m_drawPreview = false; + } + + //public override void Destroy() + //{ + // ContainerGraph.RemoveNormalDependentCount(); + // base.Destroy(); + //} + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + dataCollector.DirtyNormal = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if( dataCollector.IsTemplate ) + return dataCollector.TemplateDataCollectorInstance.GetWorldToTangentMatrix( CurrentPrecisionType ); + + if( dataCollector.IsFragmentCategory ) + { + dataCollector.ForceNormal = true; + + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + } + + GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); + + return GeneratorUtils.WorldToTangentStr; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs.meta new file mode 100644 index 00000000..c0d685db --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b598d9ebc2d7be44a97270732f55f9bc +timeCreated: 1484747592 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various.meta new file mode 100644 index 00000000..89ede46c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5bbb49ec7f4a3524d9950847c88d4afc +folderAsset: yes +timeCreated: 1481126946 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs new file mode 100644 index 00000000..231a0111 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs @@ -0,0 +1,37 @@ +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Color Space Double", "Miscellaneous", "Color Space Double" )] + public class ColorSpaceDouble : ParentNode + { + private const string ColorSpaceDoubleStr = "unity_ColorSpaceDouble"; + + private readonly string[] ColorSpaceDoubleDef = + { + "#ifdef UNITY_COLORSPACE_GAMMA//ASE Color Space Def", + "#define unity_ColorSpaceDouble half4(2.0, 2.0, 2.0, 2.0)//ASE Color Space Def", + "#else // Linear values//ASE Color Space Def", + "#define unity_ColorSpaceDouble half4(4.59479380, 4.59479380, 4.59479380, 2.0)//ASE Color Space Def", + "#endif//ASE Color Space Def" + }; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputColorPorts( "RGBA" ); + m_previewShaderGUID = "ac680a8772bb97c46851a7f075fd04e3"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + for( int i = 0; i < ColorSpaceDoubleDef.Length; i++ ) + { + dataCollector.AddToDirectives( ColorSpaceDoubleDef[ i ], -1 ); + } + } + return GetOutputVectorItem( 0, outputId, ColorSpaceDoubleStr ); ; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs.meta new file mode 100644 index 00000000..3414df1e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7d1204234983b3c4499da752961185be +timeCreated: 1481888315 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs new file mode 100644 index 00000000..5a0d4622 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs @@ -0,0 +1,64 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Face", "Primitive", "Indicates whether the rendered surface is facing the camera (1), or facing away from the camera (0)" )] + public class FaceVariableNode : ParentNode + { + public const string FaceOnVertexWarning = "Face type nodes generates extra instructions when used on vertex ports since it needs to manually calculate the value"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.FLOAT, "Out" ); + m_previewShaderGUID = "4b0b5b9f16353b840a5f5ad2baab3c3c"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " node does not work on Tessellation port" ); + return m_outputPorts[0].ErrorValue; + } + + if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) + { + if( dataCollector.TesselationActive ) + { + UIUtils.ShowMessage( UniqueId , m_nodeAttribs.Name + " node does not work properly on Tessellation ports" ); + return m_outputPorts[ 0 ].ErrorValue; + } + else + { + UIUtils.ShowMessage( UniqueId , FaceOnVertexWarning, MessageSeverity.Warning ); + string faceVariable = GeneratorUtils.GenerateVertexFace( ref dataCollector , UniqueId ); + return faceVariable; + } + } + + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetVFace( UniqueId ); + } + else + { + if ( dataCollector.CurrentCanvasMode == NodeAvailability.TemplateShader ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.FRONT_FACING ); + } + else + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.FRONT_FACING_VFACE ); + } + + string variable = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) ? Constants.VertexShaderOutputStr : Constants.InputVarStr; + return variable + "." + Constants.IsFrontFacingVariable; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs.meta new file mode 100644 index 00000000..f0deddac --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4b4a6f07436b05a4cbc2559e4e704000 +timeCreated: 1492513159 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs new file mode 100644 index 00000000..dc5da478 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs @@ -0,0 +1,137 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Instance ID", "Vertex Data", "Indicates the per-instance identifier" )] + public class InstanceIdNode : ParentNode + { + private readonly string[] InstancingVariableAttrib = + { "uint currInstanceId = 0;", + "#if defined(UNITY_INSTANCING_ENABLED) || defined(UNITY_PROCEDURAL_INSTANCING_ENABLED)", + "currInstanceId = unity_InstanceID;", + "#endif" + }; + + private const string InstanceIdRegistry = "uint {0} : SV_InstanceID;"; + + private const string TemplateSVInstanceIdVar = "instanceID"; + private const string InstancingInnerVariable = "currInstanceId"; + private bool m_useSVSemantic = false; + private bool m_procedural = false; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.INT, "Out" ); + m_previewShaderGUID = "03febce56a8cf354b90e7d5180c1dbd7"; + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + m_autoWrapProperties = !m_containerGraph.IsStandardSurface; + } + + public override void DrawProperties() + { + base.DrawProperties(); + + if( !m_containerGraph.IsStandardSurface ) + { + m_useSVSemantic = EditorGUILayoutToggle( "Use SV semantic" , m_useSVSemantic ); + } + + m_procedural = EditorGUILayoutToggle( "Procedural", m_procedural ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " does not work on Tessellation port" ); + return m_outputPorts[ 0 ].ErrorValue; + } + + if ( m_procedural ) + { + if ( dataCollector.IsSRP && ( dataCollector.CurrentPassName.Contains( "Forward" ) || dataCollector.CurrentPassName.Contains( "GBuffer" ) ) ) + { + dataCollector.AddToPragmas( UniqueId, "instancing_options renderinglayer procedural:ASEProceduralSetup" ); + } + else + { + dataCollector.AddToPragmas( UniqueId, "instancing_options procedural:ASEProceduralSetup" ); + } + dataCollector.AddToPragmas( UniqueId, "multi_compile_instancing" ); + dataCollector.AddFunction( "ASEProceduralSetup()", "void ASEProceduralSetup() { }" ); + } + + if ( dataCollector.IsTemplate ) + { + dataCollector.TemplateDataCollectorInstance.SetupInstancing(); + if ( m_useSVSemantic ) + { + return dataCollector.TemplateDataCollectorInstance.GetInstanceId(); + } + } + else + { + string name = TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.SV_InstanceID ]; + if ( dataCollector.IsFragmentCategory ) + { + GenerateValueInVertex( ref dataCollector, WirePortDataType.UINT, Constants.VertexShaderInputStr + "." + name, name, true ); + return Constants.InputVarStr + "." + name; + } + else + { + return Constants.VertexShaderInputStr + "." + name; + } + } + + if( !dataCollector.HasLocalVariable( InstancingVariableAttrib[ 0 ] ) ) + { + dataCollector.AddLocalVariable( UniqueId, InstancingVariableAttrib[ 0 ] ,true ); + dataCollector.AddLocalVariable( UniqueId, InstancingVariableAttrib[ 1 ] ,true ); + dataCollector.AddLocalVariable( UniqueId, InstancingVariableAttrib[ 2 ] ,true ); + dataCollector.AddLocalVariable( UniqueId, InstancingVariableAttrib[ 3 ] ,true ); + } + return InstancingInnerVariable; + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + if ( !dataCollector.IsTemplate ) + { + string name = TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.SV_InstanceID ]; + dataCollector.AddCustomAppData( string.Format( InstanceIdRegistry, name ) ); + } + + base.PropagateNodeData( nodeData, ref dataCollector ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 18915 ) + { + m_useSVSemantic = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + if ( UIUtils.CurrentShaderVersion() >= 19500 ) + { + m_procedural = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo , ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo , ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_useSVSemantic ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_procedural ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs.meta new file mode 100644 index 00000000..c6fd1568 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c449923583a9fbe4283acebc97756ea1 +timeCreated: 1547811127 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs new file mode 100644 index 00000000..4163dac4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs @@ -0,0 +1,101 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "LOD Fade", "Miscellaneous", "LODFadeNode" )] + public sealed class LODFadeNode : ConstVecShaderVariable + { + [SerializeField] + private bool m_legacyBehavior = false; + + private const string LegacyVarName = "legacyFadeVal"; + private const string LegacyVarValue = "(( unity_LODFade.x < 0 ) ? ( 1 + unity_LODFade.x ) : ( unity_LODFade.x ))"; + + private const string LegacyVarLabel = "Legacy Behavior"; + private const string LegacyVarInfo = "Prior to Unity 2019 values given by unity_LODFade.x/Fade[0...1] port were always positive and complemented each other between LOD Groups.\n" + + "Now fade-out is represented with positive values and fade-in with negative ones.\n"+ + "Toggling Legacy Behavior on internally checks for negative values and calculate complement result."; + + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputName( 1, "Fade[0...1]" ); + ChangeOutputName( 2, "Fade[16Lvl]" ); + ChangeOutputName( 3, "Unused" ); + ChangeOutputName( 4, "Unused" ); + m_value = "unity_LODFade"; + m_previewShaderGUID = "fcd4d93f57ffc51458d4ade10df2fdb4"; + m_autoWrapProperties = true; + } + + public override string GenerateShaderForOutput( int outputId , ref MasterNodeDataCollector dataCollector , bool ignoreLocalvar ) + { + string result = base.GenerateShaderForOutput( outputId , ref dataCollector , ignoreLocalvar ); + if( m_legacyBehavior && outputId == 1) + { + if( m_outputPorts[ 1 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 1 ].LocalValue( dataCollector.PortCategory ); + + dataCollector.AddLocalVariable( UniqueId , PrecisionType.Float , WirePortDataType.FLOAT , LegacyVarName , LegacyVarValue ); + m_outputPorts[ 1 ].SetLocalValue( LegacyVarName , dataCollector.PortCategory ); + + return m_outputPorts[ 1 ].LocalValue( dataCollector.PortCategory ); + } + else + { + return result; + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + m_legacyBehavior = EditorGUILayoutToggle( LegacyVarLabel , m_legacyBehavior ); + EditorGUILayout.HelpBox( LegacyVarInfo , MessageType.Info ); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( !m_outputPorts[ 0 ].IsConnected ) + { + m_outputPorts[ 0 ].Visible = false; + m_sizeIsDirty = true; + } + + if( !m_outputPorts[ 3 ].IsConnected ) + { + m_outputPorts[ 3 ].Visible = false; + m_sizeIsDirty = true; + } + + if( !m_outputPorts[ 4 ].IsConnected ) + { + m_outputPorts[ 4 ].Visible = false; + m_sizeIsDirty = true; + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 18902 ) + { + m_legacyBehavior = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo , ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo , ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_legacyBehavior ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs.meta new file mode 100644 index 00000000..3f1a0d58 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f96cf34c2936c96458403e9cf75e8e10 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs new file mode 100644 index 00000000..6362498a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs @@ -0,0 +1,36 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Primitive ID", "Vertex Data", "Per-primitive identifier automatically generated by the runtime" )] + public class PrimitiveIDVariableNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.INT, "Out" ); + m_previewShaderGUID = "92c1b588d7658594cb219696f593f64b"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( !dataCollector.IsTemplate ) + { + UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " is not supported on surface shaders." ); + return m_outputPorts[0].ErrorValue; + } + + if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) + { + UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " is not supported on Vertex ports" ); + return m_outputPorts[0].ErrorValue; + } + + return dataCollector.TemplateDataCollectorInstance.GetPrimitiveId(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs.meta new file mode 100644 index 00000000..1aca3755 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: dd0af9fbbba750341a7b09316178f285 +timeCreated: 1492513159 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs new file mode 100644 index 00000000..75e0971b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs @@ -0,0 +1,88 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Switch by Face", "Miscellaneous", "Switch which automaticaly uses a Face variable to select which input to use" )] + public class SwitchByFaceNode : DynamicTypeNode + { + private const string SwitchOp = "((({0}>0)?({1}):({2})))"; + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 0 ].Name = "Front"; + m_inputPorts[ 1 ].Name = "Back"; + m_textLabelWidth = 50; + m_previewShaderGUID = "f4edf6febb54dc743b25bd5b56facea8"; + } + + + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " does not work on Tessellation port" ); + return GenerateErrorValue(); + } + + if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) + { + if ( dataCollector.TesselationActive ) + { + UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " does not work properly on Vertex/Tessellation ports" ); + return GenerateErrorValue(); + } + else + { + UIUtils.ShowMessage( UniqueId , FaceVariableNode.FaceOnVertexWarning , MessageSeverity.Warning ); + string faceVariable = GeneratorUtils.GenerateVertexFace( ref dataCollector , UniqueId ); + + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string frontValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string backValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + string finalResult = string.Format( SwitchOp , faceVariable , frontValue , backValue ); + RegisterLocalVariable( 0 , finalResult , ref dataCollector , "switchResult" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } + + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string front = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string back = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + if ( dataCollector.CurrentCanvasMode == NodeAvailability.TemplateShader ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.FRONT_FACING ); + } + else + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.FRONT_FACING_VFACE ); + } + + string variable = string.Empty; + if ( dataCollector.IsTemplate ) + { + variable = dataCollector.TemplateDataCollectorInstance.GetVFace( UniqueId ); + } + else + { + variable = ( ( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) ? Constants.VertexShaderOutputStr : Constants.InputVarStr ) + "." + Constants.IsFrontFacingVariable; + } + + string value = string.Format( SwitchOp, variable, front, back ); + RegisterLocalVariable( 0, value, ref dataCollector, "switchResult" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs.meta new file mode 100644 index 00000000..4c81de77 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b0464d8b27caa7d4d8fa5d1828934da8 +timeCreated: 1492515561 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchBySRPVersionNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchBySRPVersionNode.cs new file mode 100644 index 00000000..73372b84 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchBySRPVersionNode.cs @@ -0,0 +1,127 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Switch by SRP Version", "Miscellaneous", "Switch between different inputs based on the currently installed SRP version" )] + public class SwitchBySRPVersionNode : ParentNode + { + private static readonly Tuple[] SRPVersionList = new Tuple[] + { + new Tuple( "None", -1 ), + new Tuple( "10.x", 100000 ), + new Tuple( "11.x", 110000 ), + new Tuple( "12.x", 120000 ), + new Tuple( "13.x", 130000 ), + new Tuple( "14.x", 140000 ), + new Tuple( "15.x", 150000 ), + new Tuple( "16.x", 160000 ), + new Tuple( "17.x", 170000 ) + }; + + private static readonly string[] SRPTypeNames = + { + "Built-in", + "High Definition", + "Universal" + }; + + private static readonly int m_conditionId = Shader.PropertyToID( "_Condition" ); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + + foreach ( var item in SRPVersionList ) + { + AddInputPort( WirePortDataType.FLOAT, false, item.Item1 ); + } + + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + + m_textLabelWidth = 50; + m_previewShaderGUID = "63c0b9ddc2c9d0c4b871af8347b2d5c9"; + + UpdateConnections(); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + GetInputPortByUniqueId( portId ).MatchPortToConnection(); + UpdateConnections(); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + GetInputPortByUniqueId( portId ).MatchPortToConnection(); + UpdateConnections(); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + GetInputPortByUniqueId( outputPortId ).MatchPortToConnection(); + UpdateConnections(); + } + + public override void OnMasterNodeReplaced( MasterNode newMasterNode ) + { + base.OnMasterNodeReplaced( newMasterNode ); + UpdateConnections(); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + UpdateConnections(); + } + + private int GetActivePortArrayId() + { + if ( ContainerGraph != null ) + { + int srpVersion = ASEPackageManagerHelper.CurrentSRPVersion; + for ( int i = SRPVersionList.Length - 1; i >= 0; i-- ) + { + if ( srpVersion > SRPVersionList[ i ].Item2 ) + { + return i; + } + } + + } + return 0; + } + + private void UpdateConnections() + { + int activePortIndex = GetActivePortArrayId(); + InputPort activePort = GetInputPortByArrayId( activePortIndex ); + m_outputPorts[ 0 ].ChangeTypeWithRestrictions( activePort.DataType, FunctionInput.PortCreateRestriction( activePort.DataType ) ); + + string srpTypeName = ( ContainerGraph != null ) ? SRPTypeNames[ ( int )ContainerGraph.CurrentSRPType ] : "Unknown"; + SetAdditonalTitleText( string.Format( Constants.SubTitleCurrentFormatStr, srpTypeName + ", " + SRPVersionList[ activePortIndex ].Item1 ) ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + InputPort port = GetInputPortByArrayId( GetActivePortArrayId() ); + m_outputPorts[ 0 ].ChangeType( port.DataType, false ); + return port.GeneratePortInstructions( ref dataCollector ); + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + PreviewMaterial.SetInt( m_conditionId, GetActivePortArrayId() ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchBySRPVersionNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchBySRPVersionNode.cs.meta new file mode 100644 index 00000000..c07a8b87 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchBySRPVersionNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 72ff5c2a7e57017478e8d704282730f1 +timeCreated: 1492515561 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchBySRPVersionNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/TwoSidedSignNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/TwoSidedSignNode.cs new file mode 100644 index 00000000..a0588673 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/TwoSidedSignNode.cs @@ -0,0 +1,66 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Two Sided Sign", "Primitive", "Indicates whether the rendered surface is facing the camera (1), or facing away from the camera(-1)" )] + public class TwoSidedSign : ParentNode + { + public const string FaceOnVertexWarning = "Face type nodes generates extra instructions when used on vertex ports since it needs to manually calculate the value"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.FLOAT, "Out" ); + m_previewShaderGUID = "42ebc30515b5460499b689a1dc3308f3"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " node does not work on Tessellation port" ); + return m_outputPorts[0].ErrorValue; + } + + if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) + { + if( dataCollector.TesselationActive ) + { + UIUtils.ShowMessage( UniqueId , m_nodeAttribs.Name + " node does not work properly on Tessellation ports" ); + return m_outputPorts[ 0 ].ErrorValue; + } + else + { + UIUtils.ShowMessage( UniqueId , FaceOnVertexWarning, MessageSeverity.Warning ); + string faceVariable = GeneratorUtils.GenerateVertexFace( ref dataCollector , UniqueId ); + return faceVariable; + } + } + + string variable; + if ( dataCollector.IsTemplate ) + { + variable = dataCollector.TemplateDataCollectorInstance.GetVFace( UniqueId ); + } + else + { + if ( dataCollector.CurrentCanvasMode == NodeAvailability.TemplateShader ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.FRONT_FACING ); + } + else + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.FRONT_FACING_VFACE ); + } + + variable = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) ? Constants.VertexShaderOutputStr : Constants.InputVarStr; + variable = string.Format( "{0}.{1}", variable, Constants.IsFrontFacingVariable ); + } + return string.Format( "( {0} > 0 ? +1 : -1 )", variable ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/TwoSidedSignNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/TwoSidedSignNode.cs.meta new file mode 100644 index 00000000..02a73512 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/TwoSidedSignNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 119514e4302a18345ab7c227e052b0bc +timeCreated: 1492513159 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/TwoSidedSignNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs new file mode 100644 index 00000000..1c57d42e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs @@ -0,0 +1,58 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Vertex ID", "Vertex Data", "Indicates current vertex number" )] + public class VertexIdVariableNode : ParentNode + { + private const string VertexIdRegistry = "uint {0} : SV_VertexID;"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.INT, "Out" ); + m_previewShaderGUID = "5934bf2c10b127a459177a3b622cea65"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " does not work on Tessellation port" ); + return m_outputPorts[0].ErrorValue; + } + + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetVertexId(); + } + else + { + string name = TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.SV_VertexID ]; + if ( dataCollector.IsFragmentCategory ) + { + GenerateValueInVertex( ref dataCollector, WirePortDataType.UINT, Constants.VertexShaderInputStr + "." + name, name, true ); + return Constants.InputVarStr + "." + name; + } + else + { + return Constants.VertexShaderInputStr + "." + name; + } + } + } + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + if( !dataCollector.IsTemplate ) + { + string name = TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.SV_VertexID ]; + dataCollector.AddCustomAppData( string.Format( VertexIdRegistry, name ) ); + } + + base.PropagateNodeData( nodeData, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs.meta new file mode 100644 index 00000000..5c4554fc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ce37a30cae7677942ad44f0945ab7b77 +timeCreated: 1492513159 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs new file mode 100644 index 00000000..49966a09 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs @@ -0,0 +1,32 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "World Transform Params", "Object Transform", "World Transform Params contains information about the transform, W is usually 1.0, or -1.0 for odd-negative scale transforms" )] + public sealed class WorldTransformParams : ConstVecShaderVariable + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeOutputName( 1, "X" ); + ChangeOutputName( 2, "Y" ); + ChangeOutputName( 3, "Z" ); + ChangeOutputName( 4, "W" ); + m_value = "unity_WorldTransformParams"; + m_previewShaderGUID = "5a2642605f085da458d6e03ade47b87a"; + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( !m_outputPorts[ 0 ].IsConnected ) + { + m_outputPorts[ 0 ].Visible = false; + m_sizeIsDirty = true; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs.meta new file mode 100644 index 00000000..2ff90f4b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: aec376443deca354789bc36ba18af898 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs new file mode 100644 index 00000000..3af3faf5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs @@ -0,0 +1,1391 @@ +// Amplify Shader Editor - Visual Shader vEditing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Switch", "Logical Operators", "Creates a shader keyword toggle", Available = true )] + public sealed class StaticSwitch : PropertyNode + { + public enum ShaderStage + { + All, + Vertex, + Fragment, + Hull, + Domain, + Geometry, + Raytracing + }; + + private float InstanceIconWidth = 19; + private float InstanceIconHeight = 19; + private readonly Color ReferenceHeaderColor = new Color( 0f, 0.5f, 0.585f, 1.0f ); + + [SerializeField] + private int m_defaultValue = 0; + + [SerializeField] + private int m_materialValue = 0; + + [SerializeField] + private int m_multiCompile = 0; + + [SerializeField] + private int m_currentKeywordId = 0; + + [SerializeField] + private string m_currentKeyword = string.Empty; + + [SerializeField] + private bool m_createToggle = true; + + [SerializeField] + private bool m_lockKeyword = true; + + private const string IsLocalStr = "Is Local"; + private const string StageStr = "Stage"; + + [SerializeField] + private bool m_isLocal = true; + + [SerializeField] + private ShaderStage m_shaderStage = ShaderStage.All; + + + private GUIContent m_checkContent; + private GUIContent m_popContent; + + private int m_conditionId = -1; + + private const int MinComboSize = 50; + private const int MaxComboSize = 105; + + private Rect m_varRect; + private Rect m_imgRect; + private bool m_editing; + + public enum KeywordModeType + { + Toggle = 0, + ToggleOff = 1, + KeywordEnum = 2, + } + + public enum StaticSwitchVariableMode + { + Create = 0, + Fetch = 1, + Reference = 2 + } + + public enum KeywordType + { + ShaderFeature = 0, + MultiCompile = 1, + DynamicBranch = 2, + } + + [SerializeField] + private KeywordModeType m_keywordModeType = KeywordModeType.Toggle; + + [SerializeField] + private StaticSwitch m_reference = null; + + private const string StaticSwitchStr = "Switch"; + private const string MaterialToggleStr = "Material Toggle"; + + private const string ToggleMaterialValueStr = "Material Value"; + private const string ToggleDefaultValueStr = "Default Value"; + + private const string AmountStr = "Amount"; + private const string KeywordStr = "Keyword"; + private const string CustomStr = "Custom"; + private const string ToggleTypeStr = "Toggle Type"; + private const string TypeStr = "Type"; + private const string ModeStr = "Mode"; + private const string KeywordTypeStr = "Keyword Type"; + + private const string KeywordNameStr = "Keyword Name"; + public readonly static string[] KeywordTypeList = { "Shader Feature", "Multi Compile", "Dynamic Branch" }; + public readonly static int[] KeywordTypeInt = { ( int )KeywordType.ShaderFeature, ( int )KeywordType.MultiCompile, ( int )KeywordType.DynamicBranch }; + + [SerializeField] + private string[] m_defaultKeywordNames = { "Key0", "Key1", "Key2", "Key3", "Key4", "Key5", "Key6", "Key7", "Key8" }; + + [SerializeField] + private string[] m_keywordEnumList = { "Key0", "Key1" }; + + [SerializeField] + private StaticSwitchVariableMode m_staticSwitchVarMode = StaticSwitchVariableMode.Create; + + [SerializeField] + private int m_referenceArrayId = -1; + + [SerializeField] + private int m_referenceNodeId = -1; + + private int m_keywordEnumAmount = 2; + + private bool m_isStaticSwitchDirty = false; + + private Rect m_iconPos; + + public const string DynamicBranchErrorMsg = "dynamic_branch requires Unity 2022.1+"; + public const string KeywordModifierSurfaceWarning = "Keyword stage ignored in Surface Shaders due to Unity bug."; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + AddInputPort( WirePortDataType.FLOAT, false, "False", -1, MasterNodePortCategory.Fragment, 1 ); + AddInputPort( WirePortDataType.FLOAT, false, "True", -1, MasterNodePortCategory.Fragment, 0 ); + for( int i = 2; i < 9; i++ ) + { + AddInputPort( WirePortDataType.FLOAT, false, m_defaultKeywordNames[ i ] ); + m_inputPorts[ i ].Visible = false; + } + m_headerColor = new Color( 0.0f, 0.55f, 0.45f, 1f ); + m_customPrefix = KeywordStr + " "; + m_autoWrapProperties = false; + m_freeType = false; + m_useVarSubtitle = true; + m_allowPropertyDuplicates = true; + m_showTitleWhenNotEditing = false; + m_currentParameterType = PropertyType.Property; + + m_checkContent = new GUIContent(); + m_checkContent.image = UIUtils.CheckmarkIcon; + + m_popContent = new GUIContent(); + m_popContent.image = UIUtils.PopupIcon; + + m_previewShaderGUID = "0b708c11c68e6a9478ac97fe3643eab1"; + m_showAutoRegisterUI = true; + + m_errorMessageTooltip = DynamicBranchErrorMsg; + m_errorMessageTypeIsError = NodeMessageType.Error; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_conditionId == -1 ) + m_conditionId = Shader.PropertyToID( "_Condition" ); + + StaticSwitch node = ( m_staticSwitchVarMode == StaticSwitchVariableMode.Reference && m_reference != null ) ? m_reference : this; + + if ( m_createToggle && m_materialMode ) + PreviewMaterial.SetInt( m_conditionId, node.MaterialValue ); + else + PreviewMaterial.SetInt( m_conditionId, node.DefaultValue ); + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + + if( m_createToggle ) + UIUtils.RegisterPropertyNode( this ); + else + UIUtils.UnregisterPropertyNode( this ); + + if( CurrentVarMode != StaticSwitchVariableMode.Reference ) + { + ContainerGraph.StaticSwitchNodes.AddNode( this ); + } + + if( UniqueId > -1 ) + ContainerGraph.StaticSwitchNodes.OnReorderEventComplete += OnReorderEventComplete; + } + + public override void Destroy() + { + base.Destroy(); + UIUtils.UnregisterPropertyNode( this ); + if( CurrentVarMode != StaticSwitchVariableMode.Reference ) + { + ContainerGraph.StaticSwitchNodes.RemoveNode( this ); + } + + if( UniqueId > -1 ) + ContainerGraph.StaticSwitchNodes.OnReorderEventComplete -= OnReorderEventComplete; + } + + void OnReorderEventComplete() + { + if( CurrentVarMode == StaticSwitchVariableMode.Reference ) + { + if( m_reference != null ) + { + m_referenceArrayId = ContainerGraph.StaticSwitchNodes.GetNodeRegisterIdx( m_reference.UniqueId ); + } + } + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnections(); + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); + UpdateConnections(); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + UpdateConnections(); + } + + private void UpdateConnections() + { + WirePortDataType mainType = WirePortDataType.FLOAT; + + int highest = UIUtils.GetPriority( mainType ); + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + WirePortDataType portType = m_inputPorts[ i ].GetOutputConnection().DataType; + if( UIUtils.GetPriority( portType ) > highest ) + { + mainType = portType; + highest = UIUtils.GetPriority( portType ); + } + } + } + + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + m_inputPorts[ i ].ChangeType( mainType, false ); + } + + m_outputPorts[ 0 ].ChangeType( mainType, false ); + } + + public override string GetPropertyValue() + { + if( m_createToggle ) + { + string value = UIUtils.PropertyFloatToString( m_defaultValue ); + if ( m_keywordModeType == KeywordModeType.KeywordEnum && m_keywordEnumAmount > 0 ) + { + return PropertyAttributes + "[" + m_keywordModeType.ToString() + "(" + GetKeywordEnumPropertyList() + ")] " + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + value; + } + else + { + return PropertyAttributes + "[" + m_keywordModeType.ToString() + "(" + GetPropertyValStr() + ")] " + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + value; + } + } + return string.Empty; + } + + public string KeywordEnum( int index ) + { + if( m_createToggle ) + { + return string.IsNullOrEmpty( PropertyName ) ? KeywordEnumList( index ) : ( PropertyName + "_" + KeywordEnumList( index ) ); + } + else + { + return string.IsNullOrEmpty( PropertyName ) ? KeywordEnumList( index ) : ( PropertyName + KeywordEnumList( index ) ); + } + } + + public string KeywordEnumList( int index ) + { + if( CurrentVarMode == StaticSwitchVariableMode.Fetch ) + return m_keywordEnumList[ index ]; + else + { + return m_createToggle ? m_keywordEnumList[ index ].ToUpper() : m_keywordEnumList[ index ]; + } + + } + public override string PropertyName + { + get + { + if( CurrentVarMode == StaticSwitchVariableMode.Fetch ) + return m_currentKeyword; + else + { + return m_createToggle ? base.PropertyName.ToUpper() : base.PropertyName; + } + } + } + + public override string GetPropertyValStr() + { + if ( m_keywordModeType == KeywordModeType.KeywordEnum ) + return PropertyName; + else if( !m_lockKeyword ) + return CurrentKeyword; + else if( CurrentVarMode == StaticSwitchVariableMode.Fetch ) + return m_currentKeyword; + else + return PropertyName + OnOffStr; + } + + public override string GetSubTitleVarNameFormatStr() + { + if ( m_multiCompile == ( int )KeywordType.DynamicBranch ) + { + return "Dynamic( {0} )"; + } + else + { + return "Static( {0} )"; + } + } + + private string GetKeywordEnumPropertyList() + { + string result = string.Empty; + for( int i = 0; i < m_keywordEnumList.Length; i++ ) + { + if( i == 0 ) + result = m_keywordEnumList[ i ]; + else + result += "," + m_keywordEnumList[ i ]; + } + return result; + } + + private string GetKeywordEnumPragmaList() + { + string result = string.Empty; + for( int i = 0; i < m_keywordEnumList.Length; i++ ) + { + if( i == 0 ) + result = KeywordEnum( i ); + else + result += " " + KeywordEnum( i ); + } + return result; + } + + public override string GetUniformValue() + { + return string.Empty; + } + + public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) + { + dataType = string.Empty; + dataName = string.Empty; + return false; + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + + m_showErrorMessage = ( m_multiCompile == ( int )KeywordType.DynamicBranch && TemplateHelperFunctions.GetUnityVersion() < 20220100 ); + } + + public override void DrawProperties() + { + //base.DrawProperties(); + NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, PropertyGroup ); + NodeUtils.DrawPropertyGroup( ref m_visibleCustomAttrFoldout, CustomAttrStr, DrawCustomAttributes, DrawCustomAttrAddRemoveButtons ); + CheckPropertyFromInspector(); + } + + void DrawEnumList() + { + EditorGUI.BeginChangeCheck(); + KeywordEnumAmount = EditorGUILayoutIntSlider( AmountStr, KeywordEnumAmount, 2, 9 ); + if( EditorGUI.EndChangeCheck() ) + { + CurrentSelectedInput = Mathf.Clamp( CurrentSelectedInput, 0, KeywordEnumAmount - 1 ); + UpdateLabels(); + } + EditorGUI.indentLevel++; + for( int i = 0; i < m_keywordEnumList.Length; i++ ) + { + EditorGUI.BeginChangeCheck(); + m_keywordEnumList[ i ] = EditorGUILayoutTextField( "Item " + i, m_keywordEnumList[ i ] ); + if( EditorGUI.EndChangeCheck() ) + { + m_keywordEnumList[ i ] = UIUtils.RemoveInvalidEnumCharacters( m_keywordEnumList[ i ] ); + m_keywordEnumList[ i ] = m_keywordEnumList[ i ].Replace( " ", "" ); // sad face :( does not support spaces + m_inputPorts[ i ].Name = m_keywordEnumList[ i ]; + m_defaultKeywordNames[ i ] = m_inputPorts[ i ].Name; + } + } + EditorGUI.indentLevel--; + } + + public void UpdateLabels() + { + int maxinputs = m_keywordModeType == KeywordModeType.KeywordEnum ? KeywordEnumAmount : 2; + KeywordEnumAmount = Mathf.Clamp( KeywordEnumAmount, 0, maxinputs ); + m_keywordEnumList = new string[ maxinputs ]; + + for( int i = 0; i < maxinputs; i++ ) + { + m_keywordEnumList[ i ] = m_defaultKeywordNames[ i ]; + m_inputPorts[ i ].Name = m_keywordEnumList[ i ]; + } + + if( m_keywordModeType != KeywordModeType.KeywordEnum ) + { + m_inputPorts[ 0 ].Name = "False"; + m_inputPorts[ 1 ].Name = "True"; + } + + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + m_inputPorts[ i ].Visible = ( i < maxinputs ); + } + m_sizeIsDirty = true; + m_isStaticSwitchDirty = true; + } + + void PropertyGroup() + { + EditorGUI.BeginChangeCheck(); + CurrentVarMode = (StaticSwitchVariableMode)EditorGUILayoutEnumPopup( ModeStr, CurrentVarMode ); + if( EditorGUI.EndChangeCheck() ) + { + if( CurrentVarMode == StaticSwitchVariableMode.Fetch ) + { + m_keywordModeType = KeywordModeType.Toggle; + UpdateLabels(); + } + + if( CurrentVarMode == StaticSwitchVariableMode.Reference ) + { + UIUtils.UnregisterPropertyNode( this ); + } + else + { + if( m_createToggle ) + UIUtils.RegisterPropertyNode( this ); + else + UIUtils.UnregisterPropertyNode( this ); + } + } + + if( CurrentVarMode == StaticSwitchVariableMode.Create ) + { + EditorGUI.BeginChangeCheck(); + m_multiCompile = EditorGUILayoutIntPopup( KeywordTypeStr, m_multiCompile, KeywordTypeList, KeywordTypeInt ); + if( EditorGUI.EndChangeCheck() ) + { + BeginPropertyFromInspectorCheck(); + } + + if ( m_showErrorMessage ) + { + EditorGUILayout.HelpBox( DynamicBranchErrorMsg, MessageType.Error ); + } + } + else if( CurrentVarMode == StaticSwitchVariableMode.Reference ) + { + string[] arr = ContainerGraph.StaticSwitchNodes.NodesArr; + bool guiEnabledBuffer = GUI.enabled; + if( arr != null && arr.Length > 0 ) + { + GUI.enabled = true; + } + else + { + m_referenceArrayId = -1; + GUI.enabled = false; + } + + EditorGUI.BeginChangeCheck(); + m_referenceArrayId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceArrayId, arr ); + if( EditorGUI.EndChangeCheck() ) + { + m_reference = ContainerGraph.StaticSwitchNodes.GetNode( m_referenceArrayId ); + if( m_reference != null ) + { + m_referenceNodeId = m_reference.UniqueId; + CheckReferenceValues( true ); + } + else + { + m_referenceArrayId = -1; + m_referenceNodeId = -1; + } + } + GUI.enabled = guiEnabledBuffer; + + return; + } + + if( CurrentVarMode == StaticSwitchVariableMode.Create || m_createToggle ) + { + EditorGUI.BeginChangeCheck(); + m_keywordModeType = (KeywordModeType)EditorGUILayoutEnumPopup( TypeStr, m_keywordModeType ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateLabels(); + } + } + + if( m_keywordModeType != KeywordModeType.KeywordEnum ) + { + if( CurrentVarMode == StaticSwitchVariableMode.Create || m_createToggle ) + { + ShowPropertyInspectorNameGUI(); + ShowPropertyNameGUI( true ); + if( CurrentVarMode == StaticSwitchVariableMode.Create ) + { + EditorGUILayout.BeginHorizontal(); + bool guiEnabledBuffer = GUI.enabled; + GUI.enabled = !m_lockKeyword; + if( m_lockKeyword ) + EditorGUILayout.TextField( KeywordNameStr, GetPropertyValStr() ); + else + m_currentKeyword = EditorGUILayoutTextField( KeywordNameStr, m_currentKeyword ); + GUI.enabled = guiEnabledBuffer; + m_lockKeyword = GUILayout.Toggle( m_lockKeyword, ( m_lockKeyword ? UIUtils.LockIconOpen : UIUtils.LockIconClosed ), "minibutton", GUILayout.Width( 22 ) ); + EditorGUILayout.EndHorizontal(); + } + } + + } + else + { + if( CurrentVarMode == StaticSwitchVariableMode.Create || m_createToggle ) + { + ShowPropertyInspectorNameGUI(); + ShowPropertyNameGUI( true ); + DrawEnumList(); + } + + } + + if( CurrentVarMode == StaticSwitchVariableMode.Fetch ) + { + //ShowPropertyInspectorNameGUI(); + EditorGUI.BeginChangeCheck(); + m_currentKeywordId = EditorGUILayoutPopup( KeywordStr, m_currentKeywordId, UIUtils.AvailableKeywords ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_currentKeywordId != 0 ) + { + m_currentKeyword = UIUtils.AvailableKeywords[ m_currentKeywordId ]; + } + } + + if( m_currentKeywordId == 0 ) + { + EditorGUI.BeginChangeCheck(); + m_currentKeyword = EditorGUILayoutTextField( CustomStr, m_currentKeyword ); + if( EditorGUI.EndChangeCheck() ) + { + m_currentKeyword = UIUtils.RemoveInvalidCharacters( m_currentKeyword ); + } + } + } + + GUI.enabled = ( m_multiCompile != ( int )KeywordType.DynamicBranch ); + { + m_isLocal = EditorGUILayoutToggle( IsLocalStr, m_isLocal ); + + m_shaderStage = ( ShaderStage )EditorGUILayoutEnumPopup( StageStr, m_shaderStage ); + + bool isFunction = ( m_containerGraph.CurrentCanvasMode == NodeAvailability.ShaderFunction ); + bool isTemplate = ( m_containerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader ); + if ( ( !isTemplate || isFunction ) && ( m_keywordModeType == KeywordModeType.KeywordEnum ) && ( m_shaderStage != ShaderStage.All ) ) + { + EditorGUILayout.HelpBox( KeywordModifierSurfaceWarning, isFunction ? MessageType.Info : MessageType.Warning ); + } + + //if( CurrentVarMode == StaticSwitchVariableMode.Create ) + { + ShowAutoRegister(); + } + } + GUI.enabled = true; + + EditorGUI.BeginChangeCheck(); + m_createToggle = EditorGUILayoutToggle( MaterialToggleStr, m_createToggle ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_createToggle ) + UIUtils.RegisterPropertyNode( this ); + else + UIUtils.UnregisterPropertyNode( this ); + } + + + if( m_createToggle ) + { + EditorGUILayout.BeginHorizontal(); + GUILayout.Space( 20 ); + m_propertyTab = GUILayout.Toolbar( m_propertyTab, LabelToolbarTitle ); + EditorGUILayout.EndHorizontal(); + switch( m_propertyTab ) + { + default: + case 0: + { + EditorGUI.BeginChangeCheck(); + if( m_keywordModeType != KeywordModeType.KeywordEnum ) + m_materialValue = EditorGUILayoutToggle( ToggleMaterialValueStr, m_materialValue == 1 ) ? 1 : 0; + else + m_materialValue = EditorGUILayoutPopup( ToggleMaterialValueStr, m_materialValue, m_keywordEnumList ); + if( EditorGUI.EndChangeCheck() ) + m_requireMaterialUpdate = true; + } + break; + case 1: + { + if( m_keywordModeType != KeywordModeType.KeywordEnum ) + m_defaultValue = EditorGUILayoutToggle( ToggleDefaultValueStr, m_defaultValue == 1 ) ? 1 : 0; + else + m_defaultValue = EditorGUILayoutPopup( ToggleDefaultValueStr, m_defaultValue, m_keywordEnumList ); + } + break; + } + } + + //EditorGUILayout.HelpBox( "Keyword Type:\n" + + // "The difference is that unused variants of \"Shader Feature\" shaders will not be included into game build while \"Multi Compile\" variants are included regardless of their usage.\n\n" + + // "So \"Shader Feature\" makes most sense for keywords that will be set on the materials, while \"Multi Compile\" for keywords that will be set from code globally.\n\n" + + // "You can set keywords using the material property using the \"Property Name\" or you can set the keyword directly using the \"Keyword Name\".", MessageType.None ); + } + + public override void CheckPropertyFromInspector( bool forceUpdate = false ) + { + if( m_propertyFromInspector ) + { + if( forceUpdate || ( EditorApplication.timeSinceStartup - m_propertyFromInspectorTimestamp ) > MaxTimestamp ) + { + m_propertyFromInspector = false; + RegisterPropertyName( true, m_propertyInspectorName, m_autoGlobalName, m_underscoredGlobal ); + m_propertyNameIsDirty = true; + + if( CurrentVarMode != StaticSwitchVariableMode.Reference ) + { + ContainerGraph.StaticSwitchNodes.UpdateDataOnNode( UniqueId, DataToArray ); + } + } + } + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + float finalSize = 0; + if( m_keywordModeType == KeywordModeType.KeywordEnum ) + { + GUIContent dropdown = new GUIContent( m_inputPorts[ CurrentSelectedInput ].Name ); + int cacheSize = UIUtils.GraphDropDown.fontSize; + UIUtils.GraphDropDown.fontSize = 10; + Vector2 calcSize = UIUtils.GraphDropDown.CalcSize( dropdown ); + UIUtils.GraphDropDown.fontSize = cacheSize; + finalSize = Mathf.Clamp( calcSize.x, MinComboSize, MaxComboSize ); + if( m_insideSize.x != finalSize ) + { + m_insideSize.Set( finalSize, 25 ); + m_sizeIsDirty = true; + } + } + + base.OnNodeLayout( drawInfo ); + + if( m_keywordModeType != KeywordModeType.KeywordEnum ) + { + m_varRect = m_remainingBox; + m_varRect.size = Vector2.one * 22 * drawInfo.InvertedZoom; + m_varRect.center = m_remainingBox.center; + if( m_showPreview ) + m_varRect.y = m_remainingBox.y; + } + else + { + m_varRect = m_remainingBox; + m_varRect.width = finalSize * drawInfo.InvertedZoom; + m_varRect.height = 16 * drawInfo.InvertedZoom; + m_varRect.x = m_remainingBox.xMax - m_varRect.width; + m_varRect.y += 1 * drawInfo.InvertedZoom; + + m_imgRect = m_varRect; + m_imgRect.x = m_varRect.xMax - 16 * drawInfo.InvertedZoom; + m_imgRect.width = 16 * drawInfo.InvertedZoom; + m_imgRect.height = m_imgRect.width; + } + + CheckReferenceValues( false ); + + if( m_staticSwitchVarMode == StaticSwitchVariableMode.Reference ) + { + m_iconPos = m_globalPosition; + m_iconPos.width = InstanceIconWidth * drawInfo.InvertedZoom; + m_iconPos.height = InstanceIconHeight * drawInfo.InvertedZoom; + + m_iconPos.y += 10 * drawInfo.InvertedZoom; + m_iconPos.x += /*m_globalPosition.width - m_iconPos.width - */5 * drawInfo.InvertedZoom; + } + + } + + void CheckReferenceValues( bool forceUpdate ) + { + if( m_staticSwitchVarMode == StaticSwitchVariableMode.Reference ) + { + if( m_reference == null && m_referenceNodeId > 0 ) + { + m_reference = ContainerGraph.GetNode( m_referenceNodeId ) as StaticSwitch; + m_referenceArrayId = ContainerGraph.StaticSwitchNodes.GetNodeRegisterIdx( m_referenceNodeId ); + } + + if( m_reference != null ) + { + if( forceUpdate || m_reference.IsStaticSwitchDirty ) + { + int count = m_inputPorts.Count; + for( int i = 0; i < count; i++ ) + { + m_inputPorts[ i ].Name = m_reference.InputPorts[ i ].Name; + m_inputPorts[ i ].Visible = m_reference.InputPorts[ i ].Visible; + } + m_sizeIsDirty = true; + } + } + } + else + { + m_isStaticSwitchDirty = false; + } + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if( drawInfo.CurrentEventType != EventType.MouseDown || !m_createToggle ) + return; + + if( m_varRect.Contains( drawInfo.MousePosition ) ) + { + m_editing = true; + } + else if( m_editing ) + { + m_editing = false; + } + } + + private int CurrentSelectedInput + { + get + { + return m_materialMode ? m_materialValue : m_defaultValue; + } + set + { + if( m_materialMode ) + m_materialValue = value; + else + m_defaultValue = value; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + if( m_staticSwitchVarMode == StaticSwitchVariableMode.Reference ) + return; + + if( m_editing ) + { + if( m_keywordModeType != KeywordModeType.KeywordEnum ) + { + if( GUI.Button( m_varRect, GUIContent.none, UIUtils.GraphButton ) ) + { + CurrentSelectedInput = CurrentSelectedInput == 1 ? 0 : 1; + PreviewIsDirty = true; + m_editing = false; + if( m_materialMode ) + m_requireMaterialUpdate = true; + } + + if( CurrentSelectedInput == 1 ) + { + GUI.Label( m_varRect, m_checkContent, UIUtils.GraphButtonIcon ); + } + } + else + { + EditorGUI.BeginChangeCheck(); + CurrentSelectedInput = EditorGUIPopup( m_varRect, CurrentSelectedInput, m_keywordEnumList, UIUtils.GraphDropDown ); + if( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + m_editing = false; + if( m_materialMode ) + m_requireMaterialUpdate = true; + } + } + } + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + base.OnNodeRepaint( drawInfo ); + + if( !m_isVisible ) + return; + + if( m_staticSwitchVarMode == StaticSwitchVariableMode.Reference ) + { + GUI.Label( m_iconPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ) ); + return; + } + + if( m_createToggle && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) + { + if( !m_editing ) + { + if( m_keywordModeType != KeywordModeType.KeywordEnum ) + { + GUI.Label( m_varRect, GUIContent.none, UIUtils.GraphButton ); + + if( CurrentSelectedInput == 1 ) + GUI.Label( m_varRect, m_checkContent, UIUtils.GraphButtonIcon ); + } + else + { + GUI.Label( m_varRect, m_keywordEnumList[ CurrentSelectedInput ], UIUtils.GraphDropDown ); + GUI.Label( m_imgRect, m_popContent, UIUtils.GraphButtonIcon ); + } + } + } + } + + private string OnOffStr + { + get + { + if( !m_lockKeyword ) + return string.Empty; + + StaticSwitch node = null; + switch( CurrentVarMode ) + { + default: + case StaticSwitchVariableMode.Create: + case StaticSwitchVariableMode.Fetch: + node = this; + break; + case StaticSwitchVariableMode.Reference: + { + node = ( m_reference != null ) ? m_reference : this; + } + break; + } + + if( !node.CreateToggle ) + return string.Empty; + + switch( node.KeywordModeTypeValue ) + { + default: + case KeywordModeType.Toggle: + return "_ON"; + case KeywordModeType.ToggleOff: + return "_OFF"; + } + } + } + string GetStaticSwitchType( bool allowStages ) + { + string staticSwitchType; + bool allowModifiers = true; + + switch ( m_multiCompile ) + { + case 1: + staticSwitchType = "multi_compile"; + break; + case 2: + staticSwitchType = "dynamic_branch"; + allowModifiers = false; + break; + default: + staticSwitchType = "shader_feature"; + break; + } + + if ( allowModifiers ) + { + if ( m_isLocal ) + { + staticSwitchType += "_local"; + } + + if ( allowStages ) + { + switch ( m_shaderStage ) + { + default: + case ShaderStage.All: break; + case ShaderStage.Vertex: staticSwitchType += "_vertex"; break; + case ShaderStage.Fragment: staticSwitchType += "_fragment"; break; + case ShaderStage.Hull: staticSwitchType += "_hull"; break; + case ShaderStage.Domain: staticSwitchType += "_domain"; break; + case ShaderStage.Geometry: staticSwitchType += "_geometry"; break; + case ShaderStage.Raytracing: staticSwitchType += "_raytracing"; break; + } + } + } + return staticSwitchType; + } + + void RegisterPragmas( ref MasterNodeDataCollector dataCollector ) + { + if( CurrentVarMode == StaticSwitchVariableMode.Create ) + { + string staticSwitchType = GetStaticSwitchType( allowStages: dataCollector.IsTemplate || ( m_keywordModeType != KeywordModeType.KeywordEnum ) ); + + if( m_keywordModeType == KeywordModeType.KeywordEnum ) + { + dataCollector.AddToPragmas( UniqueId, staticSwitchType + " " + GetKeywordEnumPragmaList() ); + } + else + { + if( m_multiCompile == 1 ) + dataCollector.AddToPragmas( UniqueId, staticSwitchType + " __ " + CurrentKeyword ); + else + dataCollector.AddToPragmas( UniqueId, staticSwitchType + " " + CurrentKeyword ); + } + } + } + + protected override void RegisterProperty( ref MasterNodeDataCollector dataCollector ) + { + if( m_staticSwitchVarMode == StaticSwitchVariableMode.Reference && m_reference != null ) + { + m_reference.RegisterProperty( ref dataCollector ); + m_reference.RegisterPragmas( ref dataCollector ); + } + else + { + if( m_createToggle ) + base.RegisterProperty( ref dataCollector ); + + RegisterPragmas( ref dataCollector ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + if ( m_showErrorMessage ) + { + UIUtils.ShowMessage( DynamicBranchErrorMsg ); + return GenerateErrorValue(); + } + + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + + StaticSwitch node = ( m_staticSwitchVarMode == StaticSwitchVariableMode.Reference && m_reference != null ) ? m_reference : this; + + this.OrderIndex = node.RawOrderIndex; + this.OrderIndexOffset = node.OrderIndexOffset; + + string outType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + if( node.KeywordModeTypeValue == KeywordModeType.KeywordEnum ) + { + string[] allOutputs = new string[ node.KeywordEnumAmount ]; + for ( int i = 0; i < node.KeywordEnumAmount; i++ ) + allOutputs[ i ] = m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); + + if ( m_multiCompile == ( int )KeywordType.DynamicBranch ) + { + dataCollector.AddLocalVariable( UniqueId, outType + " dynamicSwitch" + OutputId + " = ( " + outType + " )0;", true ); + for ( int i = 0; i < node.KeywordEnumAmount; i++ ) + { + string keyword = node.KeywordEnum( i ); + if ( i == 0 ) + dataCollector.AddLocalVariable( UniqueId, "UNITY_BRANCH if ( " + keyword + " )", true ); + else + dataCollector.AddLocalVariable( UniqueId, "else if ( " + keyword + " )", true ); + + dataCollector.AddLocalVariable( UniqueId, "{", true ); + + dataCollector.AddLocalVariable( UniqueId, "\tdynamicSwitch" + OutputId + " = " + allOutputs[ i ] + ";", true ); + + dataCollector.AddLocalVariable( UniqueId, "}", true ); + } + dataCollector.AddLocalVariable( UniqueId, "else", true ); + dataCollector.AddLocalVariable( UniqueId, "{", true ); + dataCollector.AddLocalVariable( UniqueId, "\tdynamicSwitch" + OutputId + " = " + allOutputs[ node.DefaultValue ] + ";", true ); + dataCollector.AddLocalVariable( UniqueId, "}", true ); + } + else + { + for ( int i = 0; i < node.KeywordEnumAmount; i++ ) + { + string keyword = node.KeywordEnum( i ); + if ( i == 0 ) + dataCollector.AddLocalVariable( UniqueId, "#if defined( " + keyword + " )", true ); + else + dataCollector.AddLocalVariable( UniqueId, "#elif defined( " + keyword + " )", true ); + + dataCollector.AddLocalVariable( UniqueId, "\t" + outType + " staticSwitch" + OutputId + " = " + allOutputs[ i ] + ";", true ); + } + dataCollector.AddLocalVariable( UniqueId, "#else", true ); + dataCollector.AddLocalVariable( UniqueId, "\t" + outType + " staticSwitch" + OutputId + " = " + allOutputs[ node.DefaultValue ] + ";", true ); + dataCollector.AddLocalVariable( UniqueId, "#endif", true ); + } + } + else + { + string falseCode = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string trueCode = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + if ( m_multiCompile == ( int )KeywordType.DynamicBranch ) + { + dataCollector.AddLocalVariable( UniqueId, outType + " dynamicSwitch" + OutputId + " = ( " + outType + " )0;", true ); + dataCollector.AddLocalVariable( UniqueId, "UNITY_BRANCH if ( " + node.CurrentKeyword + " )", true ); + dataCollector.AddLocalVariable( UniqueId, "{", true ); + dataCollector.AddLocalVariable( UniqueId, "\tdynamicSwitch" + OutputId + " = " + trueCode + ";", true ); + dataCollector.AddLocalVariable( UniqueId, "}", true ); + dataCollector.AddLocalVariable( UniqueId, "else", true ); + dataCollector.AddLocalVariable( UniqueId, "{", true ); + dataCollector.AddLocalVariable( UniqueId, "\tdynamicSwitch" + OutputId + " = " + falseCode + ";", true ); + dataCollector.AddLocalVariable( UniqueId, "}", true ); + m_outputPorts[ 0 ].SetLocalValue( "dynamicSwitch" + OutputId, dataCollector.PortCategory ); + } + else + { + //if( node.CurrentVarMode == StaticSwitchVariableMode.Fetch ) + dataCollector.AddLocalVariable( UniqueId, "#ifdef " + node.CurrentKeyword, true ); + //else + // dataCollector.AddLocalVariable( UniqueId, "#ifdef " + node.PropertyName + OnOffStr, true ); + dataCollector.AddLocalVariable( UniqueId, "\t" + outType + " staticSwitch" + OutputId + " = " + trueCode + ";", true ); + dataCollector.AddLocalVariable( UniqueId, "#else", true ); + dataCollector.AddLocalVariable( UniqueId, "\t" + outType + " staticSwitch" + OutputId + " = " + falseCode + ";", true ); + dataCollector.AddLocalVariable( UniqueId, "#endif", true ); + m_outputPorts[ 0 ].SetLocalValue( "staticSwitch" + OutputId, dataCollector.PortCategory ); + } + } + + if ( m_multiCompile == ( int )KeywordType.DynamicBranch ) + { + m_outputPorts[ 0 ].SetLocalValue( "dynamicSwitch" + OutputId, dataCollector.PortCategory ); + } + else + { + m_outputPorts[ 0 ].SetLocalValue( "staticSwitch" + OutputId, dataCollector.PortCategory ); + } + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public override void DrawTitle( Rect titlePos ) + { + bool referenceMode = m_staticSwitchVarMode == StaticSwitchVariableMode.Reference && m_reference != null; + string subTitle = string.Empty; + string subTitleFormat = string.Empty; + if( referenceMode ) + { + subTitle = m_reference.GetPropertyValStr(); + subTitleFormat = Constants.SubTitleRefNameFormatStr; + } + else + { + subTitle = GetPropertyValStr(); + subTitleFormat = GetSubTitleVarNameFormatStr(); + } + + SetAdditonalTitleTextOnCallback( subTitle, subTitleFormat, ( instance, newSubTitle ) => instance.AdditonalTitleContent.text = string.Format( subTitleFormat, newSubTitle ) ); + + if( !m_isEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + GUI.Label( titlePos, StaticSwitchStr, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); + } + } + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) + { + if( m_keywordModeType == KeywordModeType.KeywordEnum ) + { + for( int i = 0; i < m_keywordEnumAmount; i++ ) + { + string key = KeywordEnum( i ); + mat.DisableKeyword( key ); + } + mat.EnableKeyword( KeywordEnum( m_materialValue )); + mat.SetFloat( m_propertyName, m_materialValue ); + } + else + { + int final = m_materialValue; + if( m_keywordModeType == KeywordModeType.ToggleOff ) + final = final == 1 ? 0 : 1; + mat.SetFloat( m_propertyName, m_materialValue ); + if( final == 1 ) + mat.EnableKeyword( GetPropertyValStr() ); + else + mat.DisableKeyword( GetPropertyValStr() ); + } + } + } + + public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) + { + base.SetMaterialMode( mat, fetchMaterialValues ); + if( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) + { + m_materialValue = mat.GetInt( m_propertyName ); + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) + { + m_materialValue = material.GetInt( m_propertyName ); + PreviewIsDirty = true; + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_multiCompile = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 14403 ) + { + m_defaultValue = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 14101 ) + { + m_materialValue = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + } + else + { + m_defaultValue = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ) ? 1 : 0; + if( UIUtils.CurrentShaderVersion() > 14101 ) + { + m_materialValue = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ) ? 1 : 0; + } + } + + if( UIUtils.CurrentShaderVersion() > 13104 ) + { + m_createToggle = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_currentKeyword = GetCurrentParam( ref nodeParams ); + m_currentKeywordId = UIUtils.GetKeywordId( m_currentKeyword ); + } + if( UIUtils.CurrentShaderVersion() > 14001 ) + { + m_keywordModeType = (KeywordModeType)Enum.Parse( typeof( KeywordModeType ), GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 14403 ) + { + KeywordEnumAmount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + for( int i = 0; i < KeywordEnumAmount; i++ ) + { + m_defaultKeywordNames[ i ] = GetCurrentParam( ref nodeParams ); + } + + UpdateLabels(); + } + + if( UIUtils.CurrentShaderVersion() > 16304 ) + { + string currentVarMode = GetCurrentParam( ref nodeParams ); + CurrentVarMode = (StaticSwitchVariableMode)Enum.Parse( typeof( StaticSwitchVariableMode ), currentVarMode ); + if( CurrentVarMode == StaticSwitchVariableMode.Reference ) + { + m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + } + else + { + CurrentVarMode = (StaticSwitchVariableMode)m_variableMode; + //Resetting m_variableMode to its default value since it will no longer be used and interfere released ransom properties behavior + m_variableMode = VariableMode.Create; + } + + if( CurrentVarMode == StaticSwitchVariableMode.Reference ) + { + UIUtils.UnregisterPropertyNode( this ); + } + else + { + if( m_createToggle ) + UIUtils.RegisterPropertyNode( this ); + else + UIUtils.UnregisterPropertyNode( this ); + } + + if( UIUtils.CurrentShaderVersion() > 16700 ) + { + m_isLocal = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 18401 ) + m_lockKeyword = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + + if( UIUtils.CurrentShaderVersion() > 18928 ) + m_shaderStage = (ShaderStage)Enum.Parse( typeof(ShaderStage), GetCurrentParam( ref nodeParams ) ); + + + SetMaterialToggleRetrocompatibility(); + + if( !m_isNodeBeingCopied && CurrentVarMode != StaticSwitchVariableMode.Reference ) + { + ContainerGraph.StaticSwitchNodes.UpdateDataOnNode( UniqueId, DataToArray ); + } + } + + public override void ReleaseRansomedProperty() + { + //on old ASE, the property node m_variableMode was used on defining the static switch type, now we have a specific m_staticSwitchVarMode over here + //the problem with this is the fix made to release ransomend property names( hash deb232819fff0f1aeaf029a21c55ef597b3424de ) uses m_variableMode and + //makes old static switches to attempt and register an already registered name when doing this: + //CurrentVariableMode = VariableMode.Create; + //So we need to disable this release ransom property behavior as m_variableMode should never be on VariableMode.Create + //The m_variableMode is set to its default value over the ReadFromString method after its value as been set over the new m_staticSwitchVarMode variable + } + + void SetMaterialToggleRetrocompatibility() + { + if( UIUtils.CurrentShaderVersion() < 17108 ) + { + if( !m_createToggle && m_staticSwitchVarMode == StaticSwitchVariableMode.Create ) + { + if( m_keywordModeType != KeywordModeType.KeywordEnum ) + { + m_propertyName = m_propertyName.ToUpper() + "_ON"; + } + else + { + m_propertyName = m_propertyName.ToUpper(); + for( int i = 0; i < m_keywordEnumList.Length; i++ ) + { + m_keywordEnumList[ i ] = "_" + m_keywordEnumList[ i ].ToUpper(); + } + } + m_autoGlobalName = false; + } + } + } + + public override void ReadFromDeprecated( ref string[] nodeParams, Type oldType = null ) + { + base.ReadFromDeprecated( ref nodeParams, oldType ); + { + m_currentKeyword = GetCurrentParam( ref nodeParams ); + m_currentKeywordId = UIUtils.GetKeywordId( m_currentKeyword ); + m_createToggle = false; + m_keywordModeType = KeywordModeType.Toggle; + m_variableMode = VariableMode.Fetch; + CurrentVarMode = StaticSwitchVariableMode.Fetch; + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_multiCompile ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_materialValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_createToggle ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentKeyword ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_keywordModeType ); + IOUtils.AddFieldValueToString( ref nodeInfo, KeywordEnumAmount ); + for( int i = 0; i < KeywordEnumAmount; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_keywordEnumList[ i ] ); + } + + IOUtils.AddFieldValueToString( ref nodeInfo, CurrentVarMode ); + if( CurrentVarMode == StaticSwitchVariableMode.Reference ) + { + int referenceId = ( m_reference != null ) ? m_reference.UniqueId : -1; + IOUtils.AddFieldValueToString( ref nodeInfo, referenceId ); + } + IOUtils.AddFieldValueToString( ref nodeInfo, m_isLocal ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_lockKeyword ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_shaderStage ); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + CheckReferenceValues( true ); + } + + StaticSwitchVariableMode CurrentVarMode + { + get { return m_staticSwitchVarMode; } + set + { + if( m_staticSwitchVarMode != value ) + { + if( value == StaticSwitchVariableMode.Reference ) + { + ContainerGraph.StaticSwitchNodes.RemoveNode( this ); + m_referenceArrayId = -1; + m_referenceNodeId = -1; + m_reference = null; + m_headerColorModifier = ReferenceHeaderColor; + } + else + { + m_headerColorModifier = Color.white; + ContainerGraph.StaticSwitchNodes.AddNode( this ); + UpdateLabels(); + } + } + m_staticSwitchVarMode = value; + } + } + public bool IsStaticSwitchDirty { get { return m_isStaticSwitchDirty; } } + public KeywordModeType KeywordModeTypeValue { get { return m_keywordModeType; } } + public int DefaultValue { get { return m_defaultValue; } } + public int MaterialValue { get { return m_materialValue; } } + //public string CurrentKeyword { get { return m_currentKeyword; } } + public string CurrentKeyword + { + get + { + if( CurrentVarMode == StaticSwitchVariableMode.Fetch ) + return m_currentKeyword; + + return ( m_lockKeyword || string.IsNullOrEmpty( m_currentKeyword ) ? PropertyName + OnOffStr : m_currentKeyword ); + } + } + public bool CreateToggle { get { return m_createToggle; } } + + public int KeywordEnumAmount + { + get + { + return m_keywordEnumAmount; + } + set + { + m_keywordEnumAmount = value; + m_defaultValue = Mathf.Clamp( m_defaultValue, 0, m_keywordEnumAmount - 1 ); + m_materialValue = Mathf.Clamp( m_defaultValue, 0, m_keywordEnumAmount - 1 ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs.meta new file mode 100644 index 00000000..41a54cb3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b1d1a233ea65ccd478fb6caf4327da48 +timeCreated: 1497289190 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs new file mode 100644 index 00000000..4901dbbf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs @@ -0,0 +1,32 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node TAU +// Donated by The Four Headed Cat - @fourheadedcat + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Tau", "Constants And Properties", "Tau constant (2*PI): 6.28318530718", null, KeyCode.None, true, false, null,null, "The Four Headed Cat - @fourheadedcat" )] + public sealed class TauNode : ParentNode + { + private readonly string Tau = ( 2.0 * Mathf.PI ).ToString(); + public TauNode() : base() { } + public TauNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_previewShaderGUID = "701bc295c0d75d8429eabcf45e8e008d"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + return dataCollector.IsSRP? "TWO_PI": Tau; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs.meta new file mode 100644 index 00000000..9d8ae41e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1a6ded4f5e42f6d4684a6131a3cf4d33 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs new file mode 100644 index 00000000..7ba4418a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs @@ -0,0 +1,990 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + //[NodeAttributes( "Texture Array", "Textures", "Texture Array fetches a texture from a texture2DArray asset file given a index value", KeyCode.None, true, 0, int.MaxValue, typeof( Texture2DArray ) )] + [NodeAttributes( "[Old]Texture Array", "Textures", "Texture Array fetches a texture from a texture2DArray asset file given a index value", null, KeyCode.None, true, true, "SamplerNode", typeof( SamplerNode ) )] + public class TextureArrayNode : PropertyNode + { + [SerializeField] + private Texture2DArray m_defaultTextureArray; + + [SerializeField] + private Texture2DArray m_materialTextureArray; + + [SerializeField] + private TexReferenceType m_referenceType = TexReferenceType.Object; + + [SerializeField] + private int m_uvSet = 0; + + [SerializeField] + private MipType m_mipMode = MipType.Auto; + + private readonly string[] m_mipOptions = { "Auto", "Mip Level", "Derivative" }; + + private TextureArrayNode m_referenceSampler = null; + + [SerializeField] + private int m_referenceArrayId = -1; + + [SerializeField] + private int m_referenceNodeId = -1; + + [SerializeField] + private bool m_autoUnpackNormals = false; + + private InputPort m_texPort; + private InputPort m_uvPort; + private InputPort m_indexPort; + private InputPort m_lodPort; + private InputPort m_normalPort; + private InputPort m_ddxPort; + private InputPort m_ddyPort; + + private OutputPort m_colorPort; + + private const string AutoUnpackNormalsStr = "Normal"; + private const string NormalScaleStr = "Scale"; + + private string m_labelText = "None (Texture2DArray)"; + + private readonly Color ReferenceHeaderColor = new Color( 2.66f, 1.02f, 0.6f, 1.0f ); + + private int m_cachedUvsId = -1; + private int m_cachedSamplerId = -1; + private int m_texConnectedId = -1; + private int m_cachedUnpackId = -1; + private int m_cachedLodId = -1; + + private Rect m_iconPos; + private bool m_isEditingPicker; + + private bool m_linearTexture; + protected bool m_drawPicker; + + private ReferenceState m_state = ReferenceState.Self; + private ParentNode m_previewTextProp = null; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputColorPorts( "RGBA" ); + m_colorPort = m_outputPorts[ 0 ]; + AddInputPort( WirePortDataType.SAMPLER2D, false, "Tex", -1, MasterNodePortCategory.Fragment, 6 ); + AddInputPort( WirePortDataType.FLOAT2, false, "UV", -1, MasterNodePortCategory.Fragment, 0 ); + AddInputPort( WirePortDataType.FLOAT, false, "Index", -1, MasterNodePortCategory.Fragment, 1 ); + AddInputPort( WirePortDataType.FLOAT, false, "Level", -1, MasterNodePortCategory.Fragment, 2 ); + AddInputPort( WirePortDataType.FLOAT, false, NormalScaleStr, -1, MasterNodePortCategory.Fragment, 3 ); + AddInputPort( WirePortDataType.FLOAT2, false, "DDX", -1, MasterNodePortCategory.Fragment, 4 ); + AddInputPort( WirePortDataType.FLOAT2, false, "DDY", -1, MasterNodePortCategory.Fragment, 5 ); + m_inputPorts[ 2 ].AutoDrawInternalData = true; + + m_texPort = m_inputPorts[ 0 ]; + m_uvPort = m_inputPorts[ 1 ]; + m_indexPort = m_inputPorts[ 2 ]; + m_lodPort = m_inputPorts[ 3 ]; + + m_lodPort.Visible = false; + m_normalPort = m_inputPorts[ 4 ]; + m_normalPort.Visible = m_autoUnpackNormals; + m_normalPort.FloatInternalData = 1.0f; + m_ddxPort = m_inputPorts[ 5 ]; + m_ddxPort.Visible = false; + m_ddyPort = m_inputPorts[ 6 ]; + m_ddyPort.Visible = false; + m_insideSize.Set( 128, 128 + 5 ); + m_drawPrecisionUI = false; + m_currentParameterType = PropertyType.Property; + + m_availableAttribs.Add( new PropertyAttributes( "No Scale Offset", "[NoScaleOffset]" ) ); + + m_freeType = false; + m_showPreview = true; + m_drawPreviewExpander = false; + m_drawPreview = false; + m_drawPicker = true; + m_customPrefix = "Texture Array "; + m_selectedLocation = PreviewLocation.TopCenter; + m_previewShaderGUID = "2e6d093df2d289f47b827b36efb31a81"; + m_showAutoRegisterUI = false; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_cachedUvsId == -1 ) + m_cachedUvsId = Shader.PropertyToID( "_CustomUVs" ); + + if( m_cachedSamplerId == -1 ) + m_cachedSamplerId = Shader.PropertyToID( "_Sampler" ); + + if( m_texConnectedId == -1 ) + m_texConnectedId = Shader.PropertyToID( "_TexConnected" ); + + if( m_cachedUnpackId == -1 ) + m_cachedUnpackId = Shader.PropertyToID( "_Unpack" ); + + if( m_cachedLodId == -1 ) + m_cachedLodId = Shader.PropertyToID( "_LodType" ); + + PreviewMaterial.SetFloat( m_cachedLodId, ( m_mipMode == MipType.MipLevel ? 1 : 0 ) ); + PreviewMaterial.SetFloat( m_cachedUnpackId, m_autoUnpackNormals ? 1 : 0 ); + if( m_referenceType == TexReferenceType.Instance && m_referenceSampler != null ) + { + if( (ParentNode)m_referenceSampler != m_referenceSampler.PreviewTextProp ) + { + PreviewMaterial.SetInt( m_texConnectedId, 1 ); + PreviewMaterial.SetTexture( "_G", m_referenceSampler.PreviewTextProp.PreviewTexture ); + } + else + { + PreviewMaterial.SetInt( m_texConnectedId, 0 ); + PreviewMaterial.SetTexture( m_cachedSamplerId, m_referenceSampler.TextureArray ); + } + } + else if( m_texPort.IsConnected ) + { + PreviewMaterial.SetInt( m_texConnectedId, 1 ); + } + else + { + PreviewMaterial.SetInt( m_texConnectedId, 0 ); + PreviewMaterial.SetTexture( m_cachedSamplerId, TextureArray ); + } + PreviewMaterial.SetFloat( m_cachedUvsId, ( m_uvPort.IsConnected ? 1 : 0 ) ); + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + if( m_referenceType == TexReferenceType.Object ) + { + UIUtils.RegisterTextureArrayNode( this ); + UIUtils.RegisterPropertyNode( this ); + } + + if( UniqueId > -1 ) + ContainerGraph.TextureArrayNodes.OnReorderEventComplete += OnReorderEventComplete; + + } + + private void OnReorderEventComplete() + { + if( m_referenceType == TexReferenceType.Instance && m_referenceSampler != null ) + { + m_referenceArrayId = ContainerGraph.TextureArrayNodes.GetNodeRegisterIdx( m_referenceSampler.UniqueId ); + } + } + + new void ShowDefaults() + { + m_uvSet = EditorGUILayoutIntPopup( Constants.AvailableUVSetsLabel, m_uvSet, Constants.AvailableUVSetsStr, Constants.AvailableUVSets ); + + MipType newMipMode = (MipType)EditorGUILayoutPopup( "Mip Mode", (int)m_mipMode, m_mipOptions ); + if( newMipMode != m_mipMode ) + { + m_mipMode = newMipMode; + } + + switch( m_mipMode ) + { + case MipType.Auto: + m_lodPort.Visible = false; + m_ddxPort.Visible = false; + m_ddyPort.Visible = false; + break; + case MipType.MipLevel: + m_lodPort.Visible = true; + m_ddxPort.Visible = false; + m_ddyPort.Visible = false; + break; + case MipType.MipBias: + case MipType.Derivative: + m_ddxPort.Visible = true; + m_ddyPort.Visible = true; + m_lodPort.Visible = false; + break; + } + + if( m_ddxPort.Visible ) + { + EditorGUILayout.HelpBox( "Warning: Derivative Mip Mode only works on some platforms (D3D11 XBOXONE GLES3 GLCORE)", MessageType.Warning ); + } + + if( !m_lodPort.IsConnected && m_lodPort.Visible ) + { + m_lodPort.FloatInternalData = EditorGUILayoutFloatField( "Mip Level", m_lodPort.FloatInternalData ); + } + + if( !m_indexPort.IsConnected ) + { + m_indexPort.FloatInternalData = EditorGUILayoutFloatField( "Index", m_indexPort.FloatInternalData ); + } + + + } + + public override void DrawMainPropertyBlock() + { + EditorGUI.BeginChangeCheck(); + m_referenceType = (TexReferenceType)EditorGUILayoutPopup( Constants.ReferenceTypeStr, (int)m_referenceType, Constants.ReferenceArrayLabels ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_referenceType == TexReferenceType.Object ) + { + UIUtils.RegisterTextureArrayNode( this ); + UIUtils.RegisterPropertyNode( this ); + + SetTitleText( m_propertyInspectorName ); + SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); + m_referenceArrayId = -1; + m_referenceNodeId = -1; + m_referenceSampler = null; + } + else + { + UIUtils.UnregisterTextureArrayNode( this ); + UIUtils.UnregisterPropertyNode( this ); + } + UpdateHeaderColor(); + } + + if( m_referenceType == TexReferenceType.Object ) + { + EditorGUI.BeginChangeCheck(); + base.DrawMainPropertyBlock(); + if( EditorGUI.EndChangeCheck() ) + { + OnPropertyNameChanged(); + } + } + else + { + string[] arr = UIUtils.TextureArrayNodeArr(); + bool guiEnabledBuffer = GUI.enabled; + if( arr != null && arr.Length > 0 ) + { + GUI.enabled = true; + } + else + { + m_referenceArrayId = -1; + GUI.enabled = false; + } + + m_referenceArrayId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceArrayId, arr ); + GUI.enabled = guiEnabledBuffer; + + ShowDefaults(); + + DrawSamplerOptions(); + } + } + + public override void OnPropertyNameChanged() + { + base.OnPropertyNameChanged(); + UIUtils.UpdateTextureArrayDataNode( UniqueId, PropertyInspectorName ); + } + + public override void DrawSubProperties() + { + ShowDefaults(); + + DrawSamplerOptions(); + + EditorGUI.BeginChangeCheck(); + m_defaultTextureArray = EditorGUILayoutObjectField( Constants.DefaultValueLabel, m_defaultTextureArray, typeof( Texture2DArray ), false ) as Texture2DArray; + if( EditorGUI.EndChangeCheck() ) + { + CheckTextureImporter( true ); + SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); + } + } + + public override void DrawMaterialProperties() + { + ShowDefaults(); + + DrawSamplerOptions(); + + EditorGUI.BeginChangeCheck(); + m_materialTextureArray = EditorGUILayoutObjectField( Constants.MaterialValueLabel, m_materialTextureArray, typeof( Texture2DArray ), false ) as Texture2DArray; + if( EditorGUI.EndChangeCheck() ) + { + CheckTextureImporter( true ); + SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); + m_requireMaterialUpdate = true; + } + } + + public void DrawSamplerOptions() + { + EditorGUI.BeginChangeCheck(); + bool autoUnpackNormals = EditorGUILayoutToggle( "Normal Map", m_autoUnpackNormals ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_autoUnpackNormals != autoUnpackNormals ) + { + AutoUnpackNormals = autoUnpackNormals; + + ConfigureInputPorts(); + ConfigureOutputPorts(); + } + } + + if( m_autoUnpackNormals && !m_normalPort.IsConnected ) + { + m_normalPort.FloatInternalData = EditorGUILayoutFloatField( NormalScaleStr, m_normalPort.FloatInternalData ); + } + } + + public void ConfigureInputPorts() + { + m_normalPort.Visible = AutoUnpackNormals; + + m_sizeIsDirty = true; + } + + public void ConfigureOutputPorts() + { + m_outputPorts[ m_colorPort.PortId + 4 ].Visible = !AutoUnpackNormals; + + if( !AutoUnpackNormals ) + { + m_colorPort.ChangeProperties( "RGBA", WirePortDataType.FLOAT4, false ); + m_outputPorts[ m_colorPort.PortId + 1 ].ChangeProperties( "R", WirePortDataType.FLOAT, false ); + m_outputPorts[ m_colorPort.PortId + 2 ].ChangeProperties( "G", WirePortDataType.FLOAT, false ); + m_outputPorts[ m_colorPort.PortId + 3 ].ChangeProperties( "B", WirePortDataType.FLOAT, false ); + m_outputPorts[ m_colorPort.PortId + 4 ].ChangeProperties( "A", WirePortDataType.FLOAT, false ); + + } + else + { + m_colorPort.ChangeProperties( "XYZ", WirePortDataType.FLOAT3, false ); + m_outputPorts[ m_colorPort.PortId + 1 ].ChangeProperties( "X", WirePortDataType.FLOAT, false ); + m_outputPorts[ m_colorPort.PortId + 2 ].ChangeProperties( "Y", WirePortDataType.FLOAT, false ); + m_outputPorts[ m_colorPort.PortId + 3 ].ChangeProperties( "Z", WirePortDataType.FLOAT, false ); + } + + m_sizeIsDirty = true; + } + + public virtual void CheckTextureImporter( bool additionalCheck ) + { + m_requireMaterialUpdate = true; + Texture2DArray texture = m_materialMode ? m_materialTextureArray : m_defaultTextureArray; + + UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath( AssetDatabase.GetAssetPath( texture ), typeof( UnityEngine.Object ) ); + + if( obj != null ) + { + SerializedObject serializedObject = new UnityEditor.SerializedObject( obj ); + + if( serializedObject != null ) + { + SerializedProperty colorSpace = serializedObject.FindProperty( "m_ColorSpace" ); + m_linearTexture = ( colorSpace.intValue == 0 ); + } + } + } + + void UpdateHeaderColor() + { + m_headerColorModifier = ( m_referenceType == TexReferenceType.Object ) ? Color.white : ReferenceHeaderColor; + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if( !( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp || drawInfo.CurrentEventType == EventType.ExecuteCommand || drawInfo.CurrentEventType == EventType.DragPerform ) ) + return; + + bool insideBox = m_previewRect.Contains( drawInfo.MousePosition ); + + if( insideBox ) + { + m_isEditingPicker = true; + } + else if( m_isEditingPicker && !insideBox && drawInfo.CurrentEventType != EventType.ExecuteCommand ) + { + GUI.FocusControl( null ); + m_isEditingPicker = false; + } + + if( m_state != ReferenceState.Self && drawInfo.CurrentEventType == EventType.MouseDown && m_previewRect.Contains( drawInfo.MousePosition ) ) + { + UIUtils.FocusOnNode( m_previewTextProp, 1, true ); + Event.current.Use(); + } + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + + if( m_drawPreview ) + { + m_iconPos = m_globalPosition; + m_iconPos.width = 19 * drawInfo.InvertedZoom; + m_iconPos.height = 19 * drawInfo.InvertedZoom; + + m_iconPos.y += 10 * drawInfo.InvertedZoom; + m_iconPos.x += m_globalPosition.width - m_iconPos.width - 5 * drawInfo.InvertedZoom; + } + + bool instanced = CheckReference(); + if( instanced ) + { + m_state = ReferenceState.Instance; + m_previewTextProp = m_referenceSampler; + } + else if( m_texPort.IsConnected ) + { + m_state = ReferenceState.Connected; + m_previewTextProp = m_texPort.GetOutputNode( 0 ) as ParentNode; + } + else + { + m_state = ReferenceState.Self; + m_previewTextProp = this; + } + + if( m_previewTextProp == null ) + m_previewTextProp = this; + + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( m_isEditingPicker && m_drawPicker ) + { + Rect hitRect = m_previewRect; + hitRect.height = 14 * drawInfo.InvertedZoom; + hitRect.y = m_previewRect.yMax - hitRect.height; + hitRect.width = 4 * 14 * drawInfo.InvertedZoom; + + bool restoreMouse = false; + if( Event.current.type == EventType.MouseDown && hitRect.Contains( drawInfo.MousePosition ) ) + { + restoreMouse = true; + Event.current.type = EventType.Ignore; + } + + EditorGUI.BeginChangeCheck(); + m_colorBuffer = GUI.color; + GUI.color = Color.clear; + if( m_materialMode ) + m_materialTextureArray = EditorGUIObjectField( m_previewRect, m_materialTextureArray, typeof( Texture2DArray ), false ) as Texture2DArray; + else + m_defaultTextureArray = EditorGUIObjectField( m_previewRect, m_defaultTextureArray, typeof( Texture2DArray ), false ) as Texture2DArray; + GUI.color = m_colorBuffer; + + if( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + CheckTextureImporter( true ); + SetTitleText( PropertyInspectorName ); + SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); + ConfigureInputPorts(); + ConfigureOutputPorts(); + BeginDelayedDirtyProperty(); + m_requireMaterialUpdate = true; + } + + if( restoreMouse ) + { + Event.current.type = EventType.MouseDown; + } + + if( ( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp ) ) + DrawPreviewMaskButtonsLayout( drawInfo, m_previewRect ); + } + + if( drawInfo.CurrentEventType != EventType.Repaint ) + return; + + switch( m_state ) + { + default: + case ReferenceState.Self: + if( drawInfo.CurrentEventType == EventType.Repaint ) + { + m_drawPreview = false; + m_drawPicker = true; + + DrawTexturePicker( drawInfo ); + } + break; + case ReferenceState.Connected: + if( drawInfo.CurrentEventType == EventType.Repaint ) + { + m_drawPreview = true; + m_drawPicker = false; + + if( m_previewTextProp != null ) + { + SetTitleTextOnCallback( m_previewTextProp.TitleContent.text, ( instance, newTitle ) => instance.TitleContent.text = newTitle + " (Input)" ); + SetAdditonalTitleText( m_previewTextProp.AdditonalTitleContent.text ); + } + + // Draw chain lock + GUI.Label( m_iconPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ) ); + + // Draw frame around preview + GUI.Label( m_previewRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); + } + break; + case ReferenceState.Instance: + { + m_drawPreview = true; + m_drawPicker = false; + + if( m_referenceSampler != null ) + { + SetTitleTextOnCallback( m_referenceSampler.PreviewTextProp.TitleContent.text, ( instance, newTitle ) => instance.TitleContent.text = newTitle + Constants.InstancePostfixStr ); + SetAdditonalTitleText( m_referenceSampler.PreviewTextProp.AdditonalTitleContent.text ); + } + + // Draw chain lock + GUI.Label( m_iconPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ) ); + + // Draw frame around preview + GUI.Label( m_previewRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); + } + break; + } + } + + protected void DrawTexturePicker( DrawInfo drawInfo ) + { + Rect newRect = m_previewRect; + Texture2DArray currentValue = m_materialMode ? m_materialTextureArray : m_defaultTextureArray; + + if( currentValue == null ) + GUI.Label( newRect, string.Empty, UIUtils.ObjectFieldThumb ); + else + DrawPreview( drawInfo, m_previewRect ); + + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) + { + Rect butRect = m_previewRect; + butRect.y -= 1; + butRect.x += 1; + + Rect smallButton = newRect; + smallButton.height = 14 * drawInfo.InvertedZoom; + smallButton.y = newRect.yMax - smallButton.height - 2; + smallButton.width = 40 * drawInfo.InvertedZoom; + smallButton.x = newRect.xMax - smallButton.width - 2; + if( currentValue == null ) + { + GUI.Label( newRect, m_labelText, UIUtils.ObjectFieldThumbOverlay ); + } + else + { + DrawPreviewMaskButtonsRepaint( drawInfo, butRect ); + } + GUI.Label( smallButton, "Select", UIUtils.GetCustomStyle( CustomStyle.SamplerButton ) ); + } + + GUI.Label( newRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + + OnPropertyNameChanged(); + + if( CheckReference() ) + { + OrderIndex = m_referenceSampler.RawOrderIndex; + OrderIndexOffset = m_referenceSampler.OrderIndexOffset; + } + + bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ); + + bool instanced = false; + + if( m_referenceType == TexReferenceType.Instance && m_referenceSampler != null ) + instanced = true; + + if( instanced ) + { + if( !m_referenceSampler.TexPort.IsConnected ) + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + else if( !m_texPort.IsConnected ) + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + + string level = string.Empty; + if( m_lodPort.Visible ) + { + level = m_lodPort.GeneratePortInstructions( ref dataCollector ); + } + + if( isVertex && !m_lodPort.Visible ) + level = "0"; + + string propertyName = string.Empty; + if( instanced ) + { + if( m_referenceSampler.TexPort.IsConnected ) + propertyName = m_referenceSampler.TexPort.GeneratePortInstructions( ref dataCollector ); + else + propertyName = m_referenceSampler.PropertyName; + } + else if( m_texPort.IsConnected ) + propertyName = m_texPort.GeneratePortInstructions( ref dataCollector ); + else + propertyName = PropertyName; + + string uvs = string.Empty; + if( m_uvPort.IsConnected ) + { + uvs = m_uvPort.GeneratePortInstructions( ref dataCollector ); + } + else + { + if( dataCollector.IsTemplate ) + { + uvs = dataCollector.TemplateDataCollectorInstance.GetTextureCoord( m_uvSet, propertyName/*( instanced ? m_referenceSampler.PropertyName : PropertyName )*/, UniqueId, CurrentPrecisionType ); + } + else + { + if( isVertex ) + uvs = TexCoordVertexDataNode.GenerateVertexUVs( ref dataCollector, UniqueId, m_uvSet, propertyName ); + else + uvs = TexCoordVertexDataNode.GenerateFragUVs( ref dataCollector, UniqueId, m_uvSet, propertyName ); + } + } + string index = m_indexPort.GeneratePortInstructions( ref dataCollector ); + + string result = string.Empty; + + if( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + //CAREFUL mipbias here means derivative (this needs index changes) + //TODO: unity now supports bias as well + if( m_mipMode == MipType.MipBias ) + { + GeneratorUtils.AddCustomArraySamplingMacros( ref dataCollector ); + result = propertyName + ".SampleGrad(sampler" + propertyName + ", float3(" + uvs + ", " + index + "), " + m_ddxPort.GeneratePortInstructions( ref dataCollector ) + ", " + m_ddyPort.GeneratePortInstructions( ref dataCollector ) + ");"; + } + else if( m_lodPort.Visible || isVertex ) + { + result = "SAMPLE_TEXTURE2D_ARRAY_LOD(" + propertyName + ", sampler" + propertyName + ", " + uvs + ", " + index + ", " + level + " )"; + } + else + { + result = "SAMPLE_TEXTURE2D_ARRAY(" + propertyName + ", sampler" + propertyName + ", " + uvs + ", " + index + " )"; + } + } + else + { + //CAREFUL mipbias here means derivative (this needs index changes) + if( m_mipMode == MipType.MipBias ) + { + GeneratorUtils.AddCustomArraySamplingMacros( ref dataCollector ); + result = "ASE_SAMPLE_TEX2DARRAY_GRAD(" + propertyName + ", float3(" + uvs + ", " + index + "), " + m_ddxPort.GeneratePortInstructions( ref dataCollector ) + ", " + m_ddyPort.GeneratePortInstructions( ref dataCollector ) + " )"; + } + else if( m_lodPort.Visible || isVertex ) + { + result = "UNITY_SAMPLE_TEX2DARRAY_LOD(" + propertyName + ", float3(" + uvs + ", " + index + "), " + level + " )"; + } + else + { + result = "UNITY_SAMPLE_TEX2DARRAY" + ( m_lodPort.Visible || isVertex ? "_LOD" : "" ) + "(" + propertyName + ", float3(" + uvs + ", " + index + ") " + ( m_lodPort.Visible || isVertex ? ", " + level : "" ) + " )"; + } + } + + if( m_autoUnpackNormals ) + { + bool isScaledNormal = false; + if( m_normalPort.IsConnected ) + { + isScaledNormal = true; + } + else + { + if( m_normalPort.FloatInternalData != 1 ) + { + isScaledNormal = true; + } + } + + string scaleValue = isScaledNormal ? m_normalPort.GeneratePortInstructions( ref dataCollector ) : "1.0"; + result = GeneratorUtils.GenerateUnpackNormalStr( ref dataCollector, CurrentPrecisionType, UniqueId, OutputId, result, isScaledNormal, scaleValue, UnpackInputMode.Tangent ); + if( isScaledNormal && ( !dataCollector.IsTemplate || !dataCollector.IsSRP ) ) + { + dataCollector.AddToIncludes( UniqueId, Constants.UnityStandardUtilsLibFuncs ); + } + } + + RegisterLocalVariable( 0, result, ref dataCollector, "texArray" + OutputId ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + + public override string PropertyName + { + get + { + if( m_referenceType == TexReferenceType.Instance && m_referenceSampler != null ) + return m_referenceSampler.PropertyName; + else + return base.PropertyName; + } + } + + public override string PropertyInspectorName + { + get + { + if( m_referenceType == TexReferenceType.Instance && m_referenceSampler != null ) + return m_referenceSampler.PropertyInspectorName; + else + return base.PropertyInspectorName; + } + } + + public override string GetPropertyValue() + { + return PropertyAttributes + PropertyName + "(\"" + PropertyInspectorName + "\", 2DArray ) = \"\" {}"; + } + + public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) + { + MasterNode currMasterNode = ( m_containerGraph.CurrentMasterNode != null ) ? m_containerGraph.CurrentMasterNode : m_containerGraph.ParentWindow.OutsideGraph.CurrentMasterNode; + if( currMasterNode != null && currMasterNode.CurrentDataCollector.IsTemplate && currMasterNode.CurrentDataCollector.IsSRP ) + { + dataType = "TEXTURE2D_ARRAY( " + PropertyName + ""; + dataName = ");\nuniform SAMPLER( sampler" + PropertyName + " )"; + return true; + } + dataType = "UNITY_DECLARE_TEX2DARRAY("; + dataName = PropertyName + " )"; + return true; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + string textureName = GetCurrentParam( ref nodeParams ); + m_defaultTextureArray = AssetDatabase.LoadAssetAtPath( textureName ); + m_uvSet = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_referenceType = (TexReferenceType)Enum.Parse( typeof( TexReferenceType ), GetCurrentParam( ref nodeParams ) ); + m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 3202 ) + m_mipMode = (MipType)Enum.Parse( typeof( MipType ), GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 5105 ) + m_autoUnpackNormals = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + + if( m_referenceType == TexReferenceType.Instance ) + { + UIUtils.UnregisterTextureArrayNode( this ); + UIUtils.UnregisterPropertyNode( this ); + } + + ConfigureInputPorts(); + ConfigureOutputPorts(); + + m_lodPort.Visible = ( m_mipMode == MipType.MipLevel ); + m_ddxPort.Visible = ( m_mipMode == MipType.MipBias ); //not really bias, it's derivative + m_ddyPort.Visible = ( m_mipMode == MipType.MipBias ); //not really bias, it's derivative + + UpdateHeaderColor(); + + if( m_defaultTextureArray ) + { + m_materialTextureArray = m_defaultTextureArray; + } + + if( !m_isNodeBeingCopied && m_referenceType == TexReferenceType.Object ) + { + ContainerGraph.TextureArrayNodes.UpdateDataOnNode( UniqueId, DataToArray ); + } + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + + m_referenceSampler = UIUtils.GetNode( m_referenceNodeId ) as TextureArrayNode; + m_referenceArrayId = UIUtils.GetTextureArrayNodeRegisterId( m_referenceNodeId ); + OnPropertyNameChanged(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_defaultTextureArray != null ) ? AssetDatabase.GetAssetPath( m_defaultTextureArray ) : Constants.NoStringValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_uvSet.ToString() ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceType ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( ( m_referenceSampler != null ) ? m_referenceSampler.UniqueId : -1 ) ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_mipMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_autoUnpackNormals ); + } + + public override void ReadAdditionalClipboardData( ref string[] nodeParams ) + { + base.ReadAdditionalClipboardData( ref nodeParams ); + string textureName = GetCurrentParam( ref nodeParams ); + m_materialTextureArray = AssetDatabase.LoadAssetAtPath( textureName ); + } + + public override void WriteAdditionalClipboardData( ref string nodeInfo ) + { + base.WriteAdditionalClipboardData( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_materialTextureArray != null ) ? AssetDatabase.GetAssetPath( m_materialTextureArray ) : Constants.NoStringValue ); + } + + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction && m_referenceType == TexReferenceType.Object ) + { + OnPropertyNameChanged(); + if( mat.HasProperty( PropertyName ) ) + { + mat.SetTexture( PropertyName, m_materialTextureArray ); + } + } + } + + public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) + { + base.SetMaterialMode( mat, fetchMaterialValues ); + if( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) ) + { + if( mat.HasProperty( PropertyName ) ) + { + m_materialTextureArray = (Texture2DArray)mat.GetTexture( PropertyName ); + if( m_materialTextureArray == null ) + m_materialTextureArray = m_defaultTextureArray; + } + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( PropertyName ) ) + { + m_materialTextureArray = (Texture2DArray)material.GetTexture( PropertyName ); + if( m_materialTextureArray == null ) + m_materialTextureArray = m_defaultTextureArray; + + PreviewIsDirty = true; + } + } + + public override bool UpdateShaderDefaults( ref Shader shader, ref TextureDefaultsDataColector defaultCol ) + { + if( m_defaultTextureArray != null ) + { + defaultCol.AddValue( PropertyName, m_defaultTextureArray ); + } + + return true; + } + + public override string GetPropertyValStr() + { + return m_materialMode ? ( m_materialTextureArray != null ? m_materialTextureArray.name : IOUtils.NO_TEXTURES ) : ( m_defaultTextureArray != null ? m_defaultTextureArray.name : IOUtils.NO_TEXTURES ); + } + + public bool CheckReference() + { + if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 ) + { + m_referenceSampler = UIUtils.GetTextureArrayNode( m_referenceArrayId ); + + if( m_referenceSampler == null ) + { + m_texPort.Locked = false; + m_referenceArrayId = -1; + } + else + m_texPort.Locked = true; + } + else + { + m_texPort.Locked = false; + } + + return m_referenceSampler != null; + } + + public override void SetupFromCastObject( UnityEngine.Object obj ) + { + base.SetupFromCastObject( obj ); + SetupFromObject( obj ); + } + + public override void OnObjectDropped( UnityEngine.Object obj ) + { + SetupFromObject( obj ); + } + + private void SetupFromObject( UnityEngine.Object obj ) + { + if( m_materialMode ) + m_materialTextureArray = obj as Texture2DArray; + else + m_defaultTextureArray = obj as Texture2DArray; + } + + public Texture2DArray TextureArray { get { return ( m_materialMode ? m_materialTextureArray : m_defaultTextureArray ); } } + + public bool IsLinearTexture { get { return m_linearTexture; } } + + public bool AutoUnpackNormals + { + get { return m_autoUnpackNormals; } + set { m_autoUnpackNormals = value; } + } + + public override string DataToArray { get { return PropertyInspectorName; } } + + public override void Destroy() + { + base.Destroy(); + m_defaultTextureArray = null; + m_materialTextureArray = null; + + m_texPort = null; + m_uvPort = null; + m_indexPort = null; + m_lodPort = null; + m_normalPort = null; + m_ddxPort = null; + m_ddyPort = null; + + if( m_referenceType == TexReferenceType.Object ) + { + UIUtils.UnregisterTextureArrayNode( this ); + UIUtils.UnregisterPropertyNode( this ); + } + + if( UniqueId > -1 ) + ContainerGraph.TextureArrayNodes.OnReorderEventComplete -= OnReorderEventComplete; + } + + public ParentNode PreviewTextProp { get { return m_previewTextProp; } } + public InputPort TexPort { get { return m_texPort; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs.meta new file mode 100644 index 00000000..8ef67f1b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3c5be6f9c03445d4fb70955f594877dc +timeCreated: 1485801067 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs new file mode 100644 index 00000000..150a68ba --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs @@ -0,0 +1,303 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Vector2", "Constants And Properties", "Vector2 property", null, KeyCode.Alpha2 )] + public sealed class Vector2Node : PropertyNode + { + [SerializeField] + private Vector2 m_defaultValue = Vector2.zero; + + [SerializeField] + private Vector2 m_materialValue = Vector2.zero; + + private const float LabelWidth = 8; + + private int m_cachedPropertyId = -1; + + private bool m_isEditingFields; + private Vector2 m_previousValue = Vector2.zero; + private string[] m_fieldText = new string[] { "0", "0" }; + + public Vector2Node() : base() { } + public Vector2Node( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Vector" ); + m_insideSize.Set(50,20); + m_selectedLocation = PreviewLocation.BottomCenter; + AddOutputVectorPorts( WirePortDataType.FLOAT2, "XY" ); + m_availableAttribs.Add( new PropertyAttributes( "Remap Sliders", "[RemapSliders]" ) ); + m_previewShaderGUID = "88b4191eb06084d4da85d1dd2f984085"; + m_srpBatcherCompatible = true; + m_showHybridInstancedUI = true; + } + + public override void CopyDefaultsToMaterial() + { + m_materialValue = m_defaultValue; + } + + public override void DrawSubProperties() + { + m_defaultValue = EditorGUILayoutVector2Field( Constants.DefaultValueLabel, m_defaultValue ); + } + + public override void DrawMaterialProperties() + { + if ( m_materialMode ) + EditorGUI.BeginChangeCheck(); + + m_materialValue = EditorGUILayoutVector2Field( Constants.MaterialValueLabel, m_materialValue ); + if ( m_materialMode && EditorGUI.EndChangeCheck() ) + m_requireMaterialUpdate = true; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if ( m_cachedPropertyId == -1 ) + m_cachedPropertyId = Shader.PropertyToID( "_InputVector" ); + + if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) + PreviewMaterial.SetVector( m_cachedPropertyId, new Vector4( m_materialValue[ 0 ], m_materialValue[ 1 ], 0, 0 ) ); + else + PreviewMaterial.SetVector( m_cachedPropertyId, new Vector4( m_defaultValue[ 0 ], m_defaultValue[ 1 ], 0, 0 ) ); + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + + m_propertyDrawPos = m_remainingBox; + m_propertyDrawPos.x = m_remainingBox.x - LabelWidth * drawInfo.InvertedZoom; + m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; + m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if ( drawInfo.CurrentEventType != EventType.MouseDown ) + return; + + Rect hitBox = m_remainingBox; + hitBox.xMin -= LabelWidth * drawInfo.InvertedZoom; + bool insideBox = hitBox.Contains( drawInfo.MousePosition ); + + if ( insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = true; + } + else if ( m_isEditingFields && !insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = false; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if ( !m_isVisible ) + return; + + if ( m_isEditingFields && m_currentParameterType != PropertyType.Global) + { + EditorGUI.BeginChangeCheck(); + for ( int i = 0; i < 2; i++ ) + { + m_propertyDrawPos.y = m_outputPorts[ i + 1 ].Position.y - 2 * drawInfo.InvertedZoom; + if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) + { + float val = m_materialValue[ i ]; + UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref val, LabelWidth * drawInfo.InvertedZoom ); + m_materialValue[ i ] = val; + } + else + { + float val = m_defaultValue[ i ]; + UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref val, LabelWidth * drawInfo.InvertedZoom ); + m_defaultValue[ i ] = val; + } + } + if ( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + m_requireMaterialUpdate = m_materialMode; + BeginDelayedDirtyProperty(); + } + } + else if ( drawInfo.CurrentEventType == EventType.Repaint && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) + { + bool guiEnabled = GUI.enabled; + GUI.enabled = m_currentParameterType != PropertyType.Global; + for ( int i = 0; i < 2; i++ ) + { + m_propertyDrawPos.y = m_outputPorts[ i + 1 ].Position.y - 2 * drawInfo.InvertedZoom; + + Rect fakeField = m_propertyDrawPos; + fakeField.xMin += LabelWidth * drawInfo.InvertedZoom; + if( GUI.enabled ) + { + Rect fakeLabel = m_propertyDrawPos; + fakeLabel.xMax = fakeField.xMin; + EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); + EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); + } + if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) + { + if ( m_previousValue[ i ] != m_materialValue[ i ] ) + { + m_previousValue[ i ] = m_materialValue[ i ]; + m_fieldText[ i ] = m_materialValue[ i ].ToString(); + } + } + else + { + if ( m_previousValue[ i ] != m_defaultValue[ i ] ) + { + m_previousValue[ i ] = m_defaultValue[ i ]; + m_fieldText[ i ] = m_defaultValue[ i ].ToString(); + } + } + + GUI.Label( fakeField, m_fieldText[ i ], UIUtils.MainSkin.textField ); + } + GUI.enabled = guiEnabled; + } + } + + public override void ConfigureLocalVariable( ref MasterNodeDataCollector dataCollector ) + { + Vector2 value = m_defaultValue; + dataCollector.AddLocalVariable( UniqueId, CreateLocalVarDec( value.x + "," + value.y ) ); + m_outputPorts[ 0 ].SetLocalValue( m_propertyName, dataCollector.PortCategory ); + m_outputPorts[ 1 ].SetLocalValue( m_propertyName + ".x" , dataCollector.PortCategory); + m_outputPorts[ 2 ].SetLocalValue( m_propertyName + ".y", dataCollector.PortCategory ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId,ref dataCollector, ignoreLocalvar ); + m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + if ( m_currentParameterType != PropertyType.Constant ) + return GetOutputVectorItem( 0, outputId, PropertyData( dataCollector.PortCategory ) ); + + if ( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) + { + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + + if ( CheckLocalVariable( ref dataCollector ) ) + { + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + + Vector2 value = m_defaultValue; + string result = string.Empty; + switch ( outputId ) + { + case 0: + { + result = m_precisionString+"( " + value.x + "," + value.y + " )"; + } + break; + + case 1: + { + result = value.x.ToString(); + } + break; + case 2: + { + result = value.y.ToString(); + } + break; + } + + if ( result.Equals( string.Empty ) ) + { + UIUtils.ShowMessage( UniqueId, "Vector2Node generating empty code", MessageSeverity.Warning ); + } + return result; + } + + public override string GetPropertyValue() + { + string x = UIUtils.PropertyFloatToString( m_defaultValue.x ); + string y = UIUtils.PropertyFloatToString( m_defaultValue.y ); + return PropertyAttributes + m_propertyName + "(\"" + m_propertyInspectorName + "\", Vector) = (" + x + "," + y + ",0,0)"; + } + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + if ( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) + { + mat.SetVector( m_propertyName, m_materialValue ); + } + } + + public override void SetMaterialMode( Material mat , bool fetchMaterialValues ) + { + base.SetMaterialMode( mat , fetchMaterialValues ); + if ( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) + { + m_materialValue = mat.GetVector( m_propertyName ); + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) + { + m_materialValue = material.GetVector( m_propertyName ); + PreviewIsDirty = true; + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_defaultValue = IOUtils.StringToVector2( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 14101 ) + m_materialValue = IOUtils.StringToVector2( GetCurrentParam( ref nodeParams ) ); + } + + public override void SetGlobalValue() { Shader.SetGlobalVector( m_propertyName, m_defaultValue ); } + public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalVector( m_propertyName ); } + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector2ToString( m_defaultValue ) ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector2ToString( m_materialValue ) ); + } + + public override string GetPropertyValStr() + { + return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? m_materialValue.x.ToString( Mathf.Abs( m_materialValue.x ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_materialValue.y.ToString( Mathf.Abs( m_materialValue.y ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) : + m_defaultValue.x.ToString( Mathf.Abs( m_defaultValue.x ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_defaultValue.y.ToString( Mathf.Abs( m_defaultValue.y ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ); + } + + public Vector2 Value + { + get { return m_defaultValue; } + set { m_defaultValue = value; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs.meta new file mode 100644 index 00000000..8e9a3506 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6ca8f5d67cf4c5f428a6dd646099897c +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs new file mode 100644 index 00000000..1ac00719 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs @@ -0,0 +1,318 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Vector3", "Constants And Properties", "Vector3 property", null, KeyCode.Alpha3 )] + public sealed class Vector3Node : PropertyNode + { + [SerializeField] + private Vector3 m_defaultValue = Vector3.zero; + + [SerializeField] + private Vector3 m_materialValue = Vector3.zero; + + private const float LabelWidth = 8; + + private int m_cachedPropertyId = -1; + + public Vector3Node() : base() { } + public Vector3Node( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Vector" ); + m_insideSize.Set( 50, 30 ); + m_selectedLocation = PreviewLocation.BottomCenter; + AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); + m_previewShaderGUID = "8a44d38f06246bf48944b3f314bc7920"; + m_srpBatcherCompatible = true; + m_showHybridInstancedUI = true; + } + + public override void CopyDefaultsToMaterial() + { + m_materialValue = m_defaultValue; + } + + public override void DrawSubProperties() + { + m_defaultValue = EditorGUILayoutVector3Field( Constants.DefaultValueLabel, m_defaultValue ); + } + + public override void DrawMaterialProperties() + { + EditorGUI.BeginChangeCheck(); + + m_materialValue = EditorGUILayoutVector3Field( Constants.MaterialValueLabel, m_materialValue ); + + if( EditorGUI.EndChangeCheck() ) + { + //MarkForPreviewUpdate(); + if( m_materialMode ) + m_requireMaterialUpdate = true; + } + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_cachedPropertyId == -1 ) + m_cachedPropertyId = Shader.PropertyToID( "_InputVector" ); + + if( m_materialMode && m_currentParameterType != PropertyType.Constant ) + PreviewMaterial.SetVector( m_cachedPropertyId, new Vector4( m_materialValue[ 0 ], m_materialValue[ 1 ], m_materialValue[ 2 ], 0 ) ); + else + PreviewMaterial.SetVector( m_cachedPropertyId, new Vector4( m_defaultValue[ 0 ], m_defaultValue[ 1 ], m_defaultValue[ 2 ], 0 ) ); + } + + private bool m_isEditingFields; + private Vector3 m_previousValue = Vector3.zero; + private string[] m_fieldText = new string[] { "0", "0", "0" }; + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( !m_isVisible ) + return; + + if( m_isEditingFields && m_currentParameterType != PropertyType.Global) + { + EditorGUI.BeginChangeCheck(); + for( int i = 0; i < 3; i++ ) + { + m_propertyDrawPos.y = m_outputPorts[ i + 1 ].Position.y - 2 * drawInfo.InvertedZoom; + if( m_materialMode && m_currentParameterType != PropertyType.Constant ) + { + float val = m_materialValue[ i ]; + UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref val, LabelWidth * drawInfo.InvertedZoom ); + m_materialValue[ i ] = val; + } + else + { + float val = m_defaultValue[ i ]; + UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref val, LabelWidth * drawInfo.InvertedZoom ); + m_defaultValue[ i ] = val; + } + } + if( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + m_requireMaterialUpdate = m_materialMode; + BeginDelayedDirtyProperty(); + } + } + else if( drawInfo.CurrentEventType == EventType.Repaint && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) + { + bool guiEnabled = GUI.enabled; + GUI.enabled = m_currentParameterType != PropertyType.Global; + + for( int i = 0; i < 3; i++ ) + { + m_propertyDrawPos.y = m_outputPorts[ i + 1 ].Position.y - 2 * drawInfo.InvertedZoom; + + Rect fakeField = m_propertyDrawPos; + fakeField.xMin += LabelWidth * drawInfo.InvertedZoom; + if( GUI.enabled ) + { + Rect fakeLabel = m_propertyDrawPos; + fakeLabel.xMax = fakeField.xMin; + EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); + EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); + } + + if( m_materialMode && m_currentParameterType != PropertyType.Constant ) + { + if( m_previousValue[ i ] != m_materialValue[ i ] ) + { + m_previousValue[ i ] = m_materialValue[ i ]; + m_fieldText[ i ] = m_materialValue[ i ].ToString(); + } + } + else + { + if( m_previousValue[ i ] != m_defaultValue[ i ] ) + { + m_previousValue[ i ] = m_defaultValue[ i ]; + m_fieldText[ i ] = m_defaultValue[ i ].ToString(); + } + } + + GUI.Label( fakeField, m_fieldText[ i ], UIUtils.MainSkin.textField ); + } + GUI.enabled = guiEnabled; + } + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + + m_propertyDrawPos = m_remainingBox; + m_propertyDrawPos.x = m_remainingBox.x - LabelWidth * drawInfo.InvertedZoom; + m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; + m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if( drawInfo.CurrentEventType != EventType.MouseDown ) + return; + + Rect hitBox = m_remainingBox; + hitBox.xMin -= LabelWidth * drawInfo.InvertedZoom; + bool insideBox = hitBox.Contains( drawInfo.MousePosition ); + + if( insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = true; + } + else if( m_isEditingFields && !insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = false; + } + } + + public override void ConfigureLocalVariable( ref MasterNodeDataCollector dataCollector ) + { + Vector3 value = m_defaultValue; + dataCollector.AddLocalVariable( UniqueId, CreateLocalVarDec( value.x + "," + value.y + "," + value.z ) ); + m_outputPorts[ 0 ].SetLocalValue( m_propertyName , dataCollector.PortCategory ); + m_outputPorts[ 1 ].SetLocalValue( m_propertyName + ".x" , dataCollector.PortCategory ); + m_outputPorts[ 2 ].SetLocalValue( m_propertyName + ".y" , dataCollector.PortCategory ); + m_outputPorts[ 3 ].SetLocalValue( m_propertyName + ".z", dataCollector.PortCategory ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + if( m_currentParameterType != PropertyType.Constant ) + return GetOutputVectorItem( 0, outputId, PropertyData( dataCollector.PortCategory ) ); + + if( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) + { + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + + if( CheckLocalVariable( ref dataCollector ) ) + { + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + + Vector3 value = m_defaultValue; + string result = string.Empty; + switch( outputId ) + { + case 0: + { + result = m_precisionString + "(" + value.x + "," + value.y + "," + value.z + ")"; + } + break; + + case 1: + { + result = value.x.ToString(); + } + break; + case 2: + { + result = value.y.ToString(); + } + break; + case 3: + { + result = value.z.ToString(); + } + break; + } + + if( result.Equals( string.Empty ) ) + { + UIUtils.ShowMessage( UniqueId, "Vector3Node generating empty code", MessageSeverity.Warning ); + } + return result; + } + + public override string GetPropertyValue() + { + string x = UIUtils.PropertyFloatToString( m_defaultValue.x ); + string y = UIUtils.PropertyFloatToString( m_defaultValue.y ); + string z = UIUtils.PropertyFloatToString( m_defaultValue.z ); + return PropertyAttributes + m_propertyName + "(\"" + m_propertyInspectorName + "\", Vector) = (" + x + "," + y + "," + z + ",0)"; + } + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) + { + mat.SetVector( m_propertyName, m_materialValue ); + } + } + + public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) + { + base.SetMaterialMode( mat, fetchMaterialValues ); + if( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) + { + m_materialValue = mat.GetVector( m_propertyName ); + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) + { + m_materialValue = material.GetVector( m_propertyName ); + PreviewIsDirty = true; + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_defaultValue = IOUtils.StringToVector3( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 14101 ) + m_materialValue = IOUtils.StringToVector3( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector3ToString( m_defaultValue ) ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector3ToString( m_materialValue ) ); + } + + public override void SetGlobalValue() { Shader.SetGlobalVector( m_propertyName, m_defaultValue ); } + public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalVector( m_propertyName ); } + + public override string GetPropertyValStr() + { + return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? m_materialValue.x.ToString( Mathf.Abs( m_materialValue.x ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_materialValue.y.ToString( Mathf.Abs( m_materialValue.y ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_materialValue.z.ToString( Mathf.Abs( m_materialValue.z ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) : + m_defaultValue.x.ToString( Mathf.Abs( m_defaultValue.x ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_defaultValue.y.ToString( Mathf.Abs( m_defaultValue.y ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_defaultValue.z.ToString( Mathf.Abs( m_defaultValue.z ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ); + } + + public Vector3 Value + { + get { return m_defaultValue; } + set { m_defaultValue = value; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs.meta new file mode 100644 index 00000000..472ee4b6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 943f4b4fc1fa5214b8934bf4fb76474b +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs new file mode 100644 index 00000000..658d8195 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs @@ -0,0 +1,325 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Vector4", "Constants And Properties", "Vector4 property", null, KeyCode.Alpha4 )] + public sealed class Vector4Node : PropertyNode + { + [SerializeField] + private Vector4 m_defaultValue = Vector4.zero; + + [SerializeField] + private Vector4 m_materialValue = Vector4.zero; + + private const float LabelWidth = 8; + + private int m_cachedPropertyId = -1; + + private bool m_isEditingFields; + private Vector4 m_previousValue = Vector4.zero; + private string[] m_fieldText = new string[] { "0", "0", "0", "0" }; + + public Vector4Node() : base() { } + public Vector4Node( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Vector" ); + m_insideSize.Set( 50, 40 ); + m_selectedLocation = PreviewLocation.BottomCenter; + AddOutputVectorPorts( WirePortDataType.FLOAT4, "XYZW" ); + m_previewShaderGUID = "aac241d0e47a5a84fbd2edcd640788dc"; + m_availableAttribs.Add( new PropertyAttributes( "Remap Sliders", "[RemapSlidersFull]" ) ); + m_srpBatcherCompatible = true; + m_showHybridInstancedUI = true; + } + + public override void CopyDefaultsToMaterial() + { + m_materialValue = m_defaultValue; + } + + public override void DrawSubProperties() + { + m_defaultValue = EditorGUILayoutVector4Field( Constants.DefaultValueLabel, m_defaultValue ); + } + + public override void DrawMaterialProperties() + { + if ( m_materialMode ) + EditorGUI.BeginChangeCheck(); + + m_materialValue = EditorGUILayoutVector4Field( Constants.MaterialValueLabel, m_materialValue ); + if ( m_materialMode && EditorGUI.EndChangeCheck() ) + m_requireMaterialUpdate = true; + + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if ( m_cachedPropertyId == -1 ) + m_cachedPropertyId = Shader.PropertyToID( "_InputVector" ); + + if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) + PreviewMaterial.SetVector( m_cachedPropertyId, new Vector4( m_materialValue[ 0 ], m_materialValue[ 1 ], m_materialValue[ 2 ], m_materialValue[ 3 ] ) ); + else + PreviewMaterial.SetVector( m_cachedPropertyId, new Vector4( m_defaultValue[ 0 ], m_defaultValue[ 1 ], m_defaultValue[ 2 ], m_defaultValue[ 3 ] ) ); + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + + m_propertyDrawPos = m_remainingBox; + m_propertyDrawPos.x = m_remainingBox.x - LabelWidth * drawInfo.InvertedZoom; + m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; + m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if ( drawInfo.CurrentEventType != EventType.MouseDown ) + return; + + Rect hitBox = m_remainingBox; + hitBox.xMin -= LabelWidth * drawInfo.InvertedZoom; + bool insideBox = hitBox.Contains( drawInfo.MousePosition ); + + if ( insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = true; + } + else if ( m_isEditingFields && !insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = false; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if ( !m_isVisible ) + return; + + if ( m_isEditingFields && m_currentParameterType != PropertyType.Global ) + { + EditorGUI.BeginChangeCheck(); + for ( int i = 0; i < 4; i++ ) + { + m_propertyDrawPos.y = m_outputPorts[ i + 1 ].Position.y - 2 * drawInfo.InvertedZoom; + if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) + { + float val = m_materialValue[ i ]; + UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref val, LabelWidth * drawInfo.InvertedZoom ); + m_materialValue[ i ] = val; + } + else + { + float val = m_defaultValue[ i ]; + UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref val, LabelWidth * drawInfo.InvertedZoom ); + m_defaultValue[ i ] = val; + } + } + if ( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + m_requireMaterialUpdate = m_materialMode; + BeginDelayedDirtyProperty(); + //m_propertyNameIsDirty = true; + } + } + else if ( drawInfo.CurrentEventType == EventType.Repaint && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) + { + bool guiEnabled = GUI.enabled; + GUI.enabled = m_currentParameterType != PropertyType.Global; + + for( int i = 0; i < 4; i++ ) + { + m_propertyDrawPos.y = m_outputPorts[ i + 1 ].Position.y - 2 * drawInfo.InvertedZoom; + + Rect fakeField = m_propertyDrawPos; + fakeField.xMin += LabelWidth * drawInfo.InvertedZoom; + if( GUI.enabled ) + { + Rect fakeLabel = m_propertyDrawPos; + fakeLabel.xMax = fakeField.xMin; + EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); + EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); + } + if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) + { + if ( m_previousValue[ i ] != m_materialValue[ i ] ) + { + m_previousValue[ i ] = m_materialValue[ i ]; + m_fieldText[ i ] = m_materialValue[ i ].ToString(); + } + } + else + { + if ( m_previousValue[ i ] != m_defaultValue[ i ] ) + { + m_previousValue[ i ] = m_defaultValue[ i ]; + m_fieldText[ i ] = m_defaultValue[ i ].ToString(); + } + } + + GUI.Label( fakeField, m_fieldText[ i ], UIUtils.MainSkin.textField ); + } + GUI.enabled = guiEnabled; + } + } + + public override void ConfigureLocalVariable( ref MasterNodeDataCollector dataCollector ) + { + Vector4 value = m_defaultValue; + dataCollector.AddLocalVariable( UniqueId, CreateLocalVarDec( value.x + "," + value.y + "," + value.z + "," + value.w ) ); + m_outputPorts[ 0 ].SetLocalValue( m_propertyName, dataCollector.PortCategory ); + m_outputPorts[ 1 ].SetLocalValue( m_propertyName + ".x" , dataCollector.PortCategory ); + m_outputPorts[ 2 ].SetLocalValue( m_propertyName + ".y" , dataCollector.PortCategory ); + m_outputPorts[ 3 ].SetLocalValue( m_propertyName + ".z" , dataCollector.PortCategory ); + m_outputPorts[ 4 ].SetLocalValue( m_propertyName + ".w", dataCollector.PortCategory ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + if ( m_currentParameterType != PropertyType.Constant ) + return GetOutputVectorItem( 0, outputId, PropertyData( dataCollector.PortCategory ) ); + + if ( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) + { + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + + if ( CheckLocalVariable( ref dataCollector ) ) + { + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + + Vector4 value = m_defaultValue; + string result = string.Empty; + switch ( outputId ) + { + case 0: + { + result = m_precisionString+"(" + value.x + "," + value.y + "," + value.z + "," + value.w + ")"; + } + break; + + case 1: + { + result = value.x.ToString(); + } + break; + case 2: + { + result = value.y.ToString(); + } + break; + case 3: + { + result = value.z.ToString(); + } + break; + case 4: + { + result = value.w.ToString(); + } + break; + } + + if ( result.Equals( string.Empty ) ) + { + UIUtils.ShowMessage( UniqueId, "Vector4Node generating empty code", MessageSeverity.Warning ); + } + return result; + } + + public override string GetPropertyValue() + { + string x = UIUtils.PropertyFloatToString( m_defaultValue.x ); + string y = UIUtils.PropertyFloatToString( m_defaultValue.y ); + string z = UIUtils.PropertyFloatToString( m_defaultValue.z ); + string w = UIUtils.PropertyFloatToString( m_defaultValue.w ); + return PropertyAttributes + m_propertyName + "(\"" + m_propertyInspectorName + "\", Vector) = (" + x + "," + y + "," + z + "," + w + ")"; + } + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + if ( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) + { + mat.SetVector( m_propertyName, m_materialValue ); + } + } + + public override void SetMaterialMode( Material mat , bool fetchMaterialValues ) + { + base.SetMaterialMode( mat , fetchMaterialValues ); + if ( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) + { + m_materialValue = mat.GetVector( m_propertyName ); + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) + { + m_materialValue = material.GetVector( m_propertyName ); + PreviewIsDirty = true; + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_defaultValue = IOUtils.StringToVector4( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 14101 ) + m_materialValue = IOUtils.StringToVector4( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector4ToString( m_defaultValue ) ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector4ToString( m_materialValue ) ); + } + + public override void SetGlobalValue() { Shader.SetGlobalVector( m_propertyName, m_defaultValue ); } + public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalVector( m_propertyName ); } + + public override string GetPropertyValStr() + { + return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? m_materialValue.x.ToString( Mathf.Abs( m_materialValue.x ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_materialValue.y.ToString( Mathf.Abs( m_materialValue.y ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_materialValue.z.ToString( Mathf.Abs( m_materialValue.z ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_materialValue.w.ToString( Mathf.Abs( m_materialValue.w ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) : + m_defaultValue.x.ToString( Mathf.Abs( m_defaultValue.x ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_defaultValue.y.ToString( Mathf.Abs( m_defaultValue.y ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_defaultValue.z.ToString( Mathf.Abs( m_defaultValue.z ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + + m_defaultValue.w.ToString( Mathf.Abs( m_defaultValue.w ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ); + } + + public Vector4 Value + { + get { return m_defaultValue; } + set { m_defaultValue = value; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs.meta new file mode 100644 index 00000000..7428cade --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3bc3c79c7cc57df49bedb9d9b64b0bea +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs new file mode 100644 index 00000000..c0570974 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs @@ -0,0 +1,19 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Custom Add Node", "Debug", "Custom Node Debug ( Only for debug purposes)", null, UnityEngine.KeyCode.None, false )] + public sealed class CustomAddNode : CustomNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputsFromString( "customOut0", "#IP2*(#IP0 + #IP1 / #IP2)" ); + AddOutputsFromString( "customOut1", "#IP3 + #IP0*#IP2 + #IP1 / #IP2" ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs.meta new file mode 100644 index 00000000..9ce5fb8f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6fdecc48f5be618428240490565e9d8b +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs new file mode 100644 index 00000000..bffd2b4f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs @@ -0,0 +1,183 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class CustomNodeOutputData + { + public string expression; + public string name; + public List inputData; + + public CustomNodeOutputData( string newName, string newExpression ) + { + name = newName; + expression = newExpression; + inputData = new List(); + } + public void Destroy() + { + inputData.Clear(); + inputData = null; + } + + public override string ToString() + { + string result = "name: " + name + " outputExpression: " + expression + '\n'; + for ( int i = 0; i < inputData.Count; i++ ) + { + result += inputData[ i ].ToString() + '\n'; + } + return result; + } + } + + [Serializable] + public class CustomNodeInputData + { + public int index; + public int length; + public string name; + public CustomNodeInputData( int newIndex, int newLength, string newName ) + { + index = newIndex; + length = newLength; + name = newName; + + } + + public override string ToString() + { + return "index: " + index + " length: " + length + " name: " + name; + } + } + + [Serializable] + public class CustomNode : ParentNode + { + [SerializeField] + private List m_includes; + + [SerializeField] + private List m_outputData; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_outputData = new List(); + } + + public void AddIncludes( string newInclude ) + { + m_includes.Add( newInclude ); + } + + protected void AddOutputsFromString( string outputName, string output ) + { + AddOutputPort( WirePortDataType.OBJECT, outputName ); + + CustomNodeOutputData currOutputData = new CustomNodeOutputData( outputName, output ); + + + // Get existing input nodes so we can test for duplicates + Dictionary existingPorts = InputPortsDict; + + // Create dictionary to prevent duplicates when dealing with expresssions with multiple occurences of an input + Dictionary inputDuplicatePrevention = new Dictionary(); + + + // Get all inputs on the expression and save their info + int[] indexes = output.AllIndexesOf( Constants.CNIP ); + for ( int i = 0; i < indexes.Length; i++ ) + { + string name = output.Substring( indexes[ i ], Constants.CNIP.Length + 1 ); + currOutputData.inputData.Add( new CustomNodeInputData( indexes[ i ], Constants.CNIP.Length + 1, name ) ); + + if ( !inputDuplicatePrevention.ContainsKey( name ) && !existingPorts.ContainsKey( name ) ) + { + inputDuplicatePrevention.Add( name, name ); + AddInputPort( WirePortDataType.OBJECT, false, name ); + } + } + + inputDuplicatePrevention.Clear(); + inputDuplicatePrevention = null; + + existingPorts.Clear(); + existingPorts = null; + + m_outputData.Add( currOutputData ); + + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + if ( outputId < m_outputData.Count ) + { + Dictionary inputs = InputPortsDict; + + string value = m_outputData[ outputId ].expression; + for ( int i = 0; i < m_outputData[ outputId ].inputData.Count; i++ ) + { + if ( inputs.ContainsKey( m_outputData[ outputId ].inputData[ i ].name ) ) + { + InputPort inputPort = inputs[ m_outputData[ outputId ].inputData[ i ].name ]; + if ( inputPort != null ) + { + string inputValue = inputPort.GenerateShaderForOutput( ref dataCollector, WirePortDataType.OBJECT, ignoreLocalvar ); + value = value.Replace( m_outputData[ outputId ].inputData[ i ].name, inputValue ); + } + else + { + UIUtils.ShowMessage( UniqueId, m_outputData[ outputId ].inputData[ i ].name + " invalid on the inputs list", MessageSeverity.Error ); + return string.Empty; + } + } + else + { + UIUtils.ShowMessage( UniqueId, m_outputData[ outputId ].inputData[ i ].name + " Not found on the inputs list", MessageSeverity.Error ); + return string.Empty; + } + } + return value; + + } + + return string.Empty; + } + public void DumpOutputData() + { + for ( int i = 0; i < m_outputData.Count; i++ ) + { + Debug.Log( m_outputData[ i ] ); + } + } + + public override void Destroy() + { + base.Destroy(); + + if ( m_outputData != null ) + { + for ( int i = 0; i < m_outputData.Count; i++ ) + { + m_outputData[ i ].Destroy(); + } + m_outputData.Clear(); + m_outputData = null; + } + if ( m_includes != null ) + { + m_includes.Clear(); + m_includes = null; + } + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs.meta new file mode 100644 index 00000000..1e0f5c0c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c89fd369755de3e49a669e8e5daa8c2f +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs new file mode 100644 index 00000000..6a423446 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs @@ -0,0 +1,19 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +namespace AmplifyShaderEditor +{ + public class DrawInfo + { + public Rect TransformedCameraArea; + public Rect CameraArea; + public Vector2 MousePosition; + public Vector2 CameraOffset; + public float InvertedZoom; + public bool LeftMouseButtonPressed; + public EventType CurrentEventType; + public Vector2 TransformedMousePos; + public bool ZoomChanged; + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs.meta new file mode 100644 index 00000000..35ce351c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 36f40ed0b172d8f45810b3f6b8e2243d +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs new file mode 100644 index 00000000..e227f66f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs @@ -0,0 +1,521 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class DynamicTypeNode : ParentNode + { + protected string m_inputA = string.Empty; + protected string m_inputB = string.Empty; + protected List m_extensibleInputResults; + protected bool m_dynamicOutputType = true; + + protected bool m_extensibleInputPorts = false; + protected bool m_allowMatrixCheck = false; + protected bool m_vectorMatrixOps = false; + //[SerializeField] + private int m_inputCount = 2; + + //[SerializeField] + private int m_lastInputCount = 2; + + private bool m_previouslyDragging = false; + private int m_beforePreviewCount = 0; + + [UnityEngine.SerializeField] + protected WirePortDataType m_mainDataType = WirePortDataType.FLOAT; + + protected WirePortDataType[] m_dynamicRestrictions = + { + WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT, + WirePortDataType.UINT + }; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_useInternalPortData = true; + m_textLabelWidth = 35; + AddPorts(); + } + + protected virtual void AddPorts() + { + AddInputPort( WirePortDataType.FLOAT, false, "A" ); + AddInputPort( WirePortDataType.FLOAT, false, "B" ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_inputPorts[ 0 ].CreatePortRestrictions( m_dynamicRestrictions ); + m_inputPorts[ 1 ].CreatePortRestrictions( m_dynamicRestrictions ); + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + UpdateConnection( inputPortId ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnection( portId ); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + UpdateDisconnectedConnection( portId ); + UpdateConnection( portId ); + UpdateEmptyInputPorts( true ); + } + + void UpdateDisconnectedConnection( int portId ) + { + if( m_extensibleInputPorts || m_allowMatrixCheck ) + { + int higher = 0; + int groupOneType = 0; + int groupTwoType = 0; + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + int currentPriority = UIUtils.GetPriority( m_inputPorts[ i ].DataType ); + if( !m_vectorMatrixOps && currentPriority < 3 ) + currentPriority += 7; + if( currentPriority > higher && currentPriority > 2 ) + { + higher = currentPriority; + m_mainDataType = m_inputPorts[ i ].DataType; + } + switch( m_inputPorts[ i ].DataType ) + { + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + { + groupOneType++; + groupTwoType++; + } + break; + case WirePortDataType.FLOAT3x3: + { + groupOneType++; + } + break; + case WirePortDataType.FLOAT4x4: + { + groupTwoType++; + } + break; + } + } + } + + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( !m_inputPorts[ i ].IsConnected ) + { + m_inputPorts[ i ].ChangeType( m_mainDataType, false ); + } + } + + if( groupOneType > 0 && m_mainDataType == WirePortDataType.FLOAT4x4 ) + { + m_errorMessageTooltip = "Doing this operation with FLOAT4x4 value only works against other FLOAT4x4 or FLOAT values"; + m_showErrorMessage = true; + } + else if( groupTwoType > 0 && m_mainDataType == WirePortDataType.FLOAT3x3 ) + { + m_errorMessageTooltip = "Doing this operation with FLOAT3x3 value only works against other FLOAT3x3 or FLOAT values"; + m_showErrorMessage = true; + } + else + { + m_showErrorMessage = false; + } + + if( m_dynamicOutputType ) + m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); + } + else + + if( m_inputPorts[ 0 ].DataType != m_inputPorts[ 1 ].DataType ) + { + int otherPortId = ( portId + 1 ) % 2; + if( m_inputPorts[ otherPortId ].IsConnected ) + { + m_mainDataType = m_inputPorts[ otherPortId ].DataType; + m_inputPorts[ portId ].ChangeType( m_mainDataType, false ); + if( m_dynamicOutputType ) + m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); + } + else + { + if( UIUtils.GetPriority( m_inputPorts[ 0 ].DataType ) > UIUtils.GetPriority( m_inputPorts[ 1 ].DataType ) ) + { + m_mainDataType = m_inputPorts[ 0 ].DataType; + m_inputPorts[ 1 ].ChangeType( m_mainDataType, false ); + } + else + { + m_mainDataType = m_inputPorts[ 1 ].DataType; + m_inputPorts[ 0 ].ChangeType( m_mainDataType, false ); + } + + if( m_dynamicOutputType ) + { + if( m_mainDataType != m_outputPorts[ 0 ].DataType ) + { + m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); + } + } + } + } + } + + void UpdateConnection( int portId ) + { + if( m_extensibleInputPorts || m_allowMatrixCheck ) + { + m_inputPorts[ portId ].MatchPortToConnection(); + + int higher = 0; + int groupOneType = 0; + int groupTwoType = 0; + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + int currentPriority = UIUtils.GetPriority( m_inputPorts[ i ].DataType ); + if( !m_vectorMatrixOps && currentPriority < 3 ) + currentPriority += 7; + if( currentPriority > higher ) + { + higher = currentPriority; + m_mainDataType = m_inputPorts[ i ].DataType; + } + switch( m_inputPorts[ i ].DataType ) + { + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + { + groupOneType++; + groupTwoType++; + } + break; + case WirePortDataType.FLOAT3x3: + { + groupOneType++; + } + break; + case WirePortDataType.FLOAT4x4: + { + groupTwoType++; + } + break; + } + } + } + + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( !m_inputPorts[ i ].IsConnected ) + { + m_inputPorts[ i ].ChangeType( m_mainDataType, false ); + } + } + if( groupOneType > 0 && m_mainDataType == WirePortDataType.FLOAT4x4 ) + { + m_errorMessageTooltip = "Doing this operation with FLOAT4x4 value only works against other FLOAT4x4 or FLOAT values"; + m_showErrorMessage = true; + } + else if( groupTwoType > 0 && m_mainDataType == WirePortDataType.FLOAT3x3 ) + { + m_errorMessageTooltip = "Doing this operation with FLOAT3x3 value only works against other FLOAT3x3 or FLOAT values"; + m_showErrorMessage = true; + } + else + { + m_showErrorMessage = false; + } + + if( m_dynamicOutputType ) + m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); + } + + else + { + m_inputPorts[ portId ].MatchPortToConnection(); + int otherPortId = ( portId + 1 ) % 2; + if( !m_inputPorts[ otherPortId ].IsConnected ) + { + m_inputPorts[ otherPortId ].ChangeType( m_inputPorts[ portId ].DataType, false ); + } + + if( m_inputPorts[ 0 ].DataType == m_inputPorts[ 1 ].DataType ) + { + m_mainDataType = m_inputPorts[ 0 ].DataType; + if( m_dynamicOutputType ) + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + else + { + if( UIUtils.GetPriority( m_inputPorts[ 0 ].DataType ) > UIUtils.GetPriority( m_inputPorts[ 1 ].DataType ) ) + { + m_mainDataType = m_inputPorts[ 0 ].DataType; + } + else + { + m_mainDataType = m_inputPorts[ 1 ].DataType; + } + + if( m_dynamicOutputType ) + { + if( m_mainDataType != m_outputPorts[ 0 ].DataType ) + { + m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); + } + } + } + } + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + + if( !m_extensibleInputPorts ) + return; + + if( m_previouslyDragging != m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid && m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.NodeId != UniqueId ) + { + if( m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid ) + { + m_beforePreviewCount = 2; + for( int i = 2; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + m_beforePreviewCount++; + } + } + + m_inputCount = m_beforePreviewCount + 1; + if( m_inputCount <= 10 ) + { + if( m_inputCount > m_lastInputCount ) + { + UndoUtils.RegisterCompleteObjectUndo( m_containerGraph.ParentWindow, Constants.UndoCreateDynamicPortId ); + RecordObject( Constants.UndoCreateDynamicPortId ); + + AddInputPort( m_mainDataType, false, ( ( char ) ( 'A' + m_inputCount - 1 ) ).ToString() ); + m_inputPorts[ m_inputCount - 1 ].CreatePortRestrictions( m_dynamicRestrictions ); + } + + m_lastInputCount = m_inputCount; + m_sizeIsDirty = true; + m_isDirty = true; + SetSaveIsDirty(); + } + } + else + { + bool hasEmpty = CheckValidConnections(); + if( hasEmpty ) + UpdateEmptyInputPorts( false ); + } + + m_previouslyDragging = m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid; + } + + UpdateEmptyInputPorts( false ); + } + + private bool CheckValidConnections() + { + if( !m_extensibleInputPorts ) + return false; + + bool hasEmptyConnections = false; + + bool hasMatrix = m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT3x3 || m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT4x4 || m_inputPorts[ 1 ].DataType == WirePortDataType.FLOAT3x3 || m_inputPorts[ 1 ].DataType == WirePortDataType.FLOAT4x4; + + if( m_inputPorts.Count != m_beforePreviewCount ) + { + if( hasMatrix ) + { + bool showError = false; + for( int i = m_inputPorts.Count - 1; i >= 2; i-- ) + { + if( m_inputPorts[ i ].IsConnected ) + { + showError = true; + m_inputPorts[ i ].FullDeleteConnections(); + } + + hasEmptyConnections = true; + } + if( showError ) + m_containerGraph.ParentWindow.ShowMessage( UniqueId, "Matrix operations are only valid for the first two inputs to prevent errors" ); + } + else + { + for( int i = m_inputPorts.Count - 1; i >= 2; i-- ) + { + if( m_inputPorts[ i ].DataType == WirePortDataType.FLOAT3x3 || m_inputPorts[ i ].DataType == WirePortDataType.FLOAT4x4 ) + { + m_containerGraph.ParentWindow.ShowMessage( UniqueId, "Matrix operations are only valid for the first two inputs to prevent errors" ); + m_inputPorts[ i ].FullDeleteConnections(); + hasEmptyConnections = true; + } + else if( !m_inputPorts[ i ].IsConnected ) + { + hasEmptyConnections = true; + } + } + } + } + + return hasEmptyConnections; + } + + private void UpdateEmptyInputPorts( bool recordUndo ) + { + if( !m_extensibleInputPorts ) + return; + NodeWireReferencesUtils wireReferenceUtils = m_containerGraph.ParentWindow.WireReferenceUtils; + if( !wireReferenceUtils.OutputPortReference.IsValid ) + { + if( recordUndo ) + { + UndoUtils.RegisterCompleteObjectUndo( m_containerGraph.ParentWindow, Constants.UndoDeleteDynamicPortId ); + RecordObject( Constants.UndoDeleteDynamicPortId ); + } + + bool hasDeleted = false; + m_inputCount = 2; + for( int i = m_inputPorts.Count - 1; i >= 2; i-- ) + { + if( !m_inputPorts[ i ].IsConnected ) + { + hasDeleted = true; + if( wireReferenceUtils.InputPortReference.IsValid && + wireReferenceUtils.InputPortReference.NodeId == UniqueId && + wireReferenceUtils.InputPortReference.PortId == m_inputPorts[ i ].PortId ) + { + wireReferenceUtils.InputPortReference.Invalidate(); + } + DeleteInputPortByArrayIdx( i ); + } + else + { + m_inputCount++; + } + } + + if( hasDeleted || m_inputCount != m_lastInputCount ) + { + for( int i = 2; i < m_inputPorts.Count; i++ ) + { + m_inputPorts[ i ].Name = ( ( char ) ( 'A' + i ) ).ToString(); + } + + m_beforePreviewCount = m_inputPorts.Count; + m_inputCount = m_beforePreviewCount; + m_lastInputCount = m_inputCount; + m_sizeIsDirty = true; + m_isDirty = true; + SetSaveIsDirty(); + } + } + + m_inputCount = Mathf.Clamp( m_inputCount, 2, 10 ); + } + + public virtual string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( !m_extensibleInputPorts ) + SetInputData( outputId, ref dataCollector, ignoreLocalvar ); + else + SetExtensibleInputData( outputId, ref dataCollector, ignoreLocalvar ); + return string.Empty; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + string result = BuildResults( outputId, ref dataCollector, ignoreLocalvar ); + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + + protected void SetInputData( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + m_inputA = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + if( m_inputPorts[ 0 ].DataType != m_mainDataType ) + { + m_inputA = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, m_inputA, m_inputPorts[ 0 ].DataType, m_mainDataType, m_inputA ); + } + m_inputB = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + if( m_inputPorts[ 1 ].DataType != m_mainDataType ) + { + m_inputB = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, m_inputB, m_inputPorts[ 1 ].DataType, m_mainDataType, m_inputB ); + } + } + + protected void SetExtensibleInputData( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + m_extensibleInputResults = new List(); + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + m_extensibleInputResults.Add( m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ) ); + if( m_inputPorts[ i ].DataType != m_mainDataType && m_inputPorts[ i ].DataType != WirePortDataType.FLOAT && m_inputPorts[ i ].DataType != WirePortDataType.INT ) + { + m_extensibleInputResults[ i ] = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, m_extensibleInputResults[ i ], m_inputPorts[ i ].DataType, m_mainDataType, m_extensibleInputResults[ i ] ); + } + } + } + + void UpdatePorts() + { + m_lastInputCount = Mathf.Clamp( m_inputCount, 2, 10 ); + + for( int i = 2; i < m_inputCount; i++ ) + { + AddInputPort( m_mainDataType, false, ( ( char ) ( 'A' + i ) ).ToString() ); + m_inputPorts[ i ].CreatePortRestrictions( m_dynamicRestrictions ); + } + + m_sizeIsDirty = true; + SetSaveIsDirty(); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( m_extensibleInputPorts && UIUtils.CurrentShaderVersion() > 10005 ) + { + m_inputCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + UpdatePorts(); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + if( m_extensibleInputPorts ) + IOUtils.AddFieldValueToString( ref nodeInfo, m_inputCount ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs.meta new file mode 100644 index 00000000..6fe11cc6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5b60c440b5db81c4d9df9c048aa22b48 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs.meta new file mode 100644 index 00000000..2eaea63d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 868823c936b45494aa7f3ce9f16b5372 +folderAsset: yes +timeCreated: 1481126946 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs new file mode 100644 index 00000000..e8c9fc58 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs @@ -0,0 +1,130 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Camera Depth Fade", "Camera And Screen", "Outputs a 0 - 1 gradient representing the distance between the surface of this object and camera near plane" )] + public sealed class CameraDepthFade : ParentNode + { + //{0} - Eye Depth + //{1} - Offset + //{2} - Distance + private const string CameraDepthFadeFormat = "(( {0} -_ProjectionParams.y - {1} ) / {2})"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "Vertex Position", -1, MasterNodePortCategory.Fragment, 2 ); + AddInputPort( WirePortDataType.FLOAT, false, "Length", -1, MasterNodePortCategory.Fragment, 0 ); + AddInputPort( WirePortDataType.FLOAT, false, "Offset", -1, MasterNodePortCategory.Fragment, 1 ); + GetInputPortByUniqueId( 0 ).FloatInternalData = 1; + AddOutputPort( WirePortDataType.FLOAT, "Out" ); + m_useInternalPortData = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + InputPort vertexPort = GetInputPortByUniqueId( 2 ); + InputPort lengthPort = GetInputPortByUniqueId( 0 ); + InputPort offsetPort = GetInputPortByUniqueId( 1 ); + + string distance = lengthPort.GeneratePortInstructions( ref dataCollector ); + string offset = offsetPort.GeneratePortInstructions( ref dataCollector ); + + string value = string.Empty; + string eyeDepth = string.Empty; + + if( dataCollector.IsTemplate ) + { + if( vertexPort.IsConnected ) + { + string varName = "customSurfaceDepth" + OutputId; + GenerateInputInVertex( ref dataCollector, 2, varName, false ); + + string formatStr = string.Empty; + if( dataCollector.IsSRP ) + formatStr = "-TransformWorldToView(TransformObjectToWorld({0})).z"; + else + formatStr = "-UnityObjectToViewPos({0}).z"; + + string eyeInstruction = string.Format( formatStr, varName ); + eyeDepth = "customEye" + OutputId; + dataCollector.TemplateDataCollectorInstance.RegisterCustomInterpolatedData( eyeDepth, WirePortDataType.FLOAT, CurrentPrecisionType, eyeInstruction ); + } + else + { + eyeDepth = dataCollector.TemplateDataCollectorInstance.GetEyeDepth( CurrentPrecisionType ); + } + + value = string.Format( CameraDepthFadeFormat, eyeDepth, offset, distance ); + RegisterLocalVariable( 0, value, ref dataCollector, "cameraDepthFade" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + string vertexVarName = string.Empty; + if( vertexPort.IsConnected ) + { + vertexVarName = vertexPort.GeneratePortInstructions( ref dataCollector ); + } + else + { + vertexVarName = Constants.VertexShaderInputStr + ".vertex.xyz"; + } + + //dataCollector.AddVertexInstruction( "float cameraDepthFade" + UniqueId + " = (( -UnityObjectToViewPos( " + Constants.VertexShaderInputStr + ".vertex.xyz ).z -_ProjectionParams.y - " + offset + " ) / " + distance + ");", UniqueId ); + value = string.Format( CameraDepthFadeFormat, "-UnityObjectToViewPos( " + vertexVarName + " ).z", offset, distance ); + RegisterLocalVariable( 0, value, ref dataCollector, "cameraDepthFade" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + dataCollector.AddToIncludes( UniqueId, Constants.UnityShaderVariables ); + + if( dataCollector.TesselationActive ) + { + if( vertexPort.IsConnected ) + { + string vertexValue = vertexPort.GeneratePortInstructions( ref dataCollector ); + eyeDepth = "customSurfaceDepth" + OutputId; + RegisterLocalVariable( 0, string.Format( "-UnityObjectToViewPos( {0} ).z", vertexValue ), ref dataCollector, eyeDepth ); + } + else + { + eyeDepth = GeneratorUtils.GenerateScreenDepthOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); + } + } + else + { + + if( vertexPort.IsConnected ) + { + string varName = "customSurfaceDepth" + OutputId; + GenerateInputInVertex( ref dataCollector, 2, varName, false ); + dataCollector.AddToInput( UniqueId, varName, WirePortDataType.FLOAT ); + string vertexInstruction = "-UnityObjectToViewPos( " + varName + " ).z"; + dataCollector.AddToVertexLocalVariables( UniqueId, Constants.VertexShaderOutputStr + "." + varName + " = " + vertexInstruction + ";" ); + eyeDepth = Constants.InputVarStr + "." + varName; + } + else + { + dataCollector.AddToInput( UniqueId, "eyeDepth", WirePortDataType.FLOAT ); + string instruction = "-UnityObjectToViewPos( " + Constants.VertexShaderInputStr + ".vertex.xyz ).z"; + dataCollector.AddToVertexLocalVariables( UniqueId, Constants.VertexShaderOutputStr + ".eyeDepth = " + instruction + ";" ); + eyeDepth = Constants.InputVarStr + ".eyeDepth"; + } + } + + value = string.Format( CameraDepthFadeFormat, eyeDepth, offset, distance ); + RegisterLocalVariable( 0, value, ref dataCollector, "cameraDepthFade" + OutputId ); + //dataCollector.AddToLocalVariables( UniqueId, "float cameraDepthFade" + UniqueId + " = (( " + Constants.InputVarStr + ".eyeDepth -_ProjectionParams.y - "+ offset + " ) / " + distance + ");" ); + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs.meta new file mode 100644 index 00000000..e816935b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 96f38a9f14906ca49b505b8e305c37ec +timeCreated: 1491316341 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs new file mode 100644 index 00000000..e85fc0ac --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs @@ -0,0 +1,54 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Compute Grab Screen Pos", "Camera And Screen", "Computes texture coordinate for doing a screenspace-mapped texture sample. Input is clip space position" )] + public sealed class ComputeGrabScreenPosHlpNode : HelperParentNode + { + private readonly string[] ComputeGrabScreenPosFunction = + { + "inline float4 ComputeGrabScreenPos( float4 pos )\n", + "{\n", + "#if UNITY_UV_STARTS_AT_TOP\n", + "\tfloat scale = -1.0;\n", + "#else\n", + "\tfloat scale = 1.0;\n", + "#endif\n", + "\tfloat4 o = pos * 0.5f;\n", + "\to.xy = float2( o.x, o.y*scale ) + o.w;\n", + "#ifdef UNITY_SINGLE_PASS_STEREO\n", + "\to.xy = TransformStereoScreenSpaceTex ( o.xy, pos.w );\n", + "#endif\n", + "\to.zw = pos.zw;\n", + "\treturn o;\n", + "}\n" + }; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "ComputeGrabScreenPos"; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_outputPorts[ 0 ].Name = "XYZW"; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "computeGrabScreenPos" + OutputId; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + { + dataCollector.AddFunction( m_funcType, ComputeGrabScreenPosFunction, false ); + } + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs.meta new file mode 100644 index 00000000..68368256 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5fe7f4be962b9e8459eb156503b99d41 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs new file mode 100644 index 00000000..883009b9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs @@ -0,0 +1,76 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using UnityEngine; +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Compute Screen Pos", "Camera And Screen", "Computes texture coordinate for doing a screenspace-mapped texture sample. Input is clip space position" )] + public sealed class ComputeScreenPosHlpNode : HelperParentNode + { + [SerializeField] + private bool m_normalize = false; + private string NormalizeStr = "Normalize"; + private readonly string[] NormalizeOps = + { "{0} = {0} / {0}.w;", + "{0}.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? {0}.z : {0}.z* 0.5 + 0.5;" + }; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "ComputeScreenPos"; + m_funcHDFormatOverride = "ComputeScreenPos( {0} , _ProjectionParams.x )"; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_outputPorts[ 0 ].Name = "XYZW"; + m_autoWrapProperties = true; + m_previewShaderGUID = "97bd4895d847d764eb21d2bf7aa13671"; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + m_previewMaterialPassId = m_normalize ? 1 : 0; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "computeScreenPos" + OutputId; + } + + public override void DrawProperties() + { + base.DrawProperties(); + m_normalize = EditorGUILayoutToggle( NormalizeStr, m_normalize ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + string result = base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + if( m_normalize ) + { + dataCollector.AddLocalVariable( UniqueId, string.Format( NormalizeOps[ 0 ], m_localVarName ) ); + dataCollector.AddLocalVariable( UniqueId, string.Format( NormalizeOps[ 1 ], m_localVarName ) ); + } + return result; + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_normalize ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 15404 ) + { + m_normalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs.meta new file mode 100644 index 00000000..3589fa9c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c220606396d6e6048a901f217be1435e +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs new file mode 100644 index 00000000..79ebf7ef --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs @@ -0,0 +1,46 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Decode Depth Normal", "Miscellaneous", "Decodes both Depth and Normal from a previously encoded pixel value" )] + public sealed class DecodeDepthNormalNode : ParentNode + { + // URP will only have support for depth normals texture over v.10 ... must revisit this node when it comes out + private const string SRPErrorMessage = "This node is only currently supported on the Built-in pipeline"; + private const string DecodeDepthNormalFunc = "DecodeDepthNormal( {0}, {1}, {2} );"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT4, false, "Encoded" ); + AddOutputPort( WirePortDataType.FLOAT, "Depth" ); + AddOutputPort( WirePortDataType.FLOAT3, "Normal" ); + m_previewShaderGUID = "dbf37c4d3ce0f0b41822584d6c9ba203"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.IsSRP ) + { + UIUtils.ShowMessage( SRPErrorMessage, MessageSeverity.Error ); + return GenerateErrorValue( outputId ); + } + + if( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + + dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); + string encodedValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string depthDecodedVal = "depthDecodedVal" + OutputId; + string normalDecodedVal = "normalDecodedVal" + OutputId; + RegisterLocalVariable( 0, "0", ref dataCollector, depthDecodedVal ); + RegisterLocalVariable( 1, "float3(0,0,0)", ref dataCollector, normalDecodedVal ); + dataCollector.AddLocalVariable( UniqueId, string.Format( DecodeDepthNormalFunc, encodedValue , depthDecodedVal, normalDecodedVal) ); + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs.meta new file mode 100644 index 00000000..46ffcdbe --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1cc4e3c718669d54c97614ac6abcfaff +timeCreated: 1513695160 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs new file mode 100644 index 00000000..a80ad39d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs @@ -0,0 +1,27 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Decode Float RGBA", "Miscellaneous", "Decodes RGBA color into a float" )] + public sealed class DecodeFloatRGBAHlpNode : HelperParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "DecodeFloatRGBA"; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_inputPorts[ 0 ].Name = "RGBA"; + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); + m_previewShaderGUID = "f71b31b15ff3f2042bafbed40acd29f4"; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "decodeFloatRGBA" + OutputId; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs.meta new file mode 100644 index 00000000..44de3d25 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2c5479ff48207cf43a308ec9f110fa9f +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs new file mode 100644 index 00000000..3751b228 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs @@ -0,0 +1,27 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Decode Float RG", "Miscellaneous", "Decodes a previously-encoded RG float" )] + public sealed class DecodeFloatRGHlpNode : HelperParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "DecodeFloatRG"; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); + m_inputPorts[ 0 ].Name = "RG"; + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); + m_previewShaderGUID = "1fb3121b1c8febb4dbcc2a507a2df2db"; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "decodeFloatRG" + OutputId; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs.meta new file mode 100644 index 00000000..20a29509 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a965812ada2b83343a1f511273fcfc52 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs new file mode 100644 index 00000000..a7f52ddf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs @@ -0,0 +1,109 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Decode Lightmap", "Miscellaneous", "Decodes color from Unity lightmap (RGBM or dLDR depending on platform)" )] + public sealed class DecodeLightmapHlpNode : ParentNode + { + private const string m_funcStandard = "DecodeLightmap({0})"; + private string m_funcSRP = "DecodeLightmap({0},{1})"; + + private const string DecodeInstructionsLWValueStr = "half4 decodeLightmapInstructions = half4(LIGHTMAP_HDR_MULTIPLIER, LIGHTMAP_HDR_EXPONENT, 0.0h, 0.0h);"; + private const string DecodeInstructionsNameStr = "decodeLightmapInstructions"; + private readonly string[] DecodeInstructionsHDValueStr = + { + "#ifdef UNITY_LIGHTMAP_FULL_HDR//ase_decode_lightmap_0", + "\tbool useRGBMLightmap = false;//ase_decode_lightmap_1", + "\tfloat4 decodeLightmapInstructions = float4( 0.0, 0.0, 0.0, 0.0 );//ase_decode_lightmap_2", + "#else//ase_decode_lightmap//ase_decode_lightmap_3", + "\tbool useRGBMLightmap = true;//ase_decode_lightmap_4", + "#if defined(UNITY_LIGHTMAP_RGBM_ENCODING)//ase_decode_lightmap_5", + "\tfloat4 decodeLightmapInstructions = float4(34.493242, 2.2, 0.0, 0.0);//ase_decode_lightmap_6", + "#else//ase_decode_lightmap_7", + "\tfloat4 decodeLightmapInstructions = float4( 2.0, 2.2, 0.0, 0.0 );//ase_decode_lightmap_8", + "#endif//ase_decode_lightmap_9", + "#endif//ase_decode_lightmap_10" + }; + private string m_localVarName = null; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT4, false, "Value" ); + AddInputPort( WirePortDataType.FLOAT4, false, "Instructions" ); + + AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue ); + + m_previewShaderGUID = "c2d3bee1aee183343b31b9208cb402e9"; + m_useInternalPortData = true; + } + + public override string GetIncludes() + { + return Constants.UnityCgLibFuncs; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "decodeLightMap" + OutputId; + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + m_inputPorts[ 1 ].Visible = m_containerGraph.ParentWindow.IsShaderFunctionWindow || m_containerGraph.IsSRP; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string finalResult = string.Empty; + if( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + string instructions = string.Empty; + if( m_inputPorts[ 1 ].IsConnected ) + { + instructions = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + } + else + { + if( dataCollector.TemplateDataCollectorInstance.IsHDRP ) + { + for( int i = 0; i < DecodeInstructionsHDValueStr.Length; i++ ) + { + dataCollector.AddLocalVariable( UniqueId, DecodeInstructionsHDValueStr[ i ] ); + } + } + else + { + dataCollector.AddLocalVariable( UniqueId, DecodeInstructionsLWValueStr ); + } + instructions = DecodeInstructionsNameStr; + + } + + finalResult = string.Format( m_funcSRP, value , instructions ); + + } + else + { + dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); + finalResult = string.Format( m_funcStandard, value ); + } + + RegisterLocalVariable( 0, finalResult, ref dataCollector, m_localVarName ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs.meta new file mode 100644 index 00000000..923da421 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b3d1879d1e402b34f98b8e8cdf94d719 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs new file mode 100644 index 00000000..a69b4997 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs @@ -0,0 +1,27 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Decode View Normal Stereo", "Miscellaneous", "Decodes view space normal from enc4.xy" )] + public sealed class DecodeViewNormalStereoHlpNode : HelperParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "DecodeViewNormalStereo"; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_outputPorts[ 0 ].Name = "XYZ"; + m_previewShaderGUID = "e996db1cc4510c84185cb9f933f916bb"; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "decodeViewNormalStereo" + OutputId; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs.meta new file mode 100644 index 00000000..b2df9b80 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 94df47461b7e6244eaf92b0dab7cc7ee +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs new file mode 100644 index 00000000..0af28b8b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs @@ -0,0 +1,173 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Depth Fade", "Surface Data", "Outputs a linear gradient representing the distance between the surface of this object and geometry behind" )] + public sealed class DepthFade : ParentNode + { + private const string ConvertToLinearStr = "Convert To Linear"; + private const string SaturateStr = "Saturate"; + private const string MirrorStr = "Mirror"; + + [SerializeField] + private bool m_convertToLinear = true; + + [SerializeField] + private bool m_saturate = false; + + [SerializeField] + private bool m_mirror = true; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "Vertex Position", -1, MasterNodePortCategory.Fragment, 1 ); + AddInputPort( WirePortDataType.FLOAT, false, "Distance",-1,MasterNodePortCategory.Fragment,0 ); + GetInputPortByUniqueId(0).FloatInternalData = 1; + AddOutputPort( WirePortDataType.FLOAT, "Out" ); + m_useInternalPortData = true; + m_autoWrapProperties = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowNoVertexModeNodeMessage( this ); + return "0"; + } + + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) + dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); + + if( !dataCollector.IsTemplate || dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.HDRP ) + { + if( dataCollector.IsTemplate && dataCollector.CurrentSRPType == TemplateSRPType.URP ) + { + dataCollector.AddToDirectives( Constants.CameraDepthTextureLWEnabler, -1, AdditionalLineType.Define ); + } + else + { + dataCollector.AddToUniforms( UniqueId, Constants.CameraDepthTextureValue ); + dataCollector.AddToUniforms( UniqueId, Constants.CameraDepthTextureTexelSize ); + } + } + + string screenPosNorm; + InputPort vertexPosPort = GetInputPortByUniqueId( 1 ); + if( vertexPosPort.IsConnected ) + { + string vertexPosVar = "vertexPos" + OutputId; + if ( dataCollector.IsTemplate || !dataCollector.TesselationActive ) + { + GenerateInputInVertex( ref dataCollector, 1, vertexPosVar, false ); + } + else + { + // @diogo: surface shader + tessellation? can't add interpolators, so generate everything in fragment + vertexPosVar = vertexPosPort.GeneratePortInstructions( ref dataCollector ); + } + screenPosNorm = GeneratorUtils.GenerateScreenPositionNormalizedForValue( vertexPosVar, OutputId, ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); + } + else + { + if( dataCollector.IsTemplate ) + { + string ppsScreenPos = string.Empty; + if( !dataCollector.TemplateDataCollectorInstance.GetCustomInterpolatedData( TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED, WirePortDataType.FLOAT4, PrecisionType.Float, ref ppsScreenPos, true, MasterNodePortCategory.Fragment ) ) + { + screenPosNorm = GeneratorUtils.GenerateScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); + } + else + { + screenPosNorm = ppsScreenPos; + } + } + else + { + screenPosNorm = GeneratorUtils.GenerateScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); + } + } + + string screenDepth = TemplateHelperFunctions.CreateDepthFetch( dataCollector, screenPosNorm ); + if( m_convertToLinear ) + { + if( dataCollector.IsTemplate && dataCollector.IsSRP ) + screenDepth = string.Format( "LinearEyeDepth({0},_ZBufferParams)", screenDepth ); + else + screenDepth = string.Format( "LinearEyeDepth({0})", screenDepth ); + } + else + { + screenDepth = string.Format( "({0}*( _ProjectionParams.z - _ProjectionParams.y ))", screenDepth ); + } + + string distance = GetInputPortByUniqueId( 0 ).GeneratePortInstructions( ref dataCollector ); + + dataCollector.AddLocalVariable( UniqueId, "float screenDepth" + OutputId + " = " + screenDepth + ";" ); + + string finalVarName = "distanceDepth" + OutputId; + string finalVarValue = string.Empty; + if( dataCollector.IsTemplate && dataCollector.IsSRP ) + finalVarValue = "( screenDepth" + OutputId + " - LinearEyeDepth( " + screenPosNorm + ".z,_ZBufferParams ) ) / ( " + distance + " )"; + else + finalVarValue = "( screenDepth" + OutputId + " - LinearEyeDepth( " + screenPosNorm + ".z ) ) / ( " + distance + " )"; + + if( m_mirror ) + { + finalVarValue = string.Format( "abs( {0} )", finalVarValue ); + } + + if( m_saturate ) + { + finalVarValue = string.Format( "saturate( {0} )", finalVarValue ); + } + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, finalVarName, finalVarValue ); + m_outputPorts[ 0 ].SetLocalValue( finalVarName, dataCollector.PortCategory ); + return GetOutputColorItem( 0, outputId, finalVarName ); + } + + public override void DrawProperties() + { + base.DrawProperties(); + m_convertToLinear = EditorGUILayoutToggle( ConvertToLinearStr, m_convertToLinear ); + m_mirror = EditorGUILayoutToggle( MirrorStr, m_mirror ); + m_saturate = EditorGUILayoutToggle( SaturateStr, m_saturate ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() >= 13901 ) + { + m_convertToLinear = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + if( UIUtils.CurrentShaderVersion() > 15607 ) + { + m_saturate = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 15700 ) + { + m_mirror = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_convertToLinear ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_saturate ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_mirror ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs.meta new file mode 100644 index 00000000..49f1b071 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 279c74ce44e24204d803be6ec743c290 +timeCreated: 1491316341 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs new file mode 100644 index 00000000..fb032508 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs @@ -0,0 +1,67 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Diffuse And Specular From Metallic", "Miscellaneous", "Computes Diffuse and Specular color values from Base Color and Metallic." )] + public class DiffuseAndSpecularFromMetallicNode : ParentNode + { + private const string FuncHeader = "ASEComputeDiffuseAndFresnel0( {0}, {1}, {2}, {3} )"; + private readonly string[] FuncBody = + { + "float3 ASEComputeDiffuseAndFresnel0( float3 baseColor, float metallic, out float3 specularColor, out float oneMinusReflectivity )\n", + "{\n", + "\t#ifdef UNITY_COLORSPACE_GAMMA\n", + "\t\tconst float dielectricF0 = 0.220916301;\n", + "\t#else\n", + "\t\tconst float dielectricF0 = 0.04;\n", + "\t#endif\n", + "\tspecularColor = lerp( dielectricF0.xxx, baseColor, metallic );\n", + "\toneMinusReflectivity = 1.0 - metallic;\n", + "\treturn baseColor * oneMinusReflectivity;\n", + "}\n" + }; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "Base Color" ); + AddInputPort( WirePortDataType.FLOAT, false, "Metallic" ); + AddOutputPort( WirePortDataType.FLOAT3, "Diffuse Color" ); + AddOutputPort( WirePortDataType.FLOAT3, "Specular Color" ); + AddOutputPort( WirePortDataType.FLOAT, "One Minus Reflectivity" ); + m_previewShaderGUID = "c7c4485750948a045b5dab0985896e17"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) + { + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + + string baseColor = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string metallic = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + string specularColorVar = "specularColor" + OutputId; + string oneMinusReflectivityVar = "oneMinusReflectivity" + OutputId; + string diffuseColorVar = "diffuseColor" + OutputId; + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, specularColorVar, "(0).xxx" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, oneMinusReflectivityVar, "0" ); + + dataCollector.AddFunction( FuncBody[ 0 ], FuncBody, false ); + RegisterLocalVariable( 0, string.Format( FuncHeader, baseColor, metallic, specularColorVar, oneMinusReflectivityVar ), ref dataCollector, diffuseColorVar ); + + m_outputPorts[ 0 ].SetLocalValue( diffuseColorVar, dataCollector.PortCategory ); + m_outputPorts[ 1 ].SetLocalValue( specularColorVar, dataCollector.PortCategory ); + m_outputPorts[ 2 ].SetLocalValue( oneMinusReflectivityVar, dataCollector.PortCategory ); + + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs.meta new file mode 100644 index 00000000..835eaa41 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a792f114a5433af499dce78ebe05a9e6 +timeCreated: 1534266498 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs new file mode 100644 index 00000000..12b964e6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs @@ -0,0 +1,300 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Dither", "Camera And Screen", "Generates a dithering pattern" )] + public sealed class DitheringNode : ParentNode + { + private string m_functionHeader = "Dither4x4Bayer( {0}, {1} )"; + private string m_functionBody = string.Empty; + + [SerializeField] + private int m_selectedPatternInt = 0; + + [SerializeField] + private bool m_customScreenPos = false; + + private readonly string[] PatternsFuncStr = { "4x4Bayer", "8x8Bayer", "NoiseTex" }; + private readonly string[] PatternsStr = { "4x4 Bayer", "8x8 Bayer", "Noise Texture" }; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + private InputPort m_texPort; + private InputPort m_ssPort; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddInputPort( WirePortDataType.SAMPLER2D, false, "Pattern"); + m_inputPorts[ 1 ].CreatePortRestrictions( WirePortDataType.SAMPLER2D ); + m_texPort = m_inputPorts[ 1 ]; + AddInputPort( WirePortDataType.FLOAT4, false, "Screen Position" ); + + AddInputPort( WirePortDataType.SAMPLERSTATE, false, "SS" ); + m_inputPorts[ 3 ].CreatePortRestrictions( WirePortDataType.SAMPLERSTATE ); + m_ssPort = m_inputPorts[ 3 ]; + + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_textLabelWidth = 110; + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, PatternsStr[ m_selectedPatternInt ] ) ); + UpdatePorts(); + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + m_texPort = null; + m_ssPort = null; + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + if( !m_texPort.CheckValidType( type ) ) + { + m_texPort.FullDeleteConnections(); + UIUtils.ShowMessage( UniqueId, "Dithering node only accepts SAMPLER2D input type.\nTexture Object connected changed to " + type + ", connection was lost, please review and update accordingly.", MessageSeverity.Warning ); + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_selectedPatternInt = m_upperLeftWidget.DrawWidget( this, m_selectedPatternInt, PatternsStr ); + if( EditorGUI.EndChangeCheck() ) + { + UpdatePorts(); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_selectedPatternInt = EditorGUILayoutPopup( "Pattern", m_selectedPatternInt, PatternsStr ); + if ( EditorGUI.EndChangeCheck() ) + { + UpdatePorts(); + } + EditorGUI.BeginChangeCheck(); + m_customScreenPos = EditorGUILayoutToggle( "Screen Position", m_customScreenPos ); + if( EditorGUI.EndChangeCheck() ) + { + UpdatePorts(); + } + } + + private void UpdatePorts() + { + m_texPort.Visible = ( m_selectedPatternInt == 2 ); + m_ssPort.Visible = ( m_selectedPatternInt == 2 ); + m_inputPorts[ 2 ].Visible = m_customScreenPos; + m_sizeIsDirty = true; + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, PatternsStr[ m_selectedPatternInt ] ) ); + } + + private void GeneratePattern( ref MasterNodeDataCollector dataCollector ) + { + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, PatternsStr[ m_selectedPatternInt ] ) ); + switch ( m_selectedPatternInt ) + { + default: + case 0: + { + m_functionBody = string.Empty; + m_functionHeader = "Dither" + PatternsFuncStr[ m_selectedPatternInt ] + "( {0}, {1} )"; + IOUtils.AddFunctionHeader( ref m_functionBody, "inline float Dither" + PatternsFuncStr[ m_selectedPatternInt ] + "( int x, int y )" ); + IOUtils.AddFunctionLine( ref m_functionBody, "const float dither[ 16 ] = {" ); + IOUtils.AddFunctionLine( ref m_functionBody, " 1, 9, 3, 11," ); + IOUtils.AddFunctionLine( ref m_functionBody, " 13, 5, 15, 7," ); + IOUtils.AddFunctionLine( ref m_functionBody, " 4, 12, 2, 10," ); + IOUtils.AddFunctionLine( ref m_functionBody, " 16, 8, 14, 6 };" ); + IOUtils.AddFunctionLine( ref m_functionBody, "int r = y * 4 + x;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "return dither[ r ] / 16; // same # of instructions as pre-dividing due to compiler magic" ); + IOUtils.CloseFunctionBody( ref m_functionBody ); + } + break; + case 1: + { + m_functionBody = string.Empty; + m_functionHeader = "Dither" + PatternsFuncStr[ m_selectedPatternInt ] + "( {0}, {1} )"; + IOUtils.AddFunctionHeader( ref m_functionBody, "inline float Dither" + PatternsFuncStr[ m_selectedPatternInt ] + "( int x, int y )" ); + IOUtils.AddFunctionLine( ref m_functionBody, "const float dither[ 64 ] = {" ); + IOUtils.AddFunctionLine( ref m_functionBody, " 1, 49, 13, 61, 4, 52, 16, 64," ); + IOUtils.AddFunctionLine( ref m_functionBody, " 33, 17, 45, 29, 36, 20, 48, 32," ); + IOUtils.AddFunctionLine( ref m_functionBody, " 9, 57, 5, 53, 12, 60, 8, 56," ); + IOUtils.AddFunctionLine( ref m_functionBody, " 41, 25, 37, 21, 44, 28, 40, 24," ); + IOUtils.AddFunctionLine( ref m_functionBody, " 3, 51, 15, 63, 2, 50, 14, 62," ); + IOUtils.AddFunctionLine( ref m_functionBody, " 35, 19, 47, 31, 34, 18, 46, 30," ); + IOUtils.AddFunctionLine( ref m_functionBody, " 11, 59, 7, 55, 10, 58, 6, 54," ); + IOUtils.AddFunctionLine( ref m_functionBody, " 43, 27, 39, 23, 42, 26, 38, 22};" ); + IOUtils.AddFunctionLine( ref m_functionBody, "int r = y * 8 + x;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "return dither[ r ] / 64; // same # of instructions as pre-dividing due to compiler magic" ); + IOUtils.CloseFunctionBody( ref m_functionBody ); + } + break; + case 2: + { + ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; + + m_functionBody = string.Empty; + m_functionHeader = "Dither" + PatternsFuncStr[ m_selectedPatternInt ] + "( {0}, {1}, {2} )"; + + IOUtils.AddFunctionHeader( ref m_functionBody, "inline float Dither" + PatternsFuncStr[ m_selectedPatternInt ] + "( float4 screenPos, " + GeneratorUtils.GetPropertyDeclaraction( "noiseTexture", TextureType.Texture2D, ", " ) + GeneratorUtils.GetSamplerDeclaraction( "samplernoiseTexture", TextureType.Texture2D, ", " ) + "float4 noiseTexelSize )" ); + + string samplingCall = GeneratorUtils.GenerateSamplingCall( ref dataCollector, WirePortDataType.SAMPLER2D, "noiseTexture", "samplernoiseTexture", "screenPos.xy * _ScreenParams.xy * noiseTexelSize.xy", MipType.MipLevel, "0" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float dither = "+ samplingCall + ".g;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float ditherRate = noiseTexelSize.x * noiseTexelSize.y;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "dither = ( 1 - ditherRate ) * dither + ditherRate;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "return dither;" ); + IOUtils.CloseFunctionBody( ref m_functionBody ); + } + break; + } + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + dataCollector.UsingCustomScreenPos = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + GeneratePattern( ref dataCollector ); + + if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) + dataCollector.AddToIncludes( UniqueId, Constants.UnityShaderVariables ); + string varName = string.Empty; + if( m_customScreenPos && m_inputPorts[ 2 ].IsConnected ) + { + varName = "ditherCustomScreenPos" + OutputId; + string customScreenPosVal = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, varName, customScreenPosVal ); + } + else + { + if( dataCollector.TesselationActive && dataCollector.IsFragmentCategory ) + { + varName = GeneratorUtils.GenerateScreenPositionPixelOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); + } + else + { + if( dataCollector.IsTemplate ) + { + varName = dataCollector.TemplateDataCollectorInstance.GetScreenPosPixel( CurrentPrecisionType ); + } + else + { + varName = GeneratorUtils.GenerateScreenPositionPixel( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); + } + } + } + + //string surfInstruction = string.Format( "abs( {0}.xy ) * _ScreenParams.xy", varName ); + m_showErrorMessage = false; + string functionResult = ""; + string noiseTex = string.Empty; + switch ( m_selectedPatternInt ) + { + default: + case 0: + functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, "fmod( " + varName + ".x, 4 )", "fmod( " + varName + ".y, 4 )" ); + break; + case 1: + functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, "fmod( " + varName + ".x, 8 )", "fmod( " + varName + ".y, 8 )" ); + break; + case 2: + { + if( !m_texPort.IsConnected ) + { + m_showErrorMessage = true; + m_errorMessageTypeIsError = NodeMessageType.Warning; + m_errorMessageTooltip = "Please connect a texture object to the Pattern input port to generate a proper dithered pattern"; + return "0"; + } else + { + ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; + noiseTex = m_texPort.GeneratePortInstructions( ref dataCollector ); + //GeneratePattern( ref dataCollector ); + dataCollector.AddToUniforms( UniqueId, "float4 " + noiseTex + "_TexelSize;", dataCollector.IsSRP ); + if( outsideGraph.SamplingMacros ) + { + string sampler = string.Empty; + if( m_ssPort.IsConnected ) + { + sampler = m_ssPort.GeneratePortInstructions( ref dataCollector ); + } + else + { + sampler = GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, noiseTex, VariableMode.Create ); + } + functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, varName, noiseTex + ", " + sampler, noiseTex + "_TexelSize" ); + } + else + { + functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, varName, noiseTex, noiseTex + "_TexelSize" ); + } + } + } + break; + } + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, "dither" + OutputId, functionResult ); + + if( m_inputPorts[ 0 ].IsConnected ) + { + string driver = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + dataCollector.AddLocalVariable( UniqueId, "dither" + OutputId+" = step( dither"+ OutputId + ", saturate( "+ driver + " * 1.00001 ) );" ); + } + + //RegisterLocalVariable( 0, functionResult, ref dataCollector, "dither" + OutputId ); + m_outputPorts[ 0 ].SetLocalValue( "dither" + OutputId, dataCollector.PortCategory ); + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_selectedPatternInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 15404 ) + { + m_customScreenPos = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + UpdatePorts(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedPatternInt ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_customScreenPos ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs.meta new file mode 100644 index 00000000..aa99af61 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 284ebed5f88c13e45bc331b2df93aa75 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs new file mode 100644 index 00000000..eec5532e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs @@ -0,0 +1,34 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Encode Depth Normal", "Miscellaneous", "Encodes both Depth and Normal values into a Float4 value" )] + public sealed class EncodeDepthNormalNode : ParentNode + { + private const string EncodeDepthNormalFunc = "EncodeDepthNormal( {0}, {1} )"; + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "Depth" ); + AddInputPort( WirePortDataType.FLOAT3, false, "Normal" ); + AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); + string depthValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string normalValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + RegisterLocalVariable( 0, string.Format( EncodeDepthNormalFunc, depthValue, normalValue ), ref dataCollector, "encodedDepthNormal" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs.meta new file mode 100644 index 00000000..83db8e8e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: cabbbe25e4b26b54c84e27007c08a7dd +timeCreated: 1513695146 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs new file mode 100644 index 00000000..b3f95a02 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs @@ -0,0 +1,27 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Encode Float RGBA", "Miscellaneous", "Encodes [0..1] range float into RGBA color, for storage in low precision render target" )] + public sealed class EncodeFloatRGBAHlpNode : HelperParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "EncodeFloatRGBA"; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_outputPorts[ 0 ].Name = "RGBA"; + m_previewShaderGUID = "c21569bf5b9371b4ca13c0c00abd5562"; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "encodeFloatRGBA" + OutputId; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs.meta new file mode 100644 index 00000000..0bd4d50a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6532496dc1791d94cbb46004000bda61 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs new file mode 100644 index 00000000..093389e5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs @@ -0,0 +1,27 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Encode Float RG ", "Miscellaneous", "Encodes [0..1] range float into a float2" )] + public sealed class EncodeFloatRGHlpNode : HelperParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "EncodeFloatRG "; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); + m_outputPorts[ 0 ].Name = "RG"; + m_previewShaderGUID = "a44b520baa5c39e41bc69a22ea46f24d"; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "encodeFloatRG" + OutputId; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs.meta new file mode 100644 index 00000000..44b52dcf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d8bce5e7063ac6b4d93aaf15f7fd1b10 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs new file mode 100644 index 00000000..767097bc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs @@ -0,0 +1,27 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Encode View Normal Stereo", "Miscellaneous", "Encodes view space normal into two numbers in [0..1] range" )] + public sealed class EncodeViewNormalStereoHlpNode : HelperParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "EncodeViewNormalStereo"; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ 0 ].Name = "XYZ"; + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); + m_previewShaderGUID = "3d0b3d482b7246c4cb60fa73e6ceac6c"; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "encodeViewNormalStereo" + OutputId; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs.meta new file mode 100644 index 00000000..2d81a4bb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 17511ec398441ac479a2dd77d2531837 +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs new file mode 100644 index 00000000..afeaae0f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs @@ -0,0 +1,122 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Gamma To Linear", "Image Effects", "Converts color from gamma space to linear space" )] + public sealed class GammaToLinearNode : HelperParentNode + { + public readonly static string[] ModeListStr = { "Fast sRGB to Linear", "Exact sRGB to Linear" }; + public readonly static int[] ModeListInt = { 0, 1 }; + + public readonly static string[] ModeListStrLW = { "Fast sRGB to Linear", "Exact sRGB to Linear", "Gamma 2.0 to Linear", "Gamma 2.2 to Linear" }; + public readonly static int[] ModeListIntLW = { 0, 1, 2, 3 }; + + [SerializeField] + public int m_selectedMode = 0; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "GammaToLinearSpace"; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ 0 ].Name = "RGB"; + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_autoWrapProperties = true; + m_previewShaderGUID = "e82a888a6ebdb1443823aafceaa051b9"; + m_textLabelWidth = 120; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "gammaToLinear" + OutputId; + } + + public override void DrawProperties() + { + base.DrawProperties(); + if( ContainerGraph.IsSRP ) + { + m_selectedMode = EditorGUILayoutIntPopup( "Mode", m_selectedMode, ModeListStrLW, ModeListIntLW ); + EditorGUILayout.HelpBox( "Fast sRGB: fast approximation from sRGB to Linear\n\nExact sRGB: a more expensive but exact calculation from sRGB to Linear.\n\nGamma 2.0: crude approximation from Gamma to Linear using a power of 2.0 gamma value\n\nGamma 2.2: an approximation from Gamma to Linear using a power of 2.2 gamma value", MessageType.None ); + } + else + { + m_selectedMode = EditorGUILayoutIntPopup( "Mode", m_selectedMode, ModeListStr, ModeListInt ); + EditorGUILayout.HelpBox( "Fast sRGB: fast approximation from sRGB to Linear\n\nExact sRGB: a more expensive but exact calculation from sRGB to Linear.", MessageType.None ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + string result = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + if( !dataCollector.IsSRP ) + { + m_selectedMode = Mathf.Min( m_selectedMode, 1 ); + + if( m_selectedMode == 1 ) + { + dataCollector.AddLocalVariable( UniqueId, "half3 " + m_localVarName + " = " + result + ";" ); + dataCollector.AddLocalVariable( UniqueId, m_localVarName + " = half3( GammaToLinearSpaceExact(" + m_localVarName + ".r), GammaToLinearSpaceExact(" + m_localVarName + ".g), GammaToLinearSpaceExact(" + m_localVarName + ".b) );" ); + return m_localVarName; + } + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + else + { + dataCollector.AddToIncludes( UniqueId, TemplateHelperFunctions.CoreCommonLib ); + dataCollector.AddToIncludes( UniqueId, TemplateHelperFunctions.CoreColorLib ); + switch( m_selectedMode ) + { + default: + case 0: + m_funcLWFormatOverride = "FastSRGBToLinear( {0} )"; + m_funcHDFormatOverride = "FastSRGBToLinear( {0} )"; + break; + case 1: + m_funcLWFormatOverride = "SRGBToLinear( {0} )"; + m_funcHDFormatOverride = "SRGBToLinear( {0} )"; + break; + case 2: + m_funcLWFormatOverride = "Gamma20ToLinear( {0} )"; + m_funcHDFormatOverride = "Gamma20ToLinear( {0} )"; + break; + case 3: + m_funcLWFormatOverride = "Gamma22ToLinear( {0} )"; + m_funcHDFormatOverride = "Gamma22ToLinear( {0} )"; + break; + } + + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedMode ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 11003 && UIUtils.CurrentShaderVersion() <= 14503 ) + { + bool fast = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + if( fast ) + m_selectedMode = 1; + } + + if( UIUtils.CurrentShaderVersion() > 14503 ) + { + m_selectedMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs.meta new file mode 100644 index 00000000..703e4d43 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: cb2775ac410d0134c85b7f1ac0a0399f +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs new file mode 100644 index 00000000..f6a365bf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs @@ -0,0 +1,93 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +//https://docs.unity3d.com/Manual/SL-BuiltinFunctions.html + +using System; +using UnityEngine; +namespace AmplifyShaderEditor +{ + [Serializable] + public class HelperParentNode : ParentNode + { + [SerializeField] + protected string m_funcType = string.Empty; + + [SerializeField] + protected string m_funcLWFormatOverride = string.Empty; + + [SerializeField] + protected string m_funcHDFormatOverride = string.Empty; + + protected string m_localVarName = null; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + } + + public override string GetIncludes() + { + return Constants.UnityCgLibFuncs; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + + if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) + dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); + + string concatResults = string.Empty; + bool first = true; + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].Visible ) + { + if( !first ) + { + concatResults += " , "; + } + else + { + first = false; + } + + string result = string.Empty; + if( m_inputPorts[ i ].IsConnected ) + { + result = m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); + } + else + { + result = m_inputPorts[ i ].WrappedInternalData; + } + + concatResults += result; + } + } + string finalResult = m_funcType + "( " + concatResults + " )"; + if( dataCollector.IsTemplate ) + { + if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.URP && !string.IsNullOrEmpty( m_funcLWFormatOverride ) ) + { + finalResult = string.Format( m_funcLWFormatOverride, concatResults ); + } + else if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP && !string.IsNullOrEmpty( m_funcHDFormatOverride ) ) + { + finalResult = string.Format( m_funcHDFormatOverride, concatResults ); + } + + } + + RegisterLocalVariable( 0, finalResult, ref dataCollector, m_localVarName ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs.meta new file mode 100644 index 00000000..b1414ef2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 0eba64bdadd330743894a0623677cb83 +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs new file mode 100644 index 00000000..81171cc4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs @@ -0,0 +1,127 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Linear To Gamma", "Image Effects", "Converts color from linear space to gamma space" )] + public sealed class LinearToGammaNode : HelperParentNode + { + //[SerializeField] + //private bool m_exact = false; + + //private readonly static GUIContent LGExactContent = new GUIContent( "Exact Conversion", "Uses a precise version of the conversion, it's more expensive and often not needed." ); + + public readonly static string[] ModeListStr = { "Fast Linear to sRGB", "Exact Linear to sRGB" }; + public readonly static int[] ModeListInt = { 0, 1 }; + + public readonly static string[] ModeListStrLW = { "Fast Linear to sRGB", "Exact Linear to sRGB", "Linear to Gamma 2.0", "Linear to Gamma 2.2" }; + public readonly static int[] ModeListIntLW = { 0, 1, 2, 3 }; + + [SerializeField] + public int m_selectedMode = 0; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "LinearToGammaSpace"; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ 0 ].Name = "RGB"; + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_autoWrapProperties = true; + m_previewShaderGUID = "9027c408b928c5c4d8b450712049d541"; + m_textLabelWidth = 120; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "linearToGamma" + OutputId; + } + + public override void DrawProperties() + { + base.DrawProperties(); + if( ContainerGraph.IsSRP ) + { + m_selectedMode = EditorGUILayoutIntPopup( "Mode", m_selectedMode, ModeListStrLW, ModeListIntLW ); + EditorGUILayout.HelpBox( "Fast Linear: fast approximation from Linear to sRGB\n\nExact Linear: a more expensive but exact calculation from Linear to sRGB.\n\nLinear 2.0: crude approximation from Linear to Gamma using a power of 1/2.0 gamma value\n\nLinear 2.2: an approximation from Linear to Gamma using a power of 1/2.2 gamma value", MessageType.None ); + } + else + { + m_selectedMode = EditorGUILayoutIntPopup( "Mode", m_selectedMode, ModeListStr, ModeListInt ); + EditorGUILayout.HelpBox( "Fast Linear: fast approximation from Linear to sRGB\n\nExact Linear: a more expensive but exact calculation from Linear to sRGB.", MessageType.None ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + string result = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + if( !dataCollector.IsSRP ) + { + m_selectedMode = Mathf.Min( m_selectedMode, 1 ); + + if( m_selectedMode == 1 ) + { + dataCollector.AddLocalVariable( UniqueId, "half3 " + m_localVarName + " = " + result + ";" ); + dataCollector.AddLocalVariable( UniqueId, m_localVarName + " = half3( LinearToGammaSpaceExact(" + m_localVarName + ".r), LinearToGammaSpaceExact(" + m_localVarName + ".g), LinearToGammaSpaceExact(" + m_localVarName + ".b) );" ); + return m_localVarName; + } + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + else + { + dataCollector.AddToIncludes( UniqueId, TemplateHelperFunctions.CoreCommonLib ); + dataCollector.AddToIncludes( UniqueId, TemplateHelperFunctions.CoreColorLib ); + switch( m_selectedMode ) + { + default: + case 0: + m_funcLWFormatOverride = "FastLinearToSRGB( {0} )"; + m_funcHDFormatOverride = "FastLinearToSRGB( {0} )"; + break; + case 1: + m_funcLWFormatOverride = "LinearToSRGB( {0} )"; + m_funcHDFormatOverride = "LinearToSRGB( {0} )"; + break; + case 2: + m_funcLWFormatOverride = "LinearToGamma20( {0} )"; + m_funcHDFormatOverride = "LinearToGamma20( {0} )"; + break; + case 3: + m_funcLWFormatOverride = "LinearToGamma22( {0} )"; + m_funcHDFormatOverride = "LinearToGamma22( {0} )"; + break; + } + + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedMode ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 11003 && UIUtils.CurrentShaderVersion() <= 14503 ) + { + bool fast = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + if( fast ) + m_selectedMode = 1; + } + + if( UIUtils.CurrentShaderVersion() > 14503 ) + { + m_selectedMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs.meta new file mode 100644 index 00000000..ac87a8e7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a5b8a474628aeca4e86b1599f0b26ebc +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs new file mode 100644 index 00000000..6f9dd6c6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Luminance", "Image Effects", "Converts color to luminance (grayscale)", Deprecated = true, DeprecatedAlternativeType = typeof( TFHCGrayscale ), DeprecatedAlternative = "Grayscale" )] + public sealed class LuminanceHlpNode : HelperParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "Luminance"; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ 0 ].Name = "RGB"; + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "luminance" + OutputId; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs.meta new file mode 100644 index 00000000..21335731 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e8567c2e3eb634a428819fbdfbff110f +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs new file mode 100644 index 00000000..1ca3d3e2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs @@ -0,0 +1,43 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Object Space Light Dir", "Lighting", "Computes object space light direction (not normalized)" )] + public sealed class ObjSpaceLightDirHlpNode : HelperParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "ObjSpaceLightDir"; + m_inputPorts[ 0 ].Visible = false; + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_outputPorts[ 0 ].Name = "XYZ"; + + AddOutputPort( WirePortDataType.FLOAT, "X" ); + AddOutputPort( WirePortDataType.FLOAT, "Y" ); + AddOutputPort( WirePortDataType.FLOAT, "Z" ); + + m_useInternalPortData = false; + m_previewShaderGUID = "c7852de24cec4a744b5358921e23feee"; + m_drawPreviewAsSphere = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.IsTemplate ) + { + //Template must have its Light Mode correctly configured on tags to work as intended + return GetOutputVectorItem( 0, outputId, dataCollector.TemplateDataCollectorInstance.GetObjectSpaceLightDir( CurrentPrecisionType ) ); + } + + dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); + + string vertexPos = GeneratorUtils.GenerateVertexPosition( ref dataCollector, UniqueId, WirePortDataType.FLOAT4 ); + return GetOutputVectorItem( 0, outputId, GeneratorUtils.GenerateObjectLightDirection( ref dataCollector, UniqueId, CurrentPrecisionType, vertexPos ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs.meta new file mode 100644 index 00000000..bcb73549 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 0da9baf35c74c7e468cbe50c3d23ccf0 +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs new file mode 100644 index 00000000..43a67bb7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs @@ -0,0 +1,50 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Object Space View Dir", "Object Transform", "Object space direction (not normalized) from given object space vertex position towards the camera",castType:null, shortcutKey:KeyCode.None, available:false, deprecated:true )] + public sealed class ObjSpaceViewDirHlpNode : HelperParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "ObjSpaceViewDir"; + //TODO: revisit this later + m_funcLWFormatOverride = "( mul(GetWorldToObjectMatrix(), float4(_WorldSpaceCameraPos.xyz, 1)).xyz - {0}.xyz )"; + m_funcHDFormatOverride = "( mul(GetWorldToObjectMatrix(), float4(_WorldSpaceCameraPos.xyz, 1)).xyz - {0}.xyz )"; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_inputPorts[ 0 ].Vector4InternalData = new UnityEngine.Vector4( 0, 0, 0, 1 ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_outputPorts[ 0 ].Name = "XYZ"; + AddOutputPort( WirePortDataType.FLOAT, "X" ); + AddOutputPort( WirePortDataType.FLOAT, "Y" ); + AddOutputPort( WirePortDataType.FLOAT, "Z" ); + m_previewShaderGUID = "c7852de24cec4a744b5358921e23feee"; + + m_errorMessageTooltip = "This node still works but is now deprecated. Please use \"View Dir\" instead."; + m_errorMessageTypeIsError = NodeMessageType.Warning; + m_showErrorMessage = true; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "objectSpaceViewDir" + OutputId; + } + + public override void DrawProperties() + { + base.DrawProperties(); + if ( m_showErrorMessage ) + { + EditorGUILayout.HelpBox( m_errorMessageTooltip, MessageType.Warning ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs.meta new file mode 100644 index 00000000..07576404 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 590b8e54b63ad344f8d8c372e4fc5ed5 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs new file mode 100644 index 00000000..929f41ba --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs @@ -0,0 +1,148 @@ +using UnityEngine; +using UnityEditor; + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Parallax Mapping", "UV Coordinates", "Calculates offseted UVs for parallax mapping" )] + public sealed class ParallaxMappingNode : ParentNode + { + private enum ParallaxType { Normal, Planar } + + [SerializeField] + private int m_selectedParallaxTypeInt = 0; + + [SerializeField] + private ParallaxType m_selectedParallaxType = ParallaxType.Normal; + + private readonly string[] m_parallaxTypeStr = { "Normal", "Planar" }; + + private int m_cachedPropertyId = -1; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); + AddInputPort( WirePortDataType.FLOAT, false, "Height" ); + AddInputPort( WirePortDataType.FLOAT, false, "Scale" ); + AddInputPort( WirePortDataType.FLOAT3, false, "ViewDir (tan)" ); + AddOutputPort( WirePortDataType.FLOAT2, "Out" ); + m_useInternalPortData = true; + m_autoDrawInternalPortData = true; + m_autoWrapProperties = true; + m_textLabelWidth = 105; + UpdateTitle(); + m_forceDrawPreviewAsPlane = true; + m_hasLeftDropdown = true; + m_previewShaderGUID = "589f12f68e00ac74286815aa56053fcc"; + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_cachedPropertyId == -1 ) + m_cachedPropertyId = Shader.PropertyToID( "_ParallaxType" ); + + PreviewMaterial.SetFloat( m_cachedPropertyId, ( m_selectedParallaxType == ParallaxType.Normal ? 0 : 1 ) ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + + string textcoords = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string height = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string scale = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + string viewDirTan = m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ); + string localVarName = "Offset" + OutputId; + string calculation = ""; + + switch( m_selectedParallaxType ) + { + default: + case ParallaxType.Normal: + calculation = "( ( " + height + " - 1 ) * " + viewDirTan + ".xy * " + scale + " ) + " + textcoords; + break; + case ParallaxType.Planar: + calculation = "( ( " + height + " - 1 ) * ( " + viewDirTan + ".xy / " + viewDirTan + ".z ) * " + scale + " ) + " + textcoords; + break; + } + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, localVarName, calculation ); + //dataCollector.AddToLocalVariables( UniqueId, m_currentPrecisionType, m_outputPorts[ 0 ].DataType, localVarName, calculation ); + return GetOutputVectorItem( 0, outputId, localVarName ); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_selectedParallaxTypeInt = m_upperLeftWidget.DrawWidget( this, m_selectedParallaxTypeInt, m_parallaxTypeStr ); + if( EditorGUI.EndChangeCheck() ) + { + switch( m_selectedParallaxTypeInt ) + { + default: + case 0: m_selectedParallaxType = ParallaxType.Normal; break; + case 1: m_selectedParallaxType = ParallaxType.Planar; break; + } + UpdateTitle(); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + + EditorGUI.BeginChangeCheck(); + m_selectedParallaxTypeInt = EditorGUILayoutPopup( "Parallax Type", m_selectedParallaxTypeInt, m_parallaxTypeStr ); + if( EditorGUI.EndChangeCheck() ) + { + switch( m_selectedParallaxTypeInt ) + { + default: + case 0: m_selectedParallaxType = ParallaxType.Normal; break; + case 1: m_selectedParallaxType = ParallaxType.Planar; break; + } + UpdateTitle(); + } + + EditorGUILayout.HelpBox( "Normal type does a cheaper approximation thats view dependent while Planar is more accurate but generates higher aliasing artifacts at steep angles.", MessageType.None ); + } + + + void UpdateTitle() + { + m_additionalContent.text = string.Format( Constants.SubTitleTypeFormatStr, m_parallaxTypeStr[ m_selectedParallaxTypeInt ] ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_selectedParallaxType = (ParallaxType)Enum.Parse( typeof( ParallaxType ), GetCurrentParam( ref nodeParams ) ); + switch( m_selectedParallaxType ) + { + default: + case ParallaxType.Normal: m_selectedParallaxTypeInt = 0; break; + case ParallaxType.Planar: m_selectedParallaxTypeInt = 1; break; + } + UpdateTitle(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedParallaxType ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs.meta new file mode 100644 index 00000000..0cfb39d4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 96d8f50a7481d5247b16cb16c053d5f6 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs new file mode 100644 index 00000000..32605fd7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs @@ -0,0 +1,650 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; + +using System; +namespace AmplifyShaderEditor +{ + enum POMTexTypes + { + Texture2D, + Texture3D, + TextureArray + }; + + [Serializable] + [NodeAttributes( "Parallax Occlusion Mapping", "UV Coordinates", "Calculates offseted UVs for parallax occlusion mapping" )] + public sealed class ParallaxOcclusionMappingNode : ParentNode + { + private const string ArrayIndexStr = "Array Index"; + private const string Tex3DSliceStr = "Tex3D Slice"; + + private readonly string[] m_channelTypeStr = { "Red Channel", "Green Channel", "Blue Channel", "Alpha Channel" }; + private readonly string[] m_channelTypeVal = { "r", "g", "b", "a" }; + + [SerializeField] + private int m_selectedChannelInt = 0; + + //[SerializeField] + //private int m_minSamples = 8; + + //[SerializeField] + //private int m_maxSamples = 16; + [SerializeField] + private InlineProperty m_inlineMinSamples = new InlineProperty( 8 ); + + [SerializeField] + private InlineProperty m_inlineMaxSamples = new InlineProperty( 16 ); + + [SerializeField] + private int m_sidewallSteps = 2; + + [SerializeField] + private float m_defaultScale = 0.02f; + + [SerializeField] + private float m_defaultRefPlane = 0f; + + [SerializeField] + private bool m_clipEnds = false; + + [SerializeField] + private Vector2 m_tilling = new Vector2( 1, 1 ); + + [SerializeField] + private bool m_useCurvature = false; + + [SerializeField] + private Vector2 m_CurvatureVector = new Vector2( 0, 0 ); + + private string m_functionHeader = "POM( {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14} )"; + private string m_functionBody = string.Empty; + + //private const string WorldDirVarStr = "worldViewDir"; + + private InputPort m_uvPort; + private InputPort m_texPort; + private InputPort m_ssPort; + private InputPort m_scalePort; + private InputPort m_viewdirTanPort; + private InputPort m_minSamplesPort; + private InputPort m_maxSamplesPort; + private InputPort m_sidewallStepsPort; + private InputPort m_refPlanePort; + private InputPort m_curvaturePort; + private InputPort m_arrayIndexPort; + + private OutputPort m_pomUVPort; + + private Vector4Node m_texCoordsHelper; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT2, false, "UV",-1,MasterNodePortCategory.Fragment,0); + AddInputPort( WirePortDataType.SAMPLER2D, false, "Tex", -1, MasterNodePortCategory.Fragment, 1 ); + AddInputPort( WirePortDataType.SAMPLERSTATE, false, "SS", -1, MasterNodePortCategory.Fragment, 7 ); + AddInputPort( WirePortDataType.FLOAT, false, "Scale", -1, MasterNodePortCategory.Fragment, 2 ); + AddInputPort( WirePortDataType.FLOAT3, false, "ViewDir (tan)", -1, MasterNodePortCategory.Fragment, 3 ); + AddInputPort( WirePortDataType.INT, false, "Min Samples", -1, MasterNodePortCategory.Fragment, 8 ); + AddInputPort( WirePortDataType.INT, false, "Max Samples", -1, MasterNodePortCategory.Fragment, 9 ); + AddInputPort( WirePortDataType.INT, false, "Sidewall Steps", -1, MasterNodePortCategory.Fragment, 10 ); + AddInputPort( WirePortDataType.FLOAT, false, "Ref Plane", -1, MasterNodePortCategory.Fragment, 4 ); + AddInputPort( WirePortDataType.FLOAT2, false, "Curvature", -1, MasterNodePortCategory.Fragment, 5 ); + AddInputPort( WirePortDataType.FLOAT, false, ArrayIndexStr, -1, MasterNodePortCategory.Fragment, 6 ); + + AddOutputPort( WirePortDataType.FLOAT2, "Out" ); + + m_uvPort = GetInputPortByUniqueId( 0 ); + m_texPort = GetInputPortByUniqueId( 1 ); + m_texPort.CreatePortRestrictions( WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLER2DARRAY ); + m_ssPort = GetInputPortByUniqueId( 7 ); + m_ssPort.CreatePortRestrictions( WirePortDataType.SAMPLERSTATE ); + m_scalePort = GetInputPortByUniqueId( 2 ); + m_viewdirTanPort = GetInputPortByUniqueId( 3 ); + m_refPlanePort = GetInputPortByUniqueId( 4 ); + m_pomUVPort = m_outputPorts[ 0 ]; + m_curvaturePort = GetInputPortByUniqueId( 5 ); + m_arrayIndexPort = GetInputPortByUniqueId( 6 ); + m_minSamplesPort = GetInputPortByUniqueId( 8 ); + m_maxSamplesPort = GetInputPortByUniqueId( 9 ); + m_sidewallStepsPort = GetInputPortByUniqueId( 10 ); + + m_scalePort.FloatInternalData = 0.02f; + m_useInternalPortData = false; + m_textLabelWidth = 130; + m_autoWrapProperties = true; + m_curvaturePort.Visible = false; + m_arrayIndexPort.Visible = false; + UpdateSampler(); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_texPort.MatchPortToConnection(); + UpdateIndexPort(); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_texPort.MatchPortToConnection(); + UpdateIndexPort(); + } + + public override void DrawProperties() + { + base.DrawProperties(); + + EditorGUI.BeginChangeCheck(); + m_selectedChannelInt = EditorGUILayoutPopup( "Channel", m_selectedChannelInt, m_channelTypeStr ); + if ( EditorGUI.EndChangeCheck() ) + { + UpdateSampler(); + } + //EditorGUIUtility.labelWidth = 105; + + //m_minSamples = EditorGUILayoutIntSlider( "Min Samples", m_minSamples, 1, 128 ); + UndoParentNode inst = this; + EditorGUI.BeginDisabledGroup( m_minSamplesPort.IsConnected ); + m_inlineMinSamples.CustomDrawer( ref inst, ( x ) => { m_inlineMinSamples.IntValue = EditorGUILayoutIntSlider( "Min Samples", m_inlineMinSamples.IntValue, 1, 128 ); }, "Min Samples" ); + EditorGUI.EndDisabledGroup(); + + //m_maxSamples = EditorGUILayoutIntSlider( "Max Samples", m_maxSamples, 1, 128 ); + EditorGUI.BeginDisabledGroup( m_maxSamplesPort.IsConnected ); + m_inlineMaxSamples.CustomDrawer( ref inst, ( x ) => { m_inlineMaxSamples.IntValue = EditorGUILayoutIntSlider( "Max Samples", m_inlineMaxSamples.IntValue, 1, 128 ); }, "Max Samples" ); + EditorGUI.EndDisabledGroup(); + + EditorGUI.BeginDisabledGroup( m_sidewallStepsPort.IsConnected ); + m_sidewallSteps = EditorGUILayoutIntSlider( "Sidewall Steps", m_sidewallSteps, 0, 10 ); + EditorGUI.EndDisabledGroup(); + + EditorGUI.BeginDisabledGroup(m_scalePort.IsConnected ); + m_defaultScale = EditorGUILayoutSlider( "Default Scale", m_defaultScale, 0, 1 ); + EditorGUI.EndDisabledGroup(); + + EditorGUI.BeginDisabledGroup( m_refPlanePort.IsConnected ); + m_defaultRefPlane = EditorGUILayoutSlider( "Default Ref Plane", m_defaultRefPlane, 0, 1 ); + EditorGUI.EndDisabledGroup(); + //EditorGUIUtility.labelWidth = m_textLabelWidth; + + if( m_arrayIndexPort.Visible && !m_arrayIndexPort.IsConnected ) + { + m_arrayIndexPort.FloatInternalData = EditorGUILayoutFloatField( "Array Index", m_arrayIndexPort.FloatInternalData ); + } + + //float cached = EditorGUIUtility.labelWidth; + //EditorGUIUtility.labelWidth = 70; + m_clipEnds = EditorGUILayoutToggle( "Clip Edges", m_clipEnds ); + //EditorGUIUtility.labelWidth = -1; + //EditorGUIUtility.labelWidth = 100; + //EditorGUILayout.BeginHorizontal(); + //EditorGUI.BeginDisabledGroup( !m_clipEnds ); + //m_tilling = EditorGUILayout.Vector2Field( string.Empty, m_tilling ); + //EditorGUI.EndDisabledGroup(); + //EditorGUILayout.EndHorizontal(); + //EditorGUIUtility.labelWidth = cached; + + EditorGUI.BeginChangeCheck(); + m_useCurvature = EditorGUILayoutToggle( "Clip Silhouette", m_useCurvature ); + if ( EditorGUI.EndChangeCheck() ) + { + UpdateCurvaturePort(); + } + + EditorGUI.BeginDisabledGroup( !(m_useCurvature && !m_curvaturePort.IsConnected) ); + m_CurvatureVector = EditorGUILayoutVector2Field( string.Empty, m_CurvatureVector ); + EditorGUI.EndDisabledGroup(); + + EditorGUILayout.HelpBox( "WARNING:\nTex must be connected to a Texture Object for this node to work\n\nMin and Max samples:\nControl the minimum and maximum number of layers extruded\n\nSidewall Steps:\nThe number of interpolations done to smooth the extrusion result on the side of the layer extrusions, min is used at steep angles while max is used at orthogonal angles\n\n"+ + "Ref Plane:\nReference plane lets you adjust the starting reference height, 0 = deepen ground, 1 = raise ground, any value above 0 might cause distortions at higher angles\n\n"+ + "Clip Edges:\nThis will clip the ends of your uvs to give a more 3D look at the edges. It'll use the tilling given by your Heightmap input.\n\n"+ + "Clip Silhouette:\nTurning this on allows you to use the UV coordinates to clip the effect curvature in U or V axis, useful for cylinders, works best with 'Clip Edges' turned OFF", MessageType.None ); + } + + private void UpdateIndexPort() + { + m_arrayIndexPort.Visible = m_texPort.DataType != WirePortDataType.SAMPLER2D; + if( m_arrayIndexPort.Visible ) + { + m_arrayIndexPort.Name = m_texPort.DataType == WirePortDataType.SAMPLER3D ? Tex3DSliceStr : ArrayIndexStr; + } + SizeIsDirty = true; + } + + private void UpdateSampler() + { + m_texPort.Name = "Tex (" + m_channelTypeVal[ m_selectedChannelInt ].ToUpper() + ")"; + } + + private void UpdateCurvaturePort() + { + if ( m_useCurvature ) + m_curvaturePort.Visible = true; + else + m_curvaturePort.Visible = false; + + m_sizeIsDirty = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( !m_texPort.IsConnected ) + { + UIUtils.ShowMessage( UniqueId, "Parallax Occlusion Mapping node only works if a Texture Object is connected to its Tex (R) port" ); + return "0"; + } + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; + + string arrayIndex = m_arrayIndexPort.Visible?m_arrayIndexPort.GeneratePortInstructions( ref dataCollector ):"0"; + string textcoords = m_uvPort.GeneratePortInstructions( ref dataCollector ); + if( m_texPort.DataType == WirePortDataType.SAMPLER3D ) + { + string texName = "pomTexCoord" + OutputId; + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, texName, string.Format( "float3({0},{1})", textcoords, arrayIndex ) ); + textcoords = texName; + } + + string texture = m_texPort.GeneratePortInstructions( ref dataCollector ); + GeneratePOMfunction( ref dataCollector ); + string scale = m_defaultScale.ToString(); + if( m_scalePort.IsConnected ) + scale = m_scalePort.GeneratePortInstructions( ref dataCollector ); + + string viewDirTan = ""; + if ( !m_viewdirTanPort.IsConnected ) + { + if ( !dataCollector.DirtyNormal ) + dataCollector.ForceNormal = true; + + + if ( dataCollector.IsTemplate ) + { + viewDirTan = dataCollector.TemplateDataCollectorInstance.GetViewDir( CurrentPrecisionType, space: ViewSpace.Tangent ); + } + else + { + viewDirTan = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId, space: ViewSpace.Tangent ); + //dataCollector.AddToInput( UniqueId, SurfaceInputs.VIEW_DIR, m_currentPrecisionType ); + //viewDirTan = Constants.InputVarStr + "." + UIUtils.GetInputValueFromType( SurfaceInputs.VIEW_DIR ); + } + } + else + { + viewDirTan = m_viewdirTanPort.GeneratePortInstructions( ref dataCollector ); + } + + // min/max samples + string minSamples = m_minSamplesPort.IsConnected ? m_minSamplesPort.GeneratePortInstructions( ref dataCollector ) : m_inlineMinSamples.GetValueOrProperty( false ); + string maxSamples = m_maxSamplesPort.IsConnected ? m_maxSamplesPort.GeneratePortInstructions( ref dataCollector ) : m_inlineMaxSamples.GetValueOrProperty( false ); + string sidewallSteps = m_sidewallStepsPort.IsConnected ? m_sidewallStepsPort.GeneratePortInstructions( ref dataCollector ) : m_sidewallSteps.ToString(); + + //generate world normal + string normalWorld = string.Empty; + if ( dataCollector.IsTemplate ) + { + normalWorld = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( CurrentPrecisionType ); + } + else + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + normalWorld = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId ); + } + + string worldViewDir = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId, space: ViewSpace.World ); + + string dx = "ddx("+ textcoords + ")"; + string dy = "ddy(" + textcoords + ")"; + + string refPlane = m_defaultRefPlane.ToString(); + if ( m_refPlanePort.IsConnected ) + refPlane = m_refPlanePort.GeneratePortInstructions( ref dataCollector ); + + + string curvature = "float2("+ m_CurvatureVector.x + "," + m_CurvatureVector.y + ")"; + if ( m_useCurvature ) + { + dataCollector.AddToProperties( UniqueId, "[Header(Parallax Occlusion Mapping)]", 300 ); + dataCollector.AddToProperties( UniqueId, "_CurvFix(\"Curvature Bias\", Range( 0 , 1)) = 1", 301 ); + dataCollector.AddToUniforms( UniqueId, "uniform float _CurvFix;" ); + + if ( m_curvaturePort.IsConnected ) + curvature = m_curvaturePort.GeneratePortInstructions( ref dataCollector ); + } + + + string localVarName = "OffsetPOM" + OutputId; + string textCoordsST = string.Empty; + //string textureSTType = dataCollector.IsSRP ? "float4 " : "uniform float4 "; + //dataCollector.AddToUniforms( UniqueId, textureSTType + texture +"_ST;"); + if( m_texCoordsHelper == null ) + { + m_texCoordsHelper = CreateInstance(); + m_texCoordsHelper.ContainerGraph = ContainerGraph; + m_texCoordsHelper.SetBaseUniqueId( UniqueId, true ); + m_texCoordsHelper.RegisterPropertyOnInstancing = false; + m_texCoordsHelper.AddGlobalToSRPBatcher = true; + } + + if( outsideGraph.IsInstancedShader ) + { + m_texCoordsHelper.CurrentParameterType = PropertyType.InstancedProperty; + } + else + { + m_texCoordsHelper.CurrentParameterType = PropertyType.Global; + } + m_texCoordsHelper.ResetOutputLocals(); + m_texCoordsHelper.SetRawPropertyName( texture + "_ST" ); + textCoordsST = m_texCoordsHelper.GenerateShaderForOutput( 0, ref dataCollector, false ); + ////// + + string textureArgs = string.Empty; + if( outsideGraph.SamplingMacros || m_texPort.DataType == WirePortDataType.SAMPLER2DARRAY ) + { + string sampler = string.Empty; + if( m_ssPort.IsConnected ) + { + sampler = m_ssPort.GeneratePortInstructions( ref dataCollector ); + } + else + { + sampler = GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, texture , VariableMode.Create ); + } + if( outsideGraph.IsSRP ) + { + textureArgs = texture + ", " + sampler; + } + else + { + textureArgs = texture + ", " + sampler; + } + } + else + { + textureArgs = texture; + } + //string functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, ( (m_pomTexType == POMTexTypes.TextureArray) ? "UNITY_PASS_TEX2DARRAY(" + texture + ")": texture), textcoords, dx, dy, normalWorld, worldViewDir, viewDirTan, m_minSamples, m_maxSamples, scale, refPlane, texture+"_ST.xy", curvature, arrayIndex ); + string functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, textureArgs, textcoords, dx, dy, normalWorld, worldViewDir, viewDirTan, minSamples, maxSamples, sidewallSteps, scale, refPlane, textCoordsST + ".xy", curvature, arrayIndex ); + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_pomUVPort.DataType, localVarName, functionResult ); + + return GetOutputVectorItem( 0, outputId, localVarName ); + } + + private void GeneratePOMfunction( ref MasterNodeDataCollector dataCollector ) + { + ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; + m_functionBody = string.Empty; + switch( m_texPort.DataType ) + { + default: + case WirePortDataType.SAMPLER2D: + { + string sampleParam = string.Empty; + sampleParam = GeneratorUtils.GetPropertyDeclaraction( "heightMap", TextureType.Texture2D, ", " ) + GeneratorUtils.GetSamplerDeclaraction( "samplerheightMap", TextureType.Texture2D, ", " ); + IOUtils.AddFunctionHeader( ref m_functionBody, string.Format("inline float2 POM( {0}float2 uvs, float2 dx, float2 dy, float3 normalWorld, float3 viewWorld, float3 viewDirTan, int minSamples, int maxSamples, int sidewallSteps, float parallax, float refPlane, float2 tilling, float2 curv, int index )", sampleParam )); + } + break; + case WirePortDataType.SAMPLER3D: + { + string sampleParam = string.Empty; + sampleParam = GeneratorUtils.GetPropertyDeclaraction( "heightMap", TextureType.Texture3D, ", " ) + GeneratorUtils.GetSamplerDeclaraction( "samplerheightMap", TextureType.Texture3D, ", " ); + IOUtils.AddFunctionHeader( ref m_functionBody, string.Format( "inline float2 POM( {0}float3 uvs, float3 dx, float3 dy, float3 normalWorld, float3 viewWorld, float3 viewDirTan, int minSamples, int maxSamples, int sidewallSteps, float parallax, float refPlane, float2 tilling, float2 curv, int index )", sampleParam ) ); + } + break; + case WirePortDataType.SAMPLER2DARRAY: + if( outsideGraph.IsSRP ) + IOUtils.AddFunctionHeader( ref m_functionBody, "inline float2 POM( TEXTURE2D_ARRAY(heightMap), SAMPLER(samplerheightMap), float2 uvs, float2 dx, float2 dy, float3 normalWorld, float3 viewWorld, float3 viewDirTan, int minSamples, int maxSamples, int sidewallSteps, float parallax, float refPlane, float2 tilling, float2 curv, int index )" ); + else + IOUtils.AddFunctionHeader( ref m_functionBody, "inline float2 POM( UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(heightMap), SamplerState samplerheightMap, float2 uvs, float2 dx, float2 dy, float3 normalWorld, float3 viewWorld, float3 viewDirTan, int minSamples, int maxSamples, int sidewallSteps, float parallax, float refPlane, float2 tilling, float2 curv, int index )" ); + break; + } + + IOUtils.AddFunctionLine( ref m_functionBody, "float3 result = 0;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float stepIndex = 0;" ); + //IOUtils.AddFunctionLine( ref m_functionBody, "float numSteps = ( float )( minSamples + dot( viewWorld, normalWorld ) * ( maxSamples - minSamples ) );" ); + //IOUtils.AddFunctionLine( ref m_functionBody, "float numSteps = ( float )lerp( maxSamples, minSamples, length( fwidth( uvs ) ) * 10 );" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float numSteps = floor( lerp( (float)maxSamples, (float)minSamples, saturate( dot( normalWorld, viewWorld ) ) ) );" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float layerHeight = 1.0 / numSteps;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float2 plane = parallax * ( viewDirTan.xy / viewDirTan.z );" ); + IOUtils.AddFunctionLine( ref m_functionBody, "uvs.xy += refPlane * plane;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float2 deltaTex = -plane * layerHeight;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float2 prevTexOffset = 0;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float prevRayZ = 1.0f;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float prevHeight = 0.0f;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float2 currTexOffset = deltaTex;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float currRayZ = 1.0f - layerHeight;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float currHeight = 0.0f;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float intersection = 0;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float2 finalTexOffset = 0;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "while ( stepIndex < numSteps + 1 )" ); + IOUtils.AddFunctionLine( ref m_functionBody, "{" ); + + string textureProp = "heightMap"; + string sampleState = "samplerheightMap"; + + string uvs = "uvs + currTexOffset"; + if( m_texPort.DataType == WirePortDataType.SAMPLER3D ) + uvs = "float3(uvs.xy + currTexOffset, uvs.z)"; + else if( m_texPort.DataType == WirePortDataType.SAMPLER2DARRAY ) + uvs = outsideGraph.IsSRP ? uvs + ", index" : "float3(" + uvs + ", index)"; + + string samplingCall = GeneratorUtils.GenerateSamplingCall( ref dataCollector, m_texPort.DataType, textureProp, sampleState, uvs, MipType.Derivative, "dx", "dy" ); + if( m_useCurvature ) + { + IOUtils.AddFunctionLine( ref m_functionBody, " \tresult.z = dot( curv, currTexOffset * currTexOffset );" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \tcurrHeight = " + samplingCall + "." + m_channelTypeVal[ m_selectedChannelInt ] + " * ( 1 - result.z );" ); + } + else + { + IOUtils.AddFunctionLine( ref m_functionBody, " \tcurrHeight = " + samplingCall + "." + m_channelTypeVal[ m_selectedChannelInt ] + ";" ); + } + IOUtils.AddFunctionLine( ref m_functionBody, " \tif ( currHeight > currRayZ )" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t{" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tstepIndex = numSteps + 1;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t}" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \telse" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t{" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tstepIndex++;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tprevTexOffset = currTexOffset;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tprevRayZ = currRayZ;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tprevHeight = currHeight;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tcurrTexOffset += deltaTex;" ); + if ( m_useCurvature ) + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tcurrRayZ -= layerHeight * ( 1 - result.z ) * (1+_CurvFix);" ); + else + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tcurrRayZ -= layerHeight;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t}" ); + IOUtils.AddFunctionLine( ref m_functionBody, "}" ); + + if ( m_sidewallSteps > 0 || m_sidewallStepsPort.IsConnected ) + { + IOUtils.AddFunctionLine( ref m_functionBody, "float sectionSteps = sidewallSteps;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float sectionIndex = 0;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float newZ = 0;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float newHeight = 0;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "while ( sectionIndex < sectionSteps )" ); + IOUtils.AddFunctionLine( ref m_functionBody, "{" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \tintersection = ( prevHeight - prevRayZ ) / ( prevHeight - currHeight + currRayZ - prevRayZ );" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \tfinalTexOffset = prevTexOffset + intersection * deltaTex;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \tnewZ = prevRayZ - intersection * layerHeight;" ); + + string uvs2 = "uvs + finalTexOffset"; + if( m_texPort.DataType == WirePortDataType.SAMPLER3D ) + uvs2 = "float3(uvs.xy + finalTexOffset, uvs.z)"; + else if( m_texPort.DataType == WirePortDataType.SAMPLER2DARRAY ) + uvs2 = outsideGraph.IsSRP ? uvs2 + ", index" : "float3(" + uvs2 + ", index)"; + + string samplingCall2 = GeneratorUtils.GenerateSamplingCall( ref dataCollector, m_texPort.DataType, textureProp, sampleState, uvs2, MipType.Derivative, "dx", "dy" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \tnewHeight = " + samplingCall2 + "." + m_channelTypeVal[ m_selectedChannelInt ] + ";" ); + + IOUtils.AddFunctionLine( ref m_functionBody, " \tif ( newHeight > newZ )" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t{" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tcurrTexOffset = finalTexOffset;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tcurrHeight = newHeight;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tcurrRayZ = newZ;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tdeltaTex = intersection * deltaTex;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tlayerHeight = intersection * layerHeight;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t}" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \telse" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t{" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tprevTexOffset = finalTexOffset;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tprevHeight = newHeight;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tprevRayZ = newZ;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tdeltaTex = ( 1 - intersection ) * deltaTex;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tlayerHeight = ( 1 - intersection ) * layerHeight;" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t}" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \tsectionIndex++;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "}" ); + } + else + { + IOUtils.AddFunctionLine( ref m_functionBody, "finalTexOffset = currTexOffset;" ); + } + + if ( m_useCurvature ) + { + IOUtils.AddFunctionLine( ref m_functionBody, "#ifdef UNITY_PASS_SHADOWCASTER" ); + IOUtils.AddFunctionLine( ref m_functionBody, "if ( unity_LightShadowBias.z == 0.0 )" ); + IOUtils.AddFunctionLine( ref m_functionBody, "{" ); + IOUtils.AddFunctionLine( ref m_functionBody, "#endif" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \tif ( result.z > 1 )" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tclip( -1 );" ); + IOUtils.AddFunctionLine( ref m_functionBody, "#ifdef UNITY_PASS_SHADOWCASTER" ); + IOUtils.AddFunctionLine( ref m_functionBody, "}" ); + IOUtils.AddFunctionLine( ref m_functionBody, "#endif" ); + } + + if ( m_clipEnds ) + { + IOUtils.AddFunctionLine( ref m_functionBody, "result.xy = uvs.xy + finalTexOffset;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "#ifdef UNITY_PASS_SHADOWCASTER" ); + IOUtils.AddFunctionLine( ref m_functionBody, "if ( unity_LightShadowBias.z == 0.0 )" ); + IOUtils.AddFunctionLine( ref m_functionBody, "{" ); + IOUtils.AddFunctionLine( ref m_functionBody, "#endif" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \tif ( result.x < 0 )" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tclip( -1 );" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \tif ( result.x > tilling.x )" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tclip( -1 );" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \tif ( result.y < 0 )" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tclip( -1 );" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \tif ( result.y > tilling.y )" ); + IOUtils.AddFunctionLine( ref m_functionBody, " \t \tclip( -1 );" ); + IOUtils.AddFunctionLine( ref m_functionBody, "#ifdef UNITY_PASS_SHADOWCASTER" ); + IOUtils.AddFunctionLine( ref m_functionBody, "}" ); + IOUtils.AddFunctionLine( ref m_functionBody, "#endif" ); + IOUtils.AddFunctionLine( ref m_functionBody, "return result.xy;" ); + } + else + { + IOUtils.AddFunctionLine( ref m_functionBody, "return uvs.xy + finalTexOffset;" ); + } + IOUtils.CloseFunctionBody( ref m_functionBody ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_selectedChannelInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + //m_minSamples = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + //m_maxSamples = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() < 15406 ) + { + m_inlineMinSamples.IntValue = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_inlineMaxSamples.IntValue = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + else + { + m_inlineMinSamples.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + m_inlineMaxSamples.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + m_sidewallSteps = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_defaultScale = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + m_defaultRefPlane = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + if ( UIUtils.CurrentShaderVersion() > 3001 ) + { + m_clipEnds = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + string[] vector2Component = GetCurrentParam( ref nodeParams ).Split( IOUtils.VECTOR_SEPARATOR ); + if ( vector2Component.Length == 2 ) + { + m_tilling.x = Convert.ToSingle( vector2Component[ 0 ] ); + m_tilling.y = Convert.ToSingle( vector2Component[ 1 ] ); + } + } + + if ( UIUtils.CurrentShaderVersion() > 5005 ) + { + m_useCurvature = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_CurvatureVector = IOUtils.StringToVector2( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 13103 ) + { + //if( UIUtils.CurrentShaderVersion() < 15307 ) + //{ + // GetCurrentParam( ref nodeParams ); + // //bool arrayIndexVisible = false; + // //arrayIndexVisible = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + // //m_pomTexType = arrayIndexVisible ? POMTexTypes.TextureArray : POMTexTypes.Texture2D; + //} + //else + //{ + // GetCurrentParam( ref nodeParams ); + // //m_pomTexType = (POMTexTypes)Enum.Parse( typeof(POMTexTypes), GetCurrentParam( ref nodeParams ) ); + //} + if( UIUtils.CurrentShaderVersion() <= 18201 ) + { + GetCurrentParam( ref nodeParams ); + } + UpdateIndexPort(); + } + + UpdateSampler(); + //GeneratePOMfunction( string.Empty ); + UpdateCurvaturePort(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedChannelInt ); + //IOUtils.AddFieldValueToString( ref nodeInfo, m_minSamples ); + //IOUtils.AddFieldValueToString( ref nodeInfo, m_maxSamples ); + m_inlineMinSamples.WriteToString( ref nodeInfo ); + m_inlineMaxSamples.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_sidewallSteps ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultScale ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultRefPlane ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_clipEnds ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_tilling.x.ToString() + IOUtils.VECTOR_SEPARATOR + m_tilling.y.ToString() ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_useCurvature ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector2ToString( m_CurvatureVector ) ); + //IOUtils.AddFieldValueToString( ref nodeInfo, m_useTextureArray ); + //IOUtils.AddFieldValueToString( ref nodeInfo, true ); + } + + public override void Destroy() + { + base.Destroy(); + //Not calling m_texCoordsHelper.Destroy() on purpose so UIUtils does not incorrectly unregister stuff + if( m_texCoordsHelper != null ) + { + DestroyImmediate( m_texCoordsHelper ); + m_texCoordsHelper = null; + } + + + m_uvPort = null; + m_texPort = null; + m_scalePort = null; + m_viewdirTanPort = null; + m_pomUVPort = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs.meta new file mode 100644 index 00000000..88e833b6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b2350150f3f2a0443827ca8925d5e759 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs new file mode 100644 index 00000000..26b8a542 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs @@ -0,0 +1,47 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Parallax Offset", "UV Coordinates", "Calculates UV offset for parallax normal mapping" )] + public sealed class ParallaxOffsetHlpNode : HelperParentNode + { + public readonly string[] ParallaxOffsetFunc = + { + "inline float2 ParallaxOffset( half h, half height, half3 viewDir )\n", + "{\n", + "\th = h * height - height/2.0;\n", + "\tfloat3 v = normalize( viewDir );\n", + "\tv.z += 0.42;\n", + "\treturn h* (v.xy / v.z);\n", + "}\n" + }; + + void OnSRPActionEvent( int outputId, ref MasterNodeDataCollector dataCollector ) + { + dataCollector.AddFunction( ParallaxOffsetFunc[ 0 ], ParallaxOffsetFunc, false ); + } + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "ParallaxOffset"; + m_inputPorts[ 0 ].ChangeProperties( "H", WirePortDataType.FLOAT, false ); + AddInputPort( WirePortDataType.FLOAT, false, "Height" ); + AddInputPort( WirePortDataType.FLOAT3, false, "ViewDir (tan)" ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); + m_outputPorts[ 0 ].Name = "Out"; + OnHDAction = OnSRPActionEvent; + OnLightweightAction = OnSRPActionEvent; + m_previewShaderGUID = "6085f804c6fbf354eac039c11feaa7cc"; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "paralaxOffset" + OutputId; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs.meta new file mode 100644 index 00000000..4549e0ef --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 83b7d6fe57585b74d80c429aef719200 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs new file mode 100644 index 00000000..f620406e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs @@ -0,0 +1,105 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Shade Vertex Lights", "Lighting", "Computes illumination from four per-vertex lights and ambient, given object space position & normal" )] + public sealed class ShadeVertexLightsHlpNode : ParentNode + { + private const string HelperMessage = "Shade Vertex Lights node only outputs correct results on\nTemplate Vertex/Frag shaders with their LightMode set to Vertex."; + private const string ShadeVertexLightFunc = "ShadeVertexLightsFull({0},{1},{2},{3})"; + private const string LightCount = "Light Count"; + private const string IsSpotlight = "Is Spotlight"; + private const int MinLightCount = 0; + private const int MaxLightCount = 8; + [SerializeField] + private int m_lightCount = 4; + + [SerializeField] + private bool m_enableSpotlight = false; + + private int _LightCountId; + private int _IsSpotlightId; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT4, false, "Vertex Position" ); + AddInputPort( WirePortDataType.FLOAT3, false, "Vertex Normal" ); + AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue ); + m_useInternalPortData = true; + //m_autoWrapProperties = true; + m_textLabelWidth = 90; + m_previewShaderGUID = "3b6075034a85ad047be2d31dd213fb4f"; + } + + public override void OnEnable() + { + base.OnEnable(); + _LightCountId = Shader.PropertyToID( "_LightCount" ); + _IsSpotlightId = Shader.PropertyToID( "_IsSpotlight" ); + } + + public override void DrawProperties() + { + base.DrawProperties(); + NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, DrawGeneralProperties ); + EditorGUILayout.HelpBox( HelperMessage, MessageType.Info ); + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + PreviewMaterial.SetInt( _LightCountId, m_lightCount ); + PreviewMaterial.SetInt( _IsSpotlightId, ( m_enableSpotlight ? 1 : 0 ) ); + + } + + void DrawGeneralProperties() + { + m_lightCount = EditorGUILayoutIntSlider( LightCount, m_lightCount, MinLightCount, MaxLightCount ); + m_enableSpotlight = EditorGUILayoutToggle( IsSpotlight, m_enableSpotlight ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.MasterNodeCategory == AvailableShaderTypes.SurfaceShader ) + UIUtils.ShowMessage( UniqueId, HelperMessage, MessageSeverity.Warning ); + + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); + + string vertexPosition = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string vertexNormal = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + string value = string.Format( ShadeVertexLightFunc, vertexPosition, vertexNormal, m_lightCount, m_enableSpotlight.ToString().ToLower() ); + + RegisterLocalVariable( 0, value, ref dataCollector, "shadeVertexLight" + OutputId ); + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 14301 ) + { + m_lightCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_enableSpotlight = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_lightCount ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_enableSpotlight ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs.meta new file mode 100644 index 00000000..0e308ea6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 74f44334b702bce4ba8e2681dc80fe3c +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs new file mode 100644 index 00000000..c87e6ca0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs @@ -0,0 +1,207 @@ +using System; +using UnityEditor; +using UnityEngine; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Surface Depth", "Surface Data", "Returns the surface view depth" )] + public sealed class SurfaceDepthNode : ParentNode + { + [SerializeField] + private int m_viewSpaceInt = 0; + private DepthMode m_depthMode { get { return ( DepthMode )m_viewSpaceInt; } } + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + private void UpdateAdditonalTitleText() + { + SetAdditonalTitleText( string.Format( Constants.SubTitleModeFormatStr, GeneratorUtils.DepthModeStr[ m_viewSpaceInt ] ) ); + } + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "Vertex Position" ); + AddOutputPort( WirePortDataType.FLOAT, "Depth" ); + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + UpdateAdditonalTitleText(); + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_viewSpaceInt = m_upperLeftWidget.DrawWidget( this, m_viewSpaceInt, GeneratorUtils.DepthModeStr ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateAdditonalTitleText(); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_viewSpaceInt = EditorGUILayoutPopup( "Depth Mode", m_viewSpaceInt, GeneratorUtils.DepthModeStr ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateAdditonalTitleText(); + } + } + + private string ApplyLinearDepthModifier( ref MasterNodeDataCollector dataCollector, string instruction ) + { + switch ( m_depthMode ) + { + case DepthMode.DepthLinearEye: instruction = GeneratorUtils.ApplyLinearDepthModifier( ref dataCollector, instruction, m_depthMode ); break; + case DepthMode.DepthLinear01: instruction = GeneratorUtils.ApplyLinearDepthModifier( ref dataCollector, instruction, m_depthMode ); break; + case DepthMode.DepthEye: instruction = string.Format( "( {0} ) * ( _ProjectionParams.z - _ProjectionParams.y )", instruction ); break; + case DepthMode.Depth01: + default: break; + } + return instruction; + } + + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowNoVertexModeNodeMessage( this ); + return "0"; + } + + if ( dataCollector.IsTemplate ) + { + if( m_inputPorts[ 0 ].IsConnected ) + { + string vertexPos = "vertexPos" + OutputId; + GenerateInputInVertex( ref dataCollector, 0, vertexPos, false ); + + string clipPos = dataCollector.TemplateDataCollectorInstance.GetClipPosForValue( vertexPos, OutputId ); + string varName = GeneratorUtils.DepthModeVarNameStr[ m_viewSpaceInt ] + OutputId; + + string instruction = string.Format( "{0}.z / {0}.w", clipPos ); + instruction = ApplyLinearDepthModifier( ref dataCollector, instruction ); + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, varName, instruction ); + return varName; + } + else + { + return dataCollector.TemplateDataCollectorInstance.GetSurfaceDepth( m_depthMode, CurrentPrecisionType ); + } + } + + dataCollector.AddToIncludes( UniqueId, Constants.UnityShaderVariables ); + + if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) + { + string vertexPos; + string varName; + if ( m_inputPorts[ 0 ].IsConnected ) + { + vertexPos = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + varName = GeneratorUtils.DepthModeVarNameStr[ m_viewSpaceInt ] + OutputId; + } + else + { + vertexPos = Constants.VertexShaderInputStr + ".vertex.xyz"; + varName = GeneratorUtils.DepthModeVarNameStr[ m_viewSpaceInt ]; + } + + string instruction = string.Format( "UnityObjectToClipPos( {0} ).zw", vertexPos ); + string clipDepth = "clipDepth" + OutputId; + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT2, clipDepth, instruction ); + + instruction = string.Format( "{0}.x / {0}.y", clipDepth ); + instruction = ApplyLinearDepthModifier( ref dataCollector, instruction ); + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, varName, instruction ); + return varName; + } + + if ( m_inputPorts[ 0 ].IsConnected ) + { + if ( dataCollector.TesselationActive ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string vertexPos = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string instruction = string.Format( "UnityObjectToClipPos( {0} ).zw", vertexPos ); + string clipDepth = "clipDepth" + OutputId; + string varName = GeneratorUtils.DepthModeVarNameStr[ m_viewSpaceInt ] + OutputId; + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT2, clipDepth, instruction ); + + instruction = string.Format( "{0}.x / {0}.y", clipDepth ); + instruction = ApplyLinearDepthModifier( ref dataCollector, instruction ); + + RegisterLocalVariable( 0, instruction, ref dataCollector, varName ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + else + { + var savedPortCategory = dataCollector.PortCategory; + dataCollector.PortCategory = MasterNodePortCategory.Vertex; + string vertexPos = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string varName = GeneratorUtils.DepthModeVarNameStr[ m_viewSpaceInt ] + OutputId; + dataCollector.PortCategory = savedPortCategory; + + string clipDepth = "clipDepth" + OutputId; + dataCollector.AddToInput( UniqueId, clipDepth, WirePortDataType.FLOAT2 ); + + string clipDepthOutput = string.Format( "{0}.{1}", Constants.VertexShaderOutputStr, clipDepth ); + string clipDepthInput = string.Format( "{0}.{1}", Constants.InputVarStr, clipDepth ); + + string vertexInstruction = string.Format( "UnityObjectToClipPos( {0} ).zw", vertexPos ); + dataCollector.AddToVertexLocalVariables( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT2, clipDepth, vertexInstruction ); + dataCollector.AddToVertexLocalVariables( UniqueId, clipDepthOutput, clipDepth ); + + string fragmentInstruction = string.Format( "{0}.x / {0}.y", clipDepthInput ); + fragmentInstruction = ApplyLinearDepthModifier( ref dataCollector, fragmentInstruction ); + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, varName, fragmentInstruction ); + return varName; + } + } + else + { + return GeneratorUtils.GenerateSurfaceDepth( ref dataCollector, UniqueId, CurrentPrecisionType, m_depthMode ); + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_viewSpaceInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + UpdateAdditonalTitleText(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_viewSpaceInt ); + } + } + +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs.meta new file mode 100644 index 00000000..0ca53c04 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d3b0855152b8c5d478f236423cfb1959 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs new file mode 100644 index 00000000..2558ca12 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs @@ -0,0 +1,1499 @@ +using UnityEngine; +using UnityEditor; + +using System; +using System.Collections.Generic; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Triplanar Sample", "Textures", "Triplanar Mapping" )] + public sealed class TriplanarNode : ParentNode + { + [SerializeField] + private string m_uniqueName; + + private bool m_editPropertyNameMode = false; + [SerializeField] + private string m_propertyInspectorName = "Triplanar Sampler"; + + private enum TriplanarType { Spherical, Cylindrical } + + [SerializeField] + private TriplanarType m_selectedTriplanarType = TriplanarType.Spherical; + + private enum TriplanarSpace { Object, World } + + [SerializeField] + private TriplanarSpace m_selectedTriplanarSpace = TriplanarSpace.World; + + [SerializeField] + private bool m_normalCorrection = false; + + [SerializeField] + private ViewSpace m_normalSpace = ViewSpace.Tangent; + + [SerializeField] + private TexturePropertyNode m_topTexture; + [SerializeField] + private TexturePropertyNode m_midTexture; + [SerializeField] + private TexturePropertyNode m_botTexture; + + bool m_texturesInitialize = false; + + [SerializeField] + private string m_tempTopInspectorName = string.Empty; + [SerializeField] + private string m_tempTopName = string.Empty; + private TexturePropertyValues m_tempTopDefaultValue = TexturePropertyValues.white; + private int m_tempTopOrderIndex = -1; + private Texture2D m_tempTopDefaultTexture = null; + + private string m_tempMidInspectorName = string.Empty; + private string m_tempMidName = string.Empty; + private TexturePropertyValues m_tempMidDefaultValue = TexturePropertyValues.white; + private int m_tempMidOrderIndex = -1; + private Texture2D m_tempMidDefaultTexture = null; + + private string m_tempBotInspectorName = string.Empty; + private string m_tempBotName = string.Empty; + private TexturePropertyValues m_tempBotDefaultValue = TexturePropertyValues.white; + private int m_tempBotOrderIndex = -1; + private Texture2D m_tempBotDefaultTexture = null; + + private bool m_topTextureFoldout = true; + private bool m_midTextureFoldout = true; + private bool m_botTextureFoldout = true; + + private InputPort m_topTexPort; + private InputPort m_midTexPort; + private InputPort m_botTexPort; + private InputPort m_tilingPort; + private InputPort m_falloffPort; + private InputPort m_topIndexPort; + private InputPort m_midIndexPort; + private InputPort m_botIndexPort; + private InputPort m_scalePort; + private InputPort m_posPort; + + + private readonly string m_functionCall = "TriplanarSampling{0}( {1} )"; + private readonly string m_functionHeader = "inline {0} TriplanarSampling{1}( {2}float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )"; + + private readonly List m_functionSamplingBodyProj = new List() { + "float3 projNormal = ( pow( abs( worldNormal ), falloff ) );", + "projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;",// 0.00001 is to prevent division by 0 + "float3 nsign = sign( worldNormal );" + }; + + private readonly List m_functionSamplingBodyNegProj = new List() { + "float negProjNormalY = max( 0, projNormal.y * -nsign.y );", + "projNormal.y = max( 0, projNormal.y * nsign.y );" + }; + + private readonly List m_functionSamplingBodySignsSphere = new List() { + "xNorm.xyz = half3( {0}( xNorm{1} ).xy * float2( nsign.x, 1.0 ) + worldNormal.zy, worldNormal.x ).zyx;", + "yNorm.xyz = half3( {0}( yNorm{1} ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy;", + "zNorm.xyz = half3( {0}( zNorm{1} ).xy * float2( -nsign.z, 1.0 ) + worldNormal.xy, worldNormal.z ).xyz;" + }; + + private readonly List m_functionSamplingBodySignsSphereScale = new List() { + "xNorm.xyz = half3( {0}( xNorm, normalScale.y ).xy * float2( nsign.x, 1.0 ) + worldNormal.zy, worldNormal.x ).zyx;", + "yNorm.xyz = half3( {0}( yNorm, normalScale.x ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy;", + "zNorm.xyz = half3( {0}( zNorm, normalScale.y ).xy * float2( -nsign.z, 1.0 ) + worldNormal.xy, worldNormal.z ).xyz;" + }; + + private readonly List m_functionSamplingBodySignsCylinder = new List() { + "yNormN.xyz = half3( {0}( yNormN {1}).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy;" + }; + + private readonly List m_functionSamplingBodySignsCylinderScale = new List() { + "yNormN.xyz = half3( {0}( yNormN, normalScale.z ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy;" + }; + + private readonly List m_functionSamplingBodyReturnSphereNormalize = new List() { + "return normalize( xNorm.xyz * projNormal.x + yNorm.xyz * projNormal.y + zNorm.xyz * projNormal.z );" + }; + + private readonly List m_functionSamplingBodyReturnCylinderNormalize = new List() { + "return normalize( xNorm.xyz * projNormal.x + yNorm.xyz * projNormal.y + yNormN.xyz * negProjNormalY + zNorm.xyz * projNormal.z );" + }; + + private readonly List m_functionSamplingBodyReturnSphere = new List() { + "return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;" + }; + + private readonly List m_functionSamplingBodyReturnCylinder = new List() { + "return xNorm * projNormal.x + yNorm * projNormal.y + yNormN * negProjNormalY + zNorm * projNormal.z;" + }; + + private Rect m_allPicker; + private Rect m_startPicker; + private Rect m_pickerButton; + private bool m_editing; + + void ConvertListTo( MasterNodeDataCollector dataCollector, bool scaleInfo, List original, List dest ) + { + int count = original.Count; + string scale = string.Empty; + string func = string.Empty; + bool applyScale = false; + if( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + if( dataCollector.TemplateDataCollectorInstance.IsHDRP ) + { + func = "UnpackNormalmapRGorAG"; + } + else + { + func = "UnpackNormalScale"; + } + + if( !scaleInfo ) + { + scale = " , 1.0"; + applyScale = true; + } + } + else + { + func = scaleInfo ? "UnpackScaleNormal" : "UnpackNormal"; + applyScale = !scaleInfo; + } + + for( int i = 0; i < count; i++ ) + { + if( applyScale ) + dest.Add( string.Format( original[ i ], func, scale ) ); + else + dest.Add( string.Format( original[ i ], func ) ); + } + } + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.SAMPLER2D, false, "Top", -1, MasterNodePortCategory.Fragment, 0 ); + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER2DARRAY ); + AddInputPort( WirePortDataType.FLOAT, false, "Top Index", -1, MasterNodePortCategory.Fragment, 5 ); + AddInputPort( WirePortDataType.SAMPLER2D, false, "Middle", -1, MasterNodePortCategory.Fragment, 1 ); + m_inputPorts[ 2 ].CreatePortRestrictions( WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER2DARRAY ); + AddInputPort( WirePortDataType.FLOAT, false, "Mid Index", -1, MasterNodePortCategory.Fragment, 6 ); + AddInputPort( WirePortDataType.SAMPLER2D, false, "Bottom", -1, MasterNodePortCategory.Fragment, 2 ); + m_inputPorts[ 4 ].CreatePortRestrictions( WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER2DARRAY ); + AddInputPort( WirePortDataType.FLOAT, false, "Bot Index", -1, MasterNodePortCategory.Fragment, 7 ); + AddInputPort( WirePortDataType.FLOAT3, false, "Pos", -1, MasterNodePortCategory.Fragment, 9 ); + AddInputPort( WirePortDataType.FLOAT3, false, "Scale", -1, MasterNodePortCategory.Fragment, 8 ); + AddInputPort( WirePortDataType.FLOAT2, false, "Tiling", -1, MasterNodePortCategory.Fragment, 3 ); + AddInputPort( WirePortDataType.FLOAT, false, "Falloff", -1, MasterNodePortCategory.Fragment, 4 ); + AddOutputColorPorts( "RGBA" ); + m_useInternalPortData = true; + m_topTexPort = InputPorts[ 0 ]; + m_topIndexPort = InputPorts[ 1 ]; + m_midTexPort = InputPorts[ 2 ]; + m_midIndexPort = InputPorts[ 3 ]; + m_botTexPort = InputPorts[ 4 ]; + m_botIndexPort = InputPorts[ 5 ]; + m_posPort = InputPorts[ 6 ]; + m_scalePort = InputPorts[ 7 ]; + m_tilingPort = InputPorts[ 8 ]; + m_falloffPort = InputPorts[ 9 ]; + + m_scalePort.Visible = false; + m_scalePort.Vector3InternalData = Vector3.one; + m_tilingPort.FloatInternalData = 1; + m_tilingPort.Vector2InternalData = Vector2.one; + m_topIndexPort.FloatInternalData = 1; + m_falloffPort.FloatInternalData = 1; + m_topIndexPort.Visible = false; + m_selectedLocation = PreviewLocation.TopCenter; + m_marginPreviewLeft = 43; + m_drawPreviewAsSphere = true; + m_drawPreviewExpander = false; + m_drawPreview = true; + m_showPreview = true; + m_autoDrawInternalPortData = false; + m_textLabelWidth = 125; + //m_propertyInspectorName = "Triplanar Sampler"; + m_previewShaderGUID = "8723015ec59743143aadfbe480e34391"; + } + + public void ReadPropertiesData() + { + // Top + if( UIUtils.IsUniformNameAvailable( m_tempTopName ) ) + { + UIUtils.ReleaseUniformName( UniqueId, m_topTexture.PropertyName ); + if( !string.IsNullOrEmpty( m_tempTopInspectorName ) ) + { + m_topTexture.SetInspectorName( m_tempTopInspectorName ); + } + if( !string.IsNullOrEmpty( m_tempTopName ) ) + m_topTexture.SetPropertyName( m_tempTopName ); + UIUtils.RegisterUniformName( UniqueId, m_topTexture.PropertyName ); + } + m_topTexture.DefaultTextureValue = m_tempTopDefaultValue; + m_topTexture.OrderIndex = m_tempTopOrderIndex; + m_topTexture.DefaultValue = m_tempTopDefaultTexture; + //m_topTexture.SetMaterialMode( UIUtils.CurrentWindow.CurrentGraph.CurrentMaterial, true ); + + // Mid + if( UIUtils.IsUniformNameAvailable( m_tempMidName ) ) + { + UIUtils.ReleaseUniformName( UniqueId, m_midTexture.PropertyName ); + if( !string.IsNullOrEmpty( m_tempMidInspectorName ) ) + m_midTexture.SetInspectorName( m_tempMidInspectorName ); + if( !string.IsNullOrEmpty( m_tempMidName ) ) + m_midTexture.SetPropertyName( m_tempMidName ); + UIUtils.RegisterUniformName( UniqueId, m_midTexture.PropertyName ); + } + m_midTexture.DefaultTextureValue = m_tempMidDefaultValue; + m_midTexture.OrderIndex = m_tempMidOrderIndex; + m_midTexture.DefaultValue = m_tempMidDefaultTexture; + + // Bot + if( UIUtils.IsUniformNameAvailable( m_tempBotName ) ) + { + UIUtils.ReleaseUniformName( UniqueId, m_botTexture.PropertyName ); + if( !string.IsNullOrEmpty( m_tempBotInspectorName ) ) + m_botTexture.SetInspectorName( m_tempBotInspectorName ); + if( !string.IsNullOrEmpty( m_tempBotName ) ) + m_botTexture.SetPropertyName( m_tempBotName ); + UIUtils.RegisterUniformName( UniqueId, m_botTexture.PropertyName ); + } + m_botTexture.DefaultTextureValue = m_tempBotDefaultValue; + m_botTexture.OrderIndex = m_tempBotOrderIndex; + m_botTexture.DefaultValue = m_tempBotDefaultTexture; + } + + public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) + { + base.SetMaterialMode( mat, fetchMaterialValues ); + + if( !m_texturesInitialize ) + return; + + m_topTexture.SetMaterialMode( mat, fetchMaterialValues ); + m_midTexture.SetMaterialMode( mat, fetchMaterialValues ); + m_botTexture.SetMaterialMode( mat, fetchMaterialValues ); + } + + public void Init() + { + if( m_texturesInitialize ) + return; + else + m_texturesInitialize = true; + + // Top + if( m_topTexture == null ) + { + m_topTexture = ScriptableObject.CreateInstance(); + } + m_topTexture.ContainerGraph = ContainerGraph; + m_topTexture.CustomPrefix = "Top Texture "; + m_topTexture.UniqueId = UniqueId; + m_topTexture.DrawAutocast = false; + m_topTexture.CurrentParameterType = PropertyType.Property; + + // Mid + if( m_midTexture == null ) + { + m_midTexture = ScriptableObject.CreateInstance(); + } + m_midTexture.ContainerGraph = ContainerGraph; + m_midTexture.CustomPrefix = "Mid Texture "; + m_midTexture.UniqueId = UniqueId; + m_midTexture.DrawAutocast = false; + m_midTexture.CurrentParameterType = PropertyType.Property; + + // Bot + if( m_botTexture == null ) + { + m_botTexture = ScriptableObject.CreateInstance(); + } + m_botTexture.ContainerGraph = ContainerGraph; + m_botTexture.CustomPrefix = "Bot Texture "; + m_botTexture.UniqueId = UniqueId; + m_botTexture.DrawAutocast = false; + m_botTexture.CurrentParameterType = PropertyType.Property; + + if( m_materialMode ) + SetDelayedMaterialMode( ContainerGraph.CurrentMaterial ); + + if( m_nodeAttribs != null ) + m_uniqueName = m_nodeAttribs.Name + UniqueId; + + ConfigurePorts(); + + ReRegisterPorts(); + } + + public override void Destroy() + { + base.Destroy(); + + //UIUtils.UnregisterPropertyNode( m_topTexture ); + //UIUtils.UnregisterTexturePropertyNode( m_topTexture ); + + //UIUtils.UnregisterPropertyNode( m_midTexture ); + //UIUtils.UnregisterTexturePropertyNode( m_midTexture ); + + //UIUtils.UnregisterPropertyNode( m_botTexture ); + //UIUtils.UnregisterTexturePropertyNode( m_botTexture ); + if( m_topTexture != null ) + m_topTexture.Destroy(); + m_topTexture = null; + if( m_midTexture != null ) + m_midTexture.Destroy(); + m_midTexture = null; + if( m_botTexture != null ) + m_botTexture.Destroy(); + m_botTexture = null; + + m_tempTopDefaultTexture = null; + m_tempMidDefaultTexture = null; + m_tempBotDefaultTexture = null; + + m_topTexPort = null; + m_midTexPort = null; + m_botTexPort = null; + m_tilingPort = null; + m_falloffPort = null; + m_topIndexPort = null; + m_midIndexPort = null; + m_botIndexPort = null; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + if( m_topTexture == null ) + return; + + + if( m_topTexPort.IsConnected ) + { + PreviewMaterial.SetTexture( "_A", m_topTexPort.InputPreviewTexture( ContainerGraph ) ); + } + else + { + PreviewMaterial.SetTexture( "_A", m_topTexture.Value ); + } + if( m_selectedTriplanarType == TriplanarType.Cylindrical && m_midTexture != null ) + { + if( m_midTexPort.IsConnected ) + PreviewMaterial.SetTexture( "_B", m_midTexPort.InputPreviewTexture( ContainerGraph ) ); + else + PreviewMaterial.SetTexture( "_B", m_midTexture.Value ); + if( m_botTexPort.IsConnected ) + PreviewMaterial.SetTexture( "_C", m_botTexPort.InputPreviewTexture( ContainerGraph ) ); + else + PreviewMaterial.SetTexture( "_C", m_botTexture.Value ); + } + + PreviewMaterial.SetFloat( "_IsNormal", ( m_normalCorrection ? 1 : 0 ) ); + PreviewMaterial.SetFloat( "_IsTangent", ( m_normalSpace == ViewSpace.Tangent ? 1 : 0 ) ); + PreviewMaterial.SetFloat( "_IsSpherical", ( m_selectedTriplanarType == TriplanarType.Spherical ? 1 : 0 ) ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + if( portId == 0 ) + m_topTexPort.MatchPortToConnection(); + + if( portId == 1 ) + m_midTexPort.MatchPortToConnection(); + + if( portId == 2 ) + m_botTexPort.MatchPortToConnection(); + + if( m_texturesInitialize ) + ReRegisterPorts(); + + ConfigurePorts(); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + if( m_texturesInitialize ) + ReRegisterPorts(); + } + + public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); + if( portId == 0 ) + { + if( !m_topTexPort.CheckValidType( type ) ) + { + m_topTexPort.FullDeleteConnections(); + UIUtils.ShowMessage( UniqueId, "Triplanar Sampler node only accepts SAMPLER2D and SAMPLER2DARRAY input types.\nTexture Object connected changed to " + type + ", connection was lost, please review and update accordingly.", MessageSeverity.Warning ); + } + else + { + m_topTexPort.MatchPortToConnection(); + } + } + + if( portId == 1 ) + { + if( !m_midTexPort.CheckValidType( type ) ) + { + m_midTexPort.FullDeleteConnections(); + UIUtils.ShowMessage( UniqueId, "Triplanar Sampler node only accepts SAMPLER2D and SAMPLER2DARRAY input types.\nTexture Object connected changed to " + type + ", connection was lost, please review and update accordingly.", MessageSeverity.Warning ); + } + else + { + m_midTexPort.MatchPortToConnection(); + } + } + + if( portId == 2 ) + { + if( !m_botTexPort.CheckValidType( type ) ) + { + m_botTexPort.FullDeleteConnections(); + UIUtils.ShowMessage( UniqueId, "Triplanar Sampler node only accepts SAMPLER2D and SAMPLER2DARRAY input types.\nTexture Object connected changed to " + type + ", connection was lost, please review and update accordingly.", MessageSeverity.Warning ); + } + else + { + m_botTexPort.MatchPortToConnection(); + } + } + + if( m_texturesInitialize ) + ReRegisterPorts(); + + ConfigurePorts(); + } + + public void ReRegisterPorts() + { + if( m_topTexPort.IsConnected ) + { + UIUtils.UnregisterPropertyNode( m_topTexture ); + UIUtils.UnregisterTexturePropertyNode( m_topTexture ); + } + else if( m_topTexPort.Visible ) + { + UIUtils.RegisterPropertyNode( m_topTexture ); + UIUtils.RegisterTexturePropertyNode( m_topTexture ); + } + + if( m_midTexPort.IsConnected || m_selectedTriplanarType == TriplanarType.Spherical ) + { + UIUtils.UnregisterPropertyNode( m_midTexture ); + UIUtils.UnregisterTexturePropertyNode( m_midTexture ); + } + else if( m_midTexPort.Visible && m_selectedTriplanarType == TriplanarType.Cylindrical ) + { + UIUtils.RegisterPropertyNode( m_midTexture ); + UIUtils.RegisterTexturePropertyNode( m_midTexture ); + } + + if( m_botTexPort.IsConnected || m_selectedTriplanarType == TriplanarType.Spherical ) + { + UIUtils.UnregisterPropertyNode( m_botTexture ); + UIUtils.UnregisterTexturePropertyNode( m_botTexture ); + } + else if( m_botTexPort.Visible && m_selectedTriplanarType == TriplanarType.Cylindrical ) + { + UIUtils.RegisterPropertyNode( m_botTexture ); + UIUtils.RegisterTexturePropertyNode( m_botTexture ); + } + } + + public void ConfigurePorts() + { + switch( m_selectedTriplanarType ) + { + case TriplanarType.Spherical: + m_topTexPort.Name = "Tex"; + m_midTexPort.Visible = false; + m_botTexPort.Visible = false; + m_scalePort.ChangeType( WirePortDataType.FLOAT, false ); + break; + case TriplanarType.Cylindrical: + m_topTexPort.Name = "Top"; + m_midTexPort.Visible = true; + m_botTexPort.Visible = true; + m_scalePort.ChangeType( WirePortDataType.FLOAT3, false ); + break; + } + + if( m_normalCorrection ) + { + m_outputPorts[ 0 ].ChangeProperties( "XYZ", WirePortDataType.FLOAT3, false ); + m_outputPorts[ 1 ].ChangeProperties( "X", WirePortDataType.FLOAT, false ); + m_outputPorts[ 2 ].ChangeProperties( "Y", WirePortDataType.FLOAT, false ); + m_outputPorts[ 3 ].ChangeProperties( "Z", WirePortDataType.FLOAT, false ); + + m_outputPorts[ 4 ].Visible = false; + + m_scalePort.Visible = true; + } + else + { + m_outputPorts[ 0 ].ChangeProperties( "RGBA", WirePortDataType.FLOAT4, false ); + m_outputPorts[ 1 ].ChangeProperties( "R", WirePortDataType.FLOAT, false ); + m_outputPorts[ 2 ].ChangeProperties( "G", WirePortDataType.FLOAT, false ); + m_outputPorts[ 3 ].ChangeProperties( "B", WirePortDataType.FLOAT, false ); + m_outputPorts[ 4 ].ChangeProperties( "A", WirePortDataType.FLOAT, false ); + + m_outputPorts[ 4 ].Visible = true; + + m_scalePort.Visible = false; + } + + if( m_topTexPort.DataType == WirePortDataType.SAMPLER2DARRAY ) + m_topIndexPort.Visible = true; + else + m_topIndexPort.Visible = false; + + if( m_midTexPort.DataType == WirePortDataType.SAMPLER2DARRAY && m_selectedTriplanarType == TriplanarType.Cylindrical ) + m_midIndexPort.Visible = true; + else + m_midIndexPort.Visible = false; + + if( m_botTexPort.DataType == WirePortDataType.SAMPLER2DARRAY && m_selectedTriplanarType == TriplanarType.Cylindrical ) + m_botIndexPort.Visible = true; + else + m_botIndexPort.Visible = false; + + if( m_selectedTriplanarSpace == TriplanarSpace.World ) + m_posPort.Name = "World Pos"; + else + m_posPort.Name = "Local Pos"; + + m_outputPorts[ 0 ].DirtyLabelSize = true; + m_sizeIsDirty = true; + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + dataCollector.DirtyNormal = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, "Parameters", DrawMainOptions ); + DrawInternalDataGroup(); + if( m_selectedTriplanarType == TriplanarType.Spherical && !m_topTexPort.IsConnected ) + NodeUtils.DrawPropertyGroup( ref m_topTextureFoldout, "Texture", DrawTopTextureOptions ); + else if( !m_topTexPort.IsConnected ) + NodeUtils.DrawPropertyGroup( ref m_topTextureFoldout, "Top Texture", DrawTopTextureOptions ); + + if( m_selectedTriplanarType == TriplanarType.Cylindrical ) + { + if( !m_midTexPort.IsConnected ) + NodeUtils.DrawPropertyGroup( ref m_midTextureFoldout, "Middle Texture", DrawMidTextureOptions ); + if( !m_botTexPort.IsConnected ) + NodeUtils.DrawPropertyGroup( ref m_botTextureFoldout, "Bottom Texture", DrawBotTextureOptions ); + } + } + + void DrawMainOptions() + { + EditorGUI.BeginChangeCheck(); + m_propertyInspectorName = EditorGUILayoutTextField( "Name", m_propertyInspectorName ); + + m_selectedTriplanarType = (TriplanarType)EditorGUILayoutEnumPopup( "Mapping", m_selectedTriplanarType ); + + m_selectedTriplanarSpace = (TriplanarSpace)EditorGUILayoutEnumPopup( "Space", m_selectedTriplanarSpace ); + + m_normalCorrection = EditorGUILayoutToggle( "Normal Map", m_normalCorrection ); + + if( m_normalCorrection ) + m_normalSpace = (ViewSpace)EditorGUILayoutEnumPopup( "Output Normal Space", m_normalSpace ); + + if( EditorGUI.EndChangeCheck() ) + { + SetTitleText( m_propertyInspectorName ); + ConfigurePorts(); + ReRegisterPorts(); + } + } + + void DrawTopTextureOptions() + { + EditorGUI.BeginChangeCheck(); + m_topTexture.ShowPropertyInspectorNameGUI(); + m_topTexture.ShowPropertyNameGUI( true ); + m_topTexture.ShowToolbar(); + if( EditorGUI.EndChangeCheck() ) + { + m_topTexture.BeginPropertyFromInspectorCheck(); + if( m_materialMode ) + m_requireMaterialUpdate = true; + } + + m_topTexture.CheckPropertyFromInspector(); + } + + void DrawMidTextureOptions() + { + if( m_midTexture == null ) + return; + + EditorGUI.BeginChangeCheck(); + m_midTexture.ShowPropertyInspectorNameGUI(); + m_midTexture.ShowPropertyNameGUI( true ); + m_midTexture.ShowToolbar(); + if( EditorGUI.EndChangeCheck() ) + { + m_midTexture.BeginPropertyFromInspectorCheck(); + if( m_materialMode ) + m_requireMaterialUpdate = true; + } + + m_midTexture.CheckPropertyFromInspector(); + } + + void DrawBotTextureOptions() + { + if( m_botTexture == null ) + return; + + EditorGUI.BeginChangeCheck(); + m_botTexture.ShowPropertyInspectorNameGUI(); + m_botTexture.ShowPropertyNameGUI( true ); + m_botTexture.ShowToolbar(); + if( EditorGUI.EndChangeCheck() ) + { + m_botTexture.BeginPropertyFromInspectorCheck(); + if( m_materialMode ) + m_requireMaterialUpdate = true; + } + + m_botTexture.CheckPropertyFromInspector(); + } + + public override void OnEnable() + { + base.OnEnable(); + //if( !m_afterDeserialize ) + //Init(); //Generate texture properties + //else + //m_afterDeserialize = false; + + //if( m_topTexture != null ) + // m_topTexture.ReRegisterName = true; + + //if( m_selectedTriplanarType == TriplanarType.Cylindrical ) + //{ + // if( m_midTexture != null ) + // m_midTexture.ReRegisterName = true; + + // if( m_botTexture != null ) + // m_botTexture.ReRegisterName = true; + //} + } + + //bool m_afterDeserialize = false; + + //public override void OnAfterDeserialize() + //{ + // base.OnAfterDeserialize(); + // m_afterDeserialize = true; + //} + + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + + Init(); + + if( m_topTexture.ReRegisterName ) + { + m_topTexture.ReRegisterName = false; + UIUtils.RegisterUniformName( UniqueId, m_topTexture.PropertyName ); + } + + m_topTexture.CheckDelayedDirtyProperty(); + m_topTexture.CheckPropertyFromInspector(); + m_topTexture.CheckDuplicateProperty(); + + if( m_selectedTriplanarType == TriplanarType.Cylindrical ) + { + if( m_midTexture.ReRegisterName ) + { + m_midTexture.ReRegisterName = false; + UIUtils.RegisterUniformName( UniqueId, m_midTexture.PropertyName ); + } + + m_midTexture.CheckDelayedDirtyProperty(); + m_midTexture.CheckPropertyFromInspector(); + m_midTexture.CheckDuplicateProperty(); + + if( m_botTexture.ReRegisterName ) + { + m_botTexture.ReRegisterName = false; + UIUtils.RegisterUniformName( UniqueId, m_botTexture.PropertyName ); + } + + m_botTexture.CheckDelayedDirtyProperty(); + m_botTexture.CheckPropertyFromInspector(); + m_botTexture.CheckDuplicateProperty(); + } + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + + m_allPicker = m_previewRect; + m_allPicker.x -= 43 * drawInfo.InvertedZoom; + m_allPicker.width = 43 * drawInfo.InvertedZoom; + + m_startPicker = m_previewRect; + m_startPicker.x -= 43 * drawInfo.InvertedZoom; + m_startPicker.width = 43 * drawInfo.InvertedZoom; + m_startPicker.height = 43 * drawInfo.InvertedZoom; + + m_pickerButton = m_startPicker; + m_pickerButton.width = 30 * drawInfo.InvertedZoom; + m_pickerButton.x = m_startPicker.xMax - m_pickerButton.width - 2; + m_pickerButton.height = 10 * drawInfo.InvertedZoom; + m_pickerButton.y = m_startPicker.yMax - m_pickerButton.height - 2; + } + + + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if( !( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp || drawInfo.CurrentEventType == EventType.ExecuteCommand || drawInfo.CurrentEventType == EventType.DragPerform ) ) + return; + + bool insideBox = m_allPicker.Contains( drawInfo.MousePosition ); + + if( insideBox ) + { + m_editing = true; + } + else if( m_editing && !insideBox && drawInfo.CurrentEventType != EventType.ExecuteCommand ) + { + GUI.FocusControl( null ); + m_editing = false; + } + } + private int m_pickId = 0; + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + Rect pickerButtonClone = m_pickerButton; + Rect startPickerClone = m_startPicker; + + if( m_editing ) + { + if( GUI.Button( pickerButtonClone, string.Empty, GUIStyle.none ) ) + { + int controlID = EditorGUIUtility.GetControlID( FocusType.Passive ); + EditorGUIUtility.ShowObjectPicker( m_topTexture.Value, false, "", controlID ); + m_pickId = 0; + } + + if( m_selectedTriplanarType == TriplanarType.Cylindrical ) + { + pickerButtonClone.y += startPickerClone.height; + if( GUI.Button( pickerButtonClone, string.Empty, GUIStyle.none ) ) + { + int controlID = EditorGUIUtility.GetControlID( FocusType.Passive ); + EditorGUIUtility.ShowObjectPicker( m_midTexture.Value, false, "", controlID ); + m_pickId = 1; + } + + pickerButtonClone.y += startPickerClone.height; + if( GUI.Button( pickerButtonClone, string.Empty, GUIStyle.none ) ) + { + int controlID = EditorGUIUtility.GetControlID( FocusType.Passive ); + EditorGUIUtility.ShowObjectPicker( m_botTexture.Value, false, "", controlID ); + m_pickId = 2; + } + } + + string commandName = Event.current.commandName; + UnityEngine.Object newValue = null; + if( commandName.Equals( "ObjectSelectorUpdated" ) || commandName.Equals( "ObjectSelectorClosed" ) ) + { + newValue = EditorGUIUtility.GetObjectPickerObject(); + if( m_pickId == 2 ) + { + if( newValue != (UnityEngine.Object)m_botTexture.Value ) + { + PreviewIsDirty = true; + UndoRecordObject( "Changing value EditorGUIObjectField on node Triplanar Node" ); + m_botTexture.Value = newValue != null ? (Texture2D)newValue : null; + + if( m_materialMode ) + m_requireMaterialUpdate = true; + } + } + else if( m_pickId == 1 ) + { + if( newValue != (UnityEngine.Object)m_midTexture.Value ) + { + PreviewIsDirty = true; + UndoRecordObject( "Changing value EditorGUIObjectField on node Triplanar Node" ); + m_midTexture.Value = newValue != null ? (Texture2D)newValue : null; + + if( m_materialMode ) + m_requireMaterialUpdate = true; + } + } + else + { + if( newValue != (UnityEngine.Object)m_topTexture.Value ) + { + PreviewIsDirty = true; + UndoRecordObject( "Changing value EditorGUIObjectField on node Triplanar Node" ); + m_topTexture.Value = newValue != null ? (Texture2D)newValue : null; + + if( m_materialMode ) + m_requireMaterialUpdate = true; + } + } + + if( commandName.Equals( "ObjectSelectorClosed" ) ) + m_editing = false; + } + + if( GUI.Button( startPickerClone, string.Empty, GUIStyle.none ) ) + { + if( m_topTexPort.IsConnected ) + { + UIUtils.FocusOnNode( m_topTexPort.GetOutputNode( 0 ), 1, true ); + } + else + { + if( m_topTexture.Value != null ) + { + Selection.activeObject = m_topTexture.Value; + EditorGUIUtility.PingObject( Selection.activeObject ); + } + } + m_editing = false; + } + + if( m_selectedTriplanarType == TriplanarType.Cylindrical ) + { + startPickerClone.y += startPickerClone.height; + if( GUI.Button( startPickerClone, string.Empty, GUIStyle.none ) ) + { + if( m_midTexPort.IsConnected ) + { + UIUtils.FocusOnNode( m_midTexPort.GetOutputNode( 0 ), 1, true ); + } + else + { + if( m_midTexture.Value != null ) + { + Selection.activeObject = m_midTexture.Value; + EditorGUIUtility.PingObject( Selection.activeObject ); + } + } + m_editing = false; + } + + startPickerClone.y += startPickerClone.height; + if( GUI.Button( startPickerClone, string.Empty, GUIStyle.none ) ) + { + if( m_botTexPort.IsConnected ) + { + UIUtils.FocusOnNode( m_botTexPort.GetOutputNode( 0 ), 1, true ); + } + else + { + if( m_botTexture.Value != null ) + { + Selection.activeObject = m_botTexture.Value; + EditorGUIUtility.PingObject( Selection.activeObject ); + } + } + m_editing = false; + } + } + } + + pickerButtonClone = m_pickerButton; + startPickerClone = m_startPicker; + + if( drawInfo.CurrentEventType == EventType.Repaint ) + { + // Top + if( m_topTexPort.IsConnected ) + { + EditorGUI.DrawPreviewTexture( startPickerClone, m_topTexPort.GetOutputConnection( 0 ).OutputPreviewTexture, null, ScaleMode.ScaleAndCrop ); + } + else if( m_topTexture.Value != null ) + { + EditorGUI.DrawPreviewTexture( startPickerClone, m_topTexture.Value, null, ScaleMode.ScaleAndCrop ); + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) + GUI.Label( pickerButtonClone, "Select", UIUtils.MiniSamplerButton ); + } + else + { + GUI.Label( startPickerClone, string.Empty, UIUtils.ObjectFieldThumb ); + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) + { + GUI.Label( startPickerClone, "None (Texture2D)", UIUtils.MiniObjectFieldThumbOverlay ); + GUI.Label( pickerButtonClone, "Select", UIUtils.MiniSamplerButton ); + } + } + GUI.Label( startPickerClone, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); + + if( m_selectedTriplanarType == TriplanarType.Cylindrical ) + { + // Mid + startPickerClone.y += startPickerClone.height; + pickerButtonClone.y += startPickerClone.height; + if( m_midTexPort.IsConnected ) + { + EditorGUI.DrawPreviewTexture( startPickerClone, m_midTexPort.GetOutputConnection( 0 ).OutputPreviewTexture, null, ScaleMode.ScaleAndCrop ); + } + else if( m_midTexture.Value != null ) + { + EditorGUI.DrawPreviewTexture( startPickerClone, m_midTexture.Value, null, ScaleMode.ScaleAndCrop ); + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) + GUI.Label( pickerButtonClone, "Select", UIUtils.MiniSamplerButton ); + } + else + { + GUI.Label( startPickerClone, string.Empty, UIUtils.ObjectFieldThumb ); + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) + { + GUI.Label( startPickerClone, "None (Texture2D)", UIUtils.MiniObjectFieldThumbOverlay ); + GUI.Label( pickerButtonClone, "Select", UIUtils.MiniSamplerButton ); + } + } + GUI.Label( startPickerClone, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); + + // Bot + startPickerClone.y += startPickerClone.height; + startPickerClone.height = 42 * drawInfo.InvertedZoom; + pickerButtonClone.y += startPickerClone.height; + if( m_botTexPort.IsConnected ) + { + EditorGUI.DrawPreviewTexture( startPickerClone, m_botTexPort.GetOutputConnection( 0 ).OutputPreviewTexture, null, ScaleMode.ScaleAndCrop ); + } + else if( m_botTexture.Value != null ) + { + EditorGUI.DrawPreviewTexture( startPickerClone, m_botTexture.Value, null, ScaleMode.ScaleAndCrop ); + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) + GUI.Label( pickerButtonClone, "Select", UIUtils.MiniSamplerButton ); + } + else + { + GUI.Label( startPickerClone, string.Empty, UIUtils.ObjectFieldThumb ); + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) + { + GUI.Label( startPickerClone, "None (Texture2D)", UIUtils.MiniObjectFieldThumbOverlay ); + GUI.Label( pickerButtonClone, "Select", UIUtils.MiniSamplerButton ); + } + } + GUI.Label( startPickerClone, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); + } + } + } + + public override void OnNodeDoubleClicked( Vector2 currentMousePos2D ) + { + if( currentMousePos2D.y - m_globalPosition.y > Constants.NODE_HEADER_HEIGHT + Constants.NODE_HEADER_EXTRA_HEIGHT ) + { + ContainerGraph.ParentWindow.ParametersWindow.IsMaximized = !ContainerGraph.ParentWindow.ParametersWindow.IsMaximized; + } + else + { + m_editPropertyNameMode = true; + GUI.FocusControl( m_uniqueName ); + TextEditor te = (TextEditor)GUIUtility.GetStateObject( typeof( TextEditor ), GUIUtility.keyboardControl ); + if( te != null ) + { + te.SelectAll(); + } + } + } + + public override void OnNodeSelected( bool value ) + { + base.OnNodeSelected( value ); + if( !value ) + m_editPropertyNameMode = false; + } + + public override void DrawTitle( Rect titlePos ) + { + if( m_editPropertyNameMode ) + { + titlePos.height = Constants.NODE_HEADER_HEIGHT; + EditorGUI.BeginChangeCheck(); + GUI.SetNextControlName( m_uniqueName ); + m_propertyInspectorName = GUITextField( titlePos, m_propertyInspectorName, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); + if( EditorGUI.EndChangeCheck() ) + { + SetTitleText( m_propertyInspectorName ); + } + + if( Event.current.isKey && ( Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter ) ) + { + m_editPropertyNameMode = false; + GUIUtility.keyboardControl = 0; + } + } + else + { + base.DrawTitle( titlePos ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; + + dataCollector.AddPropertyNode( m_topTexture ); + dataCollector.AddPropertyNode( m_midTexture ); + dataCollector.AddPropertyNode( m_botTexture ); + + bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation || dataCollector.PortCategory == MasterNodePortCategory.Vertex ); + + string texTop = string.Empty; + string texMid = string.Empty; + string texBot = string.Empty; + string ssTop = string.Empty; + string ssMid = string.Empty; + string ssBot = string.Empty; + + if( m_topTexPort.IsConnected ) + { + texTop = m_topTexPort.GeneratePortInstructions( ref dataCollector ); + } + else + { + dataCollector.AddToUniforms( UniqueId, m_topTexture.GetTexture2DUniformValue() ); + dataCollector.AddToProperties( UniqueId, m_topTexture.GetTexture2DPropertyValue(), m_topTexture.OrderIndex ); + texTop = m_topTexture.PropertyName; + } + + if( m_selectedTriplanarType == TriplanarType.Spherical ) + { + texMid = texTop; + texBot = texTop; + + if( ( outsideGraph.SamplingMacros || m_topTexPort.DataType == WirePortDataType.SAMPLER2DARRAY ) ) + ssTop = GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, texTop , VariableMode.Create ); + } + else + { + if( m_midTexPort.IsConnected ) + { + texMid = m_midTexPort.GeneratePortInstructions( ref dataCollector ); + } + else + { + dataCollector.AddToUniforms( UniqueId, m_midTexture.GetTexture2DUniformValue() ); + dataCollector.AddToProperties( UniqueId, m_midTexture.GetTexture2DPropertyValue(), m_midTexture.OrderIndex ); + texMid = m_midTexture.PropertyName; + } + + if( m_botTexPort.IsConnected ) + { + texBot = m_botTexPort.GeneratePortInstructions( ref dataCollector ); + } + else + { + dataCollector.AddToUniforms( UniqueId, m_botTexture.GetTexture2DUniformValue() ); + dataCollector.AddToProperties( UniqueId, m_botTexture.GetTexture2DPropertyValue(), m_botTexture.OrderIndex ); + texBot = m_botTexture.PropertyName; + } + if( ( outsideGraph.SamplingMacros || m_topTexPort.DataType == WirePortDataType.SAMPLER2DARRAY ) ) + ssTop = GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, texTop , VariableMode.Create ); + if( ( outsideGraph.SamplingMacros || m_midTexPort.DataType == WirePortDataType.SAMPLER2DARRAY ) ) + ssMid = GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, texMid , VariableMode.Create ); + if( ( outsideGraph.SamplingMacros || m_botTexPort.DataType == WirePortDataType.SAMPLER2DARRAY ) ) + ssBot = GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, texBot , VariableMode.Create ); + } + + if( !isVertex ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + dataCollector.ForceNormal = true; + } + + string topIndex = "0"; + string midIndex = "0"; + string botIndex = "0"; + if( m_topIndexPort.Visible ) + topIndex = m_topIndexPort.GeneratePortInstructions( ref dataCollector ); + if( m_midIndexPort.Visible ) + midIndex = m_midIndexPort.GeneratePortInstructions( ref dataCollector ); + if( m_botIndexPort.Visible ) + botIndex = m_botIndexPort.GeneratePortInstructions( ref dataCollector ); + + string tiling = m_tilingPort.GeneratePortInstructions( ref dataCollector ); + string falloff = m_falloffPort.GeneratePortInstructions( ref dataCollector ); + + bool scaleNormals = false; + if( m_scalePort.IsConnected || ( m_scalePort.IsConnected && ( m_scalePort.Vector3InternalData == Vector3.one || m_scalePort.FloatInternalData == 1 ) ) ) + scaleNormals = true; + + MipType mip = isVertex ? MipType.MipLevel : MipType.Auto; + string samplingTriplanar = string.Empty; + string headerID = string.Empty; + string header = string.Empty; + string callHeader = string.Empty; + string samplers = string.Empty; + string extraArguments = string.Empty; + List triplanarBody = new List(); + + triplanarBody.AddRange( m_functionSamplingBodyProj ); + headerID += OutputId; + if( m_selectedTriplanarType == TriplanarType.Spherical ) + { + samplers = GeneratorUtils.GetPropertyDeclaraction( "topTexMap", m_topTexPort.DataType, ", " ) + GeneratorUtils.GetSamplerDeclaraction( "samplertopTexMap", m_topTexPort.DataType, ", " ); + + string array1 = ""; + string array2 = ""; + if( m_topTexPort.DataType == WirePortDataType.SAMPLER2DARRAY ) + { + if( outsideGraph.IsSRP ) + { + array1 = ""; + array2 = ", index.x"; + } + else + { + array1 = "float3( "; + array2 = ", index.x )"; + } + } + + triplanarBody.Add( "half4 xNorm; half4 yNorm; half4 zNorm;" ); + triplanarBody.Add( "xNorm = " + GeneratorUtils.GenerateSamplingCall( ref dataCollector, m_topTexPort.DataType, "topTexMap", "samplertopTexMap", string.Format( "{0}tiling * worldPos.zy * float2( nsign.x, 1.0 ){1}", array1, array2 ), mip, "0" ) + ";" ); + triplanarBody.Add( "yNorm = " + GeneratorUtils.GenerateSamplingCall( ref dataCollector, m_topTexPort.DataType, "topTexMap", "samplertopTexMap", string.Format( "{0}tiling * worldPos.xz * float2( nsign.y, 1.0 ){1}", array1, array2 ), mip, "0" ) + ";" ); + triplanarBody.Add( "zNorm = " + GeneratorUtils.GenerateSamplingCall( ref dataCollector, m_topTexPort.DataType, "topTexMap", "samplertopTexMap", string.Format( "{0}tiling * worldPos.xy * float2( -nsign.z, 1.0 ){1}", array1, array2 ), mip, "0" ) + ";" ); + + if( m_normalCorrection ) + { + if( scaleNormals ) + { + ConvertListTo( dataCollector, true, m_functionSamplingBodySignsSphereScale, triplanarBody ); + } + else + { + ConvertListTo( dataCollector, false, m_functionSamplingBodySignsSphere, triplanarBody ); + } + triplanarBody.AddRange( m_functionSamplingBodyReturnSphereNormalize ); + } + else + { + triplanarBody.AddRange( m_functionSamplingBodyReturnSphere ); + } + } + else + { + string topArgs = GeneratorUtils.GetPropertyDeclaraction( "topTexMap", m_topTexPort.DataType, ", " ) + GeneratorUtils.GetSamplerDeclaraction( "samplertopTexMap", m_topTexPort.DataType, ", " ); + string midArgs = GeneratorUtils.GetPropertyDeclaraction( "midTexMap", m_midTexPort.DataType, ", " ) + GeneratorUtils.GetSamplerDeclaraction( "samplermidTexMap", m_midTexPort.DataType, ", " ); + string botArgs = GeneratorUtils.GetPropertyDeclaraction( "botTexMap", m_botTexPort.DataType, ", " ) + GeneratorUtils.GetSamplerDeclaraction( "samplerbotTexMap", m_botTexPort.DataType, ", " ); + + samplers = topArgs + midArgs + botArgs; + + string uvTop = "tiling * worldPos.xz * float2( nsign.y, 1.0 )"; + if( m_topTexPort.DataType == WirePortDataType.SAMPLER2DARRAY ) + uvTop = outsideGraph.IsSRP ? uvTop + ", index.x" : "float3( " + uvTop + ", index.x )"; + + string uvMid = "tiling * worldPos.zy * float2( nsign.x, 1.0 )"; + if( m_midTexPort.DataType == WirePortDataType.SAMPLER2DARRAY ) + uvMid = outsideGraph.IsSRP ? uvMid + ", index.y" : "float3( " + uvMid + ", index.y )"; + + string uvMidNeg = "tiling * worldPos.xy * float2( -nsign.z, 1.0 )"; + if( m_midTexPort.DataType == WirePortDataType.SAMPLER2DARRAY ) + uvMidNeg = outsideGraph.IsSRP ? uvMidNeg + ", index.y" : "float3( " + uvMidNeg + ", index.y )"; + + string uvBot = "tiling * worldPos.xz * float2( nsign.y, 1.0 )"; + if( m_botTexPort.DataType == WirePortDataType.SAMPLER2DARRAY ) + uvBot = outsideGraph.IsSRP ? uvBot + ", index.z" : "float3( " + uvBot + ", index.z )"; + + extraArguments = ", {7}, {8}"; + triplanarBody.AddRange( m_functionSamplingBodyNegProj ); + + triplanarBody.Add( "half4 xNorm; half4 yNorm; half4 yNormN; half4 zNorm;" ); + triplanarBody.Add( "xNorm = " + GeneratorUtils.GenerateSamplingCall( ref dataCollector, m_midTexPort.DataType, "midTexMap", "samplermidTexMap", uvMid, mip, "0" ) + ";" ); + triplanarBody.Add( "yNorm = " + GeneratorUtils.GenerateSamplingCall( ref dataCollector, m_topTexPort.DataType, "topTexMap", "samplertopTexMap", uvTop, mip, "0" ) + ";" ); + triplanarBody.Add( "yNormN = " + GeneratorUtils.GenerateSamplingCall( ref dataCollector, m_botTexPort.DataType, "botTexMap", "samplerbotTexMap", uvBot, mip, "0" ) + ";" ); + triplanarBody.Add( "zNorm = " + GeneratorUtils.GenerateSamplingCall( ref dataCollector, m_midTexPort.DataType, "midTexMap", "samplermidTexMap", uvMidNeg, mip, "0" ) + ";" ); + + if( m_normalCorrection ) + { + if( scaleNormals ) + { + if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) + { + dataCollector.AddToIncludes( UniqueId, Constants.UnityStandardUtilsLibFuncs ); + } + + ConvertListTo( dataCollector, true, m_functionSamplingBodySignsSphereScale, triplanarBody ); + ConvertListTo( dataCollector, true, m_functionSamplingBodySignsCylinderScale, triplanarBody ); + } + else + { + ConvertListTo( dataCollector, false, m_functionSamplingBodySignsSphere, triplanarBody ); + ConvertListTo( dataCollector, false, m_functionSamplingBodySignsCylinder, triplanarBody ); + } + triplanarBody.AddRange( m_functionSamplingBodyReturnCylinderNormalize ); + } + else + { + triplanarBody.AddRange( m_functionSamplingBodyReturnCylinder ); + } + } + + string type = UIUtils.WirePortToCgType( m_outputPorts[ 0 ].DataType ); + header = string.Format( m_functionHeader, type, headerID, samplers ); + callHeader = string.Format( m_functionCall, headerID, "{0}, {1}, {2}, {3}, {4}, {5}, {6}" + extraArguments ); + + IOUtils.AddFunctionHeader( ref samplingTriplanar, header ); + foreach( string line in triplanarBody ) + IOUtils.AddFunctionLine( ref samplingTriplanar, line ); + IOUtils.CloseFunctionBody( ref samplingTriplanar ); + + string pos = GeneratorUtils.GenerateWorldPosition( ref dataCollector, UniqueId ); + string norm = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId ); + string worldToTangent = string.Empty; + if( m_normalCorrection && m_normalSpace == ViewSpace.Tangent ) + worldToTangent = GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); + + if( m_selectedTriplanarSpace == TriplanarSpace.Object ) + { + if( m_normalCorrection && m_normalSpace == ViewSpace.Tangent ) + { + string vt = GeneratorUtils.GenerateVertexTangent( ref dataCollector, UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3 ); + string vbt = GeneratorUtils.GenerateVertexBitangent( ref dataCollector, UniqueId, CurrentPrecisionType ); + norm = GeneratorUtils.GenerateVertexNormal( ref dataCollector, UniqueId, CurrentPrecisionType ); + dataCollector.AddLocalVariable( UniqueId, "float3x3 objectToTangent = float3x3("+ vt + ", "+ vbt + ", "+ norm + ");" ); + pos = GeneratorUtils.GenerateVertexPosition( ref dataCollector, UniqueId, WirePortDataType.FLOAT3 ); + worldToTangent = "objectToTangent"; + } + else + { + pos = GeneratorUtils.GenerateVertexPosition( ref dataCollector, UniqueId, WirePortDataType.FLOAT3 ); + norm = GeneratorUtils.GenerateVertexNormal( ref dataCollector, UniqueId, CurrentPrecisionType ); + } + } + + if( m_posPort.IsConnected ) + { + pos = m_posPort.GeneratePortInstructions( ref dataCollector ); + } + + string call = string.Empty; + string normalScale = m_scalePort.GeneratePortInstructions( ref dataCollector ); + + if( !string.IsNullOrEmpty( ssTop ) ) + ssTop = ", " + ssTop; + if( !string.IsNullOrEmpty( ssMid ) ) + ssMid = ", " + ssMid; + if( !string.IsNullOrEmpty( ssBot ) ) + ssBot = ", " + ssBot; + + if( m_selectedTriplanarType == TriplanarType.Spherical ) + call = dataCollector.AddFunctions( callHeader, samplingTriplanar, texTop + ssTop, pos, norm, falloff, tiling, normalScale, topIndex ); + else + call = dataCollector.AddFunctions( callHeader, samplingTriplanar, texTop + ssTop, texMid + ssMid, texBot + ssBot, pos, norm, falloff, tiling, normalScale, "float3(" + topIndex + "," + midIndex + "," + botIndex + ")" ); + string triplanarVarName = "triplanar" + OutputId; + + dataCollector.AddToLocalVariables( dataCollector.PortCategory, UniqueId, type + " "+ triplanarVarName + " = " + call + ";" ); + if( m_normalCorrection && m_normalSpace == ViewSpace.Tangent ) + { + string tanTriplanarVarName = "tanTriplanarNormal" + OutputId; + + dataCollector.AddToLocalVariables( dataCollector.PortCategory, UniqueId, "float3 " + tanTriplanarVarName + " = mul( " + worldToTangent + ", "+ triplanarVarName + " );" ); + + m_outputPorts[ 0 ].SetLocalValue( tanTriplanarVarName, dataCollector.PortCategory ); + + return GetOutputVectorItem( 0, outputId, tanTriplanarVarName ); + } + else + { + m_outputPorts[ 0 ].SetLocalValue( triplanarVarName , dataCollector.PortCategory ); + return GetOutputVectorItem( 0, outputId, triplanarVarName ); + } + } + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + m_topTexture.OnPropertyNameChanged(); + if( mat.HasProperty( m_topTexture.PropertyName ) && !InsideShaderFunction ) + { + mat.SetTexture( m_topTexture.PropertyName, m_topTexture.MaterialValue ); + } + + m_midTexture.OnPropertyNameChanged(); + if( mat.HasProperty( m_midTexture.PropertyName ) && !InsideShaderFunction ) + { + mat.SetTexture( m_midTexture.PropertyName, m_midTexture.MaterialValue ); + } + + m_botTexture.OnPropertyNameChanged(); + if( mat.HasProperty( m_botTexture.PropertyName ) && !InsideShaderFunction ) + { + mat.SetTexture( m_botTexture.PropertyName, m_botTexture.MaterialValue ); + } + } + + public void SetDelayedMaterialMode( Material mat ) + { + m_topTexture.SetMaterialMode( mat, false ); + if( mat.HasProperty( m_topTexture.PropertyName ) ) + { + m_topTexture.MaterialValue = mat.GetTexture( m_topTexture.PropertyName ); + } + + m_midTexture.SetMaterialMode( mat, false ); + if( mat.HasProperty( m_midTexture.PropertyName ) ) + { + m_midTexture.MaterialValue = mat.GetTexture( m_midTexture.PropertyName ); + } + + m_botTexture.SetMaterialMode( mat, false ); + if( mat.HasProperty( m_botTexture.PropertyName ) ) + { + m_botTexture.MaterialValue = mat.GetTexture( m_botTexture.PropertyName ); + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + base.ForceUpdateFromMaterial( material ); + if( material.HasProperty( m_topTexture.PropertyName ) ) + { + m_topTexture.MaterialValue = material.GetTexture( m_topTexture.PropertyName ); + PreviewIsDirty = true; + } + + if( material.HasProperty( m_midTexture.PropertyName ) ) + { + m_midTexture.MaterialValue = material.GetTexture( m_midTexture.PropertyName ); + PreviewIsDirty = true; + } + + if( material.HasProperty( m_botTexture.PropertyName ) ) + { + m_botTexture.MaterialValue = material.GetTexture( m_botTexture.PropertyName ); + PreviewIsDirty = true; + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_selectedTriplanarType = (TriplanarType)Enum.Parse( typeof( TriplanarType ), GetCurrentParam( ref nodeParams ) ); + m_selectedTriplanarSpace = (TriplanarSpace)Enum.Parse( typeof( TriplanarSpace ), GetCurrentParam( ref nodeParams ) ); + m_normalCorrection = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + + m_tempTopInspectorName = GetCurrentParam( ref nodeParams ); + m_tempTopName = GetCurrentParam( ref nodeParams ); + m_tempTopDefaultValue = (TexturePropertyValues)Enum.Parse( typeof( TexturePropertyValues ), GetCurrentParam( ref nodeParams ) ); + m_tempTopOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_tempTopDefaultTexture = AssetDatabase.LoadAssetAtPath( GetCurrentParam( ref nodeParams ) ); + + m_tempMidInspectorName = GetCurrentParam( ref nodeParams ); + m_tempMidName = GetCurrentParam( ref nodeParams ); + m_tempMidDefaultValue = (TexturePropertyValues)Enum.Parse( typeof( TexturePropertyValues ), GetCurrentParam( ref nodeParams ) ); + m_tempMidOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_tempMidDefaultTexture = AssetDatabase.LoadAssetAtPath( GetCurrentParam( ref nodeParams ) ); + + m_tempBotInspectorName = GetCurrentParam( ref nodeParams ); + m_tempBotName = GetCurrentParam( ref nodeParams ); + m_tempBotDefaultValue = (TexturePropertyValues)Enum.Parse( typeof( TexturePropertyValues ), GetCurrentParam( ref nodeParams ) ); + m_tempBotOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_tempBotDefaultTexture = AssetDatabase.LoadAssetAtPath( GetCurrentParam( ref nodeParams ) ); + + if( UIUtils.CurrentShaderVersion() > 6102 ) + m_propertyInspectorName = GetCurrentParam( ref nodeParams ); + + if( UIUtils.CurrentShaderVersion() <= 18301 ) + Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + + if( UIUtils.CurrentShaderVersion() > 18201 ) + m_normalSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ); + + SetTitleText( m_propertyInspectorName ); + + ConfigurePorts(); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + + Init(); + + ReadPropertiesData(); + + ConfigurePorts(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedTriplanarType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedTriplanarSpace ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_normalCorrection ); + + IOUtils.AddFieldValueToString( ref nodeInfo, m_topTexture.PropertyInspectorName ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_topTexture.PropertyName ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_topTexture.DefaultTextureValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_topTexture.OrderIndex.ToString() ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_topTexture.DefaultValue != null ) ? AssetDatabase.GetAssetPath( m_topTexture.DefaultValue ) : Constants.NoStringValue ); + + IOUtils.AddFieldValueToString( ref nodeInfo, m_midTexture.PropertyInspectorName ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_midTexture.PropertyName ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_midTexture.DefaultTextureValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_midTexture.OrderIndex.ToString() ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_midTexture.DefaultValue != null ) ? AssetDatabase.GetAssetPath( m_midTexture.DefaultValue ) : Constants.NoStringValue ); + + IOUtils.AddFieldValueToString( ref nodeInfo, m_botTexture.PropertyInspectorName ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_botTexture.PropertyName ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_botTexture.DefaultTextureValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_botTexture.OrderIndex.ToString() ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_botTexture.DefaultValue != null ) ? AssetDatabase.GetAssetPath( m_botTexture.DefaultValue ) : Constants.NoStringValue ); + + IOUtils.AddFieldValueToString( ref nodeInfo, m_propertyInspectorName ); + + //IOUtils.AddFieldValueToString( ref nodeInfo, m_arraySupport ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_normalSpace ); + } + public override void RefreshOnUndo() + { + base.RefreshOnUndo(); + if( m_topTexture != null ) + { + m_topTexture.BeginPropertyFromInspectorCheck(); + } + + if( m_midTexture != null ) + { + m_midTexture.BeginPropertyFromInspectorCheck(); + } + + if( m_botTexture != null ) + { + m_botTexture.BeginPropertyFromInspectorCheck(); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs.meta new file mode 100644 index 00000000..b0f08519 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 396e5bf33f08d3a42a19d7b161f573f2 +timeCreated: 1490358806 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs new file mode 100644 index 00000000..81e632f0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs @@ -0,0 +1,34 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Object To Clip Pos", "Object Transform", "Transforms a point from object space to the camera’s clip space in homogeneous coordinates" )] + public sealed class UnityObjToClipPosHlpNode : HelperParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "UnityObjectToClipPos"; + //TODO: revisit this later + m_funcLWFormatOverride = "TransformWorldToHClip( TransformObjectToWorld( ( {0} ).xyz ) )"; + m_funcHDFormatOverride = "TransformWorldToHClip( TransformObjectToWorld( ( {0} ).xyz ) )"; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_outputPorts[ 0 ].Name = "XYZW"; + AddOutputPort( WirePortDataType.FLOAT, "X" ); + AddOutputPort( WirePortDataType.FLOAT, "Y" ); + AddOutputPort( WirePortDataType.FLOAT, "Z" ); + AddOutputPort( WirePortDataType.FLOAT, "W" ); + m_previewShaderGUID = "14ec765a147a53340877b489e73f1c9f"; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "unityObjectToClipPos" + OutputId; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs.meta new file mode 100644 index 00000000..77bc2b73 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c01e190d996825f42bdc81e1fab5e897 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs new file mode 100644 index 00000000..89258e80 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs @@ -0,0 +1,33 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Object To View Pos", "Object Transform", "Transforms a point from object space to view space" )] + public sealed class UnityObjToViewPosHlpNode : HelperParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "UnityObjectToViewPos"; + //TODO: revisit this later + m_funcLWFormatOverride = "TransformWorldToView( TransformObjectToWorld( {0}) )"; + m_funcHDFormatOverride = "TransformWorldToView( TransformObjectToWorld( {0}) )"; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_outputPorts[ 0 ].Name = "XYZ"; + AddOutputPort( WirePortDataType.FLOAT, "X" ); + AddOutputPort( WirePortDataType.FLOAT, "Y" ); + AddOutputPort( WirePortDataType.FLOAT, "Z" ); + m_previewShaderGUID = "b790bc1d468a51840a9facef372b4729"; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "unityObjectToViewPos" + OutputId; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs.meta new file mode 100644 index 00000000..027ded8b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5f35cf284cf7d2b47be5a32426fc7a77 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs new file mode 100644 index 00000000..414a025d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs @@ -0,0 +1,78 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "World Space Light Dir", "Lighting", "Computes normalized world space light direction" )] + public sealed class WorldSpaceLightDirHlpNode : HelperParentNode + { + private const string NormalizeOptionStr = "Safe Normalize"; + + [SerializeField] + private bool m_safeNormalize = false; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "UnityWorldSpaceLightDir"; + m_inputPorts[ 0 ].Visible = false; + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_outputPorts[ 0 ].Name = "XYZ"; + + AddOutputPort( WirePortDataType.FLOAT, "X" ); + AddOutputPort( WirePortDataType.FLOAT, "Y" ); + AddOutputPort( WirePortDataType.FLOAT, "Z" ); + + m_useInternalPortData = false; + m_drawPreviewAsSphere = true; + m_autoWrapProperties = true; + m_textLabelWidth = 120; + m_previewShaderGUID = "2e8dc46eb6fb2124d9f0007caf9567e3"; + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + if( m_safeNormalize ) + dataCollector.SafeNormalizeLightDir = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + m_safeNormalize = EditorGUILayoutToggle( NormalizeOptionStr, m_safeNormalize ); + EditorGUILayout.HelpBox( "Having safe normalize ON makes sure your light vector is not zero even if there's no lights in your scene.", MessageType.None ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.IsTemplate ) + return GetOutputVectorItem( 0, outputId, dataCollector.TemplateDataCollectorInstance.GetWorldSpaceLightDir( CurrentPrecisionType ) ); ; + + dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); + + return GetOutputVectorItem( 0, outputId, GeneratorUtils.GenerateWorldLightDirection( ref dataCollector, UniqueId, CurrentPrecisionType ) ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 15201 ) + { + m_safeNormalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_safeNormalize ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs.meta new file mode 100644 index 00000000..a599ea3d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2134a58fb8235524d84046a051bce6b5 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs new file mode 100644 index 00000000..6adc186a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs @@ -0,0 +1,50 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "World Space View Dir", "Object Transform", "World space direction (not normalized) from given object space vertex position towards the camera", castType: null, shortcutKey: KeyCode.None, available: false, deprecated: true )] + public sealed class WorldSpaceViewDirHlpNode : HelperParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_funcType = "WorldSpaceViewDir"; + //TODO: revisit this later + m_funcLWFormatOverride = "( _WorldSpaceCameraPos.xyz - mul(GetObjectToWorldMatrix(), {0} ).xyz )"; + m_funcHDFormatOverride = "( _WorldSpaceCameraPos.xyz - mul(GetObjectToWorldMatrix(), {0} ).xyz )"; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_inputPorts[ 0 ].Vector4InternalData = new UnityEngine.Vector4( 0, 0, 0, 1 ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_outputPorts[ 0 ].Name = "XYZ"; + AddOutputPort( WirePortDataType.FLOAT, "X" ); + AddOutputPort( WirePortDataType.FLOAT, "Y" ); + AddOutputPort( WirePortDataType.FLOAT, "Z" ); + m_previewShaderGUID = "fe0e09756a8a0ba408015b43e66cb8a6"; + + m_errorMessageTooltip = "This node still works but is now deprecated. Please use \"View Dir\" instead."; + m_errorMessageTypeIsError = NodeMessageType.Warning; + m_showErrorMessage = true; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_localVarName = "worldSpaceViewDir" + OutputId; + } + + public override void DrawProperties() + { + base.DrawProperties(); + if ( m_showErrorMessage ) + { + EditorGUILayout.HelpBox( m_errorMessageTooltip, MessageType.Warning ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs.meta new file mode 100644 index 00000000..71a04b83 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 61d7064bd5523634496fa412627603d7 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs new file mode 100644 index 00000000..aa649046 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs @@ -0,0 +1,11 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + interface ISignalGenerator + { + void GenerateSignalPropagation(); + void GenerateSignalInibitor(); + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs.meta new file mode 100644 index 00000000..43ee379b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: cfeab503d3318794ea1af322505320ef +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects.meta new file mode 100644 index 00000000..ba29e65e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2a5d24ae30c4ee74f81a2fa0615e2e95 +folderAsset: yes +timeCreated: 1481126945 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs new file mode 100644 index 00000000..20ff09a4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs @@ -0,0 +1,445 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +//https://www.shadertoy.com/view/XdS3RW +//http://www.deepskycolors.com/archivo/2010/04/21/formulas-for-Photoshop-blending-modes.html +//http://www.pegtop.net/delphi/articles/blendmodes/softlight.htm + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + public enum BlendOps + { + ColorBurn, + ColorDodge, + Darken, + Divide, + Difference, + Exclusion, + SoftLight, + HardLight, + HardMix, + Lighten, + LinearBurn, + LinearDodge, + LinearLight, + Multiply, + Overlay, + PinLight, + Subtract, + Screen, + VividLight + } + [Serializable] + [NodeAttributes( "Blend Operations", "Image Effects", "Common layer blending modes" )] + public class BlendOpsNode : ParentNode + { + //private const string ASEHardLightCall = "ASEHardLight({0},{1})"; + //private const string ASEHardLightFunc = + //"inline float ASEHardLight( float srcLocalVar, float dstLocalVar ){" + + //" return ( ( srcLocalVar > 0.5 ) ? ( 1.0 - ( 1.0 - 2.0 * ( srcLocalVar - 0.5 ) ) * ( 1.0 - dstLocalVar ) ) : ( 2.0 * srcLocalVar * dstLocalVar ) ); }"; + + //private const string ASELinearLightCall = "ASELinearLight({0},{1})"; + //private const string ASELinearLightFunc = + //"inline float ASELinearLight( float srcLocalVar, float dstLocalVar ){" + + //" return ( ( srcLocalVar > 0.5 ) ? ( dstLocalVar + 2.0 * srcLocalVar - 1.0 ) : ( dstLocalVar + 2.0 * ( srcLocalVar - 0.5 ) ) ); }"; + + //private const string ASEOverlayCall = "ASEOverlay({0},{1})"; + //private const string ASEOverlayFunc = + //"inline float ASEOverlay( float srcLocalVar, float dstLocalVar ){" + + //" return ( ( dstLocalVar > 0.5 ) ? ( 1.0 - ( 1.0 - 2.0 * ( dstLocalVar - 0.5 ) ) * ( 1.0 - srcLocalVar ) ) : ( 2.0 * dstLocalVar * srcLocalVar ) ); }"; + ////" return (dstLocalVar < 0.5) ? 2.0 * srcLocalVar * dstLocalVar : 1.0 - 2.0 * (1.0 - srcLocalVar) * (1.0 - dstLocalVar); }"; + + //private const string ASEPinLightCall = "ASEPinLight({0},{1})"; + //private const string ASEPinLightFunc = + //"inline float ASEPinLight( float srcLocalVar, float dstLocalVar ){" + + //" return ( ( srcLocalVar > 0.5 ) ? max( dstLocalVar , 2.0 * ( srcLocalVar - 0.5 ) ) : min( dstLocalVar , 2.0 * srcLocalVar ) ); }"; + + //private const string ASEVividLightCall = "ASEVividLight({0},{1})"; + //private const string ASEVividLightFunc = "inline float ASEVividLight( float srcLocalVar, float dstLocalVar ){" + + //" return ( ( srcLocalVar > 0.5 ) ? ( dstLocalVar / ( ( 1.0 - srcLocalVar ) * 2.0 ) ) : ( 1.0 - ( ( ( 1.0 - dstLocalVar ) * 0.5 ) / srcLocalVar ) ) ); }"; + + private const string ASEDarkerColorCall = "ASEDarkerColor{}({0},{1})"; + private const string ASEDarkerColorFunc = "inline float ASEDarkerColor{0}( float srcLocalVar, float dstLocalVar ){" + + " return ({1} < {2}) ? s : d; }"; + + private const string ASELighterColorCall = "ASELighterColor{}({0},{1})"; + private const string ASELighterColorFunc = "inline float ASELighterColor{0}( float srcLocalVar, float dstLocalVar ){" + + " return ({1} > {2}) ? s : d; }"; + + private const string BlendOpsModeStr = "Blend Op"; + private const string SaturateResultStr = "Saturate"; + + [SerializeField] + private BlendOps m_currentBlendOp = BlendOps.ColorBurn; + + [SerializeField] + private WirePortDataType m_mainDataType = WirePortDataType.COLOR; + + [SerializeField] + private bool m_saturate = true; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.COLOR, false, "Source" ); + AddInputPort( WirePortDataType.COLOR, false, "Destiny" ); + AddInputPort( WirePortDataType.FLOAT, false,"Alpha" ); + m_inputPorts[ 2 ].FloatInternalData = 1; + AddOutputPort( WirePortDataType.COLOR, Constants.EmptyPortValue ); + m_inputPorts[ 0 ].AddPortForbiddenTypes( WirePortDataType.FLOAT3x3, + WirePortDataType.FLOAT4x4, + WirePortDataType.SAMPLER1D, + WirePortDataType.SAMPLER2D, + WirePortDataType.SAMPLER3D, + WirePortDataType.SAMPLERCUBE, + WirePortDataType.SAMPLER2DARRAY ); + m_inputPorts[ 1 ].AddPortForbiddenTypes( WirePortDataType.FLOAT3x3, + WirePortDataType.FLOAT4x4, + WirePortDataType.SAMPLER1D, + WirePortDataType.SAMPLER2D, + WirePortDataType.SAMPLER3D, + WirePortDataType.SAMPLERCUBE, + WirePortDataType.SAMPLER2DARRAY ); + m_textLabelWidth = 75; + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_currentBlendOp ) ); + m_useInternalPortData = true; + m_previewShaderGUID = "6d6b3518705b3ba49acdc6e18e480257"; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + m_previewMaterialPassId = (int)m_currentBlendOp; + PreviewMaterial.SetInt( "_Sat", m_saturate ? 1 : 0 ); + int lerpMode = ( m_inputPorts[ 2 ].IsConnected || m_inputPorts[ 2 ].FloatInternalData < 1 ) ? 1 : 0; + PreviewMaterial.SetInt( "_Lerp", lerpMode ); + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnection( portId ); + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); + UpdateConnection( inputPortId ); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + UpdateDisconnection( portId ); + } + + void UpdateConnection( int portId ) + { + if( portId == 2 ) + return; + + m_inputPorts[ portId ].MatchPortToConnection(); + int otherPortId = ( portId + 1 ) % 2; + if( m_inputPorts[ otherPortId ].IsConnected ) + { + m_mainDataType = UIUtils.GetPriority( m_inputPorts[ 0 ].DataType ) > UIUtils.GetPriority( m_inputPorts[ 1 ].DataType ) ? m_inputPorts[ 0 ].DataType : m_inputPorts[ 1 ].DataType; + } + else + { + m_mainDataType = m_inputPorts[ portId ].DataType; + m_inputPorts[ otherPortId ].ChangeType( m_mainDataType, false ); + } + m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); + } + + void UpdateDisconnection( int portId ) + { + if( portId == 2 ) + return; + + int otherPortId = ( portId + 1 ) % 2; + if( m_inputPorts[ otherPortId ].IsConnected ) + { + m_mainDataType = m_inputPorts[ otherPortId ].DataType; + m_inputPorts[ portId ].ChangeType( m_mainDataType, false ); + m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_currentBlendOp = (BlendOps)EditorGUILayoutEnumPopup( BlendOpsModeStr, m_currentBlendOp ); + if( EditorGUI.EndChangeCheck() ) + { + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_currentBlendOp ) ); + } + m_saturate = EditorGUILayoutToggle( SaturateResultStr, m_saturate ); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + m_upperLeftWidget.DrawWidget( ref m_currentBlendOp, this, OnWidgetUpdate ); + } + + private readonly Action OnWidgetUpdate = ( x ) => + { + x.SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, ( x as BlendOpsNode ).m_currentBlendOp ) ); + }; + + private string CreateMultiChannel( ref MasterNodeDataCollector dataCollector, string function, string srcLocalVar, string dstLocalVar, string varName ) + { + switch( m_outputPorts[ 0 ].DataType ) + { + default: + { + return string.Format( function, srcLocalVar, dstLocalVar ); + } + case WirePortDataType.FLOAT2: + { + string xChannelName = varName + OutputId + "X"; + string xChannelValue = string.Format( function, srcLocalVar + ".x", dstLocalVar + ".x" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, xChannelName, xChannelValue ); + + string yChannelName = varName + OutputId + "Y"; + string yChannelValue = string.Format( function, srcLocalVar + ".y", dstLocalVar + ".y" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, yChannelName, yChannelValue ); + + return string.Format( "float2({0},{1})", xChannelName, yChannelName ); + } + case WirePortDataType.FLOAT3: + { + string xChannelName = varName + OutputId + "X"; + string xChannelValue = string.Format( function, srcLocalVar + ".x", dstLocalVar + ".x" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, xChannelName, xChannelValue ); + + string yChannelName = varName + OutputId + "Y"; + string yChannelValue = string.Format( function, srcLocalVar + ".y", dstLocalVar + ".y" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, yChannelName, yChannelValue ); + + string zChannelName = varName + OutputId + "Z"; + string zChannelValue = string.Format( function, srcLocalVar + ".z", dstLocalVar + ".z" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, zChannelName, zChannelValue ); + + return string.Format( "float3({0},{1},{2})", xChannelName, yChannelName, zChannelName ); + } + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + { + string xChannelName = varName + OutputId + "X"; + string xChannelValue = string.Format( function, srcLocalVar + ".x", dstLocalVar + ".x" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, xChannelName, xChannelValue ); + + string yChannelName = varName + OutputId + "Y"; + string yChannelValue = string.Format( function, srcLocalVar + ".y", dstLocalVar + ".y" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, yChannelName, yChannelValue ); + + string zChannelName = varName + OutputId + "Z"; + string zChannelValue = string.Format( function, srcLocalVar + ".z", dstLocalVar + ".z" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, zChannelName, zChannelValue ); + + string wChannelName = varName + OutputId + "W"; + string wChannelValue = string.Format( function, srcLocalVar + ".w", dstLocalVar + ".w" ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, wChannelName, wChannelValue ); + + return string.Format( "float4({0},{1},{2},{3})", xChannelName, yChannelName, zChannelName, wChannelName ); + } + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string src = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, m_mainDataType, false, true ); + string dst = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, m_mainDataType, false, true ); + + string srcLocalVar = "blendOpSrc" + OutputId; + string dstLocalVar = "blendOpDest" + OutputId; + dataCollector.AddLocalVariable( UniqueId, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_mainDataType ) + " " + srcLocalVar, src + ";" ); + dataCollector.AddLocalVariable( UniqueId, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_mainDataType ) + " " + dstLocalVar, dst + ";" ); + + int currIndent = UIUtils.ShaderIndentLevel; + if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + UIUtils.ShaderIndentLevel = 0; + } + else + { + UIUtils.ShaderIndentLevel = 1; + UIUtils.ShaderIndentLevel++; + } + + string result = string.Empty; + switch( m_currentBlendOp ) + { + case BlendOps.ColorBurn: + { + result = string.Format( "( 1.0 - ( ( 1.0 - {0}) / max( {1}, 0.00001) ) )", dstLocalVar, srcLocalVar); + } + break; + case BlendOps.ColorDodge: + { + result = string.Format( "( {0}/ max( 1.0 - {1}, 0.00001 ) )", dstLocalVar, srcLocalVar ); + } + break; + case BlendOps.Darken: + { + result = "min( " + srcLocalVar + " , " + dstLocalVar + " )"; + } + break; + case BlendOps.Divide: + { + result = string.Format( "( {0} / max({1},0.00001) )", dstLocalVar, srcLocalVar ); + } + break; + case BlendOps.Difference: + { + result = "abs( " + srcLocalVar + " - " + dstLocalVar + " )"; + } + break; + case BlendOps.Exclusion: + { + result = "( 0.5 - 2.0 * ( " + srcLocalVar + " - 0.5 ) * ( " + dstLocalVar + " - 0.5 ) )"; + } + break; + case BlendOps.SoftLight: + { + result = string.Format( "2.0f*{0}*{1} + {0}*{0}*(1.0f - 2.0f*{1})", dstLocalVar, srcLocalVar ); + } + break; + case BlendOps.HardLight: + { + result = " (( " + srcLocalVar + " > 0.5 ) ? ( 1.0 - ( 1.0 - 2.0 * ( " + srcLocalVar + " - 0.5 ) ) * ( 1.0 - " + dstLocalVar + " ) ) : ( 2.0 * " + srcLocalVar + " * " + dstLocalVar + " ) )"; + //dataCollector.AddFunction( ASEHardLightCall, UIUtils.ShaderIndentTabs + ASEHardLightFunc ); + //result = CreateMultiChannel( ref dataCollector, ASEHardLightCall, srcLocalVar, dstLocalVar, "hardLightBlend" ); + } + break; + case BlendOps.HardMix: + { + result = " round( 0.5 * ( " + srcLocalVar + " + " + dstLocalVar + " ) )"; + } + break; + case BlendOps.Lighten: + { + result = " max( " + srcLocalVar + ", " + dstLocalVar + " )"; + } + break; + case BlendOps.LinearBurn: + { + result = "( " + srcLocalVar + " + " + dstLocalVar + " - 1.0 )"; + } + break; + case BlendOps.LinearDodge: + { + result = "( " + srcLocalVar + " + " + dstLocalVar + " )"; + } + break; + case BlendOps.LinearLight: + { + result = "(( " + srcLocalVar + " > 0.5 )? ( " + dstLocalVar + " + 2.0 * " + srcLocalVar + " - 1.0 ) : ( " + dstLocalVar + " + 2.0 * ( " + srcLocalVar + " - 0.5 ) ) )"; + //dataCollector.AddFunction( ASELinearLightCall, UIUtils.ShaderIndentTabs + ASELinearLightFunc ); + //result = CreateMultiChannel( ref dataCollector, ASELinearLightCall, srcLocalVar, dstLocalVar, "linearLightBlend" ); + } + break; + case BlendOps.Multiply: + { + result = "( " + srcLocalVar + " * " + dstLocalVar + " )"; + } + break; + case BlendOps.Overlay: + { + //result = "(( " + dstLocalVar + " > 0.5 ) ? ( 1.0 - ( 1.0 - 2.0 * ( " + dstLocalVar + " - 0.5 ) ) * ( 1.0 - " + srcLocalVar + " ) ) : ( 2.0 * " + dstLocalVar + " * " + srcLocalVar + " ) )"; + result = "(( " + dstLocalVar + " > 0.5 ) ? ( 1.0 - 2.0 * ( 1.0 - " + dstLocalVar + " ) * ( 1.0 - " + srcLocalVar + " ) ) : ( 2.0 * " + dstLocalVar + " * " + srcLocalVar + " ) )"; + //dataCollector.AddFunction( ASEOverlayCall, UIUtils.ShaderIndentTabs + ASEOverlayFunc ); + //result = CreateMultiChannel( ref dataCollector, ASEOverlayCall, srcLocalVar, dstLocalVar, "overlayBlend" ); + } + break; + case BlendOps.PinLight: + { + result = "(( " + srcLocalVar + " > 0.5 ) ? max( " + dstLocalVar + ", 2.0 * ( " + srcLocalVar + " - 0.5 ) ) : min( " + dstLocalVar + ", 2.0 * " + srcLocalVar + " ) )"; + //dataCollector.AddFunction( ASEPinLightCall, UIUtils.ShaderIndentTabs + ASEPinLightFunc ); + //result = CreateMultiChannel( ref dataCollector, ASEPinLightCall, srcLocalVar, dstLocalVar, "pinLightBlend" ); + } + break; + case BlendOps.Subtract: + { + result = "( " + dstLocalVar + " - " + srcLocalVar + " )"; + } + break; + case BlendOps.Screen: + { + result = "( 1.0 - ( 1.0 - " + srcLocalVar + " ) * ( 1.0 - " + dstLocalVar + " ) )"; + } + break; + case BlendOps.VividLight: + { + result = string.Format( "(( {0} > 0.5 ) ? ( {1} / max( ( 1.0 - {0} ) * 2.0 ,0.00001) ) : ( 1.0 - ( ( ( 1.0 - {1} ) * 0.5 ) / max( {0},0.00001) ) ) )", srcLocalVar, dstLocalVar); + //dataCollector.AddFunction( ASEVividLightCall, UIUtils.ShaderIndentTabs + ASEVividLightFunc ); + //result = CreateMultiChannel( ref dataCollector, ASEVividLightCall, srcLocalVar, dstLocalVar, "vividLightBlend" ); + } + break; + } + + UIUtils.ShaderIndentLevel = currIndent; + if( m_inputPorts[ 2 ].IsConnected || m_inputPorts[ 2 ].FloatInternalData < 1.0 ) + { + string opacity = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + string lerpVar = "lerpBlendMode" + OutputId; + string lerpResult = string.Format( "lerp({0},{1},{2})", dstLocalVar, result, opacity ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, lerpVar, lerpResult ); + result = lerpVar; + } + + if( m_saturate ) + result = "( saturate( " + result + " ))"; + + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentBlendOp ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_saturate ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_currentBlendOp = (BlendOps)Enum.Parse( typeof( BlendOps ), GetCurrentParam( ref nodeParams ) ); + m_saturate = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_currentBlendOp ) ); + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs.meta new file mode 100644 index 00000000..a44f88f6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 09fb0867c2a616c488bad8929f4f7ad7 +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs new file mode 100644 index 00000000..507c678d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs @@ -0,0 +1,57 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +// http://stackoverflow.com/questions/9320953/what-algorithm-does-photoshop-use-to-desaturate-an-image +// https://www.shadertoy.com/view/lsdXDH + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Desaturate", "Image Effects", "Generic desaturation operation" )] + public sealed class DesaturateOpNode : ParentNode + { + private const string GenericDesaturateOp0 = "dot( {0}, float3( 0.299, 0.587, 0.114 ))"; + private const string GenericDesaturateOp1 = "lerp( {0}, {1}.xxx, {2} )"; + //private const string GenericDesaturateOp = "lerp( {0},dot({0},float3(0.299,0.587,0.114)).xxx,{1})"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "RGB" ); + AddInputPort( WirePortDataType.FLOAT, false, "Fraction" ); + AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_previewShaderGUID = "faabe9efdf44b9648a523f1742abdfd3"; + } + + void UpdatePorts( int portId ) + { + if ( portId == 0 ) + { + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string initalColorValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string fraction = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + string initialColorVarName = "desaturateInitialColor" + OutputId; + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, initialColorVarName, initalColorValue ); + + string dotVarName = "desaturateDot" + OutputId; + string dotVarValue = string.Format( GenericDesaturateOp0, initialColorVarName ); + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, dotVarName, dotVarValue ); + RegisterLocalVariable( 0, string.Format( GenericDesaturateOp1, initialColorVarName, dotVarName,fraction ), ref dataCollector, "desaturateVar" + OutputId ); + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs.meta new file mode 100644 index 00000000..2455eda1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: eddae0a124877fc47b28ae8853286174 +timeCreated: 1489414268 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs new file mode 100644 index 00000000..a30c69aa --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs @@ -0,0 +1,87 @@ +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "HSV to RGB", "Image Effects", "Converts from HSV to RGB color space" )] + public sealed class HSVToRGBNode : ParentNode + { + public static readonly string HSVToRGBHeader = "HSVToRGB( {0}3({1},{2},{3}) )"; + public static readonly string[] HSVToRGBFunction = { "{0}3 HSVToRGB( {0}3 c )\n", + "{\n", + "\t{0}4 K = {0}4( 1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0 );\n", + "\t{0}3 p = abs( frac( c.xxx + K.xyz ) * 6.0 - K.www );\n", + "\treturn c.z * lerp( K.xxx, saturate( p - K.xxx ), c.y );\n", + "}\n"}; + public static readonly bool[] HSVToRGBFlags = { true, + false, + true, + true, + false, + false}; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "Hue" ); + AddInputPort( WirePortDataType.FLOAT, false, "Saturation" ); + AddInputPort( WirePortDataType.FLOAT, false, "Value" ); + AddOutputColorPorts( "RGB", false ); + m_previewShaderGUID = "fab445eb945d63047822a7a6b81b959d"; + m_useInternalPortData = true; + m_autoWrapProperties = true; + m_customPrecision = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + DrawPrecisionProperty(); + } + + public static void AddHSVToRGBFunction( ref MasterNodeDataCollector dataCollector , string precisionString ) + { + if( !dataCollector.HasFunction( HSVToRGBHeader ) ) + { + //Hack to be used util indent is properly used + int currIndent = UIUtils.ShaderIndentLevel; + if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + UIUtils.ShaderIndentLevel = 0; + } + else + { + UIUtils.ShaderIndentLevel = 1; + UIUtils.ShaderIndentLevel++; + } + + string finalFunction = string.Empty; + for( int i = 0; i < HSVToRGBFunction.Length; i++ ) + { + finalFunction += UIUtils.ShaderIndentTabs + ( HSVToRGBFlags[ i ] ? string.Format( HSVToRGBFunction[ i ], precisionString ) : HSVToRGBFunction[ i ] ); + } + + UIUtils.ShaderIndentLevel = currIndent; + + dataCollector.AddFunction( HSVToRGBHeader, finalFunction ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + string precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT ); + + AddHSVToRGBFunction( ref dataCollector , precisionString ); + + string hue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string saturation = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string value = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + + RegisterLocalVariable( 0, string.Format( HSVToRGBHeader, precisionString, hue, saturation, value ), ref dataCollector, "hsvTorgb" + OutputId ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs.meta new file mode 100644 index 00000000..ba77bf7f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3d992a68cff329a4a9bd1deb999fe691 +timeCreated: 1494857111 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs new file mode 100644 index 00000000..2582a59b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs @@ -0,0 +1,32 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Luminance", "Image Effects", "Calculates Luminance value from input")] + public sealed class LuminanceNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "RGB" ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_previewShaderGUID = "81e1d8ffeec8a4b4cabb1094bc981048"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string grayscale = "Luminance(" + value + ")"; + + RegisterLocalVariable( 0, grayscale, ref dataCollector, "luminance" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs.meta new file mode 100644 index 00000000..d813262c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c5f40d01acf184946b8660599f33109f +timeCreated: 1574935849 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs new file mode 100644 index 00000000..c6805a41 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs @@ -0,0 +1,466 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// Based on the work by https://github.com/keijiro/NoiseShader + +using System; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public enum NoiseGeneratorType + { + Simplex2D, + Simplex3D, + Gradient, + Simple + }; + + [Serializable] + [NodeAttributes( "Noise Generator", "Miscellaneous", "Collection of procedural noise generators", tags: "simplex gradient" )] + public sealed class NoiseGeneratorNode : ParentNode + { + private const string TypeLabelStr = "Type"; + private const string SetTo01RangeOpStr = "{0} = {0}*0.5 + 0.5;"; + private const string SetToMinus1To1RangeOpStr = "{0} = {0}*2 - 1;"; + private const string SetTo01RangeLabel = "0-1 Range"; + private const string SetTo01RangePreviewId = "_To01Range"; + private const string UseUnityVersionLabel = "Use Unity Version"; + + // Simple + private const string SimpleNoiseRandomValueFunc = "inline float noise_randomValue (float2 uv) { return frac(sin(dot(uv, float2(12.9898, 78.233)))*43758.5453); }"; + private const string SimpleNoiseInterpolateFunc = "inline float noise_interpolate (float a, float b, float t) { return (1.0-t)*a + (t*b); }"; + private const string SimpleValueNoiseHeader = "inline float valueNoise (float2 uv)"; + private readonly string[] SimpleValueNoiseBody = { "inline float valueNoise (float2 uv)\n", + "{\n", + "\tfloat2 i = floor(uv);\n", + "\tfloat2 f = frac( uv );\n", + "\tf = f* f * (3.0 - 2.0 * f);\n", + "\tuv = abs( frac(uv) - 0.5);\n", + "\tfloat2 c0 = i + float2( 0.0, 0.0 );\n", + "\tfloat2 c1 = i + float2( 1.0, 0.0 );\n", + "\tfloat2 c2 = i + float2( 0.0, 1.0 );\n", + "\tfloat2 c3 = i + float2( 1.0, 1.0 );\n", + "\tfloat r0 = noise_randomValue( c0 );\n", + "\tfloat r1 = noise_randomValue( c1 );\n", + "\tfloat r2 = noise_randomValue( c2 );\n", + "\tfloat r3 = noise_randomValue( c3 );\n", + "\tfloat bottomOfGrid = noise_interpolate( r0, r1, f.x );\n", + "\tfloat topOfGrid = noise_interpolate( r2, r3, f.x );\n", + "\tfloat t = noise_interpolate( bottomOfGrid, topOfGrid, f.y );\n", + "\treturn t;\n", + "}\n"}; + + private const string SimpleNoiseHeader = "float SimpleNoise(float2 UV, float Scale)"; + private const string SimpleNoiseFunc = "SimpleNoise( {0} )"; + private readonly string[] SimpleNoiseBody = { "float SimpleNoise(float2 UV)\n", + "{\n", + "\tfloat t = 0.0;\n", + "\tfloat freq = pow( 2.0, float( 0 ) );\n", + "\tfloat amp = pow( 0.5, float( 3 - 0 ) );\n", + "\tt += valueNoise( UV/freq )*amp;\n", + "\tfreq = pow(2.0, float(1));\n", + "\tamp = pow(0.5, float(3-1));\n", + "\tt += valueNoise( UV/freq )*amp;\n", + "\tfreq = pow(2.0, float(2));\n", + "\tamp = pow(0.5, float(3-2));\n", + "\tt += valueNoise( UV/freq )*amp;\n", + "\treturn t;\n", + "}\n"}; + + // Simplex 2D + private const string Simplex2DFloat3Mod289Func = "float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }"; + private const string Simplex2DFloat2Mod289Func = "float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }"; + private const string Simplex2DPermuteFunc = "float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }"; + + private const string SimplexNoise2DHeader = "float snoise( float2 v )"; + private const string SimplexNoise2DFunc = "snoise( {0} )"; + private readonly string[] SimplexNoise2DBody = {"float snoise( float2 v )\n", + "{\n", + "\tconst float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );\n", + "\tfloat2 i = floor( v + dot( v, C.yy ) );\n", + "\tfloat2 x0 = v - i + dot( i, C.xx );\n", + "\tfloat2 i1;\n", + "\ti1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );\n", + "\tfloat4 x12 = x0.xyxy + C.xxzz;\n", + "\tx12.xy -= i1;\n", + "\ti = mod2D289( i );\n", + "\tfloat3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );\n", + "\tfloat3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );\n", + "\tm = m * m;\n", + "\tm = m * m;\n", + "\tfloat3 x = 2.0 * frac( p * C.www ) - 1.0;\n", + "\tfloat3 h = abs( x ) - 0.5;\n", + "\tfloat3 ox = floor( x + 0.5 );\n", + "\tfloat3 a0 = x - ox;\n", + "\tm *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );\n", + "\tfloat3 g;\n", + "\tg.x = a0.x * x0.x + h.x * x0.y;\n", + "\tg.yz = a0.yz * x12.xz + h.yz * x12.yw;\n", + "\treturn 130.0 * dot( m, g );\n", + "}\n"}; + // Simplex 3D + + + + private const string Simplex3DFloat3Mod289 = "float3 mod3D289( float3 x ) { return x - floor( x / 289.0 ) * 289.0; }"; + private const string Simplex3DFloat4Mod289 = "float4 mod3D289( float4 x ) { return x - floor( x / 289.0 ) * 289.0; }"; + private const string Simplex3DFloat4Permute = "float4 permute( float4 x ) { return mod3D289( ( x * 34.0 + 1.0 ) * x ); }"; + private const string TaylorInvSqrtFunc = "float4 taylorInvSqrt( float4 r ) { return 1.79284291400159 - r * 0.85373472095314; }"; + + private const string SimplexNoise3DHeader = "float snoise( float3 v )"; + private const string SimplexNoise3DFunc = "snoise( {0} )"; + private readonly string[] SimplexNoise3DBody = + { + "float snoise( float3 v )\n", + "{\n", + "\tconst float2 C = float2( 1.0 / 6.0, 1.0 / 3.0 );\n", + "\tfloat3 i = floor( v + dot( v, C.yyy ) );\n", + "\tfloat3 x0 = v - i + dot( i, C.xxx );\n", + "\tfloat3 g = step( x0.yzx, x0.xyz );\n", + "\tfloat3 l = 1.0 - g;\n", + "\tfloat3 i1 = min( g.xyz, l.zxy );\n", + "\tfloat3 i2 = max( g.xyz, l.zxy );\n", + "\tfloat3 x1 = x0 - i1 + C.xxx;\n", + "\tfloat3 x2 = x0 - i2 + C.yyy;\n", + "\tfloat3 x3 = x0 - 0.5;\n", + "\ti = mod3D289( i);\n", + "\tfloat4 p = permute( permute( permute( i.z + float4( 0.0, i1.z, i2.z, 1.0 ) ) + i.y + float4( 0.0, i1.y, i2.y, 1.0 ) ) + i.x + float4( 0.0, i1.x, i2.x, 1.0 ) );\n", + "\tfloat4 j = p - 49.0 * floor( p / 49.0 ); // mod(p,7*7)\n", + "\tfloat4 x_ = floor( j / 7.0 );\n", + "\tfloat4 y_ = floor( j - 7.0 * x_ ); // mod(j,N)\n", + "\tfloat4 x = ( x_ * 2.0 + 0.5 ) / 7.0 - 1.0;\n", + "\tfloat4 y = ( y_ * 2.0 + 0.5 ) / 7.0 - 1.0;\n", + "\tfloat4 h = 1.0 - abs( x ) - abs( y );\n", + "\tfloat4 b0 = float4( x.xy, y.xy );\n", + "\tfloat4 b1 = float4( x.zw, y.zw );\n", + "\tfloat4 s0 = floor( b0 ) * 2.0 + 1.0;\n", + "\tfloat4 s1 = floor( b1 ) * 2.0 + 1.0;\n", + "\tfloat4 sh = -step( h, 0.0 );\n", + "\tfloat4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;\n", + "\tfloat4 a1 = b1.xzyw + s1.xzyw * sh.zzww;\n", + "\tfloat3 g0 = float3( a0.xy, h.x );\n", + "\tfloat3 g1 = float3( a0.zw, h.y );\n", + "\tfloat3 g2 = float3( a1.xy, h.z );\n", + "\tfloat3 g3 = float3( a1.zw, h.w );\n", + "\tfloat4 norm = taylorInvSqrt( float4( dot( g0, g0 ), dot( g1, g1 ), dot( g2, g2 ), dot( g3, g3 ) ) );\n", + "\tg0 *= norm.x;\n", + "\tg1 *= norm.y;\n", + "\tg2 *= norm.z;\n", + "\tg3 *= norm.w;\n", + "\tfloat4 m = max( 0.6 - float4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ), 0.0 );\n", + "\tm = m* m;\n", + "\tm = m* m;\n", + "\tfloat4 px = float4( dot( x0, g0 ), dot( x1, g1 ), dot( x2, g2 ), dot( x3, g3 ) );\n", + "\treturn 42.0 * dot( m, px);\n", + "}\n" + }; + + //Gradient Noise + private readonly string UnityGradientNoiseFunc = "UnityGradientNoise({0},{1})"; + private readonly string[] UnityGradientNoiseFunctionsBody = + { + "float2 UnityGradientNoiseDir( float2 p )\n", + "{\n", + "\tp = fmod(p , 289);\n", + "\tfloat x = fmod((34 * p.x + 1) * p.x , 289) + p.y;\n", + "\tx = fmod( (34 * x + 1) * x , 289);\n", + "\tx = frac( x / 41 ) * 2 - 1;\n", + "\treturn normalize( float2(x - floor(x + 0.5 ), abs( x ) - 0.5 ) );\n", + "}\n", + "\n", + "float UnityGradientNoise( float2 UV, float Scale )\n", + "{\n", + "\tfloat2 p = UV * Scale;\n", + "\tfloat2 ip = floor( p );\n", + "\tfloat2 fp = frac( p );\n", + "\tfloat d00 = dot( UnityGradientNoiseDir( ip ), fp );\n", + "\tfloat d01 = dot( UnityGradientNoiseDir( ip + float2( 0, 1 ) ), fp - float2( 0, 1 ) );\n", + "\tfloat d10 = dot( UnityGradientNoiseDir( ip + float2( 1, 0 ) ), fp - float2( 1, 0 ) );\n", + "\tfloat d11 = dot( UnityGradientNoiseDir( ip + float2( 1, 1 ) ), fp - float2( 1, 1 ) );\n", + "\tfp = fp * fp * fp * ( fp * ( fp * 6 - 15 ) + 10 );\n", + "\treturn lerp( lerp( d00, d01, fp.y ), lerp( d10, d11, fp.y ), fp.x ) + 0.5;\n", + "}\n" + }; + private readonly string GradientNoiseFunc = "GradientNoise({0},{1})"; + private readonly string[] GradientNoiseFunctionsBody = + { + "//https://www.shadertoy.com/view/XdXGW8\n", + "float2 GradientNoiseDir( float2 x )\n", + "{\n", + "\tconst float2 k = float2( 0.3183099, 0.3678794 );\n", + "\tx = x * k + k.yx;\n", + "\treturn -1.0 + 2.0 * frac( 16.0 * k * frac( x.x * x.y * ( x.x + x.y ) ) );\n", + "}\n", + "\n", + "float GradientNoise( float2 UV, float Scale )\n", + "{\n", + "\tfloat2 p = UV * Scale;\n", + "\tfloat2 i = floor( p );\n", + "\tfloat2 f = frac( p );\n", + "\tfloat2 u = f * f * ( 3.0 - 2.0 * f );\n", + "\treturn lerp( lerp( dot( GradientNoiseDir( i + float2( 0.0, 0.0 ) ), f - float2( 0.0, 0.0 ) ),\n", + "\t\t\tdot( GradientNoiseDir( i + float2( 1.0, 0.0 ) ), f - float2( 1.0, 0.0 ) ), u.x ),\n", + "\t\t\tlerp( dot( GradientNoiseDir( i + float2( 0.0, 1.0 ) ), f - float2( 0.0, 1.0 ) ),\n", + "\t\t\tdot( GradientNoiseDir( i + float2( 1.0, 1.0 ) ), f - float2( 1.0, 1.0 ) ), u.x ), u.y );\n", + "}\n" + }; + + [SerializeField] + private NoiseGeneratorType m_type = NoiseGeneratorType.Simplex2D; + + [SerializeField] + private bool m_setTo01Range = true; + + [SerializeField] + private bool m_unityVersion = false; + private int m_setTo01RangePreviewId; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); + AddInputPort( WirePortDataType.FLOAT, false, "Scale" ); + m_inputPorts[ 1 ].FloatInternalData = 1; + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_type ) ); + m_previewShaderGUID = "cd2d37ef5da190b42a91a5a690ba2a7d"; + ConfigurePorts(); + } + + public override void OnEnable() + { + base.OnEnable(); + m_setTo01RangePreviewId = Shader.PropertyToID( SetTo01RangePreviewId ); + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + float range01 = m_setTo01Range ? 1 : 0; + PreviewMaterial.SetFloat( m_setTo01RangePreviewId, range01 ); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + m_upperLeftWidget.DrawWidget( ref m_type, this, OnWidgetUpdate ); + } + + private readonly Action OnWidgetUpdate = ( x ) => + { + ( x as NoiseGeneratorNode ).ConfigurePorts(); + }; + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_type = (NoiseGeneratorType)EditorGUILayoutEnumPopup( TypeLabelStr, m_type ); + if( EditorGUI.EndChangeCheck() ) + { + ConfigurePorts(); + } + + m_setTo01Range = EditorGUILayoutToggle( SetTo01RangeLabel, m_setTo01Range ); + + if( m_type == NoiseGeneratorType.Gradient ) + { + EditorGUI.BeginChangeCheck(); + m_unityVersion = EditorGUILayoutToggle( UseUnityVersionLabel, m_unityVersion ); + if( EditorGUI.EndChangeCheck() ) + { + ConfigurePorts(); + } + } + //EditorGUILayout.HelpBox( "Node still under construction. Use with caution", MessageType.Info ); + } + + private void ConfigurePorts() + { + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_type ) ); + + switch( m_type ) + { + case NoiseGeneratorType.Simplex2D: + { + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); + m_previewMaterialPassId = 0; + } + break; + + case NoiseGeneratorType.Simplex3D: + { + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_previewMaterialPassId = 1; + } + break; + case NoiseGeneratorType.Gradient: + { + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); + m_previewMaterialPassId = m_unityVersion ? 3 : 2; + } + break; + case NoiseGeneratorType.Simple: + { + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); + m_previewMaterialPassId = 4; + } + break; + } + PreviewIsDirty = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) + { + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + + string size = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string scale = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + switch( m_type ) + { + case NoiseGeneratorType.Simplex2D: + { + + string float3Mod289Func = ( dataCollector.IsTemplate ) ? Simplex2DFloat3Mod289Func : "\t\t" + Simplex2DFloat3Mod289Func; + dataCollector.AddFunction( Simplex2DFloat3Mod289Func, float3Mod289Func ); + + string float2Mod289Func = ( dataCollector.IsTemplate ) ? Simplex2DFloat2Mod289Func : "\t\t" + Simplex2DFloat2Mod289Func; + dataCollector.AddFunction( Simplex2DFloat2Mod289Func, float2Mod289Func ); + + string permuteFunc = ( dataCollector.IsTemplate ) ? Simplex2DPermuteFunc : "\t\t" + Simplex2DPermuteFunc; + dataCollector.AddFunction( Simplex2DPermuteFunc, permuteFunc ); + + dataCollector.AddFunction( SimplexNoise2DHeader, SimplexNoise2DBody, false ); + + + if( m_inputPorts[ 1 ].IsConnected || m_inputPorts[ 1 ].FloatInternalData != 1.0f ) + { + size = string.Format( "{0}*{1}", size, scale ); + } + + RegisterLocalVariable( 0, string.Format( SimplexNoise2DFunc, size ), ref dataCollector, ( "simplePerlin2D" + OutputId ) ); + } + break; + case NoiseGeneratorType.Simplex3D: + { + + string float3Mod289Func = ( dataCollector.IsTemplate ) ? Simplex3DFloat3Mod289 : "\t\t" + Simplex3DFloat3Mod289; + dataCollector.AddFunction( Simplex3DFloat3Mod289, float3Mod289Func ); + + string float4Mod289Func = ( dataCollector.IsTemplate ) ? Simplex3DFloat4Mod289 : "\t\t" + Simplex3DFloat4Mod289; + dataCollector.AddFunction( Simplex3DFloat4Mod289, float4Mod289Func ); + + string permuteFunc = ( dataCollector.IsTemplate ) ? Simplex3DFloat4Permute : "\t\t" + Simplex3DFloat4Permute; + dataCollector.AddFunction( Simplex3DFloat4Permute, permuteFunc ); + + string taylorInvSqrtFunc = ( dataCollector.IsTemplate ) ? TaylorInvSqrtFunc : "\t\t" + TaylorInvSqrtFunc; + dataCollector.AddFunction( TaylorInvSqrtFunc, taylorInvSqrtFunc ); + + dataCollector.AddFunction( SimplexNoise3DHeader, SimplexNoise3DBody, false ); + + if( m_inputPorts[ 1 ].IsConnected || m_inputPorts[ 1 ].FloatInternalData != 1.0f ) + { + size = string.Format( "{0}*{1}", size, scale ); + } + + RegisterLocalVariable( 0, string.Format( SimplexNoise3DFunc, size ), ref dataCollector, ( "simplePerlin3D" + OutputId ) ); + } + break; + + case NoiseGeneratorType.Gradient: + { + string[] body = m_unityVersion ? UnityGradientNoiseFunctionsBody : GradientNoiseFunctionsBody; + string func = m_unityVersion ? UnityGradientNoiseFunc : GradientNoiseFunc; + + dataCollector.AddFunction( body[ 0 ], body, false); + RegisterLocalVariable( 0, string.Format( func, size, scale ), ref dataCollector, ( "gradientNoise" + OutputId ) ); + } + break; + + case NoiseGeneratorType.Simple: + { + string randomValue = ( dataCollector.IsTemplate ) ? SimpleNoiseRandomValueFunc : "\t\t" + SimpleNoiseRandomValueFunc; + dataCollector.AddFunction( SimpleNoiseRandomValueFunc, randomValue ); + + string interpolate = ( dataCollector.IsTemplate ) ? SimpleNoiseInterpolateFunc : "\t\t" + SimpleNoiseInterpolateFunc; + dataCollector.AddFunction( SimpleNoiseInterpolateFunc, interpolate ); + + dataCollector.AddFunction( SimpleValueNoiseHeader, SimpleValueNoiseBody, false ); + + dataCollector.AddFunction( SimpleNoiseHeader, SimpleNoiseBody, false ); + + if( m_inputPorts[ 1 ].IsConnected || m_inputPorts[ 1 ].FloatInternalData != 1.0f ) + { + size = string.Format( "{0}*{1}", size, scale ); + } + RegisterLocalVariable( 0, string.Format( SimpleNoiseFunc, size ), ref dataCollector, ( "simpleNoise" + OutputId ) ); + } + break; + } + + if( m_type == NoiseGeneratorType.Simple && !m_setTo01Range ) + { + dataCollector.AddLocalVariable( outputId, string.Format( SetToMinus1To1RangeOpStr, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ) ); + } + + if( m_setTo01Range && m_type != NoiseGeneratorType.Simple ) + { + dataCollector.AddLocalVariable( outputId, string.Format( SetTo01RangeOpStr, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ) ); + } + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_type = (NoiseGeneratorType)Enum.Parse( typeof( NoiseGeneratorType ), GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() < 16903 ) + { + m_setTo01Range = false; + } + else + { + m_setTo01Range = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_unityVersion = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + ConfigurePorts(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_type ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_setTo01Range ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_unityVersion ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs.meta new file mode 100644 index 00000000..0df413fb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6b82a8d1dffe4204fa03a09e2fe783b3 +timeCreated: 1485355115 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs new file mode 100644 index 00000000..9518f64e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs @@ -0,0 +1,98 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +//https://www.shadertoy.com/view/ldX3D4 +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Posterize", "Image Effects", "Converts a continuous gradation of tones to multiple regions of fewer tones" )] + public sealed class PosterizeNode : ParentNode + { + private const string PosterizationPowerStr = "Power"; + [SerializeField] + private int m_posterizationPower = 1; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.COLOR, false, "RGBA", -1, MasterNodePortCategory.Fragment, 1 ); + AddInputPort( WirePortDataType.INT, false, "Power", -1, MasterNodePortCategory.Fragment, 0 ); + m_inputPorts[ 1 ].AutoDrawInternalData = true; + AddOutputPort( WirePortDataType.COLOR, Constants.EmptyPortValue ); + m_textLabelWidth = 60; + m_autoWrapProperties = true; + m_previewShaderGUID = "ecb3048ef0eec1645bad1d72a98d8279"; + } + + public override void DrawProperties() + { + base.DrawProperties(); + if( !m_inputPorts[ 1 ].IsConnected ) + { + EditorGUILayout.BeginVertical(); + { + EditorGUI.BeginChangeCheck(); + m_posterizationPower = EditorGUILayoutIntSlider( PosterizationPowerStr, m_posterizationPower, 1, 256 ); + if( EditorGUI.EndChangeCheck() ) + { + GetInputPortByUniqueId( 0 ).IntInternalData = m_posterizationPower; + } + } + EditorGUILayout.EndVertical(); + } + else + { + EditorGUILayout.Space(); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string posterizationPower = "1"; + if( m_inputPorts[ 1 ].IsConnected ) + { + posterizationPower = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + } + else + { + posterizationPower = m_posterizationPower.ToString(); + } + + string colorTarget = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + string divVar = "div" + OutputId; + dataCollector.AddLocalVariable( UniqueId, "float " + divVar + "=256.0/float(" + posterizationPower + ");" ); + string result = "( floor( " + colorTarget + " * " + divVar + " ) / " + divVar + " )"; + + RegisterLocalVariable( 0, result, ref dataCollector, "posterize" + OutputId ); + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + m_inputPorts[ 0 ].ChangeType( WirePortDataType.COLOR, false ); + m_inputPorts[ 1 ].ChangeType( WirePortDataType.INT, false ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_posterizationPower ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_posterizationPower = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs.meta new file mode 100644 index 00000000..e25ae02c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7dc4667cd643835489312daa244a03b9 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs new file mode 100644 index 00000000..6d734a04 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs @@ -0,0 +1,93 @@ +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "RGB to HSV", "Image Effects", "Converts from RGB to HSV color space" )] + public sealed class RGBToHSVNode : ParentNode + { + public static readonly string RGBToHSVHeader = "RGBToHSV( {0} )"; + public static readonly string[] RGBToHSVFunction = { "{0}3 RGBToHSV({0}3 c)\n", + "{\n", + "\t{0}4 K = {0}4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n", + "\t{0}4 p = lerp( {0}4( c.bg, K.wz ), {0}4( c.gb, K.xy ), step( c.b, c.g ) );\n", + "\t{0}4 q = lerp( {0}4( p.xyw, c.r ), {0}4( c.r, p.yzx ), step( p.x, c.r ) );\n", + "\t{0} d = q.x - min( q.w, q.y );\n", + "\t{0} e = 1.0e-10;\n", + "\treturn {0}3( abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n", + "}" + }; + + public static readonly bool[] RGBToHSVFlags = { true, + false, + true, + true, + true, + true, + true, + true, + false}; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "RGB" ); + AddOutputPort( WirePortDataType.FLOAT3, "HSV" ); + AddOutputPort( WirePortDataType.FLOAT, "Hue" ); + AddOutputPort( WirePortDataType.FLOAT, "Saturation" ); + AddOutputPort( WirePortDataType.FLOAT, "Value" ); + m_previewShaderGUID = "0f2f09b49bf4954428aafa2dfe1a9a09"; + m_useInternalPortData = true; + m_autoWrapProperties = true; + m_customPrecision = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + DrawPrecisionProperty(); + } + + public static void AddRGBToHSVFunction( ref MasterNodeDataCollector dataCollector, string precisionString ) + { + if( !dataCollector.HasFunction( RGBToHSVHeader ) ) + { + //Hack to be used util indent is properly used + int currIndent = UIUtils.ShaderIndentLevel; + if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + UIUtils.ShaderIndentLevel = 0; + } + else + { + UIUtils.ShaderIndentLevel = 1; + UIUtils.ShaderIndentLevel++; + } + + string finalFunction = string.Empty; + for( int i = 0; i < RGBToHSVFunction.Length; i++ ) + { + finalFunction += UIUtils.ShaderIndentTabs + ( RGBToHSVFlags[ i ] ? string.Format( RGBToHSVFunction[ i ], precisionString ) : RGBToHSVFunction[ i ] ); + } + UIUtils.ShaderIndentLevel--; + UIUtils.ShaderIndentLevel = currIndent; + + dataCollector.AddFunction( RGBToHSVHeader, finalFunction ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + string precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT ); + AddRGBToHSVFunction( ref dataCollector, precisionString ); + + string rgbValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + RegisterLocalVariable( 0, string.Format( RGBToHSVHeader, rgbValue ), ref dataCollector, "hsvTorgb" + OutputId ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs.meta new file mode 100644 index 00000000..bb94c2fc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4d24b838adbc80d4cb63e3fc4f5a1c79 +timeCreated: 1494863846 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs new file mode 100644 index 00000000..01310922 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs @@ -0,0 +1,55 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Simple Contrast", "Image Effects", "Simple contrast matrix multiplication" )] + public sealed class SimpleContrastOpNode : ParentNode + { + private const string InputTypeStr = "Contrast"; + private const string FunctionHeader = "CalculateContrast({0},{1})"; + private readonly string[] m_functionBody = { "float4 CalculateContrast( float contrastValue, float4 colorTarget )\n", + "{\n", + "\tfloat t = 0.5 * ( 1.0 - contrastValue );\n", + "\treturn mul( float4x4( contrastValue,0,0,t, 0,contrastValue,0,t, 0,0,contrastValue,t, 0,0,0,1 ), colorTarget );\n", + "}"}; + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddPorts(); + m_textLabelWidth = 70; + m_useInternalPortData = true; + m_previewShaderGUID = "8d76799413f9f0547ac9b1de7ba798f1"; + } + + void AddPorts() + { + AddInputPort( WirePortDataType.COLOR, false, "RGBA", -1, MasterNodePortCategory.Fragment, 1 ); + AddInputPort( WirePortDataType.FLOAT, false, "Value", -1, MasterNodePortCategory.Fragment, 0 ); + AddOutputPort( WirePortDataType.COLOR, Constants.EmptyPortValue ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string contrastValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string colorTarget = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string result = dataCollector.AddFunctions( FunctionHeader, m_functionBody, false, contrastValue, colorTarget ); + + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() < 5004 ) + { + m_inputPorts[ 1 ].FloatInternalData = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs.meta new file mode 100644 index 00000000..99e17ce8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3f49defa61805f948a04775d391e507a +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs new file mode 100644 index 00000000..ec946236 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs @@ -0,0 +1,104 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +//https://www.shadertoy.com/view/XsX3zB +using System; +using UnityEngine; +using UnityEditor; + + +namespace AmplifyShaderEditor +{ + public enum NoiseType + { + Simplex3D, + Simplex3DFractal + } + + [Serializable] + [NodeAttributes( "[Deprecated] Simplex Noise", "Image Effects", "Noise generated via the Simplex algorithm",null,KeyCode.None,false,true)] + public sealed class SimplexNoiseNode : ParentNode + { + private string m_randomFuncBody; + private string m_simplex3dFuncBody; + private string m_simplex3dFractalFuncBody; + + private const string RandomfunctionHeader = "Random3({0})"; + private const string Simplex3dfunctionHeader = "Simplex3d({0})"; + private const string Simplex3dFractalfunctionHeader = "Simplex3dFractal( {0})"; + + private const string NoiseTypeStr = "Type"; + + [SerializeField] + private NoiseType m_type = NoiseType.Simplex3D; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + + IOUtils.AddFunctionHeader( ref m_randomFuncBody, "float3 Random3 ( float3 c )" ); + IOUtils.AddFunctionLine( ref m_randomFuncBody, "float fracMul = 512.0;float j = 4096.0*sin ( dot ( c, float3 ( 17.0, 59.4, 15.0 ) ) );float3 r;r.z = frac ( fracMul*j );j *= .125;r.x = frac ( fracMul*j );j *= .125;r.y = frac ( fracMul*j );return r - 0.5;" ); + IOUtils.CloseFunctionBody( ref m_randomFuncBody ); + + IOUtils.AddFunctionHeader( ref m_simplex3dFuncBody, "float3 Simplex3d ( float3 p )" ); + IOUtils.AddFunctionLine( ref m_simplex3dFuncBody, "float F3 = 0.3333333;float G3 = 0.1666667;float3 s = floor ( p + dot ( p, F3.xxx ) );float3 x = p - s + dot ( s, G3.xxx );float3 e = step ( ( 0.0 ).xxx, x - x.yzx );float3 i1 = e*( 1.0 - e.zxy );float3 i2 = 1.0 - e.zxy*( 1.0 - e );float3 x1 = x - i1 + G3;float3 x2 = x - i2 + 2.0*G3;float3 x3 = x - 1.0 + 3.0*G3;float4 w, d;w.x = dot ( x, x );w.y = dot ( x1, x1 );w.z = dot ( x2, x2 );w.w = dot ( x3, x3 );w = max ( 0.6 - w, 0.0 );d.x = dot ( Random3 ( s ), x );d.y = dot ( Random3 ( s + i1 ), x1 );d.z = dot ( Random3 ( s + i2 ), x2 );d.w = dot ( Random3 ( s + 1.0 ), x3 );w *= w;w *= w;d *= w;return dot ( d, ( 52.0 ).xxx ).xxx;" ); + IOUtils.CloseFunctionBody( ref m_simplex3dFuncBody ); + + IOUtils.AddFunctionHeader( ref m_simplex3dFractalFuncBody, "float3 Simplex3dFractal ( float3 m )" ); + IOUtils.AddFunctionLine( ref m_simplex3dFractalFuncBody, "return (0.5333333*Simplex3d ( m ) + 0.2666667*Simplex3d ( 2.0*m ) + 0.1333333*Simplex3d ( 4.0*m ) + 0.0666667*Simplex3d ( 8.0*m )).xxx;" ); + IOUtils.CloseFunctionBody( ref m_simplex3dFractalFuncBody ); + + AddInputPort( WirePortDataType.FLOAT3, false, "Position" ); + AddInputPort( WirePortDataType.FLOAT, false, "Width" ); + AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue ); + m_textLabelWidth = 50; + m_useInternalPortData = true; + m_autoWrapProperties = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + m_type = ( NoiseType ) EditorGUILayoutEnumPopup( NoiseTypeStr, m_type ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + + + string posValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string widthValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + dataCollector.AddFunctions( RandomfunctionHeader, m_randomFuncBody, "0" ); + string result = string.Empty; + switch ( m_type ) + { + case NoiseType.Simplex3D: + { + string finalValue = dataCollector.AddFunctions( Simplex3dfunctionHeader, m_simplex3dFuncBody, posValue + "*" + widthValue ); + result = finalValue + "* 0.5 + 0.5"; + }break; + + case NoiseType.Simplex3DFractal: + { + dataCollector.AddFunctions( Simplex3dfunctionHeader, m_simplex3dFuncBody, posValue + "*" + widthValue ); + string finalValue = dataCollector.AddFunctions( Simplex3dFractalfunctionHeader, m_simplex3dFractalFuncBody, posValue + "*" + widthValue + "+" + widthValue ); + result = finalValue + "* 0.5 + 0.5"; + }break; + } + + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_type = ( NoiseType ) Enum.Parse( typeof( NoiseType ), GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_type ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs.meta new file mode 100644 index 00000000..2a6af4c8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3f888e3dadb5df94199547ab13cb74d2 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs new file mode 100644 index 00000000..5620173c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs @@ -0,0 +1,116 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Grayscale +// Donated by The Four Headed Cat - @fourheadedcat + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Grayscale", "Image Effects", "Convert image colors to grayscale", null, KeyCode.None, true, false, null, null, "The Four Headed Cat - @fourheadedcat", tags:"luminance" )] + public sealed class TFHCGrayscale : ParentNode + { + private const string GrayscaleStyleStr = "Grayscale Style"; + + [SerializeField] + private int m_grayscaleStyle; + + [SerializeField] + private readonly string[] m_GrayscaleStyleValues = { "Luminance", "Natural Classic", "Old School" }; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "RGB" ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_textLabelWidth = 120; + m_useInternalPortData = true; + m_hasLeftDropdown = true; + m_autoWrapProperties = true; + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_GrayscaleStyleValues[ m_grayscaleStyle ] ) ); + m_previewShaderGUID = "56781cd022be9124597f0f396a46a35f"; + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + void UpdateFromSelected() + { + m_previewMaterialPassId = m_grayscaleStyle; + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_GrayscaleStyleValues[ m_grayscaleStyle ] ) ); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_grayscaleStyle = m_upperLeftWidget.DrawWidget( this, m_grayscaleStyle, m_GrayscaleStyleValues ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromSelected(); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_grayscaleStyle = EditorGUILayoutPopup( GrayscaleStyleStr, m_grayscaleStyle, m_GrayscaleStyleValues ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromSelected(); + } + EditorGUILayout.HelpBox( "Grayscale Old:\n\n - In: Image to convert.\n - Grayscale Style: Select the grayscale style.\n\n - Out: Grayscale version of the image.", MessageType.None ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_grayscaleStyle = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + UpdateFromSelected(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_grayscaleStyle ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string i = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string grayscale = string.Empty; + switch( m_grayscaleStyle ) + { + case 1: { grayscale = "dot(" + i + ", float3(0.299,0.587,0.114))"; } break; + case 2: { grayscale = "(" + i + ".r + " + i + ".g + " + i + ".b) / 3"; } break; + default: { grayscale = "Luminance(" + i + ")"; } break; + } + RegisterLocalVariable( 0, grayscale, ref dataCollector, "grayscale" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs.meta new file mode 100644 index 00000000..dcab5747 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 32d7b01a9f453d448abf3685a35c4a19 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs new file mode 100644 index 00000000..13d2b189 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs @@ -0,0 +1,618 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Voronoi", "Miscellaneous", "Voronoi", Tags = "noise" )] + public sealed class VoronoiNode : ParentNode + { + // Unity Voronoi + private readonly string UnityVoronoiNoiseFunc = "UnityVoronoi({0},{1},{2},{3})"; + private readonly string[] UnityVoroniNoiseFunctionsBody = + { + "inline float2 UnityVoronoiRandomVector( float2 UV, float offset )\n", + "{\n", + "\tfloat2x2 m = float2x2( 15.27, 47.63, 99.41, 89.98 );\n", + "\tUV = frac( sin(mul(UV, m) ) * 46839.32 );\n", + "\treturn float2( sin(UV.y* +offset ) * 0.5 + 0.5, cos( UV.x* offset ) * 0.5 + 0.5 );\n", + "}\n", + "\n", + "//x - Out y - Cells\n", + "float3 UnityVoronoi( float2 UV, float AngleOffset, float CellDensity, inout float2 mr )\n", + "{\n", + "\tfloat2 g = floor( UV * CellDensity );\n", + "\tfloat2 f = frac( UV * CellDensity );\n", + "\tfloat t = 8.0;\n", + "\tfloat3 res = float3( 8.0, 0.0, 0.0 );\n", + "\n", + "\tfor( int y = -1; y <= 1; y++ )\n", + "\t{\n", + "\t for( int x = -1; x <= 1; x++ )\n", + "\t {\n", + "\t\t\tfloat2 lattice = float2( x, y );\n", + "\t\t\tfloat2 offset = UnityVoronoiRandomVector( lattice + g, AngleOffset );\n", + "\t\t\tfloat d = distance( lattice + offset, f );\n", + "\n", + "\t\t\tif( d < res.x )\n", + "\t\t\t{\n", + "\t\t\t\tmr = f - lattice - offset;\n", + "\t\t\t\tres = float3( d, offset.x, offset.y );\n", + "\t\t\t}\n", + "\t }\n", + "\t}\n", + "\treturn res;\n", + "}\n", + }; + + //////////// + + private const string VoronoiHashHeader = "float2 voronoihash{0}( float2 p )"; + private readonly string[] VoronoiHashBody = { "p = p - 2 * floor( p / 2 );", + "p = float2( dot( p, float2( 127.1, 311.7 ) ), dot( p, float2( 269.5, 183.3 ) ) );", + "return frac( sin( p ) *43758.5453);" }; + + + private const string VoronoiHeader = "float voronoi{0}( float2 v, float time, inout float2 id, inout float2 mr, float smoothness, inout float2 smoothId )"; + private const string VoronoiFunc = "voronoi{0}( {1}, {2}, {3}, {4}, {5}, {6} )"; + private string[] VoronoiBody = + { + "float2 n = floor( v );", + "float2 f = frac( v );", + "float F1 = 8.0;", + "float F2 = 8.0; float2 mg = 0;", + "for ( int j = -1; j <= 1; j++ )", + "{", + " \tfor ( int i = -1; i <= 1; i++ )", + " \t{", + " \t\tfloat2 g = float2( i, j );", + " \t\tfloat2 o = voronoihash{0}( n + g );", + " \t\tfloat2 r = f - g - ( sin( 0 + o * 6.2831 ) * 0.5 + 0.5 );", + " \t\tfloat d = dot( r, r );", + " \t\tif( d + { + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].ValidInternalData && !m_inputPorts[ i ].IsConnected && m_inputPorts[ i ].Visible && m_inputPorts[ i ].AutoDrawInternalData ) + { + m_inputPorts[ i ].ShowInternalData( this ); + } + } + } ); + } + + void ChangeFunction( string scale ) + { + VoronoiBody[ 10 ] = "\t\to = ( sin( time + o * 6.2831 ) * 0.5 + 0.5 ); float2 r = f - g - o;"; + int q = m_searchQuality + 1; + VoronoiBody[ 4 ] = "for ( int j = -" + q + "; j <= " + q + "; j++ )"; + VoronoiBody[ 6 ] = "\tfor ( int i = -" + q + "; i <= " + q + "; i++ )"; + int dFunction = m_distanceFunction; + if( m_functionType == 4 ) + dFunction = 0; + switch( dFunction ) + { + default: + case 0: + VoronoiBody[ 11 ] = "\t\tfloat d = 0.5 * dot( r, r );"; + break; + case 1: + VoronoiBody[ 11 ] = "\t\tfloat d = 0.707 * sqrt(dot( r, r ));"; + break; + case 2: + VoronoiBody[ 11 ] = "\t\tfloat d = 0.5 * ( abs(r.x) + abs(r.y) );"; + break; + case 3: + VoronoiBody[ 11 ] = "\t\tfloat d = max(abs(r.x), abs(r.y));"; + break; + case 4: + VoronoiBody[ 11 ] = "\t\tfloat d = " + ( 1 / Mathf.Pow( 2, 1 / m_minkowskiPower ) ).ToString( "n3" ) + " * pow( ( pow( abs( r.x ), " + m_minkowskiPower + " ) + pow( abs( r.y ), " + m_minkowskiPower + " ) ), " + ( 1 / m_minkowskiPower ).ToString( "n3" ) + " );"; + break; + } + + if( m_functionType == 0 ) + { + if( m_calculateSmoothValue ) + { + VoronoiBody[ 12 ] = " //\t\tif( d 17402 ) + { + m_calculateSmoothValue = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 18902 ) + { + m_applySmoothToIds = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + ChangePorts(); + ChechSmoothPorts(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_searchQuality ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_distanceFunction ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_minkowskiPower ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_functionType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_octaves ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_tileable.ToString() ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_tileScale ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_useUnity ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_calculateSmoothValue ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_applySmoothToIds ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs.meta new file mode 100644 index 00000000..722e6f5f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a3f99c25e876b164789b7612a63ec748 +timeCreated: 1566897514 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators.meta new file mode 100644 index 00000000..5a304e67 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2123282111ea51445b360151bd090f3a +folderAsset: yes +timeCreated: 1481126945 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AllOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AllOpNode.cs new file mode 100644 index 00000000..1d47652a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AllOpNode.cs @@ -0,0 +1,47 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "All", "Logical Operators", "Determines if all components of the specified value are non-zero." )] + public sealed class AllOpNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_previewShaderGUID = "c33c751fb9fd7ad4e9fdc18d1f3a28d3"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + var inputValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + var outputType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + string result = string.Format( "( ( {0} )( all( {1} ) ? 1 : 0 ) )", outputType, inputValue ); + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AllOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AllOpNode.cs.meta new file mode 100644 index 00000000..012aef89 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AllOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: af02305604894ac49ab72d72193910ae +timeCreated: 1588859716 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AllOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AnyOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AnyOpNode.cs new file mode 100644 index 00000000..2b93ad39 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AnyOpNode.cs @@ -0,0 +1,47 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Any", "Logical Operators", "Determines if any components of the specified value are non-zero." )] + public sealed class AnyOpNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_previewShaderGUID = "a1e114ebddab3b347a7c5753c1cdb9cb"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + var inputValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + var outputType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + string result = string.Format( "( ( {0} )( any( {1} ) ? 1 : 0 ) )", outputType, inputValue ); + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AnyOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AnyOpNode.cs.meta new file mode 100644 index 00000000..338bf0e5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AnyOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a33b9b92dad9a1645a72aedde6a55d15 +timeCreated: 1588859716 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/AnyOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs new file mode 100644 index 00000000..dab5a159 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs @@ -0,0 +1,293 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using System.CodeDom; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Compare", "Logical Operators", "Compare A to B given the selected operator. If comparison is true return value of True else return value of False", tags: "If Ternary Compare Less Equal Not Greater" )] + public sealed class Compare : ParentNode + { + private static readonly string[] LabelsSTR = { "Equal", "Not Equal", "Greater", "Greater Or Equal", "Less", "Less Or Equal" }; + + enum Comparision + { + Equal, + NotEqual, + Greater, + GreaterOrEqual, + Less, + LessOrEqual, + } + + private WirePortDataType m_mainInputType = WirePortDataType.FLOAT; + private WirePortDataType m_mainOutputType = WirePortDataType.FLOAT; + + private int m_cachedOperatorId = -1; + + [SerializeField] + private Comparision m_comparision = Comparision.Equal; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "A" ); + AddInputPort( WirePortDataType.FLOAT, false, "B" ); + AddInputPort( WirePortDataType.FLOAT, false, "True" ); + AddInputPort( WirePortDataType.FLOAT, false, "False" ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_inputPorts[ 0 ].AutoDrawInternalData = true; + m_inputPorts[ 1 ].AutoDrawInternalData = true; + m_inputPorts[ 2 ].AutoDrawInternalData = true; + m_inputPorts[ 3 ].AutoDrawInternalData = true; + m_textLabelWidth = 100; + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + m_previewShaderGUID = "381937898f0c15747af1da09a751890c"; + UpdateTitle(); + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_comparision = (Comparision)m_upperLeftWidget.DrawWidget( this, (int)m_comparision, LabelsSTR ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateTitle(); + } + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_cachedOperatorId == -1 ) + m_cachedOperatorId = Shader.PropertyToID( "_Operator" ); + + PreviewMaterial.SetInt( m_cachedOperatorId, (int)m_comparision ); + } + + void UpdateTitle() + { + switch( m_comparision ) + { + default: + case Comparision.Equal: + m_additionalContent.text = "( A = B )"; + break; + case Comparision.NotEqual: + m_additionalContent.text = "( A \u2260 B )"; + break; + case Comparision.Greater: + m_additionalContent.text = "( A > B )"; + break; + case Comparision.GreaterOrEqual: + m_additionalContent.text = "( A \u2265 B )"; + break; + case Comparision.Less: + m_additionalContent.text = "( A < B )"; + break; + case Comparision.LessOrEqual: + m_additionalContent.text = "( A \u2264 B )"; + break; + } + m_sizeIsDirty = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_comparision = (Comparision)EditorGUILayoutEnumPopup( "", m_comparision ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateTitle(); + } + + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].ValidInternalData && !m_inputPorts[ i ].IsConnected && m_inputPorts[ i ].Visible ) + { + m_inputPorts[ i ].ShowInternalData( this ); + } + } + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); + UpdateConnection( inputPortId ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnection( portId ); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + + int otherPortId = 0; + if( portId < 2 ) + { + otherPortId = ( portId == 0 ) ? 1 : 0; + if( m_inputPorts[ otherPortId ].IsConnected ) + { + m_mainInputType = m_inputPorts[ otherPortId ].DataType; + m_inputPorts[ portId ].ChangeType( m_mainInputType, false ); + } + } + else + { + otherPortId = ( portId == 2 ) ? 3 : 2; + if( m_inputPorts[ otherPortId ].IsConnected ) + { + m_mainOutputType = m_inputPorts[ otherPortId ].DataType; + m_inputPorts[ portId ].ChangeType( m_mainOutputType, false ); + m_outputPorts[ 0 ].ChangeType( m_mainOutputType, false ); + } + } + } + + public void UpdateConnection( int portId ) + { + m_inputPorts[ portId ].MatchPortToConnection(); + int otherPortId = 0; + WirePortDataType otherPortType = WirePortDataType.FLOAT; + if( portId < 2 ) + { + otherPortId = ( portId == 0 ) ? 1 : 0; + otherPortType = m_inputPorts[ otherPortId ].IsConnected ? m_inputPorts[ otherPortId ].DataType : WirePortDataType.FLOAT; + m_mainInputType = UIUtils.GetPriority( m_inputPorts[ portId ].DataType ) > UIUtils.GetPriority( otherPortType ) ? m_inputPorts[ portId ].DataType : otherPortType; + if( !m_inputPorts[ otherPortId ].IsConnected ) + { + m_inputPorts[ otherPortId ].ChangeType( m_mainInputType, false ); + } + } + else + { + otherPortId = ( portId == 2 ) ? 3 : 2; + otherPortType = m_inputPorts[ otherPortId ].IsConnected ? m_inputPorts[ otherPortId ].DataType : WirePortDataType.FLOAT; + m_mainOutputType = UIUtils.GetPriority( m_inputPorts[ portId ].DataType ) > UIUtils.GetPriority( otherPortType ) ? m_inputPorts[ portId ].DataType : otherPortType; + + m_outputPorts[ 0 ].ChangeType( m_mainOutputType, false ); + + if( !m_inputPorts[ otherPortId ].IsConnected ) + { + m_inputPorts[ otherPortId ].ChangeType( m_mainOutputType, false ); + } + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + //Conditional Operator ?: has some shenanigans + //If the first operand is of type bool, one of the following must hold for the second and third operands: + //Both operands have compatible structure types. + //Both operands are scalars with numeric or bool type. + //Both operands are vectors with numeric or bool type, where the two vectors are of the same size, which is less than or equal to four. + //If the first operand is a packed vector of bool, then the conditional selection is performed on an elementwise basis.Both the second and third operands must be numeric vectors of the same size as the first operand. + WirePortDataType compatibleInputType = m_mainInputType; + if( m_mainInputType != WirePortDataType.FLOAT && m_mainInputType != WirePortDataType.INT && m_mainInputType != m_mainOutputType ) + { + compatibleInputType = m_mainOutputType; + } + + string a = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, compatibleInputType, ignoreLocalvar, true ); + string b = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, compatibleInputType, ignoreLocalvar, true ); + string op = string.Empty; + switch( m_comparision ) + { + default: + case Comparision.Equal: + op = "=="; + break; + case Comparision.NotEqual: + op = "!="; + break; + case Comparision.Greater: + op = ">"; + break; + case Comparision.GreaterOrEqual: + op = ">="; + break; + case Comparision.Less: + op = "<"; + break; + case Comparision.LessOrEqual: + op = "<="; + break; + } + string T = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, m_mainOutputType, ignoreLocalvar, true ); + string F = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, m_mainOutputType, ignoreLocalvar, true ); + return CreateOutputLocalVariable( 0, string.Format( "( {0} {2} {1} ? {3} : {4} )", a, b, op, T, F ), ref dataCollector ); + } + + public override void ReadFromDeprecated( ref string[] nodeParams, Type oldType = null ) + { + base.ReadFromDeprecated( ref nodeParams, oldType ); + + if( oldType == typeof( TFHCCompareEqual ) ) + { + m_comparision = Comparision.Equal; + } + else + if( oldType == typeof( TFHCCompareNotEqual ) ) + { + m_comparision = Comparision.NotEqual; + } + else + if( oldType == typeof( TFHCCompareGreater ) ) + { + m_comparision = Comparision.Greater; + } + else + if( oldType == typeof( TFHCCompareGreaterEqual ) ) + { + m_comparision = Comparision.GreaterOrEqual; + } + else + if( oldType == typeof( TFHCCompareLower ) ) + { + m_comparision = Comparision.Less; + } + else + if( oldType == typeof( TFHCCompareLowerEqual ) ) + { + m_comparision = Comparision.LessOrEqual; + } + + UpdateTitle(); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + + m_comparision = (Comparision)Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + UpdateTitle(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + + IOUtils.AddFieldValueToString( ref nodeInfo, (int)m_comparision ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs.meta new file mode 100644 index 00000000..b6ea2914 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ab308ada4f120144b8d44aef5c834fe6 +timeCreated: 1588859716 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/Compare.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs new file mode 100644 index 00000000..9a7d804a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs @@ -0,0 +1,297 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; +//using System.Collections.Generic; +//using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "If", "Logical Operators", "Conditional comparison between A with B.",tags:"branch" )] + public sealed class ConditionalIfNode : ParentNode + { + private const string UseUnityBranchesStr = "Dynamic Branching"; + private const string UnityBranchStr = "UNITY_BRANCH "; + + private readonly string[] IfOps = { "if( {0} > {1} )", + "if( {0} == {1} )", + "if( {0} < {1} )", + "if( {0} >= {1} )", + "if( {0} <= {1} )", + "if( {0} != {1} )" }; + + //private WirePortDataType m_inputMainDataType = WirePortDataType.FLOAT; + private WirePortDataType m_outputMainDataType = WirePortDataType.FLOAT; + private string[] m_results = { string.Empty, string.Empty, string.Empty }; + + [SerializeField] + private bool m_useUnityBranch = false; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "A" ); + AddInputPort( WirePortDataType.FLOAT, false, "B" ); + m_inputPorts[ 0 ].AddPortRestrictions( WirePortDataType.FLOAT, WirePortDataType.INT ); + m_inputPorts[ 1 ].AddPortRestrictions( WirePortDataType.FLOAT, WirePortDataType.INT ); + + AddInputPort( WirePortDataType.FLOAT, false, "A > B" ); + AddInputPort( WirePortDataType.FLOAT, false, "A == B" ); + AddInputPort( WirePortDataType.FLOAT, false, "A < B" ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_inputPorts[ 0 ].AutoDrawInternalData = true; + m_inputPorts[ 1 ].AutoDrawInternalData = true; + m_textLabelWidth = 131; + //m_useInternalPortData = true; + m_autoWrapProperties = true; + m_previewShaderGUID = "f6fb4d46bddf29e45a8a3ddfed75d0c0"; + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); + UpdateConnection( inputPortId ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnection( portId ); + } + + public override void DrawProperties() + { + base.DrawProperties(); + if( !m_inputPorts[ 0 ].IsConnected ) + m_inputPorts[ 0 ].FloatInternalData = EditorGUILayoutFloatField( m_inputPorts[ 0 ].Name, m_inputPorts[ 0 ].FloatInternalData ); + if( !m_inputPorts[ 1 ].IsConnected ) + m_inputPorts[ 1 ].FloatInternalData = EditorGUILayoutFloatField( m_inputPorts[ 1 ].Name, m_inputPorts[ 1 ].FloatInternalData ); + m_useUnityBranch = EditorGUILayoutToggle( UseUnityBranchesStr, m_useUnityBranch ); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + UpdateConnection( portId ); + } + + //void TestMainInputDataType() + //{ + // WirePortDataType newType = WirePortDataType.FLOAT; + // if ( m_inputPorts[ 0 ].IsConnected && UIUtils.GetPriority( m_inputPorts[ 0 ].DataType ) > UIUtils.GetPriority( newType ) ) + // { + // newType = m_inputPorts[ 0 ].DataType; + // } + + // if ( m_inputPorts[ 1 ].IsConnected && ( UIUtils.GetPriority( m_inputPorts[ 1 ].DataType ) > UIUtils.GetPriority( newType ) ) ) + // { + // newType = m_inputPorts[ 1 ].DataType; + // } + + // m_inputMainDataType = newType; + //} + + void TestMainOutputDataType() + { + WirePortDataType newType = WirePortDataType.FLOAT; + for( int i = 2; i < 5; i++ ) + { + if( m_inputPorts[ i ].IsConnected && ( UIUtils.GetPriority( m_inputPorts[ i ].DataType ) > UIUtils.GetPriority( newType ) ) ) + { + newType = m_inputPorts[ i ].DataType; + } + } + + if( newType != m_outputMainDataType ) + { + m_outputMainDataType = newType; + } + m_outputPorts[ 0 ].ChangeType( m_outputMainDataType, false ); + } + + public void UpdateConnection( int portId ) + { + m_inputPorts[ portId ].MatchPortToConnection(); + switch( portId ) + { + //case 0: + //case 1: + //{ + // TestMainInputDataType(); + //} + //break; + case 2: + case 3: + case 4: + { + TestMainOutputDataType(); + } + break; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string AValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector); + string BValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + m_results[ 0 ] = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, m_outputMainDataType, ignoreLocalvar, true ); + m_results[ 1 ] = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, m_outputMainDataType, ignoreLocalvar, true ); + m_results[ 2 ] = m_inputPorts[ 4 ].GenerateShaderForOutput( ref dataCollector, m_outputMainDataType, ignoreLocalvar, true ); + + string localVarName = "ifLocalVar" + OutputId; + string localVarDec = string.Format( "{0} {1} = 0;", UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ), localVarName ); + + bool lequal = false; + bool greater = false; + bool lesser = false; + bool gequal = false; + bool equal = false; + bool nequal = false; + bool welse = false; + bool midCon = false; + + if( m_inputPorts[ 2 ].IsConnected ) + { + greater = true; + } + + if( m_inputPorts[ 4 ].IsConnected ) + { + lesser = true; + } + + if( greater && m_inputPorts[ 2 ].GetOutputConnection() == m_inputPorts[ 3 ].GetOutputConnection() ) + { + gequal = true; + } + + if( lesser && m_inputPorts[ 4 ].GetOutputConnection() == m_inputPorts[ 3 ].GetOutputConnection() ) + { + lequal = true; + } + + if( m_inputPorts[ 2 ].GetOutputConnection() == m_inputPorts[ 4 ].GetOutputConnection() ) + { + if( m_inputPorts[ 3 ].IsConnected ) + equal = true; + else if( m_inputPorts[ 2 ].IsConnected ) + nequal = true; + } + + if( m_inputPorts[ 3 ].IsConnected ) + { + midCon = true; + + if( greater && lesser ) + welse = true; + } + + dataCollector.AddLocalVariable( UniqueId, localVarDec, true ); + if ( m_useUnityBranch && !( lequal && gequal ) && !( !greater && !midCon && !lesser ) ) + dataCollector.AddLocalVariable( UniqueId, UnityBranchStr, true ); + + if( lequal && gequal ) // all equal + { + dataCollector.AddLocalVariable( UniqueId, string.Format( "{0} = {1};", localVarName, m_results[ 1 ] ), true ); + } + else if( !lequal && gequal ) // greater or equal + { + dataCollector.AddLocalVariable( UniqueId, string.Format( IfOps[ 3 ], AValue, BValue ), true ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 0 ] ), true ); + + if( welse ) + { + dataCollector.AddLocalVariable( UniqueId, "else", true ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 2 ] ), true ); + } + } + else if( lequal && !gequal )// lesser or equal + { + dataCollector.AddLocalVariable( UniqueId, string.Format( IfOps[ 4 ], AValue, BValue ), true ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 2 ] ), true ); + + if( welse ) + { + dataCollector.AddLocalVariable( UniqueId, "else", true ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 0 ] ), true ); + } + } + else if( nequal )// not equal + { + dataCollector.AddLocalVariable( UniqueId, string.Format( IfOps[ 5 ], AValue, BValue ), true ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 0 ] ), true ); + } + else if( equal )// equal + { + dataCollector.AddLocalVariable( UniqueId, string.Format( IfOps[ 1 ], AValue, BValue ), true ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 1 ] ), true ); + + if( welse ) + { + dataCollector.AddLocalVariable( UniqueId, "else", true ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 0 ] ), true ); + } + } + else if( lesser && !midCon && !greater ) // lesser + { + dataCollector.AddLocalVariable( UniqueId, string.Format( IfOps[ 2 ], AValue, BValue ), true ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 2 ] ), true ); + } + else if( greater && !midCon && !lesser ) // greater + { + dataCollector.AddLocalVariable( UniqueId, string.Format( IfOps[ 0 ], AValue, BValue ), true ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 0 ] ), true ); + } + else if( !greater && !midCon && !lesser ) // none + { + //dataCollector.AddLocalVariable( UniqueId, localVarDec ); + } + else // all different + { + bool ifStarted = false; + if( greater ) + { + dataCollector.AddLocalVariable( UniqueId, string.Format( IfOps[ 0 ], AValue, BValue ), true ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 0 ] ), true ); + ifStarted = true; + } + + if( midCon ) + { + dataCollector.AddLocalVariable( UniqueId, ( ifStarted ? "else " : string.Empty ) +string.Format( IfOps[ 1 ], AValue, BValue ), true ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 1 ] ), true ); + ifStarted = true; + } + + if( lesser ) + { + dataCollector.AddLocalVariable( UniqueId, "else " + string.Format( IfOps[ 2 ], AValue, BValue ), true ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "\t{0} = {1};", localVarName, m_results[ 2 ] ), true ); + } + } + + m_outputPorts[ 0 ].SetLocalValue( localVarName, dataCollector.PortCategory ); + return localVarName; + } + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 4103 ) + { + m_useUnityBranch = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_useUnityBranch ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs.meta new file mode 100644 index 00000000..125dc616 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3deb719c04d269e49bcd2a2c365da6fb +timeCreated: 1486405023 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/ConditionalIfNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/FlipNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/FlipNode.cs new file mode 100644 index 00000000..f479074e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/FlipNode.cs @@ -0,0 +1,208 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Flip", "Vector Operators", "Flip value sign on specific channels from vectors or color components.", tags: "invert sign" )] + public sealed class FlipNode : ParentNode + { + [SerializeField] + private bool[] m_selection = { true, true, true, true }; + + [SerializeField] + private string[] m_labels; + + private static readonly int _Flip = Shader.PropertyToID( "_Flip" ); + private static readonly int _Count = Shader.PropertyToID( "_Count" ); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT4, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); + + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + + m_useInternalPortData = true; + m_autoWrapProperties = true; + m_selectedLocation = PreviewLocation.TopCenter; + m_labels = new string[] { "X", "Y", "Z", "W" }; + m_previewShaderGUID = "99b235eb03070cd4ab7470cda5a77e2d"; + SetAdditonalTitleText( "Value( XYZW )" ); + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + var dataType = m_inputPorts[ 0 ].DataType; + var flip = new Vector4( 0, 0, 0, 0 ); + int count = 1; + + flip.x = m_selection[ 0 ] ? 1 : 0; + if ( dataType >= WirePortDataType.FLOAT2 ) + { + flip.y = m_selection[ 1 ] ? 1 : 0; + count++; + } + if ( dataType >= WirePortDataType.FLOAT3 ) + { + flip.z = m_selection[ 2 ] ? 1 : 0; + count++; + } + if ( dataType == WirePortDataType.FLOAT4 || dataType == WirePortDataType.COLOR ) + { + flip.w = m_selection[ 3 ] ? 1 : 0; + count++; + } + + PreviewMaterial.SetVector( _Flip, flip ); + PreviewMaterial.SetInt( _Count, count ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + UpdateTitle(); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + UpdateTitle(); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + UpdateTitle(); + } + + private void UpdateTitle() + { + var dataType = m_inputPorts[ 0 ].DataType; + var additionalText = ( m_selection[ 0 ] ? "1" : "0" ); + if ( dataType >= WirePortDataType.FLOAT2 ) + { + additionalText += ", " + ( m_selection[ 1 ] ? "1" : "0" ); + } + if ( dataType >= WirePortDataType.FLOAT3 ) + { + additionalText += ", " + ( m_selection[ 2 ] ? "1" : "0" ); + } + if ( ( dataType == WirePortDataType.FLOAT4 || dataType == WirePortDataType.COLOR ) ) + { + additionalText += ", " + ( m_selection[ 3 ] ? "1" : "0" ); + } + SetAdditonalTitleText( ( additionalText.Length > 0 ) ? "Value( " + additionalText + " )" : string.Empty ); + } + + public override void DrawProperties() + { + base.DrawProperties(); + + EditorGUILayout.BeginVertical(); + + int count = 0; + switch ( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.FLOAT4: + case WirePortDataType.OBJECT: + case WirePortDataType.COLOR: count = 4; break; + case WirePortDataType.FLOAT3: count = 3; break; + case WirePortDataType.FLOAT2: count = 2; break; + case WirePortDataType.FLOAT: + case WirePortDataType.INT: count = 1; break; + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: break; + } + + if ( count > 0 ) + { + for ( int i = 0; i < count; i++ ) + { + m_selection[ i ] = EditorGUILayoutToggleLeft( m_labels[ i ], m_selection[ i ] ); + m_labels[ i ] = UIUtils.GetComponentForPosition( i, m_inputPorts[ 0 ].DataType ).ToUpper(); + } + } + + EditorGUILayout.EndVertical(); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + { + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + string inputValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string outputType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + var dataType = m_inputPorts[ 0 ].DataType; + string flip = outputType + "( " + ( m_selection[ 0 ] ? "1" : "0" ); + + if ( dataType >= WirePortDataType.FLOAT2 ) + { + flip += ", " + ( m_selection[ 1 ] ? "1" : "0" ); + } + if ( dataType >= WirePortDataType.FLOAT3 ) + { + flip += ", " + ( m_selection[ 2 ] ? "1" : "0" ); + } + if ( ( dataType == WirePortDataType.FLOAT4 || dataType == WirePortDataType.COLOR ) ) + { + flip += ", " + ( m_selection[ 3 ] ? "1" : "0" ); + } + flip += " )"; + + string result = string.Format( "( ( {0} * -2 + 1 ) * {1} )", flip, inputValue ); + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + + public string GetComponentForPosition( int i ) + { + switch ( i ) + { + case 0: return ( ( m_outputPorts[ 0 ].DataType == WirePortDataType.COLOR ) ? "r" : "x" ); + case 1: return ( ( m_outputPorts[ 0 ].DataType == WirePortDataType.COLOR ) ? "g" : "y" ); + case 2: return ( ( m_outputPorts[ 0 ].DataType == WirePortDataType.COLOR ) ? "b" : "z" ); + case 3: return ( ( m_outputPorts[ 0 ].DataType == WirePortDataType.COLOR ) ? "a" : "w" ); + } + return string.Empty; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + for ( int i = 0; i < 4; i++ ) + { + m_selection[ i ] = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + UpdateTitle(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + for ( int i = 0; i < 4; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_selection[ i ] ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/FlipNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/FlipNode.cs.meta new file mode 100644 index 00000000..49a3f3ec --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/FlipNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 9722ae49d51aa8348b5c9226d0f1867e +timeCreated: 1588859716 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/FlipNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsInfiniteNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsInfiniteNode.cs new file mode 100644 index 00000000..99dbc971 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsInfiniteNode.cs @@ -0,0 +1,47 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Is Infinite", "Logical Operators", "Determines whether or not a scalar or each vector component is infinite.", tags: "inf isinf" )] + public sealed class IsInfiniteNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_previewShaderGUID = "6fd9c9300bf239b4487f397b5117de15"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + var inputValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + var outputType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + string result = string.Format( "( isinf( {1} ) ? ( {0} )1 : ( {0} )0 )", outputType, inputValue ); + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsInfiniteNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsInfiniteNode.cs.meta new file mode 100644 index 00000000..c62e611f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsInfiniteNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 0d206220c48e0854e975e8f9cd58bced +timeCreated: 1588859716 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsInfiniteNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsNaNNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsNaNNode.cs new file mode 100644 index 00000000..77a1c2c1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsNaNNode.cs @@ -0,0 +1,47 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Is NaN", "Logical Operators", "Determines whether or not a scalar or each vector component is Not-a-Number.", tags: "isnan nan" )] + public sealed class IsNaNNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_previewShaderGUID = "250e32a6bbf31e148b1d6c402bbba693"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + var inputValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + var outputType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + string result = string.Format( "( isnan( {1} ) ? ( {0} )1 : ( {0} )0 )", outputType, inputValue ); + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsNaNNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsNaNNode.cs.meta new file mode 100644 index 00000000..79c2aca4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsNaNNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7346d6be551d22343be2d93de83db909 +timeCreated: 1588859716 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/IsNaNNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs new file mode 100644 index 00000000..23650365 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs @@ -0,0 +1,133 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Keyword Switch", "Logical Operators", "Attributes a value according to the existance of a selected keyword", Deprecated = true, DeprecatedAlternativeType = typeof(StaticSwitch), DeprecatedAlternative = "Static Switch" )] + public sealed class KeywordSwitchNode : ParentNode + { + private const string KeywordStr = "Keyword"; + private const string CustomStr = "Custom"; + + [SerializeField] + private string m_currentKeyword = string.Empty; + + [SerializeField] + private int m_currentKeywordId = 0; + + [SerializeField] + private WirePortDataType m_mainPortType = WirePortDataType.FLOAT; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "True" ); + AddInputPort( WirePortDataType.FLOAT, false, "False" ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_textLabelWidth = 65; + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_currentKeywordId = EditorGUILayoutPopup( KeywordStr, m_currentKeywordId, UIUtils.AvailableKeywords ); + if ( EditorGUI.EndChangeCheck() ) + { + if ( m_currentKeywordId != 0 ) + { + m_currentKeyword = UIUtils.AvailableKeywords[ m_currentKeywordId ]; + } + } + if ( m_currentKeywordId == 0 ) + { + m_currentKeyword = EditorGUILayoutTextField( CustomStr, m_currentKeyword ); + } + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnected( portId ); + } + + public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); + UpdateConnected( portId ); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + UpdateDisconnected( portId ); + } + + void UpdateConnected( int portId ) + { + m_inputPorts[ portId ].MatchPortToConnection(); + int otherPortId = ( portId + 1 ) % 2; + if ( m_inputPorts[ otherPortId ].IsConnected ) + { + m_mainPortType = ( UIUtils.GetPriority( m_inputPorts[ portId ].DataType ) > UIUtils.GetPriority( m_inputPorts[ otherPortId ].DataType ) ) ? + m_inputPorts[ portId ].DataType : + m_inputPorts[ otherPortId ].DataType; + } + else + { + m_mainPortType = m_inputPorts[ portId ].DataType; + m_inputPorts[ otherPortId ].ChangeType( m_mainPortType, false ); + } + m_outputPorts[ 0 ].ChangeType( m_mainPortType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string trueCode = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string falseCode = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + string localVarName = "simpleKeywordVar"+OutputId; + string outType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + dataCollector.AddLocalVariable( UniqueId, "#ifdef " + m_currentKeyword, true ); + dataCollector.AddLocalVariable( UniqueId, outType + " " + localVarName + " = " + trueCode + ";", true ); + dataCollector.AddLocalVariable( UniqueId, "#else", true ); + dataCollector.AddLocalVariable( UniqueId, outType + " " + localVarName + " = " + falseCode + ";", true ); + dataCollector.AddLocalVariable( UniqueId, "#endif", true ); + m_outputPorts[ 0 ].SetLocalValue( localVarName, dataCollector.PortCategory ); + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + void UpdateDisconnected( int portId ) + { + int otherPortId = ( portId + 1 ) % 2; + if ( m_inputPorts[ otherPortId ].IsConnected ) + { + m_mainPortType = m_inputPorts[ otherPortId ].DataType; + m_inputPorts[ portId ].ChangeType( m_mainPortType, false ); + } + m_outputPorts[ 0 ].ChangeType( m_mainPortType, false ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_currentKeyword = GetCurrentParam( ref nodeParams ); + m_currentKeywordId = UIUtils.GetKeywordId( m_currentKeyword ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentKeyword ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs.meta new file mode 100644 index 00000000..6cf993c0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 04eb50f45d1416e4bb61902a49f06d58 +timeCreated: 1500648134 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/KeywordSwitchNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NandNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NandNode.cs new file mode 100644 index 00000000..76319d49 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NandNode.cs @@ -0,0 +1,76 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Nand", "Logical Operators", "Returns 1 if both the inputs A and B are 0.", tags: "not and" )] + public sealed class NandNode : ParentNode + { + [UnityEngine.SerializeField] + private WirePortDataType m_mainDataType = WirePortDataType.FLOAT; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "A" ); + AddInputPort( WirePortDataType.FLOAT, false, "B" ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_previewShaderGUID = "04fb2bacb454a424d8cfeff7d95cca52"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnection( portId ); + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); + UpdateConnection( inputPortId ); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + UpdateConnection( portId ); + } + + void UpdateConnection( int portId ) + { + WirePortDataType type1 = WirePortDataType.FLOAT; + if ( m_inputPorts[ 0 ].IsConnected ) + type1 = m_inputPorts[ 0 ].GetOutputConnection( 0 ).DataType; + + WirePortDataType type2 = WirePortDataType.FLOAT; + if ( m_inputPorts[ 1 ].IsConnected ) + type2 = m_inputPorts[ 1 ].GetOutputConnection( 0 ).DataType; + + m_mainDataType = UIUtils.GetPriority( type1 ) > UIUtils.GetPriority( type2 ) ? type1 : type2; + + if ( !m_inputPorts[ 0 ].IsConnected && !m_inputPorts[ 1 ].IsConnected && m_inputPorts[ 2 ].IsConnected ) + m_mainDataType = m_inputPorts[ 2 ].GetOutputConnection( 0 ).DataType; + + m_inputPorts[ 0 ].ChangeType( m_mainDataType, false ); + m_inputPorts[ 1 ].ChangeType( m_mainDataType, false ); + m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + var A = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + var B = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + var outputType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + string result = string.Format( "( ( {0} )( !{1} && !{2} ) )", outputType, A, B ); + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NandNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NandNode.cs.meta new file mode 100644 index 00000000..d226f76b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NandNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1ca326826e7c3414f82056dd097fbf35 +timeCreated: 1588859716 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NandNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NotNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NotNode.cs new file mode 100644 index 00000000..2645311e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NotNode.cs @@ -0,0 +1,47 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Not", "Logical Operators", "...", tags: "" )] + public sealed class NotNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_previewShaderGUID = "53b1c286459bd074ea26bad298660f98"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + var inputValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + var outputType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + string result = string.Format( "( ( {0} )!{1} )", outputType, inputValue ); + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NotNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NotNode.cs.meta new file mode 100644 index 00000000..ecd7cc2a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NotNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: beb757014281d134bbcc66dd2d09bea5 +timeCreated: 1588859716 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/NotNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs new file mode 100644 index 00000000..dea9b145 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs @@ -0,0 +1,35 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Compare (A == B) +// Donated by The Four Headed Cat - @fourheadedcat + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Compare (A = B)", "Logical Operators", "Check if A is equal to B. If true return value of True else return value of False", null, KeyCode.None, true, true, "Compare", typeof( Compare ), "The Four Headed Cat - @fourheadedcat" )] + public sealed class TFHCCompareEqual : TFHCStub + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 0 ].Name = "A"; + m_inputPorts[ 1 ].Name = "B"; + AddInputPort( WirePortDataType.FLOAT, false, "True" ); + AddInputPort( WirePortDataType.FLOAT, false, "False" ); + m_textLabelWidth = 100; + m_useInternalPortData = true; + m_previewShaderGUID = "6904de6cf8c08e7439672390b425ab50"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + GetInputData( ref dataCollector, ignoreLocalvar ); + string strout = "(( " + m_inputDataPort0 + " == " + m_inputDataPort1 + " ) ? " + m_inputDataPort2 + " : " + m_inputDataPort3 + " )"; + return CreateOutputLocalVariable( 0, strout, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs.meta new file mode 100644 index 00000000..16d052a2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d6d04219b3c5c5a4282aa9a763b9ad3c +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareEqual.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs new file mode 100644 index 00000000..3d6db6a0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs @@ -0,0 +1,36 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Compare (A > B) +// Donated by The Four Headed Cat - @fourheadedcat + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes("Compare (A > B)", "Logical Operators", "Check if A is greater than B. If true return value of True else return value of False", null, KeyCode.None, true, true, "Compare", typeof( Compare ), "The Four Headed Cat - @fourheadedcat" )] + public sealed class TFHCCompareGreater : TFHCStub + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 0 ].Name = "A"; + m_inputPorts[ 1 ].Name = "B"; + AddInputPort( WirePortDataType.FLOAT, false, "True" ); + AddInputPort( WirePortDataType.FLOAT, false, "False" ); + m_textLabelWidth = 100; + m_useInternalPortData = true; + m_previewShaderGUID = "363192dbd019ad2478f2fe6c277b7e48"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + GetInputData( ref dataCollector, ignoreLocalvar ); + string strout = "(( " + m_inputDataPort0 + " > " + m_inputDataPort1 + " ) ? " + m_inputDataPort2 + " : " + m_inputDataPort3 + " )"; + //Debug.Log(strout); + return CreateOutputLocalVariable( 0, strout, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs.meta new file mode 100644 index 00000000..77b46cb4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ff04934859005cd41ac644f2a9349e8b +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreater.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs new file mode 100644 index 00000000..5dc0fe6f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs @@ -0,0 +1,37 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Compare (A >= B) +// Donated by The Four Headed Cat - @fourheadedcat + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes("Compare (A \u2265 B)", "Logical Operators", "Check if A is greater than or equal to B. If true return value of True else return value of False", null, KeyCode.None, true, true, "Compare", typeof(Compare), "The Four Headed Cat - @fourheadedcat" )] + public sealed class TFHCCompareGreaterEqual : TFHCStub + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 0 ].Name = "A"; + m_inputPorts[ 1 ].Name = "B"; + AddInputPort( WirePortDataType.FLOAT, false, "True" ); + AddInputPort( WirePortDataType.FLOAT, false, "False" ); + m_textLabelWidth = 100; + m_useInternalPortData = true; + m_previewShaderGUID = "f4ff76282a117c2429a1bcd8ba3a9112"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + GetInputData( ref dataCollector, ignoreLocalvar ); + string strout = "(( " + m_inputDataPort0 + " >= " + m_inputDataPort1 + " ) ? " + m_inputDataPort2 + " : " + m_inputDataPort3 + " )"; + //Debug.Log(strout); + return CreateOutputLocalVariable( 0, strout, ref dataCollector ); + + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs.meta new file mode 100644 index 00000000..7f89c520 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b2792c240940c3349bdef401f5683f70 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareGreaterEqual.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs new file mode 100644 index 00000000..8f989472 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs @@ -0,0 +1,35 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Compare (A < B) +// Donated by The Four Headed Cat - @fourheadedcat + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes("Compare (A < B)", "Logical Operators", "Check if A is lower than B. If true return value of True else return value of False", null, KeyCode.None, true, true, "Compare", typeof( Compare ), "The Four Headed Cat - @fourheadedcat" )] + public sealed class TFHCCompareLower : TFHCStub + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 0 ].Name = "A"; + m_inputPorts[ 1 ].Name = "B"; + AddInputPort( WirePortDataType.FLOAT, false, "True" ); + AddInputPort( WirePortDataType.FLOAT, false, "False" ); + m_textLabelWidth = 100; + m_useInternalPortData = true; + m_previewShaderGUID = "8024509244392ed44b37c28473e66a8a"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + GetInputData( ref dataCollector, ignoreLocalvar ); + string strout = "(( " + m_inputDataPort0 + " < " + m_inputDataPort1 + " ) ? " + m_inputDataPort2 + " : " + m_inputDataPort3 + " )"; + return CreateOutputLocalVariable( 0, strout, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs.meta new file mode 100644 index 00000000..8f365b62 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1a70dcf76fe65a64ca70400d6d08563d +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLower.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs new file mode 100644 index 00000000..d9bcafde --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs @@ -0,0 +1,35 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Compare (A <= B) +// Donated by The Four Headed Cat - @fourheadedcat + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes("Compare (A \u2264 B)", "Logical Operators", "Check if A is lower than or equal to B. If true return value of True else return value of False", null, KeyCode.None, true, true, "Compare", typeof( Compare ), "The Four Headed Cat - @fourheadedcat" )] + public sealed class TFHCCompareLowerEqual : TFHCStub + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 0 ].Name = "A"; + m_inputPorts[ 1 ].Name = "B"; + AddInputPort( WirePortDataType.FLOAT, false, "True" ); + AddInputPort( WirePortDataType.FLOAT, false, "False" ); + m_textLabelWidth = 100; + m_useInternalPortData = true; + m_previewShaderGUID = "9a3e17508793b9d42b1efaaf5bcd2554"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + GetInputData( ref dataCollector, ignoreLocalvar ); + string strout = "(( " + m_inputDataPort0 + " <= " + m_inputDataPort1 + " ) ? " + m_inputDataPort2 + " : " + m_inputDataPort3 + " )"; + return CreateOutputLocalVariable( 0, strout, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs.meta new file mode 100644 index 00000000..fca11e83 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e1e66ddf48770134b806dd1f397e4ac3 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareLowerEqual.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs new file mode 100644 index 00000000..98ec281b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs @@ -0,0 +1,35 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Compare (A != B) +// Donated by The Four Headed Cat - @fourheadedcat + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes("Compare (A \u2260 B)", "Logical Operators", "Check if A is not equal to B. If true return value of True else return value of False", null, KeyCode.None, true, true, "Compare", typeof( Compare ), "The Four Headed Cat - @fourheadedcat" )] + public sealed class TFHCCompareNotEqual : TFHCStub + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 0 ].Name = "A"; + m_inputPorts[ 1 ].Name = "B"; + AddInputPort( WirePortDataType.FLOAT, false, "True" ); + AddInputPort( WirePortDataType.FLOAT, false, "False" ); + m_textLabelWidth = 100; + m_useInternalPortData = true; + m_previewShaderGUID = "75f433376eef1ad4a881d99124e08008"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + GetInputData( ref dataCollector, ignoreLocalvar ); + string strout = "(( " + m_inputDataPort0 + " != " + m_inputDataPort1 + " ) ? " + m_inputDataPort2 + " : " + m_inputDataPort3 + " )"; + return CreateOutputLocalVariable( 0, strout, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs.meta new file mode 100644 index 00000000..7376146f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 48f885e2f5fa775409b9f50be6aaf80a +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareNotEqual.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs new file mode 100644 index 00000000..efd0d409 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs @@ -0,0 +1,122 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Compare With Range +// Donated by The Four Headed Cat - @fourheadedcat + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Compare With Range", "Logical Operators", "Check if A is in the range between Range Min and Range Max. If true return value of True else return value of False", null, KeyCode.None, true, false, null, null, "The Four Headed Cat - @fourheadedcat" )] + public sealed class TFHCCompareWithRange : DynamicTypeNode + { + private WirePortDataType m_mainInputType = WirePortDataType.FLOAT; + private WirePortDataType m_mainOutputType = WirePortDataType.FLOAT; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 0 ].Name = "Value"; + m_inputPorts[ 1 ].Name = "Range Min"; + AddInputPort( WirePortDataType.FLOAT, false, "Range Max" ); + AddInputPort( WirePortDataType.FLOAT, false, "True" ); + AddInputPort( WirePortDataType.FLOAT, false, "False" ); + m_textLabelWidth = 100; + m_useInternalPortData = true; + m_previewShaderGUID = "127d114eed178d7409f900134a6c00d1"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + UpdateConnections( portId ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + UpdateConnections( outputPortId ); + } + + public override void OnInputPortDisconnected( int portId ) + { + if ( portId < 3 ) + { + if ( portId > 0 ) + { + m_inputPorts[ portId ].ChangeType( m_mainInputType, false ); + } + } + else + { + int otherPortId = ( portId == 3 ) ? 4 : 3; + if ( m_inputPorts[ otherPortId ].IsConnected ) + { + m_mainOutputType = m_inputPorts[ otherPortId ].DataType; + m_inputPorts[ portId ].ChangeType( m_mainOutputType, false ); + m_outputPorts[ 0 ].ChangeType( m_mainOutputType, false ); + } + } + } + + void UpdateConnections( int portId ) + { + m_inputPorts[ portId ].MatchPortToConnection(); + int otherPortId = 0; + WirePortDataType otherPortType = WirePortDataType.FLOAT; + if ( portId < 3 ) + { + if ( portId == 0 ) + { + m_mainInputType = m_inputPorts[ 0 ].DataType; + for ( int i = 1; i < 3; i++ ) + { + if ( !m_inputPorts[ i ].IsConnected ) + { + m_inputPorts[ i ].ChangeType( m_mainInputType, false ); + } + } + } + } + else + { + otherPortId = ( portId == 3 ) ? 4 : 3; + otherPortType = m_inputPorts[ otherPortId ].IsConnected ? m_inputPorts[ otherPortId ].DataType : WirePortDataType.FLOAT; + m_mainOutputType = UIUtils.GetPriority( m_inputPorts[ portId ].DataType ) > UIUtils.GetPriority( otherPortType ) ? m_inputPorts[ portId ].DataType : otherPortType; + + m_outputPorts[ 0 ].ChangeType( m_mainOutputType, false ); + + if ( !m_inputPorts[ otherPortId ].IsConnected ) + { + m_inputPorts[ otherPortId ].ChangeType( m_mainOutputType, false ); + } + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + //Conditional Operator ?: has some shenanigans + //If the first operand is of type bool, one of the following must hold for the second and third operands: + //Both operands have compatible structure types. + //Both operands are scalars with numeric or bool type. + //Both operands are vectors with numeric or bool type, where the two vectors are of the same size, which is less than or equal to four. + //If the first operand is a packed vector of bool, then the conditional selection is performed on an elementwise basis.Both the second and third operands must be numeric vectors of the same size as the first operand. + WirePortDataType compatibleInputType = m_mainInputType; + if ( m_mainInputType != WirePortDataType.FLOAT && m_mainInputType != WirePortDataType.INT && m_mainInputType != m_mainOutputType ) + { + compatibleInputType = m_mainOutputType; + } + + //Check if VALUE is in range between MIN and MAX. If true return VALUE IF TRUE else VALUE IF FALSE" + string a = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, compatibleInputType, ignoreLocalvar, true ); + string b = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, compatibleInputType, ignoreLocalvar, true ); + string c = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, compatibleInputType, ignoreLocalvar, true ); + string d = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, m_mainOutputType, ignoreLocalvar, true ); + string e = m_inputPorts[ 4 ].GenerateShaderForOutput( ref dataCollector, m_mainOutputType, ignoreLocalvar, true ); + string strout = "(( " + a + " >= " + b + " && " + a + " <= " + c + " ) ? " + d + " : " + e + " )"; + //Debug.Log(strout); + return CreateOutputLocalVariable( 0, strout, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs.meta new file mode 100644 index 00000000..a2c2a676 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e7d30ad11b781804ebd54834781a32d9 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCCompareWithRange.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs new file mode 100644 index 00000000..7ed72724 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs @@ -0,0 +1,133 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node If +// Donated by The Four Headed Cat - @fourheadedcat + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "If [Community]", "Logical Operators", "Compare A with B. If A is greater than B output the value of A > B port. If A is equal to B output the value of A == B port. If A is lower than B output the value of A < B port. Equal Threshold parameter will be used to check A == B adding and subtracting this value to A.", null, KeyCode.None, true, false, null, null, "The Four Headed Cat - @fourheadedcat" )] + public sealed class TFHCIf : ParentNode + { + private WirePortDataType m_inputMainDataType = WirePortDataType.FLOAT; + private WirePortDataType m_outputMainDataType = WirePortDataType.FLOAT; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "A" ); + AddInputPort( WirePortDataType.FLOAT, false, "B" ); + AddInputPort( WirePortDataType.FLOAT, false, "A > B" ); + AddInputPort( WirePortDataType.FLOAT, false, "A == B" ); + AddInputPort( WirePortDataType.FLOAT, false, "A < B" ); + AddInputPort( WirePortDataType.FLOAT, false, "Equal Threshold" ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_textLabelWidth = 110; + m_useInternalPortData = true; + m_previewShaderGUID = "5c7bc7e3cab81da499e4864ace0d86c5"; + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); + UpdateConnection( inputPortId ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnection( portId ); + } + + public override void OnInputPortDisconnected( int portId ) + { + UpdateConnection( portId ); + } + + void TestMainInputDataType() + { + WirePortDataType newType = WirePortDataType.FLOAT; + if( m_inputPorts[ 0 ].IsConnected && UIUtils.GetPriority( m_inputPorts[ 0 ].DataType ) > UIUtils.GetPriority( newType ) ) + { + newType = m_inputPorts[ 0 ].DataType; + } + + if( m_inputPorts[ 1 ].IsConnected && ( UIUtils.GetPriority( m_inputPorts[ 1 ].DataType ) > UIUtils.GetPriority( newType ) ) ) + { + newType = m_inputPorts[ 1 ].DataType; + } + + if( m_inputPorts[ 5 ].IsConnected && ( UIUtils.GetPriority( m_inputPorts[ 5 ].DataType ) > UIUtils.GetPriority( newType ) ) ) + { + newType = m_inputPorts[ 5 ].DataType; + } + + m_inputMainDataType = newType; + } + + void TestMainOutputDataType() + { + WirePortDataType newType = WirePortDataType.FLOAT; + for( int i = 2; i < 5; i++ ) + { + if( m_inputPorts[ i ].IsConnected && ( UIUtils.GetPriority( m_inputPorts[ i ].DataType ) > UIUtils.GetPriority( newType ) ) ) + { + newType = m_inputPorts[ i ].DataType; + } + } + + if( newType != m_outputMainDataType ) + { + m_outputMainDataType = newType; + m_outputPorts[ 0 ].ChangeType( m_outputMainDataType, false ); + } + } + + public void UpdateConnection( int portId ) + { + m_inputPorts[ portId ].MatchPortToConnection(); + switch( portId ) + { + case 0: + case 1: + case 5: + { + TestMainInputDataType(); + } + break; + case 2: + case 3: + case 4: + { + TestMainOutputDataType(); + } + break; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + string a = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, m_inputMainDataType, ignoreLocalvar, true ); + string b = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, m_inputMainDataType, ignoreLocalvar, true ); + string r1 = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, m_outputMainDataType, ignoreLocalvar, true ); + string r2 = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, m_outputMainDataType, ignoreLocalvar, true ); + string r3 = m_inputPorts[ 4 ].GenerateShaderForOutput( ref dataCollector, m_outputMainDataType, ignoreLocalvar, true ); + string tr = m_inputPorts[ 5 ].GenerateShaderForOutput( ref dataCollector, m_inputMainDataType, ignoreLocalvar, true ); + + // No Equal Threshold parameter + //(a > b ? r1 : a == b ? r2 : r3 ) + //string strout = " ( " + a + " > " + b + " ? " + r1 + " : " + a + " == " + b + " ? " + r2 + " : " + r3 + " ) "; + + // With Equal Threshold parameter + // ( a - tr > b ? r1 : a - tr <= b && a + tr >= b ? r2 : r3 ) + string strout = " ( " + a + " - " + tr + " > " + b + " ? " + r1 + " : " + a + " - " + tr + " <= " + b + " && " + a + " + " + tr + " >= " + b + " ? " + r2 + " : " + r3 + " ) "; + + //Debug.Log( strout ); + return CreateOutputLocalVariable( 0, strout, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs.meta new file mode 100644 index 00000000..5f714311 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1a3d561a45c21114c99f52c5432b25e9 +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCIf.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs new file mode 100644 index 00000000..38dd4052 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs @@ -0,0 +1,103 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + + +namespace AmplifyShaderEditor +{ + [System.Serializable] + public class TFHCStub : DynamicTypeNode + { + protected WirePortDataType m_mainInputType = WirePortDataType.FLOAT; + protected WirePortDataType m_mainOutputType = WirePortDataType.FLOAT; + protected string m_inputDataPort0 = string.Empty; + protected string m_inputDataPort1 = string.Empty; + protected string m_inputDataPort2 = string.Empty; + protected string m_inputDataPort3 = string.Empty; + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + UpdateConnections( portId ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + UpdateConnections( outputPortId ); + } + + public override void OnInputPortDisconnected( int portId ) + { + int otherPortId = 0; + if ( portId < 2 ) + { + otherPortId = ( portId == 0 ) ? 1 : 0; + if ( m_inputPorts[ otherPortId ].IsConnected ) + { + m_mainInputType = m_inputPorts[ otherPortId ].DataType; + m_inputPorts[ portId ].ChangeType( m_mainInputType, false ); + } + } + else + { + otherPortId = ( portId == 2 ) ? 3 : 2; + if ( m_inputPorts[ otherPortId ].IsConnected ) + { + m_mainOutputType = m_inputPorts[ otherPortId ].DataType; + m_inputPorts[ portId ].ChangeType( m_mainOutputType, false ); + m_outputPorts[ 0 ].ChangeType( m_mainOutputType, false ); + } + } + } + + public void GetInputData( ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + //Conditional Operator ?: has some shenanigans + //If the first operand is of type bool, one of the following must hold for the second and third operands: + //Both operands have compatible structure types. + //Both operands are scalars with numeric or bool type. + //Both operands are vectors with numeric or bool type, where the two vectors are of the same size, which is less than or equal to four. + //If the first operand is a packed vector of bool, then the conditional selection is performed on an elementwise basis.Both the second and third operands must be numeric vectors of the same size as the first operand. + WirePortDataType compatibleInputType = m_mainInputType; + if ( m_mainInputType != WirePortDataType.FLOAT && m_mainInputType != WirePortDataType.INT && m_mainInputType != m_mainOutputType ) + { + compatibleInputType = m_mainOutputType; + } + + m_inputDataPort0 = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, compatibleInputType, ignoreLocalvar, true ); + m_inputDataPort1 = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, compatibleInputType, ignoreLocalvar, true ); + + + m_inputDataPort2 = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, m_mainOutputType, ignoreLocalvar, true ); + m_inputDataPort3 = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, m_mainOutputType, ignoreLocalvar, true ); + } + + void UpdateConnections( int portId ) + { + m_inputPorts[ portId ].MatchPortToConnection(); + int otherPortId = 0; + WirePortDataType otherPortType = WirePortDataType.FLOAT; + if ( portId < 2 ) + { + otherPortId = ( portId == 0 ) ? 1 : 0; + otherPortType = m_inputPorts[ otherPortId ].IsConnected ? m_inputPorts[ otherPortId ].DataType : WirePortDataType.FLOAT; + m_mainInputType = UIUtils.GetPriority( m_inputPorts[ portId ].DataType ) > UIUtils.GetPriority( otherPortType ) ? m_inputPorts[ portId ].DataType : otherPortType; + if ( !m_inputPorts[ otherPortId ].IsConnected ) + { + m_inputPorts[ otherPortId ].ChangeType( m_mainInputType, false ); + } + } + else + { + otherPortId = ( portId == 2 ) ? 3 : 2; + otherPortType = m_inputPorts[ otherPortId ].IsConnected ? m_inputPorts[ otherPortId ].DataType : WirePortDataType.FLOAT; + m_mainOutputType = UIUtils.GetPriority( m_inputPorts[ portId ].DataType ) > UIUtils.GetPriority( otherPortType ) ? m_inputPorts[ portId ].DataType : otherPortType; + + m_outputPorts[ 0 ].ChangeType( m_mainOutputType, false ); + + if ( !m_inputPorts[ otherPortId ].IsConnected ) + { + m_inputPorts[ otherPortId ].ChangeType( m_mainOutputType, false ); + } + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs.meta new file mode 100644 index 00000000..bed8893c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 67238b98f61049c45b496af625863edf +timeCreated: 1481646118 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators/TFHCStub.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master.meta new file mode 100644 index 00000000..e014e2d5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7787d08c0679d324c99a7ca9a1a3e6a4 +folderAsset: yes +timeCreated: 1481126946 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs new file mode 100644 index 00000000..7aa08d96 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs @@ -0,0 +1,140 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class AdditionalDefinesHelper + { + private const string AdditionalDefinesStr = " Additional Defines"; + private const float ShaderKeywordButtonLayoutWidth = 15; + private ParentNode m_currentOwner; + + [SerializeField] + private List m_additionalDefines = new List(); + public List DefineList { get { return m_additionalDefines; } set { m_additionalDefines = value; } } + + [SerializeField] + private List m_outsideDefines = new List(); + public List OutsideList { get { return m_outsideDefines; } set { m_outsideDefines = value; } } + + public void Draw( ParentNode owner ) + { + m_currentOwner = owner; + bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDefines; + NodeUtils.DrawPropertyGroup( ref value, AdditionalDefinesStr, DrawMainBody, DrawButtons ); + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDefines = value; + } + + void DrawButtons() + { + EditorGUILayout.Separator(); + + // Add keyword + if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_additionalDefines.Add( string.Empty ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove keyword + if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + if( m_additionalDefines.Count > 0 ) + { + m_additionalDefines.RemoveAt( m_additionalDefines.Count - 1 ); + EditorGUI.FocusTextInControl( null ); + } + } + } + + void DrawMainBody() + { + EditorGUILayout.Separator(); + int itemCount = m_additionalDefines.Count; + int markedToDelete = -1; + for( int i = 0; i < itemCount; i++ ) + { + EditorGUILayout.BeginHorizontal(); + { + EditorGUI.BeginChangeCheck(); + m_additionalDefines[ i ] = EditorGUILayout.TextField( m_additionalDefines[ i ] ); + if( EditorGUI.EndChangeCheck() ) + { + m_additionalDefines[ i ] = UIUtils.RemoveShaderInvalidCharacters( m_additionalDefines[ i ] ); + } + + // Add new port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_additionalDefines.Insert( i + 1, string.Empty ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + markedToDelete = i; + } + } + EditorGUILayout.EndHorizontal(); + } + + if( markedToDelete > -1 ) + { + if( m_additionalDefines.Count > markedToDelete ) + { + m_additionalDefines.RemoveAt( markedToDelete ); + EditorGUI.FocusTextInControl( null ); + } + } + EditorGUILayout.Separator(); + EditorGUILayout.HelpBox( "Please add your defines without the #define keywords", MessageType.Info ); + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + int count = Convert.ToInt32( nodeParams[ index++ ] ); + for( int i = 0; i < count; i++ ) + { + m_additionalDefines.Add( nodeParams[ index++ ] ); + } + } + + public void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDefines.Count ); + for( int i = 0; i < m_additionalDefines.Count; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDefines[ i ] ); + } + } + + public void AddToDataCollector( ref MasterNodeDataCollector dataCollector ) + { + for( int i = 0; i < m_additionalDefines.Count; i++ ) + { + if( !string.IsNullOrEmpty( m_additionalDefines[ i ] ) ) + dataCollector.AddToDefines( -1, m_additionalDefines[ i ] ); + } + + for( int i = 0; i < m_outsideDefines.Count; i++ ) + { + if( !string.IsNullOrEmpty( m_outsideDefines[ i ] ) ) + dataCollector.AddToDefines( -1, m_outsideDefines[ i ] ); + } + } + + public void Destroy() + { + m_additionalDefines.Clear(); + m_additionalDefines = null; + m_currentOwner = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs.meta new file mode 100644 index 00000000..f3eed3e1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 0801a5994efb46142ad8dcc0fe3c47f8 +timeCreated: 1513252939 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs new file mode 100644 index 00000000..542b586f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs @@ -0,0 +1,154 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class AdditionalIncludesHelper + { + private const string AdditionalIncludesStr = " Additional Includes"; + private const float ShaderKeywordButtonLayoutWidth = 15; + private ParentNode m_currentOwner; + + [SerializeField] + private List m_additionalIncludes = new List(); + public List IncludeList { get { return m_additionalIncludes; } set { m_additionalIncludes = value; } } + + [SerializeField] + private List m_outsideIncludes = new List(); + public List OutsideList { get { return m_outsideIncludes; } set { m_outsideIncludes = value; } } + + public void Draw( ParentNode owner ) + { + m_currentOwner = owner; + bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalIncludes; + NodeUtils.DrawPropertyGroup( ref value, AdditionalIncludesStr, DrawMainBody, DrawButtons ); + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalIncludes = value; + + } + + void DrawButtons() + { + EditorGUILayout.Separator(); + + // Add keyword + if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_additionalIncludes.Add( string.Empty ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove keyword + if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + if( m_additionalIncludes.Count > 0 ) + { + m_additionalIncludes.RemoveAt( m_additionalIncludes.Count - 1 ); + EditorGUI.FocusTextInControl( null ); + } + } + } + + void DrawMainBody() + { + EditorGUILayout.Separator(); + //if( OutsideList != null && OutsideList.Count > 0 ) + //{ + // m_drawElements.Clear(); + // EditorGUI.BeginDisabledGroup( true ); + // int outsideCount = OutsideList.Count; + // for( int i = 0; i < outsideCount; i++ ) + // { + // if( !m_drawElements.Contains( OutsideList[ i ] ) ) + // { + // m_drawElements.Add( OutsideList[ i ] ); + // EditorGUILayout.TextField( OutsideList[ i ] ); + // } + // } + // EditorGUI.EndDisabledGroup(); + // EditorGUILayout.Separator(); + //} + int itemCount = m_additionalIncludes.Count; + int markedToDelete = -1; + for( int i = 0; i < itemCount; i++ ) + { + EditorGUILayout.BeginHorizontal(); + { + EditorGUI.BeginChangeCheck(); + m_additionalIncludes[ i ] = EditorGUILayout.TextField( m_additionalIncludes[ i ] ); + if( EditorGUI.EndChangeCheck() ) + { + m_additionalIncludes[ i ] = UIUtils.RemoveShaderInvalidCharacters( m_additionalIncludes[ i ] ); + } + + // Add new port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_additionalIncludes.Insert( i + 1, string.Empty ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + markedToDelete = i; + } + } + EditorGUILayout.EndHorizontal(); + } + + if( markedToDelete > -1 ) + { + if( m_additionalIncludes.Count > markedToDelete ) + { + m_additionalIncludes.RemoveAt( markedToDelete ); + EditorGUI.FocusTextInControl( null ); + } + } + EditorGUILayout.Separator(); + EditorGUILayout.HelpBox( "Please add your includes without the #include \"\" keywords", MessageType.Info ); + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + int count = Convert.ToInt32( nodeParams[ index++ ] ); + for( int i = 0; i < count; i++ ) + { + m_additionalIncludes.Add( nodeParams[ index++ ] ); + } + } + + public void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalIncludes.Count ); + for( int i = 0; i < m_additionalIncludes.Count; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalIncludes[ i ] ); + } + } + + public void AddToDataCollector( ref MasterNodeDataCollector dataCollector ) + { + for( int i = 0; i < m_additionalIncludes.Count; i++ ) + { + if( !string.IsNullOrEmpty( m_additionalIncludes[ i ] ) ) + dataCollector.AddToIncludes( -1, m_additionalIncludes[ i ] ); + } + + for( int i = 0; i < m_outsideIncludes.Count; i++ ) + { + if( !string.IsNullOrEmpty( m_outsideIncludes[ i ] ) ) + dataCollector.AddToIncludes( -1, m_outsideIncludes[ i ] ); + } + } + + public void Destroy() + { + m_additionalIncludes.Clear(); + m_additionalIncludes = null; + m_currentOwner = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs.meta new file mode 100644 index 00000000..410787e9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 74ff3d342e013f64198aaf767e623962 +timeCreated: 1498123240 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs new file mode 100644 index 00000000..a7e89707 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs @@ -0,0 +1,141 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class AdditionalPragmasHelper + { + private const string AdditionalPragmasStr = " Additional Pragmas"; + private const float ShaderKeywordButtonLayoutWidth = 15; + private ParentNode m_currentOwner; + + [SerializeField] + private List m_additionalPragmas = new List(); + public List PragmaList { get { return m_additionalPragmas; } set { m_additionalPragmas = value; } } + + [SerializeField] + private List m_outsidePragmas = new List(); + public List OutsideList { get { return m_outsidePragmas; } set { m_outsidePragmas = value; } } + + public void Draw( ParentNode owner ) + { + m_currentOwner = owner; + bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalPragmas; + NodeUtils.DrawPropertyGroup( ref value, AdditionalPragmasStr, DrawMainBody, DrawButtons ); + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalPragmas = value; + + } + + void DrawButtons() + { + EditorGUILayout.Separator(); + + // Add keyword + if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_additionalPragmas.Add( string.Empty ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove keyword + if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + if( m_additionalPragmas.Count > 0 ) + { + m_additionalPragmas.RemoveAt( m_additionalPragmas.Count - 1 ); + EditorGUI.FocusTextInControl( null ); + } + } + } + + void DrawMainBody() + { + EditorGUILayout.Separator(); + int itemCount = m_additionalPragmas.Count; + int markedToDelete = -1; + for( int i = 0; i < itemCount; i++ ) + { + EditorGUILayout.BeginHorizontal(); + { + EditorGUI.BeginChangeCheck(); + m_additionalPragmas[ i ] = EditorGUILayout.TextField( m_additionalPragmas[ i ] ); + if( EditorGUI.EndChangeCheck() ) + { + m_additionalPragmas[ i ] = UIUtils.RemoveShaderInvalidCharacters( m_additionalPragmas[ i ] ); + } + + // Add new port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_additionalPragmas.Insert( i + 1, string.Empty ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + markedToDelete = i; + } + } + EditorGUILayout.EndHorizontal(); + } + + if( markedToDelete > -1 ) + { + if( m_additionalPragmas.Count > markedToDelete ) + { + m_additionalPragmas.RemoveAt( markedToDelete ); + EditorGUI.FocusTextInControl( null ); + } + } + EditorGUILayout.Separator(); + EditorGUILayout.HelpBox( "Please add your pragmas without the #pragma keywords", MessageType.Info ); + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + int count = Convert.ToInt32( nodeParams[ index++ ] ); + for( int i = 0; i < count; i++ ) + { + m_additionalPragmas.Add( nodeParams[ index++ ] ); + } + } + + public void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalPragmas.Count ); + for( int i = 0; i < m_additionalPragmas.Count; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalPragmas[ i ] ); + } + } + + public void AddToDataCollector( ref MasterNodeDataCollector dataCollector ) + { + for( int i = 0; i < m_additionalPragmas.Count; i++ ) + { + if( !string.IsNullOrEmpty( m_additionalPragmas[ i ] ) ) + dataCollector.AddToPragmas( -1, m_additionalPragmas[ i ] ); + } + + for( int i = 0; i < m_outsidePragmas.Count; i++ ) + { + if( !string.IsNullOrEmpty( m_outsidePragmas[ i ] ) ) + dataCollector.AddToPragmas( -1, m_outsidePragmas[ i ] ); + } + } + + public void Destroy() + { + m_additionalPragmas.Clear(); + m_additionalPragmas = null; + m_currentOwner = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs.meta new file mode 100644 index 00000000..65e2b7fe --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3153b4d10effd174988d75b84b12d281 +timeCreated: 1504515475 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs new file mode 100644 index 00000000..cd3efae7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs @@ -0,0 +1,153 @@ +using System; +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + + [Serializable] + public class AdditionalSurfaceOptionsHelper + { + private const string AdditionalOptionsStr = " Additional Surface Options"; + + + private const float ShaderKeywordButtonLayoutWidth = 15; + private ParentNode m_currentOwner; + + [SerializeField] + private List m_availableOptions = new List(); + + public void Draw( ParentNode owner ) + { + m_currentOwner = owner; + bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalSurfaceOptions; + NodeUtils.DrawPropertyGroup( ref value, AdditionalOptionsStr, DrawMainBody, DrawButtons ); + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalSurfaceOptions = value; + } + + void DrawButtons() + { + EditorGUILayout.Separator(); + + // Add tag + if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_availableOptions.Add( string.Empty ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove tag + if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + if( m_availableOptions.Count > 0 ) + { + m_availableOptions.RemoveAt( m_availableOptions.Count - 1 ); + EditorGUI.FocusTextInControl( null ); + } + } + } + + void DrawMainBody() + { + EditorGUILayout.Separator(); + int itemCount = m_availableOptions.Count; + + if( itemCount == 0 ) + { + EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one.", MessageType.Info ); + } + + int markedToDelete = -1; + float originalLabelWidth = EditorGUIUtility.labelWidth; + for( int i = 0; i < itemCount; i++ ) + { + + EditorGUI.indentLevel += 1; + EditorGUIUtility.labelWidth = 62; + EditorGUILayout.BeginHorizontal(); + //Option + EditorGUI.BeginChangeCheck(); + m_availableOptions[ i ] = EditorGUILayout.TextField( "["+i+"] -", m_availableOptions[ i ] ); + if( EditorGUI.EndChangeCheck() ) + { + m_availableOptions[ i ] = UIUtils.RemoveShaderInvalidCharacters( m_availableOptions[ i ] ); + } + + EditorGUIUtility.labelWidth = originalLabelWidth; + + { + // Add new port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_availableOptions.Insert( i + 1, string.Empty ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + markedToDelete = i; + } + } + EditorGUILayout.EndHorizontal(); + EditorGUI.indentLevel -= 1; + } + + if( markedToDelete > -1 ) + { + if( m_availableOptions.Count > markedToDelete ) + { + m_availableOptions.RemoveAt( markedToDelete ); + EditorGUI.FocusTextInControl( null ); + } + } + EditorGUILayout.Separator(); + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + int count = Convert.ToInt32( nodeParams[ index++ ] ); + for( int i = 0; i < count; i++ ) + { + m_availableOptions.Add( nodeParams[ index++ ] ); + } + } + + public void WriteToString( ref string nodeInfo ) + { + int optionsCount = m_availableOptions.Count; + IOUtils.AddFieldValueToString( ref nodeInfo, optionsCount ); + for( int i = 0; i < optionsCount; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_availableOptions[ i ].ToString() ); + } + } + + public void WriteToOptionalSurfaceOptions( ref string currentOptions ) + { + int tagsCount = m_availableOptions.Count; + if( tagsCount == 0 ) + return; + + string result = " "; + + for( int i = 0; i < tagsCount; i++ ) + { + result += m_availableOptions[ i ]; + if( i < tagsCount - 1 ) + { + result += " "; + } + } + currentOptions = currentOptions + result; + } + + public void Destroy() + { + m_availableOptions.Clear(); + m_availableOptions = null; + m_currentOwner = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs.meta new file mode 100644 index 00000000..365f3d6c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d830b2cc8bc5e174485077319135fc1e +timeCreated: 1528881842 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs new file mode 100644 index 00000000..29ad320c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs @@ -0,0 +1,270 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +// Billboard based on: +// https://gist.github.com/renaudbedard/7a90ec4a5a7359712202 +using System; +using UnityEngine; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + public enum BillboardType + { + Cylindrical, + Spherical + } + + [Serializable] + public class BillboardOpHelper + { + public static readonly string BillboardTitleStr = " Billboard"; + public static readonly string BillboardTypeStr = "Type"; + public static readonly string BillboardRotIndStr = "Ignore Rotation"; + public static readonly string BillboardAffectNormalTangentStr = "Affect Normal/Tangent"; + + public static readonly string[] BillboardCylindricalInstructions = { "//Calculate new billboard vertex position and normal", + "float3 upCamVec = float3( 0, 1, 0 )"}; + + public static readonly string[] BillboardSphericalInstructions = { "//Calculate new billboard vertex position and normal", + "float3 upCamVec = normalize ( UNITY_MATRIX_V._m10_m11_m12 )"}; + + + public static readonly string[] BillboardCommonInstructions = { "float3 forwardCamVec = -normalize ( UNITY_MATRIX_V._m20_m21_m22 )", + "float3 rightCamVec = normalize( UNITY_MATRIX_V._m00_m01_m02 )", + "float4x4 rotationCamMatrix = float4x4( rightCamVec, 0, upCamVec, 0, forwardCamVec, 0, 0, 0, 0, 1 )", + "{0} = normalize( mul( float4( {0} , 0 ), rotationCamMatrix )).xyz"}; + + public static readonly string[] BillboardRotDependent = { "//This unfortunately must be made to take non-uniform scaling into account", + "//Transform to world coords, apply rotation and transform back to local", + "{0} = mul( {1} , unity_ObjectToWorld ){2}", + "{0} = mul( {1} , rotationCamMatrix ){2}", + "{0} = mul( {1} , unity_WorldToObject ){2}"}; + + + public static readonly string[] BillboardRotIndependent = { "{0}.x *= length( unity_ObjectToWorld._m00_m10_m20 )", + "{0}.y *= length( unity_ObjectToWorld._m01_m11_m21 )", + "{0}.z *= length( unity_ObjectToWorld._m02_m12_m22 )", + "{0} = mul( {0}, rotationCamMatrix )", + "{0} = mul( unity_WorldToObject, float4( {0}.xyz, 0 ) )"}; + + + + public static readonly string[] BillboardHDRotDependent = { "//This unfortunately must be made to take non-uniform scaling into account", + "//Transform to world coords, apply rotation and transform back to local", + "{0} = mul( {1} , GetObjectToWorldMatrix() ){2}", + "{0} = mul( {1} , rotationCamMatrix ){2}", + "{0} = mul( {1} , GetWorldToObjectMatrix() ){2}"}; + + + public static readonly string[] BillboardHDRotIndependent = { "{0}.x *= length( GetObjectToWorldMatrix()._m00_m10_m20 )", + "{0}.y *= length( GetObjectToWorldMatrix()._m01_m11_m21 )", + "{0}.z *= length( GetObjectToWorldMatrix()._m02_m12_m22 )", + "{0} = mul( {0}, rotationCamMatrix )", + "{0} = mul( GetWorldToObjectMatrix(), float4( {0}.xyz, 0 ) )"}; + + + [SerializeField] + private bool m_isBillboard = false; + + [SerializeField] + private BillboardType m_billboardType = BillboardType.Cylindrical; + + [SerializeField] + private bool m_rotationIndependent = false; + + [SerializeField] + private bool m_affectNormalTangent = true; + + public void Draw( ParentNode owner ) + { + bool visible = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedVertexOptions; + bool enabled = m_isBillboard; + NodeUtils.DrawPropertyGroup( owner, ref visible, ref m_isBillboard, BillboardTitleStr, () => + { + m_billboardType = (BillboardType)owner.EditorGUILayoutEnumPopup( BillboardTypeStr, m_billboardType ); + m_rotationIndependent = owner.EditorGUILayoutToggle( BillboardRotIndStr, m_rotationIndependent ); + m_affectNormalTangent = owner.EditorGUILayoutToggle( BillboardAffectNormalTangentStr , m_affectNormalTangent ); + } ); + + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedVertexOptions = visible; + if( m_isBillboard != enabled ) + { + UIUtils.RequestSave(); + } + } + public void FillDataCollectorWithInternalData( ref MasterNodeDataCollector dataCollector ) + { + if( m_isBillboard ) + { + FillDataCollector( ref dataCollector, m_billboardType, m_rotationIndependent, "v.vertex", "v.normal","v.tangent", false, m_affectNormalTangent ); + } + } + + // This should be called after the Vertex Offset and Vertex Normal ports are analised + public static void FillDataCollector( ref MasterNodeDataCollector dataCollector, BillboardType billboardType, bool rotationIndependent, string vertexPosValue, string vertexNormalValue,string vertexTangentValue, bool vertexIsFloat3, bool affectNormalTangent ) + { + vertexTangentValue = vertexTangentValue + ".xyz"; + switch( billboardType ) + { + case BillboardType.Cylindrical: + { + for( int i = 0; i < BillboardCylindricalInstructions.Length; i++ ) + { + dataCollector.AddVertexInstruction( BillboardCylindricalInstructions[ i ] + ( dataCollector.IsTemplate ? ";" : string.Empty ), -1, true ); + } + } + break; + + case BillboardType.Spherical: + { + for( int i = 0; i < BillboardCylindricalInstructions.Length; i++ ) + { + dataCollector.AddVertexInstruction( BillboardSphericalInstructions[ i ] + ( dataCollector.IsTemplate ? ";" : string.Empty ), -1, true ); + } + } + break; + } + + for( int i = 0; i < 3; i++ ) + { + dataCollector.AddVertexInstruction( BillboardCommonInstructions[ i ] + ( dataCollector.IsTemplate ? ";" : string.Empty ), -1, true ); + } + + if( affectNormalTangent ) + { + string normalValue = string.Format( BillboardCommonInstructions[ 3 ] , vertexNormalValue ); + dataCollector.AddVertexInstruction( normalValue + ( dataCollector.IsTemplate ? ";" : string.Empty ) , -1 , true ); + + string tangentValue = string.Format( BillboardCommonInstructions[ 3 ] , vertexTangentValue ); + dataCollector.AddVertexInstruction( tangentValue + ( dataCollector.IsTemplate ? ";" : string.Empty ) , -1 , true ); + } + + if( rotationIndependent ) + { + + + for( int i = 0; i < BillboardRotIndependent.Length; i++ ) + { + string value = string.Empty; + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BiRP ) + { + value = string.Format( BillboardHDRotIndependent[ i ], vertexPosValue ); + } + else + { + value = string.Format( BillboardRotIndependent[ i ], vertexPosValue ); + } + dataCollector.AddVertexInstruction( value + ( dataCollector.IsTemplate ? ";" : string.Empty ), -1, true ); + } + } + else + { + string vertexPosConverted = vertexIsFloat3 ? string.Format( "float4({0},0)", vertexPosValue ) : vertexPosValue; + for( int i = 0; i < BillboardRotDependent.Length; i++ ) + { + string value = string.Empty; + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + { + value = ( i > 1 ) ? string.Format( BillboardHDRotDependent[ i ], vertexPosValue, vertexPosConverted, ( vertexIsFloat3 ? ".xyz" : string.Empty ) ) : BillboardHDRotDependent[ i ]; + } + else + { + value = ( i > 1 ) ? string.Format( BillboardRotDependent[ i ], vertexPosValue, vertexPosConverted, ( vertexIsFloat3 ? ".xyz" : string.Empty ) ) : BillboardRotDependent[ i ]; + } + dataCollector.AddVertexInstruction( value + ( dataCollector.IsTemplate ? ";" : string.Empty ), -1, true ); + } + } + } + + public string[] GetInternalMultilineInstructions() + { + // This method is only used on Surface ... no HD variation is needed + return GetMultilineInstructions( m_billboardType, m_rotationIndependent, "v.vertex", "v.normal", "v.tangent",m_affectNormalTangent ); + } + + public static string[] GetMultilineInstructions( BillboardType billboardType, bool rotationIndependent, string vertexPosValue, string vertexNormalValue, string vertexTangentValue, bool affectNormalTangent ) + { + vertexTangentValue += ".xyz"; + // This method is only used on Surface ... no HD variation is needed + List body = new List(); + switch( billboardType ) + { + case BillboardType.Cylindrical: + { + for( int i = 0; i < BillboardCylindricalInstructions.Length; i++ ) + { + body.Add( BillboardCylindricalInstructions[ i ] ); + } + } + break; + + case BillboardType.Spherical: + { + for( int i = 0; i < BillboardCylindricalInstructions.Length; i++ ) + { + body.Add( BillboardSphericalInstructions[ i ] ); + } + } + break; + } + + for( int i = 0; i < 3; i++ ) + { + body.Add( BillboardCommonInstructions[ i ] ); + } + + if( affectNormalTangent ) + { + string normalValue = string.Format( BillboardCommonInstructions[ 3 ] , vertexNormalValue ); + body.Add( normalValue ); + + string tangentValue = string.Format( BillboardCommonInstructions[ 3 ] , vertexTangentValue ); + body.Add( tangentValue ); + } + + if( rotationIndependent ) + { + for( int i = 0; i < BillboardRotIndependent.Length; i++ ) + { + string value = ( i != 5 ) ? string.Format( BillboardRotIndependent[ i ], vertexPosValue ) : BillboardRotIndependent[ i ]; + body.Add( value ); + } + } + else + { + for( int i = 0; i < BillboardRotDependent.Length; i++ ) + { + string value = ( i > 1 ) ? string.Format( BillboardRotDependent[ i ], vertexPosValue ) : BillboardRotDependent[ i ]; + body.Add( value ); + } + } + return body.ToArray(); + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + m_isBillboard = Convert.ToBoolean( nodeParams[ index++ ] ); + m_billboardType = (BillboardType)Enum.Parse( typeof( BillboardType ), nodeParams[ index++ ] ); + if( UIUtils.CurrentShaderVersion() > 11007 ) + { + m_rotationIndependent = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( UIUtils.CurrentShaderVersion() > 18918 ) + { + m_affectNormalTangent = Convert.ToBoolean( nodeParams[ index++ ] ); + } + } + + public void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_isBillboard ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_billboardType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_rotationIndependent ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_affectNormalTangent ); + } + + public bool IsBillboard { get { return m_isBillboard; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs.meta new file mode 100644 index 00000000..cf3beb20 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 837b906a268babc49ac733573c5b3394 +timeCreated: 1489159407 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs new file mode 100644 index 00000000..989ace5f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs @@ -0,0 +1,447 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + public enum AvailableBlendFactor + { + One = 1, + Zero = 0, + SrcColor = 3, + SrcAlpha = 5, + DstColor = 2, + DstAlpha = 7, + OneMinusSrcColor = 6, + OneMinusSrcAlpha = 10, + OneMinusDstColor = 4, + OneMinusDstAlpha = 8, + SrcAlphaSaturate = 9 + }; + + public enum AvailableBlendOps + { + OFF = 0, + Add, + Sub, + RevSub, + Min, + Max, + //Direct X11 only + LogicalClear, + LogicalSet, + LogicalCopy, + LogicalCopyInverted, + LogicalNoop, + LogicalInvert, + LogicalAnd, + LogicalNand, + LogicalOr, + LogicalNor, + LogicalXor, + LogicalEquiv, + LogicalAndReverse, + LogicalAndInverted, + LogicalOrReverse, + LogicalOrInverted + }; + + public class CommonBlendTypes + { + public string Name; + public AvailableBlendFactor SourceFactor; + public AvailableBlendFactor DestFactor; + public CommonBlendTypes( string name, AvailableBlendFactor sourceFactor, AvailableBlendFactor destFactor ) + { + Name = name; + SourceFactor = sourceFactor; + DestFactor = destFactor; + } + } + + [Serializable] + public class BlendOpsHelper + { + public static readonly string[] BlendOpsLabels = + { + "", + "Add", + "Sub", + "RevSub", + "Min", + "Max", + "LogicalClear ( DX11.1 Only )", + "LogicalSet ( DX11.1 Only )", + "LogicalCopy ( DX11.1 Only )", + "LogicalCopyInverted ( DX11.1 Only )", + "LogicalNoop ( DX11.1 Only )", + "LogicalInvert ( DX11.1 Only )", + "LogicalAnd ( DX11.1 Only )", + "LogicalNand ( DX11.1 Only )", + "LogicalOr ( DX11.1 Only )", + "LogicalNor ( DX11.1 Only )", + "LogicalXor ( DX11.1 Only )", + "LogicalEquiv ( DX11.1 Only )", + "LogicalAndReverse ( DX11.1 Only )", + "LogicalAndInverted ( DX11.1 Only )", + "LogicalOrReverse ( DX11.1 Only )", + "LogicalOrInverted ( DX11.1 Only )" + }; + + private const string BlendModesRGBStr = "Blend RGB"; + private const string BlendModesAlphaStr = "Blend Alpha"; + + private const string BlendOpsRGBStr = "Blend Op RGB"; + private const string BlendOpsAlphaStr = "Blend Op Alpha"; + + private const string SourceFactorStr = "Src"; + private const string DstFactorStr = "Dst"; + + private const string SingleBlendFactorStr = "Blend {0} {1}"; + private const string SeparateBlendFactorStr = "Blend {0} {1} , {2} {3}"; + + private const string SingleBlendOpStr = "BlendOp {0}"; + private const string SeparateBlendOpStr = "BlendOp {0} , {1}"; + + private string[] m_commonBlendTypesArr; + private List m_commonBlendTypes = new List { new CommonBlendTypes("", AvailableBlendFactor.Zero, AvailableBlendFactor.Zero ), + new CommonBlendTypes("Custom", AvailableBlendFactor.Zero, AvailableBlendFactor.Zero ) , + new CommonBlendTypes("Alpha Blend", AvailableBlendFactor.SrcAlpha, AvailableBlendFactor.OneMinusSrcAlpha ) , + new CommonBlendTypes("Premultiplied", AvailableBlendFactor.One, AvailableBlendFactor.OneMinusSrcAlpha ), + new CommonBlendTypes("Additive", AvailableBlendFactor.One, AvailableBlendFactor.One ), + new CommonBlendTypes("Soft Additive", AvailableBlendFactor.OneMinusDstColor, AvailableBlendFactor.One ), + new CommonBlendTypes("Multiplicative", AvailableBlendFactor.DstColor, AvailableBlendFactor.Zero ), + new CommonBlendTypes("2x Multiplicative", AvailableBlendFactor.DstColor, AvailableBlendFactor.SrcColor ), + new CommonBlendTypes("Particle Additive", AvailableBlendFactor.SrcAlpha, AvailableBlendFactor.One ),}; + + [SerializeField] + private bool m_enabled = false; + + // Blend Factor + // RGB + [SerializeField] + private int m_currentIndex = 0; + + + [SerializeField] + private InlineProperty m_sourceFactorRGB = new InlineProperty( 0 ); + + [SerializeField] + private InlineProperty m_destFactorRGB = new InlineProperty( 0 ); + + // Alpha + [SerializeField] + private int m_currentAlphaIndex = 0; + + [SerializeField] + private InlineProperty m_sourceFactorAlpha = new InlineProperty( 0 ); + + [SerializeField] + private InlineProperty m_destFactorAlpha = new InlineProperty( 0 ); + + //Blend Ops + [SerializeField] + private bool m_blendOpEnabled = false; + + [SerializeField] + private InlineProperty m_blendOpRGB = new InlineProperty( 0 ); + + [SerializeField] + private InlineProperty m_blendOpAlpha = new InlineProperty( 0 ); + + public BlendOpsHelper() + { + m_commonBlendTypesArr = new string[ m_commonBlendTypes.Count ]; + for( int i = 0; i < m_commonBlendTypesArr.Length; i++ ) + { + m_commonBlendTypesArr[ i ] = m_commonBlendTypes[ i ].Name; + } + } + + public void Draw( UndoParentNode owner, bool customBlendAvailable ) + { + m_enabled = customBlendAvailable; + + // RGB + EditorGUI.BeginChangeCheck(); + m_currentIndex = owner.EditorGUILayoutPopup( BlendModesRGBStr, m_currentIndex, m_commonBlendTypesArr ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_currentIndex > 1 ) + { + m_sourceFactorRGB.IntValue = (int)m_commonBlendTypes[ m_currentIndex ].SourceFactor; + m_sourceFactorRGB.SetInlineNodeValue(); + + m_destFactorRGB.IntValue = (int)m_commonBlendTypes[ m_currentIndex ].DestFactor; + m_destFactorRGB.SetInlineNodeValue(); + } + } + EditorGUI.BeginDisabledGroup( m_currentIndex == 0 ); + + EditorGUI.BeginChangeCheck(); + float cached = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 40; + + EditorGUILayout.BeginHorizontal(); + AvailableBlendFactor tempCast = (AvailableBlendFactor)m_sourceFactorRGB.IntValue; + m_sourceFactorRGB.CustomDrawer( ref owner, ( x ) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( SourceFactorStr, tempCast ); }, SourceFactorStr ); + m_sourceFactorRGB.IntValue = (int)tempCast; + EditorGUI.indentLevel--; + EditorGUIUtility.labelWidth = 25; + tempCast = (AvailableBlendFactor)m_destFactorRGB.IntValue; + m_destFactorRGB.CustomDrawer( ref owner, ( x ) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( DstFactorStr, tempCast ); }, DstFactorStr ); + m_destFactorRGB.IntValue = (int)tempCast; + EditorGUI.indentLevel++; + EditorGUILayout.EndHorizontal(); + + EditorGUIUtility.labelWidth = cached; + if( EditorGUI.EndChangeCheck() ) + { + CheckRGBIndex(); + } + + // Both these tests should be removed on a later stage + // ASE v154dev004 changed AvailableBlendOps.OFF value from -1 to 0 + // If importing the new package into an already opened ASE window makes + // hotcode to preserve the -1 value on these variables + if( m_blendOpRGB.FloatValue < 0 ) + m_blendOpRGB.FloatValue = 0; + + if( m_blendOpAlpha.FloatValue < 0 ) + m_blendOpAlpha.FloatValue = 0; + + EditorGUI.BeginChangeCheck(); + //AvailableBlendOps tempOpCast = (AvailableBlendOps)m_blendOpRGB.IntValue; + m_blendOpRGB.CustomDrawer( ref owner, ( x ) => { m_blendOpRGB.IntValue = x.EditorGUILayoutPopup( BlendOpsRGBStr, m_blendOpRGB.IntValue, BlendOpsLabels ); }, BlendOpsRGBStr ); + //m_blendOpRGB.IntValue = (int)tempOpCast; + if( EditorGUI.EndChangeCheck() ) + { + m_blendOpEnabled = ( !m_blendOpRGB.Active && m_blendOpRGB.IntValue > -1 ) || ( m_blendOpRGB.Active && m_blendOpRGB.NodeId > -1 );//AvailableBlendOps.OFF; + m_blendOpRGB.SetInlineNodeValue(); + } + + EditorGUI.EndDisabledGroup(); + + // Alpha + EditorGUILayout.Separator(); + + EditorGUI.BeginChangeCheck(); + m_currentAlphaIndex = owner.EditorGUILayoutPopup( BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_currentAlphaIndex > 0 ) + { + m_sourceFactorAlpha.IntValue = (int)m_commonBlendTypes[ m_currentAlphaIndex ].SourceFactor; + m_sourceFactorAlpha.SetInlineNodeValue(); + + m_destFactorAlpha.IntValue = (int)m_commonBlendTypes[ m_currentAlphaIndex ].DestFactor; + m_destFactorAlpha.SetInlineNodeValue(); + } + } + EditorGUI.BeginDisabledGroup( m_currentAlphaIndex == 0 ); + + EditorGUI.BeginChangeCheck(); + cached = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 40; + EditorGUILayout.BeginHorizontal(); + tempCast = (AvailableBlendFactor)m_sourceFactorAlpha.IntValue; + m_sourceFactorAlpha.CustomDrawer( ref owner, ( x ) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( SourceFactorStr, tempCast ); }, SourceFactorStr ); + m_sourceFactorAlpha.IntValue = (int)tempCast; + EditorGUI.indentLevel--; + EditorGUIUtility.labelWidth = 25; + tempCast = (AvailableBlendFactor)m_destFactorAlpha.IntValue; + m_destFactorAlpha.CustomDrawer( ref owner, ( x ) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( DstFactorStr, tempCast ); }, DstFactorStr ); + m_destFactorAlpha.IntValue = (int)tempCast; + EditorGUI.indentLevel++; + EditorGUILayout.EndHorizontal(); + EditorGUIUtility.labelWidth = cached; + + if( EditorGUI.EndChangeCheck() ) + { + CheckAlphaIndex(); + } + EditorGUI.BeginChangeCheck(); + //tempOpCast = (AvailableBlendOps)m_blendOpAlpha.IntValue; + m_blendOpAlpha.CustomDrawer( ref owner, ( x ) => { m_blendOpAlpha.IntValue = x.EditorGUILayoutPopup( BlendOpsAlphaStr, m_blendOpAlpha.IntValue, BlendOpsLabels ); }, BlendOpsAlphaStr ); + //m_blendOpAlpha.IntValue = (int)tempOpCast; + if( EditorGUI.EndChangeCheck() ) + { + m_blendOpAlpha.SetInlineNodeValue(); + } + EditorGUI.EndDisabledGroup(); + EditorGUILayout.Separator(); + } + + void CheckRGBIndex() + { + int count = m_commonBlendTypes.Count; + m_currentIndex = 1; + for( int i = 1; i < count; i++ ) + { + if( m_commonBlendTypes[ i ].SourceFactor == (AvailableBlendFactor)m_sourceFactorRGB.IntValue && m_commonBlendTypes[ i ].DestFactor == (AvailableBlendFactor)m_destFactorRGB.IntValue ) + { + m_currentIndex = i; + return; + } + } + + } + + void CheckAlphaIndex() + { + int count = m_commonBlendTypes.Count; + m_currentAlphaIndex = 1; + for( int i = 1; i < count; i++ ) + { + if( m_commonBlendTypes[ i ].SourceFactor == (AvailableBlendFactor)m_sourceFactorAlpha.IntValue && m_commonBlendTypes[ i ].DestFactor == (AvailableBlendFactor)m_destFactorAlpha.IntValue ) + { + m_currentAlphaIndex = i; + if( m_currentAlphaIndex > 0 && m_currentIndex == 0 ) + m_currentIndex = 1; + return; + } + } + + if( m_currentAlphaIndex > 0 && m_currentIndex == 0 ) + m_currentIndex = 1; + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + m_currentIndex = Convert.ToInt32( nodeParams[ index++ ] ); + if( UIUtils.CurrentShaderVersion() > 15103 ) + { + m_sourceFactorRGB.ReadFromString( ref index, ref nodeParams ); + m_destFactorRGB.ReadFromString( ref index, ref nodeParams ); + } + else + { + m_sourceFactorRGB.IntValue = (int)(AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); + m_destFactorRGB.IntValue = (int)(AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); + } + + m_currentAlphaIndex = Convert.ToInt32( nodeParams[ index++ ] ); + if( UIUtils.CurrentShaderVersion() > 15103 ) + { + m_sourceFactorAlpha.ReadFromString( ref index, ref nodeParams ); + m_destFactorAlpha.ReadFromString( ref index, ref nodeParams ); + + m_blendOpRGB.ReadFromString( ref index, ref nodeParams ); + m_blendOpAlpha.ReadFromString( ref index, ref nodeParams ); + if( UIUtils.CurrentShaderVersion() < 15404 ) + { + // Now BlendOps enum starts at 0 and not -1 + m_blendOpRGB.FloatValue += 1; + m_blendOpAlpha.FloatValue += 1; + } + } + else + { + m_sourceFactorAlpha.IntValue = (int)(AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); + m_destFactorAlpha.IntValue = (int)(AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); + m_blendOpRGB.IntValue = (int)(AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), nodeParams[ index++ ] ); + m_blendOpAlpha.IntValue = (int)(AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), nodeParams[ index++ ] ); + } + + m_enabled = ( m_currentIndex > 0 || m_currentAlphaIndex > 0 ); + m_blendOpEnabled = ( !m_blendOpRGB.Active && m_blendOpRGB.IntValue > -1 ) || ( m_blendOpRGB.Active && m_blendOpRGB.NodeId > -1 ); + } + + + public void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentIndex ); + m_sourceFactorRGB.WriteToString( ref nodeInfo ); + m_destFactorRGB.WriteToString( ref nodeInfo ); + + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentAlphaIndex ); + m_sourceFactorAlpha.WriteToString( ref nodeInfo ); + m_destFactorAlpha.WriteToString( ref nodeInfo ); + + m_blendOpRGB.WriteToString( ref nodeInfo ); + m_blendOpAlpha.WriteToString( ref nodeInfo ); + } + + public void SetBlendOpsFromBlendMode( AlphaMode mode, bool customBlendAvailable ) + { + switch( mode ) + { + case AlphaMode.Transparent: + m_currentIndex = 2; + m_sourceFactorRGB.IntValue = (int)m_commonBlendTypes[ m_currentIndex ].SourceFactor; + m_destFactorRGB.IntValue = (int)m_commonBlendTypes[ m_currentIndex ].DestFactor; + break; + case AlphaMode.Masked: + case AlphaMode.Translucent: + m_currentIndex = 0; + break; + case AlphaMode.Premultiply: + m_currentIndex = 3; + m_sourceFactorRGB.IntValue = (int)m_commonBlendTypes[ m_currentIndex ].SourceFactor; + m_destFactorRGB.IntValue = (int)m_commonBlendTypes[ m_currentIndex ].DestFactor; + break; + } + m_enabled = customBlendAvailable; + } + + public string CreateBlendOps() + { + + string result = "\t\t" + CurrentBlendFactor + "\n"; + if( m_blendOpEnabled ) + { + result += "\t\t" + CurrentBlendOp + "\n"; + } + return result; + } + + public string CurrentBlendRGB { get { return m_commonBlendTypes[ m_currentIndex ].Name; } } + + public string CurrentBlendFactorSingle { get { return string.Format( SingleBlendFactorStr, m_sourceFactorRGB.GetValueOrProperty( ( (AvailableBlendFactor)m_sourceFactorRGB.IntValue ).ToString() ), m_destFactorRGB.GetValueOrProperty( ( (AvailableBlendFactor)m_destFactorRGB.IntValue ).ToString() ) ); } } + //public string CurrentBlendFactorSingleAlpha { get { return string.Format(SeparateBlendFactorStr, m_sourceFactorRGB, m_destFactorRGB, m_sourceFactorAlpha, m_destFactorAlpha); } } + public string CurrentBlendFactorSeparate + { + get + { + string src = ( m_currentIndex > 0 ? m_sourceFactorRGB.GetValueOrProperty( ( (AvailableBlendFactor)m_sourceFactorRGB.IntValue ).ToString() ) : AvailableBlendFactor.One.ToString() ); + string dst = ( m_currentIndex > 0 ? m_destFactorRGB.GetValueOrProperty( ( (AvailableBlendFactor)m_destFactorRGB.IntValue ).ToString() ) : AvailableBlendFactor.Zero.ToString() ); + string srca = m_sourceFactorAlpha.GetValueOrProperty( ( (AvailableBlendFactor)m_sourceFactorAlpha.IntValue ).ToString() ); + string dsta = m_destFactorAlpha.GetValueOrProperty( ( (AvailableBlendFactor)m_destFactorAlpha.IntValue ).ToString() ); + return string.Format( SeparateBlendFactorStr, src, dst, srca, dsta ); + } + } + public string CurrentBlendFactor { get { return ( ( m_currentAlphaIndex > 0 ) ? CurrentBlendFactorSeparate : CurrentBlendFactorSingle ); } } + + public string CurrentBlendOpSingle + { + get + { + string value = m_blendOpRGB.GetValueOrProperty( ( (AvailableBlendOps)m_blendOpRGB.IntValue ).ToString() ); + if( value.Equals( ( AvailableBlendOps.OFF ).ToString() ) ) + return string.Empty; + + return string.Format( SingleBlendOpStr, value ); + } + } + public string CurrentBlendOpSeparate + { + get + { + string rgbValue = m_blendOpRGB.GetValueOrProperty( ( (AvailableBlendOps)m_blendOpRGB.IntValue ).ToString() ); + + if( rgbValue.Equals( ( AvailableBlendOps.OFF ).ToString() )) + rgbValue = "Add"; + + string alphaValue = m_blendOpAlpha.GetValueOrProperty( ( (AvailableBlendOps)m_blendOpAlpha.IntValue ).ToString() ); + return string.Format( SeparateBlendOpStr, ( m_currentIndex > 0 ? rgbValue : AvailableBlendOps.Add.ToString() ), alphaValue ); + } + } + public string CurrentBlendOp { get { return ( ( m_currentAlphaIndex > 0 && m_blendOpAlpha.GetValueOrProperty( ( (AvailableBlendOps)m_blendOpAlpha.IntValue ).ToString() ) != AvailableBlendOps.OFF.ToString() ) ? CurrentBlendOpSeparate : CurrentBlendOpSingle ); } } + + public bool Active { get { return m_enabled && ( m_currentIndex > 0 || m_currentAlphaIndex > 0 ); } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs.meta new file mode 100644 index 00000000..93e61946 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 8b59649a5f829e24cb4de8c1a715f8b4 +timeCreated: 1485530925 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs new file mode 100644 index 00000000..5245c9f4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs @@ -0,0 +1,24 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +namespace AmplifyShaderEditor +{ + [System.Serializable] + public class CodeGenerationData + { + [SerializeField] + public bool IsActive; + [SerializeField] + public string Name; + [SerializeField] + public string Value; + + public CodeGenerationData( string name, string value ) + { + IsActive = false; + Name = name; + Value = value; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs.meta new file mode 100644 index 00000000..c012a29b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7a47d8101acb2e94d95016b69a1c2e41 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs new file mode 100644 index 00000000..a77629e0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs @@ -0,0 +1,119 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + class ColorMaskHelper + { + private GUIContent ColorMaskContent = new GUIContent( "Color Mask", "Sets color channel writing mask, turning all off makes the object completely invisible\nDefault: RGBA" ); + private readonly char[] m_colorMaskChar = { 'R', 'G', 'B', 'A' }; + + private GUIStyle m_leftToggleColorMask; + private GUIStyle m_middleToggleColorMask; + private GUIStyle m_rightToggleColorMask; + + + [SerializeField] + private bool[] m_colorMask = { true, true, true, true }; + + [SerializeField] + private InlineProperty m_inlineMask = new InlineProperty(); + + public void Draw( UndoParentNode owner ) + { + m_inlineMask.CustomDrawer( ref owner, DrawColorMaskControls, ColorMaskContent.text ); + } + + private void DrawColorMaskControls( UndoParentNode owner ) + { + if( m_leftToggleColorMask == null || m_leftToggleColorMask.normal.background == null ) + { + m_leftToggleColorMask = GUI.skin.GetStyle( "miniButtonLeft" ); + } + + if( m_middleToggleColorMask == null || m_middleToggleColorMask.normal.background == null ) + { + m_middleToggleColorMask = GUI.skin.GetStyle( "miniButtonMid" ); + } + + if( m_rightToggleColorMask == null || m_rightToggleColorMask.normal.background == null ) + { + m_rightToggleColorMask = GUI.skin.GetStyle( "miniButtonRight" ); + } + + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField( ColorMaskContent, GUILayout.Width( 90 ) ); + + m_colorMask[ 0 ] = owner.GUILayoutToggle( m_colorMask[ 0 ], "R", m_leftToggleColorMask ); + m_colorMask[ 1 ] = owner.GUILayoutToggle( m_colorMask[ 1 ], "G", m_middleToggleColorMask ); + m_colorMask[ 2 ] = owner.GUILayoutToggle( m_colorMask[ 2 ], "B", m_middleToggleColorMask ); + m_colorMask[ 3 ] = owner.GUILayoutToggle( m_colorMask[ 3 ], "A", m_rightToggleColorMask ); + + EditorGUILayout.EndHorizontal(); + } + + public void BuildColorMask( ref string ShaderBody, bool customBlendAvailable, bool forceDefaultWrite = false ) + { + int count = 0; + string colorMask = string.Empty; + for( int i = 0; i < m_colorMask.Length; i++ ) + { + if( m_colorMask[ i ] ) + { + count++; + colorMask += m_colorMaskChar[ i ]; + } + } + + if( ( count != m_colorMask.Length && customBlendAvailable ) || m_inlineMask.Active ) + { + MasterNode.AddRenderState( ref ShaderBody, "ColorMask", m_inlineMask.GetValueOrProperty( ( ( count == 0 ) ? "0" : colorMask ) ) ); + } + + if( count == m_colorMask.Length && forceDefaultWrite ) + { + MasterNode.AddRenderState( ref ShaderBody , "ColorMask" , colorMask ); + } + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + for( int i = 0; i < m_colorMask.Length; i++ ) + { + m_colorMask[ i ] = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( UIUtils.CurrentShaderVersion() > 14501 ) + m_inlineMask.ReadFromString( ref index, ref nodeParams ); + } + + public void WriteToString( ref string nodeInfo ) + { + for( int i = 0; i < m_colorMask.Length; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_colorMask[ i ] ); + } + + m_inlineMask.WriteToString( ref nodeInfo ); + } + + public void Destroy() + { + m_leftToggleColorMask = null; + m_middleToggleColorMask = null; + m_rightToggleColorMask = null; + } + + public void HideInlineButton() + { + m_inlineMask.HideInlineButton(); + } + + public bool[] ColorMask { get { return m_colorMask; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs.meta new file mode 100644 index 00000000..af4333e1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: bf65efd881afd1b4cbd2b27f3f17251b +timeCreated: 1488903773 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs new file mode 100644 index 00000000..35e98712 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs @@ -0,0 +1,482 @@ +using System; +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class CustomTagData + { + private const string TagFormat = "\"{0}\"=\"{1}\""; + public string TagName; + public string TagValue; + public int TagId = -1; + public bool TagFoldout = true; + + [SerializeField] + private TemplateSpecialTags m_specialTag = TemplateSpecialTags.None; + [SerializeField] + private DisableBatching m_disableBatching = DisableBatching.False; + [SerializeField] + private RenderType m_renderType = RenderType.Opaque; + [SerializeField] + private RenderQueue m_renderQueue = RenderQueue.Geometry; + [SerializeField] + private int m_renderQueueOffset = 0; + + public CustomTagData() + { + TagName = string.Empty; + TagValue = string.Empty; + m_specialTag = TemplateSpecialTags.None; + m_disableBatching = DisableBatching.False; + m_renderType = RenderType.Opaque; + m_renderQueue = RenderQueue.Geometry; + m_renderQueueOffset = 0; + } + + public CustomTagData( CustomTagData other ) + { + TagName = other.TagName; + TagValue = other.TagValue; + TagId = other.TagId; + TagFoldout = other.TagFoldout; + + m_specialTag = other.m_specialTag; + m_disableBatching = other.m_disableBatching; + m_renderType = other.m_renderType; + m_renderQueue = other.m_renderQueue; + m_renderQueueOffset = other.m_renderQueueOffset; + } + + public void SetTagValue( params string[] value ) + { + TagValue = value[ 0 ]; + switch( m_specialTag ) + { + case TemplateSpecialTags.RenderType: + { + if( !TemplateHelperFunctions.StringToRenderType.TryGetValue( value[ 0 ], out m_renderType ) ) + { + m_renderType = RenderType.Custom; + TagValue = value[ 0 ]; + } + } + break; + case TemplateSpecialTags.Queue: + { + if( value.Length == 2 ) + { + m_renderQueue = TemplateHelperFunctions.StringToRenderQueue[ value[ 0 ] ]; + int.TryParse( value[ 1 ], out m_renderQueueOffset ); + } + else + { + int indexPlus = value[ 0 ].IndexOf( '+' ); + if( indexPlus > 0 ) + { + string[] args = value[ 0 ].Split( '+' ); + m_renderQueue = TemplateHelperFunctions.StringToRenderQueue[ args[ 0 ] ]; + int.TryParse( args[ 1 ], out m_renderQueueOffset ); + } + else + { + int indexMinus = value[ 0 ].IndexOf( '-' ); + if( indexMinus > 0 ) + { + string[] args = value[ 0 ].Split( '-' ); + m_renderQueue = TemplateHelperFunctions.StringToRenderQueue[ args[ 0 ] ]; + int.TryParse( args[ 1 ], out m_renderQueueOffset ); + m_renderQueueOffset *= -1; + } + else + { + m_renderQueue = TemplateHelperFunctions.StringToRenderQueue[ value[ 0 ] ]; + m_renderQueueOffset = 0; + } + } + } + BuildQueueTagValue(); + } + break; + case TemplateSpecialTags.DisableBatching: + { + if( !TemplateHelperFunctions.StringToDisableBatching.TryGetValue( value[ 0 ], out m_disableBatching ) ) + { + m_disableBatching = DisableBatching.False; + TagValue = value[ 0 ]; + } + } + break; + } + } + + void CheckSpecialTag() + { + if( TagName.Equals( Constants.RenderTypeHelperStr ) ) + { + m_specialTag = TemplateSpecialTags.RenderType; + if( !TemplateHelperFunctions.StringToRenderType.TryGetValue( TagValue, out m_renderType )) + { + m_renderType = RenderType.Custom; + } + } + else if( TagName.Equals( Constants.RenderQueueHelperStr ) ) + { + m_specialTag = TemplateSpecialTags.Queue; + SetTagValue( TagValue ); + } + else if( TagName.Equals( Constants.DisableBatchingHelperStr ) ) + { + m_specialTag = TemplateSpecialTags.DisableBatching; + if( !TemplateHelperFunctions.StringToDisableBatching.TryGetValue( TagValue, out m_disableBatching ) ) + { + m_disableBatching = DisableBatching.False; + } + } + else + { + m_specialTag = TemplateSpecialTags.None; + } + } + + public CustomTagData( string name, string value, int id ) + { + TagName = name; + TagValue = value; + TagId = id; + CheckSpecialTag(); + } + + //Used on Template based shaders loading + public CustomTagData( string data, int id ) + { + TagId = id; + string[] arr = data.Split( IOUtils.VALUE_SEPARATOR ); + if( arr.Length > 1 ) + { + TagName = arr[ 0 ]; + TagValue = arr[ 1 ]; + } + + if( arr.Length > 2 ) + { + m_specialTag = (TemplateSpecialTags)Enum.Parse( typeof( TemplateSpecialTags ), arr[ 2 ] ); + switch( m_specialTag ) + { + case TemplateSpecialTags.RenderType: + { + if( !TemplateHelperFunctions.StringToRenderType.TryGetValue( TagValue, out m_renderType ) ) + { + m_renderType = RenderType.Custom; + } + } + break; + case TemplateSpecialTags.Queue: + { + if( arr.Length == 4 ) + { + m_renderQueue = (RenderQueue)Enum.Parse( typeof( RenderQueue ), TagValue ); + int.TryParse( arr[ 3 ], out m_renderQueueOffset ); + } + BuildQueueTagValue(); + } + break; + case TemplateSpecialTags.DisableBatching: + { + if( !TemplateHelperFunctions.StringToDisableBatching.TryGetValue( TagValue, out m_disableBatching ) ) + { + m_disableBatching = DisableBatching.False; + } + } + break; + } + } + else /*if( UIUtils.CurrentShaderVersion() < 15600 )*/ + { + CheckSpecialTag(); + } + } + + //Used on Standard Surface shaders loading + public CustomTagData( string data ) + { + string[] arr = data.Split( IOUtils.VALUE_SEPARATOR ); + if( arr.Length > 1 ) + { + TagName = arr[ 0 ]; + TagValue = arr[ 1 ]; + } + } + + public override string ToString() + { + switch( m_specialTag ) + { + case TemplateSpecialTags.RenderType: + return TagName + IOUtils.VALUE_SEPARATOR + + ( RenderType != RenderType.Custom? RenderType.ToString(): TagValue ) + IOUtils.VALUE_SEPARATOR + + m_specialTag; + case TemplateSpecialTags.Queue: + return TagName + IOUtils.VALUE_SEPARATOR + + m_renderQueue.ToString() + IOUtils.VALUE_SEPARATOR + + m_specialTag + IOUtils.VALUE_SEPARATOR + + m_renderQueueOffset; + case TemplateSpecialTags.DisableBatching: + return TagName + IOUtils.VALUE_SEPARATOR + + Batching.ToString() + IOUtils.VALUE_SEPARATOR + + m_specialTag; + } + + return TagName + IOUtils.VALUE_SEPARATOR + TagValue; + } + + public string GenerateTag() + { + switch( m_specialTag ) + { + case TemplateSpecialTags.RenderType: + return string.Format( TagFormat, TagName, ( RenderType != RenderType.Custom ? RenderType.ToString() : TagValue ) ); + case TemplateSpecialTags.DisableBatching: + case TemplateSpecialTags.Queue: + case TemplateSpecialTags.None: + default: + return string.Format( TagFormat, TagName, TagValue ); + } + } + + public void BuildQueueTagValue() + { + TagValue = m_renderQueue.ToString(); + if( m_renderQueueOffset > 0 ) + { + TagValue += "+" + m_renderQueueOffset; + } + else if( m_renderQueueOffset < 0 ) + { + TagValue += m_renderQueueOffset; + } + } + + public TemplateSpecialTags SpecialTag + { + get { return m_specialTag; } + set + { + m_specialTag = value; + switch( value ) + { + case TemplateSpecialTags.DisableBatching: + { + TagValue = m_disableBatching.ToString(); + } + break; + case TemplateSpecialTags.RenderType: + { + //if( m_renderType != RenderType.Custom ) + // TagValue = m_renderType.ToString(); + } + break; + case TemplateSpecialTags.Queue: + { + BuildQueueTagValue(); + } + break; + } + } + } + + public DisableBatching Batching + { + get { return m_disableBatching; } + set { m_disableBatching = value; + TagValue = value.ToString(); + } + } + + public RenderType RenderType + { + get { return m_renderType; } + set + { + m_renderType = value; + //if( m_renderType != RenderType.Custom ) + // TagValue = value.ToString(); + } + } + + public RenderQueue RenderQueue + { + get { return m_renderQueue; } + set { m_renderQueue = value; } + } + public int RenderQueueOffset + { + get { return m_renderQueueOffset; } + set { m_renderQueueOffset = value; } + } + + public bool IsValid { get { return ( !string.IsNullOrEmpty( TagValue ) && !string.IsNullOrEmpty( TagName ) ); } } + } + + [Serializable] + public class CustomTagsHelper + { + private const string CustomTagsStr = " Custom SubShader Tags"; + private const string TagNameStr = "Name"; + private const string TagValueStr = "Value"; + + private const float ShaderKeywordButtonLayoutWidth = 15; + private ParentNode m_currentOwner; + + [SerializeField] + private List m_availableTags = new List(); + + public void Draw( ParentNode owner ) + { + m_currentOwner = owner; + bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedCustomTags; + NodeUtils.DrawPropertyGroup( ref value, CustomTagsStr, DrawMainBody, DrawButtons ); + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedCustomTags = value; + } + + void DrawButtons() + { + EditorGUILayout.Separator(); + + // Add tag + if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_availableTags.Add( new CustomTagData() ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove tag + if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + if( m_availableTags.Count > 0 ) + { + m_availableTags.RemoveAt( m_availableTags.Count - 1 ); + EditorGUI.FocusTextInControl( null ); + } + } + } + + void DrawMainBody() + { + EditorGUILayout.Separator(); + int itemCount = m_availableTags.Count; + + if( itemCount == 0 ) + { + EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one.", MessageType.Info ); + } + + int markedToDelete = -1; + float originalLabelWidth = EditorGUIUtility.labelWidth; + for( int i = 0; i < itemCount; i++ ) + { + m_availableTags[ i ].TagFoldout = m_currentOwner.EditorGUILayoutFoldout( m_availableTags[ i ].TagFoldout, string.Format( "[{0}] - {1}", i, m_availableTags[ i ].TagName ) ); + if( m_availableTags[ i ].TagFoldout ) + { + EditorGUI.indentLevel += 1; + EditorGUIUtility.labelWidth = 70; + //Tag Name + EditorGUI.BeginChangeCheck(); + m_availableTags[ i ].TagName = EditorGUILayout.TextField( TagNameStr, m_availableTags[ i ].TagName ); + if( EditorGUI.EndChangeCheck() ) + { + m_availableTags[ i ].TagName = UIUtils.RemoveShaderInvalidCharacters( m_availableTags[ i ].TagName ); + } + + //Tag Value + EditorGUI.BeginChangeCheck(); + m_availableTags[ i ].TagValue = EditorGUILayout.TextField( TagValueStr, m_availableTags[ i ].TagValue ); + if( EditorGUI.EndChangeCheck() ) + { + m_availableTags[ i ].TagValue = UIUtils.RemoveShaderInvalidCharacters( m_availableTags[ i ].TagValue ); + } + + EditorGUIUtility.labelWidth = originalLabelWidth; + + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Label( " " ); + // Add new port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_availableTags.Insert( i + 1, new CustomTagData() ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + markedToDelete = i; + } + } + EditorGUILayout.EndHorizontal(); + + EditorGUI.indentLevel -= 1; + } + + } + if( markedToDelete > -1 ) + { + if( m_availableTags.Count > markedToDelete ) + { + m_availableTags.RemoveAt( markedToDelete ); + EditorGUI.FocusTextInControl( null ); + } + } + EditorGUILayout.Separator(); + } + + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + int count = Convert.ToInt32( nodeParams[ index++ ] ); + for( int i = 0; i < count; i++ ) + { + m_availableTags.Add( new CustomTagData( nodeParams[ index++ ] ) ); + } + } + + public void WriteToString( ref string nodeInfo ) + { + int tagsCount = m_availableTags.Count; + IOUtils.AddFieldValueToString( ref nodeInfo, tagsCount ); + for( int i = 0; i < tagsCount; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_availableTags[ i ].ToString() ); + } + } + + public string GenerateCustomTags() + { + int tagsCount = m_availableTags.Count; + string result = tagsCount == 0 ? string.Empty : " "; + + for( int i = 0; i < tagsCount; i++ ) + { + if( m_availableTags[ i ].IsValid ) + { + result += m_availableTags[ i ].GenerateTag(); + if( i < tagsCount - 1 ) + { + result += " "; + } + } + } + return result; + } + + public void Destroy() + { + m_availableTags.Clear(); + m_availableTags = null; + m_currentOwner = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs.meta new file mode 100644 index 00000000..bdbc1c91 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5ed32be99aefda24483c9e3499a5cd23 +timeCreated: 1500400244 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs new file mode 100644 index 00000000..915f173c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs @@ -0,0 +1,210 @@ +using System; +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class DependenciesData + { + private string DependencyFormat = "Dependency \"{0}\"=\"{1}\"\n"; + public string DependencyName; + public string DependencyValue; + public bool DependencyFoldout = true; + + public DependenciesData() + { + DependencyName = string.Empty; + DependencyValue = string.Empty; + } + + public DependenciesData( string data ) + { + string[] arr = data.Split( IOUtils.VALUE_SEPARATOR ); + if( arr.Length > 1 ) + { + DependencyName = arr[ 0 ]; + DependencyValue = arr[ 1 ]; + } + } + + public override string ToString() + { + return DependencyName + IOUtils.VALUE_SEPARATOR + DependencyValue; + } + + public string GenerateDependency() + { + return string.Format( DependencyFormat, DependencyName, DependencyValue ); + } + + public bool IsValid { get { return ( !string.IsNullOrEmpty( DependencyValue ) && !string.IsNullOrEmpty( DependencyName ) ); } } + } + + [Serializable] + public class DependenciesHelper + { + private const string CustomDependencysStr = " Dependencies"; + private const string DependencyNameStr = "Name"; + private const string DependencyValueStr = "Value"; + + private const float ShaderKeywordButtonLayoutWidth = 15; + private ParentNode m_currentOwner; + + [SerializeField] + private List m_availableDependencies = new List(); + + public void Draw( ParentNode owner, bool isNested = false ) + { + m_currentOwner = owner; + bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDependencies; + if( isNested ) + { + NodeUtils.DrawNestedPropertyGroup( ref value, CustomDependencysStr, DrawMainBody, DrawButtons ); + } + else + { + NodeUtils.DrawPropertyGroup( ref value, CustomDependencysStr, DrawMainBody, DrawButtons ); + } + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDependencies = value; + } + + void DrawButtons() + { + EditorGUILayout.Separator(); + + // Add Dependency + if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_availableDependencies.Add( new DependenciesData() ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove Dependency + if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + if( m_availableDependencies.Count > 0 ) + { + m_availableDependencies.RemoveAt( m_availableDependencies.Count - 1 ); + EditorGUI.FocusTextInControl( null ); + } + } + } + + void DrawMainBody() + { + EditorGUILayout.Separator(); + int itemCount = m_availableDependencies.Count; + + if( itemCount == 0 ) + { + EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one.", MessageType.Info ); + } + + int markedToDelete = -1; + float originalLabelWidth = EditorGUIUtility.labelWidth; + for( int i = 0; i < itemCount; i++ ) + { + m_availableDependencies[ i ].DependencyFoldout = m_currentOwner.EditorGUILayoutFoldout( m_availableDependencies[ i ].DependencyFoldout, string.Format( "[{0}] - {1}", i, m_availableDependencies[ i ].DependencyName ) ); + if( m_availableDependencies[ i ].DependencyFoldout ) + { + EditorGUI.indentLevel += 1; + EditorGUIUtility.labelWidth = 70; + //Dependency Name + EditorGUI.BeginChangeCheck(); + m_availableDependencies[ i ].DependencyName = EditorGUILayout.TextField( DependencyNameStr, m_availableDependencies[ i ].DependencyName ); + if( EditorGUI.EndChangeCheck() ) + { + m_availableDependencies[ i ].DependencyName = UIUtils.RemoveShaderInvalidCharacters( m_availableDependencies[ i ].DependencyName ); + } + + //Dependency Value + EditorGUI.BeginChangeCheck(); + m_availableDependencies[ i ].DependencyValue = EditorGUILayout.TextField( DependencyValueStr, m_availableDependencies[ i ].DependencyValue ); + if( EditorGUI.EndChangeCheck() ) + { + m_availableDependencies[ i ].DependencyValue = UIUtils.RemoveShaderInvalidCharacters( m_availableDependencies[ i ].DependencyValue ); + } + + EditorGUIUtility.labelWidth = originalLabelWidth; + + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Label( " " ); + // Add new port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_availableDependencies.Insert( i + 1, new DependenciesData() ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + markedToDelete = i; + } + } + EditorGUILayout.EndHorizontal(); + + EditorGUI.indentLevel -= 1; + } + + } + if( markedToDelete > -1 ) + { + if( m_availableDependencies.Count > markedToDelete ) + { + m_availableDependencies.RemoveAt( markedToDelete ); + EditorGUI.FocusTextInControl( null ); + } + } + EditorGUILayout.Separator(); + } + + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + int count = Convert.ToInt32( nodeParams[ index++ ] ); + for( int i = 0; i < count; i++ ) + { + m_availableDependencies.Add( new DependenciesData( nodeParams[ index++ ] ) ); + } + } + + public void WriteToString( ref string nodeInfo ) + { + int dependencyCount = m_availableDependencies.Count; + IOUtils.AddFieldValueToString( ref nodeInfo, dependencyCount ); + for( int i = 0; i < dependencyCount; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_availableDependencies[ i ].ToString() ); + } + } + + public string GenerateDependencies() + { + int dependencyCount = m_availableDependencies.Count; + string result = dependencyCount == 0 ? string.Empty : "\n"; + UIUtils.ShaderIndentLevel++; + for( int i = 0; i < dependencyCount; i++ ) + { + if( m_availableDependencies[ i ].IsValid ) + { + result += UIUtils.ShaderIndentTabs + m_availableDependencies[ i ].GenerateDependency(); + } + } + UIUtils.ShaderIndentLevel--; + return result; + } + + public void Destroy() + { + m_availableDependencies.Clear(); + m_availableDependencies = null; + m_currentOwner = null; + } + + public bool HasDependencies { get { return m_availableDependencies.Count > 0; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs.meta new file mode 100644 index 00000000..c3f0bb18 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2daff2983fe91ac43953017a8be984a7 +timeCreated: 1512404972 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs new file mode 100644 index 00000000..aa8d8b44 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs @@ -0,0 +1,120 @@ +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class FallbackPickerHelper : ScriptableObject + { + private const string FallbackFormat = "Fallback \"{0}\""; + private const string FallbackOff = "Fallback Off"; + private const string FallbackShaderStr = "Fallback"; + private const string ShaderPoputContext = "CONTEXT/ShaderPopup"; + + private Material m_dummyMaterial; + private MenuCommand m_dummyCommand; + + [SerializeField] + private string m_fallbackShader = string.Empty; + + public void Init() + { + hideFlags = HideFlags.HideAndDontSave; + m_dummyMaterial = null; + m_dummyCommand = null; + } + + public void Draw( ParentNode owner ) + { + EditorGUILayout.BeginHorizontal(); + m_fallbackShader = owner.EditorGUILayoutTextField( FallbackShaderStr, m_fallbackShader ); + if ( GUILayout.Button( string.Empty, UIUtils.InspectorPopdropdownFallback, GUILayout.Width( 17 ), GUILayout.Height( 19 ) ) ) + { + EditorGUI.FocusTextInControl( null ); + GUI.FocusControl( null ); + DisplayShaderContext( owner, GUILayoutUtility.GetRect( GUIContent.none, EditorStyles.popup ) ); + } + EditorGUILayout.EndHorizontal(); + } + + private void DisplayShaderContext( ParentNode node, Rect r ) + { + if ( m_dummyCommand == null ) + m_dummyCommand = new MenuCommand( this, 0 ); + + if ( m_dummyMaterial == null ) + m_dummyMaterial = new Material( Shader.Find( "Hidden/ASESShaderSelectorUnlit" ) ); + +#pragma warning disable 0618 + UnityEditorInternal.InternalEditorUtility.SetupShaderMenu( m_dummyMaterial ); +#pragma warning restore 0618 + EditorUtility.DisplayPopupMenu( r, ShaderPoputContext, m_dummyCommand ); + } + + private void OnSelectedShaderPopup( string command, Shader shader ) + { + if ( shader != null ) + { + UIUtils.MarkUndoAction(); + UndoUtils.RecordObject( this, "Selected fallback shader" ); + m_fallbackShader = shader.name; + } + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + m_fallbackShader = nodeParams[ index++ ]; + } + + public void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_fallbackShader ); + } + + public void Destroy() + { + GameObject.DestroyImmediate( m_dummyMaterial ); + m_dummyMaterial = null; + m_dummyCommand = null; + } + + public string TabbedFallbackShader + { + get + { + if( string.IsNullOrEmpty( m_fallbackShader ) ) + return "\t" + FallbackOff + "\n"; + + return "\t" + string.Format( FallbackFormat, m_fallbackShader ) + "\n"; + } + } + + public string FallbackShader + { + get + { + if( string.IsNullOrEmpty( m_fallbackShader ) ) + return FallbackOff; + + return string.Format( FallbackFormat, m_fallbackShader ); + } + } + + public string RawFallbackShader + { + get + { + return m_fallbackShader; + } + set + { + m_fallbackShader = value; + } + } + + + public bool Active { get { return !string.IsNullOrEmpty( m_fallbackShader ); } } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs.meta new file mode 100644 index 00000000..f22f1bd0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: cd5a03cee1255ba438e2062d215b70b6 +timeCreated: 1490378537 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs new file mode 100644 index 00000000..b3dd8d66 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs @@ -0,0 +1,527 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Function Input", "Functions", "Function Input adds an input port to the shader function", NodeAvailabilityFlags = (int)NodeAvailability.ShaderFunction )] + public sealed class FunctionInput : ParentNode + { + private const string InputTypeStr = "Input Type"; + private readonly string[] m_inputValueTypes ={ "Int", + "Float", + "Vector2", + "Vector3", + "Vector4", + "Color", + "Matrix 3x3", + "Matrix 4x4", + "Sampler 1D", + "Sampler 2D", + "Sampler 3D", + "Sampler Cube", + "Sampler 2D Array", + "Sampler State", + "Custom"}; + + [SerializeField] + private int m_selectedInputTypeInt = 1; + + private WirePortDataType m_selectedInputType = WirePortDataType.FLOAT; + + [SerializeField] + private FunctionNode m_functionNode; + + [SerializeField] + private string m_inputName = "Input"; + + [SerializeField] + private bool m_autoCast = false; + + [SerializeField] + private int m_orderIndex = -1; + + private int m_typeId = -1; + + public bool m_ignoreConnection = false; + + public delegate string PortGeneration( ref MasterNodeDataCollector dataCollector, int index, ParentGraph graph ); + public PortGeneration OnPortGeneration = null; + + //Title editing + [SerializeField] + private string m_uniqueName; + + private bool m_isEditing; + private bool m_stopEditing; + private bool m_startEditing; + private double m_clickTime; + private double m_doubleClickTime = 0.3; + private Rect m_titleClickArea; + private bool m_showTitleWhenNotEditing = true; + + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + m_inputPorts[ 0 ].AutoDrawInternalData = true; + //m_inputPorts[ 0 ].Visible = false; + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_autoWrapProperties = true; + m_textLabelWidth = 100; + SetTitleText( m_inputName ); + UpdatePorts(); + SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); + m_previewShaderGUID = "04bc8e7b317dccb4d8da601680dd8140"; + } + + public override void SetPreviewInputs() + { + if( Fnode == null ) + { + m_ignoreConnection = false; + CheckSpherePreview(); + } + else + { + var input = Fnode.GetInput( this ); + if( input != null && ( !InputPorts[ 0 ].IsConnected || input.IsConnected ) ) + { + m_ignoreConnection = true; + InputPorts[ 0 ].PreparePortCacheID(); + Fnode.SetPreviewInput( input ); + if( input.ExternalReferences.Count > 0 ) + { + SpherePreview = Fnode.ContainerGraph.GetNode( input.ExternalReferences[ 0 ].NodeId ).SpherePreview; + } + else + { + SpherePreview = false; + } + PreviewMaterial.SetTexture( InputPorts[ 0 ].CachedPropertyId, input.InputPreviewTexture( Fnode.ContainerGraph ) ); + } + else + { + m_ignoreConnection = false; + CheckSpherePreview(); + } + } + + if( !m_ignoreConnection ) + base.SetPreviewInputs(); + + for( int i = 0; i < OutputPorts[ 0 ].ExternalReferences.Count; i++ ) + { + ContainerGraph.GetNode( OutputPorts[ 0 ].ExternalReferences[ i ].NodeId ).OnNodeChange(); + } + + if( m_typeId == -1 ) + m_typeId = Shader.PropertyToID( "_Type" ); + + if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT || m_inputPorts[ 0 ].DataType == WirePortDataType.INT ) + PreviewMaterial.SetInt( m_typeId, 1 ); + else if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT2 ) + PreviewMaterial.SetInt( m_typeId, 2 ); + else if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT3 ) + PreviewMaterial.SetInt( m_typeId, 3 ); + else + PreviewMaterial.SetInt( m_typeId, 0 ); + + } + + public override bool RecursivePreviewUpdate( Dictionary duplicatesDict = null ) + { + if( duplicatesDict == null ) + { + duplicatesDict = ContainerGraph.ParentWindow.VisitedChanged; + } + + for( int i = 0; i < InputPorts.Count; i++ ) + { + ParentNode outNode = null; + if( Fnode != null ) + { + var input = Fnode.GetInput( this ); + if( input.ExternalReferences.Count > 0 ) + { + outNode = Fnode.ContainerGraph.GetNode( input.ExternalReferences[ 0 ].NodeId ); + } + else if( InputPorts[ i ].ExternalReferences.Count > 0 ) + { + outNode = ContainerGraph.GetNode( InputPorts[ i ].ExternalReferences[ 0 ].NodeId ); + } + } + else + { + if( InputPorts[ i ].ExternalReferences.Count > 0 ) + { + outNode = ContainerGraph.GetNode( InputPorts[ i ].ExternalReferences[ 0 ].NodeId ); + } + } + if( outNode != null ) + { + if( !duplicatesDict.ContainsKey( outNode.OutputId ) ) + { + bool result = outNode.RecursivePreviewUpdate(); + if( result ) + PreviewIsDirty = true; + } + else if( duplicatesDict[ outNode.OutputId ] ) + { + PreviewIsDirty = true; + } + } + } + + bool needsUpdate = PreviewIsDirty; + RenderNodePreview(); + if( !duplicatesDict.ContainsKey( OutputId ) ) + duplicatesDict.Add( OutputId, needsUpdate ); + return needsUpdate; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + UIUtils.RegisterFunctionInputNode( this ); + if( m_nodeAttribs != null ) + m_uniqueName = m_nodeAttribs.Name + UniqueId; + } + + public override void Destroy() + { + base.Destroy(); + OnPortGeneration = null; + UIUtils.UnregisterFunctionInputNode( this ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + if( AutoCast ) + { + m_inputPorts[ 0 ].MatchPortToConnection(); + SetIntTypeFromPort(); + UpdatePorts(); + SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); + } + } + + public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); + if( AutoCast ) + { + m_inputPorts[ 0 ].MatchPortToConnection(); + SetIntTypeFromPort(); + UpdatePorts(); + SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); + } + } + + public void SetIntTypeFromPort() + { + switch( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.INT: m_selectedInputTypeInt = 0; break; + default: + case WirePortDataType.FLOAT: m_selectedInputTypeInt = 1; break; + case WirePortDataType.FLOAT2: m_selectedInputTypeInt = 2; break; + case WirePortDataType.FLOAT3: m_selectedInputTypeInt = 3; break; + case WirePortDataType.FLOAT4: m_selectedInputTypeInt = 4; break; + case WirePortDataType.COLOR: m_selectedInputTypeInt = 5; break; + case WirePortDataType.FLOAT3x3: m_selectedInputTypeInt = 6; break; + case WirePortDataType.FLOAT4x4: m_selectedInputTypeInt = 7; break; + case WirePortDataType.SAMPLER1D: m_selectedInputTypeInt = 8; break; + case WirePortDataType.SAMPLER2D: m_selectedInputTypeInt = 9; break; + case WirePortDataType.SAMPLER3D: m_selectedInputTypeInt = 10; break; + case WirePortDataType.SAMPLERCUBE: m_selectedInputTypeInt = 11; break; + case WirePortDataType.SAMPLER2DARRAY: m_selectedInputTypeInt = 12; break; + case WirePortDataType.SAMPLERSTATE: m_selectedInputTypeInt = 13; break; + case WirePortDataType.OBJECT: m_selectedInputTypeInt = 14; break; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + // Custom Editable Title + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + if( !m_isEditing && ( ( !ContainerGraph.ParentWindow.MouseInteracted && drawInfo.CurrentEventType == EventType.MouseDown && m_titleClickArea.Contains( drawInfo.MousePosition ) ) ) ) + { + if( ( EditorApplication.timeSinceStartup - m_clickTime ) < m_doubleClickTime ) + m_startEditing = true; + else + GUI.FocusControl( null ); + m_clickTime = EditorApplication.timeSinceStartup; + } + else if( m_isEditing && ( ( drawInfo.CurrentEventType == EventType.MouseDown && !m_titleClickArea.Contains( drawInfo.MousePosition ) ) || !EditorGUIUtility.editingTextField ) ) + { + m_stopEditing = true; + } + + if( m_isEditing || m_startEditing ) + { + EditorGUI.BeginChangeCheck(); + GUI.SetNextControlName( m_uniqueName ); + m_inputName = EditorGUITextField( m_titleClickArea, string.Empty, m_inputName, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); + if( EditorGUI.EndChangeCheck() ) + { + SetTitleText( m_inputName ); + UIUtils.UpdateFunctionInputData( UniqueId, m_inputName ); + } + + if( m_startEditing ) + EditorGUI.FocusTextInControl( m_uniqueName ); + + } + + if( drawInfo.CurrentEventType == EventType.Repaint ) + { + if( m_startEditing ) + { + m_startEditing = false; + m_isEditing = true; + } + + if( m_stopEditing ) + { + m_stopEditing = false; + m_isEditing = false; + GUI.FocusControl( null ); + } + } + + + } + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + // RUN LAYOUT CHANGES AFTER TITLES CHANGE + base.OnNodeLayout( drawInfo ); + m_titleClickArea = m_titlePos; + m_titleClickArea.height = Constants.NODE_HEADER_HEIGHT; + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + base.OnNodeRepaint( drawInfo ); + + if( !m_isVisible ) + return; + + // Fixed Title ( only renders when not editing ) + if( m_showTitleWhenNotEditing && !m_isEditing && !m_startEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + GUI.Label( m_titleClickArea, m_content, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); + } + } + + public override void OnNodeDoubleClicked( Vector2 currentMousePos2D ) + { + if( currentMousePos2D.y - m_globalPosition.y > ( Constants.NODE_HEADER_HEIGHT + Constants.NODE_HEADER_EXTRA_HEIGHT ) * ContainerGraph.ParentWindow.CameraDrawInfo.InvertedZoom ) + { + ContainerGraph.ParentWindow.ParametersWindow.IsMaximized = !ContainerGraph.ParentWindow.ParametersWindow.IsMaximized; + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUILayout.BeginVertical(); + EditorGUI.BeginChangeCheck(); + m_inputName = EditorGUILayoutTextField( "Name", m_inputName ); + if( EditorGUI.EndChangeCheck() ) + { + SetTitleText( m_inputName ); + UIUtils.UpdateFunctionInputData( UniqueId, m_inputName ); + } + EditorGUI.BeginChangeCheck(); + m_selectedInputTypeInt = EditorGUILayoutPopup( InputTypeStr, m_selectedInputTypeInt, m_inputValueTypes ); + if( EditorGUI.EndChangeCheck() ) + { + UpdatePorts(); + SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); + } + + m_autoCast = EditorGUILayoutToggle( "Auto Cast", m_autoCast ); + + EditorGUILayout.Separator(); + if( !m_inputPorts[ 0 ].IsConnected && m_inputPorts[ 0 ].ValidInternalData ) + { + m_inputPorts[ 0 ].ShowInternalData( this, true, "Default Value" ); + } + + + EditorGUILayout.EndVertical(); + } + + void UpdatePorts() + { + switch( m_selectedInputTypeInt ) + { + case 0: m_selectedInputType = WirePortDataType.INT; break; + default: + case 1: m_selectedInputType = WirePortDataType.FLOAT; break; + case 2: m_selectedInputType = WirePortDataType.FLOAT2; break; + case 3: m_selectedInputType = WirePortDataType.FLOAT3; break; + case 4: m_selectedInputType = WirePortDataType.FLOAT4; break; + case 5: m_selectedInputType = WirePortDataType.COLOR; break; + case 6: m_selectedInputType = WirePortDataType.FLOAT3x3; break; + case 7: m_selectedInputType = WirePortDataType.FLOAT4x4; break; + case 8: m_selectedInputType = WirePortDataType.SAMPLER1D; break; + case 9: m_selectedInputType = WirePortDataType.SAMPLER2D; break; + case 10: m_selectedInputType = WirePortDataType.SAMPLER3D; break; + case 11: m_selectedInputType = WirePortDataType.SAMPLERCUBE; break; + case 12: m_selectedInputType = WirePortDataType.SAMPLER2DARRAY; break; + case 13: m_selectedInputType = WirePortDataType.SAMPLERSTATE; break; + case 14: m_selectedInputType = WirePortDataType.OBJECT; break; + } + + ChangeInputType( m_selectedInputType, false ); + + //This node doesn't have any restrictions but changing types should be restricted to prevent invalid connections + m_outputPorts[ 0 ].ChangeTypeWithRestrictions( m_selectedInputType, PortCreateRestriction( m_selectedInputType ) ); + m_sizeIsDirty = true; + } + + public static int PortCreateRestriction( WirePortDataType dataType ) + { + int restrictions = 0; + WirePortDataType[] types = null; + switch( dataType ) + { + case WirePortDataType.OBJECT: + break; + case WirePortDataType.FLOAT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + case WirePortDataType.INT: + { + types = new WirePortDataType[] { WirePortDataType.FLOAT, WirePortDataType.FLOAT2, WirePortDataType.FLOAT3, WirePortDataType.FLOAT4, WirePortDataType.COLOR, WirePortDataType.INT, WirePortDataType.OBJECT }; + } + break; + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + types = new WirePortDataType[] { WirePortDataType.FLOAT3x3, WirePortDataType.FLOAT4x4, WirePortDataType.OBJECT }; + } + break; + case WirePortDataType.SAMPLER1D: + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.SAMPLER2DARRAY: + { + types = new WirePortDataType[] { WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.SAMPLER2DARRAY, WirePortDataType.OBJECT }; + } + break; + case WirePortDataType.SAMPLERSTATE: + { + types = new WirePortDataType[] { WirePortDataType.SAMPLERSTATE }; + } + break; + default: + break; + } + + if( types != null ) + { + for( int i = 0; i < types.Length; i++ ) + { + restrictions = restrictions | (int)types[ i ]; + } + } + + return restrictions; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + + string result = string.Empty; + if( OnPortGeneration != null ) + result = OnPortGeneration( ref dataCollector, m_orderIndex, ContainerGraph.ParentWindow.CustomGraph ); + else + result = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + if( m_outputPorts[ outputId ].ConnectionCount > 1 ) + RegisterLocalVariable( outputId, result, ref dataCollector ); + else + m_outputPorts[ outputId ].SetLocalValue( result, dataCollector.PortCategory ); + + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_inputName ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedInputTypeInt ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_orderIndex ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_autoCast ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_inputName = GetCurrentParam( ref nodeParams ); + m_selectedInputTypeInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_orderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_autoCast = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + + SetTitleText( m_inputName ); + UpdatePorts(); + SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + + SetTitleText( m_inputName ); + UpdatePorts(); + SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); + } + + public WirePortDataType SelectedInputType + { + get { return m_selectedInputType; } + } + + public string InputName + { + get { return m_inputName; } + } + + public int OrderIndex + { + get { return m_orderIndex; } + set { m_orderIndex = value; } + } + + public bool AutoCast + { + get { return m_autoCast; } + set { m_autoCast = value; } + } + + public FunctionNode Fnode + { + get { return m_functionNode; } + set { m_functionNode = value; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs.meta new file mode 100644 index 00000000..9849c1ae --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 64064ea01705e084cbe00a3bbeef2c3d +timeCreated: 1491927259 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs new file mode 100644 index 00000000..05906655 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs @@ -0,0 +1,1262 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +//#define ADD_SHADER_FUNCTION_HEADERS + +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Function Node", "Functions", "Function Node", KeyCode.None, false, 0, int.MaxValue, typeof( AmplifyShaderFunction ) )] + public class FunctionNode : ParentNode + { + [SerializeField] + private AmplifyShaderFunction m_function; + + [SerializeField] + private ParentGraph m_functionGraph; + + [SerializeField] + private int m_functionGraphId = -1; + + [SerializeField] + private List m_allFunctionInputs; + private Dictionary m_allFunctionInputsDict = new Dictionary(); + + [SerializeField] + private List m_allFunctionOutputs; + private Dictionary m_allFunctionOutputsDict = new Dictionary(); + + [SerializeField] + private List m_allFunctionSwitches; + private Dictionary m_allFunctionSwitchesDict = new Dictionary(); + + [SerializeField] + private ReordenatorNode m_reordenator; + + [SerializeField] + private string m_filename; + + [SerializeField] + private string m_headerTitle = string.Empty; + + [SerializeField] + private int m_orderIndex; + + [SerializeField] + private string m_functionCheckSum; + + [SerializeField] + private string m_functionGUID = string.Empty; + + //[SerializeField] + //private List m_includes = new List(); + + //[SerializeField] + //private List m_pragmas = new List(); + + [SerializeField] + private List m_directives = new List(); + + private bool m_parametersFoldout = true; + [SerializeField] + private ParentGraph m_outsideGraph = null; + + [SerializeField] + private FunctionOutput m_mainPreviewNode; + + bool m_portsChanged = false; + //[SerializeField] + bool m_initialGraphDraw = false; + + private bool m_refreshIdsRequired = false; + + public string[] ReadOptionsHelper = new string[] { }; + + private bool m_lateRefresh = false; + + private Texture2D m_headerIcon = null; + public Texture2D HeaderIcon + { + get + { + if ( m_headerIcon == null ) + { + m_headerIcon = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "5b59dcde73b12b746af7ff7c47a1195d" ) ); + } + return m_headerIcon; + } + } + public const int HeaderIconSize = 32; + + private Dictionary m_duplicatesBuffer = new Dictionary(); + string LastLine( string text ) + { + string[] lines = text.Replace( "\r", "" ).Split( '\n' ); + return lines[ lines.Length - 1 ]; + } + + public void CommonInit( AmplifyShaderFunction function, int uniqueId ) + { + SetBaseUniqueId( uniqueId ); + + if( function == null ) + return; + + m_refreshIdsRequired = UIUtils.IsLoading && ( UIUtils.CurrentShaderVersion() < 14004 ); + + m_function = function; + + if( Function.FunctionName.Length > 1 ) + { + SetTitleText( GraphContextMenu.AddSpacesToSentence( Function.FunctionName ) ); + } + else + { + SetTitleText( Function.FunctionName ); + } + m_tooltipText = Function.Description; + m_hasTooltipLink = false; + if( m_functionGraph == null ) + { + //m_functionGraph = new ParentGraph(); + m_functionGraph = CreateInstance(); + m_functionGraph.Init(); + m_functionGraph.ParentWindow = ContainerGraph.ParentWindow; + } + + if( string.IsNullOrEmpty( m_functionGUID ) ) + { + m_functionGUID = AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_function ) ); + } + + m_functionGraphId = Mathf.Max( m_functionGraphId, ContainerGraph.ParentWindow.GraphCount ); + ContainerGraph.ParentWindow.GraphCount = m_functionGraphId + 1; + m_functionGraph.SetGraphId( m_functionGraphId ); + + ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; + ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; + + AmplifyShaderEditorWindow.LoadFromMeta( ref m_functionGraph, ContainerGraph.ParentWindow.ContextMenuInstance, Function.FunctionInfo ); + //m_functionCheckSum = LastLine( m_function.FunctionInfo ); + m_functionCheckSum = AssetDatabase.GetAssetDependencyHash( AssetDatabase.GetAssetPath( m_function ) ).ToString(); + List propertyList = UIUtils.PropertyNodesList(); + m_allFunctionInputs = UIUtils.FunctionInputList(); + m_allFunctionOutputs = UIUtils.FunctionOutputList(); + m_allFunctionSwitches = UIUtils.FunctionSwitchList(); + + ContainerGraph.ParentWindow.CustomGraph = cachedGraph; + + m_allFunctionInputs.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + m_allFunctionOutputs.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + m_allFunctionSwitches.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + + int inputCount = m_allFunctionInputs.Count; + for( int i = 0; i < inputCount; i++ ) + { + if( m_refreshIdsRequired ) + { + AddInputPort( m_allFunctionInputs[ i ].SelectedInputType, false, m_allFunctionInputs[ i ].InputName ); + } + else + { + AddInputPort( m_allFunctionInputs[ i ].SelectedInputType, false, m_allFunctionInputs[ i ].InputName, -1, MasterNodePortCategory.Fragment, m_allFunctionInputs[ i ].UniqueId ); + } + InputPortSwitchRestriction( m_inputPorts[ i ] ); + + if( !m_allFunctionInputs[ i ].InputPorts[ 0 ].IsConnected ) + { + m_inputPorts[ i ].AutoDrawInternalData = true; + m_inputPorts[ i ].InternalData = m_allFunctionInputs[ i ].InputPorts[ 0 ].InternalData; + } + m_allFunctionInputs[ i ].Fnode = this; + } + + int outputCount = m_allFunctionOutputs.Count; + FunctionOutput first = null; + for( int i = 0; i < outputCount; i++ ) + { + if( i == 0 ) + first = m_allFunctionOutputs[ i ]; + + if( m_allFunctionOutputs[ i ].PreviewNode ) + { + m_mainPreviewNode = m_allFunctionOutputs[ i ]; + } + + if( m_refreshIdsRequired ) + { + AddOutputPort( m_allFunctionOutputs[ i ].AutoOutputType, m_allFunctionOutputs[ i ].OutputName ); + } + else + { + AddOutputPort( m_allFunctionOutputs[ i ].AutoOutputType, m_allFunctionOutputs[ i ].OutputName, m_allFunctionOutputs[ i ].UniqueId ); + } + OutputPortSwitchRestriction( m_outputPorts[ i ] ); + } + + // make sure to hide the ports properly + CheckPortVisibility(); + + if( m_mainPreviewNode == null ) + m_mainPreviewNode = first; + + //create reordenator to main graph + bool inside = false; + if( ContainerGraph.ParentWindow.CustomGraph != null ) + inside = true; + + if( /*hasConnectedProperties*/propertyList.Count > 0 ) + { + m_reordenator = ScriptableObject.CreateInstance(); + m_reordenator.Init( "_" + Function.FunctionName, Function.FunctionName, propertyList, false ); + m_reordenator.OrderIndex = m_orderIndex; + m_reordenator.HeaderTitle = Function.FunctionName; + m_reordenator.IsInside = inside; + } + + if( m_reordenator != null ) + { + cachedGraph = ContainerGraph.ParentWindow.CustomGraph; + ContainerGraph.ParentWindow.CustomGraph = null; + UIUtils.RegisterPropertyNode( m_reordenator ); + ContainerGraph.ParentWindow.CustomGraph = cachedGraph; + + if( inside ) + { + UIUtils.RegisterPropertyNode( m_reordenator ); + } + } + + UIUtils.RegisterFunctionNode( this ); + + RefreshUIHeaderColor(); + + m_previewShaderGUID = "aca70c900c50c004e8ef0b47c4fac4d4"; + m_useInternalPortData = false; + m_selectedLocation = function.PreviewPosition; + UIUtils.CurrentWindow.OutsideGraph.OnLODMasterNodesAddedEvent += OnLODMasterNodesAddedEvent; + } + + public InputPort GetInput( FunctionInput input ) + { + int index = m_allFunctionInputs.FindIndex( ( x ) => { return x.Equals( input ); } ); + if( index >= 0 ) + return InputPorts[ index ]; + else + return null; + } + + private void OnLODMasterNodesAddedEvent( int lod ) + { + AddShaderFunctionDirectivesInternal( lod ); + } + + public void SetPreviewInput( InputPort input ) + { + if( !HasPreviewShader || !m_initialized ) + return; + + if( input.IsConnected && input.InputNodeHasPreview( ContainerGraph ) ) + { + input.SetPreviewInputTexture( ContainerGraph ); + } + else + { + input.SetPreviewInputValue( ContainerGraph ); + } + } + + public override bool RecursivePreviewUpdate( Dictionary duplicatesDict = null ) + { + if( duplicatesDict == null ) + { + duplicatesDict = ContainerGraph.ParentWindow.VisitedChanged; + } + + if( m_allFunctionOutputs == null || m_allFunctionOutputs.Count == 0 ) + return false; + + for( int i = 0; i < m_allFunctionOutputs.Count; i++ ) + { + ParentNode outNode = m_allFunctionOutputs[ i ]; + if( outNode != null ) + { + if( !duplicatesDict.ContainsKey( outNode.OutputId ) ) + { + bool result = outNode.RecursivePreviewUpdate(); + if( result ) + PreviewIsDirty = true; + } + else if( duplicatesDict[ outNode.OutputId ] ) + { + PreviewIsDirty = true; + } + } + } + + bool needsUpdate = PreviewIsDirty; + RenderNodePreview(); + if( !duplicatesDict.ContainsKey( OutputId ) ) + duplicatesDict.Add( OutputId, needsUpdate ); + return needsUpdate; + } + + public override void RenderNodePreview() + { + if( m_outputPorts == null ) + return; + + if( !PreviewIsDirty && !m_continuousPreviewRefresh ) + return; + + // this is in the wrong place?? + if( m_drawPreviewAsSphere != m_mainPreviewNode.SpherePreview ) + { + m_drawPreviewAsSphere = m_mainPreviewNode.SpherePreview; + OnNodeChange(); + } + + int count = m_outputPorts.Count; + for( int i = 0; i < count; i++ ) + { + m_outputPorts[ i ].OutputPreviewTexture = m_allFunctionOutputs[ i ].PreviewTexture; + } + + if( PreviewIsDirty ) + FinishPreviewRender = true; + + PreviewIsDirty = false; + } + + public override RenderTexture PreviewTexture + { + get + { + if( m_mainPreviewNode != null ) + return m_mainPreviewNode.PreviewTexture; + else + return base.PreviewTexture; + } + } + + private void AddShaderFunctionDirectivesInternal( int lod ) + { + List nodes = ContainerGraph.ParentWindow.OutsideGraph.GetMultiPassMasterNodes( lod ); + int count = nodes.Count; + for( int i = 0; i < count; i++ ) + { + nodes[ i ].PassModule.AdditionalDirectives.AddShaderFunctionItems( OutputId, Function.AdditionalDirectives.DirectivesList ); + } + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( Function == null ) + return; + + //Debug.Log( "RefreshExternalReferences " + m_function.FunctionName + " " + UIUtils.CurrentWindow.IsShaderFunctionWindow ); + + Function.UpdateDirectivesList(); + + MasterNode masterNode = UIUtils.CurrentWindow.OutsideGraph.CurrentMasterNode; + StandardSurfaceOutputNode surface = masterNode as StandardSurfaceOutputNode; + + + + if( surface != null ) + { + //for( int i = 0; i < Function.AdditionalIncludes.IncludeList.Count; i++ ) + //{ + // //ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalIncludes.OutsideList.Add( Function.AdditionalIncludes.IncludeList[ i ] ); + // ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.AddShaderFunctionItem( AdditionalLineType.Include, Function.AdditionalIncludes.IncludeList[ i ] ); + // m_includes.Add( Function.AdditionalIncludes.IncludeList[ i ] ); + //} + + //for( int i = 0; i < Function.AdditionalPragmas.PragmaList.Count; i++ ) + //{ + // //ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalPragmas.OutsideList.Add( Function.AdditionalPragmas.PragmaList[ i ] ); + // ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.AddShaderFunctionItem(AdditionalLineType.Pragma, Function.AdditionalPragmas.PragmaList[ i ] ); + // m_pragmas.Add( Function.AdditionalPragmas.PragmaList[ i ] ); + //} + surface.AdditionalDirectives.AddShaderFunctionItems( OutputId, Function.AdditionalDirectives.DirectivesList ); + } + else + { + if( ContainerGraph.ParentWindow.OutsideGraph.MultiPassMasterNodes.Count > 0 ) + { + for( int lod = -1; lod < ContainerGraph.ParentWindow.OutsideGraph.LodMultiPassMasternodes.Count; lod++ ) + { + AddShaderFunctionDirectivesInternal( lod ); + } + } + else + { + // Assuring that we're not editing a Shader Function, as directives setup is not needed there + if( !UIUtils.CurrentWindow.IsShaderFunctionWindow ) + { + // This function is nested inside a shader function itself and this method + // was called before the main output node was created. + // This is possible since all nodes RefreshExternalReferences(...) are called at the end + // of a LoadFromMeta + // Need to delay this setup to after all nodes are loaded to then setup the directives + m_lateRefresh = true; + return; + } + } + + } + m_directives.AddRange( Function.AdditionalDirectives.DirectivesList ); + + if( m_refreshIdsRequired ) + { + m_refreshIdsRequired = false; + int inputCount = m_inputPorts.Count; + for( int i = 0; i < inputCount; i++ ) + { + m_inputPorts[ i ].ChangePortId( m_allFunctionInputs[ i ].UniqueId ); + } + + int outputCount = m_outputPorts.Count; + for( int i = 0; i < outputCount; i++ ) + { + m_outputPorts[ i ].ChangePortId( m_allFunctionOutputs[ i ].UniqueId ); + } + } + + if( ContainerGraph.ParentWindow.CurrentGraph != m_functionGraph ) + ContainerGraph.ParentWindow.CurrentGraph.InstancePropertyCount += m_functionGraph.InstancePropertyCount; + + ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; + ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; + + if( ReadOptionsHelper.Length > 2 ) + { + for( int i = 1; i < ReadOptionsHelper.Length; i += 2 ) + { + int optionId = Convert.ToInt32( ReadOptionsHelper[ i ] ); + int optionValue = Convert.ToInt32( ReadOptionsHelper[ i + 1 ] ); + for( int j = 0; j < m_allFunctionSwitches.Count; j++ ) + { + if( m_allFunctionSwitches[ j ].UniqueId == optionId ) + { + m_allFunctionSwitches[ j ].SetCurrentSelectedInput( optionValue, m_allFunctionSwitches[ j ].GetCurrentSelectedInput() ); + break; + } + } + } + } + + ContainerGraph.ParentWindow.CustomGraph = cachedGraph; + + m_portsChanged = true; + } + + void InputPortSwitchRestriction( WirePort port ) + { + switch( port.DataType ) + { + case WirePortDataType.OBJECT: + break; + case WirePortDataType.FLOAT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + case WirePortDataType.INT: + { + port.CreatePortRestrictions( WirePortDataType.FLOAT, WirePortDataType.FLOAT2, WirePortDataType.FLOAT3, WirePortDataType.FLOAT4, WirePortDataType.COLOR, WirePortDataType.INT, WirePortDataType.OBJECT ); + } + break; + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + port.CreatePortRestrictions( WirePortDataType.FLOAT3x3, WirePortDataType.FLOAT4x4, WirePortDataType.OBJECT ); + } + break; + case WirePortDataType.SAMPLER1D: + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.SAMPLER2DARRAY: + { + port.CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.SAMPLER2DARRAY, WirePortDataType.OBJECT ); + } + break; + case WirePortDataType.SAMPLERSTATE: + { + port.CreatePortRestrictions( WirePortDataType.SAMPLERSTATE ); + } + break; + default: + break; + } + } + + void OutputPortSwitchRestriction( WirePort port ) + { + switch( port.DataType ) + { + case WirePortDataType.OBJECT: + break; + case WirePortDataType.FLOAT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + case WirePortDataType.INT: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + port.AddPortForbiddenTypes( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.SAMPLER2DARRAY ); + } + break; + case WirePortDataType.SAMPLER1D: + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.SAMPLER2DARRAY: + { + port.CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.SAMPLER2DARRAY, WirePortDataType.OBJECT ); + } + break; + case WirePortDataType.SAMPLERSTATE: + { + port.CreatePortRestrictions( WirePortDataType.SAMPLERSTATE ); + } + break; + default: + break; + } + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; + m_outsideGraph = cachedGraph; + ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; + + for( int i = 0; i < m_allFunctionOutputs.Count; i++ ) + { + m_allFunctionOutputs[ i ].PropagateNodeData( nodeData, ref dataCollector ); + } + + ContainerGraph.ParentWindow.CustomGraph = cachedGraph; + + base.PropagateNodeData( nodeData, ref dataCollector ); + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + UIUtils.RegisterFunctionNode( this ); + } + + public override void SetupFromCastObject( UnityEngine.Object obj ) + { + base.SetupFromCastObject( obj ); + AmplifyShaderFunction function = obj as AmplifyShaderFunction; + CommonInit( function, UniqueId ); + RefreshExternalReferences(); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + FunctionInput functionInput = m_refreshIdsRequired ? m_allFunctionInputs[ portId ] : GetFunctionInputByUniqueId( portId ); + functionInput.PreviewIsDirty = true; + if( functionInput.AutoCast ) + { + InputPort inputPort = m_refreshIdsRequired ? m_inputPorts[ portId ] : GetInputPortByUniqueId( portId ); + inputPort.MatchPortToConnection(); + + ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; + ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; + functionInput.ChangeOutputType( inputPort.DataType, false ); + ContainerGraph.ParentWindow.CustomGraph = cachedGraph; + } + + for( int i = 0; i < m_allFunctionOutputs.Count; i++ ) + { + m_outputPorts[ i ].ChangeType( m_allFunctionOutputs[ i ].InputPorts[ 0 ].DataType, false ); + } + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + + FunctionInput functionInput = m_refreshIdsRequired ? m_allFunctionInputs[ portId ] : GetFunctionInputByUniqueId( portId ); + functionInput.PreviewIsDirty = true; + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); + FunctionInput functionInput = m_refreshIdsRequired ? m_allFunctionInputs[ inputPortId ] : GetFunctionInputByUniqueId( inputPortId ); + functionInput.PreviewIsDirty = true; + if( functionInput.AutoCast ) + { + InputPort inputPort = m_refreshIdsRequired ? m_inputPorts[ inputPortId ] : GetInputPortByUniqueId( inputPortId ); + inputPort.MatchPortToConnection(); + + ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; + ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; + functionInput.ChangeOutputType( inputPort.DataType, false ); + ContainerGraph.ParentWindow.CustomGraph = cachedGraph; + } + + for( int i = 0; i < m_allFunctionOutputs.Count; i++ ) + { + m_outputPorts[ i ].ChangeType( m_allFunctionOutputs[ i ].InputPorts[ 0 ].DataType, false ); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + + if( Function == null ) + return; + + if( Function.Description.Length > 0 || m_allFunctionSwitches.Count > 0 ) + NodeUtils.DrawPropertyGroup( ref m_parametersFoldout, "Parameters", DrawDescription ); + + bool drawInternalDataUI = false; + int inputCount = m_inputPorts.Count; + if( inputCount > 0 ) + { + for( int i = 0; i < inputCount; i++ ) + { + if( m_inputPorts[ i ].Available && m_inputPorts[ i ].ValidInternalData && !m_inputPorts[ i ].IsConnected && m_inputPorts[ i ].AutoDrawInternalData /*&& ( m_inputPorts[ i ].AutoDrawInternalData || ( m_autoDrawInternalPortData && m_useInternalPortData ) )*/ /*&& m_inputPorts[ i ].AutoDrawInternalData*/ ) + { + drawInternalDataUI = true; + break; + } + } + } + + if( drawInternalDataUI ) + NodeUtils.DrawPropertyGroup( ref m_internalDataFoldout, Constants.InternalDataLabelStr, () => + { + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].ValidInternalData && !m_inputPorts[ i ].IsConnected && m_inputPorts[ i ].Visible && m_inputPorts[ i ].AutoDrawInternalData ) + { + EditorGUI.BeginChangeCheck(); + m_inputPorts[ i ].ShowInternalData( this ); + if( EditorGUI.EndChangeCheck() ) + { + m_allFunctionInputs[ i ].PreviewIsDirty = true; + } + } + } + } ); + } + + private void DrawDescription() + { + if( Function.Description.Length > 0 ) + EditorGUILayout.HelpBox( Function.Description, MessageType.Info ); + + ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; + ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; + for( int i = 0; i < m_allFunctionSwitches.Count; i++ ) + { + m_allFunctionSwitches[ i ].AsDrawn = false; + } + + for( int i = 0; i < m_allFunctionSwitches.Count; i++ ) + { + if( m_allFunctionSwitches[ i ].DrawOption( this ) ) + { + m_portsChanged = true; + } + } + ContainerGraph.ParentWindow.CustomGraph = cachedGraph; + } + + private void RemoveShaderFunctionDirectivesInternal( int lod ) + { + List nodes = ContainerGraph.ParentWindow.OutsideGraph.GetMultiPassMasterNodes( lod ); + int count = nodes.Count; + for( int i = 0; i < count; i++ ) + { + nodes[ i ].PassModule.AdditionalDirectives.RemoveShaderFunctionItems( OutputId ); + } + } + + public override void Destroy() + { + m_mainPreviewNode = null; + base.Destroy(); + + m_duplicatesBuffer.Clear(); + m_duplicatesBuffer = null; + + if( m_functionGraph != null && ContainerGraph.ParentWindow.CurrentGraph != m_functionGraph ) + ContainerGraph.ParentWindow.CurrentGraph.InstancePropertyCount -= m_functionGraph.InstancePropertyCount; + + if( ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface != null ) + { + //for( int i = 0; i < m_includes.Count; i++ ) + //{ + // //if( ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalIncludes.OutsideList.Contains( m_includes[ i ] ) ) + // //{ + // // ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalIncludes.OutsideList.Remove( m_includes[ i ] ); + // //} + // ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.RemoveShaderFunctionItem( AdditionalLineType.Include, m_includes[ i ] ); + //} + + //for( int i = 0; i < m_pragmas.Count; i++ ) + //{ + // //if( ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalPragmas.OutsideList.Contains( m_pragmas[ i ] ) ) + // //{ + // // ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalPragmas.OutsideList.Remove( m_pragmas[ i ] ); + // //} + // ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.RemoveShaderFunctionItem( AdditionalLineType.Pragma, m_pragmas[ i ] ); + //} + ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.RemoveShaderFunctionItems( OutputId/*, m_directives */); + } + else + { + if( ContainerGraph.ParentWindow.OutsideGraph.MultiPassMasterNodes.Count > 0 ) + { + for( int lod = -1; lod < ContainerGraph.ParentWindow.OutsideGraph.LodMultiPassMasternodes.Count; lod++ ) + { + RemoveShaderFunctionDirectivesInternal( lod ); + } + } + } + + + + + // Cannot GameObject.Destroy(m_directives[i]) since we would be removing them from + // the shader function asset itself + + m_directives.Clear(); + m_directives = null; + + if( m_reordenator != null ) + { + ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; + ContainerGraph.ParentWindow.CustomGraph = null; + UIUtils.UnregisterPropertyNode( m_reordenator ); + ContainerGraph.ParentWindow.CustomGraph = cachedGraph; + + m_reordenator.Destroy(); + m_reordenator = null; + } + + UIUtils.UnregisterFunctionNode( this ); + + ParentGraph cachedGraph2 = ContainerGraph.ParentWindow.CustomGraph; + ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; + + if( m_allFunctionInputs != null ) + m_allFunctionInputs.Clear(); + m_allFunctionInputs = null; + + if( m_allFunctionOutputs != null ) + m_allFunctionOutputs.Clear(); + m_allFunctionOutputs = null; + + if( m_functionGraph != null ) + m_functionGraph.SoftDestroy(); + m_functionGraph = null; + + ContainerGraph.ParentWindow.CustomGraph = cachedGraph2; + m_function = null; + + m_allFunctionOutputsDict.Clear(); + m_allFunctionOutputsDict = null; + + m_allFunctionSwitchesDict.Clear(); + m_allFunctionSwitchesDict = null; + + m_allFunctionInputsDict.Clear(); + m_allFunctionInputsDict = null; + + UIUtils.CurrentWindow.OutsideGraph.OnLODMasterNodesAddedEvent -= OnLODMasterNodesAddedEvent; + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + if( m_lateRefresh ) + { + m_lateRefresh = false; + RefreshExternalReferences(); + } + + CheckForChangesRecursively(); + + base.OnNodeLogicUpdate( drawInfo ); + ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; + ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; + + if( m_functionGraph != null ) + { + int nodeCount = m_functionGraph.AllNodes.Count; + for( int i = 0; i < nodeCount; i++ ) + { + m_functionGraph.AllNodes[ i ].OnNodeLogicUpdate( drawInfo ); + } + + //if( !string.IsNullOrEmpty( FunctionGraph.CurrentFunctionOutput.SubTitle ) ) + { + SetAdditonalTitleText( FunctionGraph.CurrentFunctionOutput.SubTitle ); + } + } + + ContainerGraph.ParentWindow.CustomGraph = cachedGraph; + if( m_portsChanged ) + { + m_portsChanged = false; + for( int i = 0; i < m_allFunctionOutputs.Count; i++ ) + { + m_outputPorts[ i ].ChangeType( m_allFunctionOutputs[ i ].InputPorts[ 0 ].DataType, false ); + } + + CheckPortVisibility(); + } + } + + public override void Draw( DrawInfo drawInfo ) + { + //CheckForChangesRecursively(); + + if( !m_initialGraphDraw && drawInfo.CurrentEventType == EventType.Repaint ) + { + m_initialGraphDraw = true; + ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; + ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; + if( m_functionGraph != null ) + { + for( int i = 0; i < m_functionGraph.AllNodes.Count; i++ ) + { + ParentNode node = m_functionGraph.AllNodes[ i ]; + if( node != null ) + { + node.OnNodeLayout( drawInfo ); + } + } + } + ContainerGraph.ParentWindow.CustomGraph = cachedGraph; + } + + base.Draw( drawInfo ); + } + + public bool CheckForChanges( bool forceCheck = false, bool forceChange = false ) + { + if( ( ContainerGraph.ParentWindow.CheckFunctions || forceCheck || forceChange ) && m_function != null ) + { + //string newCheckSum = LastLine( m_function.FunctionInfo ); + string newCheckSum = AssetDatabase.GetAssetDependencyHash( AssetDatabase.GetAssetPath( m_function ) ).ToString(); + if( !m_functionCheckSum.Equals( newCheckSum ) || forceChange ) + { + m_functionCheckSum = newCheckSum; + ContainerGraph.OnDuplicateEvent += DuplicateMe; + return true; + } + } + return false; + } + + public bool CheckForChangesRecursively() + { + if( m_functionGraph == null ) + return false; + + bool result = false; + for( int i = 0; i < m_functionGraph.FunctionNodes.NodesList.Count; i++ ) + { + if( m_functionGraph.FunctionNodes.NodesList[ i ].CheckForChangesRecursively() ) + result = true; + } + if( CheckForChanges( false, result ) ) + result = true; + + return result; + } + + public void DuplicateMe() + { + bool previewOpen = m_showPreview; + + string allOptions = m_allFunctionSwitches.Count.ToString(); + for( int i = 0; i < m_allFunctionSwitches.Count; i++ ) + { + allOptions += "," + m_allFunctionSwitches[ i ].UniqueId + "," + m_allFunctionSwitches[ i ].GetCurrentSelectedInput(); + } + + ReadOptionsHelper = allOptions.Split( ',' ); + + ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; + ContainerGraph.ParentWindow.CustomGraph = null; + MasterNode masterNode = ContainerGraph.ParentWindow.CurrentGraph.CurrentMasterNode; + if( masterNode != null ) + masterNode.InvalidateMaterialPropertyCount(); + + ContainerGraph.ParentWindow.CustomGraph = cachedGraph; + + ParentNode newNode = ContainerGraph.CreateNode( m_function, false, Vec2Position ); + newNode.ShowPreview = previewOpen; + ( newNode as FunctionNode ).ReadOptionsHelper = ReadOptionsHelper; + newNode.RefreshExternalReferences(); + if( ( newNode as FunctionNode ).m_reordenator && m_reordenator ) + ( newNode as FunctionNode ).m_reordenator.OrderIndex = m_reordenator.OrderIndex; + + for( int i = 0; i < m_outputPorts.Count; i++ ) + { + if( m_outputPorts[ i ].IsConnected ) + { + OutputPort newOutputPort = newNode.GetOutputPortByUniqueId( m_outputPorts[ i ].PortId ); + if( newNode.OutputPorts != null && newOutputPort != null ) + { + for( int j = m_outputPorts[ i ].ExternalReferences.Count - 1; j >= 0; j-- ) + { + ContainerGraph.CreateConnection( m_outputPorts[ i ].ExternalReferences[ j ].NodeId, m_outputPorts[ i ].ExternalReferences[ j ].PortId, newOutputPort.NodeId, newOutputPort.PortId ); + } + } + } + //else + //{ + //if( newNode.OutputPorts != null && newNode.OutputPorts[ i ] != null ) + //{ + // ContainerGraph.DeleteConnection( false, newNode.UniqueId, newNode.OutputPorts[ i ].PortId, false, false, false ); + //} + //} + } + + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + InputPort newInputPort = newNode.GetInputPortByUniqueId( m_inputPorts[ i ].PortId ); + if( newNode.InputPorts != null && newInputPort != null ) + { + ContainerGraph.CreateConnection( newInputPort.NodeId, newInputPort.PortId, m_inputPorts[ i ].ExternalReferences[ 0 ].NodeId, m_inputPorts[ i ].ExternalReferences[ 0 ].PortId ); + } + } + } + + ContainerGraph.OnDuplicateEvent -= DuplicateMe; + + if( Selected ) + { + ContainerGraph.DeselectNode( this ); + ContainerGraph.SelectNode( newNode, true, false ); + } + + ContainerGraph.DestroyNode( this, false ); + } + + private FunctionOutput GetFunctionOutputByUniqueId( int uniqueId ) + { + int listCount = m_allFunctionOutputs.Count; + if( m_allFunctionOutputsDict.Count != m_allFunctionOutputs.Count ) + { + m_allFunctionOutputsDict.Clear(); + for( int i = 0; i < listCount; i++ ) + { + m_allFunctionOutputsDict.Add( m_allFunctionOutputs[ i ].UniqueId, m_allFunctionOutputs[ i ] ); + } + } + + if( m_allFunctionOutputsDict.ContainsKey( uniqueId ) ) + return m_allFunctionOutputsDict[ uniqueId ]; + + return null; + } + + private FunctionInput GetFunctionInputByUniqueId( int uniqueId ) + { + int listCount = m_allFunctionInputs.Count; + if( m_allFunctionInputsDict.Count != m_allFunctionInputs.Count ) + { + m_allFunctionInputsDict.Clear(); + for( int i = 0; i < listCount; i++ ) + { + m_allFunctionInputsDict.Add( m_allFunctionInputs[ i ].UniqueId, m_allFunctionInputs[ i ] ); + } + } + + if( m_allFunctionInputsDict.ContainsKey( uniqueId ) ) + return m_allFunctionInputsDict[ uniqueId ]; + + return null; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + OutputPort outputPort = GetOutputPortByUniqueId( outputId ); + FunctionOutput functionOutput = GetFunctionOutputByUniqueId( outputId ); + + if( outputPort.IsLocalValue( dataCollector.PortCategory ) ) + return outputPort.LocalValue( dataCollector.PortCategory ); + + m_functionGraph.CurrentPrecision = ContainerGraph.ParentWindow.CurrentGraph.CurrentPrecision; + ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; + m_outsideGraph = cachedGraph; + ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; +#if ADD_SHADER_FUNCTION_HEADERS + if( m_reordenator != null && m_reordenator.RecursiveCount() > 0 && m_reordenator.HasTitle ) + { + dataCollector.AddToProperties( UniqueId, "[Header(" + m_reordenator.HeaderTitle.Replace( "-", " " ) + ")]", m_reordenator.OrderIndex ); + } +#endif + string result = string.Empty; + for( int i = 0; i < m_allFunctionInputs.Count; i++ ) + { + if( !m_allFunctionInputs[ i ].InputPorts[ 0 ].IsConnected || m_inputPorts[ i ].IsConnected ) + m_allFunctionInputs[ i ].OnPortGeneration += FunctionNodeOnPortGeneration; + } + + result += functionOutput.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + + for( int i = 0; i < m_allFunctionInputs.Count; i++ ) + { + if( !m_allFunctionInputs[ i ].InputPorts[ 0 ].IsConnected || m_inputPorts[ i ].IsConnected ) + m_allFunctionInputs[ i ].OnPortGeneration -= FunctionNodeOnPortGeneration; + } + + ContainerGraph.ParentWindow.CustomGraph = cachedGraph; + + if( outputPort.ConnectionCount > 1 ) + RegisterLocalVariable( outputId, result, ref dataCollector ); + else + outputPort.SetLocalValue( result, dataCollector.PortCategory ); + + return outputPort.LocalValue( dataCollector.PortCategory ); + } + + private string FunctionNodeOnPortGeneration( ref MasterNodeDataCollector dataCollector, int index, ParentGraph graph ) + { + ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; + ContainerGraph.ParentWindow.CustomGraph = m_outsideGraph; + string result = m_inputPorts[ index ].GeneratePortInstructions( ref dataCollector ); + ContainerGraph.ParentWindow.CustomGraph = cachedGraph; + return result; + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + + if( Function != null ) + IOUtils.AddFieldValueToString( ref nodeInfo, m_function.name ); + else + IOUtils.AddFieldValueToString( ref nodeInfo, m_filename ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_reordenator != null ? m_reordenator.RawOrderIndex : -1 ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_headerTitle ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_functionGraphId ); + IOUtils.AddFieldValueToString( ref nodeInfo, AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_function ) ) ); + + int functionSwitchCount = m_allFunctionSwitches != null ? m_allFunctionSwitches.Count : 0; + string allOptions = functionSwitchCount.ToString(); + for( int i = 0; i < functionSwitchCount; i++ ) + { + allOptions += "," + m_allFunctionSwitches[ i ].UniqueId + "," + m_allFunctionSwitches[ i ].GetCurrentSelectedInput(); + } + IOUtils.AddFieldValueToString( ref nodeInfo, allOptions ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_filename = GetCurrentParam( ref nodeParams ); + m_orderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_headerTitle = GetCurrentParam( ref nodeParams ); + + if( UIUtils.CurrentShaderVersion() > 7203 ) + { + m_functionGraphId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 13704 ) + { + m_functionGUID = GetCurrentParam( ref nodeParams ); + } + + AmplifyShaderFunction loaded = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( m_functionGUID ) ); + if( loaded != null ) + { + CommonInit( loaded, UniqueId ); + } + else + { + string[] guids = AssetDatabase.FindAssets( "t:AmplifyShaderFunction " + m_filename ); + if( guids.Length > 0 ) + { + string sfGuid = null; + + foreach( string guid in guids ) + { + string assetPath = AssetDatabase.GUIDToAssetPath( guid ); + string name = System.IO.Path.GetFileNameWithoutExtension( assetPath ); + if( name.Equals( m_filename, StringComparison.OrdinalIgnoreCase ) ) + { + sfGuid = guid; + break; + } + } + loaded = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( sfGuid ) ); + + if( loaded != null ) + { + CommonInit( loaded, UniqueId ); + } + else + { + SetTitleText( "ERROR" ); + UIUtils.ShowMessage( UniqueId, string.Format( "Error loading {0} shader function from project folder", m_filename ), MessageSeverity.Error ); + } + } + else + { + SetTitleText( "Missing Function" ); + UIUtils.ShowMessage( UniqueId, string.Format( "Missing {0} shader function on project folder", m_filename ), MessageSeverity.Error ); + } + } + if( UIUtils.CurrentShaderVersion() > 14203 ) + { + ReadOptionsHelper = GetCurrentParam( ref nodeParams ).Split( ',' ); + } + } + + public override void ReadOutputDataFromString( ref string[] nodeParams ) + { + if( Function == null ) + return; + + base.ReadOutputDataFromString( ref nodeParams ); + + ConfigureInputportsAfterRead(); + } + + public override void OnNodeDoubleClicked( Vector2 currentMousePos2D ) + { + if( Function == null ) + return; + + ContainerGraph.DeSelectAll(); + this.Selected = true; + + ContainerGraph.ParentWindow.OnLeftMouseUp(); + AmplifyShaderEditorWindow.LoadShaderFunctionToASE( Function, true ); + this.Selected = false; + } + + private void ConfigureInputportsAfterRead() + { + if( InputPorts != null ) + { + int inputCount = InputPorts.Count; + for( int i = 0; i < inputCount; i++ ) + { + InputPorts[ i ].ChangeProperties( m_allFunctionInputs[ i ].InputName, m_allFunctionInputs[ i ].SelectedInputType, false ); + } + } + + if( OutputPorts != null ) + { + int outputCount = OutputPorts.Count; + for( int i = 0; i < outputCount; i++ ) + { + OutputPorts[ i ].ChangeProperties( m_allFunctionOutputs[ i ].OutputName, m_allFunctionOutputs[ i ].AutoOutputType, false ); + } + } + } + + private void CheckPortVisibility() + { + bool changes = false; + if( InputPorts != null ) + { + for( int i = 0; i < m_allFunctionInputs.Count; i++ ) + { + if( m_inputPorts[ i ].Visible != m_allFunctionInputs[ i ].IsConnected ) + { + m_inputPorts[ i ].Visible = m_allFunctionInputs[ i ].IsConnected; + changes = true; + } + } + } + + if( changes ) + m_sizeIsDirty = true; + } + + public bool HasProperties { get { return m_reordenator != null; } } + + public ParentGraph FunctionGraph + { + get { return m_functionGraph; } + set { m_functionGraph = value; } + } + + public AmplifyShaderFunction Function + { + get { return m_function; } + set { m_function = value; } + } + + public override void RecordObjectOnDestroy( string Id ) + { + base.RecordObjectOnDestroy( Id ); + if( m_reordenator != null ) + m_reordenator.RecordObject( Id ); + + if( m_functionGraph != null ) + { + UndoUtils.RegisterCompleteObjectUndo( m_functionGraph, Id ); + for( int i = 0; i < m_functionGraph.AllNodes.Count; i++ ) + { + m_functionGraph.AllNodes[ i ].RecordObject( Id ); + } + } + } + + public override void SetContainerGraph( ParentGraph newgraph ) + { + base.SetContainerGraph( newgraph ); + if( m_functionGraph == null ) + return; + for( int i = 0; i < m_functionGraph.AllNodes.Count; i++ ) + { + m_functionGraph.AllNodes[ i ].SetContainerGraph( m_functionGraph ); + } + } + + public override void OnMasterNodeReplaced( MasterNode newMasterNode ) + { + base.OnMasterNodeReplaced( newMasterNode ); + if( m_functionGraph == null ) + return; + + m_functionGraph.FireMasterNodeReplacedEvent( newMasterNode ); + + StandardSurfaceOutputNode surface = newMasterNode as StandardSurfaceOutputNode; + if( surface != null ) + { + surface.AdditionalDirectives.AddShaderFunctionItems( OutputId, Function.AdditionalDirectives.DirectivesList ); + } + else + { + if( ContainerGraph.ParentWindow.OutsideGraph.MultiPassMasterNodes.Count > 0 ) + { + for( int lod = -1; lod < ContainerGraph.ParentWindow.OutsideGraph.LodMultiPassMasternodes.Count; lod++ ) + { + AddShaderFunctionDirectivesInternal( lod ); + } + } + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs.meta new file mode 100644 index 00000000..2473196a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7b3de46feda5b0f4ea58c852c4a521a9 +timeCreated: 1492001141 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs new file mode 100644 index 00000000..baa49631 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs @@ -0,0 +1,318 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Function Output", "Functions", "Function Output adds an output port to the shader function, it's port type is determined automatically.", NodeAvailabilityFlags = (int)NodeAvailability.ShaderFunction )] + public sealed class FunctionOutput : OutputNode + { + public FunctionOutput() : base() { CommonInit(); } + public FunctionOutput( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { CommonInit(); } + + [SerializeField] + private bool m_previewNode = false; + + [SerializeField] + private string m_outputName = "Output"; + + [SerializeField] + private int m_orderIndex = -1; + + [SerializeField] + private AmplifyShaderFunction m_function; + + //Title editing + [SerializeField] + private string m_uniqueName; + + private bool m_isEditing; + private bool m_stopEditing; + private bool m_startEditing; + private double m_clickTime; + private double m_doubleClickTime = 0.3; + private Rect m_titleClickArea; + private bool m_showTitleWhenNotEditing = true; + + [SerializeField] + private string m_subTitle = string.Empty; + + + void CommonInit() + { + m_isMainOutputNode = false; + m_connStatus = NodeConnectionStatus.Connected; + m_activeType = GetType(); + m_currentPrecisionType = PrecisionType.Inherit; + m_textLabelWidth = 100; + m_autoWrapProperties = true; + AddInputPort( WirePortDataType.FLOAT, false, " " ); + AddOutputPort( WirePortDataType.FLOAT, " " ); + m_outputPorts[ 0 ].Visible = false; + SetTitleText( m_outputName ); + m_previewShaderGUID = "e6d5f64114b18e24f99dc65290c0fe98"; + } + + public override void SetupNodeCategories() + { + //base.SetupNodeCategories(); + ContainerGraph.ResetNodesData(); + MasterNode masterNode = ContainerGraph.ParentWindow.CurrentGraph.CurrentMasterNode; + if( masterNode != null ) + { + int count = m_inputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + NodeData nodeData = new NodeData( m_inputPorts[ i ].Category ); + ParentNode node = m_inputPorts[ i ].GetOutputNode(); + MasterNodeDataCollector temp = masterNode.CurrentDataCollector; + node.PropagateNodeData( nodeData, ref temp ); + temp = null; + } + } + } + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + UIUtils.RegisterFunctionOutputNode( this ); + if( m_nodeAttribs != null ) + m_uniqueName = m_nodeAttribs.Name + UniqueId; + } + + + public override void Destroy() + { + base.Destroy(); + UIUtils.UnregisterFunctionOutputNode( this ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_outputName = EditorGUILayoutTextField( "Name", m_outputName ); + + if( EditorGUI.EndChangeCheck() ) + { + SetTitleText( m_outputName ); + UIUtils.UpdateFunctionOutputData( UniqueId, m_outputName ); + } + + EditorGUI.BeginDisabledGroup( m_previewNode ); + if( GUILayout.Button( "Set as Preview" ) ) + { + List allOutputs = UIUtils.FunctionOutputList(); + + foreach( FunctionOutput item in allOutputs ) + item.PreviewNode = false; + + m_previewNode = true; + } + EditorGUI.EndDisabledGroup(); + } + [SerializeField] + private string m_currentTitle = string.Empty; + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + if( m_previewNode ) + m_currentTitle = "Preview"; + else + m_currentTitle = string.Empty; + + SetAdditonalTitleTextOnCallback( m_currentTitle, ( instance, newSubTitle ) => instance.AdditonalTitleContent.text = newSubTitle ); + + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + if( !m_isEditing && ( ( !ContainerGraph.ParentWindow.MouseInteracted && drawInfo.CurrentEventType == EventType.MouseDown && m_titleClickArea.Contains( drawInfo.MousePosition ) ) ) ) + { + if( ( EditorApplication.timeSinceStartup - m_clickTime ) < m_doubleClickTime ) + m_startEditing = true; + else + GUI.FocusControl( null ); + m_clickTime = EditorApplication.timeSinceStartup; + } + else if( m_isEditing && ( ( drawInfo.CurrentEventType == EventType.MouseDown && !m_titleClickArea.Contains( drawInfo.MousePosition ) ) || !EditorGUIUtility.editingTextField ) ) + { + m_stopEditing = true; + } + + if( m_isEditing || m_startEditing ) + { + EditorGUI.BeginChangeCheck(); + GUI.SetNextControlName( m_uniqueName ); + m_outputName = EditorGUITextField( m_titleClickArea, string.Empty, m_outputName, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); + if( EditorGUI.EndChangeCheck() ) + { + SetTitleText( m_outputName ); + UIUtils.UpdateFunctionInputData( UniqueId, m_outputName ); + } + + if( m_startEditing ) + EditorGUI.FocusTextInControl( m_uniqueName ); + + } + + if( drawInfo.CurrentEventType == EventType.Repaint ) + { + if( m_startEditing ) + { + m_startEditing = false; + m_isEditing = true; + } + + if( m_stopEditing ) + { + m_stopEditing = false; + m_isEditing = false; + GUI.FocusControl( null ); + } + } + } + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + // RUN LAYOUT CHANGES AFTER TITLES CHANGE + base.OnNodeLayout( drawInfo ); + m_titleClickArea = m_titlePos; + m_titleClickArea.height = Constants.NODE_HEADER_HEIGHT; + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + base.OnNodeRepaint( drawInfo ); + + if( !m_isVisible ) + return; + + // Fixed Title ( only renders when not editing ) + if( m_showTitleWhenNotEditing && !m_isEditing && !m_startEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + GUI.Label( m_titleClickArea, m_content, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); + } + } + + public override void OnNodeDoubleClicked( Vector2 currentMousePos2D ) + { + if( currentMousePos2D.y - m_globalPosition.y > ( Constants.NODE_HEADER_HEIGHT + Constants.NODE_HEADER_EXTRA_HEIGHT ) * ContainerGraph.ParentWindow.CameraDrawInfo.InvertedZoom ) + { + ContainerGraph.ParentWindow.ParametersWindow.IsMaximized = !ContainerGraph.ParentWindow.ParametersWindow.IsMaximized; + } + } + + public WirePortDataType AutoOutputType + { + get { return m_inputPorts[ 0 ].DataType; } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_outputName ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_orderIndex ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_previewNode ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_outputName = GetCurrentParam( ref nodeParams ); + m_orderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + + if( UIUtils.CurrentShaderVersion() > 13706 ) + m_previewNode = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + + if( IsNodeBeingCopied ) + PreviewNode = false; + + if( m_function == null ) + m_function = UIUtils.CurrentWindow.OpenedShaderFunction; + + if( m_isMainOutputNode && m_function != null ) + { + m_function.UpdateDirectivesList(); + } + + SetTitleText( m_outputName ); + UIUtils.UpdateFunctionOutputData( UniqueId, m_outputName ); + } + + public AmplifyShaderFunction Function + { + get { return m_function; } + set + { + m_function = value; + if( m_isMainOutputNode && m_function != null ) + { + m_function.UpdateDirectivesList(); + } + } + } + + public string OutputName + { + get { return m_outputName; } + } + + public int OrderIndex + { + get { return m_orderIndex; } + set { m_orderIndex = value; } + } + + public string SubTitle + { + get { return m_subTitle; } + set { m_subTitle = value; } + } + + public bool PreviewNode + { + get { return m_previewNode; } + set + { + m_previewNode = value; + m_sizeIsDirty = true; + if( m_previewNode ) + { + m_currentTitle = "Preview"; + } + else + { + m_currentTitle = ""; + } + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs.meta new file mode 100644 index 00000000..1f33d792 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6293b1f56d13d6c4ca6a8e2a8099cca9 +timeCreated: 1491917775 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs new file mode 100644 index 00000000..b912446c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs @@ -0,0 +1,124 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Function Subtitle", "Functions", "Adds a subtitle to its shader function", NodeAvailabilityFlags = (int)NodeAvailability.ShaderFunction )] + public sealed class FunctionSubtitle : ParentNode + { + + //protected override void CommonInit( int uniqueId ) + //{ + // base.CommonInit( uniqueId ); + // AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + // AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + // m_autoWrapProperties = true; + // m_textLabelWidth = 100; + // //SetTitleText( m_inputName ); + // //SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); + // m_previewShaderGUID = "04bc8e7b317dccb4d8da601680dd8140"; + //} + [SerializeField] + private string m_subtitle = "Subtitle"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_autoWrapProperties = true; + m_textLabelWidth = 100; + SetTitleText( m_subtitle ); + m_previewShaderGUID = "74e4d859fbdb2c0468de3612145f4929"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + return m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar ); + } + + //public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + //{ + // base.PropagateNodeData( nodeData, ref dataCollector ); + + // //if( m_containerGraph.CurrentShaderFunction != null ) + // //m_containerGraph.CurrentShaderFunction.FunctionSubtitle = m_subttile; + //} + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + //public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + //{ + // base.PropagateNodeData( nodeData, ref dataCollector ); + //Debug.Log( IsConnected + " " + m_containerGraph.CurrentFunctionOutput ); + if( m_containerGraph.CurrentFunctionOutput != null && IsConnected ) + m_containerGraph.CurrentFunctionOutput.SubTitle = m_subtitle; + // m_containerGraph.CurrentShaderFunction.FunctionSubtitle = m_subttile; + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUILayout.BeginVertical(); + EditorGUI.BeginChangeCheck(); + m_subtitle = EditorGUILayoutTextField( "Name", m_subtitle ); + if( EditorGUI.EndChangeCheck() ) + { + SetTitleText( m_subtitle ); + //UIUtils.UpdateFunctionInputData( UniqueId, m_inputName ); + } + EditorGUI.BeginChangeCheck(); + //m_selectedInputTypeInt = EditorGUILayoutPopup( InputTypeStr, m_selectedInputTypeInt, m_inputValueTypes ); + //if( EditorGUI.EndChangeCheck() ) + //{ + // UpdatePorts(); + // SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); + //} + + //m_autoCast = EditorGUILayoutToggle( "Auto Cast", m_autoCast ); + + //EditorGUILayout.Separator(); + //if( !m_inputPorts[ 0 ].IsConnected && m_inputPorts[ 0 ].ValidInternalData ) + //{ + // m_inputPorts[ 0 ].ShowInternalData( this, true, "Default Value" ); + //} + + + EditorGUILayout.EndVertical(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_subtitle ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_subtitle = GetCurrentParam( ref nodeParams ); + SetTitleText( m_subtitle ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs.meta new file mode 100644 index 00000000..efd794ce --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 97d5e0cd26200a64fa9d127599406008 +timeCreated: 1522434121 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs new file mode 100644 index 00000000..547c7436 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs @@ -0,0 +1,886 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Function Switch", "Functions", "Function Switch allows switching options at compile time for shader function", NodeAvailabilityFlags = (int)NodeAvailability.ShaderFunction )] + public sealed class FunctionSwitch : ParentNode + { + private const string InputPortNameStr = "In "; + + private const string ToggleFalseStr = "False"; + private const string ToggleTrueStr = "True"; + + private const string CurrSelectedStr = "Current"; + private const string MaxAmountStr = "Amount"; + private const int MaxAllowedAmount = 10; + + private const int MinComboSize = 50; + private const int MaxComboSize = 105; + + [SerializeField] + private string m_optionLabel = "Option"; + + [SerializeField] + private string[] AvailableInputsLabels = { "In 0", "In 1" }; + + [SerializeField] + private int[] AvailableInputsValues = { 0, 1 }; + + [SerializeField] + private int m_previousSelectedInput = 0; + + [SerializeField] + private int m_currentSelectedInput = 0; + + [SerializeField] + private int m_maxAmountInputs = 2; + + [SerializeField] + private bool m_toggleMode = false; + + [SerializeField] + private string[] m_optionNames = { "In 0", "In 1", "In 2", "In 3", "In 4", "In 5", "In 6", "In 7", "In 8", "In 9" }; + + [SerializeField] + private int m_orderIndex = -1; + + [SerializeField] + private TexReferenceType m_referenceType = TexReferenceType.Object; + + [SerializeField] + private FunctionSwitch m_functionSwitchReference = null; + + [SerializeField] + private int m_referenceUniqueId = -1; + + [SerializeField] + private bool m_validReference = false; + + private bool m_asDrawn = false; + + private GUIContent m_checkContent; + private GUIContent m_popContent; + + private const double MaxTimestamp = 1; + private bool m_nameModified = false; + private double m_lastTimeNameModified = 0; + + private Rect m_varRect; + private Rect m_imgRect; + private bool m_editing; + + private int m_cachedPropertyId = -1; + + private bool m_dirtySettings = false; + + [SerializeField] + private int m_refMaxInputs = -1; + + [SerializeField] + private string m_refOptionLabel = string.Empty; + + [SerializeField] + private int m_refSelectedInput = -1; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + for( int i = 0; i < MaxAllowedAmount; i++ ) + { + AddInputPort( WirePortDataType.FLOAT, false, InputPortNameStr + i ); + m_inputPorts[ i ].Visible = ( i < 2 ); + m_inputPorts[ i ].SetFreeForAll(); + } + AddOutputPort( WirePortDataType.FLOAT, " " ); + + m_checkContent = new GUIContent(); + m_checkContent.image = UIUtils.CheckmarkIcon; + + m_popContent = new GUIContent(); + m_popContent.image = UIUtils.PopupIcon; + + m_textLabelWidth = 100; + m_autoWrapProperties = true; + m_insideSize.Set( 80, 25 ); + m_previewShaderGUID = "a58e46feaa5e3d14383bfeac24d008bc"; + } + + public void SetCurrentSelectedInput( int newValue, int prevValue ) + { + m_previousSelectedInput = prevValue; + if( m_validReference ) + m_currentSelectedInput = Mathf.Clamp( newValue, 0, m_refMaxInputs - 1 ); + else + m_currentSelectedInput = Mathf.Clamp( newValue, 0, m_maxAmountInputs - 1 ); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ m_currentSelectedInput ].DataType, false ); + PreviewIsDirty = true; + ChangeSignalPropagation(); + } + + public int GetCurrentSelectedInput() + { + return m_currentSelectedInput; + } + + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_cachedPropertyId == -1 ) + m_cachedPropertyId = Shader.PropertyToID( "_Current" ); + + PreviewMaterial.SetInt( m_cachedPropertyId, m_currentSelectedInput ); + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + if( m_referenceType == TexReferenceType.Object ) + { + UIUtils.RegisterFunctionSwitchNode( this ); + } + else + { + if( ContainerGraph.ParentWindow.CustomGraph != null ) + UIUtils.RegisterFunctionSwitchNode( this ); + UIUtils.RegisterFunctionSwitchCopyNode( this ); + } + } + + public override void Destroy() + { + base.Destroy(); + + m_functionSwitchReference = null; + m_referenceUniqueId = -1; + + if( m_referenceType == TexReferenceType.Object ) + { + UIUtils.UnregisterFunctionSwitchNode( this ); + } + else + { + UIUtils.UnregisterFunctionSwitchNode( this ); + UIUtils.UnregisterFunctionSwitchCopyNode( this ); + } + } + + public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ portId ].MatchPortToConnection(); + if( portId == m_currentSelectedInput ) + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ portId ].DataType, false ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + InputPort port = GetInputPortByUniqueId( portId ); + int arrayPos = m_inputPorts.IndexOf( port ); + if( activateNode && m_connStatus == NodeConnectionStatus.Connected && arrayPos == m_currentSelectedInput ) + { + port.GetOutputNode().ActivateNode( m_activeNode, m_activePort, m_activeType ); + } + + OnNodeChange(); + SetSaveIsDirty(); + + m_inputPorts[ portId ].MatchPortToConnection(); + if( arrayPos == m_currentSelectedInput ) + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ portId ].DataType, false ); + } + + public override void ActivateNode( int signalGenNodeId, int signalGenPortId, Type signalGenNodeType ) + { + if( m_selfPowered ) + return; + + ConnStatus = m_restrictions.GetRestiction( signalGenNodeType, signalGenPortId ) ? NodeConnectionStatus.Error : NodeConnectionStatus.Connected; + m_activeConnections += 1; + + m_activeType = signalGenNodeType; + m_activeNode = signalGenNodeId; + m_activePort = signalGenPortId; + if( m_activeConnections == 1 ) + if( m_inputPorts[ m_currentSelectedInput ].IsConnected ) + m_inputPorts[ m_currentSelectedInput ].GetOutputNode().ActivateNode( signalGenNodeId, signalGenPortId, signalGenNodeType ); + + SetSaveIsDirty(); + } + + public override void DeactivateInputPortNode( int deactivatedPort, bool forceComplete ) + { + InputPort port = GetInputPortByUniqueId( deactivatedPort ); + if( deactivatedPort == m_currentSelectedInput ) + port.GetOutputNode().DeactivateNode( deactivatedPort, false ); + } + + public override void DeactivateNode( int deactivatedPort, bool forceComplete ) + { + if( m_selfPowered ) + return; + + SetSaveIsDirty(); + m_activeConnections -= 1; + + if( ( forceComplete || m_activeConnections <= 0 ) ) + { + m_activeConnections = 0; + ConnStatus = NodeConnectionStatus.Not_Connected; + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].IsConnected && i == m_currentSelectedInput ) + { + ParentNode node = m_inputPorts[ i ].GetOutputNode(); + if( node != null ) + node.DeactivateNode( deactivatedPort == -1 ? m_inputPorts[ i ].PortId : deactivatedPort, false ); + } + } + } + } + + public void ChangeSignalPropagation() + { + if( m_previousSelectedInput != m_currentSelectedInput && ConnStatus == NodeConnectionStatus.Connected ) + { + if( m_inputPorts[ m_previousSelectedInput ].IsConnected ) + m_inputPorts[ m_previousSelectedInput ].GetOutputNode().DeactivateNode( m_inputPorts[ m_previousSelectedInput ].PortId, false ); + + if( m_inputPorts[ m_currentSelectedInput ].IsConnected ) + m_inputPorts[ m_currentSelectedInput ].GetOutputNode().ActivateNode( UniqueId, m_inputPorts[ m_currentSelectedInput ].PortId, m_activeType ); + } + } + + public bool DrawOption( ParentNode owner, bool forceDraw = false ) + { + if( !IsConnected && !forceDraw ) + { + //EditorGUILayout.LabelField( "Not Connected" ); + return false; + } + + if( m_asDrawn ) //used to prevent the same property to be drawn more than once + return false; + + if( m_validReference ) + { + return m_functionSwitchReference.DrawOption( owner, true ); + } + + int prev = m_currentSelectedInput; + m_asDrawn = true; + if( m_toggleMode ) + { + m_currentSelectedInput = owner.EditorGUILayoutToggle( m_optionLabel, ( m_currentSelectedInput != 0 ? true : false ) ) ? 1 : 0; + + if( m_currentSelectedInput != prev ) + { + SetCurrentSelectedInput( m_currentSelectedInput, prev ); + return true; + } + else + { + return false; + } + } + else + { + m_currentSelectedInput = owner.EditorGUILayoutIntPopup( m_optionLabel, m_currentSelectedInput, AvailableInputsLabels, AvailableInputsValues ); + + if( m_currentSelectedInput != prev ) + { + SetCurrentSelectedInput( m_currentSelectedInput, prev ); + return true; + } + else + { + return false; + } + } + } + + public void CheckReference() + { + if( m_referenceType != TexReferenceType.Instance ) + { + m_validReference = false; + return; + } + + if( m_functionSwitchReference == null ) + { + m_validReference = false; + ResetToSelf(); + return; + } + + if( m_referenceUniqueId != m_functionSwitchReference.UniqueId ) + { + UpdateFromSelected(); + } + if( m_refSelectedInput != m_functionSwitchReference.GetCurrentSelectedInput() || m_refMaxInputs != m_functionSwitchReference.MaxAmountInputs || m_refOptionLabel != m_functionSwitchReference.OptionLabel ) + { + UpdateFromSelected(); + } + + if( m_functionSwitchReference.DirtySettings ) + { + UpdateFromSelected(); + } + + m_validReference = true; + } + + void ResetToSelf() + { + m_functionSwitchReference = null; + m_validReference = false; + m_referenceUniqueId = -1; + m_refMaxInputs = -1; + m_refOptionLabel = string.Empty; + m_refSelectedInput = -1; + + for( int i = 0; i < MaxAllowedAmount; i++ ) + { + m_inputPorts[ i ].Visible = ( i < m_maxAmountInputs ); + m_inputPorts[ i ].Name = m_optionNames[ i ]; + } + + if( m_currentSelectedInput >= m_maxAmountInputs ) + { + m_currentSelectedInput = m_maxAmountInputs - 1; + } + + UpdateLabels(); + m_sizeIsDirty = true; + } + + void UpdateFromSelected() + { + if( m_referenceUniqueId < 0 ) + return; + + m_functionSwitchReference = UIUtils.GetNode( m_referenceUniqueId ) as FunctionSwitch; + if( m_functionSwitchReference != null ) + { + m_validReference = true; + for( int i = 0; i < MaxAllowedAmount; i++ ) + { + m_inputPorts[ i ].Visible = ( i < m_functionSwitchReference.MaxAmountInputs ); + m_inputPorts[ i ].Name = m_functionSwitchReference.InputPorts[ i ].Name; + } + UpdateLabels(); + m_refMaxInputs = m_functionSwitchReference.m_maxAmountInputs; + m_refOptionLabel = m_functionSwitchReference.OptionLabel; + m_refSelectedInput = m_functionSwitchReference.GetCurrentSelectedInput(); + OrderIndex = m_functionSwitchReference.OrderIndex; + + SetCurrentSelectedInput( m_functionSwitchReference.GetCurrentSelectedInput(), m_currentSelectedInput ); + } + + m_sizeIsDirty = true; + m_isDirty = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + { + EditorGUI.BeginChangeCheck(); + m_referenceType = (TexReferenceType)EditorGUILayoutPopup( Constants.ReferenceTypeStr, (int)m_referenceType, Constants.ReferenceArrayLabels ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_referenceType == TexReferenceType.Object ) + { + if( ContainerGraph.ParentWindow.CustomGraph == null ) + UIUtils.UnregisterFunctionSwitchCopyNode( this ); + UIUtils.RegisterFunctionSwitchNode( this ); + ResetToSelf(); + } + else + { + if( ContainerGraph.ParentWindow.CustomGraph == null ) + UIUtils.UnregisterFunctionSwitchNode( this ); + UIUtils.RegisterFunctionSwitchCopyNode( this ); + } + } + + if( m_referenceType == TexReferenceType.Instance ) + { + EditorGUI.BeginChangeCheck(); + string[] arr = new string[ UIUtils.FunctionSwitchList().Count ]; + int[] ids = new int[ UIUtils.FunctionSwitchList().Count ]; + for( int i = 0; i < arr.Length; i++ ) + { + arr[ i ] = i + " - " + UIUtils.FunctionSwitchList()[ i ].OptionLabel; + ids[ i ] = UIUtils.FunctionSwitchList()[ i ].UniqueId; + } + m_referenceUniqueId = EditorGUILayout.IntPopup( Constants.AvailableReferenceStr, m_referenceUniqueId, arr, ids ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromSelected(); + } + return; + } + + EditorGUI.BeginChangeCheck(); + m_optionLabel = EditorGUILayoutTextField( "Option Label", m_optionLabel ); + if( EditorGUI.EndChangeCheck() ) + { + m_optionLabel = UIUtils.RemoveInvalidEnumCharacters( m_optionLabel ); + if( string.IsNullOrEmpty( m_optionLabel ) ) + { + m_optionLabel = "Option"; + } + + UIUtils.UpdateFunctionSwitchData( UniqueId, m_optionLabel ); + } + + EditorGUI.BeginChangeCheck(); + m_toggleMode = EditorGUILayoutToggle( "Toggle Mode", m_toggleMode ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_toggleMode ) + { + m_inputPorts[ 0 ].Name = ToggleFalseStr; + m_inputPorts[ 1 ].Name = ToggleTrueStr; + + for( int i = 0; i < MaxAllowedAmount; i++ ) + { + m_inputPorts[ i ].Visible = ( i < 2 ); + } + + if( m_currentSelectedInput >= 2 ) + { + m_currentSelectedInput = 1; + } + UpdateLabels(); + m_sizeIsDirty = true; + } + else + { + m_inputPorts[ 0 ].Name = m_optionNames[ 0 ]; + m_inputPorts[ 1 ].Name = m_optionNames[ 1 ]; + + for( int i = 0; i < MaxAllowedAmount; i++ ) + { + m_inputPorts[ i ].Visible = ( i < m_maxAmountInputs ); + } + + if( m_currentSelectedInput >= m_maxAmountInputs ) + { + m_currentSelectedInput = m_maxAmountInputs - 1; + } + + UpdateLabels(); + m_sizeIsDirty = true; + } + } + + if( !m_toggleMode ) + { + EditorGUI.BeginChangeCheck(); + m_maxAmountInputs = EditorGUILayoutIntSlider( MaxAmountStr, m_maxAmountInputs, 2, MaxAllowedAmount ); + if( EditorGUI.EndChangeCheck() ) + { + for( int i = 0; i < MaxAllowedAmount; i++ ) + { + m_inputPorts[ i ].Visible = ( i < m_maxAmountInputs ); + } + + if( m_currentSelectedInput >= m_maxAmountInputs ) + { + m_currentSelectedInput = m_maxAmountInputs - 1; + } + + UpdateLabels(); + m_sizeIsDirty = true; + } + + EditorGUI.indentLevel++; + for( int i = 0; i < m_maxAmountInputs; i++ ) + { + EditorGUI.BeginChangeCheck(); + m_inputPorts[ i ].Name = EditorGUILayoutTextField( "Item " + i, m_inputPorts[ i ].Name ); + if( EditorGUI.EndChangeCheck() ) + { + m_nameModified = true; + m_lastTimeNameModified = EditorApplication.timeSinceStartup; + m_inputPorts[ i ].Name = UIUtils.RemoveInvalidEnumCharacters( m_inputPorts[ i ].Name ); + m_optionNames[ i ] = m_inputPorts[ i ].Name; + if( string.IsNullOrEmpty( m_inputPorts[ i ].Name ) ) + { + m_inputPorts[ i ].Name = InputPortNameStr + i; + } + m_sizeIsDirty = true; + } + } + EditorGUI.indentLevel--; + + if( m_nameModified ) + { + UpdateLabels(); + } + } + + if( m_toggleMode ) + { + EditorGUI.BeginChangeCheck(); + int prevVal = m_currentSelectedInput; + m_currentSelectedInput = EditorGUILayoutToggle( CurrSelectedStr, ( m_currentSelectedInput != 0 ? true : false ) ) ? 1 : 0; + if( EditorGUI.EndChangeCheck() ) + SetCurrentSelectedInput( m_currentSelectedInput, prevVal ); + } + else + { + EditorGUI.BeginChangeCheck(); + int prevVal = m_currentSelectedInput; + m_currentSelectedInput = EditorGUILayoutIntPopup( CurrSelectedStr, m_currentSelectedInput, AvailableInputsLabels, AvailableInputsValues ); + if( EditorGUI.EndChangeCheck() ) + { + SetCurrentSelectedInput( m_currentSelectedInput, prevVal ); + } + } + } + if( EditorGUI.EndChangeCheck() ) + { + m_dirtySettings = true; + } + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( UIUtils.CurrentShaderVersion() > 14205 ) + { + if( m_referenceType == TexReferenceType.Instance ) + { + m_functionSwitchReference = UIUtils.GetNode( m_referenceUniqueId ) as FunctionSwitch; + UpdateFromSelected(); + } + } + + SetCurrentSelectedInput( m_currentSelectedInput, m_previousSelectedInput ); + } + + public void UpdateLabels() + { + int maxinputs = m_maxAmountInputs; + if( m_validReference ) + maxinputs = m_functionSwitchReference.MaxAmountInputs; + + AvailableInputsLabels = new string[ maxinputs ]; + AvailableInputsValues = new int[ maxinputs ]; + + for( int i = 0; i < maxinputs; i++ ) + { + AvailableInputsLabels[ i ] = m_optionNames[ i ]; + AvailableInputsValues[ i ] = i; + } + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + CheckReference(); + if( m_dirtySettings ) + m_dirtySettings = false; + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + float finalSize = 0; + if( !m_toggleMode ) + { + GUIContent dropdown = new GUIContent( m_inputPorts[ m_currentSelectedInput ].Name ); + int cacheSize = UIUtils.GraphDropDown.fontSize; + UIUtils.GraphDropDown.fontSize = 10; + Vector2 calcSize = UIUtils.GraphDropDown.CalcSize( dropdown ); + UIUtils.GraphDropDown.fontSize = cacheSize; + finalSize = Mathf.Clamp( calcSize.x, MinComboSize, MaxComboSize ); + if( m_insideSize.x != finalSize ) + { + m_insideSize.Set( finalSize, 25 ); + m_sizeIsDirty = true; + } + } + + base.OnNodeLayout( drawInfo ); + + bool toggleMode = m_toggleMode; + if( m_validReference ) + { + toggleMode = m_functionSwitchReference.m_toggleMode; + } + + if( toggleMode ) + { + m_varRect = m_remainingBox; + m_varRect.size = Vector2.one * 22 * drawInfo.InvertedZoom; + m_varRect.center = m_remainingBox.center; + if( m_showPreview ) + m_varRect.y = m_remainingBox.y; + } + else + { + m_varRect = m_remainingBox; + m_varRect.width = finalSize * drawInfo.InvertedZoom; + m_varRect.height = 16 * drawInfo.InvertedZoom; + m_varRect.x = m_remainingBox.xMax - m_varRect.width; + m_varRect.y += 1 * drawInfo.InvertedZoom; + + m_imgRect = m_varRect; + m_imgRect.x = m_varRect.xMax - 16 * drawInfo.InvertedZoom; + m_imgRect.width = 16 * drawInfo.InvertedZoom; + m_imgRect.height = m_imgRect.width; + } + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + if( m_validReference ) + { + base.DrawGUIControls( drawInfo ); + } + else + { + base.DrawGUIControls( drawInfo ); + + if( drawInfo.CurrentEventType != EventType.MouseDown ) + return; + + if( m_varRect.Contains( drawInfo.MousePosition ) ) + { + m_editing = true; + } + else if( m_editing ) + { + m_editing = false; + } + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( m_nameModified ) + { + if( ( EditorApplication.timeSinceStartup - m_lastTimeNameModified ) > MaxTimestamp ) + { + m_nameModified = false; + } + } + + if( m_validReference ) + { + SetAdditonalTitleTextOnCallback( m_functionSwitchReference.OptionLabel, ( instance, newSubTitle ) => instance.AdditonalTitleContent.text = string.Format( Constants.SubTitleVarNameFormatStr, newSubTitle ) ); + } + else + { + SetAdditonalTitleTextOnCallback( m_optionLabel, ( instance, newSubTitle ) => instance.AdditonalTitleContent.text = string.Format( Constants.SubTitleValueFormatStr, newSubTitle ) ); + + if( m_editing ) + { + if( m_toggleMode ) + { + if( GUI.Button( m_varRect, GUIContent.none, UIUtils.GraphButton ) ) + { + PreviewIsDirty = true; + int prevVal = m_currentSelectedInput; + m_currentSelectedInput = m_currentSelectedInput == 1 ? 0 : 1; + if( m_currentSelectedInput != prevVal ) + SetCurrentSelectedInput( m_currentSelectedInput, prevVal ); + m_editing = false; + } + + if( m_currentSelectedInput == 1 ) + { + GUI.Label( m_varRect, m_checkContent, UIUtils.GraphButtonIcon ); + } + } + else + { + EditorGUI.BeginChangeCheck(); + int prevVal = m_currentSelectedInput; + m_currentSelectedInput = EditorGUIIntPopup( m_varRect, m_currentSelectedInput, AvailableInputsLabels, AvailableInputsValues, UIUtils.GraphDropDown ); + if( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + SetCurrentSelectedInput( m_currentSelectedInput, prevVal ); + m_editing = false; + } + } + } + } + + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + base.OnNodeRepaint( drawInfo ); + + if( !m_isVisible ) + return; + + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) + { + if( m_validReference ) + { + bool cacheState = GUI.enabled; + GUI.enabled = false; + if( m_functionSwitchReference.m_toggleMode ) + { + GUI.Label( m_varRect, GUIContent.none, UIUtils.GraphButton ); + if( m_functionSwitchReference.GetCurrentSelectedInput() == 1 ) + { + GUI.Label( m_varRect, m_checkContent, UIUtils.GraphButtonIcon ); + } + } + else + { + GUI.Label( m_varRect, m_functionSwitchReference.AvailableInputsLabels[ m_currentSelectedInput ], UIUtils.GraphDropDown ); + } + GUI.enabled = cacheState; + } + else + { + if( !m_editing ) + { + if( m_toggleMode ) + { + GUI.Label( m_varRect, GUIContent.none, UIUtils.GraphButton ); + + if( m_currentSelectedInput == 1 ) + { + GUI.Label( m_varRect, m_checkContent, UIUtils.GraphButtonIcon ); + } + } + else + { + GUI.Label( m_varRect, AvailableInputsLabels[ m_currentSelectedInput ], UIUtils.GraphDropDown ); + GUI.Label( m_imgRect, m_popContent, UIUtils.GraphButtonIcon ); + } + } + } + } + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + if( m_inputPorts[ m_currentSelectedInput ].IsConnected ) + m_inputPorts[ m_currentSelectedInput ].GetOutputNode().PropagateNodeData( nodeData, ref dataCollector ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + return m_inputPorts[ m_currentSelectedInput ].GeneratePortInstructions( ref dataCollector ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_optionLabel = GetCurrentParam( ref nodeParams ); + m_toggleMode = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_currentSelectedInput = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_previousSelectedInput = m_currentSelectedInput; + m_maxAmountInputs = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_orderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + + for( int i = 0; i < MaxAllowedAmount; i++ ) + { + m_inputPorts[ i ].Visible = ( i < m_maxAmountInputs ); + } + + if( m_currentSelectedInput >= m_maxAmountInputs ) + { + m_currentSelectedInput = m_maxAmountInputs - 1; + } + + for( int i = 0; i < m_maxAmountInputs; i++ ) + { + m_optionNames[ i ] = GetCurrentParam( ref nodeParams ); + m_inputPorts[ i ].Name = m_optionNames[ i ]; + } + + if( m_toggleMode ) + { + m_inputPorts[ 0 ].Name = ToggleFalseStr; + m_inputPorts[ 1 ].Name = ToggleTrueStr; + } + + UpdateLabels(); + m_sizeIsDirty = true; + + UIUtils.UpdateFunctionSwitchData( UniqueId, m_optionLabel ); + UIUtils.UpdateFunctionSwitchCopyData( UniqueId, m_optionLabel ); + if( UIUtils.CurrentShaderVersion() > 14205 ) + { + m_referenceType = (TexReferenceType)Enum.Parse( typeof( TexReferenceType ), GetCurrentParam( ref nodeParams ) ); + m_referenceUniqueId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + + if( m_referenceType == TexReferenceType.Object ) + { + if( ContainerGraph.ParentWindow.CustomGraph == null ) + UIUtils.UnregisterFunctionSwitchCopyNode( this ); + UIUtils.RegisterFunctionSwitchNode( this ); + ResetToSelf(); + } + else + { + if( ContainerGraph.ParentWindow.CustomGraph == null ) + UIUtils.UnregisterFunctionSwitchNode( this ); + UIUtils.RegisterFunctionSwitchCopyNode( this ); + } + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_optionLabel ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_toggleMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentSelectedInput ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_maxAmountInputs ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_orderIndex ); + + for( int i = 0; i < m_maxAmountInputs; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_optionNames[ i ] ); + } + + IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceType ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_functionSwitchReference != null ? m_functionSwitchReference.UniqueId : -1 ) ); + } + + public int OrderIndex + { + get { return m_orderIndex; } + set { m_orderIndex = value; } + } + + public string OptionLabel + { + get { return m_optionLabel; } + set { m_optionLabel = value; } + } + + public bool AsDrawn { get { return m_asDrawn; } set { m_asDrawn = value; } } + + public override string DataToArray { get { return m_optionLabel; } } + public int MaxAmountInputs + { + get { return m_maxAmountInputs; } + } + public bool DirtySettings { get { return m_dirtySettings; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs.meta new file mode 100644 index 00000000..d54ea1b4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2bd66b9ffd0acf84ab46c9f83300495c +timeCreated: 1515408158 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs new file mode 100644 index 00000000..76c31761 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs @@ -0,0 +1,102 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Switch by Pipeline", "Functions", "Executes branch according to current pipeline", NodeAvailabilityFlags = (int)NodeAvailability.ShaderFunction )] + public sealed class FunctionSwitchByPipeline : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "BiRP Surface", -1, MasterNodePortCategory.Fragment, 0 ); + AddInputPort( WirePortDataType.FLOAT, false, "BiRP VertFrag", -1, MasterNodePortCategory.Fragment, 3 ); + AddInputPort( WirePortDataType.FLOAT, false, "URP", -1, MasterNodePortCategory.Fragment, 1 ); + AddInputPort( WirePortDataType.FLOAT, false, "HDRP", -1, MasterNodePortCategory.Fragment, 2 ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + GetInputPortByUniqueId( portId ).MatchPortToConnection(); + UpdateOutputPort(); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + GetInputPortByUniqueId( outputPortId ).MatchPortToConnection(); + UpdateOutputPort(); + } + + void UpdateOutputPort() + { + switch( UIUtils.CurrentWindow.OutsideGraph.CurrentSRPType ) + { + case TemplateSRPType.BiRP: + { + InputPort port = UIUtils.CurrentWindow.OutsideGraph.IsStandardSurface ? GetInputPortByUniqueId( 0 ) : GetInputPortByUniqueId( 3 ); + m_outputPorts[ 0 ].ChangeType( port.DataType, false ); + } + break; + case TemplateSRPType.URP: + { + InputPort port = GetInputPortByUniqueId( 1 ); + m_outputPorts[ 0 ].ChangeType( port.DataType, false ); + } + break; + case TemplateSRPType.HDRP: + { + InputPort port = GetInputPortByUniqueId( 2 ); + m_outputPorts[ 0 ].ChangeType( port.DataType, false ); + } + break; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + switch( dataCollector.CurrentSRPType ) + { + case TemplateSRPType.BiRP: + { + InputPort port = UIUtils.CurrentWindow.OutsideGraph.IsStandardSurface ? GetInputPortByUniqueId( 0 ) : GetInputPortByUniqueId( 3 ); + return port.GeneratePortInstructions( ref dataCollector ); + } + case TemplateSRPType.URP: + { + InputPort port = GetInputPortByUniqueId( 1 ); + return port.GeneratePortInstructions( ref dataCollector ); + } + case TemplateSRPType.HDRP: + { + InputPort port = GetInputPortByUniqueId( 2 ); + return port.GeneratePortInstructions( ref dataCollector ); + } + } + + return "0"; + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( UIUtils.CurrentShaderVersion() < 16303 ) + { + InputPort standardPort = GetInputPortByUniqueId( 0 ); + if( standardPort.IsConnected ) + { + UIUtils.SetConnection( UniqueId, 3, standardPort.GetConnection().NodeId, standardPort.GetConnection().PortId ); + } + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs.meta new file mode 100644 index 00000000..e313beaa --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 84a4868e0b1e8dd4bb0e71c8d9a9c130 +timeCreated: 1535365719 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs new file mode 100644 index 00000000..d431cbb8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs @@ -0,0 +1,80 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Log", "Master", "Debug node to dump output to log", null, KeyCode.None, false )] + public sealed class LogNode : MasterNode + { + private const string InputAmountStr = "Input amount"; + + [SerializeField] + private int m_inputCount = 1; + + [SerializeField] + private int m_lastInputCount = 1; + + public LogNode() : base() { } + public LogNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddMasterPorts(); + } + + public override void AddMasterPorts() + { + DeleteAllInputConnections( true ); + base.AddMasterPorts(); + + for ( int i = 0; i < m_inputCount; i++ ) + { + AddInputPort( WirePortDataType.OBJECT, false, i.ToString() ); + } + m_sizeIsDirty = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUILayout.BeginVertical(); + { + EditorGUILayout.LabelField( InputAmountStr ); + m_inputCount = EditorGUILayoutIntField( m_inputCount ); + } + EditorGUILayout.EndVertical(); + if ( m_inputCount != m_lastInputCount ) + { + m_lastInputCount = Mathf.Max( m_inputCount, 1 ); + AddMasterPorts(); + } + } + + public override void Execute( Shader currentSelected ) + { + string valueDump = ""; + string valueInstructions = ""; + + MasterNodeDataCollector dataCollector = new MasterNodeDataCollector( this ); + foreach ( InputPort port in InputPorts ) + { + if ( port.IsConnected ) + { + valueInstructions += "Port: " + port.PortId + " Value: " + port.GenerateShaderForOutput( ref dataCollector, port.DataType, false ); + } + } + Debug.Log( "Value: " + valueDump ); + Debug.Log( "Instructions: " + valueInstructions ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs.meta new file mode 100644 index 00000000..e9457b4e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3b0e734d4c354c74999e20ce054628d2 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs new file mode 100644 index 00000000..4959c858 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs @@ -0,0 +1,1061 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using UnityEditorInternal; + +namespace AmplifyShaderEditor +{ + public enum PrecisionType + { + Float = 0, + Half, + Inherit + } + + public enum AvailableShaderTypes + { + SurfaceShader = 0, + Template + } + + [Serializable] + public class MasterNodeCategoriesData + { + public AvailableShaderTypes Category; + public string Name; + public MasterNodeCategoriesData( AvailableShaderTypes category, string name ) { Category = category; Name = name; } + } + + [Serializable] + public class MasterNode : OutputNode + { + protected const string CustomInspectorStr = "Custom Editor"; + protected const string CustomInspectorFormat = "CustomEditor \"{0}\""; + + private const string PropertyOrderFoldoutStr = " Material Properties"; + private const string PropertyOrderTemplateFoldoutStr = "Material Properties"; + + protected MasterNodeDataCollector m_currentDataCollector; + + protected const string ShaderNameStr = "Shader Name"; + protected GUIContent m_shaderNameContent; + + private const string IndentationHelper = "\t\t{0}\n"; + private const string ShaderLODFormat = "\t\tLOD {0}\n"; + + public delegate void OnMaterialUpdated( MasterNode masterNode ); + public event OnMaterialUpdated OnMaterialUpdatedEvent; + public event OnMaterialUpdated OnShaderUpdatedEvent; + + protected const string GeneralFoldoutStr = " General"; + + protected readonly string[] ShaderModelTypeArr = { "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "4.6", "5.0" }; + private const string ShaderKeywordsStr = "Shader Keywords"; + + [SerializeField] + protected int m_shaderLOD = 0; + + [SerializeField] + protected int m_shaderModelIdx = 3; + + [SerializeField] + protected Shader m_currentShader; + + [SerializeField] + protected Material m_currentMaterial; + + //[SerializeField] + //private bool m_isMainMasterNode = false; + + [SerializeField] + private Rect m_masterNodeIconCoords; + + [SerializeField] + protected string m_shaderName = Constants.DefaultShaderName; + + [SerializeField] + protected string m_croppedShaderName = Constants.DefaultShaderName; + + [SerializeField] + protected string m_customInspectorName = Constants.DefaultCustomInspector; + + [SerializeField] + protected int m_masterNodeCategory = 0;// MasterNodeCategories.SurfaceShader; + + [SerializeField] + protected bool m_samplingMacros = false; + + [SerializeField] + protected string m_currentShaderData = string.Empty; + + private Texture2D m_masterNodeOnTex; + private Texture2D m_masterNodeOffTex; + + private Texture2D m_gpuInstanceOnTex; + private Texture2D m_gpuInstanceOffTex; + + // Shader Keywords + [SerializeField] + private List m_shaderKeywords = new List(); + + [SerializeField] + private bool m_shaderKeywordsFoldout = true; + + private GUIStyle m_addShaderKeywordStyle; + private GUIStyle m_removeShaderKeywordStyle; + private GUIStyle m_smallAddShaderKeywordItemStyle; + private GUIStyle m_smallRemoveShaderKeywordStyle; + private const float ShaderKeywordButtonLayoutWidth = 15; + + + public MasterNode() : base() { CommonInit(); } + public MasterNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { CommonInit(); } + + protected GUIContent m_categoryLabel = new GUIContent( "Shader Type ", "Specify the shader type you want to be working on" ); + + protected GUIContent[] m_availableCategoryLabels; + protected MasterNodeCategoriesData[] m_availableCategories; + + [SerializeField] + private List m_propertyNodesVisibleList = new List(); + + private ReorderableList m_propertyReordableList; + protected bool m_propertyOrderChanged = false; + //private int m_availableCount = 0; + private int m_lastCount = 0; + + private GUIStyle m_propertyAdjustment; + protected bool m_shaderNameIsTitle = true; + + void CommonInit() + { + m_currentMaterial = null; + m_masterNodeIconCoords = new Rect( 0, 0, 64, 64 ); + m_isMainOutputNode = false; + m_connStatus = NodeConnectionStatus.Connected; + m_activeType = GetType(); + m_currentPrecisionType = PrecisionType.Float; + m_textLabelWidth = 120; + m_shaderNameContent = new GUIContent( ShaderNameStr, string.Empty ); + + AddMasterPorts(); + } + + void InitAvailableCategories() + { + int templateCount = m_containerGraph.ParentWindow.TemplatesManagerInstance.TemplateCount; + m_availableCategories = new MasterNodeCategoriesData[ templateCount + 1 ]; + m_availableCategoryLabels = new GUIContent[ templateCount + 1 ]; + + m_availableCategories[ 0 ] = new MasterNodeCategoriesData( AvailableShaderTypes.SurfaceShader, string.Empty ); + m_availableCategoryLabels[ 0 ] = new GUIContent( "Surface" ); + + for( int i = 0; i < templateCount; i++ ) + { + int idx = i + 1; + TemplateDataParent templateData = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( i ); + m_availableCategories[ idx ] = new MasterNodeCategoriesData( AvailableShaderTypes.Template, templateData.GUID ); + m_availableCategoryLabels[ idx ] = new GUIContent( templateData.Name ); + } + } + + public void SetMasterNodeCategoryFromGUID( string GUID ) + { + if( m_availableCategories == null ) + InitAvailableCategories(); + + m_masterNodeCategory = 0; + for( int i = 1; i < m_availableCategories.Length; i++ ) + { + if( m_availableCategories[ i ].Name.Equals( GUID ) ) + m_masterNodeCategory = i; + } + + } + + public override void SetupNodeCategories() + { + //base.SetupNodeCategories(); + ContainerGraph.ResetNodesData(); + int count = m_inputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + NodeData nodeData = new NodeData( m_inputPorts[ i ].Category ); + ParentNode node = m_inputPorts[ i ].GetOutputNode(); + node.PropagateNodeData( nodeData, ref m_currentDataCollector ); + } + else if( m_inputPorts[ i ].HasExternalLink ) + { + InputPort linkedPort = m_inputPorts[ i ].ExternalLink; + if( linkedPort != null && linkedPort.IsConnected ) + { + NodeData nodeData = new NodeData( linkedPort.Category ); + ParentNode node = linkedPort.GetOutputNode(); + node.PropagateNodeData( nodeData, ref m_currentDataCollector ); + } + } + } + } + + public virtual void RefreshAvailableCategories() + { + InitAvailableCategories(); + } + + public virtual void AddMasterPorts() { } + + public virtual void ForcePortType() { } + + public virtual void UpdateMasterNodeMaterial( Material material ) { } + + public virtual void SetName( string name ) { } + + public void CopyFrom( MasterNode other ) + { + Vec2Position = other.Vec2Position; + CurrentShader = other.CurrentShader; + CurrentMaterial = other.CurrentMaterial; + ShaderName = other.ShaderName; + m_masterNodeCategory = other.CurrentMasterNodeCategoryIdx; + } + + protected void DrawCurrentShaderType() + { + if( m_availableCategories == null ) + InitAvailableCategories(); + + int oldType = m_masterNodeCategory; + m_masterNodeCategory = EditorGUILayoutPopup( m_categoryLabel, m_masterNodeCategory, m_availableCategoryLabels ); + if( oldType != m_masterNodeCategory ) + { + m_containerGraph.ParentWindow.ReplaceMasterNode( m_availableCategories[ m_masterNodeCategory ], false ); + } + } + + protected void DrawCustomInspector( bool dropdown ) + { + EditorGUILayout.BeginHorizontal(); + m_customInspectorName = EditorGUILayoutTextField( CustomInspectorStr, m_customInspectorName ); + if( !dropdown ) + { + if( GUILayoutButton( string.Empty, UIUtils.GetCustomStyle( CustomStyle.ResetToDefaultInspectorButton ), GUILayout.Width( 15 ), GUILayout.Height( 15 ) ) ) + { + GUIUtility.keyboardControl = 0; + m_customInspectorName = Constants.DefaultCustomInspector; + } + } + else + { + if( GUILayoutButton( string.Empty, UIUtils.InspectorPopdropdownFallback, GUILayout.Width( 17 ), GUILayout.Height( 19 ) ) ) + { + EditorGUI.FocusTextInControl( null ); + GUI.FocusControl( null ); + + GenericMenu menu = new GenericMenu(); + AddMenuItem( menu, Constants.DefaultCustomInspector ); + + ASESRPBaseline version = ASESRPBaseline.ASE_SRP_INVALID; + bool foundHDRP = ASEPackageManagerHelper.FoundHDRPVersion; + bool foundURP = ASEPackageManagerHelper.FoundURPVersion; + + if( foundHDRP && foundURP ) + { + version = ( ASEPackageManagerHelper.CurrentHDRPBaseline > ASEPackageManagerHelper.CurrentURPBaseline ) ? ASEPackageManagerHelper.CurrentHDRPBaseline : ASEPackageManagerHelper.CurrentURPBaseline; + } + else if( foundHDRP ) + { + version = ASEPackageManagerHelper.CurrentHDRPBaseline; + } + else if( foundURP ) + { + version = ASEPackageManagerHelper.CurrentURPBaseline; + } + + if( foundHDRP ) + { + if( version >= ASESRPBaseline.ASE_SRP_11 ) + { + AddMenuItem( menu , "Rendering.HighDefinition.DecalShaderGraphGUI" ); + AddMenuItem( menu , "Rendering.HighDefinition.LightingShaderGraphGUI" ); + AddMenuItem( menu , "Rendering.HighDefinition.LitShaderGraphGUI" ); + AddMenuItem( menu , "Rendering.HighDefinition.HDUnlitGUI" ); + } + else + if( version >= ASESRPBaseline.ASE_SRP_10 ) + { + AddMenuItem( menu , "Rendering.HighDefinition.DecalGUI" ); + AddMenuItem( menu , "Rendering.HighDefinition.LitShaderGraphGUI" ); + AddMenuItem( menu , "Rendering.HighDefinition.LightingShaderGraphGUI" ); + AddMenuItem( menu , "Rendering.HighDefinition.HDUnlitGUI" ); + } + else if( version >= ASESRPBaseline.ASE_SRP_12 ) + { + AddMenuItem( menu , "Rendering.HighDefinition.DecalGUI" ); + AddMenuItem( menu , "Rendering.HighDefinition.LitShaderGraphGUI" ); + AddMenuItem( menu , "Rendering.HighDefinition.LightingShaderGraphGUI" ); + AddMenuItem( menu , "Rendering.HighDefinition.HDUnlitGUI" ); + } + else + { + AddMenuItem( menu , "UnityEditor.Rendering.HighDefinition.HDLitGUI" ); + } + } + + if( foundURP ) + { + if( version >= ASESRPBaseline.ASE_SRP_12 ) + { + AddMenuItem( menu , "UnityEditor.ShaderGraphLitGUI" ); + AddMenuItem( menu , "UnityEditor.ShaderGraphUnlitGUI" ); + AddMenuItem( menu , "UnityEditor.Rendering.Universal.DecalShaderGraphGUI" ); + AddMenuItem( menu , "UnityEditor.ShaderGraphLitGUI" ); + } + else + { + AddMenuItem( menu , "UnityEditor.ShaderGraph.PBRMasterGUI" ); + } + } + menu.ShowAsContext(); + } + } + EditorGUILayout.EndHorizontal(); + } + + private void AddMenuItem( GenericMenu menu, string newClass ) + { + menu.AddItem( new GUIContent( newClass ), m_customInspectorName.Equals( newClass ), OnSelection, newClass ); + } + + private void OnSelection( object newClass ) + { + m_customInspectorName = (string)newClass; + } + + protected void DrawShaderName() + { + + // this is a hack to control the automatic selection of text fields when the window is selected after serialization + // by having a selectable label the focus happens on it instead and doesn't interupt the usual flow of the editor + EditorGUILayout.SelectableLabel( "", GUILayout.Height( 0 ) ); + + EditorGUI.BeginChangeCheck(); + string newShaderName = EditorGUILayoutTextField( m_shaderNameContent, m_shaderName ); + if( EditorGUI.EndChangeCheck() ) + { + if( newShaderName.Length > 0 ) + { + newShaderName = UIUtils.RemoveShaderInvalidCharacters( newShaderName ); + } + else + { + newShaderName = Constants.DefaultShaderName; + } + ShaderName = newShaderName; + ContainerGraph.ParentWindow.UpdateTabTitle( ShaderName, true ); + } + m_shaderNameContent.tooltip = m_shaderName; + } + + protected void DrawSamplingMacros() + { + EditorGUI.BeginChangeCheck(); + m_samplingMacros = EditorGUILayoutToggle( "Use Sampling Macros", m_samplingMacros ); + if( EditorGUI.EndChangeCheck() ) + ContainerGraph.SamplingMacros = SamplingMacros; + } + + public void DrawShaderKeywords() + { + if( m_addShaderKeywordStyle == null ) + m_addShaderKeywordStyle = UIUtils.PlusStyle; + + if( m_removeShaderKeywordStyle == null ) + m_removeShaderKeywordStyle = UIUtils.MinusStyle; + + if( m_smallAddShaderKeywordItemStyle == null ) + m_smallAddShaderKeywordItemStyle = UIUtils.PlusStyle; + + if( m_smallRemoveShaderKeywordStyle == null ) + m_smallRemoveShaderKeywordStyle = UIUtils.MinusStyle; + + EditorGUILayout.BeginHorizontal(); + { + m_shaderKeywordsFoldout = EditorGUILayout.Foldout( m_shaderKeywordsFoldout, ShaderKeywordsStr ); + + // Add keyword + if( GUILayout.Button( string.Empty, m_addShaderKeywordStyle ) ) + { + m_shaderKeywords.Insert( 0, "" ); + } + + //Remove keyword + if( GUILayout.Button( string.Empty, m_removeShaderKeywordStyle ) ) + { + m_shaderKeywords.RemoveAt( m_shaderKeywords.Count - 1 ); + } + } + EditorGUILayout.EndHorizontal(); + + if( m_shaderKeywordsFoldout ) + { + EditorGUI.indentLevel += 1; + int itemCount = m_shaderKeywords.Count; + int markedToDelete = -1; + for( int i = 0; i < itemCount; i++ ) + { + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Label( " " ); + // Add new port + if( GUILayoutButton( string.Empty, m_smallAddShaderKeywordItemStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_shaderKeywords.Insert( i, "" ); + } + + //Remove port + if( GUILayoutButton( string.Empty, m_smallRemoveShaderKeywordStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + markedToDelete = i; + } + } + EditorGUILayout.EndHorizontal(); + } + if( markedToDelete > -1 ) + { + m_shaderKeywords.RemoveAt( markedToDelete ); + } + EditorGUI.indentLevel -= 1; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + if( m_availableCategories == null ) + InitAvailableCategories(); + + base.Draw( drawInfo ); + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + base.OnNodeRepaint( drawInfo ); + + if( m_isMainOutputNode ) + { + if( m_masterNodeOnTex == null ) + { + m_masterNodeOnTex = UIUtils.MasterNodeOnTexture; + } + + if( m_masterNodeOffTex == null ) + { + m_masterNodeOffTex = UIUtils.MasterNodeOffTexture; + } + + if( m_gpuInstanceOnTex == null ) + { + m_gpuInstanceOnTex = UIUtils.GPUInstancedOnTexture; + } + + if( m_gpuInstanceOffTex == null ) + { + m_gpuInstanceOffTex = UIUtils.GPUInstancedOffTexture; + } + + m_masterNodeIconCoords = m_globalPosition; + m_masterNodeIconCoords.x += m_globalPosition.width - m_masterNodeOffTex.width * drawInfo.InvertedZoom; + m_masterNodeIconCoords.y += m_globalPosition.height - m_masterNodeOffTex.height * drawInfo.InvertedZoom; + m_masterNodeIconCoords.width = m_masterNodeOffTex.width * drawInfo.InvertedZoom; + m_masterNodeIconCoords.height = m_masterNodeOffTex.height * drawInfo.InvertedZoom; + + GUI.DrawTexture( m_masterNodeIconCoords, m_masterNodeOffTex ); + + if( m_gpuInstanceOnTex == null ) + { + m_gpuInstanceOnTex = UIUtils.GPUInstancedOnTexture; + } + } + } + + protected void DrawInstancedIcon( DrawInfo drawInfo ) + { + if( m_gpuInstanceOffTex == null || drawInfo.CurrentEventType != EventType.Repaint ) + return; + + m_masterNodeIconCoords = m_globalPosition; + m_masterNodeIconCoords.x += m_globalPosition.width - 5 - m_gpuInstanceOffTex.width * drawInfo.InvertedZoom; + m_masterNodeIconCoords.y += m_headerPosition.height; + m_masterNodeIconCoords.width = m_gpuInstanceOffTex.width * drawInfo.InvertedZoom; + m_masterNodeIconCoords.height = m_gpuInstanceOffTex.height * drawInfo.InvertedZoom; + GUI.DrawTexture( m_masterNodeIconCoords, m_gpuInstanceOffTex ); + } + //public override void DrawProperties() + //{ + // base.DrawProperties(); + // //EditorGUILayout.LabelField( _shaderTypeLabel ); + //} + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + //IOUtils.AddFieldValueToString( ref nodeInfo, m_isMainMasterNode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_shaderModelIdx ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_customInspectorName ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_shaderLOD ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_masterNodeCategory ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 21 ) + { + m_shaderModelIdx = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() < 17005 ) + { + string val = GetCurrentParam( ref nodeParams ); + if( m_customPrecision ) + { + if( val.Equals( "Fixed" ) ) + m_currentPrecisionType = PrecisionType.Half; + else + m_currentPrecisionType = (PrecisionType)Enum.Parse( typeof( PrecisionType ), val ); + } + else + { + m_currentPrecisionType = PrecisionType.Inherit; + } + } + } + + if( UIUtils.CurrentShaderVersion() > 2404 ) + { + m_customInspectorName = GetCurrentParam( ref nodeParams ); + if ( m_customInspectorName.Equals( Constants.OldCustomInspector ) ) + { + m_customInspectorName = Constants.DefaultCustomInspector; + } + } + + if( UIUtils.CurrentShaderVersion() > 6101 ) + { + ShaderLOD = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() >= 13001 ) + { + //Debug.LogWarning( "Add correct version as soon as it is merged into master" ); + m_masterNodeCategory = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + if( activateNode ) + { + InputPort port = GetInputPortByUniqueId( portId ); + port.GetOutputNode().ActivateNode( UniqueId, portId, m_activeType ); + } + } + + public void FireMaterialChangedEvt() + { + if( OnMaterialUpdatedEvent != null ) + { + OnMaterialUpdatedEvent( this ); + } + } + + public void FireShaderChangedEvt() + { + if( OnShaderUpdatedEvent != null ) + OnShaderUpdatedEvent( this ); + } + + public void RegisterStandaloneFuntions() + { + List nodes = m_containerGraph.CustomExpressionOnFunctionMode.NodesList; + int count = nodes.Count; + Dictionary examinedNodes = new Dictionary(); + for( int i = 0; i < count; i++ ) + { + if( nodes[ i ].AutoRegisterMode ) + { + nodes[ i ].CheckDependencies( ref m_currentDataCollector, ref examinedNodes ); + } + } + examinedNodes.Clear(); + examinedNodes = null; + } + + // What operation this node does + public virtual void Execute( Shader selectedShader ) + { + Execute( AssetDatabase.GetAssetPath( selectedShader ), false ); + } + + public virtual Shader Execute( string pathname, bool isFullPath ) + { + ContainerGraph.ResetNodesLocalVariables(); + m_currentDataCollector = new MasterNodeDataCollector( this ); + return null; + } + + public void CheckSamplingMacrosFlag() + { + if( ContainerGraph.SamplingMacros && m_currentDataCollector != null ) + m_currentDataCollector.AddToDirectives( Constants.SamplingMacrosDirective ); + + } + protected void SortInputPorts( ref List vertexPorts, ref List fragmentPorts ) + { + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].Category == MasterNodePortCategory.Fragment || m_inputPorts[ i ].Category == MasterNodePortCategory.Debug ) + { + if( fragmentPorts != null ) + fragmentPorts.Add( m_inputPorts[ i ] ); + } + else + { + if( vertexPorts != null ) + vertexPorts.Add( m_inputPorts[ i ] ); + } + } + + if( fragmentPorts.Count > 0 ) + { + fragmentPorts.Sort( ( x, y ) => x.OrderId.CompareTo( y.OrderId ) ); + } + + if( vertexPorts.Count > 0 ) + { + vertexPorts.Sort( ( x, y ) => x.OrderId.CompareTo( y.OrderId ) ); + } + } + + protected void UpdateShaderAsset( ref string pathname, ref string shaderBody, bool isFullPath ) + { + shaderBody = UIUtils.ForceLFLineEnding( shaderBody ); + + // Generate Graph info + shaderBody += ContainerGraph.ParentWindow.GenerateGraphInfo(); + + //TODO: Remove current SaveDebugShader and uncomment SaveToDisk as soon as pathname is editable + if( !String.IsNullOrEmpty( pathname ) ) + { + IOUtils.StartSaveThread( shaderBody, ( isFullPath ? pathname : ( IOUtils.dataPath + pathname ) ) ); + } + else + { + IOUtils.StartSaveThread( shaderBody, Application.dataPath + "/AmplifyShaderEditor/Samples/Shaders/" + m_shaderName + ".shader" ); + } + + + if( CurrentShader == null ) + { + AssetDatabase.Refresh( ImportAssetOptions.ForceUpdate ); + CurrentShader = Shader.Find( ShaderName ); + } + + //else + //{ + // // need to always get asset datapath because a user can change and asset location from the project window + // AssetDatabase.ImportAsset( AssetDatabase.GetAssetPath( m_currentShader ) ); + // //ShaderUtil.UpdateShaderAsset( m_currentShader, ShaderBody ); + // //ShaderImporter importer = (ShaderImporter)ShaderImporter.GetAtPath( AssetDatabase.GetAssetPath( CurrentShader ) ); + // //importer.SaveAndReimport(); + //} + + if( m_currentShader != null ) + { + m_currentDataCollector.UpdateShaderImporter( ref m_currentShader ); + if( m_currentMaterial != null ) + { + if( m_currentMaterial.shader != m_currentShader ) + m_currentMaterial.shader = m_currentShader; + + //m_currentDataCollector.UpdateMaterialOnPropertyNodes( m_currentMaterial ); + //This master node UpdateMaterial is needed on Standard Surface node to update its internal properties + UpdateMaterial( m_currentMaterial ); + + UIUtils.CurrentWindow.OutsideGraph.UpdateMaterialOnPropertyNodes( m_currentMaterial ); + + FireMaterialChangedEvt(); + // need to always get asset datapath because a user can change and asset location from the project window + //AssetDatabase.ImportAsset( AssetDatabase.GetAssetPath( m_currentMaterial ) ); + } + + } + + m_currentDataCollector.Destroy(); + m_currentDataCollector = null; + } + + + public void InvalidateMaterialPropertyCount() + { + m_lastCount = -1; + } + + private void RefreshVisibleList( ref List allNodes ) + { + // temp reference for lambda expression + List nodes = allNodes; + m_propertyNodesVisibleList.Clear(); + + for( int i = 0; i < nodes.Count; i++ ) + { + ReordenatorNode rnode = nodes[ i ] as ReordenatorNode; + if( ( rnode == null || !rnode.IsInside ) && ( !m_propertyNodesVisibleList.Exists( x => x.PropertyName.Equals( nodes[ i ].PropertyName ) ) ) ) + m_propertyNodesVisibleList.Add( nodes[ i ] ); + } + + m_propertyNodesVisibleList.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + } + + public void DrawMaterialInputs( GUIStyle toolbarstyle, bool style = true ) + { + m_propertyOrderChanged = false; + Color cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); + EditorGUILayout.BeginHorizontal( toolbarstyle ); + GUI.color = cachedColor; + + EditorGUI.BeginChangeCheck(); + if( style ) + { + ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties = GUILayoutToggle( ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties, PropertyOrderFoldoutStr, UIUtils.MenuItemToggleStyle ); + } + else + { + ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties = GUILayoutToggle( ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties, PropertyOrderTemplateFoldoutStr, UIUtils.MenuItemToggleStyle ); + } + + if( EditorGUI.EndChangeCheck() ) + { + EditorPrefs.SetBool( "ExpandedProperties", ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties ); + } + + EditorGUILayout.EndHorizontal(); + if( !ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties ) + return; + + cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); + EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); + GUI.color = cachedColor; + + List nodes = UIUtils.PropertyNodesList(); + + if( nodes.Count != m_lastCount ) + { + RefreshVisibleList( ref nodes ); + m_lastCount = nodes.Count; + } + + if( m_propertyReordableList == null ) + { + m_propertyReordableList = new ReorderableList( m_propertyNodesVisibleList, typeof( PropertyNode ), true, false, false, false ) + { + headerHeight = 0, + footerHeight = 0, + showDefaultBackground = false, + + drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => + { + var first = rect; + first.width *= 0.60f; + EditorGUI.LabelField( first, m_propertyNodesVisibleList[ index ].PropertyInspectorName ); + var second = rect; + second.width *= 0.4f; + second.x += first.width; + if( GUI.Button( second, m_propertyNodesVisibleList[ index ].PropertyName, new GUIStyle( "AssetLabel Partial" ) ) ) + { + UIUtils.FocusOnNode( m_propertyNodesVisibleList[ index ], 1, false ); + } + }, + + onReorderCallback = ( list ) => + { + ReorderList( ref nodes ); + m_propertyOrderChanged = true; + //RecursiveLog(); + } + }; + ReorderList( ref nodes ); + } + + if( m_propertyReordableList != null ) + { + if( m_propertyAdjustment == null ) + { + m_propertyAdjustment = new GUIStyle(); + m_propertyAdjustment.padding.left = 17; + } + EditorGUILayout.BeginVertical( m_propertyAdjustment ); + m_propertyReordableList.DoLayoutList(); + EditorGUILayout.EndVertical(); + } + EditorGUILayout.EndVertical(); + } + + public void ForceReordering() + { + List nodes = UIUtils.PropertyNodesList(); + + if( nodes.Count != m_lastCount ) + { + RefreshVisibleList( ref nodes ); + m_lastCount = nodes.Count; + } + + ReorderList( ref nodes ); + //RecursiveLog(); + } + + private void RecursiveLog() + { + List nodes = UIUtils.PropertyNodesList(); + nodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + for( int i = 0; i < nodes.Count; i++ ) + { + if( ( nodes[ i ] is ReordenatorNode ) ) + ( nodes[ i ] as ReordenatorNode ).RecursiveLog(); + else + Debug.Log( nodes[ i ].OrderIndex + " " + nodes[ i ].PropertyName ); + } + } + + private void ReorderList( ref List nodes ) + { + // clear lock list before reordering because of multiple sf being used + for( int i = 0; i < nodes.Count; i++ ) + { + ReordenatorNode rnode = nodes[ i ] as ReordenatorNode; + if( rnode != null ) + rnode.RecursiveClear(); + } + + int propoffset = 0; + int count = 0; + for( int i = 0; i < m_propertyNodesVisibleList.Count; i++ ) + { + ReordenatorNode renode = m_propertyNodesVisibleList[ i ] as ReordenatorNode; + if( renode != null ) + { + if( !renode.IsInside ) + { + m_propertyNodesVisibleList[ i ].OrderIndex = count + propoffset; + + if( renode.PropertyListCount > 0 ) + { + propoffset += renode.RecursiveCount(); + // the same reordenator can exist multiple times, apply ordering to all of them + for( int j = 0; j < nodes.Count; j++ ) + { + ReordenatorNode pnode = ( nodes[ j ] as ReordenatorNode ); + if( pnode != null && pnode.PropertyName.Equals( renode.PropertyName ) ) + { + pnode.OrderIndex = renode.RawOrderIndex; + pnode.RecursiveSetOrderOffset( renode.RawOrderIndex, true ); + } + } + } + else + { + count++; + } + } + else + { + m_propertyNodesVisibleList[ i ].OrderIndex = 0; + } + } + else + { + m_propertyNodesVisibleList[ i ].OrderIndex = count + propoffset; + count++; + } + } + } + + public void CopyPropertyListFrom( MasterNode masterNode ) + { + m_lastCount = masterNode.ReordableListLastCount; + m_propertyNodesVisibleList.Clear(); + m_propertyNodesVisibleList.AddRange( masterNode.PropertyNodesVisibleList ); + } + + public virtual void UpdateFromShader( Shader newShader ) { } + + public void ClearUpdateEvents() + { + OnShaderUpdatedEvent = null; + OnMaterialUpdatedEvent = null; + } + + public Material CurrentMaterial { get { return m_currentMaterial; } set { m_currentMaterial = value; } } + public Shader CurrentShader + { + set + { + if( value != null ) + { + SetName( value.name ); + } + + m_currentShader = value; + FireShaderChangedEvt(); + } + get { return m_currentShader; } + } + public virtual void OnRefreshLinkedPortsComplete() { } + public virtual void ReleaseResources() { } + public override void Destroy() + { + base.Destroy(); + OnMaterialUpdatedEvent = null; + OnShaderUpdatedEvent = null; + m_masterNodeOnTex = null; + m_masterNodeOffTex = null; + m_gpuInstanceOnTex = null; + m_gpuInstanceOffTex = null; + m_addShaderKeywordStyle = null; + m_removeShaderKeywordStyle = null; + m_smallAddShaderKeywordItemStyle = null; + m_smallRemoveShaderKeywordStyle = null; + m_shaderKeywords.Clear(); + m_shaderKeywords = null; + m_propertyReordableList = null; + m_propertyAdjustment = null; + if( m_currentDataCollector != null ) + { + m_currentDataCollector.Destroy(); + m_currentDataCollector = null; + } + } + + public static void OpenShaderBody( ref string result, string name ) + { + result += string.Format( "Shader \"{0}\"\n", name ) + "{\n"; + } + + public static void CloseShaderBody( ref string result ) + { + result += "}\n"; + } + + public static void OpenSubShaderBody( ref string result ) + { + result += "\n\tSubShader\n\t{\n"; + } + + public static void CloseSubShaderBody( ref string result ) + { + result += "\t}\n"; + } + + public static void AddShaderProperty( ref string result, string name, string value ) + { + result += string.Format( "\t{0} \"{1}\"\n", name, value ); + } + + public static void AddShaderPragma( ref string result, string value ) + { + result += string.Format( "\t\t#pragma {0}\n", value ); + } + + public static void AddRenderState( ref string result, string state, string stateParams ) + { + result += string.Format( "\t\t{0} {1}\n", state, stateParams ); + } + + public static void AddRenderTags( ref string result, string tags ) + { + result += string.Format( IndentationHelper, tags ); ; + } + + public static void AddShaderLOD( ref string result, int shaderLOD ) + { + if( shaderLOD > 0 ) + { + result += string.Format( ShaderLODFormat, shaderLOD ); + } + } + + public static void AddMultilineBody( ref string result, string[] lines ) + { + for( int i = 0; i < lines.Length; i++ ) + { + result += string.Format( IndentationHelper, lines[ i ] ); + } + } + + public static void OpenCGInclude( ref string result ) + { + result += "\t\tCGINCLUDE\n"; + } + + public static void OpenCGProgram( ref string result ) + { + result += "\t\tCGPROGRAM\n"; + } + + public static void CloseCGProgram( ref string result ) + { + result += "\n\t\tENDCG\n"; + } + + public string ShaderName + { + //get { return ( ( _isHidden ? "Hidden/" : string.Empty ) + ( String.IsNullOrEmpty( _shaderCategory ) ? "" : ( _shaderCategory + "/" ) ) + _shaderName ); } + get { return m_shaderName; } + set + { + m_shaderName = value; + string[] shaderNameArr = m_shaderName.Split( '/' ); + m_croppedShaderName = shaderNameArr[ shaderNameArr.Length - 1 ]; + + if( m_shaderNameIsTitle ) + m_content.text = GenerateClippedTitle( m_croppedShaderName ); + + m_sizeIsDirty = true; + } + } + public string CurrentInspector { get { return m_customInspectorName; } } + public string CustomInspectorFormatted { get { return string.Format( CustomInspectorFormat, m_customInspectorName ); } } + public string CroppedShaderName { get { return m_croppedShaderName; } } + public virtual AvailableShaderTypes CurrentMasterNodeCategory { get { return ( m_masterNodeCategory == 0 ) ? AvailableShaderTypes.SurfaceShader : AvailableShaderTypes.Template; } } + public int CurrentMasterNodeCategoryIdx { get { return m_masterNodeCategory; } } + public MasterNodeDataCollector CurrentDataCollector { get { return m_currentDataCollector; } set { m_currentDataCollector = value; } } + public List PropertyNodesVisibleList { get { return m_propertyNodesVisibleList; } } + public ReorderableList PropertyReordableList { get { return m_propertyReordableList; } } + public int ReordableListLastCount { get { return m_lastCount; } } + public MasterNodeCategoriesData CurrentCategoriesData { get { return m_availableCategories[ m_masterNodeCategory ]; } } + public int ShaderLOD + { + get { return m_shaderLOD; } + set + { + m_shaderLOD = Mathf.Max( 0, value ); + } + } + public bool SamplingMacros + { + get { return m_samplingMacros; } + set + { + m_samplingMacros = value; + if( IsLODMainMasterNode ) + ContainerGraph.SamplingMacros = value; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs.meta new file mode 100644 index 00000000..1c3a124d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7fc2c839ab9f3a045877b59493c51502 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs new file mode 100644 index 00000000..18592c3a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs @@ -0,0 +1,2384 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using System.Text.RegularExpressions; + +namespace AmplifyShaderEditor +{ + public class PropertyDataCollector + { + public int NodeId; + public int OrderIndex; + public string PropertyName; + public WirePortDataType DataType; + public bool IsDirective; + + public PropertyDataCollector( int nodeId, string propertyName, int orderIndex = -1, bool isDirective = false ) + { + NodeId = nodeId; + PropertyName = propertyName; + OrderIndex = orderIndex; + IsDirective = isDirective; + } + } + + public class InputCoordsCollector + { + public int NodeId; + public string CoordName; + public WirePortDataType DataType; + public PrecisionType Precision; + public int TextureSlot; + public int TextureIndex; + + public InputCoordsCollector( int nodeId, string coordName, WirePortDataType dataType, PrecisionType precision, int textureSlot, int textureIndex ) + { + NodeId = nodeId; + CoordName = coordName; + DataType = dataType; + Precision = precision; + TextureSlot = textureSlot; + TextureIndex = textureIndex; + } + } + + public class TextureDefaultsDataColector + { + private List m_names = new List(); + private List m_values = new List(); + public void AddValue( string newName, Texture newValue ) + { + m_names.Add( newName ); + m_values.Add( newValue ); + } + + public void Destroy() + { + m_names.Clear(); + m_names = null; + + m_values.Clear(); + m_values = null; + } + + public string[] NamesArr { get { return m_names.ToArray(); } } + public Texture[] ValuesArr { get { return m_values.ToArray(); } } + } + + public enum TextureChannelUsage + { + Not_Used, + Used, + Required + } + + [Flags] + public enum MacrosMask + { + NONE = 0, + AUTO = 1 << 1, + LOD = 1 << 2, + BIAS = 1 << 3, + GRAD = 1 << 4, + } + + public class MasterNodeDataCollector + { + private bool m_showDebugMessages = false; + private string m_input; + private string m_customInput; + private string m_properties; + private string m_instancedProperties; + private string m_instanceBlockName; + private string m_uniforms; + private string m_includes; + private string m_pragmas; + private string m_defines; + private string m_instructions; + private string m_localVariables; + private string m_vertexLocalVariables; + private string m_specialLocalVariables; + private string m_vertexData; + private string m_customOutput; + private string m_functions; + private string m_grabPass; + + private List m_inputList; + private List m_customInputList; + private List m_propertiesList; + private List m_instancedPropertiesList; + private List m_dotsPropertiesList; + private List m_dotsDefinesList; + private List m_uniformsList; + private List m_includesList; + private List m_additionalDirectivesList; + //private List m_tagsList; + private List m_pragmasList; + private List m_definesList; + private List m_instructionsList; + private List m_localVariablesList; + private List m_vertexLocalVariablesList; + private List m_specialLocalVariablesList; + private List m_vertexDataList; + private List m_customOutputList; + private List m_functionsList; + private List m_grabPassList; + private List m_aboveUsePassesList; + private List m_belowUsePassesList; + + private bool m_surfaceCustomShadowCaster = false; + private List m_customShadowCoordsList; + private List m_packSlotsList; + private string m_customAppDataItems; + + private Dictionary m_inputDict; + private Dictionary m_customInputDict; + private Dictionary m_propertiesDict; + private Dictionary m_instancedPropertiesDict; + private Dictionary m_dotsPropertiesDict; + private Dictionary m_uniformsDict; + private Dictionary m_softRegisteredUniformsDict; + private Dictionary m_includesDict; + private Dictionary m_additionalDirectivesDict; + private Dictionary m_includesExclusionDict; + + //private Dictionary m_tagsDict; + private Dictionary m_pragmasDict; + private Dictionary m_definesDict; + private Dictionary m_virtualCoordinatesDict; + private Dictionary m_virtualVariablesDict; + private Dictionary m_localVariablesDict; + private Dictionary m_localVariablesByNameDict; + private Dictionary m_vertexLocalVariablesDict; + private Dictionary m_vertexLocalVariablesByNameDict; + private Dictionary m_specialLocalVariablesDict; + private Dictionary m_specialLocalVariablesByNameDict; + private Dictionary m_vertexDataDict; + private Dictionary m_customOutputDict; + private Dictionary m_customOutputByNameDict; + private Dictionary m_localFunctions; + private Dictionary m_grabPassDict; + private Dictionary m_usePassesDict; + private Dictionary m_customAppDataItemsDict; + + private Dictionary m_customShadowCoordsDict; + + private TextureChannelUsage[] m_requireTextureProperty = { TextureChannelUsage.Not_Used, TextureChannelUsage.Not_Used, TextureChannelUsage.Not_Used, TextureChannelUsage.Not_Used }; + private WirePortDataType[] m_textureChannelSize = + { + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT2 + }; + + private bool m_dirtyAppData; + private bool m_dirtyInputs; + private bool m_dirtyCustomInputs; + private bool m_dirtyFunctions; + private bool m_dirtyProperties; + private bool m_dirtyInstancedProperties; + private bool m_dirtyUniforms; + private bool m_dirtyIncludes; + private bool m_dirtyPragmas; + private bool m_dirtyDefines; + private bool m_dirtyAdditionalDirectives; + private bool m_dirtyInstructions; + private bool m_dirtyLocalVariables; + private bool m_dirtyVertexLocalVariables; + private bool m_dirtySpecialLocalVariables; + private bool m_dirtyPerVertexData; + private bool m_dirtyNormal; + private bool m_forceNormal; + + private bool m_usingInternalData; + private bool m_usingVertexColor; + private bool m_usingWorldPosition; + private bool m_usingWorldNormal; + private bool m_usingScreenPos; + private bool m_usingWorldReflection; + private bool m_usingViewDirection; + private bool m_usingLightAttenuation; + private bool m_usingArrayDerivatives; + private bool m_usingTextureArrays; + private bool m_usingExtraStandardMacros; + private MacrosMask m_using2DMacrosMask; + private MacrosMask m_using3DMacrosMask; + private MacrosMask m_usingCUBEMacrosMask; + private MacrosMask m_using2DArrayMacrosMask; + private bool m_usingExtra3DSRPMacros; + + private bool m_usingHigherSizeTexcoords; + private bool m_usingCustomScreenPos; + + private bool m_usingCustomOutlineColor; + private bool m_usingCustomOutlineWidth; + private bool m_usingCustomOutlineAlpha; + private int m_customOutlineSelectedAlpha = 0; + private bool m_usingCustomOutput; + + private bool m_safeNormalizeLightDir; + private bool m_safeNormalizeViewDir; + + private bool m_isOutlineDataCollector = false; + + private bool m_forceNormalIsDirty; + private bool m_grabPassIsDirty; + private bool m_tesselationActive; + + private Dictionary m_propertyNodes; + private MasterNode m_masterNode; + + private int m_availableVertexTempId = 0; + private int m_availableFragTempId = 0; + + private MasterNodePortCategory m_portCategory; + private PortGenType m_genType; + private RenderPath m_renderPath = RenderPath.All; + private NodeAvailability m_currentCanvasMode = NodeAvailability.SurfaceShader; + + //Templates specific data + private AvailableShaderTypes m_masterNodeCategory; + private List m_vertexInputList; + private Dictionary m_vertexInputDict; + private List m_interpolatorsList; + private Dictionary m_interpolatorsDict; + private List m_vertexInterpDeclList; + private Dictionary m_vertexInterpDeclDict; + private TemplateDataCollector m_templateDataCollector; + + public MasterNodeDataCollector( MasterNode masterNode ) : this() + { + m_masterNode = masterNode; + m_masterNodeCategory = masterNode.CurrentMasterNodeCategory; + m_currentCanvasMode = masterNode.ContainerGraph.CurrentCanvasMode; + } + + public MasterNodeDataCollector() + { + //m_masterNode = masterNode; + m_input = "struct Input\n\t\t{\n"; + m_customInput = "\t\tstruct SurfaceOutput{0}\n\t\t{\n"; + m_properties = IOUtils.PropertiesBegin;//"\tProperties\n\t{\n"; + m_uniforms = string.Empty; + m_instructions = string.Empty; + m_includes = string.Empty; + m_pragmas = string.Empty; + m_defines = string.Empty; + m_localVariables = string.Empty; + m_specialLocalVariables = string.Empty; + m_customOutput = string.Empty; + + m_inputList = new List(); + m_customInputList = new List(); + m_propertiesList = new List(); + m_instancedPropertiesList = new List(); + m_dotsPropertiesList = new List(); + m_dotsDefinesList = new List(); + m_uniformsList = new List(); + m_includesList = new List(); + m_additionalDirectivesList = new List(); + //m_tagsList = new List(); + m_pragmasList = new List(); + m_definesList = new List(); + m_instructionsList = new List(); + m_localVariablesList = new List(); + m_vertexLocalVariablesList = new List(); + m_specialLocalVariablesList = new List(); + m_vertexDataList = new List(); + m_customOutputList = new List(); + m_functionsList = new List(); + m_grabPassList = new List(); + m_aboveUsePassesList = new List(); + m_belowUsePassesList = new List(); + m_customAppDataItems = string.Empty; + m_customAppDataItemsDict = new Dictionary(); + m_customShadowCoordsList = new List(); + m_packSlotsList = new List(); + + m_inputDict = new Dictionary(); + m_customInputDict = new Dictionary(); + + m_propertiesDict = new Dictionary(); + m_instancedPropertiesDict = new Dictionary(); + m_dotsPropertiesDict = new Dictionary(); + m_uniformsDict = new Dictionary(); + m_softRegisteredUniformsDict = new Dictionary(); + m_includesDict = new Dictionary(); + m_additionalDirectivesDict = new Dictionary(); + m_includesExclusionDict = new Dictionary(); + + //m_tagsDict = new Dictionary(); + m_pragmasDict = new Dictionary(); + m_definesDict = new Dictionary(); + m_virtualCoordinatesDict = new Dictionary(); + m_localVariablesDict = new Dictionary(); + m_localVariablesByNameDict = new Dictionary(); + m_virtualVariablesDict = new Dictionary(); + m_specialLocalVariablesDict = new Dictionary(); + m_specialLocalVariablesByNameDict = new Dictionary(); + m_vertexLocalVariablesDict = new Dictionary(); + m_vertexLocalVariablesByNameDict = new Dictionary(); + m_localFunctions = new Dictionary(); + m_vertexDataDict = new Dictionary(); + m_customOutputDict = new Dictionary(); + m_customOutputByNameDict = new Dictionary(); + m_grabPassDict = new Dictionary(); + m_usePassesDict = new Dictionary(); + + m_customShadowCoordsDict = new Dictionary(); + + m_dirtyAppData = false; + m_dirtyInputs = false; + m_dirtyCustomInputs = false; + m_dirtyProperties = false; + m_dirtyInstancedProperties = false; + m_dirtyUniforms = false; + m_dirtyInstructions = false; + m_dirtyIncludes = false; + m_dirtyPragmas = false; + m_dirtyDefines = false; + m_dirtyAdditionalDirectives = false; + m_dirtyLocalVariables = false; + m_dirtySpecialLocalVariables = false; + m_grabPassIsDirty = false; + + m_portCategory = MasterNodePortCategory.Fragment; + m_propertyNodes = new Dictionary(); + m_showDebugMessages = ( m_showDebugMessages && DebugConsoleWindow.DeveloperMode ); + + //templates + //m_masterNodeCategory = masterNode.CurrentMasterNodeCategory; + + m_vertexInputList = new List(); + m_vertexInputDict = new Dictionary(); + + m_interpolatorsList = new List(); + m_interpolatorsDict = new Dictionary(); + + m_vertexInterpDeclList = new List(); + m_vertexInterpDeclDict = new Dictionary(); + + m_templateDataCollector = new TemplateDataCollector(); + } + + public void CopyTextureChannelSizeFrom( ref MasterNodeDataCollector dataCollector ) + { + for( int i = 0 ; i < m_textureChannelSize.Length ; i++ ) + { + SetTextureChannelSize( i , dataCollector.GetMaxTextureChannelSize( i ) ); + } + } + + public void SetTextureChannelSize( int channelIdx , WirePortDataType size ) + { + if( size > m_textureChannelSize[ channelIdx ] ) + { + m_textureChannelSize[ channelIdx ] = size; + } + } + + public WirePortDataType GetMaxTextureChannelSize( int channelIdx ) + { + return m_textureChannelSize[ channelIdx ]; + } + + public void SetChannelUsage( int channelId, TextureChannelUsage usage ) + { + if( channelId > -1 && channelId < 4 ) + m_requireTextureProperty[ channelId ] = usage; + } + + public TextureChannelUsage GetChannelUsage( int channelId ) + { + if( channelId > -1 && channelId < 4 ) + return m_requireTextureProperty[ channelId ]; + + return TextureChannelUsage.Not_Used; + } + + public void OpenPerVertexHeader( bool includeCustomData ) + { + string appData = "inout " + ( m_dirtyAppData ? Constants.CustomAppDataFullName : Constants.AppDataFullName ) + " "; + if( m_dirtyPerVertexData ) + return; + + m_dirtyPerVertexData = true; + if( m_tesselationActive ) + { + m_vertexData = "\t\tvoid " + Constants.VertexDataFunc + "( " + appData + Constants.VertexShaderInputStr + " )\n\t\t{\n"; + } + else + { + m_vertexData = "\t\tvoid " + Constants.VertexDataFunc + "( " + appData + Constants.VertexShaderInputStr + ( includeCustomData ? ( string.Format( ", out Input {0}", Constants.VertexShaderOutputStr ) ) : string.Empty ) + " )\n\t\t{\n"; + if( includeCustomData ) + m_vertexData += string.Format( "\t\t\tUNITY_INITIALIZE_OUTPUT( Input, {0} );\n", Constants.VertexShaderOutputStr ); + } + } + + public void ClosePerVertexHeader() + { + if( m_dirtyPerVertexData ) + m_vertexData += "\t\t}\n\n"; + } + + public void AddToVertexDisplacement( string value, VertexMode vertexMode ) + { + if( string.IsNullOrEmpty( value ) ) + return; + + if( !m_dirtyPerVertexData ) + { + OpenPerVertexHeader( true ); + } + + switch( vertexMode ) + { + default: + case VertexMode.Relative: + { + m_vertexData += "\t\t\t" + Constants.VertexShaderInputStr + ".vertex.xyz += " + value + ";\n"; + } + break; + case VertexMode.Absolute: + { + m_vertexData += "\t\t\t" + Constants.VertexShaderInputStr + ".vertex.xyz = " + value + ";\n"; + } + break; + } + m_vertexData += "\t\t\t" + Constants.VertexShaderInputStr + ".vertex.w = 1;\n"; + } + + + public void AddToVertexNormal( string value ) + { + if( string.IsNullOrEmpty( value ) ) + return; + + if( !m_dirtyPerVertexData ) + { + OpenPerVertexHeader( true ); + } + + m_vertexData += "\t\t\t" + Constants.VertexShaderInputStr + ".normal = " + value + ";\n"; + } + + public void AddToVertexTangent( string value ) + { + if ( string.IsNullOrEmpty( value ) ) + return; + + if ( !m_dirtyPerVertexData ) + { + OpenPerVertexHeader( true ); + } + + m_vertexData += "\t\t\t" + Constants.VertexShaderInputStr + ".tangent = " + value + ";\n"; + } + + public void AddVertexInstruction( string value, int nodeId = -1, bool addDelimiters = true ) + { + if( !m_dirtyPerVertexData && !IsOutlineDataCollector/*&& !(m_usingCustomOutlineColor || m_usingCustomOutlineWidth)*/ ) + { + OpenPerVertexHeader( true ); + } + if( !m_vertexDataDict.ContainsKey( value ) ) + { + m_vertexDataDict.Add( value, new PropertyDataCollector( nodeId, value ) ); + m_vertexDataList.Add( m_vertexDataDict[ value ] ); + m_vertexData += ( addDelimiters ? ( "\t\t\t" + value + ";\n" ) : value ); + } + } + + public bool ContainsInput( string value ) + { + return m_inputDict.ContainsKey( value ); + } + + public void AddToInput( int nodeId, string interpName, WirePortDataType dataType, PrecisionType precision = PrecisionType.Float, bool addSemiColon = true ) + { + string value = UIUtils.PrecisionWirePortToCgType( precision, dataType ) + " " + interpName; + AddToInput( nodeId, value, addSemiColon ); + + if( !m_customShadowCoordsDict.ContainsKey( interpName ) ) + { + int slot = 0; + int index = 0; + int size = UIUtils.GetChannelsAmount( dataType ); + + if( m_packSlotsList.Count == 0 ) + m_packSlotsList.Add( 4 ); + + for( int i = 0; i < m_packSlotsList.Count; i++ ) + { + slot = i; + if( m_packSlotsList[ i ] >= size ) + { + index = 4 - m_packSlotsList[ i ]; + m_packSlotsList[ i ] -= size; + break; + } + else if( i == m_packSlotsList.Count - 1 ) + { + m_packSlotsList.Add( 4 ); + } + } + m_customShadowCoordsDict.Add( interpName, new InputCoordsCollector( nodeId, interpName, dataType, precision, slot, index ) ); + m_customShadowCoordsList.Add( m_customShadowCoordsDict[ interpName ] ); + } + } + + public void AddToInput( int nodeId, SurfaceInputs surfaceInput, PrecisionType precision = PrecisionType.Float, bool addSemiColon = true ) + { + switch( surfaceInput ) + { + case SurfaceInputs.VIEW_DIR: + UsingViewDirection = true; + break; + case SurfaceInputs.SCREEN_POS: + UsingScreenPos = true; + break; + case SurfaceInputs.WORLD_POS: + UsingWorldPosition = true; + break; + case SurfaceInputs.WORLD_REFL: + UsingWorldReflection = true; + break; + case SurfaceInputs.WORLD_NORMAL: + UsingWorldNormal = true; + break; + case SurfaceInputs.INTERNALDATA: + UsingInternalData = true; + break; + case SurfaceInputs.COLOR: + UsingVertexColor = true; + break; + } + + AddToInput( nodeId, UIUtils.GetInputDeclarationFromType( precision, surfaceInput ), addSemiColon ); + } + + /// + /// Direct access to inputs, plese use another overload + /// + /// + /// + /// + public void AddToInput( int nodeId, string value, bool addSemiColon ) + { + if( string.IsNullOrEmpty( value ) ) + return; + + if( !m_inputDict.ContainsKey( value ) ) + { + m_inputDict.Add( value, new PropertyDataCollector( nodeId, value ,-1, !addSemiColon) ); + m_inputList.Add( m_inputDict[ value ] ); + + m_input += "\t\t\t" + value + ( ( addSemiColon ) ? ( ";\n" ) : "\n" ); + m_dirtyInputs = true; + } + } + + public void CloseInputs() + { + m_input += "\t\t};"; + } + + public void ChangeCustomInputHeader( string value ) + { + m_customInput = m_customInput.Replace( "{0}", value ); + } + + public void AddToCustomInput( int nodeId, string value, bool addSemiColon ) + { + if( string.IsNullOrEmpty( value ) ) + return; + + if( !m_customInputDict.ContainsKey( value ) ) + { + m_customInputDict.Add( value, new PropertyDataCollector( nodeId, value ) ); + m_customInputList.Add( m_customInputDict[ value ] ); + m_customInput += "\t\t\t" + value + ( ( addSemiColon ) ? ( ";\n" ) : "\n" ); + m_dirtyCustomInputs = true; + } + } + + public void CloseCustomInputs() + { + m_customInput += "\t\t};"; + } + + + // Used by Template Master Node to add tabs into variable declaration + public void TabifyInstancedVars() + { + for( int i = 0; i < m_instancedPropertiesList.Count; i++ ) + { + m_instancedPropertiesList[ i ].PropertyName = '\t' + m_instancedPropertiesList[ i ].PropertyName; + } + } + + private int GetWeightForInstancedType( WirePortDataType type ) + { + switch( type ) + { + case WirePortDataType.INT: + case WirePortDataType.FLOAT: return -1; + case WirePortDataType.FLOAT2: return -2; + case WirePortDataType.FLOAT3: return -3; + case WirePortDataType.COLOR: + case WirePortDataType.FLOAT4: return -4; + case WirePortDataType.FLOAT3x3: return -9; + case WirePortDataType.FLOAT4x4: return -16; + default: + case WirePortDataType.OBJECT: + case WirePortDataType.SAMPLER1D: + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.SAMPLER2DARRAY: + case WirePortDataType.SAMPLERSTATE: + return 0; + } + } + + public void OptimizeInstancedProperties() + { + if( m_instancedPropertiesList.Count > 0 ) + { + m_instancedProperties = string.Empty; + m_instancedPropertiesList.Sort( ( x, y ) => { return GetWeightForInstancedType( x.DataType ).CompareTo( GetWeightForInstancedType( y.DataType ) ); } ); + int count = m_instancedPropertiesList.Count; + for( int i = 0; i < count; i++ ) + { + m_instancedProperties += m_instancedPropertiesList[ i ].PropertyName; + } + } + } + // Instanced properties + public void SetupInstancePropertiesBlock( string blockName ) + { + m_instanceBlockName = blockName; + if( IsTemplate ) + { + //if( DebugConsoleWindow.DeveloperMode ) + // Debug.LogWarning( "SetupInstancePropertiesBlock should not be used during template mode" ); + + return; + } + + OptimizeInstancedProperties(); + + if( m_dirtyInstancedProperties ) + { + m_instancedProperties = string.Format( IOUtils.InstancedPropertiesBeginTabs, blockName ) + m_instancedProperties + IOUtils.InstancedPropertiesEndTabs; + } + } + + public void AddToDotsProperties( WirePortDataType dataType, int nodeId, string value, int orderIndex, PrecisionType precision ) + { + if( string.IsNullOrEmpty( value ) ) + return; + + string prop = string.Format( IOUtils.DotsInstancedPropertiesData, UIUtils.PrecisionWirePortToCgType( precision, dataType ), value ); + string define = string.Format( IOUtils.DotsInstancedDefinesData, UIUtils.PrecisionWirePortToCgType( precision, dataType ), value ); + + if( !m_dotsPropertiesDict.ContainsKey( value ) ) + { + PropertyDataCollector dataColl = new PropertyDataCollector( nodeId, prop, orderIndex ); + dataColl.DataType = dataType; + m_dotsPropertiesDict.Add( value, dataColl ); + m_dotsPropertiesList.Add( dataColl ); + + dataColl = new PropertyDataCollector( nodeId, define, orderIndex ); + m_dotsDefinesList.Add( dataColl ); + } + } + + public void AddToInstancedProperties( WirePortDataType dataType, int nodeId, string value, int orderIndex ) + { + if( string.IsNullOrEmpty( value ) ) + return; + string uniformValue = value.Contains( "uniform" ) ? value : "uniform " + value; + if( !m_instancedPropertiesDict.ContainsKey( value ) && + !m_uniformsDict.ContainsKey( value ) && + !m_uniformsDict.ContainsKey( uniformValue ) + ) + { + PropertyDataCollector dataColl = new PropertyDataCollector( nodeId, value, orderIndex ); + dataColl.DataType = dataType; + m_instancedPropertiesDict.Add( value, dataColl ); + m_instancedPropertiesList.Add( dataColl ); + m_instancedProperties += value; + m_dirtyInstancedProperties = true; + } + } + + public void CloseInstancedProperties() + { + if( m_dirtyInstancedProperties ) + { + m_instancedProperties += IOUtils.InstancedPropertiesEnd; + } + } + + // Properties + public void CopyPropertiesFromDataCollector( MasterNodeDataCollector dataCollector ) + { + if( dataCollector == null ) + return; + + int propertyCount = dataCollector.PropertiesList.Count; + for( int i = 0; i < propertyCount; i++ ) + { + AddToProperties( dataCollector.PropertiesList[ i ].NodeId, + dataCollector.PropertiesList[ i ].PropertyName, + dataCollector.PropertiesList[ i ].OrderIndex ); + } + + foreach( KeyValuePair kvp in dataCollector.GrabPassDict ) + { + AddGrabPass( kvp.Value ); + } + + m_templateDataCollector.CopySRPPropertiesFromDataCollector( -1, dataCollector.TemplateDataCollectorInstance ); + } + + public void AddToProperties( int nodeId, string value, int orderIndex ) + { + if( string.IsNullOrEmpty( value ) ) + return; + + if( !m_propertiesDict.ContainsKey( value ) ) + { + //Debug.Log( UIUtils ); + m_propertiesDict.Add( value, new PropertyDataCollector( nodeId, value, orderIndex ) ); + m_propertiesList.Add( m_propertiesDict[ value ] ); + m_properties += string.Format( IOUtils.PropertiesElement, value ); + m_dirtyProperties = true; + } + } + + public string BuildPropertiesString() + { + List list = new List( m_propertiesDict.Values ); + //for ( int i = 0; i < list.Count; i++ ) + //{ + // Debug.Log( list[ i ].OrderIndex + " " + list[ i ].PropertyName ); + //} + + list.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + CleanUpList( ref list ); + m_properties = IOUtils.PropertiesBegin; + for( int i = 0; i < list.Count; i++ ) + { + m_properties += string.Format( IOUtils.PropertiesElement, list[ i ].PropertyName ); + //Debug.Log() + } + m_properties += IOUtils.PropertiesEnd; + return m_properties; + } + + public bool ContainsProperty( string propertyName ) + { + // TODO: this needs to change, find the property should be dependant of have a "(" + List list = new List( m_propertiesDict.Values ); + return list.Find( x => x.PropertyName.Contains( propertyName+"(" ) ) != null; + } + + public string[] BuildUnformatedPropertiesStringArr() + { + List list = new List( m_propertiesDict.Values ); + list.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + CleanUpList( ref list ); + string[] arr = new string[ list.Count ]; + for( int i = 0; i < list.Count; i++ ) + { + arr[ i ] = list[ i ].PropertyName; + } + return arr; + } + //This clean up was set to remove Header attributes from shader functions which would be last on the property list + //Thus creating a label on the inspector with no properties below + public void CleanUpList( ref List list ) + { + if( list.Count == 0 ) + return; + + if( list[ list.Count - 1 ].PropertyName.Contains( "[Header(" ) ) + { + //Check if this is a complete property or just a standalone header + Match match = Regex.Match( list[ list.Count - 1 ].PropertyName, TemplateHelperFunctions.PropertiesPatternI ); + if( !match.Success ) + { + list.RemoveAt( list.Count - 1 ); + CleanUpList( ref list ); + } + } + } + + public void CloseProperties() + { + if( m_dirtyProperties ) + { + m_properties += IOUtils.PropertiesEnd; + } + } + + public void AddUsePass( string value, bool above ) + { + if( m_usePassesDict.ContainsKey( value ) ) + return; + m_usePassesDict.Add( value, value ); + if( above ) + { + m_aboveUsePassesList.Add( new PropertyDataCollector( -1, value ) ); + } + else + { + m_belowUsePassesList.Add( new PropertyDataCollector( -1, value ) ); + } + } + + public void AddGrabPass( string value ) + { + if( m_grabPassDict.ContainsKey( value ) ) + return; + + m_grabPassDict.Add( value, value ); + + if( string.IsNullOrEmpty( value ) ) + { + if( !m_grabPassIsDirty ) + m_grabPass += IOUtils.GrabPassEmpty; + } + else + { + m_grabPass += IOUtils.GrabPassBegin + value + IOUtils.GrabPassEnd; + } + m_grabPassList.Add( new PropertyDataCollector( -1, m_grabPass.Replace( "\t", string.Empty ).Replace( "\n", string.Empty ) ) ); + m_grabPassIsDirty = true; + } + + // This is used by templates global variables to register already existing globals/properties + //public void SoftRegisterUniform( string dataName ) + //{ + // if( !m_uniformsDict.ContainsKey( dataName ) ) + // { + // m_uniformsDict.Add( dataName, new PropertyDataCollector( -1, dataName ) ); + // } + //} + + public string GenerateInstanced(PrecisionType precisionType, WirePortDataType dataType,string propertyName ) + { + if( IsSRP ) + { + return string.Format( IOUtils.LWSRPInstancedPropertiesElement, UIUtils.PrecisionWirePortToCgType( precisionType, dataType ), propertyName ); + } + else + { + return string.Format( IOUtils.InstancedPropertiesElement, UIUtils.PrecisionWirePortToCgType( precisionType, dataType ), propertyName ); + } + } + + public bool CheckIfSoftRegistered( string name ) + { + return m_softRegisteredUniformsDict.ContainsKey( name ); + } + + public void SoftRegisterUniform( TemplateShaderPropertyData data ) + { + bool excludeUniformKeyword = ( data.PropertyType == PropertyType.InstancedProperty ) || IsSRP; + + string uniformName = data.IsMacro? data.PropertyName: + UIUtils.GenerateUniformName( excludeUniformKeyword, data.PropertyDataType, data.PropertyName ); + if( !m_uniformsDict.ContainsKey( uniformName ) ) + { + PropertyDataCollector newEntry = new PropertyDataCollector( -1, uniformName ); + m_uniformsDict.Add( uniformName, newEntry ); + m_softRegisteredUniformsDict.Add( uniformName, newEntry ); + } + + string instancedUniform = GenerateInstanced( PrecisionType.Float, data.PropertyDataType, data.PropertyName ); + if( !m_uniformsDict.ContainsKey( instancedUniform ) ) + { + PropertyDataCollector newEntry = new PropertyDataCollector( -1, instancedUniform ); + m_uniformsDict.Add( instancedUniform, newEntry ); + m_softRegisteredUniformsDict.Add( instancedUniform, newEntry ); + } + + instancedUniform = GenerateInstanced( PrecisionType.Half, data.PropertyDataType, data.PropertyName ); + if( !m_uniformsDict.ContainsKey( instancedUniform ) ) + { + PropertyDataCollector newEntry = new PropertyDataCollector( -1, instancedUniform ); + m_uniformsDict.Add( instancedUniform, newEntry ); + m_softRegisteredUniformsDict.Add( instancedUniform, newEntry ); + } + } + + public void AddToUniforms( int nodeId, string dataType, string dataName, bool checkSRPBatch = false, bool excludeUniform = false ) + { + if( string.IsNullOrEmpty( dataName ) || string.IsNullOrEmpty( dataType ) ) + return; + + string value = UIUtils.GenerateUniformName( IsSRP || excludeUniform, dataType, dataName ); + if( !m_uniformsDict.ContainsKey( value ) && !m_uniformsDict.ContainsKey( dataName ) ) + { + m_uniformsDict.Add( value, new PropertyDataCollector( nodeId, value ) ); + if( IsSRP && checkSRPBatch ) + { + m_templateDataCollector.AddSRPBatcherProperty( nodeId, value ); + } + else + { + m_uniforms += "\t\t" + value + '\n'; + m_uniformsList.Add( m_uniformsDict[ value ] ); + } + m_dirtyUniforms = true; + } + } + + public void AddToUniforms( int nodeId, string value, bool checkSRPBatch = false ) + { + if( string.IsNullOrEmpty( value ) ) + return; + + if( !m_uniformsDict.ContainsKey( value ) ) + { + m_uniformsDict.Add( value, new PropertyDataCollector( nodeId, value ) ); + if( IsSRP && checkSRPBatch ) + { + m_templateDataCollector.AddSRPBatcherProperty( nodeId, value ); + } + else + { + m_uniforms += "\t\t" + value + '\n'; + m_uniformsList.Add( m_uniformsDict[ value ] ); + } + m_dirtyUniforms = true; + } + } + + public void AddASEMacros() + { + if( Using2DMacrosMask == MacrosMask.NONE && Using3DMacrosMask == MacrosMask.NONE && UsingCUBEMacrosMask == MacrosMask.NONE && Using2DArrayMacrosMask == MacrosMask.NONE ) + return; + + ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; + + //Debug.Log( UsingMacrosMask ); + AddToDirectives( Constants.CustomASEStandarSamplingMacrosHelper[ 0 ], 1 ); + + if( ( Using2DMacrosMask & MacrosMask.AUTO ) == MacrosMask.AUTO ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 0 ], 1 ); + if( ( Using2DMacrosMask & MacrosMask.LOD ) == MacrosMask.LOD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 1 ], 1 ); + if( ( Using2DMacrosMask & MacrosMask.BIAS ) == MacrosMask.BIAS ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 2 ], 1 ); + if( ( Using2DMacrosMask & MacrosMask.GRAD ) == MacrosMask.GRAD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 3 ], 1 ); + + if( ( Using3DMacrosMask & MacrosMask.AUTO ) == MacrosMask.AUTO ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 4 ], 1 ); + if( ( Using3DMacrosMask & MacrosMask.LOD ) == MacrosMask.LOD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 5 ], 1 ); + if( ( Using3DMacrosMask & MacrosMask.BIAS ) == MacrosMask.BIAS ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 6 ], 1 ); + if( ( Using3DMacrosMask & MacrosMask.GRAD ) == MacrosMask.GRAD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 7 ], 1 ); + + if( ( UsingCUBEMacrosMask & MacrosMask.AUTO ) == MacrosMask.AUTO ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 8 ], 1 ); + if( ( UsingCUBEMacrosMask & MacrosMask.LOD ) == MacrosMask.LOD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 9 ], 1 ); + if( ( UsingCUBEMacrosMask & MacrosMask.BIAS ) == MacrosMask.BIAS ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 10 ], 1 ); + if( ( UsingCUBEMacrosMask & MacrosMask.GRAD ) == MacrosMask.GRAD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 11 ], 1 ); + + if( ( Using2DArrayMacrosMask & MacrosMask.AUTO ) == MacrosMask.AUTO ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 12 ], 1 ); + if( ( Using2DArrayMacrosMask & MacrosMask.LOD ) == MacrosMask.LOD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 13 ], 1 ); + if( ( Using2DArrayMacrosMask & MacrosMask.BIAS ) == MacrosMask.BIAS ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 14 ], 1 ); + if( ( Using2DArrayMacrosMask & MacrosMask.GRAD ) == MacrosMask.GRAD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosRecent[ 15 ], 1 ); + + AddToDirectives( Constants.CustomASEStandarSamplingMacrosHelper[ 1 ], 1 ); + + if( ( Using2DMacrosMask & MacrosMask.AUTO ) == MacrosMask.AUTO ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 0 ], 1 ); + if( ( Using2DMacrosMask & MacrosMask.LOD ) == MacrosMask.LOD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 1 ], 1 ); + if( ( Using2DMacrosMask & MacrosMask.BIAS ) == MacrosMask.BIAS ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 2 ], 1 ); + if( ( Using2DMacrosMask & MacrosMask.GRAD ) == MacrosMask.GRAD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 3 ], 1 ); + + if( ( Using3DMacrosMask & MacrosMask.AUTO ) == MacrosMask.AUTO ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 4 ], 1 ); + if( ( Using3DMacrosMask & MacrosMask.LOD ) == MacrosMask.LOD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 5 ], 1 ); + if( ( Using3DMacrosMask & MacrosMask.BIAS ) == MacrosMask.BIAS ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 6 ], 1 ); + if( ( Using3DMacrosMask & MacrosMask.GRAD ) == MacrosMask.GRAD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 7 ], 1 ); + + if( ( UsingCUBEMacrosMask & MacrosMask.AUTO ) == MacrosMask.AUTO ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 8 ], 1 ); + if( ( UsingCUBEMacrosMask & MacrosMask.LOD ) == MacrosMask.LOD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 9 ], 1 ); + if( ( UsingCUBEMacrosMask & MacrosMask.BIAS ) == MacrosMask.BIAS ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 10 ], 1 ); + if( ( UsingCUBEMacrosMask & MacrosMask.GRAD ) == MacrosMask.GRAD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 11 ], 1 ); + + if( ( Using2DArrayMacrosMask & MacrosMask.AUTO ) == MacrosMask.AUTO ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 12 ], 1 ); + if( ( Using2DArrayMacrosMask & MacrosMask.LOD ) == MacrosMask.LOD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 13 ], 1 ); + if( ( Using2DArrayMacrosMask & MacrosMask.BIAS ) == MacrosMask.BIAS ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 14 ], 1 ); + if( ( Using2DArrayMacrosMask & MacrosMask.GRAD ) == MacrosMask.GRAD ) + AddToDirectives( Constants.CustomASEStandarSamplingMacrosOlder[ 15 ], 1 ); + + AddToDirectives( Constants.CustomASEStandarSamplingMacrosHelper[ 2 ], 1 ); + } + + public void AddToDirectives( string value, int orderIndex = -1 , AdditionalLineType type = AdditionalLineType.Custom ) + { + if( string.IsNullOrEmpty( value ) ) + return; + + switch( type ) + { + case AdditionalLineType.Include:value = "#include " + value;break; + case AdditionalLineType.Define:value = "#define " + value; break; + case AdditionalLineType.Pragma:value = "#pragma " + value; break; + } + if( !m_additionalDirectivesDict.ContainsKey( value ) ) + { + PropertyDataCollector data = new PropertyDataCollector( -1, value, orderIndex ); + m_additionalDirectivesDict.Add( value, data ); + m_additionalDirectivesList.Add( data ); + m_dirtyAdditionalDirectives = true; + } + } + + public void AddToIncludes( int nodeId, string value ) + { + if( string.IsNullOrEmpty( value ) ) + return; + + if( m_includesExclusionDict.ContainsKey( value ) ) + { + return; + } + + if( IsTemplate ) + { + if( m_templateDataCollector.HasDirective( AdditionalLineType.Include, value ) ) + return; + } + + if( !m_includesDict.ContainsKey( value ) ) + { + PropertyDataCollector data = new PropertyDataCollector( nodeId, "#include \"" + value + "\"" ); + m_includesDict.Add( value, data ); + m_includesList.Add( data ); + m_includes += "\t\t#include \"" + value + "\"\n"; + m_dirtyIncludes = true; + } + else + { + if( m_showDebugMessages ) UIUtils.ShowMessage( "AddToIncludes:Attempting to add duplicate " + value, MessageSeverity.Warning ); + } + } + + + public void RemoveFromIncludes( string value ) + { + if( string.IsNullOrEmpty( value ) ) + return; + + if( !m_includesExclusionDict.ContainsKey( value ) ) + { + m_includesExclusionDict.Add( value, value ); + } + + if( m_includesDict.ContainsKey( value ) ) + { + PropertyDataCollector data = m_includesDict[ value ]; + m_includesDict.Remove( value ); + m_includesList.Remove( data ); + m_dirtyIncludes = true; + string finalValueName = "\t\t#include \"" + value + "\"\n"; + m_includes = m_includes.Replace( finalValueName, string.Empty ); + } + } + + //public void AddToTags( int nodeId, string name, string value ) + //{ + // if( string.IsNullOrEmpty( name ) || string.IsNullOrEmpty( value ) ) + // return; + + // if( !m_tagsDict.ContainsKey( name ) ) + // { + // string finalResult = string.Format( "\"{0}\"=\"{1}\"", name, value ); + // m_tagsDict.Add( name, new PropertyDataCollector( nodeId, finalResult ) ); + // m_tagsList.Add( new PropertyDataCollector( nodeId, finalResult ) ); + // } + //} + + public bool ContainsPragma( string value ) + { + return m_pragmasDict.ContainsKey( value ); + } + + public void AddToPragmas( int nodeId, string value ) + { + if( string.IsNullOrEmpty( value ) ) + return; + + if( IsTemplate ) + { + if( m_templateDataCollector.HasDirective( AdditionalLineType.Pragma, value ) ) + return; + } + + if( !m_pragmasDict.ContainsKey( value ) ) + { + string finalValue = "#pragma " + value; + PropertyDataCollector dataCollector = new PropertyDataCollector( nodeId , finalValue ); + + //Adding both versions to dict so check can take both into account + m_pragmasDict.Add( value, dataCollector ); + m_pragmasDict.Add( finalValue , dataCollector ); + + m_pragmasList.Add( m_pragmasDict[ value ] ); + m_pragmas += "\t\t#pragma " + value + "\n"; + m_dirtyPragmas = true; + } + else + { + if( m_showDebugMessages ) UIUtils.ShowMessage( "AddToPragmas:Attempting to add duplicate " + value, MessageSeverity.Warning ); + } + } + + public bool ContainsDefine( string value ) + { + return m_definesDict.ContainsKey( value ); + } + + public void AddToDefines( int nodeId, string value, bool define = true ) + { + if( string.IsNullOrEmpty( value ) ) + return; + + if( IsTemplate ) + { + if( m_templateDataCollector.HasDirective( AdditionalLineType.Define, value ) ) + return; + } + + if( !m_definesDict.ContainsKey( value ) ) + { + string defineValue = ( define ? "#define " : "#undef " ) + value; + PropertyDataCollector dataCollector = new PropertyDataCollector( nodeId , defineValue ); + + //Adding both versions to dict so check can take both into account + m_definesDict.Add( value, dataCollector ); + m_definesDict.Add( defineValue , dataCollector ); + + m_definesList.Add( m_definesDict[ value ] ); + m_defines += "\t\t" + defineValue + "\n"; + m_dirtyDefines = true; + } + else + { + if( m_showDebugMessages ) UIUtils.ShowMessage( "AddToDefines:Attempting to add duplicate " + value, MessageSeverity.Warning ); + } + } + + public int GetVirtualCoordinatesId( int nodeId, string coord, string lodBias ) + { + if( !m_virtualCoordinatesDict.ContainsKey( coord ) ) + { + m_virtualCoordinatesDict.Add( coord, nodeId ); + AddLocalVariable( nodeId, "VirtualCoord " + Constants.VirtualCoordNameStr + nodeId + " = VTComputeVirtualCoord" + lodBias + "(" + coord + ");" ); + return nodeId; + } + else + { + int fetchedId = 0; + m_virtualCoordinatesDict.TryGetValue( coord, out fetchedId ); + return fetchedId; + } + } + + public bool AddToLocalVariables( MasterNodePortCategory category, int nodeId, PrecisionType precisionType, WirePortDataType type, string varName, string varValue ) + { + if( string.IsNullOrEmpty( varName ) || string.IsNullOrEmpty( varValue ) ) + return false; + + string value = UIUtils.PrecisionWirePortToCgType( precisionType, type ) + " " + varName + " = " + varValue + ";"; + return AddToLocalVariables( category, nodeId, value, varName: varName ); + } + + public bool AddToLocalVariables( int nodeId, PrecisionType precisionType, WirePortDataType type, string varName, string varValue ) + { + if( string.IsNullOrEmpty( varName ) || string.IsNullOrEmpty( varValue ) ) + return false; + + string value = UIUtils.PrecisionWirePortToCgType( precisionType, type ) + " " + varName + " = " + varValue + ";"; + return AddToFragmentLocalVariables( nodeId, value, varName: varName ); + } + + public bool AddToLocalVariables( MasterNodePortCategory category, int nodeId, string value, bool ignoreDuplicates = false, string varName = "" ) + { + if( string.IsNullOrEmpty( value ) ) + return false; + + switch( category ) + { + case MasterNodePortCategory.Vertex: + case MasterNodePortCategory.Tessellation: + { + return AddToVertexLocalVariables( nodeId, value, ignoreDuplicates, varName ); + } + case MasterNodePortCategory.Fragment: + case MasterNodePortCategory.Debug: + { + return AddToFragmentLocalVariables( nodeId, value, ignoreDuplicates, varName ); + } + } + + return false; + } + + public bool AddLocalVariable( int nodeId, string customType, string varName, string varValue ) + { + if( string.IsNullOrEmpty( varName ) || string.IsNullOrEmpty( varValue ) ) + return false; + + string value = customType + " " + varName + " = " + varValue + ";"; + return AddLocalVariable( nodeId, value, varName: varName ); + } + + private bool ValidadeLocalVariable( PrecisionType precisionType, WirePortDataType type, string varName, string varValue, ref string result ) + { + Array enumValues = Enum.GetValues( typeof( PrecisionType ) ); + foreach( PrecisionType currPrecision in enumValues) + { + string value = UIUtils.PrecisionWirePortToTypeValue( currPrecision, type, varName ) + " = " + varValue + ";"; + if( HasLocalVariable( value ) ) + return false; + + if( precisionType == currPrecision ) + result = value; + } + + return true; + } + + public bool AddLocalVariable( int nodeId, PrecisionType precisionType, WirePortDataType type, string varName, string varValue ) + { + if ( string.IsNullOrEmpty( varName ) || string.IsNullOrEmpty( varValue ) ) + { + return false; + } + + string value = string.Empty; + if ( ValidadeLocalVariable( precisionType, type, varName, varValue, ref value ) ) + { + return AddLocalVariable( nodeId, value, varName: varName ); + } + return false; + } + + public bool AddLocalVariable( int nodeId, string varName, string varValue, bool ignoreDuplicates = false, bool addSemiColon = false ) + { + string finalValue = addSemiColon ? varName + " = " + varValue + ";" : varName + " = " + varValue; + return AddLocalVariable( nodeId, finalValue, ignoreDuplicates, varName: varName ); + } + + public bool AddLocalVariable( int nodeId, string value, bool ignoreDuplicates = false, string varName = "" ) + { + if ( string.IsNullOrEmpty( value ) ) + { + return false; + } + + switch ( m_portCategory ) + { + case MasterNodePortCategory.Vertex: + case MasterNodePortCategory.Tessellation: + { + return AddToVertexLocalVariables( nodeId, value, ignoreDuplicates, varName ); + } + case MasterNodePortCategory.Fragment: + case MasterNodePortCategory.Debug: + { + return AddToFragmentLocalVariables( nodeId, value, ignoreDuplicates, varName ); + } + } + + return false; + } + + public string AddVirtualLocalVariable( int nodeId, string variable, string value ) + { + if( string.IsNullOrEmpty( value ) ) + return string.Empty; + + string result = string.Empty; + + if( !m_virtualVariablesDict.ContainsKey( value ) ) + { + m_virtualVariablesDict.Add( value, variable ); + result = variable; + } + else + { + m_virtualVariablesDict.TryGetValue( value, out result ); + } + return result; + } + + public void AddCodeComments( bool forceForwardSlash, params string[] comments ) + { + if( m_portCategory == MasterNodePortCategory.Tessellation || m_portCategory == MasterNodePortCategory.Vertex ) + { + AddToVertexLocalVariables( 0, IOUtils.CreateCodeComments( forceForwardSlash, comments ) ); + } + else + { + AddToFragmentLocalVariables( 0, IOUtils.CreateCodeComments( forceForwardSlash, comments ) ); + } + } + + public bool HasLocalVariable( string value ) + { + return HasLocalVariable( value, m_portCategory ); + } + + public bool HasLocalVariable( string value, MasterNodePortCategory category ) + { + switch( category ) + { + case MasterNodePortCategory.Vertex: + case MasterNodePortCategory.Tessellation: + { + return m_vertexLocalVariablesDict.ContainsKey( value ); + } + case MasterNodePortCategory.Fragment: + case MasterNodePortCategory.Debug: + { + if( m_usingCustomOutput ) + { + return m_customOutputDict.ContainsKey( value ); + } + else + { + return m_localVariablesDict.ContainsKey( value ); + } + } + } + return false; + } + + public bool HasLocalVariableByName( string varName ) + { + return HasLocalVariableByName( varName, m_portCategory ); + } + + public bool HasLocalVariableByName( string varName, MasterNodePortCategory category ) + { + switch ( category ) + { + case MasterNodePortCategory.Vertex: + case MasterNodePortCategory.Tessellation: + { + return m_vertexLocalVariablesByNameDict.ContainsKey( varName ); + } + case MasterNodePortCategory.Fragment: + case MasterNodePortCategory.Debug: + { + if ( m_usingCustomOutput ) + { + return m_customOutputByNameDict.ContainsKey( varName ); + } + else + { + return m_localVariablesByNameDict.ContainsKey( varName ); + } + } + } + return false; + } + + public bool AddToFragmentLocalVariables( int nodeId, string value, bool ignoreDuplicates = false, string varName = "" ) + { + if ( string.IsNullOrEmpty( value ) ) + { + return false; + } + + if ( m_usingCustomOutput ) + { + if ( !m_customOutputDict.ContainsKey( value ) || ignoreDuplicates ) + { + if ( !m_customOutputDict.TryGetValue( value, out PropertyDataCollector property ) ) + { + property = new PropertyDataCollector( nodeId, value ); + m_customOutputDict.Add( value, property ); + } + + if ( !string.IsNullOrEmpty( varName ) && !m_customOutputByNameDict.ContainsKey( varName ) ) + { + m_customOutputByNameDict.Add( varName, property ); + } + + m_customOutputList.Add( m_customOutputDict[ value ] ); + m_customOutput += "\t\t\t" + value + '\n'; + return true; + } + else + { + if ( m_showDebugMessages ) UIUtils.ShowMessage( "AddToLocalVariables:Attempting to add duplicate " + value, MessageSeverity.Warning ); + } + } + else + { + if ( !m_localVariablesDict.ContainsKey( value ) || ignoreDuplicates ) + { + if ( !m_localVariablesDict.TryGetValue( value, out PropertyDataCollector property ) ) + { + property = new PropertyDataCollector( nodeId, value ); + m_localVariablesDict.Add( value, property ); + } + + if ( !string.IsNullOrEmpty( varName ) && !m_localVariablesByNameDict.ContainsKey( varName ) ) + { + m_localVariablesByNameDict.Add( varName, property ); + } + + m_localVariablesList.Add( m_localVariablesDict[ value ] ); + AddToSpecialLocalVariables( nodeId, value, ignoreDuplicates ); + return true; + } + else + { + if ( m_showDebugMessages ) UIUtils.ShowMessage( "AddToLocalVariables:Attempting to add duplicate " + value, MessageSeverity.Warning ); + } + } + return false; + } + + public void AddToSpecialLocalVariables( int nodeId, string value, bool ignoreDuplicates = false, string varName = "" ) + { + if ( string.IsNullOrEmpty( value ) ) + return; + + if ( m_usingCustomOutput ) + { + if ( !m_customOutputDict.ContainsKey( value ) || ignoreDuplicates ) + { + if ( !m_customOutputDict.TryGetValue( value, out PropertyDataCollector property ) ) + { + property = new PropertyDataCollector( nodeId, value ); + m_customOutputDict.Add( value, property ); + } + + if ( !string.IsNullOrEmpty( varName ) && !m_customOutputByNameDict.ContainsKey( varName ) ) + { + m_customOutputByNameDict.Add( varName, property ); + } + + m_customOutputList.Add( m_customOutputDict[ value ] ); + m_customOutput += "\t\t\t" + value + '\n'; + m_dirtySpecialLocalVariables = true; + } + else + { + if ( m_showDebugMessages ) UIUtils.ShowMessage( "AddToSpecialLocalVariables:Attempting to add duplicate " + value, MessageSeverity.Warning ); + } + } + else + { + if ( !m_specialLocalVariablesDict.ContainsKey( value ) || ignoreDuplicates ) + { + if ( !m_specialLocalVariablesDict.TryGetValue( value, out PropertyDataCollector property ) ) + { + property = new PropertyDataCollector( nodeId, value ); + m_specialLocalVariablesDict.Add( value, property ); + } + + if ( !string.IsNullOrEmpty( varName ) && !m_specialLocalVariablesByNameDict.ContainsKey( varName ) ) + { + m_specialLocalVariablesByNameDict.Add( value, property ); + } + + m_specialLocalVariablesList.Add( m_specialLocalVariablesDict[ value ] ); + m_specialLocalVariables += "\t\t\t" + value + '\n'; + m_dirtySpecialLocalVariables = true; + } + else + { + if ( m_showDebugMessages ) UIUtils.ShowMessage( "AddToSpecialLocalVariables:Attempting to add duplicate " + value, MessageSeverity.Warning ); + } + } + } + + public void ClearSpecialLocalVariables() + { + //m_specialLocalVariablesDict.Clear(); + m_specialLocalVariables = string.Empty; + m_dirtySpecialLocalVariables = false; + } + + public bool AddToVertexLocalVariables( int nodeId, string varName, string varValue ) + { + if ( string.IsNullOrEmpty( varName ) || string.IsNullOrEmpty( varValue ) ) + return false; + + string value = varName + " = " + varValue + ";"; + return AddToVertexLocalVariables( nodeId, value, varName: varName ); + } + + public bool AddToVertexLocalVariables( int nodeId, PrecisionType precisionType, WirePortDataType type, string varName, string varValue ) + { + if ( string.IsNullOrEmpty( varName ) || string.IsNullOrEmpty( varValue ) ) + return false; + + string value = UIUtils.PrecisionWirePortToCgType( precisionType, type ) + " " + varName + " = " + varValue + ";"; + return AddToVertexLocalVariables( nodeId, value, varName: varName ); + } + + public bool AddToVertexLocalVariables( int nodeId, string value, bool ignoreDuplicates = false, string varName = "" ) + { + if ( string.IsNullOrEmpty( value ) ) + return false; + + if ( !m_vertexLocalVariablesDict.ContainsKey( value ) || ignoreDuplicates ) + { + if ( !m_vertexLocalVariablesDict.TryGetValue( value, out PropertyDataCollector property ) ) + { + property = new PropertyDataCollector( nodeId, value ); + m_vertexLocalVariablesDict.Add( value, property ); + } + + if ( !string.IsNullOrEmpty( varName ) && !m_vertexLocalVariablesByNameDict.ContainsKey( value ) ) + { + m_vertexLocalVariablesByNameDict.Add( value, property ); + } + + m_vertexLocalVariablesList.Add( m_vertexLocalVariablesDict[ value ] ); + m_vertexLocalVariables += "\t\t\t" + value + '\n'; + m_dirtyVertexLocalVariables = true; + return true; + } + else + { + if ( m_showDebugMessages ) UIUtils.ShowMessage( "AddToVertexLocalVariables:Attempting to add duplicate " + value, MessageSeverity.Warning ); + } + + return false; + } + + public void ClearVertexLocalVariables() + { + //m_vertexLocalVariablesDict.Clear(); + m_vertexLocalVariables = string.Empty; + m_dirtyVertexLocalVariables = false; + } + + + public bool CheckFunction( string header ) + { + return m_localFunctions.ContainsKey( header ); + } + + public string AddFunctions( string header, string body, params object[] inParams ) + { + if( !m_localFunctions.ContainsKey( header ) ) + { + m_localFunctions.Add( header, body ); + m_functionsList.Add( new PropertyDataCollector( -1, body.Replace( "\t\t", string.Empty ) ) ); + m_functions += "\n" + body + "\n"; + m_dirtyFunctions = true; + } + + return String.Format( header, inParams ); + } + + public string AddFunctions( string header, string[] bodyLines, bool addNewLine, params object[] inParams ) + { + if( !m_localFunctions.ContainsKey( header ) ) + { + string body = string.Empty; + for( int i = 0; i < bodyLines.Length; i++ ) + { + body += ( m_masterNodeCategory == AvailableShaderTypes.Template ) ? bodyLines[ i ] : "\t\t" + bodyLines[ i ]; + if( addNewLine ) + body += '\n'; + } + + m_localFunctions.Add( header, body ); + m_functionsList.Add( new PropertyDataCollector( -1, body ) ); + m_functions += "\n" + body + "\n"; + m_dirtyFunctions = true; + } + + return String.Format( header, inParams ); + } + + public bool HasFunction( string functionId ) + { + return m_localFunctions.ContainsKey( functionId ); + } + + public void AddFunction( string functionId, string body ) + { + if( !m_localFunctions.ContainsKey( functionId ) ) + { + m_functionsList.Add( new PropertyDataCollector( -1, body ) ); + + m_localFunctions.Add( functionId, body ); + m_functions += "\n" + body + "\n"; + m_dirtyFunctions = true; + } + } + + public void AddFunction( string functionId, string[] bodyLines, bool addNewline ) + { + if( !m_localFunctions.ContainsKey( functionId ) ) + { + string body = string.Empty; + for( int i = 0; i < bodyLines.Length; i++ ) + { + body += ( m_masterNodeCategory == AvailableShaderTypes.Template ) ? bodyLines[ i ] : "\t\t" + bodyLines[ i ]; + if( addNewline ) + body += '\n'; + + } + m_functionsList.Add( new PropertyDataCollector( -1, body ) ); + + m_localFunctions.Add( functionId, body ); + m_functions += "\n" + body + "\n"; + m_dirtyFunctions = true; + } + } + + public void AddInstructions( string value, bool addTabs = false, bool addLineEnding = false ) + { + m_instructionsList.Add( new PropertyDataCollector( -1, value ) ); + m_instructions += addTabs ? "\t\t\t" + value : value; + if( addLineEnding ) + { + m_instructions += '\n'; + } + m_dirtyInstructions = true; + } + + + public void AddInstructions( bool addLineEnding, bool addTabs, params string[] values ) + { + for( int i = 0; i < values.Length; i++ ) + { + m_instructionsList.Add( new PropertyDataCollector( -1, values[ i ] ) ); + m_instructions += addTabs ? "\t\t\t" + values[ i ] : values[ i ]; + if( addLineEnding ) + { + m_instructions += '\n'; + } + } + m_dirtyInstructions = true; + } + + + + public void AddToStartInstructions( string value ) + { + if( string.IsNullOrEmpty( value ) ) + return; + + m_instructions = value + m_instructions; + m_dirtyInstructions = true; + } + + public void ResetInstructions() + { + m_instructionsList.Clear(); + m_instructions = string.Empty; + m_dirtyInstructions = false; + } + + + public void ResetVertexInstructions() + { + m_vertexDataList.Clear(); + m_vertexData = string.Empty; + m_dirtyPerVertexData = false; + } + + public void AddPropertyNode( PropertyNode node ) + { + if( !m_propertyNodes.ContainsKey( node.UniqueId ) ) + { + m_propertyNodes.Add( node.UniqueId, node ); + } + } + + public void UpdateMaterialOnPropertyNodes( Material material ) + { + m_masterNode.UpdateMaterial( material ); + foreach( KeyValuePair kvp in m_propertyNodes ) + { + kvp.Value.UpdateMaterial( material ); + } + } + + public void AddToVertexInput( string value ) + { + if( !m_vertexInputDict.ContainsKey( value ) ) + { + m_vertexInputDict.Add( value, value ); + m_vertexInputList.Add( value ); + } + } + + public void AddToInterpolators( string value ) + { + if( !m_interpolatorsDict.ContainsKey( value ) ) + { + m_interpolatorsDict.Add( value, value ); + m_interpolatorsList.Add( value ); + } + } + + public void AddToVertexInterpolatorsDecl( string value ) + { + if( !m_vertexInterpDeclDict.ContainsKey( value ) ) + { + m_vertexInterpDeclDict.Add( value, value ); + m_vertexInterpDeclList.Add( value ); + } + } + + public void UpdateShaderImporter( ref Shader shader ) + { + ShaderImporter importer = (ShaderImporter)ShaderImporter.GetAtPath( AssetDatabase.GetAssetPath( shader ) ); + if( m_propertyNodes.Count > 0 ) + { + try + { + bool hasContents = false; + TextureDefaultsDataColector defaultCol = new TextureDefaultsDataColector(); + foreach( KeyValuePair kvp in m_propertyNodes ) + { + hasContents = kvp.Value.UpdateShaderDefaults( ref shader, ref defaultCol ) || hasContents; + } + + if( hasContents ) + { + importer.SetDefaultTextures( defaultCol.NamesArr, defaultCol.ValuesArr ); + defaultCol.Destroy(); + defaultCol = null; + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + importer.SaveAndReimport(); + } + + public void AddCustomAppData( string value ) + { + if( m_customAppDataItemsDict.ContainsKey( value ) ) + return; + + m_customAppDataItemsDict.Add( value, value ); + m_customAppDataItems += "\t\t\t" + value + "\n"; + m_dirtyAppData = true; + } + + public void ForceCustomAppDataUsage() + { + m_dirtyAppData = true; + } + + //public string CustomAppDataName { get { return m_dirtyAppData ? Constants.CustomAppDataFullName : Constants.AppDataFullName; } } + public string SurfaceVertexStructure { get { return ( m_dirtyAppData ? Constants.CustomAppDataFullName : Constants.AppDataFullName ); } } + public string CustomAppData + { + get + { + if( m_dirtyPerVertexData ) + { + return Constants.CustomAppDataFullBody + m_customAppDataItems + "\t\t};\n"; + } + else if ( m_dirtyAppData ) + { + return Constants.CustomAppDataFullBody + "\t\t};\n"; + } + + return string.Empty; + } + } + + public void Destroy() + { + m_masterNode = null; + + m_customAppDataItemsDict.Clear(); + m_customAppDataItemsDict = null; + + m_inputList.Clear(); + m_inputList = null; + + m_customInputList.Clear(); + m_customInputList = null; + + m_propertiesList.Clear(); + m_propertiesList = null; + + m_instancedPropertiesList.Clear(); + m_instancedPropertiesList = null; + + m_dotsPropertiesList.Clear(); + m_dotsPropertiesList = null; + + m_dotsDefinesList.Clear(); + m_dotsDefinesList = null; + + m_uniformsList.Clear(); + m_uniformsList = null; + + m_additionalDirectivesList.Clear(); + m_additionalDirectivesList = null; + + m_includesList.Clear(); + m_includesList = null; + + //m_tagsList.Clear(); + //m_tagsList = null; + + m_pragmasList.Clear(); + m_pragmasList = null; + + m_definesList.Clear(); + m_definesList = null; + + m_instructionsList.Clear(); + m_instructionsList = null; + + m_localVariablesList.Clear(); + m_localVariablesList = null; + + m_vertexLocalVariablesList.Clear(); + m_vertexLocalVariablesList = null; + + m_specialLocalVariablesList.Clear(); + m_specialLocalVariablesList = null; + + m_vertexDataList.Clear(); + m_vertexDataList = null; + + m_customOutputList.Clear(); + m_customOutputList = null; + + m_functionsList.Clear(); + m_functionsList = null; + + m_grabPassList.Clear(); + m_grabPassList = null; + + m_aboveUsePassesList.Clear(); + m_aboveUsePassesList = null; + + m_belowUsePassesList.Clear(); + m_belowUsePassesList = null; + + m_grabPassDict.Clear(); + m_grabPassDict = null; + + m_usePassesDict.Clear(); + m_usePassesDict = null; + + m_propertyNodes.Clear(); + m_propertyNodes = null; + + m_inputDict.Clear(); + m_inputDict = null; + + m_customInputDict.Clear(); + m_customInputDict = null; + + m_propertiesDict.Clear(); + m_propertiesDict = null; + + m_dotsPropertiesDict.Clear(); + m_dotsPropertiesDict = null; + + m_instancedPropertiesDict.Clear(); + m_instancedPropertiesDict = null; + + m_uniformsDict.Clear(); + m_uniformsDict = null; + + m_softRegisteredUniformsDict.Clear(); + m_softRegisteredUniformsDict = null; + + m_includesDict.Clear(); + m_includesDict = null; + + m_additionalDirectivesDict.Clear(); + m_additionalDirectivesDict = null; + + m_includesExclusionDict.Clear(); + m_includesExclusionDict = null; + //m_tagsDict.Clear(); + //m_tagsDict = null; + + m_pragmasDict.Clear(); + m_pragmasDict = null; + + m_definesDict.Clear(); + m_definesDict = null; + + m_virtualCoordinatesDict.Clear(); + m_virtualCoordinatesDict = null; + + m_virtualVariablesDict.Clear(); + m_virtualVariablesDict = null; + + m_localVariablesDict.Clear(); + m_localVariablesDict = null; + + m_localVariablesByNameDict.Clear(); + m_localVariablesByNameDict = null; + + m_specialLocalVariablesDict.Clear(); + m_specialLocalVariablesDict = null; + + m_specialLocalVariablesByNameDict.Clear(); + m_specialLocalVariablesByNameDict = null; + + m_vertexLocalVariablesDict.Clear(); + m_vertexLocalVariablesDict = null; + + m_vertexLocalVariablesByNameDict.Clear(); + m_vertexLocalVariablesByNameDict = null; + + m_localFunctions.Clear(); + m_localFunctions = null; + + m_vertexDataDict.Clear(); + m_vertexDataDict = null; + + m_customOutputDict.Clear(); + m_customOutputDict = null; + + m_customOutputByNameDict.Clear(); + m_customOutputByNameDict = null; + + //templates + m_vertexInputList.Clear(); + m_vertexInputList = null; + + m_vertexInputDict.Clear(); + m_vertexInputDict = null; + + m_interpolatorsList.Clear(); + m_interpolatorsList = null; + + m_interpolatorsDict.Clear(); + m_interpolatorsDict = null; + + m_vertexInterpDeclList.Clear(); + m_vertexInterpDeclList = null; + + m_vertexInterpDeclDict.Clear(); + m_vertexInterpDeclDict = null; + + m_templateDataCollector.Destroy(); + m_templateDataCollector = null; + + m_customShadowCoordsDict.Clear(); + m_customShadowCoordsDict = null; + + m_customShadowCoordsList.Clear(); + m_customShadowCoordsDict = null; + + m_packSlotsList.Clear(); + m_packSlotsList = null; + } + + public string Inputs { get { return m_input; } } + public string CustomInput { get { return m_customInput; } } + public string Properties { get { return m_properties; } } + public string InstanceBlockName { get { return m_instanceBlockName; } } + public string InstancedProperties { get { return m_instancedProperties; } } + public string Uniforms { get { return m_uniforms; } } + public string Instructions { get { return m_instructions; } } + public string Includes { get { return m_includes; } } + public string Pragmas { get { return m_pragmas; } } + public string Defines { get { return m_defines; } } + public string LocalVariables { get { return m_localVariables; } } + public string SpecialLocalVariables { get { return m_specialLocalVariables; } } + public string VertexLocalVariables { get { return m_vertexLocalVariables; } } + //public string VertexLocalVariablesFromList + //{ + // get + // { + // string result = string.Empty; + // int count = m_vertexLocalVariablesList.Count; + // for( int i = 0; i < count; i++ ) + // { + // result += m_vertexLocalVariablesList[ i ].PropertyName + "\n"; + // } + // return result; + // } + //} + public string VertexData { get { return m_vertexData; } } + public string CustomOutput { get { return m_customOutput; } } + public string Functions { get { return m_functions; } } + public string GrabPass { get { return m_grabPass; } } + public bool DirtyAppData { get { return m_dirtyAppData; } } + public bool DirtyInstructions { get { return m_dirtyInstructions; } } + public bool DirtyUniforms { get { return m_dirtyUniforms; } } + public bool DirtyProperties { get { return m_dirtyProperties; } } + public bool DirtyInstancedProperties { get { return m_dirtyInstancedProperties; } } + public bool DirtyInputs { get { return m_dirtyInputs; } } + public bool DirtyCustomInput { get { return m_dirtyCustomInputs; } } + public bool DirtyIncludes { get { return m_dirtyIncludes; } } + public bool DirtyPragmas { get { return m_dirtyPragmas; } } + public bool DirtyDefines { get { return m_dirtyDefines; } } + public bool DirtyAdditionalDirectives { get { return m_dirtyAdditionalDirectives; } } + public bool DirtyLocalVariables { get { return m_dirtyLocalVariables; } } + public bool DirtyVertexVariables { get { return m_dirtyVertexLocalVariables; } } + public bool DirtySpecialLocalVariables { get { return m_dirtySpecialLocalVariables; } } + public bool DirtyPerVertexData { get { return m_dirtyPerVertexData; } } + public bool DirtyFunctions { get { return m_dirtyFunctions; } } + public bool DirtyGrabPass { get { return m_grabPassIsDirty; } } + public int LocalVariablesAmount { get { return m_localVariablesDict.Count; } } + public int SpecialLocalVariablesAmount { get { return m_specialLocalVariablesDict.Count; } } + public int VertexLocalVariablesAmount { get { return m_vertexLocalVariablesDict.Count; } } + public bool TesselationActive { set { m_tesselationActive = value; } get { return m_tesselationActive; } } + + + public int AvailableVertexTempId { get { return m_availableVertexTempId++; } } + public int AvailableFragTempId { get { return m_availableFragTempId++; } } + + /// + /// Returns true if Normal output is being written by something else + /// + public bool DirtyNormal + { + get { return m_dirtyNormal; } + set { m_dirtyNormal = value; } + } + + public bool IsFragmentCategory + { + get { return m_portCategory == MasterNodePortCategory.Fragment || m_portCategory == MasterNodePortCategory.Debug; } + } + + public MasterNodePortCategory PortCategory + { + get { return m_portCategory; } + set { m_portCategory = value; } + } + + public PortGenType GenType + { + get { return m_genType; } + set { m_genType = value; } + } + + public bool IsTemplate { get { return m_masterNodeCategory == AvailableShaderTypes.Template; } } + + public bool IsSRP { get { return ( TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.URP || TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ); } } + + public AvailableShaderTypes MasterNodeCategory + { + get { return m_masterNodeCategory; } + set { m_masterNodeCategory = value; } + } + + public string CurrentPassName + { + get + { + var multiPassMasterNode = m_masterNode as TemplateMultiPassMasterNode; + return ( multiPassMasterNode != null ) ? multiPassMasterNode.PassName : string.Empty; + } + } + + /// + /// Forces write to Normal output when the output is not connected + /// + public bool ForceNormal + { + get { return m_forceNormal; } + set + { + if( value ) + { + if( !m_forceNormalIsDirty ) + { + m_forceNormal = value; + m_forceNormalIsDirty = value; + } + } + else + { + m_forceNormal = value; + } + } + } + + public bool UsingVertexColor + { + get { return m_usingVertexColor; } + set { m_usingVertexColor = value; } + } + + public bool UsingInternalData + { + get { return m_usingInternalData; } + set { m_usingInternalData = value; } + } + + public bool UsingScreenPos + { + get { return m_usingScreenPos; } + set { m_usingScreenPos = value; } + } + + public bool UsingCustomScreenPos + { + get { return m_usingCustomScreenPos; } + set { m_usingCustomScreenPos = value; } + } + + public bool UsingWorldNormal + { + get { return m_usingWorldNormal; } + set { m_usingWorldNormal = value; } + } + + public bool UsingWorldReflection + { + get { return m_usingWorldReflection; } + set { m_usingWorldReflection = value; } + } + + public bool UsingWorldPosition + { + get { return m_usingWorldPosition; } + set { m_usingWorldPosition = value; } + } + + public bool UsingViewDirection + { + get { return m_usingViewDirection; } + set { m_usingViewDirection = value; } + } + + public bool IsOutlineDataCollector + { + get { return m_isOutlineDataCollector; } + set { m_isOutlineDataCollector = value; } + } + + public bool UsingCustomOutlineColor + { + get { return m_usingCustomOutlineColor; } + set { m_usingCustomOutlineColor = value; } + } + + public bool UsingCustomOutlineWidth + { + get { return m_usingCustomOutlineWidth; } + set { m_usingCustomOutlineWidth = value; } + } + + public bool UsingCustomOutlineAlpha + { + get { return m_usingCustomOutlineAlpha; } + set { m_usingCustomOutlineAlpha = value; } + } + + public int CustomOutlineSelectedAlpha + { + get { return m_customOutlineSelectedAlpha; } + set { m_customOutlineSelectedAlpha = value; } + } + + public bool UsingCustomOutput + { + get { return m_usingCustomOutput; } + set { m_usingCustomOutput = value; } + } + + public bool UsingHigherSizeTexcoords + { + get { return m_usingHigherSizeTexcoords; } + set { m_usingHigherSizeTexcoords = value; } + } + + public bool UsingLightAttenuation + { + get { return m_usingLightAttenuation; } + set { m_usingLightAttenuation = value; } + } + + public bool UsingTextureArrays + { + get { return m_usingTextureArrays; } + set { m_usingTextureArrays = value; } + } + + public bool UsingExtraStandardMacros + { + get { return m_usingExtraStandardMacros; } + set { m_usingExtraStandardMacros = value; } + } + + public MacrosMask Using2DMacrosMask + { + get { return m_using2DMacrosMask; } + set { m_using2DMacrosMask = value; } + } + + public MacrosMask Using3DMacrosMask + { + get { return m_using3DMacrosMask; } + set { m_using3DMacrosMask = value; } + } + + public MacrosMask UsingCUBEMacrosMask + { + get { return m_usingCUBEMacrosMask; } + set { m_usingCUBEMacrosMask = value; } + } + + public MacrosMask Using2DArrayMacrosMask + { + get { return m_using2DArrayMacrosMask; } + set { m_using2DArrayMacrosMask = value; } + } + + public bool UsingExtra3DSRPMacros + { + get { return m_usingExtra3DSRPMacros; } + set { m_usingExtra3DSRPMacros = value; } + } + + public bool UsingArrayDerivatives + { + get { return m_usingArrayDerivatives; } + set { m_usingArrayDerivatives = value; } + } + + public bool SafeNormalizeLightDir + { + get { return m_safeNormalizeLightDir; } + set { m_safeNormalizeLightDir = value; } + } + + public bool SafeNormalizeViewDir + { + get { return m_safeNormalizeViewDir; } + set { m_safeNormalizeViewDir = value; } + } + + public string StandardAdditionalDirectives + { + get + { + string body = string.Empty; + int count = m_additionalDirectivesList.Count; + for( int i = 0; i < count; i++ ) + { + body += "\t\t" + m_additionalDirectivesList[ i ].PropertyName + "\n"; + } + return body; + } + } + + public bool SurfaceCustomShadowCaster + { + get { return m_surfaceCustomShadowCaster; } + set { m_surfaceCustomShadowCaster = value; } + } + + public bool CustomOutline { get { return UsingCustomOutlineColor || UsingCustomOutlineWidth || UsingCustomOutlineAlpha; } } + public List InputList { get { return m_inputList; } } + public List CustomInputList { get { return m_customInputList; } } + public List PropertiesList { get { return m_propertiesList; } } + public List InstancedPropertiesList { get { return m_instancedPropertiesList; } } + public List DotsPropertiesList { get { return m_dotsPropertiesList; } } + public List DotsDefinesList { get { return m_dotsDefinesList; } } + public List UniformsList { get { return m_uniformsList; } } + public List MiscList { get { return m_additionalDirectivesList; } } + public List BeforeNativeDirectivesList { get { return m_additionalDirectivesList.FindAll( obj => obj.OrderIndex < 0 ); } } + public List AfterNativeDirectivesList { get { return m_additionalDirectivesList.FindAll( obj => obj.OrderIndex > 0 ); } } + public List IncludesList { get { return m_includesList; } } + //public List TagsList { get { return m_tagsList; } } + public List PragmasList { get { return m_pragmasList; } } + public List DefinesList { get { return m_definesList; } } + public List InstructionsList { get { return m_instructionsList; } } + public List LocalVariablesList { get { return m_localVariablesList; } } + public List VertexLocalVariablesList { get { return m_vertexLocalVariablesList; } } + public List SpecialLocalVariablesList { get { return m_specialLocalVariablesList; } } + public List VertexDataList { get { return m_vertexDataList; } } + public List CustomOutputList { get { return m_customOutputList; } } + public List FunctionsList { get { return m_functionsList; } } + public List GrabPassList { get { return m_grabPassList; } } + public Dictionary GrabPassDict { get { return m_grabPassDict; } } + public List AboveUsePassesList { get { return m_aboveUsePassesList; } } + public List BelowUsePassesList { get { return m_belowUsePassesList; } } + public Dictionary AboveUsePassesDict { get { return m_usePassesDict; } } + public List CustomShadowCoordsList { get { return m_customShadowCoordsList; } } + public List PackSlotsList { get { return m_packSlotsList; } } + public Dictionary LocalFunctions { get { return m_localFunctions; } } + //Templates + public List VertexInputList { get { return m_vertexInputList; } } + public List InterpolatorList { get { return m_interpolatorsList; } } + public List VertexInterpDeclList { get { return m_vertexInterpDeclList; } } + public TemplateDataCollector TemplateDataCollectorInstance { get { return m_templateDataCollector; } } + public RenderPath CurrentRenderPath + { + get { return m_renderPath; } + set { m_renderPath = value; } + } + + public NodeAvailability CurrentCanvasMode { get { return m_currentCanvasMode; } set { m_currentCanvasMode = value; } } + public TemplateSRPType CurrentSRPType + { + get + { + if( IsTemplate ) + return m_templateDataCollector.CurrentSRPType; + + return TemplateSRPType.BiRP; + } + } + + public Dictionary PropertiesDict { get { return m_propertiesDict; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs.meta new file mode 100644 index 00000000..9f9ad138 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d026d775ff431f34789437db3fb4abbb +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs new file mode 100644 index 00000000..23c104ef --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs @@ -0,0 +1,683 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + public enum OutlineMode + { + VertexOffset, + VertexScale + } + + [Serializable] + public sealed class OutlineOpHelper + { + + private string[] ModeTags = + { + "Tags{ }", + "Tags{ \"RenderType\" = \"TransparentCutout\" \"Queue\" = \"AlphaTest+0\"}", + "Tags{ \"RenderType\" = \"Transparent\" \"Queue\" = \"Transparent+0\"}", + "Tags{ \"RenderType\" = \"Transparent\" \"Queue\" = \"Transparent+0\" }" + }; + + private string[] ModePragma = + { + string.Empty, + string.Empty, + "alpha:fade ", + "alpha:premul " + }; + + + private readonly string OutlineSurfaceConfig = "#pragma surface outlineSurf Outline {0} keepalpha noshadow noambient novertexlights nolightmap nodynlightmap nodirlightmap nometa noforwardadd vertex:outlineVertexDataFunc "; + + private readonly string OutlineBodyStructBegin = "struct Input {"; + private readonly string OutlineBodyStructDefault = "\thalf filler;"; + private readonly string OutlineBodyStructEnd = "};"; + + private readonly string OutlineDefaultUniformColor = "half4 _ASEOutlineColor;"; + private readonly string OutlineDefaultUniformWidth = "half _ASEOutlineWidth;"; + private readonly string OutlineDefaultUniformColorInstanced = "UNITY_DEFINE_INSTANCED_PROP( half4, _ASEOutlineColor )"; + private readonly string OutlineDefaultUniformWidthInstanced = "UNITY_DEFINE_INSTANCED_PROP( half, _ASEOutlineWidth )"; + + private readonly string OutlineDefaultVertexHeader = "void outlineVertexDataFunc( inout appdata_full v, out Input o )\n\t\t{"; + private readonly string OutlineTessVertexHeader = "void outlineVertexDataFunc( inout appdata_full v )\n\t\t{"; + + private readonly string OutlineDefaultVertexOutputDeclaration = "\tUNITY_INITIALIZE_OUTPUT( Input, o );"; + + private readonly string[] OutlineSurfBody = { + "\to.Emission = _ASEOutlineColor.rgb;", + "\to.Alpha = 1;" + }; + + private readonly string[] OutlineSurfBodyInstanced = { + "\to.Emission = UNITY_ACCESS_INSTANCED_PROP(_ASEOutlineColor).rgb;", + "\to.Alpha = 1;" + }; + + private readonly string[] OutlineBodyDefaultSurfBegin = { + "}", + "inline half4 LightingOutline( SurfaceOutput s, half3 lightDir, half atten ) { return half4 ( 0,0,0, s.Alpha); }", + "void outlineSurf( Input i, inout SurfaceOutput o )", + "{"}; + + private readonly string[] OutlineBodyDefaultSurfEnd = { + "}", + "ENDCG", + "\n"}; + + //private const string OutlineInstancedHeader = "#pragma multi_compile_instancing"; + + //private readonly string[] OutlineBodyInstancedBegin = { + // "UNITY_INSTANCING_CBUFFER_START({0})", + // "\tUNITY_DEFINE_INSTANCED_PROP( half4, _ASEOutlineColor )", + // "\tUNITY_DEFINE_INSTANCED_PROP(half, _ASEOutlineWidth)", + // "UNITY_INSTANCING_CBUFFER_END", + // "void outlineVertexDataFunc( inout appdata_full v, out Input o )", + // "{", + // "\tUNITY_INITIALIZE_OUTPUT( Input, o );"}; + + //private readonly string[] OutlineBodyInstancedEnd = { + // "}", + // "inline half4 LightingOutline( SurfaceOutput s, half3 lightDir, half atten ) { return half4 ( 0,0,0, s.Alpha); }", + // "void outlineSurf( Input i, inout SurfaceOutput o ) { o.Emission = UNITY_ACCESS_INSTANCED_PROP( _ASEOutlineColor ).rgb; o.Alpha = 1; }", + // "ENDCG", + // "\n"}; + + private const string WidthVariableAccessInstanced = "UNITY_ACCESS_INSTANCED_PROP( _ASEOutlineWidth )"; + + private const string OutlineVertexOffsetMode = "\tv.vertex.xyz += ( v.normal * {0} );"; + private const string OutlineVertexScaleMode = "\tv.vertex.xyz *= ( 1 + {0});"; + private const string OutlineVertexCustomMode = "\tv.vertex.xyz += {0};"; + + private const string OutlineColorLabel = "Color"; + private const string OutlineWidthLabel = "Width"; + + private const string ColorPropertyName = "_ASEOutlineColor"; + private const string WidthPropertyName = "_ASEOutlineWidth"; + + + private const string WidthPropertyNameInstanced = "UNITY_ACCESS_INSTANCED_PROP(_ASEOutlineWidth)"; + + + + private const string ColorPropertyDec = "_ASEOutlineColor( \"Outline Color\", Color ) = ({0})"; + private const string OutlinePropertyDec = "_ASEOutlineWidth( \"Outline Width\", Float ) = {0}"; + + private const string ModePropertyStr = "Mode"; + + private const string NoFogStr = "No Fog"; + + private const string BillboardInstructionFormat = "\t{0};"; + + private readonly char[] m_colorMaskChar = { 'R' , 'G' , 'B' , 'A' }; + + [SerializeField] + private Color m_outlineColor; + + [SerializeField] + private float m_outlineWidth; + + [SerializeField] + private bool m_enabled; + + [SerializeField] + private OutlineMode m_mode = OutlineMode.VertexOffset; + + [SerializeField] + private bool m_noFog = true; + + private bool[] m_colorMask = { true , true , true , true }; + private CullMode m_cullMode = CullMode.Front; + private int m_zTestMode = 0; + private int m_zWriteMode = 0; + private bool m_dirtyInput = false; + private string m_inputs = string.Empty; + private List m_inputList = new List(); + private string m_uniforms = string.Empty; + private List m_uniformList = new List(); + private List m_instancedPropertiesList = new List(); + private string m_instancedProperties = string.Empty; + private string m_instructions = string.Empty; + private string m_functions = string.Empty; + private string m_includes = string.Empty; + private string m_pragmas = string.Empty; + private string m_defines = string.Empty; + private string m_standardAdditionalDirectives = string.Empty; + private string m_vertexData = string.Empty; + private string m_grabPasses = string.Empty; + private Dictionary m_localFunctions; + + //private OutlineMode m_customMode = OutlineMode.VertexOffset; + private int m_offsetMode = 0; + private bool m_customNoFog = true; + + public void Draw( ParentNode owner, GUIStyle toolbarstyle, Material mat ) + { + Color cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); + EditorGUILayout.BeginHorizontal( toolbarstyle ); + GUI.color = cachedColor; + owner.ContainerGraph.ParentWindow.InnerWindowVariables.OutlineActiveMode = owner.GUILayoutToggle( owner.ContainerGraph.ParentWindow.InnerWindowVariables.OutlineActiveMode , EditorVariablesManager.OutlineActiveMode.LabelName, UIUtils.MenuItemToggleStyle, GUILayout.ExpandWidth( true ) ); + EditorGUI.BeginChangeCheck(); + m_enabled = owner.EditorGUILayoutToggle( string.Empty, m_enabled, UIUtils.MenuItemEnableStyle, GUILayout.Width( 16 ) ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_enabled ) + UpdateToMaterial( mat ); + + UIUtils.RequestSave(); + } + EditorGUILayout.EndHorizontal(); + + if( owner.ContainerGraph.ParentWindow.InnerWindowVariables.OutlineActiveMode ) + { + cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); + EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); + GUI.color = cachedColor; + + EditorGUILayout.Separator(); + EditorGUI.BeginDisabledGroup( !m_enabled ); + + EditorGUI.indentLevel += 1; + { + m_mode = (OutlineMode)owner.EditorGUILayoutEnumPopup( ModePropertyStr, m_mode ); + + EditorGUI.BeginChangeCheck(); + m_outlineColor = owner.EditorGUILayoutColorField( OutlineColorLabel, m_outlineColor ); + if( EditorGUI.EndChangeCheck() && mat != null ) + { + if( mat.HasProperty( ColorPropertyName ) ) + { + mat.SetColor( ColorPropertyName, m_outlineColor ); + } + } + + EditorGUI.BeginChangeCheck(); + m_outlineWidth = owner.EditorGUILayoutFloatField( OutlineWidthLabel, m_outlineWidth ); + if( EditorGUI.EndChangeCheck() && mat != null ) + { + if( mat.HasProperty( WidthPropertyName ) ) + { + mat.SetFloat( WidthPropertyName, m_outlineWidth ); + } + } + + m_noFog = owner.EditorGUILayoutToggle( NoFogStr, m_noFog ); + } + + EditorGUI.indentLevel -= 1; + EditorGUI.EndDisabledGroup(); + EditorGUILayout.Separator(); + EditorGUILayout.EndVertical(); + } + } + + public void UpdateToMaterial( Material mat ) + { + if( mat == null ) + return; + + if( mat.HasProperty( ColorPropertyName ) ) + { + mat.SetColor( ColorPropertyName, m_outlineColor ); + } + + if( mat.HasProperty( WidthPropertyName ) ) + { + mat.SetFloat( WidthPropertyName, m_outlineWidth ); + } + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + m_enabled = Convert.ToBoolean( nodeParams[ index++ ] ); + m_outlineWidth = Convert.ToSingle( nodeParams[ index++ ] ); + m_outlineColor = IOUtils.StringToColor( nodeParams[ index++ ] ); + if( UIUtils.CurrentShaderVersion() > 5004 ) + { + m_mode = (OutlineMode)Enum.Parse( typeof( OutlineMode ), nodeParams[ index++ ] ); + } + + if( UIUtils.CurrentShaderVersion() > 13902 ) + { + m_noFog = Convert.ToBoolean( nodeParams[ index++ ] ); + } + } + + public void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_enabled ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_outlineWidth ); + IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.ColorToString( m_outlineColor ) ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_mode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_noFog ); + } + + public void AddToDataCollector( ref MasterNodeDataCollector dataCollector ) + { + if( !dataCollector.UsingCustomOutlineColor ) + dataCollector.AddToProperties( -1, string.Format( ColorPropertyDec, IOUtils.ColorToString( m_outlineColor ) ), -1 ); + if( !dataCollector.UsingCustomOutlineWidth ) + dataCollector.AddToProperties( -1, string.Format( OutlinePropertyDec, m_outlineWidth ), -1 ); + } + + public void UpdateFromMaterial( Material mat ) + { + if( mat.HasProperty( ColorPropertyName ) ) + { + m_outlineColor = mat.GetColor( ColorPropertyName ); + } + + if( mat.HasProperty( WidthPropertyName ) ) + { + m_outlineWidth = mat.GetFloat( WidthPropertyName ); + } + } + + void AddMultibodyString( string body , List list ) + { + body = body.Replace( "\t\t", string.Empty ); + string[] strArr = body.Split( '\n' ); + for( int i = 0; i < strArr.Length; i++ ) + { + list.Add( strArr[ i ] ); + } + + } + public string[] OutlineFunctionBody( ref MasterNodeDataCollector dataCollector, bool instanced, bool isShadowCaster, string shaderName, string[] billboardInfo, ref TessellationOpHelper tessOpHelper, string target, PrecisionType precision ) + { + List body = new List(); + body.Add( ModeTags[ dataCollector.CustomOutlineSelectedAlpha ] ); + if( !string.IsNullOrEmpty( m_grabPasses )) + body.Add( m_grabPasses.Replace( "\t\t",string.Empty )); + + if( m_zWriteMode != 0 ) + body.Add( "ZWrite " + ZBufferOpHelper.ZWriteModeValues[ m_zWriteMode ] ); + if( m_zTestMode != 0 ) + body.Add( "ZTest " + ZBufferOpHelper.ZTestModeValues[ m_zTestMode ] ); + + body.Add( "Cull " + m_cullMode ); + + //Color Mask + { + int count = 0; + string colorMask = string.Empty; + for( int i = 0 ; i < m_colorMask.Length ; i++ ) + { + if( m_colorMask[ i ] ) + { + count++; + colorMask += m_colorMaskChar[ i ]; + } + } + + if( count != m_colorMask.Length ) + { + body.Add( "ColorMask " + ( ( count == 0 ) ? "0" : colorMask ) ); + } + } + + body.Add( "CGPROGRAM" ); + if( tessOpHelper.EnableTesselation ) + { + body.Add( "#include \"" + TessellationOpHelper.TessInclude + "\"" ); + body.Add( "#pragma target " + target ); + } + else + { + body.Add( "#pragma target 3.0" ); + } + bool customOutline = dataCollector.UsingCustomOutlineColor || dataCollector.UsingCustomOutlineWidth || dataCollector.UsingCustomOutlineAlpha; + int outlineMode = customOutline ? m_offsetMode : ( m_mode == OutlineMode.VertexOffset ? 0 : 1 ); + string extraOptions = ( customOutline ? m_customNoFog : m_noFog ) ? "nofog " : string.Empty; + if( dataCollector.CustomOutlineSelectedAlpha > 0 ) + { + extraOptions += ModePragma[ dataCollector.CustomOutlineSelectedAlpha ]; + } + + string surfConfig = string.Format( OutlineSurfaceConfig, extraOptions ); + + if( tessOpHelper.EnableTesselation ) + tessOpHelper.WriteToOptionalParams( ref surfConfig ); + + body.Add( surfConfig ); + if( !isShadowCaster ) + { + AddMultibodyString( m_defines, body ); + AddMultibodyString( m_includes, body ); + AddMultibodyString( m_pragmas, body ); + } + AddMultibodyString( m_standardAdditionalDirectives, body ); + //if( instanced ) + //{ + // body.Add( OutlineInstancedHeader ); + //} + + if( customOutline ) + { + if( isShadowCaster ) + { + + for( int i = 0; i < InputList.Count; i++ ) + { + dataCollector.AddToInput( InputList[ i ].NodeId, InputList[ i ].PropertyName, !InputList[ i ].IsDirective ); + } + } + else + { + if( !string.IsNullOrEmpty( m_inputs ) ) + body.Add( m_inputs.Trim( '\t', '\n' ) ); + } + + if( !DirtyInput && !isShadowCaster ) + body.Add( OutlineBodyStructDefault ); + + if( !isShadowCaster ) + body.Add( OutlineBodyStructEnd ); + } + else if( !isShadowCaster ) + { + body.Add( OutlineBodyStructBegin ); + body.Add( OutlineBodyStructDefault ); + body.Add( OutlineBodyStructEnd ); + } + + if( instanced ) + { + //for( int i = 0; i < OutlineBodyInstancedBegin.Length; i++ ) + //{ + // body.Add( ( i == 0 ) ? string.Format( OutlineBodyInstancedBegin[ i ], shaderName ) : OutlineBodyInstancedBegin[ i ] ); + //} + + //if( (object)billboardInfo != null ) + //{ + // for( int j = 0; j < billboardInfo.Length; j++ ) + // { + // body.Add( string.Format( BillboardInstructionFormat, billboardInfo[ j ] ) ); + // } + //} + + //switch( outlineMode ) + //{ + // case 0: body.Add( string.Format( OutlineVertexOffsetMode, WidthVariableAccessInstanced ) ); break; + // case 1: body.Add( string.Format( OutlineVertexScaleMode, WidthVariableAccessInstanced ) ); break; + // case 2: body.Add( string.Format( OutlineVertexCustomMode, WidthVariableAccessInstanced ) ); break; + //} + //for( int i = 0; i < OutlineBodyInstancedEnd.Length; i++ ) + //{ + // body.Add( OutlineBodyInstancedEnd[ i ] ); + //} + + //Instanced block name must differ from used on main shader so it won't throw a duplicate name error + shaderName = shaderName+ "Outline"; + bool openCBuffer = true; + if( customOutline ) + { + if( isShadowCaster ) + { + for( int i = 0; i < UniformList.Count; i++ ) + { + dataCollector.AddToUniforms( UniformList[ i ].NodeId, UniformList[ i ].PropertyName ); + } + + foreach( KeyValuePair kvp in m_localFunctions ) + { + dataCollector.AddFunction( kvp.Key, kvp.Value ); + } + } + else + { + if( !string.IsNullOrEmpty( Uniforms ) ) + body.Add( Uniforms.Trim( '\t', '\n' ) ); + + openCBuffer = false; + body.Add( string.Format( IOUtils.InstancedPropertiesBegin, shaderName )); + if( !string.IsNullOrEmpty( InstancedProperties ) ) + body.Add( InstancedProperties.Trim( '\t', '\n' ) ); + } + } + + if( openCBuffer) + body.Add( string.Format( IOUtils.InstancedPropertiesBegin, shaderName ) ); + + if( !dataCollector.UsingCustomOutlineColor ) + body.Add( precision == PrecisionType.Float ? OutlineDefaultUniformColorInstanced.Replace( "half", "float" ) : OutlineDefaultUniformColorInstanced ); + + if( !dataCollector.UsingCustomOutlineWidth ) + body.Add( precision == PrecisionType.Float ? OutlineDefaultUniformWidthInstanced.Replace( "half", "float" ) : OutlineDefaultUniformWidthInstanced ); + + body.Add( IOUtils.InstancedPropertiesEnd ); + + //Functions + if( customOutline && !isShadowCaster ) + body.Add( Functions ); + + if( tessOpHelper.EnableTesselation && !isShadowCaster ) + { + body.Add( tessOpHelper.Uniforms().TrimStart( '\t' ) ); + body.Add( tessOpHelper.GetCurrentTessellationFunction( ref dataCollector ).Trim( '\t', '\n' ) + "\n" ); + } + + if( tessOpHelper.EnableTesselation ) + { + body.Add( OutlineTessVertexHeader ); + } + else + { + body.Add( OutlineDefaultVertexHeader ); + body.Add( OutlineDefaultVertexOutputDeclaration ); + } + + if( customOutline ) + { + if( !string.IsNullOrEmpty( VertexData ) ) + body.Add( "\t" + VertexData.Trim( '\t', '\n' ) ); + } + + if( (object)billboardInfo != null ) + { + for( int j = 0; j < billboardInfo.Length; j++ ) + { + body.Add( string.Format( BillboardInstructionFormat, billboardInfo[ j ] ) ); + } + } + + switch( outlineMode ) + { + case 0: body.Add( string.Format( OutlineVertexOffsetMode, dataCollector.UsingCustomOutlineWidth ? "outlineVar" : WidthPropertyNameInstanced ) ); break; + case 1: body.Add( string.Format( OutlineVertexScaleMode, dataCollector.UsingCustomOutlineWidth ? "outlineVar" : WidthPropertyNameInstanced ) ); break; + case 2: body.Add( string.Format( OutlineVertexCustomMode, dataCollector.UsingCustomOutlineWidth ? "outlineVar" : WidthPropertyNameInstanced ) ); break; + } + + for( int i = 0; i < OutlineBodyDefaultSurfBegin.Length; i++ ) + { + body.Add( OutlineBodyDefaultSurfBegin[ i ] ); + } + if( dataCollector.UsingCustomOutlineColor || dataCollector.CustomOutlineSelectedAlpha > 0 ) + { + body.Add( "\t" + Instructions.Trim( '\t', '\n' ) ); + } + else + { + for( int i = 0; i < OutlineSurfBodyInstanced.Length; i++ ) + { + body.Add( OutlineSurfBodyInstanced[ i ] ); + } + } + + for( int i = 0; i < OutlineBodyDefaultSurfEnd.Length; i++ ) + { + body.Add( OutlineBodyDefaultSurfEnd[ i ] ); + } + } + else + { + if( customOutline ) + { + if( isShadowCaster ) + { + for( int i = 0; i < UniformList.Count; i++ ) + { + dataCollector.AddToUniforms( UniformList[ i ].NodeId, UniformList[ i ].PropertyName ); + } + + foreach( KeyValuePair kvp in m_localFunctions ) + { + dataCollector.AddFunction( kvp.Key, kvp.Value ); + } + } + else + { + if( !string.IsNullOrEmpty( Uniforms ) ) + body.Add( Uniforms.Trim( '\t', '\n' ) ); + } + } + + if( !dataCollector.UsingCustomOutlineColor ) + body.Add( precision == PrecisionType.Float ? OutlineDefaultUniformColor.Replace( "half", "float" ) : OutlineDefaultUniformColor ); + + if( !dataCollector.UsingCustomOutlineWidth ) + body.Add( precision == PrecisionType.Float ? OutlineDefaultUniformWidth.Replace( "half", "float" ) : OutlineDefaultUniformWidth ); + + //Functions + if( customOutline && !isShadowCaster ) + body.Add( Functions ); + + if( tessOpHelper.EnableTesselation && !isShadowCaster ) + { + body.Add( tessOpHelper.Uniforms().TrimStart( '\t' ) ); + body.Add( tessOpHelper.GetCurrentTessellationFunction( ref dataCollector ).Trim( '\t', '\n' ) + "\n" ); + } + + if( tessOpHelper.EnableTesselation ) + { + body.Add( OutlineTessVertexHeader ); + } + else + { + body.Add( OutlineDefaultVertexHeader ); + body.Add( OutlineDefaultVertexOutputDeclaration ); + } + + if( customOutline ) + { + if( !string.IsNullOrEmpty( VertexData ) ) + body.Add( "\t" + VertexData.Trim( '\t', '\n' ) ); + } + + if( (object)billboardInfo != null ) + { + for( int j = 0; j < billboardInfo.Length; j++ ) + { + body.Add( string.Format( BillboardInstructionFormat, billboardInfo[ j ] ) ); + } + } + + switch( outlineMode ) + { + case 0: body.Add( string.Format( OutlineVertexOffsetMode, dataCollector.UsingCustomOutlineWidth ? "outlineVar" : WidthPropertyName ) ); break; + case 1: body.Add( string.Format( OutlineVertexScaleMode, dataCollector.UsingCustomOutlineWidth ? "outlineVar" : WidthPropertyName ) ); break; + case 2: body.Add( string.Format( OutlineVertexCustomMode, dataCollector.UsingCustomOutlineWidth ? "outlineVar" : WidthPropertyName ) ); break; + } + for( int i = 0; i < OutlineBodyDefaultSurfBegin.Length; i++ ) + { + body.Add( OutlineBodyDefaultSurfBegin[ i ] ); + } + if( dataCollector.UsingCustomOutlineColor || dataCollector.CustomOutlineSelectedAlpha > 0 ) + { + body.Add( "\t" + Instructions.Trim( '\t', '\n' ) ); + } + else + { + for( int i = 0; i < OutlineSurfBody.Length; i++ ) + { + body.Add( OutlineSurfBody[ i ] ); + } + } + + for( int i = 0; i < OutlineBodyDefaultSurfEnd.Length; i++ ) + { + body.Add( OutlineBodyDefaultSurfEnd[ i ] ); + } + } + + string[] bodyArr = body.ToArray(); + body.Clear(); + body = null; + return bodyArr; + } + + + public void Destroy() + { + m_inputList = null; + m_uniformList = null; + m_instancedPropertiesList = null; + m_localFunctions = null; + } + + public bool EnableOutline { get { return m_enabled; } } + + public bool UsingCullMode { get { return m_cullMode != CullMode.Front; } } + public bool UsingZWrite { get { return m_zWriteMode != 0; } } + public bool UsingZTest { get { return m_zTestMode != 0; } } + public int ZWriteMode { get { return m_zWriteMode; } set { m_zWriteMode = value; } } + public int ZTestMode { get { return m_zTestMode; } set { m_zTestMode = value; } } + public CullMode OutlineCullMode { get { return m_cullMode; } set { m_cullMode = value; } } + public bool[] ColorMask + { + get { return m_colorMask; } + set + { + if( value.Length == m_colorMask.Length ) + { + for( int i = 0 ; i < m_colorMask.Length ; i++ ) + { + m_colorMask[i] = value[i]; + } + } + } + } + + public bool ActiveColorMask + { + get + { + for( int i = 0 ; i < m_colorMask.Length ; i++ ) + { + if( !m_colorMask[ i ] ) + return true; + } + return false; + } + } + public string Inputs { get { return m_inputs; } set { m_inputs = value; } } + public string Uniforms { get { return m_uniforms; } set { m_uniforms = value; } } + public string InstancedProperties { get { return m_instancedProperties; } set { m_instancedProperties = value; } } + public string Instructions { get { return m_instructions; } set { m_instructions = value; } } + public string Functions { get { return m_functions; } set { m_functions = value; } } + public string Includes { get { return m_includes; } set { m_includes = value; } } + public string Pragmas { get { return m_pragmas; } set { m_pragmas = value; } } + public string Defines { get { return m_defines; } set { m_defines = value; } } + public string StandardAdditionalDirectives { get { return m_standardAdditionalDirectives; } set { m_standardAdditionalDirectives = value; } } + public string VertexData { get { return m_vertexData; } set { m_vertexData = value; } } + public string GrabPasses { get { return m_grabPasses; } set { m_grabPasses = value; } } + public List InputList { get { return m_inputList; } set { m_inputList = value; } } + public List UniformList { get { return m_uniformList; } set { m_uniformList = value; } } + public List InstancedPropertiesList { get { return m_instancedPropertiesList; } set { m_instancedPropertiesList = value; } } + + public Dictionary LocalFunctions { get { return m_localFunctions; } set { m_localFunctions = value; } } + public bool DirtyInput { get { return m_dirtyInput; } set { m_dirtyInput = value; } } + + //public OutlineMode CustomMode { get { return m_customMode; } set { m_customMode = value; } } + public int OffsetMode { get { return m_offsetMode; } set { m_offsetMode = value; } } + public bool CustomNoFog { get { return m_customNoFog; } set { m_customNoFog = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs.meta new file mode 100644 index 00000000..6e2dd590 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d0900a4b7d1563e49b6184d7579dcbec +timeCreated: 1487331466 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs new file mode 100644 index 00000000..1fffc290 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs @@ -0,0 +1,90 @@ +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public class OutputNode : SignalGeneratorNode + { + public static int LOD_SUBSHADER_VERSION = 17200; + [SerializeField] + protected bool m_isMainOutputNode = false; + + [SerializeField] + protected int m_lodIndex = -1; + + public OutputNode() : base() { } + public OutputNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + + public override void ResetNodeData() + { + base.ResetNodeData(); + m_graphDepth = -1; + } + + public virtual void SetupNodeCategories() + { + ContainerGraph.ResetNodesData(); + //int count = m_inputPorts.Count; + //for( int i = 0; i < count; i++ ) + //{ + // if( m_inputPorts[ i ].IsConnected ) + // { + // NodeData nodeData = new NodeData( m_inputPorts[ i ].Category ); + // ParentNode node = m_inputPorts[ i ].GetOutputNode(); + // node.PropagateNodeData( nodeData, ref collector ); + // } + //} + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_isMainOutputNode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_lodIndex ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_isMainOutputNode = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > LOD_SUBSHADER_VERSION ) + { + m_lodIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + if( IsLODMainMasterNode && !ContainerGraph.IsDuplicating ) + { + ContainerGraph.AssignMasterNode( this, true ); + } + } + + public override void AfterDuplication() + { + base.AfterDuplication(); + m_isMainOutputNode = false; + } + + public bool IsMainOutputNode + { + get { return m_isMainOutputNode; } + set + { + if( value != m_isMainOutputNode ) + { + m_isMainOutputNode = value; + if( m_isMainOutputNode ) + { + GenerateSignalPropagation(); + } + else + { + GenerateSignalInibitor(); + } + } + } + } + + public int LODIndex { get { return m_lodIndex; } set { m_lodIndex = value; } } + public bool IsLODMainMasterNode { get { return m_isMainOutputNode && m_lodIndex == -1; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs.meta new file mode 100644 index 00000000..9b62977e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ed0ee3a73f11f344495d16b54bb3af29 +timeCreated: 1491918470 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs new file mode 100644 index 00000000..854134da --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs @@ -0,0 +1,221 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public enum DisableBatchingTagValues + { + True, + False, + LODFading + } + + [Serializable] + public class RenderingOptionsOpHelper + { + private const string RenderingOptionsStr = " Rendering Options"; + private readonly static GUIContent EmissionGIFlags = new GUIContent( "Emission GI Flag", "Modifies Emission GI flags" ); + private readonly static GUIContent LODCrossfadeContent = new GUIContent( " LOD Group Cross Fade", "Applies a dither crossfade to be used with LOD groups for smoother transitions. Uses one interpolator\nDefault: OFF" ); + private readonly static GUIContent DisableBatchingContent = new GUIContent( "Disable Batching", "\nDisables objects to be batched and used with DrawCallBatching Default: False" ); + private readonly static GUIContent IgnoreProjectorContent = new GUIContent( " Ignore Projector", "\nIf True then an object that uses this shader will not be affected by Projectors Default: False" ); + private readonly static GUIContent UseDefaultCasterContent = new GUIContent( " Use Default Shadow Caster", "\nIf True always use surface default shadow caster Default: False" ); + private readonly static GUIContent ForceNoShadowCastingContent = new GUIContent( " Force No Shadow Casting", "\nIf True then an object that is rendered using this subshader will never cast shadows Default: False" ); + private readonly static GUIContent ForceEnableInstancingContent = new GUIContent( " Force Enable Instancing", "\nIf True forces instancing on shader independent of having instanced properties" ); + private readonly static GUIContent ForceDisableInstancingContent = new GUIContent( " Force Disable Instancing", "\nIf True forces disable instancing on shader independent of having instanced properties" ); + private readonly static GUIContent SpecularHightlightsContent = new GUIContent( " Fwd Specular Highlights Toggle", "\nIf True creates a material toggle to set Unity's internal specular highlight rendering keyword" ); + private readonly static GUIContent ReflectionsContent = new GUIContent( " Fwd Reflections Toggle", "\nIf True creates a material toggle to set Unity's internal reflections rendering keyword" ); + + [SerializeField] + private bool m_forceEnableInstancing = false; + + [SerializeField] + private bool m_forceDisableInstancing = false; + + [SerializeField] + private bool m_specularHighlightToggle = false; + + [SerializeField] + private bool m_reflectionsToggle = false; + + [SerializeField] + private bool m_lodCrossfade = false; + + [SerializeField] + private DisableBatchingTagValues m_disableBatching = DisableBatchingTagValues.False; + + [SerializeField] + private bool m_ignoreProjector = false; + + [SerializeField] + private bool m_useDefaultShadowCaster = false; + + [SerializeField] + private bool m_forceNoShadowCasting = false; + + [SerializeField] + private List m_codeGenerationDataList; + + public RenderingOptionsOpHelper() + { + m_codeGenerationDataList = new List(); + m_codeGenerationDataList.Add( new CodeGenerationData( " Exclude Deferred", "exclude_path:deferred" ) ); + m_codeGenerationDataList.Add( new CodeGenerationData( " Exclude Forward", "exclude_path:forward" ) ); + m_codeGenerationDataList.Add( new CodeGenerationData( " Exclude Legacy Deferred", "exclude_path:prepass" ) ); + m_codeGenerationDataList.Add( new CodeGenerationData( " Shadows", "noshadow" ) ); + m_codeGenerationDataList.Add( new CodeGenerationData( " Ambient Light", "noambient" ) ); + m_codeGenerationDataList.Add( new CodeGenerationData( " Per Vertex Light", "novertexlights" ) ); + m_codeGenerationDataList.Add( new CodeGenerationData( " Lightmaps", "nolightmap " ) ); + m_codeGenerationDataList.Add( new CodeGenerationData( " Dynamic Global GI", "nodynlightmap" ) ); + m_codeGenerationDataList.Add( new CodeGenerationData( " Directional lightmaps", "nodirlightmap" ) ); + m_codeGenerationDataList.Add( new CodeGenerationData( " Built-in Fog", "nofog" ) ); + m_codeGenerationDataList.Add( new CodeGenerationData( " Meta Pass", "nometa" ) ); + m_codeGenerationDataList.Add( new CodeGenerationData( " Add Pass", "noforwardadd" ) ); + } + + public bool IsOptionActive( string option ) + { + return !m_codeGenerationDataList.Find( x => x.Name.Equals( option ) ).IsActive; + } + + public void Draw( StandardSurfaceOutputNode owner ) + { + bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedRenderingOptions; + NodeUtils.DrawPropertyGroup( ref value, RenderingOptionsStr, () => + { + int codeGenCount = m_codeGenerationDataList.Count; + // Starting from index 4 because other options are already contemplated with m_renderPath and add/receive shadows + for( int i = 4; i < codeGenCount; i++ ) + { + m_codeGenerationDataList[ i ].IsActive = !owner.EditorGUILayoutToggleLeft( m_codeGenerationDataList[ i ].Name, !m_codeGenerationDataList[ i ].IsActive ); + } + m_lodCrossfade = owner.EditorGUILayoutToggleLeft( LODCrossfadeContent, m_lodCrossfade ); + m_ignoreProjector = owner.EditorGUILayoutToggleLeft( IgnoreProjectorContent, m_ignoreProjector ); + EditorGUI.BeginDisabledGroup( !owner.CastShadows ); + m_useDefaultShadowCaster = owner.EditorGUILayoutToggleLeft( UseDefaultCasterContent, m_useDefaultShadowCaster ); + EditorGUI.EndDisabledGroup(); + m_forceNoShadowCasting = owner.EditorGUILayoutToggleLeft( ForceNoShadowCastingContent, m_forceNoShadowCasting ); + if( owner.ContainerGraph.IsInstancedShader ) + { + GUI.enabled = false; + owner.EditorGUILayoutToggleLeft( ForceEnableInstancingContent, true ); + GUI.enabled = true; + } + else + { + m_forceEnableInstancing = owner.EditorGUILayoutToggleLeft( ForceEnableInstancingContent, m_forceEnableInstancing ); + } + + m_forceDisableInstancing = owner.EditorGUILayoutToggleLeft( ForceDisableInstancingContent, m_forceDisableInstancing ); + m_specularHighlightToggle = owner.EditorGUILayoutToggleLeft( SpecularHightlightsContent, m_specularHighlightToggle ); + m_reflectionsToggle = owner.EditorGUILayoutToggleLeft( ReflectionsContent, m_reflectionsToggle ); + m_disableBatching = (DisableBatchingTagValues)owner.EditorGUILayoutEnumPopup( DisableBatchingContent, m_disableBatching ); + Material mat = owner.ContainerGraph.CurrentMaterial; + if( mat != null ) + { + mat.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)owner.EditorGUILayoutEnumPopup( EmissionGIFlags, mat.globalIlluminationFlags ); + } + } ); + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedRenderingOptions = value; + } + + public void Build( ref string OptionalParameters ) + { + int codeGenCount = m_codeGenerationDataList.Count; + + for( int i = 0; i < codeGenCount; i++ ) + { + if( m_codeGenerationDataList[ i ].IsActive ) + { + OptionalParameters += m_codeGenerationDataList[ i ].Value + Constants.OptionalParametersSep; + } + } + + if( m_lodCrossfade ) + { + OptionalParameters += Constants.LodCrossFadeOption2017 + Constants.OptionalParametersSep; + } + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + for( int i = 0; i < m_codeGenerationDataList.Count; i++ ) + { + m_codeGenerationDataList[ i ].IsActive = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( UIUtils.CurrentShaderVersion() > 10005 ) + { + m_lodCrossfade = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( UIUtils.CurrentShaderVersion() > 10007 ) + { + m_disableBatching = (DisableBatchingTagValues)Enum.Parse( typeof( DisableBatchingTagValues ), nodeParams[ index++ ] ); + m_ignoreProjector = Convert.ToBoolean( nodeParams[ index++ ] ); + m_forceNoShadowCasting = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( UIUtils.CurrentShaderVersion() > 11002 ) + { + m_forceEnableInstancing = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( UIUtils.CurrentShaderVersion() > 15205 ) + { + m_forceDisableInstancing = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( UIUtils.CurrentShaderVersion() > 14403 ) + { + m_specularHighlightToggle = Convert.ToBoolean( nodeParams[ index++ ] ); + m_reflectionsToggle = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( UIUtils.CurrentShaderVersion() > 16307 ) + { + m_useDefaultShadowCaster = Convert.ToBoolean( nodeParams[ index++ ] ); + } + } + + public void WriteToString( ref string nodeInfo ) + { + for( int i = 0; i < m_codeGenerationDataList.Count; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_codeGenerationDataList[ i ].IsActive ); + } + + IOUtils.AddFieldValueToString( ref nodeInfo, m_lodCrossfade ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_disableBatching ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_ignoreProjector ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_forceNoShadowCasting ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_forceEnableInstancing ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_forceDisableInstancing ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_specularHighlightToggle ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_reflectionsToggle ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_useDefaultShadowCaster ); + } + + public void Destroy() + { + m_codeGenerationDataList.Clear(); + m_codeGenerationDataList = null; + } + public bool UseDefaultShadowCaster { get { return m_useDefaultShadowCaster; } } + public bool ForceEnableInstancing { get { return m_forceEnableInstancing; } } + public bool ForceDisableInstancing { get { return m_forceDisableInstancing; } } + + public bool LodCrossfade { get { return m_lodCrossfade; } } + public bool IgnoreProjectorValue { get { return m_ignoreProjector; } set { m_ignoreProjector = value; } } + public bool SpecularHighlightToggle { get { return m_specularHighlightToggle; } set { m_specularHighlightToggle = value; } } + public bool ReflectionsToggle { get { return m_reflectionsToggle; } set { m_reflectionsToggle = value; } } + + public string DisableBatchingTag { get { return ( m_disableBatching != DisableBatchingTagValues.False ) ? string.Format( Constants.TagFormat, "DisableBatching", m_disableBatching ) : string.Empty; } } + public string IgnoreProjectorTag { get { return ( m_ignoreProjector ) ? string.Format( Constants.TagFormat, "IgnoreProjector", "True" ) : string.Empty; } } + public string ForceNoShadowCastingTag { get { return ( m_forceNoShadowCasting ) ? string.Format( Constants.TagFormat, "ForceNoShadowCasting", "True" ) : string.Empty; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs.meta new file mode 100644 index 00000000..f1b30247 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 26d840af03d4f7b418e9c7bece143648 +timeCreated: 1488906067 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs new file mode 100644 index 00000000..b845e4d5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs @@ -0,0 +1,355 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEditor; +using UnityEngine; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class RenderPlatformInfo + { + public string Label; + public RenderPlatforms Value; + } + + public enum RenderPlatforms + { + d3d9, + d3d11, + glcore, + gles, + gles3, + metal, + d3d11_9x, + xbox360, + xboxone, + xboxseries, + ps4, + playstation, + psp2, + n3ds, + wiiu, + @switch, + vulkan, + nomrt, + ps5, // @diogo: added in 19100 + all + } + + [Serializable] + public class RenderingPlatformOpHelper + { + private const string RenderingPlatformsStr = " Rendering Platforms"; + public static readonly RenderPlatformInfo[] RenderingPlatformsInfo = + { + new RenderPlatformInfo(){Label = " Direct3D 11/12", Value = RenderPlatforms.d3d11}, + new RenderPlatformInfo(){Label = " OpenGL 3.x/4.x", Value = RenderPlatforms.glcore}, + new RenderPlatformInfo(){Label = " OpenGL ES 2.0", Value = RenderPlatforms.gles}, + new RenderPlatformInfo(){Label = " OpenGL ES 3.x", Value = RenderPlatforms.gles3}, + new RenderPlatformInfo(){Label = " Metal iOS/macOS", Value = RenderPlatforms.metal}, + new RenderPlatformInfo(){Label = " Vulkan", Value = RenderPlatforms.vulkan}, + new RenderPlatformInfo(){Label = " Xbox One", Value = RenderPlatforms.xboxone}, + new RenderPlatformInfo(){Label = " Xbox Series X", Value = RenderPlatforms.xboxseries}, + new RenderPlatformInfo(){Label = " PlayStation", Value = RenderPlatforms.playstation}, + new RenderPlatformInfo(){Label = " PlayStation 4", Value = RenderPlatforms.ps4}, + new RenderPlatformInfo(){Label = " PlayStation 5", Value = RenderPlatforms.ps5}, + new RenderPlatformInfo(){Label = " Nintendo Switch", Value = RenderPlatforms.@switch}, + }; + + // Values from this dictionary must be the indices corresponding from the list above + public static readonly Dictionary PlatformToIndex = new Dictionary() + { + {RenderPlatforms.d3d11, 0}, + {RenderPlatforms.glcore, 1}, + {RenderPlatforms.gles, 2}, + {RenderPlatforms.gles3, 3}, + {RenderPlatforms.metal, 4}, + {RenderPlatforms.vulkan, 5}, + {RenderPlatforms.xboxone, 6}, + {RenderPlatforms.xboxseries, 7}, + {RenderPlatforms.playstation, 8}, + {RenderPlatforms.ps4, 9}, + {RenderPlatforms.ps5, 10}, + {RenderPlatforms.@switch, 11}, + }; + + + public static readonly List LegacyIndexToPlatform = new List() + { + RenderPlatforms.d3d9, + RenderPlatforms.d3d11, + RenderPlatforms.glcore, + RenderPlatforms.gles, + RenderPlatforms.gles3, + RenderPlatforms.metal, + RenderPlatforms.d3d11_9x, + RenderPlatforms.xbox360, + RenderPlatforms.xboxone, + RenderPlatforms.ps4, + RenderPlatforms.psp2, + RenderPlatforms.n3ds, + RenderPlatforms.wiiu + }; + + [SerializeField] + private bool[] m_renderingPlatformValues; + + public RenderingPlatformOpHelper() + { + m_renderingPlatformValues = new bool[ RenderingPlatformsInfo.Length ]; + for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) + { + m_renderingPlatformValues[ i ] = true; + } + } + + + public void Draw( ParentNode owner ) + { + bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedRenderingPlatforms; + NodeUtils.DrawPropertyGroup( ref value, RenderingPlatformsStr, () => + { + for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) + { + m_renderingPlatformValues[ i ] = owner.EditorGUILayoutToggleLeft( RenderingPlatformsInfo[ i ].Label, m_renderingPlatformValues[ i ] ); + } + } ); + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedRenderingPlatforms = value; + } + + public void DrawNested( ParentNode owner ) + { + bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedRenderingPlatforms; + NodeUtils.DrawNestedPropertyGroup( ref value , RenderingPlatformsStr , () => + { + for( int i = 0 ; i < m_renderingPlatformValues.Length ; i++ ) + { + m_renderingPlatformValues[ i ] = owner.EditorGUILayoutToggleLeft( RenderingPlatformsInfo[ i ].Label , m_renderingPlatformValues[ i ] ); + } + } ); + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedRenderingPlatforms = value; + } + + + public string CreateResult( bool addPragmaPrefix = false ) + { + int checkedPlatforms = 0; + int uncheckedPlatforms = 0; + + for( int i = 0 ; i < m_renderingPlatformValues.Length ; i++ ) + { + if( m_renderingPlatformValues[ i ] ) + { + checkedPlatforms += 1; + } + else + { + uncheckedPlatforms += 1; + } + } + + if( checkedPlatforms > 0 && checkedPlatforms < m_renderingPlatformValues.Length ) + { + string result = string.Empty; + if( checkedPlatforms < uncheckedPlatforms ) + { + result = "only_renderers "; + for( int i = 0 ; i < m_renderingPlatformValues.Length ; i++ ) + { + if( m_renderingPlatformValues[ i ] ) + { + result += (RenderPlatforms)RenderingPlatformsInfo[ i ].Value + " "; + } + } + } + else + { + result = "exclude_renderers "; + for( int i = 0 ; i < m_renderingPlatformValues.Length ; i++ ) + { + if( !m_renderingPlatformValues[ i ] ) + { + result += (RenderPlatforms)RenderingPlatformsInfo[ i ].Value + " "; + } + } + } + if( addPragmaPrefix ) + { + result = "#pragma " + result; + } + return result; + } + + return string.Empty; + } + + public void SetRenderingPlatforms( ref string ShaderBody ) + { + string result = CreateResult(); + if( !string.IsNullOrEmpty(result)) + { + MasterNode.AddShaderPragma( ref ShaderBody, result ); + } + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + if( UIUtils.CurrentShaderVersion() < 17006 ) + { + for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) + { + m_renderingPlatformValues[ i ] = false; + } + + int count = LegacyIndexToPlatform.Count; + int activeCount = 0; + for( int i = 0; i < count; i++ ) + { + RenderPlatforms platform = LegacyIndexToPlatform[ i ]; + int newIndex = PlatformToIndex[ platform ]; + bool value = Convert.ToBoolean( nodeParams[ index++ ] ); + if( value ) + { + m_renderingPlatformValues[ newIndex ] = true; + activeCount += 1; + } + else + { + m_renderingPlatformValues[ newIndex ] = false; + } + } + + if( activeCount == count ) + { + m_renderingPlatformValues[ PlatformToIndex[ RenderPlatforms.vulkan ] ] = true; + } + } + else + { + int count = Convert.ToInt32( nodeParams[ index++ ] ); + if( count > 0 ) + { + RenderPlatforms firstPlatform = (RenderPlatforms)Enum.Parse( typeof(RenderPlatforms), nodeParams[ index++ ] ); + if( firstPlatform == RenderPlatforms.all ) + { + for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) + { + m_renderingPlatformValues[ i ] = true; + } + } + else + { + for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) + { + m_renderingPlatformValues[ i ] = false; + } + + // @diogo: should have been designed as exclude, instead of include, to avoid stuff like this... + if ( UIUtils.CurrentShaderVersion() < 19100 ) + { + m_renderingPlatformValues[ PlatformToIndex[ RenderPlatforms.ps5 ] ] = true; + } + + for( int i = 0; i < count; i++ ) + { + RenderPlatforms currPlatform = ( i == 0 ) ? firstPlatform : (RenderPlatforms)Enum.Parse( typeof( RenderPlatforms ), nodeParams[ index++ ] ); + if ( PlatformToIndex.TryGetValue( currPlatform, out int platformIndex ) ) + { + m_renderingPlatformValues[ platformIndex ] = true; + } + } + } + } + } + } + + public void WriteToString( ref string nodeInfo ) + { + int active = 0; + for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) + { + if( m_renderingPlatformValues[ i ] ) + active += 1; + } + IOUtils.AddFieldValueToString( ref nodeInfo, active ); + if( active == m_renderingPlatformValues.Length ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, RenderPlatforms.all ); + } + else + { + for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) + { + if( m_renderingPlatformValues[ i ] ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, RenderingPlatformsInfo[i].Value ); + } + } + } + + } + + public void Destroy() + { + m_renderingPlatformValues = null; + } + + //TEMPLATE SPECIFIC + [SerializeField] + private bool m_loadedFromTemplate = false; + + [SerializeField] + private bool m_validData = false; + public void SetupFromTemplate( TemplateRenderPlatformHelper template ) + { + if( m_loadedFromTemplate ) + return; + + if( m_renderingPlatformValues.Length != template.RenderingPlatforms.Length ) + { + Debug.LogError( "Rendering platform length mismatch" ); + return; + } + + + m_loadedFromTemplate = true; + m_validData = true; + + for( int i = 0 ; i < m_renderingPlatformValues.Length ; i++ ) + { + m_renderingPlatformValues[ i ] = template.RenderingPlatforms[ i ]; + } + } + + public void ReadFromStringTemplate( ref uint index , ref string[] nodeParams ) + { + if( UIUtils.CurrentShaderVersion() > 18911 ) + { + bool isValid = Convert.ToBoolean( nodeParams[ index++ ] ); + if( isValid ) + { + ReadFromString( ref index , ref nodeParams ); + } + } + else + { + ReadFromString( ref index , ref nodeParams ); + } + } + + public void WriteToStringTemplate( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo , m_validData ); + if( m_validData ) + { + WriteToString( ref nodeInfo ); + } + } + + public bool LoadedFromTemplate { get { return m_loadedFromTemplate; } } + public bool ValidData { get { return m_validData; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs.meta new file mode 100644 index 00000000..73fe0545 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 50a1f03b042823f469cef7d97c73fdc3 +timeCreated: 1488907373 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs new file mode 100644 index 00000000..b6ea9314 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs @@ -0,0 +1,3324 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using UnityEditorInternal; + +namespace AmplifyShaderEditor +{ + public enum VertexMode + { + Relative, + Absolute + } + + public enum RenderPath + { + All, + ForwardOnly, + DeferredOnly + } + + public enum StandardShaderLightModel + { + Standard, + StandardSpecular, + Lambert, + BlinnPhong, + Unlit, + CustomLighting + } + + public enum CullMode + { + Back, + Front, + Off + } + + public enum AlphaMode + { + Opaque = 0, + Masked = 1, + Transparent = 2, // Transparent (alpha:fade) + Translucent = 3, + Premultiply = 4, // Alpha Premul (alpha:premul) + Custom = 5, + } + + public enum DisableBatching + { + True, + False, + LODFading + } + + public enum RenderType + { + Opaque, + Transparent, + TransparentCutout, + Background, + Overlay, + TreeOpaque, + TreeTransparentCutout, + TreeBillboard, + Grass, + GrassBillboard, + Custom + } + + public enum RenderQueue + { + Background, + Geometry, + AlphaTest, + Transparent, + Overlay + } + + [Serializable] + public class NodeCache + { + public int TargetNodeId = -1; + public int TargetPortId = -1; + + public NodeCache( int targetNodeId, int targetPortId ) + { + SetData( targetNodeId, targetPortId ); + } + + public void SetData( int targetNodeId, int targetPortId ) + { + TargetNodeId = targetNodeId; + TargetPortId = targetPortId; + } + + public void Invalidate() + { + TargetNodeId = -1; + TargetPortId = -1; + } + + public bool IsValid + { + get { return ( TargetNodeId >= 0 ); } + } + + public override string ToString() + { + return "TargetNodeId " + TargetNodeId + " TargetPortId " + TargetPortId; + } + } + + [Serializable] + public class CacheNodeConnections + { + public Dictionary> NodeCacheArray; + + public CacheNodeConnections() + { + NodeCacheArray = new Dictionary>(); + } + + public void Add( string key, NodeCache value ) + { + if( NodeCacheArray.ContainsKey( key ) ) + { + NodeCacheArray[ key ].Add( value ); + } + else + { + NodeCacheArray.Add( key, new List() ); + NodeCacheArray[ key ].Add( value ); + } + } + + public NodeCache Get( string key, int idx = 0 ) + { + if( NodeCacheArray.ContainsKey( key ) ) + { + if( idx < NodeCacheArray[ key ].Count ) + return NodeCacheArray[ key ][ idx ]; + } + return null; + } + + public List GetList( string key ) + { + if( NodeCacheArray.ContainsKey( key ) ) + { + return NodeCacheArray[ key ]; + } + return null; + } + + public void Clear() + { + foreach( KeyValuePair> kvp in NodeCacheArray ) + { + kvp.Value.Clear(); + } + NodeCacheArray.Clear(); + } + } + + [Serializable] + [NodeAttributes( "Standard Surface Output", "Master", "Surface shader generator output", null, KeyCode.None, false )] + public sealed class StandardSurfaceOutputNode : MasterNode, ISerializationCallbackReceiver + { + private readonly static string[] VertexLitFunc = { "\t\tinline half4 LightingUnlit( SurfaceOutput s, half3 lightDir, half atten )", + "\t\t{", + "\t\t\treturn half4 ( 0, 0, 0, s.Alpha );", + "\t\t}\n"}; + + private readonly static string[] FadeModeOptions = { "Opaque", "Masked", "Transparent", "Translucent", "Alpha Premultipled", "Custom" }; + private const string VertexModeStr = "Vertex Output"; + private readonly static GUIContent RenderPathContent = new GUIContent( "Render Path", "Selects and generates passes for the supported rendering paths\nDefault: All" ); + private const string ShaderModelStr = "Shader Model"; + private readonly static GUIContent LightModelContent = new GUIContent( "Light Model", "Surface shader lighting model defines how the surface reflects light\nDefault: Standard" ); + private readonly static GUIContent ShaderLODContent = new GUIContent( "Shader LOD", "Shader LOD" ); + private readonly static GUIContent CullModeContent = new GUIContent( "Cull Mode", "Polygon culling mode prevents rendering of either back-facing or front-facing polygons to save performance, turn it off if you want to render both sides\nDefault: Back" ); + + private const string ChromaticAberrationStr = "Chromatic Aberration"; + private const string DiscardStr = "Opacity Mask"; + private const string VertexDisplacementStr = "Local Vertex Offset"; + private const string VertexPositionStr = "Local Vertex Position"; + private const string VertexDataStr = "VertexData"; + private const string VertexNormalStr = "Local Vertex Normal"; + private const string VertexTangentStr = "Local Vertex Tangent"; + private const string CustomLightingStr = "Custom Lighting"; + private const string AlbedoStr = "Albedo"; + private const string NormalStr = "Normal"; + private const string EmissionStr = "Emission"; + private const string MetallicStr = "Metallic"; + private const string SmoothnessStr = "Smoothness"; + private const string OcclusionDataStr = "Occlusion"; + private const string OcclusionLabelStr = "Ambient Occlusion"; + private const string TransmissionStr = "Transmission"; + private const string TranslucencyStr = "Translucency"; + private const string RefractionStr = "Refraction"; + private const string AlphaStr = "Opacity"; + private const string AlphaDataStr = "Alpha"; + private const string DebugStr = "Debug"; + private const string SpecularStr = "Specular"; + private const string GlossStr = "Gloss"; + private const string CustomRenderTypeStr = "Custom Type"; + private readonly static GUIContent AlphaModeContent = new GUIContent( " Blend Mode", "Defines how the surface blends with the background\nDefault: Opaque" ); + private const string OpacityMaskClipValueStr = "Mask Clip Value"; + private readonly static GUIContent OpacityMaskClipValueContent = new GUIContent( "Mask Clip Value", "Default clip value to be compared with opacity alpha ( 0 = fully Opaque, 1 = fully Masked )\nDefault: 0.5" ); + private readonly static GUIContent CastShadowsContent = new GUIContent( "Cast Shadows", "Generates a shadow caster pass for vertex modifications and point lights in forward rendering\nDefault: ON" ); + private readonly static GUIContent ReceiveShadowsContent = new GUIContent( "Receive Shadows", "Untick it to disable shadow receiving, this includes self-shadowing (only for forward rendering) \nDefault: ON" ); + private readonly static GUIContent QueueIndexContent = new GUIContent( "Queue Index", "Value to offset the render queue, accepts both positive values to render later and negative values to render sooner\nDefault: 0" ); + private readonly static GUIContent RefractionLayerStr = new GUIContent( "Refraction Layer", "Use it to group or ungroup different refraction shaders into the same or different grabpass (only for forward rendering) \nDefault: 0" ); + private readonly static GUIContent AlphaToCoverageStr = new GUIContent( "Alpha To Coverage", "" ); + private readonly static GUIContent RenderQueueContent = new GUIContent( "Render Queue", "Base rendering queue index\n(Background = 1000, Geometry = 2000, AlphaTest = 2450, Transparent = 3000, Overlay = 4000)\nDefault: Geometry" ); + private readonly static GUIContent RenderTypeContent = new GUIContent( "Render Type", "Categorizes shaders into several predefined groups, usually to be used with screen shader effects\nDefault: Opaque" ); + + private const string ShaderInputOrderStr = "Shader Input Order"; + + + [SerializeField] + private BlendOpsHelper m_blendOpsHelper = new BlendOpsHelper(); + + [SerializeField] + private StencilBufferOpHelper m_stencilBufferHelper = new StencilBufferOpHelper(); + + [SerializeField] + private ZBufferOpHelper m_zBufferHelper = new ZBufferOpHelper(); + + [SerializeField] + private OutlineOpHelper m_outlineHelper = new OutlineOpHelper(); + + [SerializeField] + private TessellationOpHelper m_tessOpHelper = new TessellationOpHelper(); + + [SerializeField] + private ColorMaskHelper m_colorMaskHelper = new ColorMaskHelper(); + + [SerializeField] + private RenderingPlatformOpHelper m_renderingPlatformOpHelper = new RenderingPlatformOpHelper(); + + [SerializeField] + private RenderingOptionsOpHelper m_renderingOptionsOpHelper = new RenderingOptionsOpHelper(); + + [SerializeField] + private BillboardOpHelper m_billboardOpHelper = new BillboardOpHelper(); + + [SerializeField] + private FallbackPickerHelper m_fallbackHelper = null; + + [SerializeField] + private TerrainDrawInstancedHelper m_drawInstancedHelper = new TerrainDrawInstancedHelper(); + + //legacy + [SerializeField] + private AdditionalIncludesHelper m_additionalIncludes = new AdditionalIncludesHelper(); + //legacy + [SerializeField] + private AdditionalPragmasHelper m_additionalPragmas = new AdditionalPragmasHelper(); + //legacy + [SerializeField] + private AdditionalDefinesHelper m_additionalDefines = new AdditionalDefinesHelper(); + + [SerializeField] + private TemplateAdditionalDirectivesHelper m_additionalDirectives = new TemplateAdditionalDirectivesHelper( " Additional Directives" ); + + [SerializeField] + private AdditionalSurfaceOptionsHelper m_additionalSurfaceOptions = new AdditionalSurfaceOptionsHelper(); + + [SerializeField] + private UsePassHelper m_usePass; + + [SerializeField] + private CustomTagsHelper m_customTagsHelper = new CustomTagsHelper(); + + [SerializeField] + private DependenciesHelper m_dependenciesHelper = new DependenciesHelper(); + + [SerializeField] + private StandardShaderLightModel m_currentLightModel; + + [SerializeField] + private StandardShaderLightModel m_lastLightModel; + + [SerializeField] + private CullMode m_cullMode = CullMode.Back; + + [SerializeField] + private InlineProperty m_inlineCullMode = new InlineProperty(); + + [SerializeField] + private InlineProperty m_inlineChromaticAberration = new InlineProperty(0.1f); + + [SerializeField] + private AlphaMode m_alphaMode = AlphaMode.Opaque; + + [SerializeField] + private RenderType m_renderType = RenderType.Opaque; + + [SerializeField] + private string m_customRenderType = string.Empty; + + [SerializeField] + private RenderQueue m_renderQueue = RenderQueue.Geometry; + + [SerializeField] + private RenderPath m_renderPath = RenderPath.All; + + [SerializeField] + private VertexMode m_vertexMode = VertexMode.Relative; + + [SerializeField] + private bool m_customBlendMode = false; + + [SerializeField] + private float m_opacityMaskClipValue = 0.5f; + + [SerializeField] + private InlineProperty m_inlineOpacityMaskClipValue = new InlineProperty(); + + [SerializeField] + private InlineProperty m_inlineAlphaToCoverage = new InlineProperty(); + + [SerializeField] + private int m_customLightingPortId = -1; + + [SerializeField] + private int m_emissionPortId = -1; + + [SerializeField] + private int m_discardPortId = -1; + + [SerializeField] + private int m_opacityPortId = -1; + + [SerializeField] + private int m_vertexPortId = -1; + + [SerializeField] + private bool m_keepAlpha = true; + + [SerializeField] + private bool m_castShadows = true; + + //[SerializeField] + private bool m_customShadowCaster = false; + + [SerializeField] + private bool m_receiveShadows = true; + + [SerializeField] + private int m_queueOrder = 0; + + [SerializeField] + private int m_grabOrder = 0; + + [SerializeField] + private bool m_alphaToCoverage = false; + + private InputPort m_transmissionPort; + private InputPort m_translucencyPort; + private InputPort m_tessellationPort; + private bool m_previousTranslucencyOn = false; + private bool m_previousRefractionOn = false; + + [SerializeField] + private CacheNodeConnections m_cacheNodeConnections = new CacheNodeConnections(); + + + private bool m_usingProSkin = false; + private GUIStyle m_inspectorFoldoutStyle; + private GUIStyle m_inspectorToolbarStyle; + private GUIStyle m_inspectorTooldropdownStyle; + + + private bool m_customBlendAvailable = false; + + private Color m_cachedColor = Color.white; + private float m_titleOpacity = 0.5f; + private float m_boxOpacity = 0.5f; + + private InputPort m_refractionPort; + private InputPort m_normalPort; + + + private GUIStyle m_inspectorDefaultStyle; + + [SerializeField] + private ReordenatorNode m_specColorReorder = null; + + [SerializeField] + private int m_specColorOrderIndex = -1; + + [SerializeField] + private ReordenatorNode m_maskClipReorder = null; + + [SerializeField] + private int m_maskClipOrderIndex = -1; + + [SerializeField] + private ReordenatorNode m_translucencyReorder = null; + + [SerializeField] + private int m_translucencyOrderIndex = -1; + + [SerializeField] + private ReordenatorNode m_refractionReorder = null; + + [SerializeField] + private int m_refractionOrderIndex = -1; + + [SerializeField] + private ReordenatorNode m_tessellationReorder = null; + + [SerializeField] + private int m_tessellationOrderIndex = -1; + + private bool m_previousTessellationOn = false; + private bool m_initialize = true; + private bool m_checkChanges = true; + private bool m_lightModelChanged = true; + + private PropertyNode m_dummyProperty = null; + + protected override void CommonInit( int uniqueId ) + { + m_currentLightModel = m_lastLightModel = StandardShaderLightModel.Standard; + m_textLabelWidth = 120; + m_autoDrawInternalPortData = false; + base.CommonInit( uniqueId ); + m_zBufferHelper.ParentSurface = this; + m_tessOpHelper.ParentSurface = this; + m_customPrecision = true; + } + + public override void OnEnable() + { + base.OnEnable(); + if( m_usePass == null ) + { + m_usePass = ScriptableObject.CreateInstance(); + m_usePass.Init( " Additional Use Passes" ); + } + + if( m_fallbackHelper == null ) + { + m_fallbackHelper = ScriptableObject.CreateInstance(); + m_fallbackHelper.Init(); + } + } + + public override void AddMasterPorts() + { + int vertexCorrection = 3; + int index = vertexCorrection + 2; + base.AddMasterPorts(); + switch( m_currentLightModel ) + { + case StandardShaderLightModel.Standard: + { + AddInputPort( WirePortDataType.FLOAT3, false, AlbedoStr, vertexCorrection + 1, MasterNodePortCategory.Fragment, 0 ); + AddInputPort( WirePortDataType.FLOAT3, false, NormalStr, vertexCorrection + 0, MasterNodePortCategory.Fragment, 1 ); + m_normalPort = m_inputPorts[ m_inputPorts.Count - 1 ]; + AddInputPort( WirePortDataType.FLOAT3, false, EmissionStr, index++, MasterNodePortCategory.Fragment, 2 ); + AddInputPort( WirePortDataType.FLOAT, false, MetallicStr, index++, MasterNodePortCategory.Fragment, 3 ); + AddInputPort( WirePortDataType.FLOAT, false, SmoothnessStr, index++, MasterNodePortCategory.Fragment, 4 ); + AddInputPort( WirePortDataType.FLOAT, false, OcclusionLabelStr, OcclusionDataStr, index++, MasterNodePortCategory.Fragment, 5 ); + } + break; + case StandardShaderLightModel.StandardSpecular: + { + AddInputPort( WirePortDataType.FLOAT3, false, AlbedoStr, vertexCorrection + 1, MasterNodePortCategory.Fragment, 0 ); + AddInputPort( WirePortDataType.FLOAT3, false, NormalStr, vertexCorrection + 0, MasterNodePortCategory.Fragment, 1 ); + m_normalPort = m_inputPorts[ m_inputPorts.Count - 1 ]; + AddInputPort( WirePortDataType.FLOAT3, false, EmissionStr, index++, MasterNodePortCategory.Fragment, 2 ); + AddInputPort( WirePortDataType.FLOAT3, false, SpecularStr, index++, MasterNodePortCategory.Fragment, 3 ); + AddInputPort( WirePortDataType.FLOAT, false, SmoothnessStr, index++, MasterNodePortCategory.Fragment, 4 ); + AddInputPort( WirePortDataType.FLOAT, false, OcclusionLabelStr, OcclusionDataStr, index++, MasterNodePortCategory.Fragment, 5 ); + } + break; + case StandardShaderLightModel.CustomLighting: + { + AddInputPort( WirePortDataType.FLOAT3, false, AlbedoStr, vertexCorrection + 1, MasterNodePortCategory.Fragment, 0 ); + AddInputPort( WirePortDataType.FLOAT3, false, NormalStr, vertexCorrection + 0, MasterNodePortCategory.Fragment, 1 ); + m_normalPort = m_inputPorts[ m_inputPorts.Count - 1 ]; + m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true; + AddInputPort( WirePortDataType.FLOAT3, false, EmissionStr, index++, MasterNodePortCategory.Fragment, 2 ); + AddInputPort( WirePortDataType.FLOAT, false, SpecularStr, index++, MasterNodePortCategory.Fragment, 3 ); + m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true; + AddInputPort( WirePortDataType.FLOAT, false, GlossStr, index++, MasterNodePortCategory.Fragment, 4 ); + m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true; + } + break; + case StandardShaderLightModel.Unlit: + { + AddInputPort( WirePortDataType.FLOAT3, false, AlbedoStr, vertexCorrection + 1, MasterNodePortCategory.Fragment, 0 ); + m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true; + AddInputPort( WirePortDataType.FLOAT3, false, NormalStr, vertexCorrection + 0, MasterNodePortCategory.Fragment, 1 ); + m_normalPort = m_inputPorts[ m_inputPorts.Count - 1 ]; + m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true; + AddInputPort( WirePortDataType.FLOAT3, false, EmissionStr, index++, MasterNodePortCategory.Fragment, 2 ); + AddInputPort( WirePortDataType.FLOAT, false, SpecularStr, index++, MasterNodePortCategory.Fragment, 3 ); + m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true; + AddInputPort( WirePortDataType.FLOAT, false, GlossStr, index++, MasterNodePortCategory.Fragment, 4 ); + m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true; + } + break; + case StandardShaderLightModel.Lambert: + { + AddInputPort( WirePortDataType.FLOAT3, false, AlbedoStr, vertexCorrection + 1, MasterNodePortCategory.Fragment, 0 ); + AddInputPort( WirePortDataType.FLOAT3, false, NormalStr, vertexCorrection + 0, MasterNodePortCategory.Fragment, 1 ); + m_normalPort = m_inputPorts[ m_inputPorts.Count - 1 ]; + AddInputPort( WirePortDataType.FLOAT3, false, EmissionStr, index++, MasterNodePortCategory.Fragment, 2 ); + AddInputPort( WirePortDataType.FLOAT, false, SpecularStr, index++, MasterNodePortCategory.Fragment, 3 ); + AddInputPort( WirePortDataType.FLOAT, false, GlossStr, index++, MasterNodePortCategory.Fragment, 4 ); + } + break; + case StandardShaderLightModel.BlinnPhong: + { + AddInputPort( WirePortDataType.FLOAT3, false, AlbedoStr, vertexCorrection + 1, MasterNodePortCategory.Fragment, 0 ); + AddInputPort( WirePortDataType.FLOAT3, false, NormalStr, vertexCorrection + 0, MasterNodePortCategory.Fragment, 1 ); + m_normalPort = m_inputPorts[ m_inputPorts.Count - 1 ]; + AddInputPort( WirePortDataType.FLOAT3, false, EmissionStr, index++, MasterNodePortCategory.Fragment, 2 ); + AddInputPort( WirePortDataType.FLOAT, false, SpecularStr, index++, MasterNodePortCategory.Fragment, 3 ); + AddInputPort( WirePortDataType.FLOAT, false, GlossStr, index++, MasterNodePortCategory.Fragment, 4 ); + } + break; + } + + // instead of setting in the switch emission port is always at position 2; + m_emissionPortId = 2; + + AddInputPort( WirePortDataType.FLOAT3, false, TransmissionStr, index++, MasterNodePortCategory.Fragment, 6 ); + m_transmissionPort = m_inputPorts[ m_inputPorts.Count - 1 ]; + m_inputPorts[ m_inputPorts.Count - 1 ].Locked = ( m_currentLightModel == StandardShaderLightModel.Standard ) || ( m_currentLightModel == StandardShaderLightModel.StandardSpecular ) ? false : true; + + AddInputPort( WirePortDataType.FLOAT3, false, TranslucencyStr, index++, MasterNodePortCategory.Fragment, 7 ); + m_translucencyPort = m_inputPorts[ m_inputPorts.Count - 1 ]; + m_inputPorts[ m_inputPorts.Count - 1 ].Locked = ( m_currentLightModel == StandardShaderLightModel.Standard ) || ( m_currentLightModel == StandardShaderLightModel.StandardSpecular ) ? false : true; + + AddInputPort( WirePortDataType.FLOAT, false, RefractionStr, index + 2, MasterNodePortCategory.Fragment, 8 ); + m_refractionPort = m_inputPorts[ m_inputPorts.Count - 1 ]; + m_inputPorts[ m_inputPorts.Count - 1 ].Locked = ( m_alphaMode == AlphaMode.Opaque || m_alphaMode == AlphaMode.Masked || m_currentLightModel == StandardShaderLightModel.Unlit || m_currentLightModel == StandardShaderLightModel.CustomLighting ); + + AddInputPort( WirePortDataType.FLOAT, false, AlphaStr, index++, MasterNodePortCategory.Fragment, 9 ); + m_inputPorts[ m_inputPorts.Count - 1 ].DataName = AlphaDataStr; + m_opacityPortId = m_inputPorts.Count - 1; + m_inputPorts[ m_inputPorts.Count - 1 ].Locked = ( m_alphaMode == AlphaMode.Opaque || m_alphaMode == AlphaMode.Masked ); + + AddInputPort( WirePortDataType.FLOAT, false, DiscardStr, index++, MasterNodePortCategory.Fragment, 10 ); + m_inputPorts[ m_inputPorts.Count - 1 ].Locked = ( m_alphaMode != AlphaMode.Masked && m_alphaMode != AlphaMode.Custom ); + m_discardPortId = m_inputPorts.Count - 1; + + // This is done to take the index + 2 from refraction port into account and not overlap indexes + index++; + + AddInputPort( WirePortDataType.FLOAT3, false, CustomLightingStr, index++, MasterNodePortCategory.Fragment, 13 ); + m_inputPorts[ m_inputPorts.Count - 1 ].Locked = ( m_currentLightModel != StandardShaderLightModel.CustomLighting ); + m_inputPorts[ m_inputPorts.Count - 1 ].GenType = PortGenType.CustomLighting; + m_customLightingPortId = m_inputPorts.Count - 1; + + //////////////////////////////////////////////////////////////////////////////////////////////// + // Vertex functions - Adding ordex index in order to force these to be the last ones + // Well now they have been moved to be the first ones so operations on vertex are to be taken into account + // by dither, screen position and similar nodes + //////////////////////////////////////////////////////////////////////////////////////////////// + m_vertexPortId = m_inputPorts.Count; + m_tessOpHelper.VertexOffsetIndexPort = m_vertexPortId; + AddInputPort( WirePortDataType.FLOAT3, false, ( m_vertexMode == VertexMode.Relative ? VertexDisplacementStr : VertexPositionStr ), VertexDataStr, 0/*index++*/, MasterNodePortCategory.Vertex, 11 ); + AddInputPort( WirePortDataType.FLOAT3, false, VertexNormalStr, 1/*index++*/, MasterNodePortCategory.Vertex, 12 ); + AddInputPort( WirePortDataType.FLOAT4, false, VertexTangentStr, 2/*index++*/, MasterNodePortCategory.Vertex, 16 ); + + //AddInputPort( WirePortDataType.FLOAT3, false, CustomLightModelStr, index++, MasterNodePortCategory.Fragment, 13 ); + //m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true;// !(m_currentLightModel == StandardShaderLightModel.CustomLighting); + + AddInputPort( WirePortDataType.FLOAT4, false, TessellationOpHelper.TessellationPortStr, index++, MasterNodePortCategory.Tessellation, 14 ); + m_tessellationPort = m_inputPorts[ m_inputPorts.Count - 1 ]; + m_tessOpHelper.MasterNodeIndexPort = m_tessellationPort.PortId; + + //////////////////////////////////////////////////////////////////////////////////// + AddInputPort( WirePortDataType.FLOAT3, false, DebugStr, index++, MasterNodePortCategory.Debug, 15 ); + + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + m_inputPorts[ i ].CustomColor = Color.white; + } + m_sizeIsDirty = true; + } + + public override void ForcePortType() + { + int portId = 0; + switch( m_currentLightModel ) + { + case StandardShaderLightModel.Standard: + { + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); + } + break; + case StandardShaderLightModel.StandardSpecular: + { + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); + } + break; + case StandardShaderLightModel.CustomLighting: + { + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); + } + break; + case StandardShaderLightModel.Unlit: + case StandardShaderLightModel.Lambert: + { + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); + } + break; + case StandardShaderLightModel.BlinnPhong: + { + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); + } + break; + } + + //Transmission + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + //Translucency + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + //Refraction + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); + //Alpha + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); + //Discard + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); + //Custom Lighting + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + //Vertex Offset + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + //Vertex Normal + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + //Vertex Tangents + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT4, false ); + //Tessellation + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT4, false ); + //Debug + m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); + } + + public override void SetName( string name ) + { + ShaderName = name; + } + + public void DrawInspectorProperty() + { + if( m_inspectorDefaultStyle == null ) + { + m_inspectorDefaultStyle = UIUtils.GetCustomStyle( CustomStyle.ResetToDefaultInspectorButton ); + } + + DrawCustomInspector( false ); + } + + private void RecursiveLog() + { + List nodes = UIUtils.PropertyNodesList(); + nodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); + for( int i = 0; i < nodes.Count; i++ ) + { + if( ( nodes[ i ] is ReordenatorNode ) ) + ( nodes[ i ] as ReordenatorNode ).RecursiveLog(); + else + Debug.Log( nodes[ i ].OrderIndex + " " + nodes[ i ].PropertyName ); + } + } + + public void DrawGeneralOptions() + { + DrawShaderName(); + DrawCurrentShaderType(); + + EditorGUI.BeginChangeCheck(); + m_currentLightModel = (StandardShaderLightModel)EditorGUILayoutEnumPopup( LightModelContent, m_currentLightModel ); + if( EditorGUI.EndChangeCheck() ) + { + ContainerGraph.ChangedLightingModel = true; + if( m_currentLightModel == StandardShaderLightModel.CustomLighting ) + { + ContainerGraph.ParentWindow.CurrentNodeAvailability = NodeAvailability.CustomLighting; + //ContainerGraph.CurrentCanvasMode = NodeAvailability.CustomLighting; + } + else + { + ContainerGraph.ParentWindow.CurrentNodeAvailability = NodeAvailability.SurfaceShader; + //ContainerGraph.CurrentCanvasMode = NodeAvailability.SurfaceShader; + } + } + + m_shaderModelIdx = EditorGUILayoutPopup( ShaderModelStr, m_shaderModelIdx, ShaderModelTypeArr ); + + EditorGUI.BeginChangeCheck(); + DrawPrecisionProperty( false ); + if( EditorGUI.EndChangeCheck() ) + ContainerGraph.CurrentPrecision = m_currentPrecisionType; + //m_cullMode = (CullMode)EditorGUILayoutEnumPopup( CullModeContent, m_cullMode ); + UndoParentNode inst = this; + m_inlineCullMode.CustomDrawer( ref inst, ( x ) => { m_cullMode = (CullMode)EditorGUILayoutEnumPopup( CullModeContent, m_cullMode ); }, CullModeContent.text ); + //m_inlineCullMode.Value = (int)m_cullMode; + //m_inlineCullMode.EnumTypePopup( ref inst, CullModeContent.text, Enum.GetNames( typeof( CullMode ) ) ); + //m_cullMode = (CullMode) m_inlineCullMode.Value; + + m_renderPath = (RenderPath)EditorGUILayoutEnumPopup( RenderPathContent, m_renderPath ); + + m_castShadows = EditorGUILayoutToggle( CastShadowsContent, m_castShadows ); + + m_receiveShadows = EditorGUILayoutToggle( ReceiveShadowsContent, m_receiveShadows ); + + DrawSamplingMacros(); + + m_drawInstancedHelper.Draw( this ); + + m_queueOrder = EditorGUILayoutIntField( QueueIndexContent, m_queueOrder ); + EditorGUI.BeginChangeCheck(); + m_vertexMode = (VertexMode)EditorGUILayoutEnumPopup( VertexModeStr, m_vertexMode ); + if( EditorGUI.EndChangeCheck() ) + { + m_inputPorts[ m_vertexPortId ].Name = m_vertexMode == VertexMode.Relative ? VertexDisplacementStr : VertexPositionStr; + m_sizeIsDirty = true; + } + + ShaderLOD = Mathf.Clamp( EditorGUILayoutIntField( ShaderLODContent, ShaderLOD ), 0, Shader.globalMaximumLOD ); + ////m_lodCrossfade = EditorGUILayoutToggle( LODCrossfadeContent, m_lodCrossfade ); + m_fallbackHelper.Draw( this ); + DrawInspectorProperty(); + + } + + public void ShowOpacityMaskValueUI() + { + EditorGUI.BeginChangeCheck(); + UndoParentNode inst = this; + m_inlineOpacityMaskClipValue.CustomDrawer( ref inst, ( x ) => { m_opacityMaskClipValue = EditorGUILayoutFloatField( OpacityMaskClipValueContent, m_opacityMaskClipValue ); }, OpacityMaskClipValueContent.text ); + if( EditorGUI.EndChangeCheck() ) + { + m_checkChanges = true; + if( m_currentMaterial != null && m_currentMaterial.HasProperty( IOUtils.MaskClipValueName ) ) + { + m_currentMaterial.SetFloat( IOUtils.MaskClipValueName, m_opacityMaskClipValue ); + } + } + } + + public override void DrawProperties() + { + if( m_inspectorFoldoutStyle == null || EditorGUIUtility.isProSkin != m_usingProSkin ) + m_inspectorFoldoutStyle = new GUIStyle( GUI.skin.GetStyle( "foldout" ) ); + + if( m_inspectorToolbarStyle == null || EditorGUIUtility.isProSkin != m_usingProSkin ) + { + m_inspectorToolbarStyle = new GUIStyle( GUI.skin.GetStyle( "toolbarbutton" ) ) + { + fixedHeight = 20 + }; + } + + if( m_inspectorTooldropdownStyle == null || EditorGUIUtility.isProSkin != m_usingProSkin ) + { + m_inspectorTooldropdownStyle = new GUIStyle( GUI.skin.GetStyle( "toolbardropdown" ) ) + { + fixedHeight = 20 + }; + m_inspectorTooldropdownStyle.margin.bottom = 2; + } + + if( EditorGUIUtility.isProSkin != m_usingProSkin ) + m_usingProSkin = EditorGUIUtility.isProSkin; + + base.DrawProperties(); + + EditorGUILayout.BeginVertical(); + { + EditorGUILayout.Separator(); + + m_titleOpacity = 0.5f; + m_boxOpacity = ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ); + m_cachedColor = GUI.color; + + // General + bool generalIsVisible = ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions; + NodeUtils.DrawPropertyGroup( ref generalIsVisible, GeneralFoldoutStr, DrawGeneralOptions ); + ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions = generalIsVisible; + + //Blend Mode + GUI.color = new Color( m_cachedColor.r, m_cachedColor.g, m_cachedColor.b, m_titleOpacity ); + EditorGUILayout.BeginHorizontal( m_inspectorToolbarStyle ); + GUI.color = m_cachedColor; + + bool blendOptionsVisible = GUILayout.Toggle( ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendOptions, AlphaModeContent, UIUtils.MenuItemToggleStyle, GUILayout.ExpandWidth( true ) ); + if( Event.current.button == Constants.FoldoutMouseId ) + { + ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendOptions = blendOptionsVisible; + } + + + if( !EditorGUIUtility.isProSkin ) + GUI.color = new Color( 0.25f, 0.25f, 0.25f, 1f ); + + float boxSize = 60; + switch( m_alphaMode ) + { + case AlphaMode.Transparent: + boxSize = 85; + break; + case AlphaMode.Translucent: + boxSize = 80; + break; + case AlphaMode.Premultiply: + boxSize = 120; + break; + } + EditorGUI.BeginChangeCheck(); + m_alphaMode = (AlphaMode)EditorGUILayoutPopup( string.Empty, (int)m_alphaMode, FadeModeOptions, UIUtils.InspectorPopdropdownStyle, GUILayout.Width( boxSize ), GUILayout.Height( 19 ) ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromBlendMode(); + } + + GUI.color = m_cachedColor; + EditorGUILayout.EndHorizontal(); + + m_customBlendAvailable = ( m_alphaMode == AlphaMode.Custom || m_alphaMode == AlphaMode.Opaque ); + + if( ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendOptions ) + { + GUI.color = new Color( m_cachedColor.r, m_cachedColor.g, m_cachedColor.b, m_boxOpacity ); + EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); + GUI.color = m_cachedColor; + EditorGUI.indentLevel++; + EditorGUILayout.Separator(); + EditorGUI.BeginChangeCheck(); + + + m_renderType = (RenderType)EditorGUILayoutEnumPopup( RenderTypeContent, m_renderType ); + if( m_renderType == RenderType.Custom ) + { + EditorGUI.BeginChangeCheck(); + m_customRenderType = EditorGUILayoutTextField( CustomRenderTypeStr, m_customRenderType ); + if( EditorGUI.EndChangeCheck() ) + { + m_customRenderType = UIUtils.RemoveInvalidCharacters( m_customRenderType ); + } + } + + m_renderQueue = (RenderQueue)EditorGUILayoutEnumPopup( RenderQueueContent, m_renderQueue ); + + if( EditorGUI.EndChangeCheck() ) + { + if( m_renderType == RenderType.Opaque && m_renderQueue == RenderQueue.Geometry ) + m_alphaMode = AlphaMode.Opaque; + else if( m_renderType == RenderType.TransparentCutout && m_renderQueue == RenderQueue.AlphaTest ) + m_alphaMode = AlphaMode.Masked; + else if( m_renderType == RenderType.Transparent && m_renderQueue == RenderQueue.Transparent ) + m_alphaMode = AlphaMode.Transparent; + else if( m_renderType == RenderType.Opaque && m_renderQueue == RenderQueue.Transparent ) + m_alphaMode = AlphaMode.Translucent; + else + m_alphaMode = AlphaMode.Custom; + + + UpdateFromBlendMode(); + } + + bool bufferedEnabled = GUI.enabled; + + GUI.enabled = ( m_alphaMode == AlphaMode.Masked || m_alphaMode == AlphaMode.Custom ); + m_inputPorts[ m_discardPortId ].Locked = !GUI.enabled; + ShowOpacityMaskValueUI(); + + GUI.enabled = bufferedEnabled; + + EditorGUI.BeginDisabledGroup( !( m_alphaMode == AlphaMode.Transparent || m_alphaMode == AlphaMode.Premultiply || m_alphaMode == AlphaMode.Translucent || m_alphaMode == AlphaMode.Custom ) ); + m_grabOrder = EditorGUILayoutIntField( RefractionLayerStr, m_grabOrder ); + float cachedLabelWidth = EditorGUIUtility.labelWidth; + UndoParentNode inst = this; + if( m_refractionPort.IsConnected ) + { + EditorGUIUtility.labelWidth = 145; + EditorGUI.BeginChangeCheck(); + m_inlineChromaticAberration.RangedFloatField( ref inst, ChromaticAberrationStr, 0.0f,0.3f ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_currentMaterial != null && m_currentMaterial.HasProperty( IOUtils.ChromaticAberrationProperty ) ) + { + m_currentMaterial.SetFloat( IOUtils.ChromaticAberrationProperty, m_inlineChromaticAberration.FloatValue ); + } + } + } + + //EditorGUIUtility.labelWidth = 130; + m_inlineAlphaToCoverage.CustomDrawer( ref inst, ( x ) => { m_alphaToCoverage = EditorGUILayoutToggle( AlphaToCoverageStr, m_alphaToCoverage ); }, AlphaToCoverageStr.text ); + //EditorGUIUtility.labelWidth = cachedLabelWidth; + EditorGUI.EndDisabledGroup(); + + EditorGUILayout.Separator(); + + if( !m_customBlendAvailable ) + { + EditorGUILayout.HelpBox( "Advanced options are only available for Custom blend modes", MessageType.Warning ); + } + + EditorGUI.BeginDisabledGroup( !m_customBlendAvailable ); + m_blendOpsHelper.Draw( this, m_customBlendAvailable ); + m_colorMaskHelper.Draw( this ); + + EditorGUI.EndDisabledGroup(); + EditorGUILayout.Separator(); + EditorGUI.indentLevel--; + EditorGUILayout.EndVertical(); + } + + m_stencilBufferHelper.Draw( this ); + m_tessOpHelper.Draw( this, m_inspectorToolbarStyle, m_currentMaterial, m_tessellationPort.IsConnected ); + m_outlineHelper.Draw( this, m_inspectorToolbarStyle, m_currentMaterial ); + m_billboardOpHelper.Draw( this ); + m_zBufferHelper.Draw( this, m_inspectorToolbarStyle, m_customBlendAvailable ); + m_renderingOptionsOpHelper.Draw( this ); + m_renderingPlatformOpHelper.Draw( this ); + //m_additionalDefines.Draw( this ); + //m_additionalIncludes.Draw( this ); + //m_additionalPragmas.Draw( this ); + m_additionalSurfaceOptions.Draw( this ); + m_usePass.Draw( this ); + m_additionalDirectives.Draw( this ); + m_customTagsHelper.Draw( this ); + m_dependenciesHelper.Draw( this ); + DrawMaterialInputs( m_inspectorToolbarStyle ); + } + + EditorGUILayout.EndVertical(); + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + + if( m_initialize ) + { + m_initialize = false; + + if( m_dummyProperty == null ) + { + m_dummyProperty = ScriptableObject.CreateInstance(); + m_dummyProperty.ContainerGraph = ContainerGraph; + } + } + + if( m_currentLightModel != m_lastLightModel ) + m_lightModelChanged = true; + + if( m_lightModelChanged ) + { + m_lightModelChanged = false; + if( m_currentLightModel == StandardShaderLightModel.BlinnPhong ) + { + if( m_specColorReorder == null ) + { + m_specColorReorder = ScriptableObject.CreateInstance(); + m_specColorReorder.ContainerGraph = ContainerGraph; + m_specColorReorder.OrderIndex = m_specColorOrderIndex; + m_specColorReorder.Init( "_SpecColor", "Specular Color", null ); + } + + UIUtils.RegisterPropertyNode( m_specColorReorder ); + } + else + { + if( m_specColorReorder != null ) + UIUtils.UnregisterPropertyNode( m_specColorReorder ); + } + + if( m_currentLightModel == StandardShaderLightModel.CustomLighting && m_masterNodeCategory == 0 ) + ContainerGraph.CurrentCanvasMode = NodeAvailability.CustomLighting; + else if( m_masterNodeCategory == 0 ) + ContainerGraph.CurrentCanvasMode = NodeAvailability.SurfaceShader; + CacheCurrentSettings(); + m_lastLightModel = m_currentLightModel; + DeleteAllInputConnections( true, true ); + AddMasterPorts(); + ConnectFromCache(); + } + + if( drawInfo.CurrentEventType != EventType.Layout ) + return; + + if( m_transmissionPort != null && m_transmissionPort.IsConnected && m_renderPath != RenderPath.ForwardOnly ) + { + m_renderPath = RenderPath.ForwardOnly; + UIUtils.ShowMessage( "Render Path changed to Forward Only since transmission only works in forward rendering" ); + } + + if( m_translucencyPort != null && m_translucencyPort.IsConnected && m_renderPath != RenderPath.ForwardOnly ) + { + m_renderPath = RenderPath.ForwardOnly; + UIUtils.ShowMessage( "Render Path changed to Forward Only since translucency only works in forward rendering" ); + } + + if( m_translucencyPort.IsConnected != m_previousTranslucencyOn ) + m_checkChanges = true; + + if( m_refractionPort.IsConnected != m_previousRefractionOn ) + m_checkChanges = true; + + if( ( m_tessOpHelper.EnableTesselation && !m_tessellationPort.IsConnected ) != m_previousTessellationOn ) + m_checkChanges = true; + + m_previousTranslucencyOn = m_translucencyPort.IsConnected; + + m_previousRefractionOn = m_refractionPort.IsConnected; + + m_previousTessellationOn = ( m_tessOpHelper.EnableTesselation && !m_tessellationPort.IsConnected ); + + if( m_checkChanges ) + { + if( m_translucencyPort.IsConnected ) + { + if( m_translucencyReorder == null ) + { + List translucencyList = new List(); + for( int i = 0; i < 7; i++ ) + { + translucencyList.Add( m_dummyProperty ); + } + + m_translucencyReorder = ScriptableObject.CreateInstance(); + m_translucencyReorder.ContainerGraph = ContainerGraph; + m_translucencyReorder.OrderIndex = m_translucencyOrderIndex; + m_translucencyReorder.Init( "_TranslucencyGroup", "Translucency", translucencyList ); + } + + UIUtils.RegisterPropertyNode( m_translucencyReorder ); + } + else + { + if( m_translucencyReorder != null ) + UIUtils.UnregisterPropertyNode( m_translucencyReorder ); + } + + if( m_refractionPort.IsConnected ) + { + if( m_refractionReorder == null ) + { + List refractionList = new List(); + for( int i = 0; i < 2; i++ ) + { + refractionList.Add( m_dummyProperty ); + } + + m_refractionReorder = ScriptableObject.CreateInstance(); + m_refractionReorder.ContainerGraph = ContainerGraph; + m_refractionReorder.OrderIndex = m_refractionOrderIndex; + m_refractionReorder.Init( "_RefractionGroup", "Refraction", refractionList ); + } + + UIUtils.RegisterPropertyNode( m_refractionReorder ); + } + else + { + if( m_refractionReorder != null ) + UIUtils.UnregisterPropertyNode( m_refractionReorder ); + } + + if( m_tessOpHelper.EnableTesselation && !m_tessellationPort.IsConnected ) + { + if( m_tessellationReorder == null ) + { + List tessellationList = new List(); + for( int i = 0; i < 4; i++ ) + { + tessellationList.Add( m_dummyProperty ); + } + + m_tessellationReorder = ScriptableObject.CreateInstance(); + m_tessellationReorder.ContainerGraph = ContainerGraph; + m_tessellationReorder.OrderIndex = m_tessellationOrderIndex; + m_tessellationReorder.Init( "_TessellationGroup", "Tessellation", tessellationList ); + m_tessellationReorder.HeaderTitle = "Tesselation"; + } + + UIUtils.RegisterPropertyNode( m_tessellationReorder ); + } + else + { + if( m_tessellationReorder != null ) + UIUtils.UnregisterPropertyNode( m_tessellationReorder ); + } + + if( m_inputPorts[ m_discardPortId ].Available && !m_inlineOpacityMaskClipValue.IsValid ) + { + if( m_maskClipReorder == null ) + { + // Create dragable clip material property + m_maskClipReorder = ScriptableObject.CreateInstance(); + m_maskClipReorder.ContainerGraph = ContainerGraph; + m_maskClipReorder.OrderIndex = m_maskClipOrderIndex; + m_maskClipReorder.Init( "_Cutoff", "Mask Clip Value", null ); + } + + UIUtils.RegisterPropertyNode( m_maskClipReorder ); + } + else + { + if( m_maskClipReorder != null ) + UIUtils.UnregisterPropertyNode( m_maskClipReorder ); + } + + m_checkChanges = false; + } + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + base.OnNodeRepaint( drawInfo ); + + if( m_containerGraph.IsInstancedShader || m_renderingOptionsOpHelper.ForceEnableInstancing ) + { + DrawInstancedIcon( drawInfo ); + } + } + + private void CacheCurrentSettings() + { + m_cacheNodeConnections.Clear(); + for( int portId = 0; portId < m_inputPorts.Count; portId++ ) + { + if( m_inputPorts[ portId ].IsConnected ) + { + WireReference connection = m_inputPorts[ portId ].GetConnection(); + m_cacheNodeConnections.Add( m_inputPorts[ portId ].Name, new NodeCache( connection.NodeId, connection.PortId ) ); + } + } + } + + private void ConnectFromCache() + { + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + NodeCache cache = m_cacheNodeConnections.Get( m_inputPorts[ i ].Name ); + if( cache != null ) + { + UIUtils.SetConnection( UniqueId, m_inputPorts[ i ].PortId, cache.TargetNodeId, cache.TargetPortId ); + } + } + } + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + if( m_alphaMode == AlphaMode.Masked || m_alphaMode == AlphaMode.Custom ) + { + if( mat.HasProperty( IOUtils.MaskClipValueName ) ) + mat.SetFloat( IOUtils.MaskClipValueName, m_opacityMaskClipValue ); + } + + if( m_refractionPort.IsConnected && !m_inlineChromaticAberration.Active ) + { + if( mat.HasProperty( IOUtils.ChromaticAberrationProperty ) ) + mat.SetFloat( IOUtils.ChromaticAberrationProperty, m_inlineChromaticAberration.FloatValue ); + } + } + + public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) + { + base.SetMaterialMode( mat, fetchMaterialValues ); + if( m_alphaMode == AlphaMode.Masked || m_alphaMode == AlphaMode.Custom ) + { + if( fetchMaterialValues && m_materialMode && mat.HasProperty( IOUtils.MaskClipValueName ) ) + { + m_opacityMaskClipValue = mat.GetFloat( IOUtils.MaskClipValueName ); + } + } + + if( m_refractionPort.IsConnected && !m_inlineChromaticAberration.Active ) + { + if( fetchMaterialValues && m_materialMode && mat.HasProperty( IOUtils.ChromaticAberrationProperty ) ) + m_inlineChromaticAberration.FloatValue = mat.GetFloat( IOUtils.ChromaticAberrationProperty); + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + m_tessOpHelper.UpdateFromMaterial( material ); + m_outlineHelper.UpdateFromMaterial( material ); + + if( m_alphaMode == AlphaMode.Masked || m_alphaMode == AlphaMode.Custom ) + { + if( material.HasProperty( IOUtils.MaskClipValueName ) ) + m_opacityMaskClipValue = material.GetFloat( IOUtils.MaskClipValueName ); + } + + if( m_refractionPort.IsConnected && !m_inlineChromaticAberration.Active ) + { + if( material.HasProperty( IOUtils.ChromaticAberrationProperty ) ) + m_inlineChromaticAberration.FloatValue = material.GetFloat( IOUtils.ChromaticAberrationProperty ); + } + } + + public override void UpdateMasterNodeMaterial( Material material ) + { + m_currentMaterial = material; + UpdateMaterialEditor(); + } + + void UpdateMaterialEditor() + { + FireMaterialChangedEvt(); + } + + public string CreateInstructionsForVertexPort( InputPort port ) + { + //Vertex displacement and per vertex custom data + WireReference connection = port.GetConnection(); + ParentNode node = UIUtils.GetNode( connection.NodeId ); + + string vertexInstructions = node.GetValueFromOutputStr( connection.PortId, port.DataType, ref m_currentDataCollector, false ); + + if( m_currentDataCollector.DirtySpecialLocalVariables ) + { + m_currentDataCollector.AddVertexInstruction( m_currentDataCollector.SpecialLocalVariables, UniqueId, false ); + m_currentDataCollector.ClearSpecialLocalVariables(); + } + + if( m_currentDataCollector.DirtyVertexVariables ) + { + m_currentDataCollector.AddVertexInstruction( m_currentDataCollector.VertexLocalVariables, UniqueId, false ); + m_currentDataCollector.ClearVertexLocalVariables(); + } + + return vertexInstructions; + } + + public void CreateInstructionsForPort( InputPort port, string portName, bool addCustomDelimiters = false, string customDelimiterIn = null, string customDelimiterOut = null, bool ignoreLocalVar = false, bool normalIsConnected = false , bool isDebugPort = false ) + { + WireReference connection = port.GetConnection(); + ParentNode node = UIUtils.GetNode( connection.NodeId ); + + string newInstruction = node.GetValueFromOutputStr( connection.PortId, port.DataType, ref m_currentDataCollector, ignoreLocalVar ); + + if( m_currentDataCollector.DirtySpecialLocalVariables ) + { + m_currentDataCollector.AddInstructions( m_currentDataCollector.SpecialLocalVariables ); + m_currentDataCollector.ClearSpecialLocalVariables(); + } + + if( m_currentDataCollector.DirtyVertexVariables ) + { + m_currentDataCollector.AddVertexInstruction( m_currentDataCollector.VertexLocalVariables, port.NodeId, false ); + m_currentDataCollector.ClearVertexLocalVariables(); + } + + if( m_currentDataCollector.ForceNormal && !normalIsConnected ) + { + m_currentDataCollector.AddToStartInstructions( "\t\t\t" + Constants.OutputVarStr + ".Normal = float3(0,0,1);\n" ); + m_currentDataCollector.DirtyNormal = true; + m_currentDataCollector.ForceNormal = false; + } + + m_currentDataCollector.AddInstructions( addCustomDelimiters ? customDelimiterIn : ( "\t\t\t" + portName + " = " ) ); + m_currentDataCollector.AddInstructions( newInstruction ); + m_currentDataCollector.AddInstructions( addCustomDelimiters ? customDelimiterOut :((isDebugPort)?" + 1E-5;\n":";\n") ); + } + + public string CreateInstructionStringForPort( InputPort port, bool ignoreLocalVar = false ) + { + WireReference connection = port.GetConnection(); + ParentNode node = UIUtils.GetNode( connection.NodeId ); + + string newInstruction = node.GetValueFromOutputStr( connection.PortId, port.DataType, ref m_currentDataCollector, ignoreLocalVar ); + + if( m_currentDataCollector.DirtySpecialLocalVariables ) + { + m_currentDataCollector.AddInstructions( m_currentDataCollector.SpecialLocalVariables ); + m_currentDataCollector.ClearSpecialLocalVariables(); + } + + if( m_currentDataCollector.DirtyVertexVariables ) + { + m_currentDataCollector.AddVertexInstruction( m_currentDataCollector.VertexLocalVariables, port.NodeId, false ); + m_currentDataCollector.ClearVertexLocalVariables(); + } + + if( m_currentDataCollector.ForceNormal ) + { + m_currentDataCollector.AddToStartInstructions( "\t\t\t" + Constants.OutputVarStr + ".Normal = float3(0,0,1);\n" ); + m_currentDataCollector.DirtyNormal = true; + m_currentDataCollector.ForceNormal = false; + } + + return newInstruction; + } + + public override Shader Execute( string pathname, bool isFullPath ) + { + ForcePortType(); + ForceReordering(); + UpdateFromBlendMode(); + base.Execute( pathname, isFullPath ); + RegisterStandaloneFuntions(); + + bool isInstancedShader = m_renderingOptionsOpHelper.ForceEnableInstancing || UIUtils.IsInstancedShader(); + bool hasVirtualTexture = UIUtils.HasVirtualTexture(); + bool hasTranslucency = false; + bool hasTransmission = false; + bool hasEmission = false; + bool hasOpacity = false; + bool hasOpacityMask = false; + bool hasRefraction = false; + //bool hasVertexOffset = false; + //bool hasCustomLightingAlpha = false; + bool hasCustomLightingMask = false; + + string customLightingCode = string.Empty; + string customLightingAlphaCode = string.Empty; + string customLightingMaskCode = string.Empty; + string customLightingInstructions = string.Empty; + + string refractionCode = string.Empty; + string refractionInstructions = string.Empty; + string refractionFix = string.Empty; + + string aboveUsePasses = string.Empty; + string bellowUsePasses = string.Empty; + + + m_currentDataCollector.TesselationActive = m_tessOpHelper.EnableTesselation; + #if UNITY_IOS + if ( m_currentDataCollector.TesselationActive ) + { + // On iOS custom app data must be used since fixed4 color from appdata_full generates an error on it when tessellation is active + m_currentDataCollector.ForceCustomAppDataUsage(); + } + #endif + m_currentDataCollector.CurrentRenderPath = m_renderPath; + + StandardShaderLightModel cachedLightModel = m_currentLightModel; + NodeAvailability cachedAvailability = ContainerGraph.CurrentCanvasMode; + + bool debugIsUsingCustomLighting = false; + bool usingDebugPort = false; + if( m_inputPorts[ m_inputPorts.Count - 1 ].IsConnected ) + { + usingDebugPort = true; + debugIsUsingCustomLighting = m_currentLightModel == StandardShaderLightModel.CustomLighting; + + m_currentDataCollector.GenType = PortGenType.CustomLighting; + m_currentLightModel = StandardShaderLightModel.CustomLighting; + ContainerGraph.CurrentCanvasMode = NodeAvailability.CustomLighting; + } + + // @diogo: Set ASE info + ASEPackageManagerHelper.SetASEVersionInfoOnDataCollector( ref m_currentDataCollector ); + + if ( isInstancedShader ) + { + m_currentDataCollector.AddToPragmas( UniqueId, IOUtils.InstancedPropertiesHeader ); + } + + if( m_renderingOptionsOpHelper.SpecularHighlightToggle || m_renderingOptionsOpHelper.ReflectionsToggle ) + m_currentDataCollector.AddToProperties( UniqueId, "[Header(Forward Rendering Options)]", 10001 ); + if( m_renderingOptionsOpHelper.SpecularHighlightToggle ) + { + m_currentDataCollector.AddToProperties( UniqueId, "[ToggleOff] _SpecularHighlights(\"Specular Highlights\", Float) = 1.0", 10002 ); + m_currentDataCollector.AddToPragmas( UniqueId, "shader_feature _SPECULARHIGHLIGHTS_OFF" ); + } + if( m_renderingOptionsOpHelper.ReflectionsToggle ) + { + m_currentDataCollector.AddToProperties( UniqueId, "[ToggleOff] _GlossyReflections(\"Reflections\", Float) = 1.0", 10003 ); + m_currentDataCollector.AddToPragmas( UniqueId, "shader_feature _GLOSSYREFLECTIONS_OFF" ); + } + + + // See if each node is being used on frag and/or vert ports + SetupNodeCategories(); + m_containerGraph.CheckPropertiesAutoRegister( ref m_currentDataCollector ); + + if( m_refractionPort.IsConnected || m_inputPorts[ m_inputPorts.Count - 1 ].IsConnected ) + { + m_currentDataCollector.DirtyNormal = true; + m_currentDataCollector.ForceNormal = true; + } + //this.PropagateNodeData( nodeData ); + + string tags = "\"RenderType\" = \"{0}\" \"Queue\" = \"{1}\""; + string finalRenderType = ( m_renderType == RenderType.Custom && m_customRenderType.Length > 0 ) ? m_customRenderType : m_renderType.ToString(); + tags = string.Format( tags, finalRenderType, ( m_renderQueue + ( ( m_queueOrder >= 0 ) ? "+" : string.Empty ) + m_queueOrder ) ); + //if ( !m_customBlendMode ) + { + if( m_alphaMode == AlphaMode.Transparent || m_alphaMode == AlphaMode.Premultiply ) + { + //tags += " \"IgnoreProjector\" = \"True\""; + if( !m_renderingOptionsOpHelper.IgnoreProjectorValue ) + { + Debug.Log( string.Format( "Setting Ignore Projector to True since it's requires by Blend Mode {0}.", m_alphaMode ) ); + m_renderingOptionsOpHelper.IgnoreProjectorValue = true; + } + } + } + + tags += m_renderingOptionsOpHelper.IgnoreProjectorTag; + tags += m_renderingOptionsOpHelper.ForceNoShadowCastingTag; + tags += m_renderingOptionsOpHelper.DisableBatchingTag; + + //add virtual texture support + if( hasVirtualTexture ) + { + tags += " \"Amplify\" = \"True\" "; + } + + //tags = "Tags{ " + tags + " }"; + + string outputStruct = ""; + switch( m_currentLightModel ) + { + case StandardShaderLightModel.CustomLighting: outputStruct = "SurfaceOutputCustomLightingCustom"; break; + case StandardShaderLightModel.Standard: outputStruct = "SurfaceOutputStandard"; break; + case StandardShaderLightModel.StandardSpecular: outputStruct = "SurfaceOutputStandardSpecular"; break; + case StandardShaderLightModel.Unlit: + case StandardShaderLightModel.Lambert: + case StandardShaderLightModel.BlinnPhong: outputStruct = "SurfaceOutput"; break; + } + + if( m_currentLightModel == StandardShaderLightModel.CustomLighting ) + { + m_currentDataCollector.AddToIncludes( UniqueId, Constants.UnityPBSLightingLib ); + + m_currentDataCollector.ChangeCustomInputHeader( m_currentLightModel.ToString() + Constants.CustomLightStructStr ); + m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Albedo", true ); + m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Normal", true ); + m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Emission", true ); + m_currentDataCollector.AddToCustomInput( UniqueId, "half Metallic", true ); + m_currentDataCollector.AddToCustomInput( UniqueId, "half Smoothness", true ); + m_currentDataCollector.AddToCustomInput( UniqueId, "half Occlusion", true ); + m_currentDataCollector.AddToCustomInput( UniqueId, "half Alpha", true ); + m_currentDataCollector.AddToCustomInput( UniqueId, "Input SurfInput", true ); + m_currentDataCollector.AddToCustomInput( UniqueId, "UnityGIInput GIData", true ); + } + + //Terrain Draw Instanced + if( m_drawInstancedHelper.Enabled ) + { + if( !m_currentDataCollector.DirtyPerVertexData ) + { + m_currentDataCollector.OpenPerVertexHeader( !m_tessOpHelper.EnableTesselation ); + } + m_drawInstancedHelper.UpdateDataCollectorForStandard( ref m_currentDataCollector ); + } + + // Need to sort before creating local vars so they can inspect the normal port correctly + SortedList sortedPorts = new SortedList(); + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + sortedPorts.Add( m_inputPorts[ i ].OrderId, m_inputPorts[ i ] ); + } + + //This must be set before node code generation since it will be used by Outline node + m_currentDataCollector.SurfaceCustomShadowCaster = CustomShadowCaster; + + bool normalIsConnected = m_normalPort.IsConnected; + m_tessOpHelper.Reset(); + if( m_inputPorts[ m_inputPorts.Count - 1 ].IsConnected ) + { + //Debug Port active + InputPort debugPort = m_inputPorts[ m_inputPorts.Count - 1 ]; + m_currentDataCollector.PortCategory = debugPort.Category; + if( debugIsUsingCustomLighting ) + { + m_currentDataCollector.UsingCustomOutput = true; + WireReference connection = m_inputPorts[ m_inputPorts.Count - 1 ].GetConnection(); + ParentNode node = UIUtils.GetNode( connection.NodeId ); + customLightingCode = node.GetValueFromOutputStr( connection.PortId, WirePortDataType.FLOAT3, ref m_currentDataCollector, false ); + customLightingInstructions = m_currentDataCollector.CustomOutput; + + if( m_currentDataCollector.ForceNormal ) + { + m_currentDataCollector.AddToStartInstructions( "\t\t\t" + Constants.OutputVarStr + ".Normal = float3(0,0,1);\n" ); + m_currentDataCollector.DirtyNormal = true; + m_currentDataCollector.ForceNormal = false; + } + + if( m_currentDataCollector.DirtyVertexVariables ) + { + m_currentDataCollector.AddVertexInstruction( m_currentDataCollector.VertexLocalVariables, UniqueId, false ); + m_currentDataCollector.ClearVertexLocalVariables(); + } + m_currentDataCollector.UsingCustomOutput = false; + } + else + { + CreateInstructionsForPort( debugPort, Constants.OutputVarStr + ".Emission", false, null, null, false, false,true ); + } + } + else + { + MasterNodePortCategory currentCategory = sortedPorts[ 0 ].Category; + //Collect data from standard nodes + for( int i = 0; i < sortedPorts.Count; i++ ) + { + // prepare ports for custom lighting + m_currentDataCollector.GenType = sortedPorts[ i ].GenType; + if( m_currentLightModel == StandardShaderLightModel.CustomLighting && sortedPorts[ i ].Name.Equals( AlphaStr ) ) + ContainerGraph.ResetNodesLocalVariablesIfNot( MasterNodePortCategory.Vertex ); + + if( sortedPorts[ i ].IsConnected ) + { + m_currentDataCollector.PortCategory = sortedPorts[ i ].Category; + + if( sortedPorts[ i ].Name.Equals( NormalStr ) )// Normal Map is Connected + { + m_currentDataCollector.DirtyNormal = true; + } + if( sortedPorts[ i ].Name.Equals( TranslucencyStr ) ) + { + hasTranslucency = true; + } + if( sortedPorts[ i ].Name.Equals( TransmissionStr ) ) + { + hasTransmission = true; + } + if( sortedPorts[ i ].Name.Equals( EmissionStr ) ) + { + hasEmission = true; + } + + if( sortedPorts[ i ].Name.Equals( RefractionStr ) ) + { + hasRefraction = true; + } + + if( sortedPorts[ i ].Name.Equals( AlphaStr ) ) + { + hasOpacity = true; + } + + if( sortedPorts[ i ].Name.Equals( DiscardStr ) ) + { + hasOpacityMask = true; + } + + if( hasRefraction ) + { + m_currentDataCollector.AddToInput( UniqueId, SurfaceInputs.SCREEN_POS ); + m_currentDataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); + + //not necessary, just being safe + m_currentDataCollector.DirtyNormal = true; + m_currentDataCollector.ForceNormal = true; + + if( m_grabOrder != 0 ) + { + m_currentDataCollector.AddGrabPass( "RefractionGrab" + m_grabOrder ); + m_currentDataCollector.AddToUniforms( UniqueId, "uniform sampler2D RefractionGrab" + m_grabOrder + ";" ); + } + else + { + m_currentDataCollector.AddGrabPass( "" ); + m_currentDataCollector.AddToUniforms( UniqueId, "uniform sampler2D _GrabTexture;" ); + } + + if( !m_inlineChromaticAberration.Active ) + { + m_currentDataCollector.AddToUniforms( UniqueId, "uniform float _ChromaticAberration;" ); + + m_currentDataCollector.AddToProperties( UniqueId, "[Header(Refraction)]", m_refractionReorder.OrderIndex ); + m_currentDataCollector.AddToProperties( UniqueId, "_ChromaticAberration(\"Chromatic Aberration\", Range( 0 , 0.3)) = 0.1", m_refractionReorder.OrderIndex + 1 ); + } + + m_currentDataCollector.AddToPragmas( UniqueId, "multi_compile _ALPHAPREMULTIPLY_ON" ); + } + + if( hasTranslucency || hasTransmission ) + { + //Translucency and Transmission Generation + + //Add properties and uniforms + m_currentDataCollector.AddToIncludes( UniqueId, Constants.UnityPBSLightingLib ); + + if( hasTranslucency ) + { + m_currentDataCollector.AddToProperties( UniqueId, "[Header(Translucency)]", m_translucencyReorder.OrderIndex ); + m_currentDataCollector.AddToProperties( UniqueId, "_Translucency(\"Strength\", Range( 0 , 50)) = 1", m_translucencyReorder.OrderIndex + 1 ); + m_currentDataCollector.AddToProperties( UniqueId, "_TransNormalDistortion(\"Normal Distortion\", Range( 0 , 1)) = 0.1", m_translucencyReorder.OrderIndex + 2 ); + m_currentDataCollector.AddToProperties( UniqueId, "_TransScattering(\"Scaterring Falloff\", Range( 1 , 50)) = 2", m_translucencyReorder.OrderIndex + 3 ); + m_currentDataCollector.AddToProperties( UniqueId, "_TransDirect(\"Direct\", Range( 0 , 1)) = 1", m_translucencyReorder.OrderIndex + 4 ); + m_currentDataCollector.AddToProperties( UniqueId, "_TransAmbient(\"Ambient\", Range( 0 , 1)) = 0.2", m_translucencyReorder.OrderIndex + 5 ); + m_currentDataCollector.AddToProperties( UniqueId, "_TransShadow(\"Shadow\", Range( 0 , 1)) = 0.9", m_translucencyReorder.OrderIndex + 6 ); + + m_currentDataCollector.AddToUniforms( UniqueId, "uniform half _Translucency;" ); + m_currentDataCollector.AddToUniforms( UniqueId, "uniform half _TransNormalDistortion;" ); + m_currentDataCollector.AddToUniforms( UniqueId, "uniform half _TransScattering;" ); + m_currentDataCollector.AddToUniforms( UniqueId, "uniform half _TransDirect;" ); + m_currentDataCollector.AddToUniforms( UniqueId, "uniform half _TransAmbient;" ); + m_currentDataCollector.AddToUniforms( UniqueId, "uniform half _TransShadow;" ); + } + + //Add custom struct + switch( m_currentLightModel ) + { + case StandardShaderLightModel.Standard: + case StandardShaderLightModel.StandardSpecular: + outputStruct = "SurfaceOutput" + m_currentLightModel.ToString() + Constants.CustomLightStructStr; break; + } + + m_currentDataCollector.ChangeCustomInputHeader( m_currentLightModel.ToString() + Constants.CustomLightStructStr ); + m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Albedo", true ); + m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Normal", true ); + m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Emission", true ); + switch( m_currentLightModel ) + { + case StandardShaderLightModel.Standard: + m_currentDataCollector.AddToCustomInput( UniqueId, "half Metallic", true ); + break; + case StandardShaderLightModel.StandardSpecular: + m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Specular", true ); + break; + } + m_currentDataCollector.AddToCustomInput( UniqueId, "half Smoothness", true ); + m_currentDataCollector.AddToCustomInput( UniqueId, "half Occlusion", true ); + m_currentDataCollector.AddToCustomInput( UniqueId, "half Alpha", true ); + if( hasTranslucency ) + m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Translucency", true ); + + if( hasTransmission ) + m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Transmission", true ); + } + + if( sortedPorts[ i ].Name.Equals( DiscardStr ) ) + { + //Discard Op Node + if( m_currentLightModel == StandardShaderLightModel.CustomLighting ) + { + hasCustomLightingMask = true; + m_currentDataCollector.UsingCustomOutput = true; + m_currentDataCollector.GenType = PortGenType.CustomLighting; + WireReference connection = sortedPorts[ i ].GetConnection(); + ParentNode node = UIUtils.GetNode( connection.NodeId ); + + customLightingMaskCode = node.GetValueFromOutputStr( connection.PortId, WirePortDataType.FLOAT, ref m_currentDataCollector, false ); + customLightingMaskCode = "clip( " + customLightingMaskCode + " - " + m_inlineOpacityMaskClipValue.GetValueOrProperty( IOUtils.MaskClipValueName, false ) + " )"; + customLightingInstructions = m_currentDataCollector.CustomOutput; + + m_currentDataCollector.GenType = PortGenType.NonCustomLighting; + m_currentDataCollector.UsingCustomOutput = false; + continue; + } + else + { + string clipIn = "\t\t\tclip( "; + string clipOut = " - " + m_inlineOpacityMaskClipValue.GetValueOrProperty( IOUtils.MaskClipValueName, false ) + " );\n"; + //if( ( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) && m_castShadows ) + //{ + // clipIn = "\t\t\t#if UNITY_PASS_SHADOWCASTER\n" + clipIn; + // clipOut = clipOut + "\t\t\t#endif\n"; + //} + CreateInstructionsForPort( sortedPorts[ i ], Constants.OutputVarStr + "." + sortedPorts[ i ].DataName, true, clipIn, clipOut, false, normalIsConnected ); + } + } + else if( sortedPorts[ i ].DataName.Equals( VertexDataStr ) ) + { + string vertexInstructions = CreateInstructionsForVertexPort( sortedPorts[ i ] ); + m_currentDataCollector.AddToVertexDisplacement( vertexInstructions, m_vertexMode ); + } + else if( sortedPorts[ i ].DataName.Equals( VertexNormalStr ) ) + { + string vertexInstructions = CreateInstructionsForVertexPort( sortedPorts[ i ] ); + m_currentDataCollector.AddToVertexNormal( vertexInstructions ); + } + else if ( sortedPorts[ i ].DataName.Equals( VertexTangentStr ) ) + { + string vertexInstructions = CreateInstructionsForVertexPort( sortedPorts[ i ] ); + m_currentDataCollector.AddToVertexTangent( vertexInstructions ); + } + else if( m_tessOpHelper.IsTessellationPort( sortedPorts[ i ].PortId ) && sortedPorts[ i ].IsConnected /* && m_tessOpHelper.EnableTesselation*/) + { + //Vertex displacement and per vertex custom data + WireReference connection = sortedPorts[ i ].GetConnection(); + ParentNode node = UIUtils.GetNode( connection.NodeId ); + + string vertexInstructions = node.GetValueFromOutputStr( connection.PortId, sortedPorts[ i ].DataType, ref m_currentDataCollector, false ); + + if( m_currentDataCollector.DirtySpecialLocalVariables ) + { + m_tessOpHelper.AddAdditionalData( m_currentDataCollector.SpecialLocalVariables ); + m_currentDataCollector.ClearSpecialLocalVariables(); + } + + if( m_currentDataCollector.DirtyVertexVariables ) + { + m_tessOpHelper.AddAdditionalData( m_currentDataCollector.VertexLocalVariables ); + m_currentDataCollector.ClearVertexLocalVariables(); + } + + m_tessOpHelper.AddCustomFunction( vertexInstructions ); + } + else if( sortedPorts[ i ].Name.Equals( RefractionStr ) ) + { + ContainerGraph.ResetNodesLocalVariables(); + m_currentDataCollector.UsingCustomOutput = true; + + refractionFix = " + 0.00001 * i.screenPos * i.worldPos"; + m_currentDataCollector.AddInstructions( "\t\t\to.Normal = o.Normal" + refractionFix + ";\n" ); + refractionCode = CreateInstructionStringForPort( sortedPorts[ i ], false ); + refractionInstructions = m_currentDataCollector.CustomOutput; + + m_currentDataCollector.UsingCustomOutput = false; + } + else if( sortedPorts[ i ].Name.Equals( CustomLightingStr ) ) + { + m_currentDataCollector.UsingCustomOutput = true; + WireReference connection = sortedPorts[ i ].GetConnection(); + ParentNode node = UIUtils.GetNode( connection.NodeId ); + + customLightingCode = node.GetValueFromOutputStr( connection.PortId, WirePortDataType.FLOAT3, ref m_currentDataCollector, false ); + customLightingInstructions = m_currentDataCollector.CustomOutput; + + if( m_currentDataCollector.ForceNormal ) + { + m_currentDataCollector.AddToStartInstructions( "\t\t\t" + Constants.OutputVarStr + ".Normal = float3(0,0,1);\n" ); + m_currentDataCollector.DirtyNormal = true; + m_currentDataCollector.ForceNormal = false; + } + + if( m_currentDataCollector.DirtyVertexVariables ) + { + m_currentDataCollector.AddVertexInstruction( m_currentDataCollector.VertexLocalVariables, UniqueId, false ); + m_currentDataCollector.ClearVertexLocalVariables(); + } + + m_currentDataCollector.UsingCustomOutput = false; + + } + else if( sortedPorts[ i ].Name.Equals( AlphaStr ) && m_currentLightModel == StandardShaderLightModel.CustomLighting ) + { + m_currentDataCollector.UsingCustomOutput = true; + m_currentDataCollector.GenType = PortGenType.CustomLighting; + + WireReference connection = sortedPorts[ i ].GetConnection(); + ParentNode node = UIUtils.GetNode( connection.NodeId ); + + customLightingAlphaCode = node.GetValueFromOutputStr( connection.PortId, WirePortDataType.FLOAT, ref m_currentDataCollector, false ); + customLightingInstructions = m_currentDataCollector.CustomOutput; + + if( m_currentDataCollector.ForceNormal ) + { + m_currentDataCollector.AddToStartInstructions( "\t\t\t" + Constants.OutputVarStr + ".Normal = float3(0,0,1);\n" ); + m_currentDataCollector.DirtyNormal = true; + m_currentDataCollector.ForceNormal = false; + } + + if( m_currentDataCollector.DirtyVertexVariables ) + { + m_currentDataCollector.AddVertexInstruction( m_currentDataCollector.VertexLocalVariables, UniqueId, false ); + m_currentDataCollector.ClearVertexLocalVariables(); + } + + m_currentDataCollector.GenType = PortGenType.NonCustomLighting; + m_currentDataCollector.UsingCustomOutput = false; + } + else + { + // Surface shader instruccions + // if working on normals and have normal dependent node then ignore local var generation + CreateInstructionsForPort( sortedPorts[ i ], Constants.OutputVarStr + "." + sortedPorts[ i ].DataName, false, null, null, false, normalIsConnected ); + } + } + else if( sortedPorts[ i ].Name.Equals( AlphaStr ) ) + { + if( m_currentLightModel != StandardShaderLightModel.CustomLighting ) + { + m_currentDataCollector.AddInstructions( string.Format( "\t\t\t{0}.{1} = 1;\n", Constants.OutputVarStr, sortedPorts[ i ].DataName ) ); + } + } + } + + m_billboardOpHelper.FillDataCollectorWithInternalData( ref m_currentDataCollector ); + } + + m_customShadowCaster = CustomShadowCaster; + + //if( !m_renderingOptionsOpHelper.UseDefaultShadowCaster && + // ( ( m_castShadows && ( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) ) || + // ( m_castShadows && hasOpacity ) || + // ( m_castShadows && ( m_currentDataCollector.UsingWorldNormal || m_currentDataCollector.UsingWorldReflection || m_currentDataCollector.UsingViewDirection ) ) || + // ( m_castShadows && m_inputPorts[ m_discardPortId ].Available && m_inputPorts[ m_discardPortId ].IsConnected && m_currentLightModel == StandardShaderLightModel.CustomLighting ) )) + // m_customShadowCaster = true; + //else + // m_customShadowCaster = false; + + //m_customShadowCaster = true; + + for( int i = 0; i < 4; i++ ) + { + if( m_currentDataCollector.GetChannelUsage( i ) == TextureChannelUsage.Required ) + { + string channelName = UIUtils.GetChannelName( i ); + m_currentDataCollector.AddToProperties( -1, UIUtils.GetTex2DProperty( channelName, TexturePropertyValues.white ), -1 ); + } + } + + m_currentDataCollector.AddToProperties( -1, IOUtils.DefaultASEDirtyCheckProperty, 10000 ); + if( m_inputPorts[ m_discardPortId ].Available && m_inputPorts[ m_discardPortId ].IsConnected ) + { + if( m_inlineOpacityMaskClipValue.IsValid ) + { + RangedFloatNode fnode = UIUtils.GetNode( m_inlineOpacityMaskClipValue.NodeId ) as RangedFloatNode; + if( fnode != null ) + { + m_currentDataCollector.AddToProperties( fnode.UniqueId, fnode.GetPropertyValue(), fnode.OrderIndex ); + m_currentDataCollector.AddToUniforms( fnode.UniqueId, fnode.GetUniformValue() ); + } + else + { + IntNode inode = UIUtils.GetNode( m_inlineOpacityMaskClipValue.NodeId ) as IntNode; + m_currentDataCollector.AddToProperties( inode.UniqueId, inode.GetPropertyValue(), inode.OrderIndex ); + m_currentDataCollector.AddToUniforms( inode.UniqueId, inode.GetUniformValue() ); + } + } + else + { + m_currentDataCollector.AddToProperties( -1, string.Format( IOUtils.MaskClipValueProperty, OpacityMaskClipValueStr, m_opacityMaskClipValue ), ( m_maskClipReorder != null ) ? m_maskClipReorder.OrderIndex : -1 ); + m_currentDataCollector.AddToUniforms( -1, string.Format( IOUtils.MaskClipValueUniform, m_opacityMaskClipValue ) ); + } + } + + if( !m_currentDataCollector.DirtyInputs ) + m_currentDataCollector.AddToInput( UniqueId, "half filler", true ); + + if( m_currentLightModel == StandardShaderLightModel.BlinnPhong ) + m_currentDataCollector.AddToProperties( -1, "_SpecColor(\"Specular Color\",Color)=(1,1,1,1)", m_specColorReorder.OrderIndex ); + + //Tesselation + if( m_tessOpHelper.EnableTesselation ) + { + m_tessOpHelper.AddToDataCollector( ref m_currentDataCollector, m_tessellationReorder != null ? m_tessellationReorder.OrderIndex : -1 ); + if( !m_currentDataCollector.DirtyPerVertexData ) + { + m_currentDataCollector.OpenPerVertexHeader( false ); + } + } + + + if( m_outlineHelper.EnableOutline || ( m_currentDataCollector.UsingCustomOutlineColor || m_currentDataCollector.CustomOutlineSelectedAlpha > 0 || m_currentDataCollector.UsingCustomOutlineWidth ) ) + { + m_outlineHelper.AddToDataCollector( ref m_currentDataCollector ); + } + + //m_additionalIncludes.AddToDataCollector( ref m_currentDataCollector ); + //m_additionalPragmas.AddToDataCollector( ref m_currentDataCollector ); + //m_additionalDefines.AddToDataCollector( ref m_currentDataCollector ); + m_additionalDirectives.AddAllToDataCollector( ref m_currentDataCollector ); + + //m_currentDataCollector.CloseInputs(); + m_currentDataCollector.CloseCustomInputs(); + m_currentDataCollector.CloseProperties(); + m_currentDataCollector.ClosePerVertexHeader(); + + //build Shader Body + string ShaderBody = string.Empty; + OpenShaderBody( ref ShaderBody, m_shaderName ); + { + //set properties + if( m_currentDataCollector.DirtyProperties ) + { + ShaderBody += m_currentDataCollector.BuildPropertiesString(); + } + //set subshader + OpenSubShaderBody( ref ShaderBody ); + { + + // Add extra depth pass + m_zBufferHelper.DrawExtraDepthPass( ref ShaderBody ); + + // Add optionalPasses + if( m_outlineHelper.EnableOutline || ( m_currentDataCollector.UsingCustomOutlineColor || m_currentDataCollector.CustomOutlineSelectedAlpha > 0 || m_currentDataCollector.UsingCustomOutlineWidth ) ) + { + if( !usingDebugPort ) + AddMultilineBody( ref ShaderBody, m_outlineHelper.OutlineFunctionBody( ref m_currentDataCollector, isInstancedShader, m_customShadowCaster, UIUtils.RemoveInvalidCharacters( ShaderName ), ( m_billboardOpHelper.IsBillboard && !usingDebugPort ? m_billboardOpHelper.GetInternalMultilineInstructions() : null ), ref m_tessOpHelper, ShaderModelTypeArr[ m_shaderModelIdx ], CurrentPrecisionType ) ); + } + + //Add SubShader tags + if( hasEmission ) + { + tags += " \"IsEmissive\" = \"true\" "; + } + + tags += m_customTagsHelper.GenerateCustomTags(); + + tags = "Tags{ " + tags + " }"; + m_usePass.BuildUsePassInfo( m_currentDataCollector, ref aboveUsePasses, ref bellowUsePasses, "\t\t" ); + if( !string.IsNullOrEmpty( aboveUsePasses ) ) + { + ShaderBody += aboveUsePasses; + } + + AddRenderTags( ref ShaderBody, tags ); + AddShaderLOD( ref ShaderBody, ShaderLOD ); + AddRenderState( ref ShaderBody, "Cull", m_inlineCullMode.GetValueOrProperty( m_cullMode.ToString() ) ); + m_customBlendAvailable = ( m_alphaMode == AlphaMode.Custom || m_alphaMode == AlphaMode.Opaque ); + if( ( m_zBufferHelper.IsActive && m_customBlendAvailable ) || m_outlineHelper.UsingZWrite || m_outlineHelper.UsingZTest ) + { + ShaderBody += m_zBufferHelper.CreateDepthInfo( m_outlineHelper.UsingZWrite, m_outlineHelper.UsingZTest ); + } + if( m_stencilBufferHelper.Active ) + { + ShaderBody += m_stencilBufferHelper.CreateStencilOp( this ); + } + + if( m_blendOpsHelper.Active ) + { + ShaderBody += m_blendOpsHelper.CreateBlendOps(); + } + + if( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) + { + ShaderBody += "\t\tAlphaToMask "+ m_inlineAlphaToCoverage.GetValueOrProperty( "On" )+"\n"; + } + + // Build Color Mask + bool forceDefault = m_outlineHelper.ActiveColorMask; + m_colorMaskHelper.BuildColorMask( ref ShaderBody, m_customBlendAvailable, forceDefault ); + + //ShaderBody += "\t\tZWrite " + _zWriteMode + '\n'; + //ShaderBody += "\t\tZTest " + _zTestMode + '\n'; + + //Add GrabPass + if( m_currentDataCollector.DirtyGrabPass ) + { + ShaderBody += m_currentDataCollector.GrabPass; + } + + // build optional parameters + string OptionalParameters = string.Empty; + + // addword standard to custom lighting to accepts standard lighting models + string standardCustomLighting = string.Empty; + if( m_currentLightModel == StandardShaderLightModel.CustomLighting ) + standardCustomLighting = "Standard"; + + //add cg program + if( m_customShadowCaster ) + OpenCGInclude( ref ShaderBody ); + else + OpenCGProgram( ref ShaderBody ); + { + //Add Defines + if( m_currentDataCollector.DirtyDefines ) + ShaderBody += m_currentDataCollector.Defines; + + //Add Includes + if( m_customShadowCaster ) + { + m_currentDataCollector.AddToIncludes( UniqueId, Constants.UnityPBSLightingLib ); + m_currentDataCollector.AddToIncludes( UniqueId, "Lighting.cginc" ); + } + if( m_currentDataCollector.DirtyIncludes ) + ShaderBody += m_currentDataCollector.Includes; + + //define as surface shader and specify lighting model + if( UIUtils.GetTextureArrayNodeAmount() > 0 && m_shaderModelIdx < 3 ) + { + UIUtils.ShowMessage( "Automatically changing Shader Model to 3.5 since\nit's the minimum required by texture arrays." ); + m_shaderModelIdx = 3; + } + + // if tessellation is active then we need be at least using shader model 4.6 + if( m_tessOpHelper.EnableTesselation && m_shaderModelIdx < 6 ) + { + UIUtils.ShowMessage( "Automatically changing Shader Model to 4.6 since\nit's the minimum required by tessellation." ); + m_shaderModelIdx = 6; + } + + // if translucency is ON change render path + if( hasTranslucency && m_renderPath != RenderPath.ForwardOnly ) + { + UIUtils.ShowMessage( "Automatically changing Render Path to Forward Only since\ntranslucency only works in forward rendering." ); + m_renderPath = RenderPath.ForwardOnly; + } + + // if outline is ON change render path + if( m_outlineHelper.EnableOutline && m_renderPath != RenderPath.ForwardOnly ) + { + UIUtils.ShowMessage( "Automatically changing Render Path to Forward Only since\noutline only works in forward rendering." ); + m_renderPath = RenderPath.ForwardOnly; + } + + // if transmission is ON change render path + if( hasTransmission && m_renderPath != RenderPath.ForwardOnly ) + { + UIUtils.ShowMessage( "Automatically changing Render Path to Forward Only since\ntransmission only works in forward rendering." ); + m_renderPath = RenderPath.ForwardOnly; + } + + // if refraction is ON change render path + if( hasRefraction && m_renderPath != RenderPath.ForwardOnly ) + { + UIUtils.ShowMessage( "Automatically changing Render Path to Forward Only since\nrefraction only works in forward rendering." ); + m_renderPath = RenderPath.ForwardOnly; + } + + ShaderBody += string.Format( IOUtils.PragmaTargetHeader, ShaderModelTypeArr[ m_shaderModelIdx ] ); + + + //Add pragmas (needs check to see if all pragmas work with custom shadow caster) + if( m_currentDataCollector.DirtyPragmas/* && !m_customShadowCaster */) + ShaderBody += m_currentDataCollector.Pragmas; + + CheckSamplingMacrosFlag(); + m_currentDataCollector.AddASEMacros(); + if( m_currentDataCollector.DirtyAdditionalDirectives ) + ShaderBody += m_currentDataCollector.StandardAdditionalDirectives; + + //if ( !m_customBlendMode ) + { + switch( m_alphaMode ) + { + case AlphaMode.Opaque: + case AlphaMode.Masked: break; + case AlphaMode.Transparent: + { + OptionalParameters += "alpha:fade" + Constants.OptionalParametersSep; + } + break; + case AlphaMode.Premultiply: + { + OptionalParameters += "alpha:premul" + Constants.OptionalParametersSep; + } + break; + } + } + + if( m_keepAlpha ) + { + OptionalParameters += "keepalpha" + Constants.OptionalParametersSep; + } + + if( hasRefraction ) + { + OptionalParameters += "finalcolor:RefractionF" + Constants.OptionalParametersSep; + } + + if( !m_customShadowCaster && m_castShadows ) + { + OptionalParameters += "addshadow" + Constants.OptionalParametersSep; + } + + if( m_castShadows ) + { + OptionalParameters += "fullforwardshadows" + Constants.OptionalParametersSep; + } + + if( !m_receiveShadows ) + { + OptionalParameters += "noshadow" + Constants.OptionalParametersSep; + } + + if( m_renderingOptionsOpHelper.IsOptionActive( " Add Pass" ) && usingDebugPort ) + { + OptionalParameters += "noforwardadd" + Constants.OptionalParametersSep; + } + + if( m_renderingOptionsOpHelper.ForceDisableInstancing ) + { + OptionalParameters += "noinstancing" + Constants.OptionalParametersSep; + } + + switch( m_renderPath ) + { + case RenderPath.All: break; + case RenderPath.DeferredOnly: OptionalParameters += "exclude_path:forward" + Constants.OptionalParametersSep; break; + case RenderPath.ForwardOnly: OptionalParameters += "exclude_path:deferred" + Constants.OptionalParametersSep; break; + } + + //Add code generation options + m_renderingOptionsOpHelper.Build( ref OptionalParameters ); + + if( !m_customShadowCaster ) + { + string customLightSurface = string.Empty; + if( hasTranslucency || hasTransmission ) + customLightSurface = "Custom"; + m_renderingPlatformOpHelper.SetRenderingPlatforms( ref ShaderBody ); + + //Check if Custom Vertex is being used and add tag + if( m_currentDataCollector.DirtyPerVertexData ) + OptionalParameters += "vertex:" + Constants.VertexDataFunc + Constants.OptionalParametersSep; + + if( m_tessOpHelper.EnableTesselation && !usingDebugPort ) + { + m_tessOpHelper.WriteToOptionalParams( ref OptionalParameters ); + } + + m_additionalSurfaceOptions.WriteToOptionalSurfaceOptions( ref OptionalParameters ); + + AddShaderPragma( ref ShaderBody, "surface surf " + standardCustomLighting + m_currentLightModel.ToString() + customLightSurface + Constants.OptionalParametersSep + OptionalParameters ); + } + else + { + if( /*m_currentDataCollector.UsingWorldNormal ||*/ m_currentDataCollector.UsingInternalData ) + { + ShaderBody += "\t\t#ifdef UNITY_PASS_SHADOWCASTER\n"; + ShaderBody += "\t\t\t#undef INTERNAL_DATA\n"; + ShaderBody += "\t\t\t#undef WorldReflectionVector\n"; + ShaderBody += "\t\t\t#undef WorldNormalVector\n"; + ShaderBody += "\t\t\t#define INTERNAL_DATA half3 internalSurfaceTtoW0; half3 internalSurfaceTtoW1; half3 internalSurfaceTtoW2;\n"; + ShaderBody += "\t\t\t#define WorldReflectionVector(data,normal) reflect (data.worldRefl, half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal)))\n"; + ShaderBody += "\t\t\t#define WorldNormalVector(data,normal) half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))\n"; + ShaderBody += "\t\t#endif\n"; + } + } + + if( m_currentDataCollector.UsingHigherSizeTexcoords ) + { + ShaderBody += "\t\t#undef TRANSFORM_TEX\n"; + ShaderBody += "\t\t#define TRANSFORM_TEX(tex,name) float4(tex.xy * name##_ST.xy + name##_ST.zw, tex.z, tex.w)\n"; + } + + if( m_currentDataCollector.DirtyAppData ) + ShaderBody += m_currentDataCollector.CustomAppData; + + // Add Input struct + if( m_currentDataCollector.DirtyInputs ) + ShaderBody += "\t\t" + m_currentDataCollector.Inputs + "\t\t};" + "\n\n"; + + // Add Custom Lighting struct + if( m_currentDataCollector.DirtyCustomInput ) + ShaderBody += m_currentDataCollector.CustomInput + "\n\n"; + + //Add Uniforms + if( m_currentDataCollector.DirtyUniforms ) + ShaderBody += m_currentDataCollector.Uniforms + "\n"; + + // Add Array Derivatives Macros + //if( m_currentDataCollector.UsingArrayDerivatives ) + //{ + // ShaderBody += "\t\t#if defined(UNITY_COMPILER_HLSL2GLSL) || defined(SHADER_TARGET_SURFACE_ANALYSIS)\n"; + // ShaderBody += "\t\t\t#define ASE_SAMPLE_TEX2DARRAY_GRAD(tex,coord,dx,dy) UNITY_SAMPLE_TEX2DARRAY (tex,coord)\n"; + // ShaderBody += "\t\t#else\n"; + // ShaderBody += "\t\t\t#define ASE_SAMPLE_TEX2DARRAY_GRAD(tex,coord,dx,dy) tex.SampleGrad (sampler##tex,coord,dx,dy)\n"; + // ShaderBody += "\t\t#endif\n\n"; + //} + + //Add Instanced Properties + if( isInstancedShader && m_currentDataCollector.DirtyInstancedProperties ) + { + m_currentDataCollector.SetupInstancePropertiesBlock( UIUtils.RemoveInvalidCharacters( ShaderName ) ); + ShaderBody += m_currentDataCollector.InstancedProperties + "\n"; + } + + if( m_currentDataCollector.DirtyFunctions ) + ShaderBody += m_currentDataCollector.Functions + "\n"; + + + //Tesselation + if( m_tessOpHelper.EnableTesselation && !usingDebugPort ) + { + ShaderBody += m_tessOpHelper.GetCurrentTessellationFunction( ref m_currentDataCollector ) + "\n"; + } + + //Add Custom Vertex Data + if( m_currentDataCollector.DirtyPerVertexData ) + { + ShaderBody += m_currentDataCollector.VertexData; + } + + if( m_currentLightModel == StandardShaderLightModel.Unlit ) + { + for( int i = 0; i < VertexLitFunc.Length; i++ ) + { + ShaderBody += VertexLitFunc[ i ] + "\n"; + } + } + + //Add custom lighting + if( m_currentLightModel == StandardShaderLightModel.CustomLighting ) + { + ShaderBody += "\t\tinline half4 LightingStandard" + m_currentLightModel.ToString() + "( inout " + outputStruct + " " + Constants.CustomLightOutputVarStr + ", half3 viewDir, UnityGI gi )\n\t\t{\n"; + ShaderBody += "\t\t\tUnityGIInput data = s.GIData;\n"; + ShaderBody += "\t\t\tInput i = s.SurfInput;\n"; + ShaderBody += "\t\t\thalf4 c = 0;\n"; + if( m_currentDataCollector.UsingLightAttenuation ) + { + ShaderBody += "\t\t\t#ifdef UNITY_PASS_FORWARDBASE\n"; + ShaderBody += "\t\t\tfloat ase_lightAtten = data.atten;\n"; + ShaderBody += "\t\t\tif( _LightColor0.a == 0)\n"; + ShaderBody += "\t\t\tase_lightAtten = 0;\n"; + ShaderBody += "\t\t\t#else\n"; + ShaderBody += "\t\t\tfloat3 ase_lightAttenRGB = gi.light.color / ( ( _LightColor0.rgb ) + 0.000001 );\n"; + ShaderBody += "\t\t\tfloat ase_lightAtten = max( max( ase_lightAttenRGB.r, ase_lightAttenRGB.g ), ase_lightAttenRGB.b );\n"; + ShaderBody += "\t\t\t#endif\n"; + + ShaderBody += "\t\t\t#if defined(HANDLE_SHADOWS_BLENDING_IN_GI)\n"; + ShaderBody += "\t\t\thalf bakedAtten = UnitySampleBakedOcclusion(data.lightmapUV.xy, data.worldPos);\n"; + ShaderBody += "\t\t\tfloat zDist = dot(_WorldSpaceCameraPos - data.worldPos, UNITY_MATRIX_V[2].xyz);\n"; + ShaderBody += "\t\t\tfloat fadeDist = UnityComputeShadowFadeDistance(data.worldPos, zDist);\n"; + ShaderBody += "\t\t\tase_lightAtten = UnityMixRealtimeAndBakedShadows(data.atten, bakedAtten, UnityComputeShadowFade(fadeDist));\n"; + ShaderBody += "\t\t\t#endif\n"; + } + + //if( m_currentDataCollector.dirtyc ) + ShaderBody += customLightingInstructions; + ShaderBody += "\t\t\tc.rgb = " + ( !string.IsNullOrEmpty( customLightingCode ) ? customLightingCode : "0" ) + ";\n"; + ShaderBody += "\t\t\tc.a = " + ( !string.IsNullOrEmpty( customLightingAlphaCode ) ? customLightingAlphaCode : "1" ) + ";\n"; + if( m_alphaMode == AlphaMode.Premultiply || ( ( m_alphaMode == AlphaMode.Custom || m_alphaMode == AlphaMode.Opaque ) && m_blendOpsHelper.CurrentBlendRGB.IndexOf( "Premultiplied" ) > -1 ) ) + ShaderBody += "\t\t\tc.rgb *= c.a;\n"; + if( hasCustomLightingMask ) + ShaderBody += "\t\t\t" + customLightingMaskCode + ";\n"; + ShaderBody += "\t\t\treturn c;\n"; + ShaderBody += "\t\t}\n\n"; + + //Add GI function + ShaderBody += "\t\tinline void LightingStandard" + m_currentLightModel.ToString() + "_GI( inout " + outputStruct + " " + Constants.CustomLightOutputVarStr + ", UnityGIInput data, inout UnityGI gi )\n\t\t{\n"; + ShaderBody += "\t\t\ts.GIData = data;\n"; + //ShaderBody += "\t\t\tUNITY_GI(gi, " + Constants.CustomLightOutputVarStr + ", data);\n"; + ShaderBody += "\t\t}\n\n"; + } + + //Add custom lighting function + if( hasTranslucency || hasTransmission ) + { + ShaderBody += "\t\tinline half4 Lighting" + m_currentLightModel.ToString() + Constants.CustomLightStructStr + "(" + outputStruct + " " + Constants.CustomLightOutputVarStr + ", half3 viewDir, UnityGI gi )\n\t\t{\n"; + if( hasTranslucency ) + { + //ShaderBody += "\t\t\t#if !DIRECTIONAL\n"; + ShaderBody += "\t\t\t#if !defined(DIRECTIONAL)\n"; + ShaderBody += "\t\t\tfloat3 lightAtten = gi.light.color;\n"; + ShaderBody += "\t\t\t#else\n"; + ShaderBody += "\t\t\tfloat3 lightAtten = lerp( _LightColor0.rgb, gi.light.color, _TransShadow );\n"; + ShaderBody += "\t\t\t#endif\n"; + ShaderBody += "\t\t\thalf3 lightDir = gi.light.dir + " + Constants.CustomLightOutputVarStr + ".Normal * _TransNormalDistortion;\n"; + ShaderBody += "\t\t\thalf transVdotL = pow( saturate( dot( viewDir, -lightDir ) ), _TransScattering );\n"; + ShaderBody += "\t\t\thalf3 translucency = lightAtten * (transVdotL * _TransDirect + gi.indirect.diffuse * _TransAmbient) * " + Constants.CustomLightOutputVarStr + ".Translucency;\n"; + ShaderBody += "\t\t\thalf4 c = half4( " + Constants.CustomLightOutputVarStr + ".Albedo * translucency * _Translucency, 0 );\n\n"; + } + + if( hasTransmission ) + { + ShaderBody += "\t\t\thalf3 transmission = max(0 , -dot(" + Constants.CustomLightOutputVarStr + ".Normal, gi.light.dir)) * gi.light.color * " + Constants.CustomLightOutputVarStr + ".Transmission;\n"; + ShaderBody += "\t\t\thalf4 d = half4(" + Constants.CustomLightOutputVarStr + ".Albedo * transmission , 0);\n\n"; + } + + ShaderBody += "\t\t\tSurfaceOutput" + m_currentLightModel.ToString() + " r;\n"; + ShaderBody += "\t\t\tr.Albedo = " + Constants.CustomLightOutputVarStr + ".Albedo;\n"; + ShaderBody += "\t\t\tr.Normal = " + Constants.CustomLightOutputVarStr + ".Normal;\n"; + ShaderBody += "\t\t\tr.Emission = " + Constants.CustomLightOutputVarStr + ".Emission;\n"; + switch( m_currentLightModel ) + { + case StandardShaderLightModel.Standard: + ShaderBody += "\t\t\tr.Metallic = " + Constants.CustomLightOutputVarStr + ".Metallic;\n"; + break; + case StandardShaderLightModel.StandardSpecular: + ShaderBody += "\t\t\tr.Specular = " + Constants.CustomLightOutputVarStr + ".Specular;\n"; + break; + } + ShaderBody += "\t\t\tr.Smoothness = " + Constants.CustomLightOutputVarStr + ".Smoothness;\n"; + ShaderBody += "\t\t\tr.Occlusion = " + Constants.CustomLightOutputVarStr + ".Occlusion;\n"; + ShaderBody += "\t\t\tr.Alpha = " + Constants.CustomLightOutputVarStr + ".Alpha;\n"; + ShaderBody += "\t\t\treturn Lighting" + m_currentLightModel.ToString() + " (r, viewDir, gi)" + ( hasTranslucency ? " + c" : "" ) + ( hasTransmission ? " + d" : "" ) + ";\n"; + ShaderBody += "\t\t}\n\n"; + + //Add GI function + ShaderBody += "\t\tinline void Lighting" + m_currentLightModel.ToString() + Constants.CustomLightStructStr + "_GI(" + outputStruct + " " + Constants.CustomLightOutputVarStr + ", UnityGIInput data, inout UnityGI gi )\n\t\t{\n"; + + ShaderBody += "\t\t\t#if defined(UNITY_PASS_DEFERRED) && UNITY_ENABLE_REFLECTION_BUFFERS\n"; + ShaderBody += "\t\t\t\tgi = UnityGlobalIllumination(data, " + Constants.CustomLightOutputVarStr + ".Occlusion, " + Constants.CustomLightOutputVarStr + ".Normal);\n"; + ShaderBody += "\t\t\t#else\n"; + ShaderBody += "\t\t\t\tUNITY_GLOSSY_ENV_FROM_SURFACE( g, " + Constants.CustomLightOutputVarStr + ", data );\n"; + ShaderBody += "\t\t\t\tgi = UnityGlobalIllumination( data, " + Constants.CustomLightOutputVarStr + ".Occlusion, " + Constants.CustomLightOutputVarStr + ".Normal, g );\n"; + ShaderBody += "\t\t\t#endif\n"; + + //ShaderBody += "\t\t\tUNITY_GI(gi, " + Constants.CustomLightOutputVarStr + ", data);\n"; + ShaderBody += "\t\t}\n\n"; + } + + if( hasRefraction ) + { + ShaderBody += "\t\tinline float4 Refraction( Input " + Constants.InputVarStr + ", " + outputStruct + " " + Constants.OutputVarStr + ", float indexOfRefraction, float chomaticAberration ) {\n"; + ShaderBody += "\t\t\tfloat3 worldNormal = " + Constants.OutputVarStr + ".Normal;\n"; + ShaderBody += "\t\t\tfloat4 screenPos = " + Constants.InputVarStr + ".screenPos;\n"; + ShaderBody += "\t\t\t#if UNITY_UV_STARTS_AT_TOP\n"; + ShaderBody += "\t\t\t\tfloat scale = -1.0;\n"; + ShaderBody += "\t\t\t#else\n"; + ShaderBody += "\t\t\t\tfloat scale = 1.0;\n"; + ShaderBody += "\t\t\t#endif\n"; + ShaderBody += "\t\t\tfloat halfPosW = screenPos.w * 0.5;\n"; + ShaderBody += "\t\t\tscreenPos.y = ( screenPos.y - halfPosW ) * _ProjectionParams.x * scale + halfPosW;\n"; + ShaderBody += "\t\t\t#if SHADER_API_D3D9 || SHADER_API_D3D11\n"; + ShaderBody += "\t\t\t\tscreenPos.w += 0.00000000001;\n"; + ShaderBody += "\t\t\t#endif\n"; + ShaderBody += "\t\t\tfloat2 projScreenPos = ( screenPos / screenPos.w ).xy;\n"; + ShaderBody += "\t\t\tfloat3 worldViewDir = normalize( UnityWorldSpaceViewDir( " + Constants.InputVarStr + ".worldPos ) );\n"; + ShaderBody += "\t\t\tfloat3 refractionOffset = ( indexOfRefraction - 1.0 ) * mul( UNITY_MATRIX_V, float4( worldNormal, 0.0 ) ) * ( 1.0 - dot( worldNormal, worldViewDir ) );\n"; + ShaderBody += "\t\t\tfloat2 cameraRefraction = float2( refractionOffset.x, refractionOffset.y );\n"; + + string grabpass = "_GrabTexture"; + if( m_grabOrder != 0 ) + grabpass = "RefractionGrab" + m_grabOrder; + ShaderBody += "\t\t\tfloat4 redAlpha = tex2D( " + grabpass + ", ( projScreenPos + cameraRefraction ) );\n"; + ShaderBody += "\t\t\tfloat green = tex2D( " + grabpass + ", ( projScreenPos + ( cameraRefraction * ( 1.0 - chomaticAberration ) ) ) ).g;\n"; + ShaderBody += "\t\t\tfloat blue = tex2D( " + grabpass + ", ( projScreenPos + ( cameraRefraction * ( 1.0 + chomaticAberration ) ) ) ).b;\n"; + ShaderBody += "\t\t\treturn float4( redAlpha.r, green, blue, redAlpha.a );\n"; + ShaderBody += "\t\t}\n\n"; + + ShaderBody += "\t\tvoid RefractionF( Input " + Constants.InputVarStr + ", " + outputStruct + " " + Constants.OutputVarStr + ", inout half4 color )\n"; + ShaderBody += "\t\t{\n"; + ShaderBody += "\t\t\t#ifdef UNITY_PASS_FORWARDBASE\n"; + ShaderBody += refractionInstructions; + if( m_inlineChromaticAberration.Active ) + { + ShaderBody += "\t\t\tcolor.rgb = color.rgb + Refraction( " + Constants.InputVarStr + ", " + Constants.OutputVarStr + ", " + refractionCode + ", " + m_inlineChromaticAberration.GetValueOrProperty(false) + " ) * ( 1 - color.a );\n"; + } + else + { + ShaderBody += "\t\t\tcolor.rgb = color.rgb + Refraction( " + Constants.InputVarStr + ", " + Constants.OutputVarStr + ", " + refractionCode + ", _ChromaticAberration ) * ( 1 - color.a );\n"; + } + ShaderBody += "\t\t\tcolor.a = 1;\n"; + ShaderBody += "\t\t\t#endif\n"; + ShaderBody += "\t\t}\n\n"; + } + + //Add Surface Shader body + ShaderBody += "\t\tvoid surf( Input " + Constants.InputVarStr + " , inout " + outputStruct + " " + Constants.OutputVarStr + " )\n\t\t{\n"; + { + // Pass input information to custom lighting function + if( m_currentLightModel == StandardShaderLightModel.CustomLighting ) + ShaderBody += "\t\t\t" + Constants.OutputVarStr + ".SurfInput = " + Constants.InputVarStr + ";\n"; + + //add local vars + if( m_currentDataCollector.DirtyLocalVariables ) + ShaderBody += m_currentDataCollector.LocalVariables; + + //add nodes ops + if( m_currentDataCollector.DirtyInstructions ) + ShaderBody += m_currentDataCollector.Instructions; + } + ShaderBody += "\t\t}\n"; + } + CloseCGProgram( ref ShaderBody ); + + + //Add custom Shadow Caster + if( m_customShadowCaster ) + { + OpenCGProgram( ref ShaderBody ); + string customLightSurface = hasTranslucency || hasTransmission ? "Custom" : ""; + m_renderingPlatformOpHelper.SetRenderingPlatforms( ref ShaderBody ); + + //Check if Custom Vertex is being used and add tag + if( m_currentDataCollector.DirtyPerVertexData ) + OptionalParameters += "vertex:" + Constants.VertexDataFunc + Constants.OptionalParametersSep; + + if( m_tessOpHelper.EnableTesselation && !usingDebugPort ) + { + m_tessOpHelper.WriteToOptionalParams( ref OptionalParameters ); + } + //if ( hasRefraction ) + // ShaderBody += "\t\t#pragma multi_compile _ALPHAPREMULTIPLY_ON\n"; + + m_additionalSurfaceOptions.WriteToOptionalSurfaceOptions( ref OptionalParameters ); + + AddShaderPragma( ref ShaderBody, "surface surf " + standardCustomLighting + m_currentLightModel.ToString() + customLightSurface + Constants.OptionalParametersSep + OptionalParameters ); + CloseCGProgram( ref ShaderBody ); + + ShaderBody += "\t\tPass\n"; + ShaderBody += "\t\t{\n"; + ShaderBody += "\t\t\tName \"ShadowCaster\"\n"; + ShaderBody += "\t\t\tTags{ \"LightMode\" = \"ShadowCaster\" }\n"; + ShaderBody += "\t\t\tZWrite On\n"; + if( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) + ShaderBody += "\t\t\tAlphaToMask Off\n"; + ShaderBody += "\t\t\tCGPROGRAM\n"; + ShaderBody += "\t\t\t#pragma vertex vert\n"; + ShaderBody += "\t\t\t#pragma fragment frag\n"; + ShaderBody += "\t\t\t#pragma target " + ShaderModelTypeArr[ m_shaderModelIdx ] + "\n"; + //ShaderBody += "\t\t\t#pragma multi_compile_instancing\n"; + ShaderBody += "\t\t\t#pragma multi_compile_shadowcaster\n"; + ShaderBody += "\t\t\t#pragma multi_compile UNITY_PASS_SHADOWCASTER\n"; + ShaderBody += "\t\t\t#pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2\n"; + ShaderBody += "\t\t\t#include \"HLSLSupport.cginc\"\n"; + //Preventing WebGL to throw error Duplicate system value semantic definition: input semantic 'SV_POSITION' and input semantic 'VPOS' + ShaderBody += "\t\t\t#if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )\n"; + ShaderBody += "\t\t\t\t#define CAN_SKIP_VPOS\n"; + ShaderBody += "\t\t\t#endif\n"; + ShaderBody += "\t\t\t#include \"UnityCG.cginc\"\n"; + ShaderBody += "\t\t\t#include \"Lighting.cginc\"\n"; + ShaderBody += "\t\t\t#include \"UnityPBSLighting.cginc\"\n"; + + if( !( ( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) && hasOpacity && hasOpacityMask ) ) + if( hasOpacity ) + ShaderBody += "\t\t\tsampler3D _DitherMaskLOD;\n"; + + //ShaderBody += "\t\t\tsampler3D _DitherMaskLOD;\n"; + + ShaderBody += "\t\t\tstruct v2f\n"; + ShaderBody += "\t\t\t{\n"; + ShaderBody += "\t\t\t\tV2F_SHADOW_CASTER;\n"; + int texcoordIndex = 1; + for( int i = 0; i < m_currentDataCollector.PackSlotsList.Count; i++ ) + { + int size = 4 - m_currentDataCollector.PackSlotsList[ i ]; + if( size > 0 ) + { + ShaderBody += "\t\t\t\tfloat" + size + " customPack" + ( i + 1 ) + " : TEXCOORD" + ( i + 1 ) + ";\n"; + } + texcoordIndex++; + } + + if( !m_currentDataCollector.UsingInternalData ) + ShaderBody += "\t\t\t\tfloat3 worldPos : TEXCOORD" + ( texcoordIndex++ ) + ";\n"; + if( m_currentDataCollector.UsingScreenPos ) + ShaderBody += "\t\t\t\tfloat4 screenPos : TEXCOORD" + ( texcoordIndex++ ) + ";\n"; + if( /*m_currentDataCollector.UsingWorldNormal || m_currentDataCollector.UsingWorldPosition ||*/ m_currentDataCollector.UsingInternalData || m_currentDataCollector.DirtyNormal ) + { + ShaderBody += "\t\t\t\tfloat4 tSpace0 : TEXCOORD" + ( texcoordIndex++ ) + ";\n"; + ShaderBody += "\t\t\t\tfloat4 tSpace1 : TEXCOORD" + ( texcoordIndex++ ) + ";\n"; + ShaderBody += "\t\t\t\tfloat4 tSpace2 : TEXCOORD" + ( texcoordIndex++ ) + ";\n"; + } + else if( !m_currentDataCollector.UsingInternalData && m_currentDataCollector.UsingWorldNormal ) + { + ShaderBody += "\t\t\t\tfloat3 worldNormal : TEXCOORD" + ( texcoordIndex++ ) + ";\n"; + } + + if( m_currentDataCollector.UsingVertexColor ) + ShaderBody += "\t\t\t\thalf4 color : COLOR0;\n"; + ShaderBody += "\t\t\t\tUNITY_VERTEX_INPUT_INSTANCE_ID\n"; + ShaderBody += "\t\t\t\tUNITY_VERTEX_OUTPUT_STEREO\n"; + ShaderBody += "\t\t\t};\n"; + + ShaderBody += "\t\t\tv2f vert( " + m_currentDataCollector.SurfaceVertexStructure + " v )\n"; + ShaderBody += "\t\t\t{\n"; + ShaderBody += "\t\t\t\tv2f o;\n"; + + ShaderBody += "\t\t\t\tUNITY_SETUP_INSTANCE_ID( v );\n"; + ShaderBody += "\t\t\t\tUNITY_INITIALIZE_OUTPUT( v2f, o );\n"; + ShaderBody += "\t\t\t\tUNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );\n"; + ShaderBody += "\t\t\t\tUNITY_TRANSFER_INSTANCE_ID( v, o );\n"; + + if( m_currentDataCollector.DirtyPerVertexData || m_currentDataCollector.CustomShadowCoordsList.Count > 0 ) + ShaderBody += "\t\t\t\tInput customInputData;\n"; + if( m_currentDataCollector.DirtyPerVertexData ) + { + ShaderBody += "\t\t\t\tvertexDataFunc( v" + ( m_currentDataCollector.TesselationActive ? "" : ", customInputData" ) + " );\n"; + } + + ShaderBody += "\t\t\t\tfloat3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;\n"; + ShaderBody += "\t\t\t\thalf3 worldNormal = UnityObjectToWorldNormal( v.normal );\n"; + if( m_currentDataCollector.UsingInternalData || m_currentDataCollector.DirtyNormal ) + { + ShaderBody += "\t\t\t\thalf3 worldTangent = UnityObjectToWorldDir( v.tangent.xyz );\n"; + ShaderBody += "\t\t\t\thalf tangentSign = v.tangent.w * unity_WorldTransformParams.w;\n"; + ShaderBody += "\t\t\t\thalf3 worldBinormal = cross( worldNormal, worldTangent ) * tangentSign;\n"; + ShaderBody += "\t\t\t\to.tSpace0 = float4( worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x );\n"; + ShaderBody += "\t\t\t\to.tSpace1 = float4( worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y );\n"; + ShaderBody += "\t\t\t\to.tSpace2 = float4( worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z );\n"; + } + else if( !m_currentDataCollector.UsingInternalData && m_currentDataCollector.UsingWorldNormal ) + { + ShaderBody += "\t\t\t\to.worldNormal = worldNormal;\n"; + } + + for( int i = 0; i < m_currentDataCollector.CustomShadowCoordsList.Count; i++ ) + { + int size = UIUtils.GetChannelsAmount( m_currentDataCollector.CustomShadowCoordsList[ i ].DataType ); + string channels = string.Empty; + for( int j = 0; j < size; j++ ) + { + channels += Convert.ToChar( 120 + m_currentDataCollector.CustomShadowCoordsList[ i ].TextureIndex + j ); + } + channels = channels.Replace( '{', 'w' ); + ShaderBody += "\t\t\t\to.customPack" + ( m_currentDataCollector.CustomShadowCoordsList[ i ].TextureSlot + 1 ) + "." + channels + " = customInputData." + m_currentDataCollector.CustomShadowCoordsList[ i ].CoordName + ";\n"; + + //TODO: TEMPORARY SOLUTION, this needs to go somewhere else, there's no need for these comparisons + if( m_currentDataCollector.CustomShadowCoordsList[ i ].CoordName.StartsWith( "uv_" ) ) + { + ShaderBody += "\t\t\t\to.customPack" + ( m_currentDataCollector.CustomShadowCoordsList[ i ].TextureSlot + 1 ) + "." + channels + " = v.texcoord;\n"; + } + else if( m_currentDataCollector.CustomShadowCoordsList[ i ].CoordName.StartsWith( "uv2_" ) ) + { + ShaderBody += "\t\t\t\to.customPack" + ( m_currentDataCollector.CustomShadowCoordsList[ i ].TextureSlot + 1 ) + "." + channels + " = v.texcoord1;\n"; + } + else if( m_currentDataCollector.CustomShadowCoordsList[ i ].CoordName.StartsWith( "uv3_" ) ) + { + ShaderBody += "\t\t\t\to.customPack" + ( m_currentDataCollector.CustomShadowCoordsList[ i ].TextureSlot + 1 ) + "." + channels + " = v.texcoord2;\n"; + } + else if( m_currentDataCollector.CustomShadowCoordsList[ i ].CoordName.StartsWith( "uv4_" ) ) + { + ShaderBody += "\t\t\t\to.customPack" + ( m_currentDataCollector.CustomShadowCoordsList[ i ].TextureSlot + 1 ) + "." + channels + " = v.texcoord3;\n"; + } + } + + if( !m_currentDataCollector.UsingInternalData ) + ShaderBody += "\t\t\t\to.worldPos = worldPos;\n"; + ShaderBody += "\t\t\t\tTRANSFER_SHADOW_CASTER_NORMALOFFSET( o )\n"; + if( m_currentDataCollector.UsingScreenPos ) + ShaderBody += "\t\t\t\to.screenPos = ComputeScreenPos( o.pos );\n"; + if( m_currentDataCollector.UsingVertexColor ) + ShaderBody += "\t\t\t\to.color = v.color;\n"; + ShaderBody += "\t\t\t\treturn o;\n"; + ShaderBody += "\t\t\t}\n"; + + ShaderBody += "\t\t\thalf4 frag( v2f IN\n"; + ShaderBody += "\t\t\t#if !defined( CAN_SKIP_VPOS )\n"; + ShaderBody += "\t\t\t, UNITY_VPOS_TYPE vpos : VPOS\n"; + ShaderBody += "\t\t\t#endif\n"; + ShaderBody += "\t\t\t) : SV_Target\n"; + ShaderBody += "\t\t\t{\n"; + ShaderBody += "\t\t\t\tUNITY_SETUP_INSTANCE_ID( IN );\n"; + ShaderBody += "\t\t\t\tInput surfIN;\n"; + ShaderBody += "\t\t\t\tUNITY_INITIALIZE_OUTPUT( Input, surfIN );\n"; + + for( int i = 0; i < m_currentDataCollector.CustomShadowCoordsList.Count; i++ ) + { + int size = UIUtils.GetChannelsAmount( m_currentDataCollector.CustomShadowCoordsList[ i ].DataType ); + string channels = string.Empty; + for( int j = 0; j < size; j++ ) + { + channels += Convert.ToChar( 120 + m_currentDataCollector.CustomShadowCoordsList[ i ].TextureIndex + j ); + } + channels = channels.Replace( '{', 'w' ); + ShaderBody += "\t\t\t\tsurfIN." + m_currentDataCollector.CustomShadowCoordsList[ i ].CoordName + " = IN.customPack" + ( m_currentDataCollector.CustomShadowCoordsList[ i ].TextureSlot + 1 ) + "." + channels + ";\n"; + } + + if( m_currentDataCollector.UsingInternalData ) + ShaderBody += "\t\t\t\tfloat3 worldPos = float3( IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w );\n"; + else + ShaderBody += "\t\t\t\tfloat3 worldPos = IN.worldPos;\n"; + ShaderBody += "\t\t\t\thalf3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );\n"; + + if( m_currentDataCollector.UsingViewDirection && !m_currentDataCollector.DirtyNormal ) + ShaderBody += "\t\t\t\tsurfIN.viewDir = worldViewDir;\n"; + else if( m_currentDataCollector.UsingViewDirection ) + ShaderBody += "\t\t\t\tsurfIN.viewDir = IN.tSpace0.xyz * worldViewDir.x + IN.tSpace1.xyz * worldViewDir.y + IN.tSpace2.xyz * worldViewDir.z;\n"; + + if( m_currentDataCollector.UsingWorldPosition ) + ShaderBody += "\t\t\t\tsurfIN.worldPos = worldPos;\n"; + + if( m_currentDataCollector.UsingWorldNormal && m_currentDataCollector.UsingInternalData ) + ShaderBody += "\t\t\t\tsurfIN.worldNormal = float3( IN.tSpace0.z, IN.tSpace1.z, IN.tSpace2.z );\n"; + else if( !m_currentDataCollector.UsingInternalData && m_currentDataCollector.UsingWorldNormal ) + ShaderBody += "\t\t\t\tsurfIN.worldNormal = IN.worldNormal;\n"; + + if( m_currentDataCollector.UsingWorldReflection ) + ShaderBody += "\t\t\t\tsurfIN.worldRefl = -worldViewDir;\n"; + + if( m_currentDataCollector.UsingInternalData ) + { + ShaderBody += "\t\t\t\tsurfIN.internalSurfaceTtoW0 = IN.tSpace0.xyz;\n"; + ShaderBody += "\t\t\t\tsurfIN.internalSurfaceTtoW1 = IN.tSpace1.xyz;\n"; + ShaderBody += "\t\t\t\tsurfIN.internalSurfaceTtoW2 = IN.tSpace2.xyz;\n"; + } + + if( m_currentDataCollector.UsingScreenPos ) + ShaderBody += "\t\t\t\tsurfIN.screenPos = IN.screenPos;\n"; + + if( m_currentDataCollector.UsingVertexColor ) + ShaderBody += "\t\t\t\tsurfIN.vertexColor = IN.color;\n"; + + ShaderBody += "\t\t\t\t" + outputStruct + " o;\n"; + ShaderBody += "\t\t\t\tUNITY_INITIALIZE_OUTPUT( " + outputStruct + ", o )\n"; + ShaderBody += "\t\t\t\tsurf( surfIN, o );\n"; + if( ( hasOpacity || hasOpacityMask ) && m_currentLightModel == StandardShaderLightModel.CustomLighting ) + { + ShaderBody += "\t\t\t\tUnityGI gi;\n"; + ShaderBody += "\t\t\t\tUNITY_INITIALIZE_OUTPUT( UnityGI, gi );\n"; + ShaderBody += "\t\t\t\to.Alpha = LightingStandardCustomLighting( o, worldViewDir, gi ).a;\n"; + } + ShaderBody += "\t\t\t\t#if defined( CAN_SKIP_VPOS )\n"; + ShaderBody += "\t\t\t\tfloat2 vpos = IN.pos;\n"; + ShaderBody += "\t\t\t\t#endif\n"; + + /*if( ( ( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) && hasOpacity && m_inputPorts[ m_discardPortId ].IsConnected ) ) + { + + } + else*/ if(!( ( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) && hasOpacity && m_inputPorts[ m_discardPortId ].IsConnected ) && hasOpacity ) + { + ShaderBody += "\t\t\t\thalf alphaRef = tex3D( _DitherMaskLOD, float3( vpos.xy * 0.25, o.Alpha * 0.9375 ) ).a;\n"; + ShaderBody += "\t\t\t\tclip( alphaRef - 0.01 );\n"; + } + + ShaderBody += "\t\t\t\tSHADOW_CASTER_FRAGMENT( IN )\n"; + ShaderBody += "\t\t\t}\n"; + + ShaderBody += "\t\t\tENDCG\n"; + + ShaderBody += "\t\t}\n"; + } + + } + + if( !string.IsNullOrEmpty( bellowUsePasses ) ) + { + ShaderBody += bellowUsePasses; + } + + CloseSubShaderBody( ref ShaderBody ); + + if( m_dependenciesHelper.HasDependencies ) + { + ShaderBody += m_dependenciesHelper.GenerateDependencies(); + } + + if( m_fallbackHelper.Active ) + { + ShaderBody += m_fallbackHelper.TabbedFallbackShader; + } + else if( m_castShadows || m_receiveShadows ) + { + AddShaderProperty( ref ShaderBody, "Fallback", "Diffuse" ); + } + + if( !string.IsNullOrEmpty( m_customInspectorName ) ) + { + AddShaderProperty( ref ShaderBody, "CustomEditor", m_customInspectorName ); + } + } + CloseShaderBody( ref ShaderBody ); + + if( usingDebugPort ) + { + m_currentLightModel = cachedLightModel; + ContainerGraph.CurrentCanvasMode = cachedAvailability; + } + + // Generate Graph info + ShaderBody += ContainerGraph.ParentWindow.GenerateGraphInfo(); + + //TODO: Remove current SaveDebugShader and uncomment SaveToDisk as soon as pathname is editable + if( !String.IsNullOrEmpty( pathname ) ) + { + IOUtils.StartSaveThread( ShaderBody, ( isFullPath ? pathname : ( IOUtils.dataPath + pathname ) ) ); + } + else + { + IOUtils.StartSaveThread( ShaderBody, Application.dataPath + "/AmplifyShaderEditor/Samples/Shaders/" + m_shaderName + ".shader" ); + } + + // Load new shader into material + + if( CurrentShader == null ) + { + AssetDatabase.Refresh( ImportAssetOptions.ForceUpdate ); + CurrentShader = Shader.Find( ShaderName ); + } + //else + //{ + // // need to always get asset datapath because a user can change and asset location from the project window + // AssetDatabase.ImportAsset( AssetDatabase.GetAssetPath( m_currentShader ) ); + // //ShaderUtil.UpdateShaderAsset( m_currentShader, ShaderBody ); + //} + + if( m_currentShader != null ) + { + m_currentDataCollector.UpdateShaderImporter( ref m_currentShader ); + if( m_currentMaterial != null ) + { + if( m_currentShader != m_currentMaterial.shader ) + m_currentMaterial.shader = m_currentShader; + if ( isInstancedShader ) + { + m_currentMaterial.enableInstancing = true; + } + m_currentDataCollector.UpdateMaterialOnPropertyNodes( m_currentMaterial ); + UpdateMaterialEditor(); + // need to always get asset datapath because a user can change and asset location from the project window + //AssetDatabase.ImportAsset( AssetDatabase.GetAssetPath( m_currentMaterial ) ); + } + } + + m_currentDataCollector.Destroy(); + m_currentDataCollector = null; + + return m_currentShader; + } + + public override void UpdateFromShader( Shader newShader ) + { + if( m_currentMaterial != null && m_currentMaterial.shader != newShader ) + { + m_currentMaterial.shader = newShader; + } + CurrentShader = newShader; + } + + public override void Destroy() + { + base.Destroy(); + + if( m_dummyProperty != null ) + { + m_dummyProperty.Destroy(); + GameObject.DestroyImmediate( m_dummyProperty ); + m_dummyProperty = null; + } + + m_drawInstancedHelper = null; + + m_translucencyPort = null; + m_transmissionPort = null; + m_refractionPort = null; + m_normalPort = null; + + m_renderingOptionsOpHelper.Destroy(); + m_renderingOptionsOpHelper = null; + + m_additionalIncludes.Destroy(); + m_additionalIncludes = null; + + m_additionalPragmas.Destroy(); + m_additionalPragmas = null; + + m_additionalDefines.Destroy(); + m_additionalDefines = null; + + m_additionalSurfaceOptions.Destroy(); + m_additionalSurfaceOptions = null; + + m_additionalDirectives.Destroy(); + m_additionalDirectives = null; + + m_customTagsHelper.Destroy(); + m_customTagsHelper = null; + + m_dependenciesHelper.Destroy(); + m_dependenciesHelper = null; + + m_renderingPlatformOpHelper = null; + m_inspectorDefaultStyle = null; + m_inspectorFoldoutStyle = null; + + m_zBufferHelper = null; + m_stencilBufferHelper = null; + m_blendOpsHelper = null; + m_tessOpHelper.Destroy(); + m_tessOpHelper = null; + m_outlineHelper.Destroy(); + m_outlineHelper = null; + m_colorMaskHelper.Destroy(); + m_colorMaskHelper = null; + m_billboardOpHelper = null; + + m_fallbackHelper.Destroy(); + GameObject.DestroyImmediate( m_fallbackHelper ); + m_fallbackHelper = null; + + m_usePass.Destroy(); + GameObject.DestroyImmediate( m_usePass ); + m_usePass = null; + } + + public override int VersionConvertInputPortId( int portId ) + { + int newPort = portId; + + //added translucency input after occlusion + if( UIUtils.CurrentShaderVersion() <= 2404 ) + { + switch( m_currentLightModel ) + { + case StandardShaderLightModel.Standard: + case StandardShaderLightModel.StandardSpecular: + if( portId >= 6 ) + newPort += 1; + break; + case StandardShaderLightModel.CustomLighting: + case StandardShaderLightModel.Unlit: + case StandardShaderLightModel.Lambert: + case StandardShaderLightModel.BlinnPhong: + if( portId >= 5 ) + newPort += 1; + break; + } + } + + portId = newPort; + + //added transmission input after occlusion + if( UIUtils.CurrentShaderVersion() < 2407 ) + { + switch( m_currentLightModel ) + { + case StandardShaderLightModel.Standard: + case StandardShaderLightModel.StandardSpecular: + if( portId >= 6 ) + newPort += 1; + break; + case StandardShaderLightModel.CustomLighting: + case StandardShaderLightModel.Unlit: + case StandardShaderLightModel.Lambert: + case StandardShaderLightModel.BlinnPhong: + if( portId >= 5 ) + newPort += 1; + break; + } + } + + portId = newPort; + + //added tessellation ports + if( UIUtils.CurrentShaderVersion() < 3002 ) + { + switch( m_currentLightModel ) + { + case StandardShaderLightModel.Standard: + case StandardShaderLightModel.StandardSpecular: + if( portId >= 13 ) + newPort += 1; + break; + case StandardShaderLightModel.CustomLighting: + case StandardShaderLightModel.Unlit: + case StandardShaderLightModel.Lambert: + case StandardShaderLightModel.BlinnPhong: + if( portId >= 10 ) + newPort += 1; + break; + } + } + + portId = newPort; + + //added refraction after translucency + if( UIUtils.CurrentShaderVersion() < 3204 ) + { + switch( m_currentLightModel ) + { + case StandardShaderLightModel.Standard: + case StandardShaderLightModel.StandardSpecular: + if( portId >= 8 ) + newPort += 1; + break; + case StandardShaderLightModel.CustomLighting: + case StandardShaderLightModel.Unlit: + case StandardShaderLightModel.Lambert: + case StandardShaderLightModel.BlinnPhong: + if( portId >= 7 ) + newPort += 1; + break; + } + } + + portId = newPort; + + //removed custom lighting port + //if ( UIUtils.CurrentShaderVersion() < 10003 ) //runs everytime because this system is only used after 5000 version + { + switch( m_currentLightModel ) + { + case StandardShaderLightModel.Standard: + case StandardShaderLightModel.StandardSpecular: + if( portId >= 13 ) + newPort -= 1; + break; + case StandardShaderLightModel.CustomLighting: + case StandardShaderLightModel.Unlit: + case StandardShaderLightModel.Lambert: + case StandardShaderLightModel.BlinnPhong: + if( portId >= 12 ) + newPort -= 1; + break; + } + } + + portId = newPort; + + //if( UIUtils.CurrentShaderVersion() < 13802 ) //runs everytime because this system is only used after 5000 version + { + switch( m_currentLightModel ) + { + case StandardShaderLightModel.Standard: + case StandardShaderLightModel.StandardSpecular: + if( portId >= 11 ) + newPort += 1; + break; + case StandardShaderLightModel.CustomLighting: + case StandardShaderLightModel.Unlit: + case StandardShaderLightModel.Lambert: + case StandardShaderLightModel.BlinnPhong: + if( portId >= 10 ) + newPort += 1; + break; + } + } + + portId = newPort; + return newPort; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + try + { + base.ReadFromString( ref nodeParams ); + m_currentLightModel = (StandardShaderLightModel)Enum.Parse( typeof( StandardShaderLightModel ), GetCurrentParam( ref nodeParams ) ); + + if( CurrentMasterNodeCategory == AvailableShaderTypes.SurfaceShader && m_currentLightModel == StandardShaderLightModel.CustomLighting ) + { + ContainerGraph.CurrentCanvasMode = NodeAvailability.CustomLighting; + ContainerGraph.ParentWindow.CurrentNodeAvailability = NodeAvailability.CustomLighting; + } + else if( CurrentMasterNodeCategory == AvailableShaderTypes.SurfaceShader ) + { + ContainerGraph.CurrentCanvasMode = NodeAvailability.SurfaceShader; + ContainerGraph.ParentWindow.CurrentNodeAvailability = NodeAvailability.SurfaceShader; + } + //if ( _shaderCategory.Length > 0 ) + // _shaderCategory = UIUtils.RemoveInvalidCharacters( _shaderCategory ); + ShaderName = GetCurrentParam( ref nodeParams ); + if( m_shaderName.Length > 0 ) + ShaderName = UIUtils.RemoveShaderInvalidCharacters( ShaderName ); + + m_renderingOptionsOpHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + + m_cullMode = (CullMode)Enum.Parse( typeof( CullMode ), GetCurrentParam( ref nodeParams ) ); + m_zBufferHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + + string alphaMode = GetCurrentParam( ref nodeParams ); + + if( UIUtils.CurrentShaderVersion() < 4003 ) + { + if( alphaMode.Equals( "Fade" ) ) + { + alphaMode = "Transparent"; + } + else if( alphaMode.Equals( "Transparent" ) ) + { + alphaMode = "Premultiply"; + } + } + + m_alphaMode = (AlphaMode)Enum.Parse( typeof( AlphaMode ), alphaMode ); + m_opacityMaskClipValue = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + m_keepAlpha = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_keepAlpha = true; + m_castShadows = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_queueOrder = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 11 ) + { + m_customBlendMode = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_renderType = (RenderType)Enum.Parse( typeof( RenderType ), GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 14305 ) + { + m_customRenderType = GetCurrentParam( ref nodeParams ); + } + m_renderQueue = (RenderQueue)Enum.Parse( typeof( RenderQueue ), GetCurrentParam( ref nodeParams ) ); + } + if( UIUtils.CurrentShaderVersion() > 2402 ) + { + m_renderPath = (RenderPath)Enum.Parse( typeof( RenderPath ), GetCurrentParam( ref nodeParams ) ); + } + if( UIUtils.CurrentShaderVersion() > 2405 ) + { + m_renderingPlatformOpHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 2500 ) + { + m_colorMaskHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 2501 ) + { + m_stencilBufferHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 2504 ) + { + m_tessOpHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 2505 ) + { + m_receiveShadows = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 3202 ) + { + m_blendOpsHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 3203 ) + { + m_grabOrder = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 5003 ) + { + m_outlineHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 5110 ) + { + m_billboardOpHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 6101 ) + { + m_vertexMode = (VertexMode)Enum.Parse( typeof( VertexMode ), GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 6102 ) + { + ShaderLOD = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_fallbackHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 7102 ) + { + m_maskClipOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_translucencyOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_refractionOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_tessellationOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 10010 && UIUtils.CurrentShaderVersion() < 15312 ) + { + m_additionalIncludes.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 11006 ) + { + m_customTagsHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 13102 && UIUtils.CurrentShaderVersion() < 15312 ) + { + m_additionalPragmas.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 13205 ) + { + m_alphaToCoverage = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 13903 ) + { + m_dependenciesHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 14005 && UIUtils.CurrentShaderVersion() < 15312 ) + { + m_additionalDefines.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 14501 ) + { + m_inlineCullMode.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 14502 ) + { + m_specColorOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 15204 ) + { + m_inlineOpacityMaskClipValue.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 15311 ) + { + m_additionalDirectives.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + m_additionalSurfaceOptions.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + else + { + m_additionalDirectives.AddItems( AdditionalLineType.Define, m_additionalDefines.DefineList ); + m_additionalDirectives.AddItems( AdditionalLineType.Include, m_additionalIncludes.IncludeList ); + m_additionalDirectives.AddItems( AdditionalLineType.Pragma, m_additionalPragmas.PragmaList ); + } + + if( UIUtils.CurrentShaderVersion() > 15402 ) + { + m_usePass.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 16203 ) + { + m_drawInstancedHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 16204 ) + m_inlineChromaticAberration.ReadFromString( ref m_currentReadParamIdx, ref nodeParams , false ); + + if( UIUtils.CurrentShaderVersion() > 16207 ) + m_inlineAlphaToCoverage.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + + if( UIUtils.CurrentShaderVersion() > 18302 ) + SamplingMacros = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + else + SamplingMacros = false; + + m_lightModelChanged = true; + m_lastLightModel = m_currentLightModel; + DeleteAllInputConnections( true ); + AddMasterPorts(); + UpdateFromBlendMode(); + m_customBlendMode = TestCustomBlendMode(); + + ContainerGraph.CurrentPrecision = m_currentPrecisionType; + } + catch( Exception e ) + { + Debug.Log( e ); + } + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + + // change port connection from emission to the new custom lighting port + if( m_currentLightModel == StandardShaderLightModel.CustomLighting && m_inputPorts[ m_emissionPortId ].IsConnected && UIUtils.CurrentShaderVersion() < 13802 ) + { + OutputPort port = m_inputPorts[ m_emissionPortId ].GetOutputConnection( 0 ); + m_inputPorts[ m_emissionPortId ].FullDeleteConnections(); + UIUtils.SetConnection( m_inputPorts[ m_customLightingPortId ].NodeId, m_inputPorts[ m_customLightingPortId ].PortId, port.NodeId, port.PortId ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentLightModel ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_shaderName ); + m_renderingOptionsOpHelper.WriteToString( ref nodeInfo ); + + IOUtils.AddFieldValueToString( ref nodeInfo, m_cullMode ); + m_zBufferHelper.WriteToString( ref nodeInfo ); + + IOUtils.AddFieldValueToString( ref nodeInfo, m_alphaMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_opacityMaskClipValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_keepAlpha ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_castShadows ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_queueOrder ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_customBlendMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_renderType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_customRenderType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_renderQueue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_renderPath ); + m_renderingPlatformOpHelper.WriteToString( ref nodeInfo ); + m_colorMaskHelper.WriteToString( ref nodeInfo ); + m_stencilBufferHelper.WriteToString( ref nodeInfo ); + m_tessOpHelper.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_receiveShadows ); + m_blendOpsHelper.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_grabOrder ); + m_outlineHelper.WriteToString( ref nodeInfo ); + m_billboardOpHelper.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_vertexMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, ShaderLOD ); + m_fallbackHelper.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_maskClipReorder != null ) ? m_maskClipReorder.OrderIndex : -1 ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_translucencyReorder != null ) ? m_translucencyReorder.OrderIndex : -1 ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_refractionReorder != null ) ? m_refractionReorder.OrderIndex : -1 ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_tessellationReorder != null ) ? m_tessellationReorder.OrderIndex : -1 ); + //m_additionalIncludes.WriteToString( ref nodeInfo ); + m_customTagsHelper.WriteToString( ref nodeInfo ); + //m_additionalPragmas.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_alphaToCoverage ); + m_dependenciesHelper.WriteToString( ref nodeInfo ); + //m_additionalDefines.WriteToString( ref nodeInfo ); + m_inlineCullMode.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_specColorReorder != null ) ? m_specColorReorder.OrderIndex : -1 ); + m_inlineOpacityMaskClipValue.WriteToString( ref nodeInfo ); + m_additionalDirectives.WriteToString( ref nodeInfo ); + m_additionalSurfaceOptions.WriteToString( ref nodeInfo ); + m_usePass.WriteToString( ref nodeInfo ); + m_drawInstancedHelper.WriteToString( ref nodeInfo ); + m_inlineChromaticAberration.WriteToString( ref nodeInfo ); + m_inlineAlphaToCoverage.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_samplingMacros ); + } + + private bool TestCustomBlendMode() + { + switch( m_alphaMode ) + { + case AlphaMode.Opaque: + { + if( m_renderType == RenderType.Opaque && m_renderQueue == RenderQueue.Geometry ) + return false; + } + break; + case AlphaMode.Masked: + { + if( m_renderType == RenderType.TransparentCutout && m_renderQueue == RenderQueue.AlphaTest ) + return false; + } + break; + case AlphaMode.Transparent: + case AlphaMode.Premultiply: + { + if( m_renderType == RenderType.Transparent && m_renderQueue == RenderQueue.Transparent ) + return false; + } + break; + case AlphaMode.Translucent: + { + if( m_renderType == RenderType.Opaque && m_renderQueue == RenderQueue.Transparent ) + return false; + } + break; + } + return true; + } + + private void UpdateFromBlendMode() + { + m_checkChanges = true; + bool lockRefractionPort = false; + if( m_currentLightModel == StandardShaderLightModel.Unlit || m_currentLightModel == StandardShaderLightModel.CustomLighting ) + { + lockRefractionPort = true; + } + + switch( m_alphaMode ) + { + case AlphaMode.Opaque: + { + m_renderType = RenderType.Opaque; + m_renderQueue = RenderQueue.Geometry; + m_keepAlpha = true; + m_refractionPort.Locked = true; + m_inputPorts[ m_opacityPortId ].Locked = true; + m_inputPorts[ m_discardPortId ].Locked = true; + } + break; + case AlphaMode.Masked: + { + m_renderType = RenderType.TransparentCutout; + m_renderQueue = RenderQueue.AlphaTest; + m_keepAlpha = true; + m_refractionPort.Locked = true; + m_inputPorts[ m_opacityPortId ].Locked = true; + m_inputPorts[ m_discardPortId ].Locked = false; + } + break; + case AlphaMode.Transparent: + case AlphaMode.Premultiply: + { + m_renderType = RenderType.Transparent; + m_renderQueue = RenderQueue.Transparent; + m_refractionPort.Locked = false || lockRefractionPort; + m_inputPorts[ m_opacityPortId ].Locked = false; + m_inputPorts[ m_discardPortId ].Locked = true; + } + break; + case AlphaMode.Translucent: + { + m_renderType = RenderType.Opaque; + m_renderQueue = RenderQueue.Transparent; + m_refractionPort.Locked = false || lockRefractionPort; + m_inputPorts[ m_opacityPortId ].Locked = false; + m_inputPorts[ m_discardPortId ].Locked = true; + } + break; + case AlphaMode.Custom: + { + m_refractionPort.Locked = false || lockRefractionPort; + m_inputPorts[ m_opacityPortId ].Locked = false; + m_inputPorts[ m_discardPortId ].Locked = false; + } + break; + } + + m_blendOpsHelper.SetBlendOpsFromBlendMode( m_alphaMode, ( m_alphaMode == AlphaMode.Custom || m_alphaMode == AlphaMode.Opaque ) ); + } + + public bool CastShadows { get { return m_castShadows; } } + public StandardShaderLightModel CurrentLightingModel { get { return m_currentLightModel; } } + public CullMode CurrentCullMode { get { return m_cullMode; } } + //public AdditionalIncludesHelper AdditionalIncludes { get { return m_additionalIncludes; } set { m_additionalIncludes = value; } } + //public AdditionalPragmasHelper AdditionalPragmas { get { return m_additionalPragmas; } set { m_additionalPragmas = value; } } + //public AdditionalDefinesHelper AdditionalDefines { get { return m_additionalDefines; } set { m_additionalDefines = value; } } + public TemplateAdditionalDirectivesHelper AdditionalDirectives { get { return m_additionalDirectives; } } + public OutlineOpHelper OutlineHelper { get { return m_outlineHelper; } } + public float OpacityMaskClipValue { get { return m_opacityMaskClipValue; } } + public InlineProperty InlineOpacityMaskClipValue { get { return m_inlineOpacityMaskClipValue; } set { m_inlineOpacityMaskClipValue = value; } } + public bool CustomShadowCaster + { + get + { + bool hasOpacity = m_inputPorts[ m_opacityPortId ].IsConnected; + return + ( !m_renderingOptionsOpHelper.UseDefaultShadowCaster && + ( ( m_castShadows && ( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) ) || + ( m_castShadows && hasOpacity ) || + ( m_castShadows && ( m_currentDataCollector.UsingWorldNormal || m_currentDataCollector.UsingWorldReflection || m_currentDataCollector.UsingViewDirection ) ) || + ( m_castShadows && m_inputPorts[ m_discardPortId ].Available && m_inputPorts[ m_discardPortId ].IsConnected && m_currentLightModel == StandardShaderLightModel.CustomLighting ) ) ); + } + } + public override AvailableShaderTypes CurrentMasterNodeCategory { get { return AvailableShaderTypes.SurfaceShader; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs.meta new file mode 100644 index 00000000..85a76b0f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 59e61f9559385a94a87d4d37dbd556f0 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs new file mode 100644 index 00000000..5393c876 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs @@ -0,0 +1,305 @@ +using System; +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + + [Serializable] + public class StencilBufferOpHelper + { + public static readonly string[] StencilComparisonValues = + { + "", + "Greater" , + "GEqual" , + "Less" , + "LEqual" , + "Equal" , + "NotEqual" , + "Always" , + "Never" + }; + + public static readonly Dictionary StencilComparisonValuesDict = new Dictionary() + { + {"Greater" , 1}, + {"GEqual" , 2}, + {"Less" , 3}, + {"LEqual" , 4}, + {"Equal" , 5}, + {"NotEqual", 6}, + {"Always" , 7}, + {"Never" , 8}, + }; + + public static readonly string[] StencilComparisonLabels = + { + "", + "Greater" , + "Greater or Equal" , + "Less" , + "Less or Equal" , + "Equal" , + "Not Equal" , + "Always" , + "Never" + }; + + + public static readonly string[] StencilOpsValues = + { + "", + "Keep", + "Zero", + "Replace", + "IncrSat", + "DecrSat", + "Invert", + "IncrWrap", + "DecrWrap" + }; + + public static readonly Dictionary StencilOpsValuesDict = new Dictionary() + { + {"Keep", 1}, + {"Zero", 2}, + {"Replace", 3}, + {"IncrSat", 4}, + {"DecrSat", 5}, + {"Invert", 6}, + {"IncrWrap",7}, + {"DecrWrap",8}, + }; + + public static readonly string[] StencilOpsLabels = + { + "", + "Keep", + "Zero", + "Replace", + "IncrSat", + "DecrSat", + "Invert", + "IncrWrap", + "DecrWrap" + }; + + + private const string FoldoutLabelStr = " Stencil Buffer"; + private GUIContent ReferenceValueContent = new GUIContent( "Reference", "The value to be compared against (if Comparison is anything else than always) and/or the value to be written to the buffer (if either Pass, Fail or ZFail is set to replace)" ); + private GUIContent ReadMaskContent = new GUIContent( "Read Mask", "An 8 bit mask as an 0-255 integer, used when comparing the reference value with the contents of the buffer (referenceValue & readMask) comparisonFunction (stencilBufferValue & readMask)" ); + private GUIContent WriteMaskContent = new GUIContent( "Write Mask", "An 8 bit mask as an 0-255 integer, used when writing to the buffer" ); + private const string ComparisonStr = "Comparison"; + private const string PassStr = "Pass"; + private const string FailStr = "Fail"; + private const string ZFailStr = "ZFail"; + + private const string ComparisonFrontStr = "Comp. Front"; + private const string PassFrontStr = "Pass Front"; + private const string FailFrontStr = "Fail Front"; + private const string ZFailFrontStr = "ZFail Front"; + + private const string ComparisonBackStr = "Comp. Back"; + private const string PassBackStr = "Pass Back"; + private const string FailBackStr = "Fail Back"; + private const string ZFailBackStr = "ZFail Back"; + + private const int ReferenceDefaultValue = 0; + private const int ReadMaskDefaultValue = 255; + private const int WriteMaskDefaultValue = 255; + private const int ComparisonDefaultValue = 0; + private const int PassStencilOpDefaultValue = 0; + private const int FailStencilOpDefaultValue = 0; + private const int ZFailStencilOpDefaultValue = 0; + + [SerializeField] + private bool m_active; + + [SerializeField] + private InlineProperty m_refValue = new InlineProperty( ReferenceDefaultValue ); + [SerializeField] + private InlineProperty m_readMask = new InlineProperty( ReadMaskDefaultValue ); + [SerializeField] + private InlineProperty m_writeMask = new InlineProperty( WriteMaskDefaultValue ); + + //Comparison Function + [SerializeField] + private InlineProperty m_comparisonFunctionIdx = new InlineProperty( ComparisonDefaultValue ); + [SerializeField] + private InlineProperty m_comparisonFunctionBackIdx = new InlineProperty( ComparisonDefaultValue ); + + //Pass Stencil Op + [SerializeField] + private InlineProperty m_passStencilOpIdx = new InlineProperty( PassStencilOpDefaultValue ); + [SerializeField] + private InlineProperty m_passStencilOpBackIdx = new InlineProperty( PassStencilOpDefaultValue ); + + //Fail Stencil Op + [SerializeField] + private InlineProperty m_failStencilOpIdx = new InlineProperty( FailStencilOpDefaultValue ); + [SerializeField] + private InlineProperty m_failStencilOpBackIdx = new InlineProperty( FailStencilOpDefaultValue ); + + //ZFail Stencil Op + [SerializeField] + private InlineProperty m_zFailStencilOpIdx = new InlineProperty( ZFailStencilOpDefaultValue ); + [SerializeField] + private InlineProperty m_zFailStencilOpBackIdx = new InlineProperty( ZFailStencilOpDefaultValue ); + + public string CreateStencilOp( UndoParentNode owner ) + { + string result = "\t\tStencil\n\t\t{\n"; + result += string.Format( "\t\t\tRef {0}\n", m_refValue.GetValueOrProperty() ); + if( m_readMask.Active || m_readMask.IntValue != ReadMaskDefaultValue ) + { + result += string.Format( "\t\t\tReadMask {0}\n", m_readMask.GetValueOrProperty() ); + } + + if( m_writeMask.Active || m_writeMask.IntValue != WriteMaskDefaultValue ) + { + result += string.Format( "\t\t\tWriteMask {0}\n", m_writeMask.GetValueOrProperty() ); + } + + if( ( owner as StandardSurfaceOutputNode ).CurrentCullMode == CullMode.Off ) + { + if( m_comparisonFunctionIdx.IntValue != ComparisonDefaultValue || m_comparisonFunctionIdx.Active ) + result += string.Format( "\t\t\tCompFront {0}\n", m_comparisonFunctionIdx.GetValueOrProperty( StencilComparisonValues[ m_comparisonFunctionIdx.IntValue ] ) ); + if( m_passStencilOpIdx.IntValue != PassStencilOpDefaultValue || m_passStencilOpIdx.Active ) + result += string.Format( "\t\t\tPassFront {0}\n", m_passStencilOpIdx.GetValueOrProperty( StencilOpsValues[ m_passStencilOpIdx.IntValue ] ) ); + if( m_failStencilOpIdx.IntValue != FailStencilOpDefaultValue || m_failStencilOpIdx.Active ) + result += string.Format( "\t\t\tFailFront {0}\n", m_failStencilOpIdx.GetValueOrProperty( StencilOpsValues[ m_failStencilOpIdx.IntValue ] ) ); + if( m_zFailStencilOpIdx.IntValue != ZFailStencilOpDefaultValue || m_zFailStencilOpIdx.Active ) + result += string.Format( "\t\t\tZFailFront {0}\n", m_zFailStencilOpIdx.GetValueOrProperty( StencilOpsValues[ m_zFailStencilOpIdx.IntValue ] ) ); + + if( m_comparisonFunctionBackIdx.IntValue != ComparisonDefaultValue || m_comparisonFunctionBackIdx.Active ) + result += string.Format( "\t\t\tCompBack {0}\n", m_comparisonFunctionBackIdx.GetValueOrProperty( StencilComparisonValues[ m_comparisonFunctionBackIdx.IntValue ] ) ); + if( m_passStencilOpBackIdx.IntValue != PassStencilOpDefaultValue || m_passStencilOpBackIdx.Active ) + result += string.Format( "\t\t\tPassBack {0}\n", m_passStencilOpBackIdx.GetValueOrProperty( StencilOpsValues[ m_passStencilOpBackIdx.IntValue ] ) ); + if( m_failStencilOpBackIdx.IntValue != FailStencilOpDefaultValue || m_failStencilOpBackIdx.Active ) + result += string.Format( "\t\t\tFailBack {0}\n", m_failStencilOpBackIdx.GetValueOrProperty( StencilOpsValues[ m_failStencilOpBackIdx.IntValue ] ) ); + if( m_zFailStencilOpBackIdx.IntValue != ZFailStencilOpDefaultValue || m_zFailStencilOpBackIdx.Active ) + result += string.Format( "\t\t\tZFailBack {0}\n", m_zFailStencilOpBackIdx.GetValueOrProperty( StencilOpsValues[ m_zFailStencilOpBackIdx.IntValue ] ) ); + } + else + { + if( m_comparisonFunctionIdx.IntValue != ComparisonDefaultValue || m_comparisonFunctionIdx.Active ) + result += string.Format( "\t\t\tComp {0}\n", m_comparisonFunctionIdx.GetValueOrProperty( StencilComparisonValues[ m_comparisonFunctionIdx.IntValue ] ) ); + if( m_passStencilOpIdx.IntValue != PassStencilOpDefaultValue || m_passStencilOpIdx.Active ) + result += string.Format( "\t\t\tPass {0}\n", m_passStencilOpIdx.GetValueOrProperty( StencilOpsValues[ m_passStencilOpIdx.IntValue ] ) ); + if( m_failStencilOpIdx.IntValue != FailStencilOpDefaultValue || m_failStencilOpIdx.Active ) + result += string.Format( "\t\t\tFail {0}\n", m_failStencilOpIdx.GetValueOrProperty( StencilOpsValues[ m_failStencilOpIdx.IntValue ] ) ); + if( m_zFailStencilOpIdx.IntValue != ZFailStencilOpDefaultValue || m_zFailStencilOpIdx.Active ) + result += string.Format( "\t\t\tZFail {0}\n", m_zFailStencilOpIdx.GetValueOrProperty( StencilOpsValues[ m_zFailStencilOpIdx.IntValue ] ) ); + } + + + result += "\t\t}\n"; + return result; + } + + public void Draw( UndoParentNode owner ) + { + bool foldoutValue = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedStencilOptions; + NodeUtils.DrawPropertyGroup( owner, ref foldoutValue, ref m_active, FoldoutLabelStr, () => + { + float cache = EditorGUIUtility.labelWidth; + float cache2 = EditorGUIUtility.fieldWidth; + EditorGUIUtility.labelWidth = 110; + EditorGUIUtility.fieldWidth = 30; + m_refValue.IntSlider( ref owner, ReferenceValueContent, 0, 255 ); + m_readMask.IntSlider( ref owner, ReadMaskContent, 0, 255 ); + m_writeMask.IntSlider( ref owner, WriteMaskContent, 0, 255 ); + //EditorGUIUtility.labelWidth = cache; + EditorGUIUtility.fieldWidth = cache2; + if( ( owner as StandardSurfaceOutputNode ).CurrentCullMode == CullMode.Off ) + { + m_comparisonFunctionIdx.EnumTypePopup( ref owner, ComparisonFrontStr, StencilComparisonLabels ); + m_passStencilOpIdx.EnumTypePopup( ref owner, PassFrontStr, StencilOpsLabels ); + m_failStencilOpIdx.EnumTypePopup( ref owner, FailFrontStr, StencilOpsLabels ); + m_zFailStencilOpIdx.EnumTypePopup( ref owner, ZFailFrontStr, StencilOpsLabels ); + EditorGUILayout.Separator(); + m_comparisonFunctionBackIdx.EnumTypePopup( ref owner, ComparisonBackStr, StencilComparisonLabels ); + m_passStencilOpBackIdx.EnumTypePopup( ref owner, PassBackStr, StencilOpsLabels ); + m_failStencilOpBackIdx.EnumTypePopup( ref owner, FailBackStr, StencilOpsLabels ); + m_zFailStencilOpBackIdx.EnumTypePopup( ref owner, ZFailBackStr, StencilOpsLabels ); + } + else + { + m_comparisonFunctionIdx.EnumTypePopup( ref owner, ComparisonStr, StencilComparisonLabels ); + m_passStencilOpIdx.EnumTypePopup( ref owner, PassFrontStr, StencilOpsLabels ); + m_failStencilOpIdx.EnumTypePopup( ref owner, FailFrontStr, StencilOpsLabels ); + m_zFailStencilOpIdx.EnumTypePopup( ref owner, ZFailFrontStr, StencilOpsLabels ); + } + EditorGUIUtility.labelWidth = cache; + } ); + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedStencilOptions = foldoutValue; + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + m_active = Convert.ToBoolean( nodeParams[ index++ ] ); + if( UIUtils.CurrentShaderVersion() > 14501 ) + { + m_refValue.ReadFromString( ref index, ref nodeParams ); + m_readMask.ReadFromString( ref index, ref nodeParams ); + m_writeMask.ReadFromString( ref index, ref nodeParams ); + m_comparisonFunctionIdx.ReadFromString( ref index, ref nodeParams ); + m_passStencilOpIdx.ReadFromString( ref index, ref nodeParams ); + m_failStencilOpIdx.ReadFromString( ref index, ref nodeParams ); + m_zFailStencilOpIdx.ReadFromString( ref index, ref nodeParams ); + } + else + { + m_refValue.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_readMask.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_writeMask.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_comparisonFunctionIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_passStencilOpIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_failStencilOpIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_zFailStencilOpIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + } + + if( UIUtils.CurrentShaderVersion() > 13203 ) + { + if( UIUtils.CurrentShaderVersion() > 14501 ) + { + m_comparisonFunctionBackIdx.ReadFromString( ref index, ref nodeParams ); + m_passStencilOpBackIdx.ReadFromString( ref index, ref nodeParams ); + m_failStencilOpBackIdx.ReadFromString( ref index, ref nodeParams ); + m_zFailStencilOpBackIdx.ReadFromString( ref index, ref nodeParams ); + } + else + { + m_comparisonFunctionBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_passStencilOpBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_failStencilOpBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_zFailStencilOpBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + } + } + } + + public void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_active ); + m_refValue.WriteToString( ref nodeInfo ); + m_readMask.WriteToString( ref nodeInfo ); + m_writeMask.WriteToString( ref nodeInfo ); + m_comparisonFunctionIdx.WriteToString( ref nodeInfo ); + m_passStencilOpIdx.WriteToString( ref nodeInfo ); + m_failStencilOpIdx.WriteToString( ref nodeInfo ); + m_zFailStencilOpIdx.WriteToString( ref nodeInfo ); + m_comparisonFunctionBackIdx.WriteToString( ref nodeInfo ); + m_passStencilOpBackIdx.WriteToString( ref nodeInfo ); + m_failStencilOpBackIdx.WriteToString( ref nodeInfo ); + m_zFailStencilOpBackIdx.WriteToString( ref nodeInfo ); + } + + public bool Active + { + get { return m_active; } + set { m_active = value; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs.meta new file mode 100644 index 00000000..7b386c8d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 0111d524dc809f14aa95e4e1ab93d37b +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs new file mode 100644 index 00000000..05923586 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs @@ -0,0 +1,379 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; + +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TerrainDrawInstancedHelper + { + private readonly string[] InstancedPragmas = + { + "multi_compile_instancing", + "instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap forwardadd" + }; + + private readonly string[] InstancedPragmasSRP = + { + "multi_compile_instancing", + "instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap" + }; + + private readonly string[] InstancedGlobalsSRP = + { + "#ifdef UNITY_INSTANCING_ENABLED//ASE Terrain Instancing", + "\tTEXTURE2D(_TerrainHeightmapTexture);//ASE Terrain Instancing", + "\tTEXTURE2D( _TerrainNormalmapTexture);//ASE Terrain Instancing", + "\tSAMPLER(sampler_TerrainNormalmapTexture);//ASE Terrain Instancing", + "#endif//ASE Terrain Instancing", + "UNITY_INSTANCING_BUFFER_START( Terrain )//ASE Terrain Instancing", + "\tUNITY_DEFINE_INSTANCED_PROP( float4, _TerrainPatchInstanceData )//ASE Terrain Instancing", + "UNITY_INSTANCING_BUFFER_END( Terrain)//ASE Terrain Instancing", + "CBUFFER_START( UnityTerrain)//ASE Terrain Instancing", + "\t#ifdef UNITY_INSTANCING_ENABLED//ASE Terrain Instancing", + "\t\tfloat4 _TerrainHeightmapRecipSize;//ASE Terrain Instancing", + "\t\tfloat4 _TerrainHeightmapScale;//ASE Terrain Instancing", + "\t#endif//ASE Terrain Instancing", + "CBUFFER_END//ASE Terrain Instancing" + }; + + private readonly string[] InstancedGlobalsDefault = + { + "#ifdef UNITY_INSTANCING_ENABLED//ASE Terrain Instancing", + "\tsampler2D _TerrainHeightmapTexture;//ASE Terrain Instancing", + "\tsampler2D _TerrainNormalmapTexture;//ASE Terrain Instancing", + "#endif//ASE Terrain Instancing", + "UNITY_INSTANCING_BUFFER_START( Terrain )//ASE Terrain Instancing", + "\tUNITY_DEFINE_INSTANCED_PROP( float4, _TerrainPatchInstanceData )//ASE Terrain Instancing", + "UNITY_INSTANCING_BUFFER_END( Terrain)//ASE Terrain Instancing", + "CBUFFER_START( UnityTerrain)//ASE Terrain Instancing", + "\t#ifdef UNITY_INSTANCING_ENABLED//ASE Terrain Instancing", + "\t\tfloat4 _TerrainHeightmapRecipSize;//ASE Terrain Instancing", + "\t\tfloat4 _TerrainHeightmapScale;//ASE Terrain Instancing", + "\t#endif//ASE Terrain Instancing", + "CBUFFER_END//ASE Terrain Instancing" + }; + + + private readonly string ApplyMeshModificationInstruction = "{0} = ApplyMeshModification({0});"; + + private readonly string[] ApplyMeshModificationFunctionSRP = + { + /*0 - struct name 1 - var name*/"{0} ApplyMeshModification( {0} {1} )\n", + "{\n", + "#ifdef UNITY_INSTANCING_ENABLED\n", + /* 0 vertex position*/"\tfloat2 patchVertex = {0}.xy;\n", + "\tfloat4 instanceData = UNITY_ACCESS_INSTANCED_PROP( Terrain, _TerrainPatchInstanceData );\n", + "\tfloat2 sampleCoords = ( patchVertex.xy + instanceData.xy ) * instanceData.z;\n", + "\tfloat height = UnpackHeightmap( _TerrainHeightmapTexture.Load( int3( sampleCoords, 0 ) ) );\n", + /*0 - vertex position*/"\t{0}.xz = sampleCoords* _TerrainHeightmapScale.xz;\n", + /*0 - vertex position*/"\t{0}.y = height* _TerrainHeightmapScale.y;\n", + "\t#ifdef ENABLE_TERRAIN_PERPIXEL_NORMAL\n", + /* 0 - vertex normal*/"\t\t{0} = float3(0, 1, 0);\n", + "\t#else\n", + /* 0 - vertex normal*/"\t\t{0} = _TerrainNormalmapTexture.Load(int3(sampleCoords, 0)).rgb* 2 - 1;\n", + "\t#endif\n", + "",//"#ifdef ENABLE_TERRAIN_PERPIXEL_NORMAL\n", + "",///* 0 - tex coord*/"\t{0}.xy = sampleCoords;\n", + "",//"#else\n", + /* 0 - tex coord*/"\t{0}.xy = sampleCoords* _TerrainHeightmapRecipSize.zw;\n", + "",//"#endif\n", + "#endif\n", + /* 0 - var name*/"\treturn {0};\n", + "}\n" + }; + //{ + // /*0 - struct name 1 - var name*/"{0} ApplyMeshModification( {0} {1} )\n", + // "{\n", + // "#ifdef UNITY_INSTANCING_ENABLED\n", + // /* 0 vertex position*/"\tfloat2 patchVertex = {0}.xy;\n", + // "\t\tfloat4 instanceData = UNITY_ACCESS_INSTANCED_PROP( Terrain, _TerrainPatchInstanceData );\n", + // "\t\tfloat2 sampleCoords = ( patchVertex.xy + instanceData.xy ) * instanceData.z;\n", + // "\t\tfloat height = UnpackHeightmap( _TerrainHeightmapTexture.Load( int3( sampleCoords, 0 ) ) );\n", + // /*0 - vertex position*/"\t\t{0}.xz = sampleCoords* _TerrainHeightmapScale.xz;\n", + // /*0 - vertex position*/"\t\t{0}.y = height* _TerrainHeightmapScale.y;\n", + // "# ifdef ATTRIBUTES_NEED_NORMAL\n", + // /* 0 - vertex normal*/"\t\t{0} = _TerrainNormalmapTexture.Load(int3(sampleCoords, 0)).rgb* 2 - 1;\n", + // "\t#endif\n", + // "\t#if defined(VARYINGS_NEED_TEXCOORD0) || defined(VARYINGS_DS_NEED_TEXCOORD0)\n", + // "\t\t#ifdef ENABLE_TERRAIN_PERPIXEL_NORMAL\n", + // /* 0 - tex coord*/"\t\t\t{0} = sampleCoords;\n", + // "\t\t#else\n", + // /* 0 - tex coord*/"\t\t\t{0}.xy = sampleCoords* _TerrainHeightmapRecipSize.zw;\n", + // "\t\t#endif\n", + // "\t#endif\n", + // "#endif\n", + // "#ifdef ATTRIBUTES_NEED_TANGENT\n", + // /* 0 - tangent 1 - normal*/"\t\t{0}.xyz = cross( {1}, float3(0, 0, 1));\n", + // /*0 - tangent*/"\t{0}.w = -1;\n", + // "#endif\n", + // /* 0 - var name*/"\treturn {0};\n", + // "}\n" + //}; + + + + private readonly string[] ApplyMeshModificationFunctionDefaultTemplate = + { + /* 0 vertex struct */"{0} ApplyMeshModification( {0} {1} )", + "{\n", + "#ifdef UNITY_INSTANCING_ENABLED\n", + /*0 - vertex pos*/"\tfloat2 patchVertex = {0}.xy;\n", + "\tfloat4 instanceData = UNITY_ACCESS_INSTANCED_PROP( Terrain, _TerrainPatchInstanceData );\n", + + "\tfloat4 uvscale = instanceData.z * _TerrainHeightmapRecipSize;\n" + + "\tfloat4 uvoffset = instanceData.xyxy * uvscale;\n" + + "\tuvoffset.xy += 0.5f * _TerrainHeightmapRecipSize.xy;\n" + + "\tfloat2 sampleCoords = (patchVertex.xy * uvscale.xy + uvoffset.xy);\n", + /* 0 - tex coords*/"\t{0} = float4(patchVertex.xy * uvscale.zw + uvoffset.zw, 0, 0);\n", + /* 0 - tex coords*/"\tfloat height = UnpackHeightmap( tex2Dlod( _TerrainHeightmapTexture, float4(sampleCoords, 0, 0) ) );\n", + /* 0 - vertex pos*/"\t{0}.xz = (patchVertex.xy + instanceData.xy) * _TerrainHeightmapScale.xz * instanceData.z;\n", + /* 0 - vertex pos*/"\t{0}.y = height * _TerrainHeightmapScale.y;\n", + /* 0 - normal 1 - tex coord*/"\t{0} = tex2Dlod( _TerrainNormalmapTexture, {1} ).rgb * 2 - 1;\n", + "#endif\n", + /* var name*/"return {0};\n", + "}\n" + }; + + private readonly string ApplyMeshModificationInstructionStandard = "ApplyMeshModification({0});"; + private readonly string[] ApplyMeshModificationFunctionStandard = + { + "void ApplyMeshModification( inout {0} v )", + "#if defined(UNITY_INSTANCING_ENABLED) && !defined(SHADER_API_D3D11_9X)", + "\tfloat2 patchVertex = v.vertex.xy;", + "\tfloat4 instanceData = UNITY_ACCESS_INSTANCED_PROP(Terrain, _TerrainPatchInstanceData);", + "\t", + "\tfloat4 uvscale = instanceData.z * _TerrainHeightmapRecipSize;", + "\tfloat4 uvoffset = instanceData.xyxy * uvscale;", + "\tuvoffset.xy += 0.5f * _TerrainHeightmapRecipSize.xy;", + "\tfloat2 sampleCoords = (patchVertex.xy * uvscale.xy + uvoffset.xy);", + "\t", + "\tfloat hm = UnpackHeightmap(tex2Dlod(_TerrainHeightmapTexture, float4(sampleCoords, 0, 0)));", + "\tv.vertex.xz = (patchVertex.xy + instanceData.xy) * _TerrainHeightmapScale.xz * instanceData.z;", + "\tv.vertex.y = hm * _TerrainHeightmapScale.y;", + "\tv.vertex.w = 1.0f;", + "\t", + "\tv.texcoord.xy = (patchVertex.xy * uvscale.zw + uvoffset.zw);", + "\tv.texcoord3 = v.texcoord2 = v.texcoord1 = v.texcoord;", + "\t", + "\t#ifdef TERRAIN_INSTANCED_PERPIXEL_NORMAL", + "\t\tv.normal = float3(0, 1, 0);", + "\t\t//data.tc.zw = sampleCoords;", + "\t#else", + "\t\tfloat3 nor = tex2Dlod(_TerrainNormalmapTexture, float4(sampleCoords, 0, 0)).xyz;", + "\t\tv.normal = 2.0f * nor - 1.0f;", + "\t#endif", + "#endif", + }; + private readonly string[] AdditionalUsePasses = + { + "Hidden/Nature/Terrain/Utilities/PICKING", + "Hidden/Nature/Terrain/Utilities/SELECTION" + }; + private readonly string DrawInstancedLabel = "Instanced Terrain"; + + [SerializeField] + private bool m_enable = false; + + public void Draw( UndoParentNode owner ) + { + m_enable = owner.EditorGUILayoutToggle( DrawInstancedLabel, m_enable ); + } + + public void UpdateDataCollectorForTemplates( ref MasterNodeDataCollector dataCollector, ref List vertexInstructions ) + { + if( m_enable ) + { + for( int i = 0; i < AdditionalUsePasses.Length; i++ ) + { + dataCollector.AddUsePass( AdditionalUsePasses[ i ], false ); + } + + string[] instancedPragmas = dataCollector.IsSRP ? InstancedPragmasSRP : InstancedPragmas; + for( int i = 0; i < instancedPragmas.Length; i++ ) + { + dataCollector.AddToPragmas( -1, instancedPragmas[ i ] ); + } + + if( dataCollector.IsSRP ) + { + + TemplateFunctionData functionData = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData; + string uvCoord = dataCollector.TemplateDataCollectorInstance.GetUV( 0, MasterNodePortCategory.Vertex ); + string vertexNormal = dataCollector.TemplateDataCollectorInstance.GetVertexNormal( PrecisionType.Float, false, MasterNodePortCategory.Vertex ); + //string vertexTangent = dataCollector.TemplateDataCollectorInstance.GetVertexTangent( WirePortDataType.FLOAT4, PrecisionType.Float, false, MasterNodePortCategory.Vertex ); + string vertexPos = dataCollector.TemplateDataCollectorInstance.GetVertexPosition( WirePortDataType.OBJECT, PrecisionType.Float, false, MasterNodePortCategory.Vertex ); + + string functionHeader = string.Format( ApplyMeshModificationFunctionSRP[ 0 ], functionData.InVarType, functionData.InVarName ); + + //string functionBody = functionHeader + + // ApplyMeshModificationFunctionSRP[ 1 ] + + // ApplyMeshModificationFunctionSRP[ 2 ] + + // string.Format( ApplyMeshModificationFunctionSRP[ 3 ], vertexPos ) + + // ApplyMeshModificationFunctionSRP[ 4 ] + + // ApplyMeshModificationFunctionSRP[ 5 ] + + // ApplyMeshModificationFunctionSRP[ 6 ] + + // string.Format( ApplyMeshModificationFunctionSRP[ 7 ], vertexPos ) + + // string.Format( ApplyMeshModificationFunctionSRP[ 8 ], vertexPos ) + + // ApplyMeshModificationFunctionSRP[ 9 ] + + // string.Format( ApplyMeshModificationFunctionSRP[ 10 ], vertexNormal ) + + // ApplyMeshModificationFunctionSRP[ 11 ] + + // ApplyMeshModificationFunctionSRP[ 12 ] + + // ApplyMeshModificationFunctionSRP[ 13 ] + + // string.Format( ApplyMeshModificationFunctionSRP[ 14 ], uvCoord ) + + // ApplyMeshModificationFunctionSRP[ 15 ] + + // string.Format( ApplyMeshModificationFunctionSRP[ 16 ], uvCoord ) + + // ApplyMeshModificationFunctionSRP[ 17 ] + + // ApplyMeshModificationFunctionSRP[ 18 ] + + // ApplyMeshModificationFunctionSRP[ 19 ] + + // ApplyMeshModificationFunctionSRP[ 20 ] + + // string.Format( ApplyMeshModificationFunctionSRP[ 21 ], vertexTangent, vertexNormal ) + + // string.Format( ApplyMeshModificationFunctionSRP[ 22 ], vertexTangent ) + + // ApplyMeshModificationFunctionSRP[ 23 ] + + // string.Format( ApplyMeshModificationFunctionSRP[ 24 ], functionData.InVarName ) + + // ApplyMeshModificationFunctionSRP[ 25 ]; + string functionBody = functionHeader + + ApplyMeshModificationFunctionSRP[ 1 ] + + ApplyMeshModificationFunctionSRP[ 2 ] + + string.Format( ApplyMeshModificationFunctionSRP[ 3 ], vertexPos ) + + ApplyMeshModificationFunctionSRP[ 4 ] + + ApplyMeshModificationFunctionSRP[ 5 ] + + ApplyMeshModificationFunctionSRP[ 6 ] + + string.Format( ApplyMeshModificationFunctionSRP[ 7 ], vertexPos ) + + string.Format( ApplyMeshModificationFunctionSRP[ 8 ], vertexPos ) + + ApplyMeshModificationFunctionSRP[ 9 ] + + string.Format( ApplyMeshModificationFunctionSRP[ 10 ], vertexNormal ) + + ApplyMeshModificationFunctionSRP[ 11 ] + + string.Format( ApplyMeshModificationFunctionSRP[ 12 ], vertexNormal ) + + ApplyMeshModificationFunctionSRP[ 13 ] + + ApplyMeshModificationFunctionSRP[ 14 ] + + string.Format( ApplyMeshModificationFunctionSRP[ 15 ], uvCoord ) + + ApplyMeshModificationFunctionSRP[ 16 ] + + string.Format( ApplyMeshModificationFunctionSRP[ 17 ], uvCoord ) + + ApplyMeshModificationFunctionSRP[ 18 ] + + ApplyMeshModificationFunctionSRP[ 19 ] + + string.Format( ApplyMeshModificationFunctionSRP[ 20 ], functionData.InVarName ) + + ApplyMeshModificationFunctionSRP[ 21 ]; + dataCollector.AddFunction( functionHeader, functionBody ); + + for( int i = 0; i < InstancedGlobalsSRP.Length; i++ ) + { + dataCollector.AddToUniforms( -1, InstancedGlobalsSRP[ i ] ); + } + + + string vertexVarName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData.InVarName; + vertexInstructions.Insert( 0, string.Format( ApplyMeshModificationInstruction, vertexVarName ) ); + } + else + { + TemplateFunctionData functionData = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData; + + string uvCoord = dataCollector.TemplateDataCollectorInstance.GetUV( 0, MasterNodePortCategory.Vertex ); + string vertexNormal = dataCollector.TemplateDataCollectorInstance.GetVertexNormal( PrecisionType.Float, false, MasterNodePortCategory.Vertex ); + string vertexPos = dataCollector.TemplateDataCollectorInstance.GetVertexPosition( WirePortDataType.OBJECT, PrecisionType.Float, false, MasterNodePortCategory.Vertex ); + + string functionHeader = string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 0 ], functionData.InVarType, functionData.InVarName ); + string functionBody = functionHeader + + ApplyMeshModificationFunctionDefaultTemplate[ 1 ] + + ApplyMeshModificationFunctionDefaultTemplate[ 2 ] + + string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 3 ], vertexPos ) + + ApplyMeshModificationFunctionDefaultTemplate[ 4 ] + + ApplyMeshModificationFunctionDefaultTemplate[ 5 ] + + string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 6 ], uvCoord ) + + string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 7 ], uvCoord ) + + string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 8 ], vertexPos ) + + string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 9 ], vertexPos ) + + string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 10 ], vertexNormal, uvCoord ) + + ApplyMeshModificationFunctionDefaultTemplate[ 11 ] + + string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 12 ], functionData.InVarName ) + + ApplyMeshModificationFunctionDefaultTemplate[ 13 ]; + + + dataCollector.AddFunction( functionHeader, functionBody ); + for( int i = 0; i < InstancedGlobalsDefault.Length; i++ ) + { + dataCollector.AddToUniforms( -1, InstancedGlobalsDefault[ i ] ); + } + + + string vertexVarName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData.InVarName; + vertexInstructions.Insert( 0, string.Format( ApplyMeshModificationInstruction, vertexVarName ) ); + + } + } + } + + public void UpdateDataCollectorForStandard( ref MasterNodeDataCollector dataCollector ) + { + if( m_enable ) + { + for( int i = 0; i < AdditionalUsePasses.Length; i++ ) + { + dataCollector.AddUsePass( AdditionalUsePasses[ i ], false ); + } + + for( int i = 0; i < InstancedPragmas.Length; i++ ) + { + dataCollector.AddToPragmas( -1, InstancedPragmas[ i ] ); + } + string functionBody = string.Empty; + + string functionHeader = string.Format( ApplyMeshModificationFunctionStandard[ 0 ], dataCollector.SurfaceVertexStructure ); + IOUtils.AddFunctionHeader( ref functionBody, functionHeader ); + for( int i = 1; i < ApplyMeshModificationFunctionStandard.Length; i++ ) + { + IOUtils.AddFunctionLine( ref functionBody, ApplyMeshModificationFunctionStandard[ i ] ); + } + IOUtils.CloseFunctionBody( ref functionBody ); + + //string inputName = "input"; + //string uvCoord = "input.texcoord"; + //string vertexNormal = "input.normal"; + //string vertexPos = "input.vertex"; + + //string functionHeader = string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 0 ], dataCollector.SurfaceVertexStructure, inputName ); + //IOUtils.AddFunctionHeader( ref functionBody, functionHeader ); + //IOUtils.AddFunctionLine( ref functionBody, ApplyMeshModificationFunctionDefaultTemplate[ 1 ] ); + //IOUtils.AddFunctionLine( ref functionBody,ApplyMeshModificationFunctionDefaultTemplate[ 2 ] ); + //IOUtils.AddFunctionLine( ref functionBody,string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 3 ], vertexPos ) ); + //IOUtils.AddFunctionLine( ref functionBody,ApplyMeshModificationFunctionDefaultTemplate[ 4 ] ); + //IOUtils.AddFunctionLine( ref functionBody,ApplyMeshModificationFunctionDefaultTemplate[ 5 ] ); + //IOUtils.AddFunctionLine( ref functionBody,string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 6 ], uvCoord ) ); + //IOUtils.AddFunctionLine( ref functionBody,string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 7 ], uvCoord ) ); + //IOUtils.AddFunctionLine( ref functionBody,string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 8 ], vertexPos ) ); + //IOUtils.AddFunctionLine( ref functionBody,string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 9 ], vertexPos ) ); + //IOUtils.AddFunctionLine( ref functionBody,string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 10 ], vertexNormal, uvCoord ) ); + //IOUtils.AddFunctionLine( ref functionBody,ApplyMeshModificationFunctionDefaultTemplate[ 11 ] ); + //IOUtils.AddFunctionLine( ref functionBody,string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 12 ], inputName ) ); + //IOUtils.AddFunctionLine( ref functionBody, ApplyMeshModificationFunctionDefaultTemplate[ 13 ] ); + //IOUtils.CloseFunctionBody( ref functionBody ); + + dataCollector.AddFunction( functionHeader, functionBody ); + for( int i = 0; i < InstancedGlobalsDefault.Length; i++ ) + { + dataCollector.AddToUniforms( -1, InstancedGlobalsDefault[ i ] ); + } + + dataCollector.AddVertexInstruction( string.Format( ApplyMeshModificationInstructionStandard, "v" ) ); + } + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + m_enable = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + public void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_enable ); + } + + public bool Enabled { get { return m_enable; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs.meta new file mode 100644 index 00000000..658eecd2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 935c69709205e1c4dbd54da410518cc6 +timeCreated: 1548263010 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs new file mode 100644 index 00000000..11a392bc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs @@ -0,0 +1,654 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + public sealed class TessellationOpHelper + { + public const string TessellationPortStr = "Tessellation"; + + + public const string TessSurfParam = "tessellate:tessFunction"; + public const string TessInclude = "Tessellation.cginc"; + //public const string CustomAppData = "\t\tstruct appdata\n" + + // "\t\t{\n" + + // "\t\t\tfloat4 vertex : POSITION;\n" + + // "\t\t\tfloat4 tangent : TANGENT;\n" + + // "\t\t\tfloat3 normal : NORMAL;\n" + + // "\t\t\tfloat4 texcoord : TEXCOORD0;\n" + + // "\t\t\tfloat4 texcoord1 : TEXCOORD1;\n" + + // "\t\t\tfloat4 texcoord2 : TEXCOORD2;\n" + + // "\t\t\tfloat4 texcoord3 : TEXCOORD3;\n" + + // "\t\t\tfixed4 color : COLOR;\n" + + // "\t\t\tUNITY_VERTEX_INPUT_INSTANCE_ID\n" + + // "\t\t};\n\n"; + + + + private const string TessUniformName = "_TessValue"; + private const string TessMinUniformName = "_TessMin"; + private const string TessMaxUniformName = "_TessMax"; + + //private GUIContent EnableTessContent = new GUIContent( "Tessellation", "Activates the use of tessellation which subdivides polygons to increase geometry detail using a set of rules\nDefault: OFF" ); + private GUIContent TessFactorContent = new GUIContent( "Tess", "Tessellation factor\nDefault: 4" ); + private GUIContent TessMinDistanceContent = new GUIContent( "Min", "Minimum tessellation distance\nDefault: 10" ); + private GUIContent TessMaxDistanceContent = new GUIContent( "Max", "Maximum tessellation distance\nDefault: 25" ); + + + private readonly int[] TesselationTypeValues = { 0, 1, 2, 3 }; + private readonly string[] TesselationTypeLabels = { "Distance-based", "Fixed", "Edge Length", "Edge Length Cull" }; + private readonly string TesselationTypeStr = "Type"; + + private const string TessProperty = "_TessValue( \"Max Tessellation\", Range( 1, 32 ) ) = {0}"; + private const string TessMinProperty = "_TessMin( \"Tess Min Distance\", Float ) = {0}"; + private const string TessMaxProperty = "_TessMax( \"Tess Max Distance\", Float ) = {0}"; + + private const string TessFunctionOpen = "\t\tfloat4 tessFunction( {0} v0, {0} v1, {0} v2 )\n\t\t{{\n"; + private const string TessFunctionClose = "\t\t}\n"; + + // Custom function + private const string CustomFunctionBody = "\t\t\treturn {0};\n"; + + // Distance based function + private const string DistBasedTessFunctionBody = "\t\t\treturn UnityDistanceBasedTess( v0.vertex, v1.vertex, v2.vertex, _TessMin, _TessMax, _TessValue );\n"; + + // Fixed amount function + private const string FixedAmountTessFunctionOpen = "\t\tfloat4 tessFunction( )\n\t\t{\n"; + private const string FixedAmountTessFunctionBody = "\t\t\treturn _TessValue;\n"; + + // Edge Length + private GUIContent EdgeLengthContent = new GUIContent( "Edge Length", "Tessellation levels ccomputed based on triangle edge length on the screen\nDefault: 4" ); + private const string EdgeLengthTessProperty = "_EdgeLength ( \"Edge length\", Range( 2, 50 ) ) = {0}"; + private const string EdgeLengthTessUniformName = "_EdgeLength"; + + private const string EdgeLengthTessFunctionBody = "\t\t\treturn UnityEdgeLengthBasedTess (v0.vertex, v1.vertex, v2.vertex, _EdgeLength);\n"; + private const string EdgeLengthTessCullFunctionBody = "\t\t\treturn UnityEdgeLengthBasedTessCull (v0.vertex, v1.vertex, v2.vertex, _EdgeLength , _TessMaxDisp );\n"; + + + private const string EdgeLengthTessMaxDispProperty = "_TessMaxDisp( \"Max Displacement\", Float ) = {0}"; + private const string EdgeLengthTessMaxDispUniformName = "_TessMaxDisp"; + private GUIContent EdgeLengthTessMaxDisplacementContent = new GUIContent( "Max Disp.", "Max Displacement" ); + + // Phong + private GUIContent PhongEnableContent = new GUIContent( "Phong", "Modifies positions of the subdivided faces so that the resulting surface follows the mesh normals a bit\nDefault: OFF" ); + private GUIContent PhongStrengthContent = new GUIContent( "Strength", "Strength\nDefault: 0.5" ); + public const string PhongStrengthParam = "tessphong:_TessPhongStrength"; + + private const string PhongStrengthProperty = "_TessPhongStrength( \"Phong Tess Strength\", Range( 0, 1 ) ) = {0}"; + private const string PhongStrengthUniformName = "_TessPhongStrength"; + + [SerializeField] + private bool m_enabled = false; + + //private bool m_expanded = false; + + [SerializeField] + private int m_tessType = 2; + + [SerializeField] + private float m_tessMinDistance = 10f; + + [SerializeField] + private float m_tessMaxDistance = 25f; + + [SerializeField] + private float m_tessFactor = 15f; + + [SerializeField] + private float m_phongStrength = 0.5f; + + [SerializeField] + private bool m_phongEnabled = false; + + [SerializeField] + private string[] m_customData = { string.Empty, string.Empty, string.Empty }; + + [SerializeField] + private bool m_hasCustomFunction = false; + + [SerializeField] + private string m_customFunction = String.Empty; + + [SerializeField] + private string m_additionalData = string.Empty; + + [SerializeField] + private StandardSurfaceOutputNode m_parentSurface; + + private Dictionary m_additionalDataDict = new Dictionary(); + + private int m_masterNodeIndexPort = 0; + private int m_vertexOffsetIndexPort = 0; + //private int m_orderIndex = 1000; + + public void Draw( UndoParentNode owner, GUIStyle toolbarstyle, Material mat, bool connectedInput ) + { + Color cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); + EditorGUILayout.BeginHorizontal( toolbarstyle ); + GUI.color = cachedColor; + EditorGUI.BeginChangeCheck(); + m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedTesselation = GUILayout.Toggle( m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedTesselation, " Tessellation", UIUtils.MenuItemToggleStyle, GUILayout.ExpandWidth( true ) ); + if ( EditorGUI.EndChangeCheck() ) + { + EditorPrefs.SetBool( "ExpandedTesselation", m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedTesselation ); + } + + EditorGUI.BeginChangeCheck(); + m_enabled = owner.EditorGUILayoutToggle( string.Empty, m_enabled, UIUtils.MenuItemEnableStyle, GUILayout.Width( 16 ) ); + if ( EditorGUI.EndChangeCheck() ) + { + if ( m_enabled ) + UpdateToMaterial( mat, !connectedInput ); + + UIUtils.RequestSave(); + } + + EditorGUILayout.EndHorizontal(); + + m_enabled = m_enabled || connectedInput; + + if ( m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedTesselation ) + { + cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); + EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); + GUI.color = cachedColor; + + EditorGUILayout.Separator(); + EditorGUI.BeginDisabledGroup( !m_enabled ); + + EditorGUI.indentLevel += 1; + + m_phongEnabled = owner.EditorGUILayoutToggle( PhongEnableContent, m_phongEnabled ); + if ( m_phongEnabled ) + { + EditorGUI.indentLevel += 1; + EditorGUI.BeginChangeCheck(); + m_phongStrength = owner.EditorGUILayoutSlider( PhongStrengthContent, m_phongStrength, 0.0f, 1.0f ); + if ( EditorGUI.EndChangeCheck() && mat != null ) + { + if ( mat.HasProperty( PhongStrengthUniformName ) ) + mat.SetFloat( PhongStrengthUniformName, m_phongStrength ); + } + + EditorGUI.indentLevel -= 1; + } + + bool guiEnabled = GUI.enabled; + GUI.enabled = !connectedInput && m_enabled; + + m_tessType = owner.EditorGUILayoutIntPopup( TesselationTypeStr, m_tessType, TesselationTypeLabels, TesselationTypeValues ); + + switch ( m_tessType ) + { + case 0: + { + EditorGUI.BeginChangeCheck(); + m_tessFactor = owner.EditorGUILayoutSlider( TessFactorContent, m_tessFactor, 1, 32 ); + if ( EditorGUI.EndChangeCheck() && mat != null ) + { + if ( mat.HasProperty( TessUniformName ) ) + mat.SetFloat( TessUniformName, m_tessFactor ); + } + + EditorGUI.BeginChangeCheck(); + m_tessMinDistance = owner.EditorGUILayoutFloatField( TessMinDistanceContent, m_tessMinDistance ); + if ( EditorGUI.EndChangeCheck() && mat != null ) + { + if ( mat.HasProperty( TessMinUniformName ) ) + mat.SetFloat( TessMinUniformName, m_tessMinDistance ); + } + + EditorGUI.BeginChangeCheck(); + m_tessMaxDistance = owner.EditorGUILayoutFloatField( TessMaxDistanceContent, m_tessMaxDistance ); + if ( EditorGUI.EndChangeCheck() && mat != null ) + { + if ( mat.HasProperty( TessMaxUniformName ) ) + mat.SetFloat( TessMaxUniformName, m_tessMaxDistance ); + } + } + break; + case 1: + { + EditorGUI.BeginChangeCheck(); + m_tessFactor = owner.EditorGUILayoutSlider( TessFactorContent, m_tessFactor, 1, 32 ); + if ( EditorGUI.EndChangeCheck() && mat != null ) + { + if ( mat.HasProperty( TessUniformName ) ) + mat.SetFloat( TessUniformName, m_tessFactor ); + } + } + break; + case 2: + { + EditorGUI.BeginChangeCheck(); + m_tessFactor = owner.EditorGUILayoutSlider( EdgeLengthContent, m_tessFactor, 2, 50 ); + if ( EditorGUI.EndChangeCheck() && mat != null ) + { + if ( mat.HasProperty( EdgeLengthTessUniformName ) ) + mat.SetFloat( EdgeLengthTessUniformName, m_tessFactor ); + } + } + break; + case 3: + { + EditorGUI.BeginChangeCheck(); + m_tessFactor = owner.EditorGUILayoutSlider( EdgeLengthContent, m_tessFactor, 2, 50 ); + if ( EditorGUI.EndChangeCheck() && mat != null ) + { + if ( mat.HasProperty( EdgeLengthTessUniformName ) ) + mat.SetFloat( EdgeLengthTessUniformName, m_tessFactor ); + } + + EditorGUI.BeginChangeCheck(); + m_tessMaxDistance = owner.EditorGUILayoutFloatField( EdgeLengthTessMaxDisplacementContent, m_tessMaxDistance ); + if ( EditorGUI.EndChangeCheck() && mat != null ) + { + if ( mat.HasProperty( TessMinUniformName ) ) + mat.SetFloat( TessMinUniformName, m_tessMaxDistance ); + } + } + break; + } + GUI.enabled = guiEnabled; + EditorGUI.indentLevel -= 1; + EditorGUI.EndDisabledGroup(); + EditorGUILayout.Separator(); + EditorGUILayout.EndVertical(); + } + } + + public void UpdateToMaterial( Material mat, bool updateInternals ) + { + if ( mat == null ) + return; + + if ( m_phongEnabled ) + { + if ( mat.HasProperty( PhongStrengthUniformName ) ) + mat.SetFloat( PhongStrengthUniformName, m_phongStrength ); + } + + if ( updateInternals ) + { + switch ( m_tessType ) + { + case 0: + { + if ( mat.HasProperty( TessUniformName ) ) + mat.SetFloat( TessUniformName, m_tessFactor ); + + if ( mat.HasProperty( TessMinUniformName ) ) + mat.SetFloat( TessMinUniformName, m_tessMinDistance ); + + if ( mat.HasProperty( TessMaxUniformName ) ) + mat.SetFloat( TessMaxUniformName, m_tessMaxDistance ); + } + break; + case 1: + { + if ( mat.HasProperty( TessUniformName ) ) + mat.SetFloat( TessUniformName, m_tessFactor ); + } + break; + case 2: + { + + if ( mat.HasProperty( EdgeLengthTessUniformName ) ) + mat.SetFloat( EdgeLengthTessUniformName, m_tessFactor ); + } + break; + case 3: + { + if ( mat.HasProperty( EdgeLengthTessUniformName ) ) + mat.SetFloat( EdgeLengthTessUniformName, m_tessFactor ); + + if ( mat.HasProperty( TessMinUniformName ) ) + mat.SetFloat( TessMinUniformName, m_tessMaxDistance ); + } + break; + } + } + } + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + m_enabled = Convert.ToBoolean( nodeParams[ index++ ] ); + m_tessType = Convert.ToInt32( nodeParams[ index++ ] ); + m_tessFactor = Convert.ToSingle( nodeParams[ index++ ] ); + m_tessMinDistance = Convert.ToSingle( nodeParams[ index++ ] ); + m_tessMaxDistance = Convert.ToSingle( nodeParams[ index++ ] ); + if ( UIUtils.CurrentShaderVersion() > 3001 ) + { + m_phongEnabled = Convert.ToBoolean( nodeParams[ index++ ] ); + m_phongStrength = Convert.ToSingle( nodeParams[ index++ ] ); + } + } + + public void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_enabled ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_tessType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_tessFactor ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_tessMinDistance ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_tessMaxDistance ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_phongEnabled ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_phongStrength ); + } + + public string Uniforms() + { + string uniforms = string.Empty; + switch( m_tessType ) + { + case 0: + { + if( !m_hasCustomFunction ) + { + + //Tess + uniforms += "\t\tuniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessUniformName + ";\n"; + + //Min + uniforms += "\t\tuniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessMinUniformName + ";\n"; + + //Max + uniforms += "\t\tuniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessMaxUniformName + ";\n"; + } + } + break; + case 1: + //Tess + if( !m_hasCustomFunction ) + { + uniforms += "\t\tuniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessUniformName + ";\n"; + } + break; + case 2: + if( !m_hasCustomFunction ) + { + uniforms += "\t\tuniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float , WirePortDataType.FLOAT ) + " " + EdgeLengthTessUniformName + ";\n"; + } + break; + case 3: + if( !m_hasCustomFunction ) + { + uniforms += "\t\tuniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float , WirePortDataType.FLOAT ) + " " + EdgeLengthTessUniformName + ";\n"; + uniforms += "\t\tuniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float , WirePortDataType.FLOAT ) + " " + EdgeLengthTessMaxDispUniformName + ";\n"; + } + break; + } + + if( m_phongEnabled ) + { + uniforms += "\t\tuniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + PhongStrengthUniformName + ";\n" ; + } + + return uniforms; + } + + public void AddToDataCollector( ref MasterNodeDataCollector dataCollector, int reorder ) + { + int orderIndex = reorder; + switch ( m_tessType ) + { + case 0: + { + dataCollector.AddToIncludes( -1, TessellationOpHelper.TessInclude ); + if ( !m_hasCustomFunction ) + { + //Tess + dataCollector.AddToProperties( -1, string.Format( TessProperty, m_tessFactor ), orderIndex++ ); + dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessUniformName + ";" ); + + //Min + dataCollector.AddToProperties( -1, string.Format( TessMinProperty, m_tessMinDistance ), orderIndex++ ); + dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessMinUniformName + ";" ); + + //Max + dataCollector.AddToProperties( -1, string.Format( TessMaxProperty, m_tessMaxDistance ), orderIndex++ ); + dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessMaxUniformName + ";" ); + } + } + break; + case 1: + { + //Tess + if ( !m_hasCustomFunction ) + { + dataCollector.AddToProperties( -1, string.Format( TessProperty, m_tessFactor ), orderIndex++ ); + dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessUniformName + ";" ); + } + } + break; + case 2: + { + dataCollector.AddToIncludes( -1, TessellationOpHelper.TessInclude ); + + //Tess + if ( !m_hasCustomFunction ) + { + dataCollector.AddToProperties( -1, string.Format( EdgeLengthTessProperty, m_tessFactor ), orderIndex++ ); + dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + EdgeLengthTessUniformName + ";" ); + } + } + break; + case 3: + { + dataCollector.AddToIncludes( -1, TessellationOpHelper.TessInclude ); + + if ( !m_hasCustomFunction ) + { + //Tess + dataCollector.AddToProperties( -1, string.Format( EdgeLengthTessProperty, m_tessFactor ), orderIndex++ ); + dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + EdgeLengthTessUniformName + ";" ); + + //Max Displacement + dataCollector.AddToProperties( -1, string.Format( EdgeLengthTessMaxDispProperty, m_tessMaxDistance ), orderIndex++ ); + dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + EdgeLengthTessMaxDispUniformName + ";" ); + } + } + break; + } + + if ( m_phongEnabled ) + { + dataCollector.AddToProperties( -1, string.Format( PhongStrengthProperty, m_phongStrength ), orderIndex++ ); + dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + PhongStrengthUniformName + ";" ); + } + } + + //ToDo: Optimize material property fetches to use Id instead of string + public void UpdateFromMaterial( Material mat ) + { + if ( m_enabled ) + { + if ( m_phongEnabled ) + { + if ( mat.HasProperty( PhongStrengthUniformName ) ) + m_phongStrength = mat.GetFloat( PhongStrengthUniformName ); + } + + switch ( m_tessType ) + { + case 0: + { + if ( mat.HasProperty( TessUniformName ) ) + m_tessFactor = mat.GetFloat( TessUniformName ); + + if ( mat.HasProperty( TessMinUniformName ) ) + m_tessMinDistance = mat.GetFloat( TessMinUniformName ); + + if ( mat.HasProperty( TessMaxUniformName ) ) + m_tessMaxDistance = mat.GetFloat( TessMaxUniformName ); + } + break; + case 1: + { + if ( mat.HasProperty( TessUniformName ) ) + m_tessFactor = mat.GetFloat( TessUniformName ); + } + break; + case 2: + { + if ( mat.HasProperty( EdgeLengthTessUniformName ) ) + m_tessFactor = mat.GetFloat( EdgeLengthTessUniformName ); + } + break; + case 3: + { + if ( mat.HasProperty( EdgeLengthTessUniformName ) ) + m_tessFactor = mat.GetFloat( EdgeLengthTessUniformName ); + + if ( mat.HasProperty( EdgeLengthTessMaxDispUniformName ) ) + m_tessMaxDistance = mat.GetFloat( EdgeLengthTessMaxDispUniformName ); + } + break; + } + } + } + + public void WriteToOptionalParams( ref string optionalParams ) + { + optionalParams += TessellationOpHelper.TessSurfParam + Constants.OptionalParametersSep; + if ( m_phongEnabled ) + { + optionalParams += TessellationOpHelper.PhongStrengthParam + Constants.OptionalParametersSep; + } + } + + public void Reset() + { + m_hasCustomFunction = false; + m_customFunction = string.Empty; + + m_additionalData = string.Empty; + m_additionalDataDict.Clear(); + switch ( m_tessType ) + { + case 0: + { + m_customData[ 0 ] = TessUniformName; + m_customData[ 1 ] = TessMinUniformName; + m_customData[ 2 ] = TessMaxUniformName; + } + break; + case 1: + { + m_customData[ 0 ] = TessUniformName; + m_customData[ 1 ] = string.Empty; + m_customData[ 2 ] = string.Empty; + } + break; + case 2: + { + m_customData[ 0 ] = EdgeLengthTessUniformName; + m_customData[ 1 ] = string.Empty; + m_customData[ 2 ] = string.Empty; + } + break; + case 3: + { + m_customData[ 0 ] = EdgeLengthTessUniformName; + m_customData[ 1 ] = EdgeLengthTessMaxDispUniformName; + m_customData[ 2 ] = string.Empty; + } + break; + } + } + + public string GetCurrentTessellationFunction( ref MasterNodeDataCollector dataCollector ) + { + string finalTessFunctionOpen = string.Format( TessFunctionOpen , dataCollector.SurfaceVertexStructure ); + + if ( m_hasCustomFunction ) + { + return finalTessFunctionOpen + + m_customFunction + + TessFunctionClose; + } + + string tessFunction = string.Empty; + switch ( m_tessType ) + { + case 0: + { + tessFunction = finalTessFunctionOpen + + DistBasedTessFunctionBody + + TessFunctionClose; + } + break; + case 1: + { + tessFunction = FixedAmountTessFunctionOpen + + FixedAmountTessFunctionBody + + TessFunctionClose; + } + break; + case 2: + { + tessFunction = finalTessFunctionOpen + + EdgeLengthTessFunctionBody + + TessFunctionClose; + } + break; + case 3: + { + tessFunction = finalTessFunctionOpen + + EdgeLengthTessCullFunctionBody + + TessFunctionClose; + } + break; + } + return tessFunction; + } + + public void AddAdditionalData( string data ) + { + if ( !m_additionalDataDict.ContainsKey( data ) ) + { + m_additionalDataDict.Add( data, true ); + m_additionalData += data; + } + } + + public void AddCustomFunction( string returnData ) + { + m_hasCustomFunction = true; + m_customFunction = m_additionalData + string.Format( CustomFunctionBody, returnData ); + } + + public void Destroy() + { + m_additionalDataDict.Clear(); + m_additionalDataDict = null; + } + + public bool IsTessellationPort( int index ) + { + return index == m_masterNodeIndexPort; + } + + public bool EnableTesselation { get { return m_enabled; } } + + public int TessType { get { return m_tessType; } } + public int MasterNodeIndexPort + { + get { return m_masterNodeIndexPort; } + set { m_masterNodeIndexPort = value; } + } + public int VertexOffsetIndexPort + { + get { return m_vertexOffsetIndexPort; } + set { m_vertexOffsetIndexPort = value; } + } + + public StandardSurfaceOutputNode ParentSurface { get { return m_parentSurface; } set { m_parentSurface = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs.meta new file mode 100644 index 00000000..1e5a23b9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c6fbad94b0fc6b948be3a3dc61232c05 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs new file mode 100644 index 00000000..2a6ca837 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs @@ -0,0 +1,360 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using UnityEditorInternal; + +namespace AmplifyShaderEditor +{ + public enum UsePassLocation + { + Above, + Below + } + + [Serializable] + public class UsePassItem : ScriptableObject + { + public UsePassLocation Location; + public string Value; + public UsePassItem() + { + Location = UsePassLocation.Above; + Value = string.Empty; + } + + public UsePassItem( UsePassLocation location, string name ) + { + Location = location; + Value = name; + } + + } + + [Serializable] + public class UsePassHelper : ScriptableObject + { + private const string UseGrabFormatNewLine = "UsePass \"{0}\"\n"; + private const string UseGrabFormat = "UsePass \"{0}\""; + private const float ShaderKeywordButtonLayoutWidth = 15; + private const string ShaderPoputContext = "CONTEXT/ShaderPopup"; + + [SerializeField] + private List m_items = new List(); + + [SerializeField] + private UndoParentNode m_owner = null; + + [SerializeField] + protected bool m_isDirty = false; + + [SerializeField] + protected string m_moduleName = string.Empty; + + private ReorderableList m_reordableList = null; + private ReordableAction m_actionType = ReordableAction.None; + private int m_actionIndex = 0; + private GUIStyle m_propertyAdjustment; + + private Material m_dummyMaterial; + private MenuCommand m_dummyCommand; + private int m_currentUsePassIdx = 0; + + public void Init( string moduleName ) + { + hideFlags = HideFlags.HideAndDontSave; + m_moduleName = moduleName; + } + + void DrawButtons() + { + EditorGUILayout.Separator(); + + // Add keyword + if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + UsePassItem newItem = ScriptableObject.CreateInstance(); + newItem.hideFlags = HideFlags.HideAndDontSave; + m_items.Add( newItem ); + EditorGUI.FocusTextInControl( null ); + m_isDirty = true; + } + + //Remove keyword + if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + if( m_items.Count > 0 ) + { + UsePassItem itemToDelete = m_items[ m_items.Count - 1 ]; + m_items.RemoveAt( m_items.Count - 1 ); + ScriptableObject.DestroyImmediate( itemToDelete ); + EditorGUI.FocusTextInControl( null ); + } + m_isDirty = true; + } + } + + public void Draw( UndoParentNode owner, bool style = true ) + { + if( m_owner == null ) + m_owner = owner; + + if( m_reordableList == null ) + { + m_reordableList = new ReorderableList( m_items, typeof( UsePassItem ), true, false, false, false ) + { + headerHeight = 0, + footerHeight = 0, + showDefaultBackground = false, + drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => + { + if( m_items[ index ] != null ) + { + float labelWidthMultiplier; + float popUpWidth; + float shaderSelectorMultiplier; + float buttonPlusPosMultiplier; + if( style ) + { + rect.x -= 10; + labelWidthMultiplier = 0.9f; + popUpWidth = 0.31f; + shaderSelectorMultiplier = 1.01f; + buttonPlusPosMultiplier = 0.78f; + } + else + { + rect.x -= 1; + labelWidthMultiplier = 1.01f; + popUpWidth = 0.25f; + shaderSelectorMultiplier = 1.0f; + buttonPlusPosMultiplier = 0.55f; + } + + Rect popupPos = new Rect( rect.x, rect.y + 2, popUpWidth * rect.width, rect.height ); + Rect labelPos = new Rect( rect.x + popupPos.width * labelWidthMultiplier, rect.y, 0.59f * rect.width, rect.height ); + + Rect shaderSelectorPos = new Rect( labelPos.x + labelPos.width* shaderSelectorMultiplier, rect.y, 15, rect.height ); + + Rect buttonPlusPos = new Rect( shaderSelectorPos.x + shaderSelectorPos.width * buttonPlusPosMultiplier, rect.y, ShaderKeywordButtonLayoutWidth, rect.height ); + Rect buttonMinusPos = new Rect( buttonPlusPos.x + buttonPlusPos.width, rect.y, ShaderKeywordButtonLayoutWidth, rect.height ); + + EditorGUI.BeginChangeCheck(); + m_items[ index ].Location = (UsePassLocation)owner.EditorGUIEnumPopup( popupPos, m_items[ index ].Location ); + + if( EditorGUI.EndChangeCheck() && m_items[ index ].Location == UsePassLocation.Below && m_owner != null && m_owner.ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader ) + { + m_items[ index ].Location = UsePassLocation.Above; + UIUtils.ShowMessage( "Below option still not available on templates" ); + } + m_items[ index ].Value = owner.EditorGUITextField( labelPos, string.Empty, m_items[ index ].Value ); + + if( GUI.Button( shaderSelectorPos, string.Empty, UIUtils.InspectorPopdropdownFallback ) ) + { + EditorGUI.FocusTextInControl( null ); + GUI.FocusControl( null ); + m_currentUsePassIdx = index; + DisplayShaderContext( owner, GUILayoutUtility.GetRect( GUIContent.none, EditorStyles.popup ) ); + } + + if( GUI.Button( buttonPlusPos, string.Empty, UIUtils.PlusStyle ) ) + { + m_actionType = ReordableAction.Add; + m_actionIndex = index; + } + + if( GUI.Button( buttonMinusPos, string.Empty, UIUtils.MinusStyle ) ) + { + m_actionType = ReordableAction.Remove; + m_actionIndex = index; + } + } + } + }; + } + + if( m_actionType != ReordableAction.None ) + { + switch( m_actionType ) + { + case ReordableAction.Add: + UsePassItem newItem = ScriptableObject.CreateInstance(); + newItem.hideFlags = HideFlags.HideAndDontSave; + m_items.Insert( m_actionIndex + 1, newItem ); + break; + case ReordableAction.Remove: + UsePassItem itemToDelete = m_items[ m_actionIndex ]; + m_items.RemoveAt( m_actionIndex ); + ScriptableObject.DestroyImmediate( itemToDelete ); + break; + } + m_isDirty = true; + m_actionType = ReordableAction.None; + EditorGUI.FocusTextInControl( null ); + } + bool foldoutValue = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedUsePass; + if( style ) + { + NodeUtils.DrawPropertyGroup( ref foldoutValue, m_moduleName, DrawReordableList, DrawButtons ); + } + else + { + NodeUtils.DrawNestedPropertyGroup( ref foldoutValue, m_moduleName, DrawReordableList, DrawButtons ); + } + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedUsePass = foldoutValue; + } + + private void DisplayShaderContext( UndoParentNode node, Rect r ) + { + if( m_dummyCommand == null ) + m_dummyCommand = new MenuCommand( this, 0 ); + + if( m_dummyMaterial == null ) + m_dummyMaterial = new Material( Shader.Find( "Hidden/ASESShaderSelectorUnlit" ) ); + +#pragma warning disable 0618 + UnityEditorInternal.InternalEditorUtility.SetupShaderMenu( m_dummyMaterial ); +#pragma warning restore 0618 + EditorUtility.DisplayPopupMenu( r, ShaderPoputContext, m_dummyCommand ); + } + + private void OnSelectedShaderPopup( string command, Shader shader ) + { + if( shader != null ) + { + UIUtils.MarkUndoAction(); + UndoUtils.RecordObject( m_owner, "Selected Use Pass shader" ); + m_items[ m_currentUsePassIdx ].Value = shader.name; + } + } + + void DrawReordableList() + { + if( m_reordableList != null ) + { + if( m_propertyAdjustment == null ) + { + m_propertyAdjustment = new GUIStyle(); + m_propertyAdjustment.padding.left = 17; + } + EditorGUILayout.Space(); + + if( m_items.Count == 0 ) + { + EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one.", MessageType.Info ); + } + else + { + m_reordableList.DoLayoutList(); + } + EditorGUILayout.Space(); + } + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + try + { + int count = Convert.ToInt32( nodeParams[ index++ ] ); + for( int i = 0; i < count; i++ ) + { + string locationValue = nodeParams[ index++ ]; + // REMOVE THIS TEST AFTER A COUPLE OF VERSIONS (curr v1.5.6 r02) + if( locationValue.Equals( "Bellow" ) ) locationValue = "Below"; + + UsePassLocation location = (UsePassLocation)Enum.Parse( typeof( UsePassLocation ), locationValue ); + string name = nodeParams[ index++ ]; + UsePassItem newItem = ScriptableObject.CreateInstance(); + newItem.hideFlags = HideFlags.HideAndDontSave; + newItem.Location = location; + newItem.Value = name; + m_items.Add( newItem ); + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + + public void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_items.Count ); + for( int i = 0; i < m_items.Count; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_items[ i ].Location ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_items[ i ].Value ); + } + } + + public void BuildUsePassInfo( MasterNodeDataCollector dataCollector, ref string aboveItems, ref string bellowItems, string tabs) + { + int count = 0; + count = dataCollector.AboveUsePassesList.Count; + for( int i = 0; i < count; i++ ) + { + aboveItems += tabs + string.Format( UseGrabFormatNewLine, dataCollector.AboveUsePassesList[ i ].PropertyName ); + } + + count = dataCollector.BelowUsePassesList.Count; + for( int i = 0; i < count; i++ ) + { + bellowItems += tabs + string.Format( UseGrabFormatNewLine, dataCollector.BelowUsePassesList[ i ].PropertyName ); + } + + count = m_items.Count; + for( int i = 0; i < count; i++ ) + { + if( m_items[ i ].Location == UsePassLocation.Above ) + { + aboveItems += tabs + string.Format( UseGrabFormatNewLine, m_items[ i ].Value ); + } + else + { + bellowItems += tabs + string.Format( UseGrabFormatNewLine, m_items[ i ].Value ); + } + } + } + + public void BuildUsePassInfo( MasterNodeDataCollector dataCollector, ref List aboveItems, ref List bellowItems ) + { + int count = 0; + count = dataCollector.AboveUsePassesList.Count; + for( int i = 0; i < count; i++ ) + { + aboveItems.Add( new PropertyDataCollector( -1, string.Format( UseGrabFormat, dataCollector.AboveUsePassesList[ i ].PropertyName ) ) ); + } + + count = dataCollector.BelowUsePassesList.Count; + for( int i = 0; i < count; i++ ) + { + bellowItems.Add( new PropertyDataCollector( -1, string.Format( UseGrabFormat, dataCollector.BelowUsePassesList[ i ].PropertyName ) ) ); + } + + + count = m_items.Count; + for( int i = 0; i < count; i++ ) + { + if( m_items[ i ].Location == UsePassLocation.Above ) + { + aboveItems.Add( new PropertyDataCollector(-1,string.Format( UseGrabFormat, m_items[ i ].Value ))); + } + else + { + bellowItems.Add( new PropertyDataCollector( -1, string.Format( UseGrabFormat, m_items[ i ].Value ) ) ); + } + } + } + + //public string ModuleName { set { m_moduleName = value; } } + public void Destroy() + { + m_owner = null; + m_items.Clear(); + m_items = null; + m_reordableList = null; + m_dummyMaterial = null; + m_dummyCommand = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs.meta new file mode 100644 index 00000000..94f441a8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d818a147712609646b8d6f0f7c2ae731 +timeCreated: 1530179906 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs new file mode 100644 index 00000000..73d3599c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs @@ -0,0 +1,272 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public enum ZWriteMode + { + On, + Off + } + + public enum ZTestMode + { + Less, + Greater, + LEqual, + GEqual, + Equal, + NotEqual, + Always + } + + [Serializable] + class ZBufferOpHelper + { + public static readonly string DepthParametersStr = " Depth"; + public static readonly string ZWriteModeStr = "ZWrite Mode"; + public static readonly string ZTestModeStr = "ZTest Mode"; + public static readonly string OffsetStr = "Offset"; + public static readonly string OffsetFactorStr = "Factor"; + public static readonly string OffsetUnitsStr = "Units"; + private const string ExtraDepthPassStr = "Extra Depth Pass"; + private const string DepthZTestStr = "Depth ZTest"; + + public static readonly string[] ZTestModeLabels = + { + "", + "Less", + "Greater", + "Less or Equal", + "Greater or Equal", + "Equal", + "Not Equal", + "Always" + }; + + public static readonly string[] ZTestModeValues = + { + "", + "Less", + "Greater", + "LEqual", + "GEqual", + "Equal", + "NotEqual", + "Always" + }; + + public static readonly string[] ZWriteModeValues = + { + "", + "On", + "Off" + }; + + public static readonly Dictionary ZTestModeDict = new Dictionary + { + {ZTestMode.Less,1 }, + {ZTestMode.Greater,2}, + {ZTestMode.LEqual,3}, + {ZTestMode.GEqual,4}, + {ZTestMode.Equal,5}, + {ZTestMode.NotEqual,6}, + {ZTestMode.Always,7} + }; + + public static readonly Dictionary ZWriteModeDict = new Dictionary + { + { ZWriteMode.On,1}, + { ZWriteMode.Off,2} + }; + + + [SerializeField] + private InlineProperty m_zTestMode = new InlineProperty(); + + [SerializeField] + private InlineProperty m_zWriteMode = new InlineProperty(); + [SerializeField] + private InlineProperty m_offsetFactor = new InlineProperty(); + + [SerializeField] + private InlineProperty m_offsetUnits = new InlineProperty(); + + [SerializeField] + private bool m_offsetEnabled; + + [SerializeField] + private bool m_extraDepthPass; + + [SerializeField] + private int m_extrazTestMode = 0; + + [SerializeField] + private StandardSurfaceOutputNode m_parentSurface; + + public string CreateDepthInfo( bool outlineZWrite, bool outlineZTest ) + { + string result = string.Empty; + if( m_zWriteMode.IntValue != 0 || m_zWriteMode.Active ) + { + MasterNode.AddRenderState( ref result, "ZWrite", m_zWriteMode.GetValueOrProperty( ZWriteModeValues[ m_zWriteMode.IntValue ] ) ); + } + else if( outlineZWrite ) + { + MasterNode.AddRenderState( ref result, "ZWrite", ZWriteModeValues[ 1 ] ); + } + + if( m_zTestMode.IntValue != 0 || m_zTestMode.Active ) + { + MasterNode.AddRenderState( ref result, "ZTest", m_zTestMode.GetValueOrProperty( ZTestModeValues[ m_zTestMode.IntValue ] ) ); + } + else if( outlineZTest ) + { + MasterNode.AddRenderState( ref result, "ZTest", ZTestModeValues[ 3 ] ); + } + + if( m_offsetEnabled ) + { + MasterNode.AddRenderState( ref result, "Offset ", m_offsetFactor.GetValueOrProperty() + " , " + m_offsetUnits.GetValueOrProperty() ); + } + + return result; + } + + public void Draw( UndoParentNode owner, GUIStyle toolbarstyle, bool customBlendAvailable ) + { + Color cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); + EditorGUILayout.BeginHorizontal( toolbarstyle ); + GUI.color = cachedColor; + EditorGUI.BeginChangeCheck(); + m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth = owner.GUILayoutToggle( m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth, DepthParametersStr, UIUtils.MenuItemToggleStyle ); + if( EditorGUI.EndChangeCheck() ) + { + EditorPrefs.SetBool( "ExpandedDepth", m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth ); + } + EditorGUILayout.EndHorizontal(); + + if( m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth ) + { + cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); + EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); + GUI.color = cachedColor; + + EditorGUI.indentLevel++; + if( !customBlendAvailable ) + EditorGUILayout.HelpBox( "Depth Writing is only available for Opaque or Custom blend modes", MessageType.Warning ); + + EditorGUILayout.Separator(); + EditorGUI.BeginDisabledGroup( !customBlendAvailable ); + + m_zWriteMode.EnumTypePopup( ref owner, ZWriteModeStr, ZWriteModeValues ); + m_zTestMode.EnumTypePopup( ref owner, ZTestModeStr, ZTestModeLabels ); + //m_zWriteMode = owner.EditorGUILayoutPopup( ZWriteModeStr, m_zWriteMode, ZWriteModeValues ); + //m_zTestMode = owner.EditorGUILayoutPopup( ZTestModeStr, m_zTestMode, ZTestModeLabels ); + m_offsetEnabled = owner.EditorGUILayoutToggle( OffsetStr, m_offsetEnabled ); + if( m_offsetEnabled ) + { + EditorGUI.indentLevel++; + m_offsetFactor.FloatField( ref owner , OffsetFactorStr ); + m_offsetUnits.FloatField( ref owner , OffsetUnitsStr ); + EditorGUI.indentLevel--; + } + + m_extraDepthPass = owner.EditorGUILayoutToggle( ExtraDepthPassStr, m_extraDepthPass ); + if( m_extraDepthPass ) + { + EditorGUI.indentLevel++; + m_extrazTestMode = owner.EditorGUILayoutPopup( DepthZTestStr, m_extrazTestMode, ZTestModeLabels ); + EditorGUI.indentLevel--; + } + EditorGUILayout.Separator(); + EditorGUI.indentLevel--; + EditorGUI.EndDisabledGroup(); + EditorGUILayout.EndVertical(); + } + + EditorGUI.EndDisabledGroup(); + } + + public void DrawExtraDepthPass( ref string shaderBody ) + { + if( m_extraDepthPass ) + { + shaderBody += "\t\tPass\n"; + shaderBody += "\t\t{\n"; + shaderBody += "\t\t\tColorMask 0\n"; + if( m_extrazTestMode != 0 ) + shaderBody += "\t\t\tZTest " + ZTestModeValues[ m_extrazTestMode ] + "\n"; + shaderBody += "\t\t\tZWrite On\n"; + shaderBody += "\t\t}\n\n"; + } + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + if( UIUtils.CurrentShaderVersion() < 2502 ) + { + string zWriteMode = nodeParams[ index++ ]; + m_zWriteMode.IntValue = zWriteMode.Equals( "Off" ) ? 2 : 0; + + string zTestMode = nodeParams[ index++ ]; + for( int i = 0; i < ZTestModeValues.Length; i++ ) + { + if( zTestMode.Equals( ZTestModeValues[ i ] ) ) + { + m_zTestMode.IntValue = i; + break; + } + } + } + else + { + if( UIUtils.CurrentShaderVersion() > 14501 ) + { + m_zWriteMode.ReadFromString( ref index, ref nodeParams ); + m_zTestMode.ReadFromString( ref index, ref nodeParams ); + } + else + { + m_zWriteMode.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_zTestMode.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + } + m_offsetEnabled = Convert.ToBoolean( nodeParams[ index++ ] ); + + if( UIUtils.CurrentShaderVersion() > 15303 ) + { + m_offsetFactor.ReadFromString( ref index , ref nodeParams , false ); + m_offsetUnits.ReadFromString( ref index, ref nodeParams , false ); + } + else + { + m_offsetFactor.FloatValue = Convert.ToSingle( nodeParams[ index++ ] ); + m_offsetUnits.FloatValue = Convert.ToSingle( nodeParams[ index++ ] ); + } + + if( UIUtils.CurrentShaderVersion() > 14202 ) + { + m_extraDepthPass = Convert.ToBoolean( nodeParams[ index++ ] ); + m_extrazTestMode = Convert.ToInt32( nodeParams[ index++ ] ); + } + } + } + + public void WriteToString( ref string nodeInfo ) + { + m_zWriteMode.WriteToString( ref nodeInfo ); + m_zTestMode.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_offsetEnabled ); + m_offsetFactor.WriteToString( ref nodeInfo ); + m_offsetUnits.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_extraDepthPass ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_extrazTestMode ); + } + public bool IsActive { get { return m_zTestMode.IntValue != 0 || m_zWriteMode.IntValue != 0 || m_offsetEnabled || m_zTestMode.Active || m_zWriteMode.Active; } } + public StandardSurfaceOutputNode ParentSurface { get { return m_parentSurface; } set { m_parentSurface = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs.meta new file mode 100644 index 00000000..33529cb6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f35a3e26a28596b4f9b54a1f2689db06 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc.meta new file mode 100644 index 00000000..ae40b7c9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6371d71bb076e1d47a3854adc59fdb93 +folderAsset: yes +timeCreated: 1481126945 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs new file mode 100644 index 00000000..6318614b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs @@ -0,0 +1,254 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "[Old]Append", "Vector Operators", "Append channels to create a new component",null,KeyCode.V,true,true,"Append",typeof(DynamicAppendNode))] + public sealed class AppendNode : ParentNode + { + private const string OutputTypeStr = "Output type"; + + [SerializeField] + private WirePortDataType m_selectedOutputType = WirePortDataType.FLOAT4; + + [SerializeField] + private int m_selectedOutputTypeInt = 2; + + [SerializeField] + private float[] m_defaultValues = { 0, 0, 0, 0 }; + private string[] m_defaultValuesStr = { "[0]", "[1]", "[2]", "[3]" }; + + private readonly string[] m_outputValueTypes ={ "Vector2", + "Vector3", + "Vector4", + "Color"}; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "[0]" ); + AddInputPort( WirePortDataType.FLOAT, false, "[1]" ); + AddInputPort( WirePortDataType.FLOAT, false, "[2]" ); + AddInputPort( WirePortDataType.FLOAT, false, "[3]" ); + AddOutputPort( m_selectedOutputType, Constants.EmptyPortValue ); + m_textLabelWidth = 90; + m_autoWrapProperties = true; + m_previewShaderGUID = "d80ac81aabf643848a4eaa76f2f88d65"; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if ( m_dropdownEditing ) + { + EditorGUI.BeginChangeCheck(); + m_selectedOutputTypeInt = EditorGUIPopup( m_dropdownRect, m_selectedOutputTypeInt, m_outputValueTypes, UIUtils.PropertyPopUp ); + if ( EditorGUI.EndChangeCheck() ) + { + SetupPorts(); + DropdownEditing = false; + } + } + } + + void SetupPorts() + { + switch ( m_selectedOutputTypeInt ) + { + case 0: m_selectedOutputType = WirePortDataType.FLOAT2; break; + case 1: m_selectedOutputType = WirePortDataType.FLOAT3; break; + case 2: m_selectedOutputType = WirePortDataType.FLOAT4; break; + case 3: m_selectedOutputType = WirePortDataType.COLOR; break; + } + + UpdatePorts(); + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUILayout.BeginVertical(); + + EditorGUI.BeginChangeCheck(); + m_selectedOutputTypeInt = EditorGUILayoutPopup( OutputTypeStr, m_selectedOutputTypeInt, m_outputValueTypes ); + if ( EditorGUI.EndChangeCheck() ) + { + SetupPorts(); + } + + int count = 0; + switch ( m_selectedOutputType ) + { + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + { + count = 4; + } + break; + case WirePortDataType.FLOAT3: + { + count = 3; + } + break; + case WirePortDataType.FLOAT2: + { + count = 2; + } + break; + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { } + break; + } + + for ( int i = 0; i < count; i++ ) + { + if ( !m_inputPorts[ i ].IsConnected ) + m_defaultValues[ i ] = EditorGUILayoutFloatField( m_defaultValuesStr[ i ], m_defaultValues[ i ] ); + } + + EditorGUILayout.EndVertical(); + } + void UpdatePorts() + { + m_sizeIsDirty = true; + ChangeOutputType( m_selectedOutputType, false ); + switch ( m_selectedOutputType ) + { + case WirePortDataType.FLOAT4: + case WirePortDataType.OBJECT: + case WirePortDataType.COLOR: + { + m_inputPorts[ 0 ].Visible = true; + m_inputPorts[ 1 ].Visible = true; + m_inputPorts[ 2 ].Visible = true; + m_inputPorts[ 3 ].Visible = true; + } + break; + case WirePortDataType.FLOAT3: + { + m_inputPorts[ 0 ].Visible = true; + m_inputPorts[ 1 ].Visible = true; + m_inputPorts[ 2 ].Visible = true; + m_inputPorts[ 3 ].Visible = false; + if ( m_inputPorts[ 3 ].IsConnected ) + UIUtils.DeleteConnection( true, UniqueId, 3, false, true ); + } + break; + case WirePortDataType.FLOAT2: + { + m_inputPorts[ 0 ].Visible = true; + m_inputPorts[ 1 ].Visible = true; + m_inputPorts[ 2 ].Visible = false; + if ( m_inputPorts[ 2 ].IsConnected ) + UIUtils.DeleteConnection( true, UniqueId, 2, false, true ); + + m_inputPorts[ 3 ].Visible = false; + if ( m_inputPorts[ 3 ].IsConnected ) + UIUtils.DeleteConnection( true, UniqueId, 3, false, true ); + } + break; + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { } + break; + } + } + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string value = string.Empty; + switch ( m_selectedOutputType ) + { + case WirePortDataType.FLOAT4: + case WirePortDataType.OBJECT: + case WirePortDataType.COLOR: + { + value = "float4( "; + for ( int i = 0; i < 4; i++ ) + { + value += m_inputPorts[ i ].IsConnected ? InputPorts[ i ].GenerateShaderForOutput( ref dataCollector, WirePortDataType.FLOAT, ignoreLocalVar, true ) : m_defaultValues[ i ].ToString(); + if ( i != 3 ) + value += " , "; + } + value += " )"; + } + break; + case WirePortDataType.FLOAT3: + { + value = "float3( "; + for ( int i = 0; i < 3; i++ ) + { + value += m_inputPorts[ i ].IsConnected ? InputPorts[ i ].GenerateShaderForOutput( ref dataCollector, WirePortDataType.FLOAT, ignoreLocalVar, true ) : m_defaultValues[ i ].ToString(); + if ( i != 2 ) + value += " , "; + } + value += " )"; + } + break; + case WirePortDataType.FLOAT2: + { + value = "float2( "; + for ( int i = 0; i < 2; i++ ) + { + value += m_inputPorts[ i ].IsConnected ? InputPorts[ i ].GenerateShaderForOutput( ref dataCollector, WirePortDataType.FLOAT, ignoreLocalVar, true ) : m_defaultValues[ i ].ToString(); + if ( i != 1 ) + value += " , "; + } + value += " )"; + } + break; + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { } + break; + } + + RegisterLocalVariable( 0, value, ref dataCollector, "appendResult" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_selectedOutputType = ( WirePortDataType ) Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ); + switch ( m_selectedOutputType ) + { + case WirePortDataType.FLOAT2: m_selectedOutputTypeInt = 0; break; + case WirePortDataType.FLOAT3: m_selectedOutputTypeInt = 1; break; + case WirePortDataType.FLOAT4: m_selectedOutputTypeInt = 2; break; + case WirePortDataType.COLOR: m_selectedOutputTypeInt = 3; break; + } + for ( int i = 0; i < m_defaultValues.Length; i++ ) + { + m_defaultValues[ i ] = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + } + UpdatePorts(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedOutputType ); + for ( int i = 0; i < m_defaultValues.Length; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultValues[ i ] ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs.meta new file mode 100644 index 00000000..0e2a7d75 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 688412c534df41444ad49759fa2b6a62 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs new file mode 100644 index 00000000..03e89378 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs @@ -0,0 +1,290 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Split", "Vector Operators", "Formerly known as Break To Components. Breaks the input data into its individual components", null, KeyCode.B, tags: "split Break To Components" )] + public sealed class BreakToComponentsNode : ParentNode + { + private const string RenameInfo = "This node was formerly known as Break To Components and was renamed to Split to decrease its canvas size."; + private WirePortDataType m_currentType = WirePortDataType.FLOAT; + private readonly string[] ColorPortNames = { "R", "G", "B", "A" }; + private readonly string[] VectorPortNames = { "X", "Y", "Z", "W" }; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + for( int i = 0; i < 16; i++ ) + { + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_outputPorts[ i ].IndexPreviewOffset = 1; + if( i != 0 ) + { + m_outputPorts[ i ].Visible = false; + } + } + m_previewShaderGUID = "5f58f74a202ba804daddec838b75207d"; + } + + public override void RenderNodePreview() + { + //Runs at least one time + if( !m_initialized ) + { + // nodes with no preview don't update at all + PreviewIsDirty = false; + return; + } + + if( !PreviewIsDirty ) + return; + + SetPreviewInputs(); + if( !Preferences.User.DisablePreviews ) + { + int count = m_outputPorts.Count; + for( int i = 0 ; i < count ; i++ ) + { + RenderTexture temp = RenderTexture.active; + RenderTexture.active = m_outputPorts[ i ].OutputPreviewTexture; + Graphics.Blit( null , m_outputPorts[ i ].OutputPreviewTexture , PreviewMaterial , Mathf.Min( i , 3 ) ); + RenderTexture.active = temp; + } + } + PreviewIsDirty = m_continuousPreviewRefresh; + } + + public override RenderTexture PreviewTexture + { + get + { + return m_inputPorts[ 0 ].InputPreviewTexture( ContainerGraph ); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUILayout.HelpBox( RenameInfo, MessageType.Warning ); + } + + void UpdateOutputs( WirePortDataType newType ) + { + //this only happens when on initial load + if( newType == WirePortDataType.OBJECT ) + return; + + m_currentType = newType; + switch( newType ) + { + case WirePortDataType.OBJECT: + { + m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, WirePortDataType.OBJECT, false ); + m_outputPorts[ 0 ].Visible = true; + for( int i = 1; i < m_outputPorts.Count; i++ ) + { + m_outputPorts[ i ].Visible = false; + } + } + break; + case WirePortDataType.FLOAT: + { + m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, WirePortDataType.FLOAT, false ); + m_outputPorts[ 0 ].Visible = true; + for( int i = 1; i < m_outputPorts.Count; i++ ) + { + m_outputPorts[ i ].Visible = false; + } + } + break; + case WirePortDataType.FLOAT2: + { + for( int i = 0; i < 2; i++ ) + { + m_outputPorts[ i ].ChangeProperties( VectorPortNames[ i ], WirePortDataType.FLOAT, false ); + m_outputPorts[ i ].Visible = true; + } + for( int i = 2; i < m_outputPorts.Count; i++ ) + { + m_outputPorts[ i ].Visible = false; + } + } + break; + case WirePortDataType.FLOAT3: + { + for( int i = 0; i < 3; i++ ) + { + m_outputPorts[ i ].ChangeProperties( VectorPortNames[ i ], WirePortDataType.FLOAT, false ); + m_outputPorts[ i ].Visible = true; + } + for( int i = 3; i < m_outputPorts.Count; i++ ) + { + m_outputPorts[ i ].Visible = false; + } + } + break; + case WirePortDataType.FLOAT4: + { + for( int i = 0; i < 4; i++ ) + { + m_outputPorts[ i ].ChangeProperties( VectorPortNames[ i ], WirePortDataType.FLOAT, false ); + m_outputPorts[ i ].Visible = true; + } + for( int i = 4; i < m_outputPorts.Count; i++ ) + { + m_outputPorts[ i ].Visible = false; + } + } + break; + case WirePortDataType.FLOAT3x3: + { + for( int i = 0; i < 9; i++ ) + { + m_outputPorts[ i ].ChangeProperties( "[" + (int)( i / 3 ) + "][" + i % 3 + "]", WirePortDataType.FLOAT, false ); + m_outputPorts[ i ].Visible = true; + } + for( int i = 9; i < m_outputPorts.Count; i++ ) + { + m_outputPorts[ i ].Visible = false; + } + } + break; + case WirePortDataType.FLOAT4x4: + { + for( int i = 0; i < 16; i++ ) + { + m_outputPorts[ i ].ChangeProperties( "[" + (int)( i / 4 ) + "][" + i % 4 + "]", WirePortDataType.FLOAT, false ); + m_outputPorts[ i ].Visible = true; + } + } + break; + case WirePortDataType.COLOR: + { + for( int i = 0; i < 4; i++ ) + { + m_outputPorts[ i ].ChangeProperties( ColorPortNames[ i ], WirePortDataType.FLOAT, false ); + m_outputPorts[ i ].Visible = true; + } + for( int i = 4; i < m_outputPorts.Count; i++ ) + { + m_outputPorts[ i ].Visible = false; + } + } + break; + case WirePortDataType.INT: + { + m_outputPorts[ 0 ].Visible = true; + m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, WirePortDataType.INT, false ); + for( int i = 1; i < m_outputPorts.Count; i++ ) + { + m_outputPorts[ i ].Visible = false; + } + } + break; + } + m_sizeIsDirty = true; + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + + if( UIUtils.IsLoading || m_isNodeBeingCopied ) + return; + + m_inputPorts[ 0 ].MatchPortToConnection(); + UpdateOutputs( m_inputPorts[ 0 ].DataType ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + + if( UIUtils.IsLoading || m_isNodeBeingCopied ) + return; + + m_inputPorts[ 0 ].MatchPortToConnection(); + UpdateOutputs( m_inputPorts[ 0 ].DataType ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentType ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + UpdateOutputs( (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ) ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + { + return ReturnByType( m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ), outputId ); + } + + string value = string.Empty; + value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + int channelsUsed = 0; + for( int i = 0; i < m_outputPorts.Count; i++ ) + { + if( m_outputPorts[ i ].IsConnected ) + channelsUsed++; + } + string varName = "break" + OutputId; + if( channelsUsed > 1 ) + { + //RegisterLocalVariable( 0, value, ref dataCollector, varName ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].DataType, varName, value ); + m_outputPorts[ 0 ].SetLocalValue( varName, dataCollector.PortCategory ); + + + value = varName; + } + + return ReturnByType( value, outputId ); + } + + private string ReturnByType( string value, int outputId ) + { + switch( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + { + return value; + } + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + { + return GetOutputVectorItem( 0, outputId + 1, value ); + } + case WirePortDataType.COLOR: + { + return GetOutputColorItem( 0, outputId + 1, value ); + } + case WirePortDataType.FLOAT3x3: + { + return value + "[ " + ( (int)( outputId / 3 ) ) + " ][ " + ( outputId % 3 ) + " ]"; + } + case WirePortDataType.FLOAT4x4: + { + return value + "[ " + ( (int)( outputId / 4 ) ) + " ][ " + ( outputId % 4 ) + " ]"; + } + } + return value; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs.meta new file mode 100644 index 00000000..8d97afa7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a74e2c0a9306c0048bfcc733cb7d154d +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs new file mode 100644 index 00000000..c9c8f79d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs @@ -0,0 +1,1881 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using UnityEditorInternal; +using System.Text.RegularExpressions; + +namespace AmplifyShaderEditor +{ + public enum CustomExpressionMode + { + Create, + Call, + File + } + + [Serializable] + public class CustomExpressionInputItem + { + public PrecisionType Precision; + public VariableQualifiers Qualifier; + public WirePortDataType Type; + public bool IsSamplerState; + public bool IsTexture2DArray; + public string CustomType; + public bool IsVariable; + public bool FoldoutFlag; + public string FoldoutLabel; + + public CustomExpressionInputItem( PrecisionType precision , VariableQualifiers qualifier , string customType , bool isVariable , bool foldoutFlag , string foldoutLabel ) + { + Precision = precision; + Qualifier = qualifier; + CustomType = customType; + FoldoutFlag = foldoutFlag; + FoldoutLabel = foldoutLabel; + IsVariable = isVariable; + } + } + + [Serializable] + public class CustomExpressionDependency + { + public int DependencyArrayIdx; + public int DependencyNodeId; + public CustomExpressionDependency() { DependencyArrayIdx = DependencyNodeId = -1; } + public CustomExpressionDependency( string id ) { DependencyNodeId = Convert.ToInt32( id ); DependencyArrayIdx = -1; } + public void Reset() + { + DependencyArrayIdx = -1; + DependencyNodeId = -1; + } + } + + [Serializable] + [NodeAttributes( "Custom Expression" , "Miscellaneous" , "Creates a custom expression or function if return is detected in the written code." )] + public sealed class CustomExpressionNode : ParentNode + { + private const string WarningText = "Characters $ and @ are NOT allowed inside code since they are internally used as delimiters over the node meta.\nThey will be automatically removed when saving the shader."; + private const float AddRemoveButtonLayoutWidth = 15; + private const float LineAdjust = 1.15f; + private const float IdentationAdjust = 5f; + private const string CustomExpressionInfo = "Creates a custom expression or function according to how code is written on text area.\n\n" + + "- If a return function is detected on Code text area then a function will be created.\n" + + "Also in function mode a ; is expected on the end of each instruction line.\n\n" + + "- If no return function is detected then an expression will be generated and used directly on the vertex/frag body.\n" + + "On Expression mode a ; is not required on the end of an instruction line.\n\n" + + "- You can also call a function from an external file, just make sure to add the include file via the 'Additional Directives' group " + + "in the main property panel. Also works with shader functions."; + + private const string ReturnHelper = "return"; + private const double MaxTimestamp = 1; + private const string DefaultExpressionNameStr = "My Custom Expression"; + private const string DefaultInputNameStr = "In"; + private const string CodeTitleStr = "Code"; + private const string OutputTypeStr = "Output Type"; + private const string CustomTypeStr = " "; + private const string IsVariableStr = "Is Variable"; + private const string InputsStr = "Inputs"; + private const string InputNameStr = "Name"; + private const string InputTypeStr = "Type"; + private const string InputValueStr = "Value"; + private const string InputQualifierStr = "Qualifier"; + private const string ExpressionNameLabelStr = "Name"; + private const string FunctionCallModeStr = "Mode"; + private const string GenerateUniqueNameStr = "Set Unique"; + private const string AutoRegisterStr = "Auto-Register"; + private const string DependenciesStr = "Dependencies"; + + private const string DefaultSamplerStateStr = "_Linear_Repeat"; + + private const string VarRegexReplacer = @"\b{0}\b"; + private readonly string[] PrecisionLabelsExtraLocal = { "Float" , "Half" , "Inherit Local" }; + + private readonly string[] AvailableWireTypesStr = + { + "int", + "float", + "float2", + "float3", + "float4", + "float3x3", + "float4x4", + "sampler1D", + "sampler2D", + "sampler3D", + "samplerCUBE", + "sampler2Darray", + "samplerState", + "custom"}; + + private readonly string[] AvailableOutputWireTypesStr = + { + "int", + "float", + "float2", + "float3", + "float4", + "float3x3", + "float4x4", + "void", + }; + + private readonly string[] QualifiersStr = + { + "In", + "Out", + "InOut" + }; + + private readonly WirePortDataType[] AvailableWireTypes = + { + WirePortDataType.INT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.FLOAT3x3, + WirePortDataType.FLOAT4x4, + WirePortDataType.SAMPLER1D, + WirePortDataType.SAMPLER2D, + WirePortDataType.SAMPLER3D, + WirePortDataType.SAMPLERCUBE, + WirePortDataType.SAMPLER2DARRAY, + WirePortDataType.SAMPLERSTATE, + WirePortDataType.OBJECT + }; + + private readonly WirePortDataType[] AvailableOutputWireTypes = + { + WirePortDataType.INT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.FLOAT3x3, + WirePortDataType.FLOAT4x4, + WirePortDataType.OBJECT, + }; + + + private readonly Dictionary WireToIdx = new Dictionary + { + { WirePortDataType.INT, 0}, + { WirePortDataType.FLOAT, 1}, + { WirePortDataType.FLOAT2, 2}, + { WirePortDataType.FLOAT3, 3}, + { WirePortDataType.FLOAT4, 4}, + { WirePortDataType.FLOAT3x3, 5}, + { WirePortDataType.FLOAT4x4, 6}, + { WirePortDataType.SAMPLER1D, 7}, + { WirePortDataType.SAMPLER2D, 8}, + { WirePortDataType.SAMPLER3D, 9}, + { WirePortDataType.SAMPLERCUBE, 10}, + { WirePortDataType.SAMPLER2DARRAY, 11}, + { WirePortDataType.SAMPLERSTATE, 12}, + { WirePortDataType.OBJECT, 13} + }; + + [SerializeField] + private string m_customExpressionName = DefaultExpressionNameStr; + + [SerializeField] + private List m_items = new List(); + + [SerializeField] + private string m_code = " "; + + [SerializeField] + private int m_outputTypeIdx = 1; + + [SerializeField] + private bool m_visibleInputsFoldout = true; + + [SerializeField] + private CustomExpressionMode m_mode = CustomExpressionMode.Create; + + [SerializeField] + private string m_fileGUID = string.Empty; + + [SerializeField] + private TextAsset m_fileAsset = null; + + [SerializeField] + private bool m_precisionSuffix = false; + + [SerializeField] + private bool m_voidMode = false; + + [SerializeField] + private bool m_autoRegisterMode = false; + + [SerializeField] + private bool m_functionMode = false; + + [SerializeField] + private int m_firstAvailablePort = 0; + + [SerializeField] + private string m_uniqueName; + + [SerializeField] + private bool m_generateUniqueName = true; + + [SerializeField] + private bool m_dependenciesFoldout = false; + + [SerializeField] + private List m_dependencies = new List(); + + private const float ButtonLayoutWidth = 15; + + private bool m_repopulateNameDictionary = true; + private Dictionary m_usedNames = new Dictionary(); + + private double m_lastTimeNameModified = 0; + private bool m_nameModified = false; + + private double m_lastTimeCodeModified = 0; + private bool m_codeModified = false; + + //Title editing + private bool m_isEditing; + private bool m_stopEditing; + private bool m_startEditing; + private double m_clickTime; + private double m_doubleClickTime = 0.3; + private Rect m_titleClickArea; + + //Item Reordable List + private ReordableAction m_actionType = ReordableAction.None; + private int m_actionIndex = 0; + private int m_lastIndex = 0; + + private ReorderableList m_itemReordableList = null; + private ReorderableList m_dependenciesReordableList = null; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT , false , "In0" ); + m_items.Add( new CustomExpressionInputItem( PrecisionType.Inherit , VariableQualifiers.In , string.Empty , false , true , string.Empty/*"[0]"*/ ) ); + AddOutputPort( WirePortDataType.FLOAT , "Out" ); + m_textLabelWidth = 97; + m_customPrecision = true; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + + if( m_mode == CustomExpressionMode.Create ) + UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.AddNode( this ); + + SetTitleText( m_customExpressionName ); + + if( m_nodeAttribs != null ) + m_uniqueName = m_nodeAttribs.Name + OutputId; + else + m_uniqueName = "CustomExpression" + OutputId; + } + + public override void OnInputPortConnected( int portId , int otherNodeId , int otherPortId , bool activateNode = true ) + { + base.OnInputPortConnected( portId , otherNodeId , otherPortId , activateNode ); + CheckPortConnection( portId ); + } + + public override void OnConnectedOutputNodeChanges( int portId , int otherNodeId , int otherPortId , string name , WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( portId , otherNodeId , otherPortId , name , type ); + CheckPortConnection( portId ); + } + + void CheckPortConnection( int portId ) + { + if( portId == 0 && ( m_mode == CustomExpressionMode.Call || m_voidMode ) ) + { + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType , false ); + } + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + if( m_nameModified ) + { + if( ( EditorApplication.timeSinceStartup - m_lastTimeNameModified ) > MaxTimestamp ) + { + m_nameModified = false; + m_sizeIsDirty = true; + m_repopulateNameDictionary = true; + } + } + + if( m_repopulateNameDictionary ) + { + m_repopulateNameDictionary = false; + m_usedNames.Clear(); + for( int i = 0 ; i < m_inputPorts.Count ; i++ ) + { + m_usedNames.Add( m_inputPorts[ i ].Name , i ); + } + } + + if( m_codeModified ) + { + if( ( EditorApplication.timeSinceStartup - m_lastTimeCodeModified ) > MaxTimestamp ) + { + m_codeModified = false; + bool functionMode = m_code.Contains( ReturnHelper ); + if( functionMode != m_functionMode ) + { + m_functionMode = functionMode; + CheckCallMode(); + } + } + } + } + + bool CheckCallMode() + { + if( m_functionMode && m_mode == CustomExpressionMode.Call ) + { + Mode = CustomExpressionMode.Create; + m_outputTypeIdx = ( AvailableOutputWireTypesStr.Length - 1 ); + //m_outputPorts[ 0 ].ChangeType( AvailableOutputWireTypes[ m_outputTypeIdx ], false ); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType , false ); + m_voidMode = true; + return true; + } + return false; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + if( !m_isEditing && ( ( !ContainerGraph.ParentWindow.MouseInteracted && drawInfo.CurrentEventType == EventType.MouseDown && m_titleClickArea.Contains( drawInfo.MousePosition ) ) ) ) + { + if( ( EditorApplication.timeSinceStartup - m_clickTime ) < m_doubleClickTime ) + m_startEditing = true; + else + GUI.FocusControl( null ); + m_clickTime = EditorApplication.timeSinceStartup; + } + else if( m_isEditing && ( ( drawInfo.CurrentEventType == EventType.MouseDown && !m_titleClickArea.Contains( drawInfo.MousePosition ) ) || !EditorGUIUtility.editingTextField ) ) + { + m_stopEditing = true; + } + + if( m_isEditing || m_startEditing ) + { + EditorGUI.BeginChangeCheck(); + GUI.SetNextControlName( m_uniqueName ); + m_customExpressionName = EditorGUITextField( m_titleClickArea , string.Empty , m_customExpressionName , UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); + if( EditorGUI.EndChangeCheck() ) + { + SetTimedUpdate( 2 ); + SetTitleText( m_customExpressionName ); + m_sizeIsDirty = true; + m_isDirty = true; + } + + if( m_startEditing ) + EditorGUI.FocusTextInControl( m_uniqueName ); + } + + if( drawInfo.CurrentEventType == EventType.Repaint ) + { + if( m_startEditing ) + { + m_startEditing = false; + m_isEditing = true; + } + + if( m_stopEditing ) + { + m_stopEditing = false; + m_isEditing = false; + GUI.FocusControl( null ); + } + } + } + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + m_titleClickArea = m_titlePos; + m_titleClickArea.height = Constants.NODE_HEADER_HEIGHT; + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + base.OnNodeRepaint( drawInfo ); + if( !m_isVisible ) + return; + + // Fixed Title ( only renders when not editing ) + if( !m_isEditing && !m_startEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + GUI.Label( m_titleClickArea , m_content , UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); + } + } + + public string GetFirstAvailableName() + { + string name = string.Empty; + for( int i = 0 ; i < m_inputPorts.Count + 1 ; i++ ) + { + name = DefaultInputNameStr + i; + if( !m_usedNames.ContainsKey( name ) ) + { + return name; + } + } + Debug.LogWarning( "Could not find valid name" ); + return string.Empty; + } + + public override void DrawProperties() + { + base.DrawProperties(); + NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout , Constants.ParameterLabelStr , DrawBaseProperties ); + //NodeUtils.DrawPropertyGroup( ref m_visibleInputsFoldout, InputsStr, DrawInputs, DrawAddRemoveInputs ); + NodeUtils.DrawPropertyGroup( ref m_visibleInputsFoldout , InputsStr , DrawReordableInputs , DrawItemsAddRemoveInputs ); + + EditorGUILayout.HelpBox( CustomExpressionInfo , MessageType.Info ); + EditorGUILayout.HelpBox( WarningText , MessageType.Warning ); + } + + string WrapCodeInFunction( bool isTemplate , string functionName , bool expressionMode ) + { + //Hack to be used util indent is properly used + int currIndent = UIUtils.ShaderIndentLevel; + UIUtils.ShaderIndentLevel = isTemplate ? 0 : 1; + + if( !isTemplate ) UIUtils.ShaderIndentLevel++; + + //string functionName = UIUtils.RemoveInvalidCharacters( m_customExpressionName ); + string returnType = ( m_mode == CustomExpressionMode.Call || m_voidMode ) ? "void" : UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType , m_outputPorts[ 0 ].DataType ); + if( expressionMode ) + returnType = "inline " + returnType; + + string functionBody = UIUtils.ShaderIndentTabs + returnType + " " + functionName + "( "; + int count = m_inputPorts.Count - m_firstAvailablePort; + for( int i = 0 ; i < count ; i++ ) + { + int portIdx = i + m_firstAvailablePort; + string qualifier = m_items[ i ].Qualifier == VariableQualifiers.In ? string.Empty : UIUtils.QualifierToCg( m_items[ i ].Qualifier ) + " "; + PrecisionType precision = m_items[ i ].Precision; + if( precision == PrecisionType.Inherit ) + precision = CurrentPrecisionType; + //string dataType = ( m_inputPorts[ portIdx ].DataType == WirePortDataType.OBJECT ) ? m_items[ i ].CustomType : UIUtils.PrecisionWirePortToCgType( precision, m_inputPorts[ portIdx ].DataType ); + string declaration = string.Empty; + if( m_inputPorts[ portIdx ].DataType == WirePortDataType.OBJECT ) + declaration = m_items[ i ].CustomType + " " + m_inputPorts[ portIdx ].Name; + else + declaration = UIUtils.PrecisionWirePortToTypeValue( precision , m_inputPorts[ portIdx ].DataType , m_inputPorts[ portIdx ].Name ); + functionBody += qualifier + declaration; + //functionBody += qualifier + dataType + " " + m_inputPorts[ portIdx ].Name; + if( i < ( count - 1 ) ) + { + functionBody += ", "; + } + } + functionBody += " )\n" + UIUtils.ShaderIndentTabs + "{\n"; + UIUtils.ShaderIndentLevel++; + { + if( expressionMode ) + functionBody += UIUtils.ShaderIndentTabs + "return "; + + string[] codeLines = m_code.Split( IOUtils.LINE_TERMINATOR ); + for( int i = 0 ; i < codeLines.Length ; i++ ) + { + if( codeLines[ i ].Length > 0 ) + { + functionBody += ( ( i == 0 && expressionMode ) ? string.Empty : UIUtils.ShaderIndentTabs ) + codeLines[ i ] + ( ( ( i == codeLines.Length - 1 ) && expressionMode ) ? string.Empty : "\n" ); + } + } + if( expressionMode ) + functionBody += ";\n"; + } + UIUtils.ShaderIndentLevel--; + + functionBody += UIUtils.ShaderIndentTabs + "}\n"; + UIUtils.ShaderIndentLevel = currIndent; + return functionBody; + } + + string GetFileAssetRelativePath() + { + Shader currentShader = m_containerGraph.ParentWindow.OutsideGraph.CurrentShader; + if( currentShader != null ) + { + string fileAssePath = AssetDatabase.GetAssetPath( m_fileAsset ); + if( fileAssePath.StartsWith( "Packages" ) ) + { + return fileAssePath; + } + else if( fileAssePath.StartsWith( "Assets" ) ) + { + string currentShaderPath = AssetDatabase.GetAssetPath( currentShader ); + + string path0 = Application.dataPath + fileAssePath.Substring( 6 ); + string path1 = Application.dataPath + currentShaderPath.Substring( 6 ); + + Uri path0URI = new Uri( path0 , UriKind.Absolute ); + Uri path1URI = new Uri( path1 , UriKind.Absolute ); + + return path1URI.MakeRelativeUri( path0URI ).ToString(); + } + UIUtils.ShowMessage( UniqueId , "Invalid path found in Custom Expression File Asset: " + fileAssePath , MessageSeverity.Warning ); + } + else + { + UIUtils.ShowMessage( UniqueId , "Invalid shader in Custom Expression" ); + } + + return string.Empty; + } + + void DrawBaseProperties() + { + EditorGUI.BeginChangeCheck(); + m_customExpressionName = EditorGUILayoutTextField( ExpressionNameLabelStr , m_customExpressionName ); + if( EditorGUI.EndChangeCheck() ) + { + SetTimedUpdate( 2 ); + SetTitleText( m_customExpressionName ); + } + + EditorGUI.BeginChangeCheck(); + Mode = (CustomExpressionMode)EditorGUILayoutEnumPopup( FunctionCallModeStr , m_mode ); + if( EditorGUI.EndChangeCheck() ) + { + if( CheckCallMode() ) + UIUtils.ShowMessage( UniqueId , "Call Mode cannot have return over is code.\nFalling back to Create Mode" ); + SetupCallMode(); + RecalculateInOutOutputPorts(); + } + + if( m_mode == CustomExpressionMode.File ) + { + m_fileAsset = EditorGUILayoutObjectField( "Source" , m_fileAsset , typeof( TextAsset ) , false ) as TextAsset; + m_precisionSuffix = EditorGUILayoutToggle( "Precision Suffix" , m_precisionSuffix ); + } + else + { + EditorGUILayout.LabelField( CodeTitleStr ); + EditorGUI.BeginChangeCheck(); + { + m_code = EditorGUILayoutTextArea( m_code , UIUtils.MainSkin.textArea ); + } + if( EditorGUI.EndChangeCheck() ) + { + m_codeModified = true; + m_lastTimeCodeModified = EditorApplication.timeSinceStartup; + } + } + if( m_mode == CustomExpressionMode.Create || m_mode == CustomExpressionMode.File ) + { + DrawPrecisionProperty(); + + bool guiEnabled = GUI.enabled; + + GUI.enabled = !AutoRegisterMode && Mode != CustomExpressionMode.File; + m_generateUniqueName = EditorGUILayoutToggle( GenerateUniqueNameStr , m_generateUniqueName ) && !AutoRegisterMode; + + GUI.enabled = !m_generateUniqueName; + AutoRegisterMode = EditorGUILayoutToggle( AutoRegisterStr , AutoRegisterMode ) && !m_generateUniqueName; + + GUI.enabled = guiEnabled; + + EditorGUI.BeginChangeCheck(); + m_outputTypeIdx = EditorGUILayoutPopup( OutputTypeStr , m_outputTypeIdx , AvailableOutputWireTypesStr ); + if( EditorGUI.EndChangeCheck() ) + { + bool oldVoidValue = m_voidMode; + UpdateVoidMode(); + if( oldVoidValue != m_voidMode ) + { + SetupCallMode(); + RecalculateInOutOutputPorts(); + } + else + { + m_outputPorts[ 0 ].ChangeType( AvailableOutputWireTypes[ m_outputTypeIdx ] , false ); + } + } + } + NodeUtils.DrawNestedPropertyGroup( ref m_dependenciesFoldout , "Dependencies" , DrawDependencies , DrawDependenciesAddRemoveInputs ); + } + + void UpdateVoidMode() + { + m_voidMode = ( m_outputTypeIdx == ( AvailableOutputWireTypesStr.Length - 1 ) ); + } + + void SetupCallMode() + { + if( m_mode == CustomExpressionMode.Call || m_voidMode ) + { + if( m_firstAvailablePort != 1 ) + { + m_firstAvailablePort = 1; + AddInputPortAt( 0 , WirePortDataType.FLOAT , false , DefaultInputNameStr ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT , false ); + } + } + else + { + if( m_firstAvailablePort != 0 ) + { + m_firstAvailablePort = 0; + if( m_inputPorts[ 0 ].IsConnected ) + { + m_containerGraph.DeleteConnection( true , UniqueId , m_inputPorts[ 0 ].PortId , false , true ); + } + DeleteInputPortByArrayIdx( 0 ); + m_outputPorts[ 0 ].ChangeType( AvailableOutputWireTypes[ m_outputTypeIdx ] , false ); + } + } + } + + void DrawItemsAddRemoveInputs() + { + if( m_inputPorts.Count == m_firstAvailablePort ) + m_visibleInputsFoldout = false; + + // Add new port + if( GUILayoutButton( string.Empty , UIUtils.PlusStyle , GUILayout.Width( ButtonLayoutWidth ) ) ) + { + AddPortAt( m_inputPorts.Count ); + m_visibleInputsFoldout = true; + EditorGUI.FocusTextInControl( null ); + } + + //Remove port + if( GUILayoutButton( string.Empty , UIUtils.MinusStyle , GUILayout.Width( ButtonLayoutWidth ) ) ) + { + RemovePortAt( m_inputPorts.Count - 1 ); + EditorGUI.FocusTextInControl( null ); + } + } + + void DrawDependenciesAddRemoveInputs() + { + // Add new port + if( GUILayoutButton( string.Empty , UIUtils.PlusStyle , GUILayout.Width( ButtonLayoutWidth ) ) ) + { + m_dependencies.Add( new CustomExpressionDependency() ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove port + if( GUILayoutButton( string.Empty , UIUtils.MinusStyle , GUILayout.Width( ButtonLayoutWidth ) ) ) + { + m_dependencies.RemoveAt( m_dependencies.Count - 1 ); + } + } + + void DrawDependencies() + { + if( m_dependenciesReordableList == null ) + { + m_dependenciesReordableList = new ReorderableList( m_dependencies , typeof( CustomExpressionDependency ) , true , false , false , false ) + { + headerHeight = 0 , + footerHeight = 0 , + showDefaultBackground = false , + drawElementCallback = ( Rect rect , int index , bool isActive , bool isFocused ) => + { + if( m_dependencies[ index ] != null ) + { + rect.xMin -= 1; + + Rect popupPos = new Rect( rect.x , rect.y , rect.width - 2 * Constants.PlusMinusButtonLayoutWidth , EditorGUIUtility.singleLineHeight ); + Rect buttonPlusPos = new Rect( rect.x + rect.width - 2 * Constants.PlusMinusButtonLayoutWidth , rect.y - 2 , Constants.PlusMinusButtonLayoutWidth , Constants.PlusMinusButtonLayoutWidth ); + Rect buttonMinusPos = new Rect( rect.x + rect.width - Constants.PlusMinusButtonLayoutWidth , rect.y - 2 , Constants.PlusMinusButtonLayoutWidth , Constants.PlusMinusButtonLayoutWidth ); + EditorGUI.BeginChangeCheck(); + m_dependencies[ index ].DependencyArrayIdx = EditorGUIPopup( popupPos , string.Empty , m_dependencies[ index ].DependencyArrayIdx , UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.NodesArr ); + if( EditorGUI.EndChangeCheck() ) + { + m_dependencies[ index ].DependencyNodeId = UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.GetNode( m_dependencies[ index ].DependencyArrayIdx ).UniqueId; + if( m_dependencies[ index ].DependencyNodeId == UniqueId ) + { + m_dependencies[ index ].Reset(); + } + } + + if( GUI.Button( buttonPlusPos , string.Empty , UIUtils.PlusStyle ) ) + { + m_actionType = ReordableAction.Add; + m_actionIndex = index; + } + + if( GUI.Button( buttonMinusPos , string.Empty , UIUtils.MinusStyle ) ) + { + m_actionType = ReordableAction.Remove; + m_actionIndex = index; + } + } + } + }; + } + + if( m_dependenciesReordableList != null ) + { + EditorGUILayout.Space(); + if( m_dependencies.Count == 0 ) + { + EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one." , MessageType.Info ); + } + else + { + m_dependenciesReordableList.DoLayoutList(); + } + EditorGUILayout.Space(); + } + + if( m_actionType != ReordableAction.None ) + { + switch( m_actionType ) + { + case ReordableAction.Add: + m_dependencies.Insert( m_actionIndex + 1 , new CustomExpressionDependency() ); + break; + case ReordableAction.Remove: + m_dependencies.RemoveAt( m_actionIndex ); + break; + } + m_isDirty = true; + m_actionType = ReordableAction.None; + EditorGUI.FocusTextInControl( null ); + } + } + + void DrawReordableInputs() + { + if( m_itemReordableList == null ) + { + m_itemReordableList = new ReorderableList( m_items , typeof( CustomExpressionInputItem ) , true , false , false , false ) + { + headerHeight = 0 , + footerHeight = 0 , + showDefaultBackground = false , + elementHeightCallback = ( int index ) => + { + float lineHeight = EditorGUIUtility.singleLineHeight * LineAdjust; + if( m_items[ index ].FoldoutFlag ) + { + float size = 7 * lineHeight; + + // Take Is Variable toggle into account + if( m_mode == CustomExpressionMode.Call ) + size += lineHeight; + + if( m_inputPorts[ m_firstAvailablePort + index ].DataType == WirePortDataType.OBJECT ) + size += lineHeight; + + if( !m_inputPorts[ m_firstAvailablePort + index ].IsConnected ) + { + switch( m_inputPorts[ m_firstAvailablePort + index ].DataType ) + { + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + size += 0;// lineHeight; + break; + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + size += lineHeight;//2 * lineHeight; + break; + case WirePortDataType.FLOAT3x3: + size += 5 * lineHeight;//6 * lineHeight; + break; + case WirePortDataType.FLOAT4x4: + size += 6 * lineHeight;//8 * lineHeight; + break; + + } + } + + return size; + } + else + { + return lineHeight; + } + } , + + onReorderCallback = ( ReorderableList list ) => + { + int realLastIndex = m_firstAvailablePort + m_lastIndex; + int realCurrIndex = m_firstAvailablePort + list.index; + + InputPort portA = m_inputPorts[ realLastIndex ]; + int originalOutputPortId = CreateOutputId( portA.PortId ); + + SwapInputPorts( realLastIndex , realCurrIndex ); + + if( m_outputPorts.Count > 1 ) + { + if( list.index > m_lastIndex ) + { + for( int i = m_lastIndex ; i <= list.index ; i++ ) + { + if( m_items[ i ].Qualifier != VariableQualifiers.In ) + { + int portIdx = i + m_firstAvailablePort; + int oldOutputPortId; + if( i < list.index ) + { + int oldinputPortId = m_inputPorts[ portIdx ].PortId + 1; + oldOutputPortId = CreateOutputId( oldinputPortId ); + } + else + { + oldOutputPortId = originalOutputPortId; + } + + m_outputPortsDict[ oldOutputPortId ].ChangePortId( CreateOutputId( m_inputPorts[ portIdx ].PortId ) ); + } + } + } + else + { + for( int i = list.index ; i <= m_lastIndex ; i++ ) + { + if( m_items[ i ].Qualifier != VariableQualifiers.In ) + { + int portIdx = i + m_firstAvailablePort; + int oldOutputPortId; + if( i > list.index ) + { + int oldinputPortId = m_inputPorts[ portIdx ].PortId - 1; + oldOutputPortId = CreateOutputId( oldinputPortId ); + } + else + { + oldOutputPortId = originalOutputPortId; + } + + m_outputPortsDict[ oldOutputPortId ].ChangePortId( CreateOutputId( m_inputPorts[ portIdx ].PortId ) ); + } + } + } + } + + + m_outputPorts.Sort( ( A , B ) => + { + return A.PortId.CompareTo( B.PortId ); + } ); + + m_outputPortsDict.Clear(); + for( int i = 0 ; i < m_outputPorts.Count ; i++ ) + { + m_outputPortsDict.Add( m_outputPorts[ i ].PortId , m_outputPorts[ i ] ); + } + + } , + onSelectCallback = ( ReorderableList list ) => + { + m_lastIndex = list.index; + } , + drawElementCallback = ( Rect rect , int index , bool isActive , bool isFocused ) => + { + if( m_items[ index ] != null ) + { + float lineHeight = EditorGUIUtility.singleLineHeight; + float lineSpacing = lineHeight * LineAdjust; + + rect.x -= IdentationAdjust; + rect.height = lineHeight; + int portIdx = index + m_firstAvailablePort; + Rect foldoutRect = rect; + if( !m_items[ index ].FoldoutFlag ) + { + foldoutRect.width -= 2 * AddRemoveButtonLayoutWidth; + } + m_items[ index ].FoldoutFlag = EditorGUIFoldout( foldoutRect , m_items[ index ].FoldoutFlag , /*m_items[ index ].FoldoutLabel + " - " +*/ m_inputPorts[ portIdx ].Name ); + if( m_items[ index ].FoldoutFlag ) + { + rect.x += IdentationAdjust; + + //Qualifier + rect.y += lineSpacing; + VariableQualifiers newQualifier = (VariableQualifiers)EditorGUIPopup( rect , InputQualifierStr , (int)m_items[ index ].Qualifier , QualifiersStr ); + if( newQualifier != m_items[ index ].Qualifier ) + { + VariableQualifiers oldQualifier = m_items[ index ].Qualifier; + m_items[ index ].Qualifier = newQualifier; + if( newQualifier == VariableQualifiers.In ) + { + RemoveOutputPort( CreateOutputId( m_inputPorts[ portIdx ].PortId ) , false ); + } + else if( oldQualifier == VariableQualifiers.In ) + { + int outputId = CreateOutputId( m_inputPorts[ portIdx ].PortId ); + AddOutputPort( m_inputPorts[ portIdx ].DataType , m_inputPorts[ portIdx ].Name , outputId ); + } + m_inputPorts[ portIdx ].Visible = newQualifier != VariableQualifiers.Out; + m_sizeIsDirty = true; + RecalculateInOutOutputPorts(); + } + + // Precision + rect.y += lineSpacing; + m_items[ index ].Precision = (PrecisionType)EditorGUIPopup( rect , PrecisionContent.text , (int)m_items[ index ].Precision , PrecisionLabelsExtraLocal ); + // Type + rect.y += lineSpacing; + int typeIdx = WireToIdx[ m_inputPorts[ portIdx ].DataType ]; + EditorGUI.BeginChangeCheck(); + typeIdx = EditorGUIPopup( rect , InputTypeStr , typeIdx , AvailableWireTypesStr ); + if( EditorGUI.EndChangeCheck() ) + { + // actual type is need in order for texture array and sampler state to fallback correctly + m_inputPorts[ portIdx ].ChangeType( AvailableWireTypes[ typeIdx ] , false ); + if( typeIdx == 5 || typeIdx == 6 ) + { + m_inputPorts[ portIdx ].Matrix4x4InternalData = Matrix4x4.identity; + } + + if( m_items[ index ].Qualifier != VariableQualifiers.In ) + { + OutputPort currOutPort = GetOutputPortByUniqueId( CreateOutputId( m_inputPorts[ portIdx ].PortId ) ); + currOutPort.ChangeType( AvailableWireTypes[ typeIdx ] , false ); + } + } + + if( AvailableWireTypes[ typeIdx ] == WirePortDataType.OBJECT ) + { + rect.y += lineSpacing; + m_items[ index ].CustomType = EditorGUITextField( rect , CustomTypeStr , m_items[ index ].CustomType ); + } + + //Name + rect.y += lineSpacing; + EditorGUI.BeginChangeCheck(); + { + m_inputPorts[ portIdx ].Name = EditorGUITextField( rect , InputNameStr , m_inputPorts[ portIdx ].Name ); + } + if( EditorGUI.EndChangeCheck() ) + { + m_nameModified = true; + m_lastTimeNameModified = EditorApplication.timeSinceStartup; + m_inputPorts[ portIdx ].Name = UIUtils.RemoveInvalidCharacters( m_inputPorts[ portIdx ].Name ); + if( string.IsNullOrEmpty( m_inputPorts[ portIdx ].Name ) ) + { + m_inputPorts[ portIdx ].Name = DefaultInputNameStr + index; + } + + if( m_items[ index ].Qualifier != VariableQualifiers.In ) + { + OutputPort currOutPort = GetOutputPortByUniqueId( CreateOutputId( m_inputPorts[ portIdx ].PortId ) ); + currOutPort.Name = m_inputPorts[ portIdx ].Name; + } + } + + if( m_mode == CustomExpressionMode.Call ) + { + //Is Unique + rect.y += lineSpacing; + m_items[ index ].IsVariable = EditorGUIToggle( rect , IsVariableStr , m_items[ index ].IsVariable ); + } + // Port Data + if( !m_inputPorts[ portIdx ].IsConnected ) + { + rect.y += lineSpacing; + m_inputPorts[ portIdx ].ShowInternalData( rect , this , true , InputValueStr ); + } + + //Buttons + rect.x += rect.width - 2 * AddRemoveButtonLayoutWidth; + rect.y += lineSpacing; + if( !m_inputPorts[ m_firstAvailablePort + index ].IsConnected ) + { + switch( m_inputPorts[ m_firstAvailablePort + index ].DataType ) + { + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + rect.y += 0;// lineSpacing; + break; + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + rect.y += lineSpacing;//2 * lineSpacing; + break; + case WirePortDataType.FLOAT3x3: + rect.y += 5 * lineSpacing;//6 * lineSpacing; + break; + case WirePortDataType.FLOAT4x4: + rect.y += 6 * lineSpacing;//8 * lineSpacing; + break; + + } + } + rect.width = AddRemoveButtonLayoutWidth; + if( GUI.Button( rect , string.Empty , UIUtils.PlusStyle ) ) + { + m_actionType = ReordableAction.Add; + m_actionIndex = index; + } + rect.x += AddRemoveButtonLayoutWidth; + if( GUI.Button( rect , string.Empty , UIUtils.MinusStyle ) ) + { + m_actionType = ReordableAction.Remove; + m_actionIndex = index; + } + + } + else + { + //Buttons + rect.x += IdentationAdjust + rect.width - 2 * AddRemoveButtonLayoutWidth; + rect.width = AddRemoveButtonLayoutWidth; + if( GUI.Button( rect , string.Empty , UIUtils.PlusStyle ) ) + { + m_actionType = ReordableAction.Add; + m_actionIndex = index; + } + rect.x += AddRemoveButtonLayoutWidth; + if( GUI.Button( rect , string.Empty , UIUtils.MinusStyle ) ) + { + m_actionType = ReordableAction.Remove; + m_actionIndex = index; + } + } + } + } + }; + } + + if( m_itemReordableList != null ) + { + EditorGUILayout.Space(); + if( m_items.Count == 0 ) + { + EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one." , MessageType.Info ); + } + else + { + m_itemReordableList.DoLayoutList(); + } + EditorGUILayout.Space(); + } + + if( m_actionType != ReordableAction.None ) + { + switch( m_actionType ) + { + case ReordableAction.Add: + AddPortAt( m_firstAvailablePort + m_actionIndex + 1 ); + break; + case ReordableAction.Remove: + RemovePortAt( m_firstAvailablePort + m_actionIndex ); + break; + } + m_isDirty = true; + m_actionType = ReordableAction.None; + EditorGUI.FocusTextInControl( null ); + } + } + + void RecalculateInOutOutputPorts() + { + m_outputPorts.Sort( ( x , y ) => x.PortId.CompareTo( y.PortId ) ); + + m_outputPortsDict.Clear(); + int count = m_inputPorts.Count - m_firstAvailablePort; + int outputId = 1; + for( int i = 0 ; i < count ; i++ ) + { + int idx = i + m_firstAvailablePort; + if( m_items[ i ].Qualifier != VariableQualifiers.In ) + { + m_outputPorts[ outputId ].ChangeProperties( m_inputPorts[ idx ].Name , m_inputPorts[ idx ].DataType , false ); + m_outputPorts[ outputId ].ChangePortId( CreateOutputId( m_inputPorts[ idx ].PortId ) ); + outputId++; + } + } + + int outCount = m_outputPorts.Count; + for( int i = 0 ; i < outCount ; i++ ) + { + m_outputPortsDict.Add( m_outputPorts[ i ].PortId , m_outputPorts[ i ] ); + } + } + + void AddPortAt( int idx ) + { + AddInputPortAt( idx , WirePortDataType.FLOAT , false , GetFirstAvailableName() ); + m_items.Insert( idx - m_firstAvailablePort , new CustomExpressionInputItem( PrecisionType.Inherit , VariableQualifiers.In , string.Empty , false , true , string.Empty/* "[" + idx + "]"*/ ) ); + m_repopulateNameDictionary = true; + RecalculateInOutOutputPorts(); + } + + void RemovePortAt( int idx ) + { + if( m_inputPorts.Count > m_firstAvailablePort ) + { + int varIdx = idx - m_firstAvailablePort; + if( m_items[ varIdx ].Qualifier != VariableQualifiers.In ) + { + int id = CreateOutputId( m_inputPorts[ idx ].PortId ); + RemoveOutputPort( id , false ); + } + + DeleteInputPortByArrayIdx( idx ); + m_items.RemoveAt( varIdx ); + + m_repopulateNameDictionary = true; + + RecalculateInOutOutputPorts(); + } + } + + public override void OnAfterDeserialize() + { + base.OnAfterDeserialize(); + m_repopulateNameDictionary = true; + } + + public string DealWithFileMode( int outputId , ref MasterNodeDataCollector dataCollector , bool ignoreLocalvar ) + { + OutputPort outputPort = GetOutputPortByUniqueId( outputId ); + if( outputPort.IsLocalValue( dataCollector.PortCategory ) ) + return outputPort.LocalValue( dataCollector.PortCategory ); + + if( m_fileAsset == null && !string.IsNullOrEmpty( m_fileGUID ) ) + { + m_fileAsset = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( m_fileGUID ) ); + } + + if( m_fileAsset != null ) + { + string path = GetFileAssetRelativePath(); + + if( !string.IsNullOrEmpty( path ) ) + dataCollector.AddToIncludes( UniqueId , path ); + } + + int dependenciesCount = m_dependencies.Count; + Dictionary examinedNodes = new Dictionary(); + for( int i = 0 ; i < dependenciesCount ; i++ ) + { + CustomExpressionNode node = m_containerGraph.GetNode( m_dependencies[ i ].DependencyNodeId ) as CustomExpressionNode; + if( node == null ) + { + node = UIUtils.CurrentWindow.OutsideGraph.GetNode( m_dependencies[ i ].DependencyNodeId ) as CustomExpressionNode; + } + + if( node != null ) + { + node.CheckDependencies( ref dataCollector , ref examinedNodes ); + } + } + + examinedNodes.Clear(); + examinedNodes = null; + + string expressionName = UIUtils.RemoveInvalidCharacters( m_customExpressionName ); + string localVarName = "local" + expressionName; + + localVarName += OutputId; + + int count = m_inputPorts.Count; + + if( m_voidMode ) + { + string mainData = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + RegisterLocalVariable( 0 , string.Format( Constants.CodeWrapper , mainData ) , ref dataCollector , localVarName ); + } + string precisionSuffix = string.Empty; + if( m_precisionSuffix ) + { + switch( CurrentPrecisionType ) + { + default: + case PrecisionType.Float: precisionSuffix = "_float"; break; + case PrecisionType.Half: precisionSuffix = "_half"; break; + } + } + + string functionCall = expressionName + precisionSuffix + "( "; + for( int i = m_firstAvailablePort ; i < count ; i++ ) + { + if( UIUtils.CurrentWindow.OutsideGraph.SamplingMacros && !UIUtils.CurrentWindow.OutsideGraph.IsSRP ) + { + // we don't know what kind of sampling the user will do so we add all of them + GeneratorUtils.AddCustomStandardSamplingMacros( ref dataCollector , m_inputPorts[ i ].DataType , MipType.Auto ); + GeneratorUtils.AddCustomStandardSamplingMacros( ref dataCollector , m_inputPorts[ i ].DataType , MipType.MipLevel ); + GeneratorUtils.AddCustomStandardSamplingMacros( ref dataCollector , m_inputPorts[ i ].DataType , MipType.MipBias ); + GeneratorUtils.AddCustomStandardSamplingMacros( ref dataCollector , m_inputPorts[ i ].DataType , MipType.Derivative ); + } + + string inputPortLocalVar = m_inputPorts[ i ].Name + OutputId; + int idx = i - m_firstAvailablePort; + if( m_inputPorts[ i ].DataType != WirePortDataType.OBJECT ) + { + string result = m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); + dataCollector.AddLocalVariable( UniqueId , CurrentPrecisionType , m_inputPorts[ i ].DataType , inputPortLocalVar , result ); + } + else + { + string result = ( m_inputPorts[ i ].IsConnected ) ? m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ) : m_inputPorts[ i ].InternalData.ToString(); + string inputLocalVar = string.Format( Constants.CustomTypeLocalValueDecWithoutIdent , m_items[ idx ].CustomType , inputPortLocalVar , result ); + dataCollector.AddLocalVariable( UniqueId , inputLocalVar ); + } + + if( m_items[ idx ].Qualifier != VariableQualifiers.In ) + { + OutputPort currOutputPort = GetOutputPortByUniqueId( CreateOutputId( m_inputPorts[ i ].PortId ) ); + currOutputPort.SetLocalValue( inputPortLocalVar , dataCollector.PortCategory ); + } + functionCall += inputPortLocalVar; + if( i < ( count - 1 ) ) + { + functionCall += " , "; + } + } + functionCall += " )"; + + if( m_voidMode ) + { + dataCollector.AddLocalVariable( 0 , functionCall + ";" , true ); + } + else + { + RegisterLocalVariable( 0 , functionCall , ref dataCollector , localVarName ); + } + + return outputPort.LocalValue( dataCollector.PortCategory ); + } + + public override string GenerateShaderForOutput( int outputId , ref MasterNodeDataCollector dataCollector , bool ignoreLocalvar ) + { + if( Mode == CustomExpressionMode.File ) + { + return DealWithFileMode( outputId , ref dataCollector , ignoreLocalvar ); + } + + if( string.IsNullOrEmpty( m_code ) ) + { + UIUtils.ShowMessage( UniqueId , string.Format( "Custom Expression '{0}' need to have code associated" , m_customExpressionName ) , MessageSeverity.Warning ); + return "0"; + } + + m_code = UIUtils.ForceLFLineEnding( m_code ); + + bool codeContainsReturn = m_code.Contains( ReturnHelper ); + + bool expressionMode = false; + if( !codeContainsReturn ) + { + string[] codeLines = m_code.Split( IOUtils.LINE_TERMINATOR ); + expressionMode = codeLines.Length == 1 && !m_voidMode; + } + + if( !expressionMode && + !codeContainsReturn && + m_mode == CustomExpressionMode.Create && !m_voidMode ) + { + UIUtils.ShowMessage( UniqueId , string.Format( "Custom Expression '{0}' has a non-void return type but no return instruction was detected" , m_customExpressionName ) , MessageSeverity.Error ); + + if( outputId != 0 ) + UIUtils.ShowMessage( UniqueId , string.Format( "Attempting to get value on Custom Expression '{0}' from inexisting '{1}' inout/out variable" , m_customExpressionName , m_outputPorts[ outputId ].Name ) , MessageSeverity.Error ); + + return "0"; + } + + int dependenciesCount = m_dependencies.Count; + Dictionary examinedNodes = new Dictionary(); + for( int i = 0 ; i < dependenciesCount ; i++ ) + { + CustomExpressionNode node = m_containerGraph.GetNode( m_dependencies[ i ].DependencyNodeId ) as CustomExpressionNode; + if( node == null ) + { + node = UIUtils.CurrentWindow.OutsideGraph.GetNode( m_dependencies[ i ].DependencyNodeId ) as CustomExpressionNode; + } + + if( node != null ) + { + node.CheckDependencies( ref dataCollector , ref examinedNodes ); + } + } + examinedNodes.Clear(); + examinedNodes = null; + + + OutputPort outputPort = GetOutputPortByUniqueId( outputId ); + if( outputPort.IsLocalValue( dataCollector.PortCategory ) ) + return outputPort.LocalValue( dataCollector.PortCategory ); + + string expressionName = UIUtils.RemoveInvalidCharacters( m_customExpressionName ); + string localVarName = "local" + expressionName; + + if( m_generateUniqueName ) + { + expressionName += OutputId; + } + localVarName += OutputId; + + int count = m_inputPorts.Count; + if( count > 0 ) + { + if( m_mode == CustomExpressionMode.Call || m_voidMode ) + { + string mainData = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + RegisterLocalVariable( 0 , string.Format( Constants.CodeWrapper , mainData ) , ref dataCollector , localVarName ); + } + + if( codeContainsReturn ) + { + string function = WrapCodeInFunction( dataCollector.IsTemplate , expressionName , false ); + string functionCall = expressionName + "( "; + for( int i = m_firstAvailablePort ; i < count ; i++ ) + { + if( UIUtils.CurrentWindow.OutsideGraph.SamplingMacros && !UIUtils.CurrentWindow.OutsideGraph.IsSRP ) + { + // we don't know what kind of sampling the user will do so we add all of them + GeneratorUtils.AddCustomStandardSamplingMacros( ref dataCollector , m_inputPorts[ i ].DataType , MipType.Auto ); + GeneratorUtils.AddCustomStandardSamplingMacros( ref dataCollector , m_inputPorts[ i ].DataType , MipType.MipLevel ); + GeneratorUtils.AddCustomStandardSamplingMacros( ref dataCollector , m_inputPorts[ i ].DataType , MipType.MipBias ); + GeneratorUtils.AddCustomStandardSamplingMacros( ref dataCollector , m_inputPorts[ i ].DataType , MipType.Derivative ); + } + + string inputPortLocalVar = m_inputPorts[ i ].Name + OutputId; + int idx = i - m_firstAvailablePort; + if( m_inputPorts[ i ].DataType != WirePortDataType.OBJECT ) + { + string result = m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); + if ( !m_inputPorts[ i ].IsConnected && m_inputPorts[ i ].DataType == WirePortDataType.SAMPLERSTATE ) + { + result = GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, DefaultSamplerStateStr, VariableMode.Create ); + } + dataCollector.AddLocalVariable( UniqueId , CurrentPrecisionType , m_inputPorts[ i ].DataType , inputPortLocalVar , result ); + } + else + { + string result = ( m_inputPorts[ i ].IsConnected ) ? m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ) : m_inputPorts[ i ].InternalData.ToString(); + string inputLocalVar = string.Format( Constants.CustomTypeLocalValueDecWithoutIdent , m_items[ idx ].CustomType , inputPortLocalVar , result ); + dataCollector.AddLocalVariable( UniqueId , inputLocalVar ); + } + + if( m_items[ idx ].Qualifier != VariableQualifiers.In ) + { + OutputPort currOutputPort = GetOutputPortByUniqueId( CreateOutputId( m_inputPorts[ i ].PortId ) ); + currOutputPort.SetLocalValue( inputPortLocalVar , dataCollector.PortCategory ); + } + functionCall += inputPortLocalVar; + if( i < ( count - 1 ) ) + { + functionCall += " , "; + } + } + functionCall += " )"; + + if( m_mode == CustomExpressionMode.Call || m_voidMode ) + { + dataCollector.AddLocalVariable( 0 , functionCall + ";" , true ); + } + else + { + RegisterLocalVariable( 0 , functionCall , ref dataCollector , localVarName ); + } + + dataCollector.AddFunction( expressionName , function ); + } + else + { + + string localCode = m_code; + if( m_mode == CustomExpressionMode.Call || m_voidMode ) + { + for( int i = m_firstAvailablePort ; i < count ; i++ ) + { + int idx = i - m_firstAvailablePort; + if( !m_items[ idx ].IsVariable || + m_items[ idx ].Qualifier != VariableQualifiers.In || + !m_inputPorts[ i ].IsConnected + ) + { + string inputPortLocalVar = m_inputPorts[ i ].Name + OutputId; + string nameToReplaceRegex = string.Format( VarRegexReplacer , m_inputPorts[ i ].Name ); + localCode = Regex.Replace( localCode , nameToReplaceRegex , inputPortLocalVar , RegexOptions.Multiline ); + //localCode = localCode.Replace( m_inputPorts[ i ].Name, inputPortLocalVar ); + + if( m_inputPorts[ i ].IsConnected ) + { + string result = m_inputPorts[ i ].GenerateShaderForOutput( ref dataCollector , m_inputPorts[ i ].DataType , true , true ); + if( m_inputPorts[ i ].DataType == WirePortDataType.OBJECT ) + { + dataCollector.AddLocalVariable( UniqueId , m_items[ idx ].CustomType + " " + inputPortLocalVar , result + ";" ); + } + else + { + dataCollector.AddLocalVariable( UniqueId , CurrentPrecisionType , m_inputPorts[ i ].DataType , inputPortLocalVar , result ); + } + } + else + { + if( m_inputPorts[ i ].DataType == WirePortDataType.OBJECT ) + { + dataCollector.AddLocalVariable( UniqueId , m_items[ idx ].CustomType + " " + inputPortLocalVar , m_inputPorts[ i ].WrappedInternalData + ";" ); + } + else + { + string result = m_inputPorts[ i ].WrappedInternalData; + if ( m_inputPorts[ i ].DataType == WirePortDataType.SAMPLERSTATE ) + { + result = GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, DefaultSamplerStateStr, VariableMode.Create ); + } + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ i ].DataType, inputPortLocalVar, result ); + } + } + + if( m_items[ idx ].Qualifier != VariableQualifiers.In ) + { + OutputPort currOutputPort = GetOutputPortByUniqueId( CreateOutputId( m_inputPorts[ i ].PortId ) ); + currOutputPort.SetLocalValue( inputPortLocalVar , dataCollector.PortCategory ); + } + } + else + { + // Not Unique + string result = m_inputPorts[ i ].GenerateShaderForOutput( ref dataCollector , m_inputPorts[ i ].DataType , true , true ); + string nameToReplaceRegex = string.Format( VarRegexReplacer , m_inputPorts[ i ].Name ); + localCode = Regex.Replace( localCode , nameToReplaceRegex , result , RegexOptions.Multiline ); + //localCode = localCode.Replace( m_inputPorts[ i ].Name, result ); + } + } + localCode = string.Format( Constants.InlineCodeWrapper , localCode ); + string[] codeLines = localCode.Split( '\n' ); + for( int codeIdx = 0 ; codeIdx < codeLines.Length ; codeIdx++ ) + { + dataCollector.AddLocalVariable( 0 , codeLines[ codeIdx ] , true ); + } + } + else + { + string function = WrapCodeInFunction( dataCollector.IsTemplate , expressionName , true ); + + string functionCall = expressionName + "( "; + for( int i = m_firstAvailablePort ; i < count ; i++ ) + { + if( UIUtils.CurrentWindow.OutsideGraph.SamplingMacros && !UIUtils.CurrentWindow.OutsideGraph.IsSRP ) + { + // we don't know what kind of sampling the user will do so we add all of them + GeneratorUtils.AddCustomStandardSamplingMacros( ref dataCollector , m_inputPorts[ i ].DataType , MipType.Auto ); + GeneratorUtils.AddCustomStandardSamplingMacros( ref dataCollector , m_inputPorts[ i ].DataType , MipType.MipLevel ); + GeneratorUtils.AddCustomStandardSamplingMacros( ref dataCollector , m_inputPorts[ i ].DataType , MipType.MipBias ); + GeneratorUtils.AddCustomStandardSamplingMacros( ref dataCollector , m_inputPorts[ i ].DataType , MipType.Derivative ); + } + + string inputPortLocalVar = m_inputPorts[ i ].Name + OutputId; + int idx = i - m_firstAvailablePort; + if( m_inputPorts[ i ].DataType != WirePortDataType.OBJECT ) + { + string result = m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); + dataCollector.AddLocalVariable( UniqueId , CurrentPrecisionType , m_inputPorts[ i ].DataType , inputPortLocalVar , result ); + } + else + { + string result = ( m_inputPorts[ i ].IsConnected ) ? m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ) : m_inputPorts[ i ].InternalData.ToString(); + string inputLocalVar = string.Format( Constants.CustomTypeLocalValueDecWithoutIdent , m_items[ idx ].CustomType , inputPortLocalVar , result ); + dataCollector.AddLocalVariable( UniqueId , inputLocalVar ); + } + + if( m_items[ idx ].Qualifier != VariableQualifiers.In ) + { + OutputPort currOutputPort = GetOutputPortByUniqueId( CreateOutputId( m_inputPorts[ i ].PortId ) ); + currOutputPort.SetLocalValue( inputPortLocalVar , dataCollector.PortCategory ); + } + functionCall += inputPortLocalVar; + if( i < ( count - 1 ) ) + { + functionCall += " , "; + } + } + functionCall += " )"; + RegisterLocalVariable( 0 , functionCall , ref dataCollector , localVarName ); + dataCollector.AddFunction( expressionName , function ); + } + } + + return outputPort.LocalValue( dataCollector.PortCategory ); + } + else + { + if( m_code.Contains( ReturnHelper ) ) + { + string function = WrapCodeInFunction( dataCollector.IsTemplate , expressionName , false ); + dataCollector.AddFunction( expressionName , function ); + string functionCall = expressionName + "()"; + RegisterLocalVariable( 0 , functionCall , ref dataCollector , localVarName ); + } + else + { + RegisterLocalVariable( 0 , string.Format( Constants.CodeWrapper , m_code ) , ref dataCollector , localVarName ); + } + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } + + int CreateOutputId( int inputId ) + { + return ( inputId + 1 ); + } + + int CreateInputId( int outputId ) + { + return outputId - 1; + } + + void UpdateOutputPorts() + { + int count = m_inputPorts.Count - m_firstAvailablePort; + for( int i = 0 ; i < count ; i++ ) + { + if( m_items[ i ].Qualifier != VariableQualifiers.In ) + { + int portIdx = i + m_firstAvailablePort; + int outputPortId = CreateOutputId( m_inputPorts[ portIdx ].PortId ); + AddOutputPort( m_inputPorts[ portIdx ].DataType , m_inputPorts[ portIdx ].Name , outputPortId ); + } + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + // This node is, by default, created with one input port + base.ReadFromString( ref nodeParams ); + m_code = GetCurrentParam( ref nodeParams ); + m_code = m_code.Replace( Constants.LineFeedSeparator , '\n' ); + m_code = m_code.Replace( Constants.SemiColonSeparator , ';' ); + m_outputTypeIdx = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( m_outputTypeIdx >= AvailableWireTypes.Length ) + { + UIUtils.ShowMessage( UniqueId , "Sampler types were removed as a valid output custom expression type" ); + m_outputTypeIdx = 1; + } + UpdateVoidMode(); + m_outputPorts[ 0 ].ChangeType( AvailableWireTypes[ m_outputTypeIdx ] , false ); + + if( UIUtils.CurrentShaderVersion() > 12001 ) + { + if( UIUtils.CurrentShaderVersion() > 18901 ) + { + m_mode = (CustomExpressionMode)Enum.Parse( typeof( CustomExpressionMode ) , GetCurrentParam( ref nodeParams ) ); + } + else + { + bool mode = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_mode = mode ? CustomExpressionMode.Call : CustomExpressionMode.Create; + } + + if( m_mode == CustomExpressionMode.Call || m_voidMode ) + { + m_firstAvailablePort = 1; + AddInputPortAt( 0 , WirePortDataType.FLOAT , false , DefaultInputNameStr ); + } + } + + if( m_mode == CustomExpressionMode.Call || m_mode == CustomExpressionMode.File ) + UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.RemoveNode( this ); + + int count = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( count == 0 ) + { + DeleteInputPortByArrayIdx( m_firstAvailablePort ); + m_items.Clear(); + } + else + { + for( int i = 0 ; i < count ; i++ ) + { + bool foldoutValue = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + string name = GetCurrentParam( ref nodeParams ); + WirePortDataType type = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ) , GetCurrentParam( ref nodeParams ) ); + string internalData = GetCurrentParam( ref nodeParams ); + VariableQualifiers qualifier = VariableQualifiers.In; + if( UIUtils.CurrentShaderVersion() > 12001 ) + { + qualifier = (VariableQualifiers)Enum.Parse( typeof( VariableQualifiers ) , GetCurrentParam( ref nodeParams ) ); + } + string customType = string.Empty; + if( UIUtils.CurrentShaderVersion() > 15311 ) + { + customType = GetCurrentParam( ref nodeParams ); + } + PrecisionType precision = PrecisionType.Float; + if( UIUtils.CurrentShaderVersion() > 15607 ) + { + precision = (PrecisionType)Enum.Parse( typeof( PrecisionType ) , GetCurrentParam( ref nodeParams ) ); + } + bool isVariable = false; + if( UIUtils.CurrentShaderVersion() > 16600 ) + { + isVariable = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + int portIdx = i + m_firstAvailablePort; + if( i == 0 ) + { + m_inputPorts[ portIdx ].ChangeProperties( name , type , false ); + m_inputPorts[ portIdx ].Visible = qualifier != VariableQualifiers.Out; + m_items[ 0 ].Qualifier = qualifier; + m_items[ 0 ].FoldoutFlag = foldoutValue; + m_items[ 0 ].CustomType = customType; + m_items[ 0 ].Precision = precision; + m_items[ 0 ].IsVariable = isVariable; + } + else + { + m_items.Add( new CustomExpressionInputItem( precision , qualifier , customType , isVariable , foldoutValue , string.Empty/*"[" + i + "]"*/ ) ); + AddInputPort( type , false , name ); + m_inputPorts[ m_inputPorts.Count - 1 ].Visible = qualifier != VariableQualifiers.Out; + } + m_inputPorts[ i ].InternalData = internalData; + } + } + + if( UIUtils.CurrentShaderVersion() > 7205 ) + { + m_customExpressionName = GetCurrentParam( ref nodeParams ); + SetTitleText( m_customExpressionName ); + } + + if( UIUtils.CurrentShaderVersion() > 14401 ) + { + m_generateUniqueName = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 15102 ) + { + m_autoRegisterMode = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 15403 ) + { + int dependencyCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + for( int i = 0 ; i < dependencyCount ; i++ ) + { + m_dependencies.Add( new CustomExpressionDependency( GetCurrentParam( ref nodeParams ) ) ); + } + } + + if( UIUtils.CurrentShaderVersion() > 18901 ) + { + m_fileGUID = GetCurrentParam( ref nodeParams ); + if( !string.IsNullOrEmpty( m_fileGUID ) ) + { + m_fileAsset = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( m_fileGUID ) ); + } + + m_precisionSuffix = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + if( m_mode == CustomExpressionMode.Create ) + { + UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.AddNode( this ); + } + UpdateOutputPorts(); + + m_repopulateNameDictionary = true; + m_functionMode = m_code.Contains( ReturnHelper ); + CheckCallMode(); + + } + + public override void WriteToString( ref string nodeInfo , ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo , ref connectionsInfo ); + + m_code = m_code.Replace( Constants.LineFeedSeparator.ToString() , string.Empty ); + m_code = m_code.Replace( Constants.SemiColonSeparator.ToString() , string.Empty ); + m_code = UIUtils.ForceLFLineEnding( m_code ); + + string parsedCode = m_code.Replace( '\n' , Constants.LineFeedSeparator ); + parsedCode = parsedCode.Replace( ';' , Constants.SemiColonSeparator ); + + IOUtils.AddFieldValueToString( ref nodeInfo , parsedCode ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_outputTypeIdx ); + //IOUtils.AddFieldValueToString( ref nodeInfo, m_mode == CustomExpressionMode.Call ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_mode ); + + int count = m_inputPorts.Count - m_firstAvailablePort; + IOUtils.AddFieldValueToString( ref nodeInfo , count ); + for( int i = 0 ; i < count ; i++ ) + { + int portIdx = m_firstAvailablePort + i; + IOUtils.AddFieldValueToString( ref nodeInfo , m_items[ i ].FoldoutFlag ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_inputPorts[ portIdx ].Name ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_inputPorts[ portIdx ].DataType ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_inputPorts[ portIdx ].InternalData ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_items[ i ].Qualifier ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_items[ i ].CustomType ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_items[ i ].Precision ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_items[ i ].IsVariable ); + } + IOUtils.AddFieldValueToString( ref nodeInfo , m_customExpressionName ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_generateUniqueName ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_autoRegisterMode ); + count = m_dependencies.Count; + IOUtils.AddFieldValueToString( ref nodeInfo , count ); + for( int i = 0 ; i < count ; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo , m_dependencies[ i ].DependencyNodeId ); + } + + m_fileGUID = ( m_fileAsset == null ) ? string.Empty : + AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_fileAsset ) ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_fileGUID ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_precisionSuffix ); + } + + public override void Destroy() + { + base.Destroy(); + if( m_mode == CustomExpressionMode.Create ) + { + UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.RemoveNode( this ); + } + m_items.Clear(); + m_items = null; + m_dependencies.Clear(); + m_dependencies = null; + m_itemReordableList = null; + } + + public void CheckDependencies( ref MasterNodeDataCollector dataCollector , ref Dictionary examinedNodes ) + { + if( !examinedNodes.ContainsKey( UniqueId ) && m_mode == CustomExpressionMode.Create && !m_generateUniqueName ) + { + int dependencyCount = m_dependencies.Count; + for( int d = 0 ; d < dependencyCount ; d++ ) + { + if( !examinedNodes.ContainsKey( m_dependencies[ d ].DependencyNodeId ) ) + { + CustomExpressionNode dNode = m_containerGraph.GetNode( m_dependencies[ d ].DependencyNodeId ) as CustomExpressionNode; + + if( dNode == null ) + { + dNode = UIUtils.CurrentWindow.OutsideGraph.GetNode( m_dependencies[ d ].DependencyNodeId ) as CustomExpressionNode; + } + + if( dNode != null ) + { + dNode.CheckDependencies( ref dataCollector , ref examinedNodes ); + } + } + } + dataCollector.AddFunction( ExpressionName , EncapsulatedCode( dataCollector.IsTemplate ) ); + examinedNodes.Add( UniqueId , this ); + } + } + + public string EncapsulatedCode( bool isTemplate ) + { + string functionName = UIUtils.RemoveInvalidCharacters( m_customExpressionName ); + if( m_generateUniqueName ) + { + functionName += OutputId; + } + return WrapCodeInFunction( isTemplate , functionName , false ); + } + + public CustomExpressionMode Mode + { + get { return m_mode; } + set + { + if( m_mode != value ) + { + m_mode = value; + if( m_mode == CustomExpressionMode.Call ) + { + AutoRegisterMode = false; + m_generateUniqueName = false; + UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.RemoveNode( this ); + } + else if( m_mode == CustomExpressionMode.File ) + { + m_generateUniqueName = false; + UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.RemoveNode( this ); + } + else if( m_mode == CustomExpressionMode.Create ) + { + UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.AddNode( this ); + } + } + } + } + + public string ExpressionName + { + get + { + string expressionName = UIUtils.RemoveInvalidCharacters( m_customExpressionName ); + + if( m_generateUniqueName ) + { + expressionName += OutputId; + } + return expressionName; + } + } + public override string DataToArray { get { return m_customExpressionName; } } + public bool AutoRegisterMode + { + get { return m_autoRegisterMode; } + set + { + if( value != m_autoRegisterMode ) + { + m_autoRegisterMode = value; + } + } + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + int portCount = m_inputPorts.Count; + for( int i = 0 ; i < portCount ; i++ ) + { + if( m_inputPorts[ i ].DataType == WirePortDataType.COLOR ) + { + m_inputPorts[ i ].ChangeType( WirePortDataType.FLOAT4 , false ); ; + } + } + + int dependencyCount = m_dependencies.Count; + for( int i = 0 ; i < dependencyCount ; i++ ) + { + m_dependencies[ i ].DependencyArrayIdx = UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.GetNodeRegisterIdx( m_dependencies[ i ].DependencyNodeId ); + } + //Fixing bug where user could set main output port as OBJECT + if( m_outputPorts[ 0 ].DataType == WirePortDataType.OBJECT && ( m_voidMode || m_mode == CustomExpressionMode.Call ) ) + { + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType , false ); + } + } + + public override void FireTimedUpdate() + { + UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.UpdateDataOnNode( UniqueId , m_customExpressionName ); + } + + public List Dependencies { get { return m_dependencies; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs.meta new file mode 100644 index 00000000..7e5f214f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f2507a764c07082458e350211d671334 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs new file mode 100644 index 00000000..64cc8ebe --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs @@ -0,0 +1,475 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + + public struct AppendData + { + public WirePortDataType PortType; + public int OldPortId; + public int NewPortId; + public AppendData( WirePortDataType portType, int oldPortId, int newPortId ) + { + PortType = portType; + OldPortId = oldPortId; + NewPortId = newPortId; + } + } + + [Serializable] + [NodeAttributes( "Append", "Vector Operators", "Append channels to create a new component", null, KeyCode.V, tags: "combine" )] + public sealed class DynamicAppendNode : ParentNode + { + private const string OutputTypeStr = "Output type"; + private const string OutputFormatStr = "({0}({1}))"; + + [SerializeField] + private WirePortDataType m_selectedOutputType = WirePortDataType.FLOAT4; + + [SerializeField] + private int m_selectedOutputTypeInt = 2; + + private readonly string[] m_outputValueTypes ={ "Vector2", + "Vector3", + "Vector4", + "Color"}; + + [SerializeField] + private int[] m_occupiedChannels = { -1, -1, -1, -1 }; + + [SerializeField] + private int m_maskId; + + [SerializeField] + private Vector4 m_maskValue = Vector4.one; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.ChannelNamesVector[ 0 ] ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.ChannelNamesVector[ 1 ] ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.ChannelNamesVector[ 2 ] ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.ChannelNamesVector[ 3 ] ); + AddOutputPort( m_selectedOutputType, Constants.EmptyPortValue ); + m_textLabelWidth = 90; + m_autoWrapProperties = true; + m_useInternalPortData = true; + m_hasLeftDropdown = true; + m_previewShaderGUID = "bfcd2919fe75bbf428fbbe583f463a9e"; + } + + public override void OnEnable() + { + base.OnEnable(); + m_maskId = Shader.PropertyToID( "_Mask" ); + } + + void NewUpdateBehaviorConn( int portId, bool onLoading ) + { + InputPort inputPort = GetInputPortByUniqueId( portId ); + int channelsRequired = UIUtils.GetChannelsAmount( onLoading ? inputPort.DataType : inputPort.ConnectionType( 0 ) ); + int availableChannels = UIUtils.GetChannelsAmount( m_selectedOutputType ); + + // Invalidate previously used channels + for( int i = 0; i < availableChannels; i++ ) + { + if( m_occupiedChannels[ i ] == portId ) + { + m_occupiedChannels[ i ] = -1; + m_inputPorts[ i ].Visible = true; + } + } + // Lock available channels to port + int len = Mathf.Min( portId + channelsRequired, availableChannels ); + + int channelsUsed = 0; + for( int i = portId; i < len; i++ ) + { + if( m_occupiedChannels[ i ] == -1 ) + { + m_occupiedChannels[ i ] = portId; + channelsUsed += 1; + } + else + { + break; + } + } + + if( !onLoading ) + inputPort.ChangeType( UIUtils.GetWireTypeForChannelAmount( channelsUsed ), false ); + + if( channelsUsed > 1 && portId < availableChannels - 1 ) + { + channelsUsed -= 1; + int i = portId + 1; + for( ; channelsUsed > 0; i++, --channelsUsed ) + { + m_inputPorts[ i ].Visible = false; + } + + } + m_sizeIsDirty = true; + } + + void NewUpdateBehaviorDisconn( int portId ) + { + int availableChannels = UIUtils.GetChannelsAmount( m_selectedOutputType ); + // Invalidate previously used channels + for( int i = 0; i < availableChannels; i++ ) + { + if( m_occupiedChannels[ i ] == portId ) + { + m_occupiedChannels[ i ] = -1; + m_inputPorts[ i ].Visible = true; + m_inputPorts[ i ].ChangeType( WirePortDataType.FLOAT, false ); + } + } + m_sizeIsDirty = true; + } + + void RenamePorts() + { + int channel = 0; + for( int i = 0; i < 4; i++ ) + { + if( m_inputPorts[ i ].Visible ) + { + string name = string.Empty; + int usedChannels = UIUtils.GetChannelsAmount( m_inputPorts[ i ].DataType ); + bool isColor = ( m_selectedOutputType == WirePortDataType.COLOR ); + for( int j = 0; j < usedChannels; j++ ) + { + if( channel < Constants.ChannelNamesVector.Length ) + name += isColor ? Constants.ChannelNamesColor[ channel++ ] : Constants.ChannelNamesVector[ channel++ ]; + } + m_inputPorts[ i ].Name = name; + } + } + + CalculatePreviewData(); + } + + void UpdatePortTypes() + { + ChangeOutputType( m_selectedOutputType, false ); + int availableChannels = UIUtils.GetChannelsAmount( m_selectedOutputType ); + int usedChannels = 0; + while( usedChannels < availableChannels ) + { + int channelsRequired = m_inputPorts[ usedChannels ].IsConnected ? UIUtils.GetChannelsAmount( m_inputPorts[ usedChannels ].DataType ) : 0; + if( channelsRequired > 0 ) + { + + if( ( usedChannels + channelsRequired ) < availableChannels ) + { + usedChannels += channelsRequired; + } + else + { + m_inputPorts[ usedChannels ].Visible = true; + WirePortDataType newType = UIUtils.GetWireTypeForChannelAmount( availableChannels - usedChannels ); + m_inputPorts[ usedChannels ].ChangeType( newType, false ); + usedChannels = availableChannels; + break; + } + } + else + { + m_occupiedChannels[ usedChannels ] = -1; + m_inputPorts[ usedChannels ].Visible = true; + m_inputPorts[ usedChannels ].ChangeType( WirePortDataType.FLOAT, false ); + usedChannels += 1; + } + } + + for( int i = usedChannels; i < availableChannels; i++ ) + { + m_occupiedChannels[ i ] = -1; + m_inputPorts[ i ].Visible = true; + m_inputPorts[ i ].ChangeType( WirePortDataType.FLOAT, false ); + } + + for( int i = availableChannels; i < 4; i++ ) + { + m_occupiedChannels[ i ] = -1; + m_inputPorts[ i ].Visible = false; + m_inputPorts[ i ].ChangeType( WirePortDataType.FLOAT, false ); + } + m_sizeIsDirty = true; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + + if( ( m_containerGraph.IsLoading || m_isNodeBeingCopied ) && UIUtils.CurrentShaderVersion() < 13206 ) + return; + + NewUpdateBehaviorConn( portId, ( UIUtils.IsLoading|| m_isNodeBeingCopied ) ); + RenamePorts(); + + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + + if( ( UIUtils.IsLoading || m_isNodeBeingCopied ) && UIUtils.CurrentShaderVersion() < 13206 ) + return; + + NewUpdateBehaviorDisconn( portId ); + RenamePorts(); + } + + public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); + + if( ( UIUtils.IsLoading || m_isNodeBeingCopied ) && UIUtils.CurrentShaderVersion() < 13206 ) + return; + + NewUpdateBehaviorConn( portId, ( UIUtils.IsLoading || m_isNodeBeingCopied ) ); + RenamePorts(); + } + + void SetupPorts() + { + switch( m_selectedOutputTypeInt ) + { + case 0: m_selectedOutputType = WirePortDataType.FLOAT2; break; + case 1: m_selectedOutputType = WirePortDataType.FLOAT3; break; + case 2: m_selectedOutputType = WirePortDataType.FLOAT4; break; + case 3: m_selectedOutputType = WirePortDataType.COLOR; break; + } + UpdatePortTypes(); + RenamePorts(); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( m_dropdownEditing ) + { + EditorGUI.BeginChangeCheck(); + m_selectedOutputTypeInt = EditorGUIPopup( m_dropdownRect, m_selectedOutputTypeInt, m_outputValueTypes, UIUtils.PropertyPopUp ); + if( EditorGUI.EndChangeCheck() ) + { + SetupPorts(); + DropdownEditing = false; + } + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUILayout.BeginVertical(); + + EditorGUI.BeginChangeCheck(); + m_selectedOutputTypeInt = EditorGUILayoutPopup( OutputTypeStr, m_selectedOutputTypeInt, m_outputValueTypes ); + if( EditorGUI.EndChangeCheck() ) + { + SetupPorts(); + } + + EditorGUILayout.EndVertical(); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + string result = string.Empty; + for( int i = 0; i < 4; i++ ) + { + if( m_inputPorts[ i ].Visible ) + { + if( i > 0 ) + { + result += " , "; + } + result += m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); + } + } + + result = string.Format( OutputFormatStr, + UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_selectedOutputType ), + result ); + + RegisterLocalVariable( 0, result, ref dataCollector, "appendResult" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_selectedOutputType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ); + switch( m_selectedOutputType ) + { + case WirePortDataType.FLOAT2: m_selectedOutputTypeInt = 0; break; + case WirePortDataType.FLOAT3: m_selectedOutputTypeInt = 1; break; + case WirePortDataType.FLOAT4: m_selectedOutputTypeInt = 2; break; + case WirePortDataType.COLOR: m_selectedOutputTypeInt = 3; break; + } + } + + public override void ReadFromDeprecated( ref string[] nodeParams, Type oldType = null ) + { + m_selectedOutputType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ); + switch( m_selectedOutputType ) + { + case WirePortDataType.FLOAT2: m_selectedOutputTypeInt = 0; break; + case WirePortDataType.FLOAT3: m_selectedOutputTypeInt = 1; break; + case WirePortDataType.FLOAT4: m_selectedOutputTypeInt = 2; break; + case WirePortDataType.COLOR: m_selectedOutputTypeInt = 3; break; + } + for( int i = 0; i < 4; i++ ) + { + m_inputPorts[i].FloatInternalData = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + + if( UIUtils.CurrentShaderVersion() < 13206 ) + { + //TODO: MAKE THIS LESS BRUTE FORCE + List reroutes = new List(); + int availableChannel = 0; + for( int i = 0; i < 4 && availableChannel < 4; i++ ) + { + int channelsAmount = UIUtils.GetChannelsAmount( m_inputPorts[ i ].DataType ); + if( m_inputPorts[ i ].IsConnected /*&& availableChannel != i*/ ) + { + reroutes.Add( new AppendData( m_inputPorts[ i ].DataType, i, availableChannel ) ); + } + + availableChannel += channelsAmount; + } + + if( reroutes.Count > 0 ) + { + for( int i = reroutes.Count - 1; i > -1; i-- ) + { + int nodeId = m_inputPorts[ reroutes[ i ].OldPortId ].ExternalReferences[ 0 ].NodeId; + int portId = m_inputPorts[ reroutes[ i ].OldPortId ].ExternalReferences[ 0 ].PortId; + + m_containerGraph.DeleteConnection( true, UniqueId, reroutes[ i ].OldPortId, false, false, false ); + m_containerGraph.CreateConnection( UniqueId, reroutes[ i ].NewPortId, nodeId, portId, false ); + NewUpdateBehaviorConn( reroutes[ i ].NewPortId, true ); + } + } + + availableChannel = UIUtils.GetChannelsAmount( m_selectedOutputType ); + int currChannelIdx = 0; + for( ; currChannelIdx < availableChannel; currChannelIdx++ ) + { + if( m_inputPorts[ currChannelIdx ].Visible ) + { + int channelsAmount = UIUtils.GetChannelsAmount( m_inputPorts[ currChannelIdx ].DataType ); + for( int j = currChannelIdx + 1; j < currChannelIdx + channelsAmount; j++ ) + { + m_inputPorts[ j ].Visible = false; + } + } + } + + for( ; currChannelIdx < 4; currChannelIdx++ ) + { + m_inputPorts[ currChannelIdx ].Visible = false; + } + } + SetupPorts(); + m_sizeIsDirty = true; + } + + + void CalculatePreviewData() + { + switch( m_outputPorts[ 0 ].DataType ) + { + default: m_maskValue = Vector4.zero; break; + case WirePortDataType.INT: + case WirePortDataType.FLOAT: m_maskValue = new Vector4( 1, 0, 0, 0 ); break; + case WirePortDataType.FLOAT2: m_maskValue = new Vector4( 1, 1, 0, 0 ); break; + case WirePortDataType.FLOAT3: m_maskValue = new Vector4( 1, 1, 1, 0 ); break; + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: m_maskValue = Vector4.one; break; + } + + m_previewMaterialPassId = -1; + switch( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + { + switch( m_inputPorts[ 1 ].DataType ) + { + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + { + if( m_inputPorts[ 2 ].DataType == WirePortDataType.FLOAT || + m_inputPorts[ 2 ].DataType == WirePortDataType.INT ) + { + m_previewMaterialPassId = 0; + } + else if( m_inputPorts[ 2 ].DataType == WirePortDataType.FLOAT2 ) + { + m_previewMaterialPassId = 1; + } + } + break; + case WirePortDataType.FLOAT2: m_previewMaterialPassId = 2; break; + case WirePortDataType.FLOAT3: m_previewMaterialPassId = 3; break; + } + + }; break; + case WirePortDataType.FLOAT2: + { + if( m_inputPorts[ 2 ].DataType == WirePortDataType.FLOAT || + m_inputPorts[ 2 ].DataType == WirePortDataType.INT ) + { + m_previewMaterialPassId = 4; + } + else if( m_inputPorts[ 2 ].DataType == WirePortDataType.FLOAT2 ) + { + m_previewMaterialPassId = 5; + } + }; break; + case WirePortDataType.FLOAT3: m_previewMaterialPassId = 6; break; + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: m_previewMaterialPassId = 7; break; + } + + if( m_previewMaterialPassId == -1 ) + { + m_previewMaterialPassId = 0; + if( DebugConsoleWindow.DeveloperMode ) + { + UIUtils.ShowMessage( UniqueId, "Could not find pass ID for append" , MessageSeverity.Error ); + } + } + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + PreviewMaterial.SetVector( m_maskId, m_maskValue ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedOutputType ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs.meta new file mode 100644 index 00000000..959c2a14 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: bc524cd13743b6f49a2e331767646448 +timeCreated: 1500632879 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs new file mode 100644 index 00000000..51e483e9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs @@ -0,0 +1,393 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// http://kylehalladay.com/blog/tutorial/2014/02/18/Fresnel-Shaders-From-The-Ground-Up.html +// http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter07.html + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Fresnel", "Surface Data", "Simple Fresnel effect" )] + public sealed class FresnelNode : ParentNode + { + private const string FresnedFinalVar = "fresnelNode"; + + [SerializeField] + private ViewSpace m_normalSpace = ViewSpace.Tangent; + + enum FresnelType + { + Standard = 0, + Schlick, + SchlickIOR, + } + + enum NormalType + { + WorldNormal = 0, + TangentNormal, + HalfVector, + } + + enum ViewType + { + ViewDir = 0, + LightDir, + } + + [SerializeField] + private FresnelType m_fresnelType = FresnelType.Standard; + + [SerializeField] + private NormalType m_normalType = NormalType.WorldNormal; + + [SerializeField] + private ViewType m_viewType = ViewType.ViewDir; + + [SerializeField] + private bool m_normalizeVectors = false; + + [SerializeField] + private bool m_safePower = false; + + private InputPort m_normalVecPort; + private InputPort m_viewVecPort; + private InputPort m_biasPort; + private InputPort m_scalePort; + private InputPort m_powerPort; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "World Normal", -1, MasterNodePortCategory.Fragment, 0 ); + AddInputPort( WirePortDataType.FLOAT3, false, "View Dir", -1, MasterNodePortCategory.Fragment, 4 ); + AddInputPort( WirePortDataType.FLOAT, false, "Bias", -1, MasterNodePortCategory.Fragment, 1 ); + AddInputPort( WirePortDataType.FLOAT, false, "Scale", -1, MasterNodePortCategory.Fragment, 2 ); + AddInputPort( WirePortDataType.FLOAT, false, "Power", -1, MasterNodePortCategory.Fragment, 3 ); + AddOutputPort( WirePortDataType.FLOAT, "Out" ); + + m_normalVecPort = m_inputPorts[ 0 ]; + m_viewVecPort = m_inputPorts[ 1 ]; + m_biasPort = m_inputPorts[ 2 ]; + m_scalePort = m_inputPorts[ 3 ]; + m_powerPort = m_inputPorts[ 4 ]; + + m_biasPort.AutoDrawInternalData = true; + m_scalePort.AutoDrawInternalData = true; + m_powerPort.AutoDrawInternalData = true; + m_autoWrapProperties = true; + m_drawPreviewAsSphere = true; + m_normalVecPort.Vector3InternalData = Vector3.forward; + m_scalePort.FloatInternalData = 1; + m_powerPort.FloatInternalData = 5; + m_previewShaderGUID = "240145eb70cf79f428015012559f4e7d"; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + //m_mate + PreviewMaterial.SetInt( "_FresnelType", (int)m_fresnelType ); + + if( m_normalType == NormalType.TangentNormal && m_normalVecPort.IsConnected ) + m_previewMaterialPassId = 2; + else if( (m_normalType == NormalType.WorldNormal || m_normalType == NormalType.HalfVector ) && m_normalVecPort.IsConnected && !m_viewVecPort.IsConnected ) + m_previewMaterialPassId = 1; + else if( m_normalType == NormalType.HalfVector && !m_normalVecPort.IsConnected && !m_viewVecPort.IsConnected ) + m_previewMaterialPassId = 3; + else if( m_normalVecPort.IsConnected && m_viewVecPort.IsConnected ) + m_previewMaterialPassId = 4; + else if( !m_normalVecPort.IsConnected && !m_viewVecPort.IsConnected && m_viewType == ViewType.LightDir ) + m_previewMaterialPassId = 5; + else if( !m_normalVecPort.IsConnected && m_viewVecPort.IsConnected && m_normalType == NormalType.HalfVector ) + m_previewMaterialPassId = 7; + else if( !m_normalVecPort.IsConnected && m_viewVecPort.IsConnected ) + m_previewMaterialPassId = 6; + else + m_previewMaterialPassId = 0; + } + + public override void DrawProperties() + { + base.DrawProperties(); + + EditorGUI.BeginChangeCheck(); + m_fresnelType = (FresnelType)EditorGUILayoutEnumPopup( "Type", m_fresnelType ); + m_normalType = (NormalType)EditorGUILayoutEnumPopup( "Normal Vector", m_normalType ); + m_viewType = (ViewType)EditorGUILayoutEnumPopup( "View Vector", m_viewType ); + if( EditorGUI.EndChangeCheck() ) + { + UpdatePort(); + } + + if( !m_biasPort.IsConnected && m_biasPort.Visible ) + m_biasPort.FloatInternalData = EditorGUILayoutFloatField( m_biasPort.Name, m_biasPort.FloatInternalData ); + if( !m_scalePort.IsConnected && m_scalePort.Visible ) + m_scalePort.FloatInternalData = EditorGUILayoutFloatField( m_scalePort.Name, m_scalePort.FloatInternalData ); + if( !m_powerPort.IsConnected && m_powerPort.Visible ) + m_powerPort.FloatInternalData = EditorGUILayoutFloatField( m_powerPort.Name, m_powerPort.FloatInternalData ); + + m_normalizeVectors = EditorGUILayoutToggle( "Normalize Vectors", m_normalizeVectors ); + m_safePower = EditorGUILayoutToggle( PowerNode.SafePowerLabel, m_safePower ); + } + + private void UpdatePort() + { + switch( m_normalType ) + { + default: + case NormalType.WorldNormal: + m_normalVecPort.Name = "World Normal"; + break; + case NormalType.TangentNormal: + m_normalVecPort.Name = "Normal"; + break; + case NormalType.HalfVector: + m_normalVecPort.Name = "Half Vector"; + break; + } + + switch( m_viewType ) + { + default: + case ViewType.ViewDir: + m_viewVecPort.Name = "View Dir"; + break; + case ViewType.LightDir: + m_viewVecPort.Name = "Light Dir"; + break; + } + + switch( m_fresnelType ) + { + default: + case FresnelType.Standard: + m_biasPort.Visible = true; + m_biasPort.Name = "Bias"; + m_scalePort.Name = "Scale"; + m_scalePort.Visible = true; + m_powerPort.Visible = true; + break; + case FresnelType.Schlick: + m_biasPort.Visible = true; + m_biasPort.Name = "F0"; + m_scalePort.Visible = false; + m_powerPort.Visible = false; + break; + case FresnelType.SchlickIOR: + m_biasPort.Visible = false; + m_scalePort.Name = "IOR"; + m_scalePort.Visible = true; + m_powerPort.Visible = false; + break; + } + + m_sizeIsDirty = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + if( dataCollector.IsFragmentCategory ) + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); + + string viewdir = string.Empty; + if( m_viewType == ViewType.ViewDir ) + { + if( m_viewVecPort.IsConnected ) + viewdir = m_viewVecPort.GeneratePortInstructions( ref dataCollector ); + else + viewdir = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId, space: ViewSpace.World ); + } + else + { + if( m_viewVecPort.IsConnected ) + viewdir = m_viewVecPort.GeneratePortInstructions( ref dataCollector ); + else + viewdir = GeneratorUtils.GenerateWorldLightDirection( ref dataCollector, UniqueId, CurrentPrecisionType ); + } + + string normal = string.Empty; + if( m_normalType == NormalType.WorldNormal || m_normalType == NormalType.TangentNormal ) + { + if( m_normalVecPort.IsConnected ) + { + normal = m_normalVecPort.GeneratePortInstructions( ref dataCollector ); + + if( dataCollector.IsFragmentCategory ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + + if( m_normalType == NormalType.TangentNormal ) + { + if( dataCollector.IsTemplate ) + { + normal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, normal, OutputId ); + } + else + { + normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, CurrentPrecisionType, normal, OutputId ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + dataCollector.ForceNormal = true; + } + } + else + { + if( m_normalizeVectors ) + normal = string.Format( "normalize( {0} )", normal ); + } + } + else + { + if( m_normalType == NormalType.TangentNormal ) + { + string wtMatrix = GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); + normal = "mul( " + normal + "," + wtMatrix + " )"; + } + } + } + else + { + if( dataCollector.IsFragmentCategory ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + if( dataCollector.DirtyNormal ) + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + } + + if( dataCollector.IsTemplate ) + normal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( CurrentPrecisionType, normalize: ( dataCollector.DirtyNormal && m_normalizeVectors ) ); + else + normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, ( dataCollector.DirtyNormal && m_normalizeVectors ) ); + + if( dataCollector.DirtyNormal ) + { + dataCollector.ForceNormal = true; + } + } + } + else + { + // generate HV + if( !m_normalVecPort.IsConnected ) + { + string halfView = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId, space: ViewSpace.World ); + string halfLight = GeneratorUtils.GenerateWorldLightDirection( ref dataCollector, UniqueId, CurrentPrecisionType ); + normal = "halfVector" + OutputId; + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, normal, "normalize( " + halfView + " + " + halfLight + " )" ); + } + else + { + normal = m_normalVecPort.GeneratePortInstructions( ref dataCollector ); + if( m_normalizeVectors ) + normal = string.Format( "normalize( {0} )", normal ); + } + } + + string bias = m_biasPort.GeneratePortInstructions( ref dataCollector ); + string scale = m_scalePort.GeneratePortInstructions( ref dataCollector ); + string power = m_powerPort.GeneratePortInstructions( ref dataCollector ); + + string fresnelNDotVLocalValue = "dot( " + normal + ", " + viewdir + " )"; + string fresnelNDotVLocalVar = "fresnelNdotV" + OutputId; + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, fresnelNDotVLocalVar, fresnelNDotVLocalValue ); + + string fresnelFinalVar = FresnedFinalVar + OutputId; + + string result = string.Empty; + switch( m_fresnelType ) + { + default: + case FresnelType.Standard: + { + string powOp = m_safePower? string.Format( "pow( max( 1.0 - {0} , 0.0001 ), {1} )", fresnelNDotVLocalVar, power ): + string.Format( "pow( 1.0 - {0}, {1} )", fresnelNDotVLocalVar, power ); + result = string.Format( "( {0} + {1} * {2} )", bias, scale, powOp ); + } + break; + case FresnelType.Schlick: + { + string f0VarName = "f0" + OutputId; + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, f0VarName, bias ); + string powOp = m_safePower? string.Format( "pow( max( 1.0 - {0} , 0.0001 ), 5 )", fresnelNDotVLocalVar ) : + string.Format( "pow( 1.0 - {0}, 5 )", fresnelNDotVLocalVar ); + result = string.Format( "( {0} + ( 1.0 - {0} ) * {1} )", f0VarName, powOp ); + } + break; + case FresnelType.SchlickIOR: + { + string iorVarName = "ior" + OutputId; + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, iorVarName, scale ); + string iorPowOp = m_safePower? string.Format( "pow( max( ( 1 - {0} ) / ( 1 + {0} ) , 0.0001 ), 2 )", iorVarName ): + string.Format( "pow( ( 1 - {0} ) / ( 1 + {0} ), 2 )", iorVarName ); + + dataCollector.AddLocalVariable( UniqueId, iorVarName +" = "+ iorPowOp + ";"); + + string fresnelPowOp = m_safePower? string.Format( "pow( max( 1.0 - {0} , 0.0001 ), 5 )", fresnelNDotVLocalVar ): + string.Format( "pow( 1.0 - {0}, 5 )", fresnelNDotVLocalVar ); + result = string.Format( "( {0} + ( 1.0 - {0} ) * {1} )", iorVarName, fresnelPowOp ); + } + break; + } + + RegisterLocalVariable( 0, result, ref dataCollector, fresnelFinalVar ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + if( m_normalType == NormalType.TangentNormal && m_normalVecPort.IsConnected ) + dataCollector.DirtyNormal = true; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + + if( UIUtils.CurrentShaderVersion() > 15305 ) + { + m_fresnelType = (FresnelType)Enum.Parse( typeof( FresnelType ), GetCurrentParam( ref nodeParams ) ); + m_normalType = (NormalType)Enum.Parse( typeof( NormalType ), GetCurrentParam( ref nodeParams ) ); + m_viewType = (ViewType)Enum.Parse( typeof( ViewType ), GetCurrentParam( ref nodeParams ) ); + m_normalizeVectors = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 17502 ) + m_safePower = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + else + { + if( UIUtils.CurrentShaderVersion() >= 13202 ) + { + m_normalSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ); + } + else + { + m_normalSpace = ViewSpace.World; + } + + if( m_normalSpace == ViewSpace.World ) + m_normalType = NormalType.WorldNormal; + else + m_normalType = NormalType.TangentNormal; + } + UpdatePort(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + + IOUtils.AddFieldValueToString( ref nodeInfo, m_fresnelType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_normalType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_viewType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_normalizeVectors ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_safePower ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs.meta new file mode 100644 index 00000000..bfe7d00f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 91955bc593b0dc14d90b10cb3eb25355 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs new file mode 100644 index 00000000..42fb540a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs @@ -0,0 +1,430 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Get Local Var", "Miscellaneous", "Use a registered local variable", null, KeyCode.G )] + public class GetLocalVarNode : ParentNode + { + [SerializeField] + private int m_referenceId = -1; + + [SerializeField] + private float m_referenceWidth = -1; + + [SerializeField] + private int m_nodeId = -1; + + [SerializeField] + private RegisterLocalVarNode m_currentSelected = null; + + [SerializeField] + private string m_registerLocalVarName = string.Empty; + + private int m_cachedPropertyId = -1; + + private string m_previousLabel = string.Empty; + + private bool m_refSelect = false; + private int m_prevReferenceId = -1; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.OBJECT, Constants.EmptyPortValue ); + + // This is needed for infinite loop detection + AddInputPort( WirePortDataType.OBJECT, false, Constants.EmptyPortValue ); + m_inputPorts[ 0 ].Visible = false; + + m_outputPorts[ 0 ].Locked = true; + m_textLabelWidth = 80; + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + m_previewShaderGUID = "f21a6e44c7d7b8543afacd19751d24c6"; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + + if( UniqueId > -1 ) + m_containerGraph.LocalVarNodes.OnReorderEventComplete += OnReorderEventComplete; + } + + private void OnReorderEventComplete() + { + if( m_currentSelected != null ) + { + m_referenceId = m_containerGraph.LocalVarNodes.GetNodeRegisterIdx( m_currentSelected.UniqueId ); + } + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_currentSelected != null ) + { + if( m_drawPreviewAsSphere != m_currentSelected.SpherePreview ) + { + m_drawPreviewAsSphere = m_currentSelected.SpherePreview; + OnNodeChange(); + } + //CheckSpherePreview(); + + if( m_cachedPropertyId == -1 ) + m_cachedPropertyId = Shader.PropertyToID( "_A" ); + + PreviewMaterial.SetTexture( m_cachedPropertyId, m_currentSelected.OutputPorts[ 0 ].OutputPreviewTexture ); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUILayout.BeginHorizontal(); + EditorGUI.BeginChangeCheck(); + m_referenceId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceId, UIUtils.LocalVarNodeArr() ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromSelected(); + } + + if( GUILayout.Button( "\u25C4", "minibutton", GUILayout.Width( 17 ) ) && m_currentSelected ) + { + UIUtils.FocusOnNode( m_currentSelected, 0, false ); + } + EditorGUILayout.EndHorizontal(); + //EditorGUILayout.LabelField( ConnStatus.ToString() + " " + m_activeConnections ); + } + + public override void Destroy() + { + base.Destroy(); + CurrentSelected = null; + if( UniqueId > -1 ) + m_containerGraph.LocalVarNodes.OnReorderEventComplete -= OnReorderEventComplete; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( m_dropdownEditing ) + { + EditorGUI.BeginChangeCheck(); + m_referenceId = EditorGUIPopup( m_dropdownRect, m_referenceId, UIUtils.LocalVarNodeArr(), UIUtils.PropertyPopUp ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromSelected(); + DropdownEditing = false; + } + } + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + UpdateLocalVar(); + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + base.OnNodeRepaint( drawInfo ); + + if( m_isVisible && m_refSelect && !m_selected ) + { + GUI.color = Constants.SpecialGetLocalVarSelectionColor; + GUI.Label( m_globalPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ) ); + GUI.color = m_colorBuffer; + } + } + + void CheckForLoops() + { + if( CurrentSelected != null && UIUtils.DetectNodeLoopsFrom( CurrentSelected, new Dictionary() ) ) + { + CurrentSelected = UIUtils.GetLocalVarNode( m_prevReferenceId ); + if( CurrentSelected == null || UIUtils.DetectNodeLoopsFrom( CurrentSelected, new Dictionary() ) ) + { + m_referenceId = -1; + m_prevReferenceId = -1; + CurrentSelected = null; + m_outputPorts[ 0 ].Locked = true; + SetAdditonalTitleText( "" ); + UIUtils.ShowMessage( "Infinite Loop detected, disabled selection" ); + } + else + { + m_referenceId = m_prevReferenceId; + UIUtils.ShowMessage( "Infinite Loop detected, reverted to previous selection" ); + } + } + } + + void UpdateFromSelected() + { + CurrentSelected = UIUtils.GetLocalVarNode( m_referenceId ); + CheckForLoops(); + + if( m_currentSelected != null ) + { + m_nodeId = m_currentSelected.UniqueId; + m_outputPorts[ 0 ].Locked = false; + m_outputPorts[ 0 ].ChangeType( m_currentSelected.OutputPorts[ 0 ].DataType, false ); + m_drawPreviewAsSphere = m_currentSelected.SpherePreview; + CheckSpherePreview(); + + m_previousLabel = m_currentSelected.DataToArray; + SetAdditonalTitleText( string.Format( Constants.SubTitleVarNameFormatStr, m_currentSelected.DataToArray ) ); + m_referenceWidth = m_currentSelected.Position.width; + } + + m_sizeIsDirty = true; + m_isDirty = true; + m_prevReferenceId = m_referenceId; + } + + public void UpdateLocalVar() + { + m_refSelect = false; + if( m_referenceId > -1 ) + { + ParentNode newNode = UIUtils.GetLocalVarNode( m_referenceId ); + if( newNode != null ) + { + if( newNode.UniqueId != m_nodeId ) + { + CurrentSelected = null; + int count = UIUtils.LocalVarNodeAmount(); + for( int i = 0; i < count; i++ ) + { + ParentNode node = UIUtils.GetLocalVarNode( i ); + if( node.UniqueId == m_nodeId ) + { + CurrentSelected = node as RegisterLocalVarNode; + m_referenceId = i; + break; + } + } + } + } + + if( m_currentSelected != null ) + { + if( m_currentSelected.OutputPorts[ 0 ].DataType != m_outputPorts[ 0 ].DataType ) + { + m_outputPorts[ 0 ].Locked = false; + m_outputPorts[ 0 ].ChangeType( m_currentSelected.OutputPorts[ 0 ].DataType, false ); + } + + if( !m_previousLabel.Equals( m_currentSelected.DataToArray ) ) + { + m_previousLabel = m_currentSelected.DataToArray; + SetAdditonalTitleText( string.Format( Constants.SubTitleVarNameFormatStr, m_currentSelected.DataToArray ) ); + } + + if( m_referenceWidth != m_currentSelected.Position.width ) + { + m_referenceWidth = m_currentSelected.Position.width; + m_sizeIsDirty = true; + } + + if( m_currentSelected.Selected ) + m_refSelect = true; + } + else + { + ResetReference(); + } + } + } + + public void ResetReference() + { + m_outputPorts[ 0 ].Locked = true; + m_currentSelected = null; + m_inputPorts[ 0 ].DummyClear(); + m_nodeId = -1; + m_referenceId = -1; + m_referenceWidth = -1; + SetAdditonalTitleText( string.Empty ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_currentSelected != null ) + { + return m_currentSelected.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + else + { + UIUtils.ShowMessage( UniqueId, "Get Local Var node without reference. Attempting to access inexistant local variable.", MessageSeverity.Error ); + + return m_outputPorts[ 0 ].ErrorValue; + } + } + + + //public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + //{ + // base.PropagateNodeData( nodeData, ref dataCollector ); + // if( m_currentSelected != null ) + // { + // m_currentSelected.PropagateNodeData( nodeData, ref dataCollector ); + // } + //} + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 15 ) + { + m_nodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_outputPorts[ 0 ].Locked = ( m_nodeId < 0 ); + if( UIUtils.CurrentShaderVersion() > 15500 ) + { + m_registerLocalVarName = GetCurrentParam( ref nodeParams ); + } + } + else + { + m_referenceId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_outputPorts[ 0 ].Locked = ( m_referenceId < 0 ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + if( m_currentSelected != null ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentSelected.UniqueId ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentSelected.DataToArray ); + } + else + { + IOUtils.AddFieldValueToString( ref nodeInfo, -1 ); + IOUtils.AddFieldValueToString( ref nodeInfo, string.Empty ); + } + + } + + public override void OnNodeDoubleClicked( Vector2 currentMousePos2D ) + { + if( m_currentSelected != null ) + { + UIUtils.FocusOnNode( m_currentSelected, 0, true ); + } + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( UIUtils.CurrentShaderVersion() > 15 ) + { + CurrentSelected = UIUtils.GetNode( m_nodeId ) as RegisterLocalVarNode; + m_referenceId = UIUtils.GetLocalVarNodeRegisterId( m_nodeId ); + if( CurrentSelected == null && UIUtils.CurrentShaderVersion() > 15500 && !string.IsNullOrEmpty( m_registerLocalVarName ) ) + { + CurrentSelected = m_containerGraph.LocalVarNodes.GetNodeByDataToArray( m_registerLocalVarName ); + if( CurrentSelected != null ) + { + m_nodeId = CurrentSelected.UniqueId; + m_referenceId = UIUtils.GetLocalVarNodeRegisterId( m_nodeId ); + } + } + } + else + { + CurrentSelected = UIUtils.GetLocalVarNode( m_referenceId ); + if( m_currentSelected != null ) + { + m_nodeId = m_currentSelected.UniqueId; + } + } + + CheckForLoops(); + + if( m_currentSelected != null ) + { + m_outputPorts[ 0 ].Locked = false; + m_outputPorts[ 0 ].ChangeType( m_currentSelected.OutputPorts[ 0 ].DataType, false ); + } + else + { + m_outputPorts[ 0 ].Locked = true; + } + } + + public override void ActivateNode( int signalGenNodeId, int signalGenPortId, System.Type signalGenNodeType ) + { + base.ActivateNode( signalGenNodeId, signalGenPortId, signalGenNodeType ); + if( m_activeConnections == 1 ) + { + if( m_currentSelected != null ) + { + m_currentSelected.ActivateNode( signalGenNodeId, signalGenPortId, signalGenNodeType ); + } + } + } + + public override void DeactivateNode( int deactivatedPort, bool forceComplete ) + { + forceComplete = forceComplete || ( m_activeConnections == 1 ); + base.DeactivateNode( deactivatedPort, forceComplete ); + if( forceComplete && m_currentSelected != null ) + { + m_currentSelected.DeactivateNode( deactivatedPort, false ); + } + } + + public override void OnNodeSelected( bool value ) + { + base.OnNodeSelected( value ); + if( m_currentSelected != null ) + { + m_currentSelected.CheckReferenceSelection(); + } + } + + public RegisterLocalVarNode CurrentSelected + { + get { return m_currentSelected; } + set + { + // This is needed for infinite loop detection + if( m_inputPorts != null ) + m_inputPorts[ 0 ].DummyClear(); + + if( m_currentSelected != null ) + { + m_currentSelected.UnregisterGetLocalVar( this ); + + //if( m_currentSelected != value ) + m_currentSelected.DeactivateNode( 0, false ); + } + + if( value != null ) + { + value.RegisterGetLocalVar( this ); + if( IsConnected && value != m_currentSelected ) + value.ActivateNode( UniqueId, 0, m_activeType ); + + // This is needed for infinite loop detection + m_inputPorts[ 0 ].DummyAdd( value.UniqueId, 0 ); ; + } + + m_currentSelected = value; + + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs.meta new file mode 100644 index 00000000..4fafea20 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: efce529ed3c74854b9d0cece836991c3 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs new file mode 100644 index 00000000..21589b00 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs @@ -0,0 +1,61 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Layered Blend", "Miscellaneous", "Mix all channels through interpolation factors", null, KeyCode.None, true )] + public sealed class LayeredBlendNode : WeightedAvgNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 1 ].Name = "Layer Base"; + AddInputPort( WirePortDataType.FLOAT, false, string.Empty ); + for ( int i = 2; i < m_inputPorts.Count; i++ ) + { + m_inputPorts[ i ].Name = AmountsStr[ i - 2 ]; + } + m_inputData = new string[ 6 ]; + m_minimumSize = 2; + UpdateConnection( 0 ); + m_previewShaderGUID = "48faca2f6506fc44c97adb1e2b79c37d"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + GetInputData( ref dataCollector, ignoreLocalvar ); + + string result = string.Empty; + string localVarName = "layeredBlendVar" + OutputId; + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].DataType, localVarName, m_inputData[ 0 ] ); + + if ( m_activeCount == 1 ) + { + result = m_inputData[ 0 ]; + } + else if ( m_activeCount == 2 ) + { + result += "lerp( " + m_inputData[ 1 ] + "," + m_inputData[ 2 ] + " , " + localVarName + " )"; + } + else + { + result = m_inputData[ 1 ]; + for ( int i = 1; i < m_activeCount; i++ ) + { + result = "lerp( " + result + " , " + m_inputData[ i + 1 ] + " , " + localVarName + Constants.VectorSuffixes[ i - 1 ] + " )"; + } + } + result = UIUtils.AddBrackets( result ); + RegisterLocalVariable( 0, result, ref dataCollector, "layeredBlend" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs.meta new file mode 100644 index 00000000..477622b6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 90801da82a0b4f74cae2f9387bd5ad92 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs new file mode 100644 index 00000000..5e84c3a7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs @@ -0,0 +1,109 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Linear Depth", "Miscellaneous", "Converts depth values given on logarithmic space to linear" )] + public sealed class LinearDepthNode : ParentNode + { + private readonly string[] LinearModeLabels = { "Eye Space", "0-1 Space" }; + + private const string LinearEyeFuncFormat = "LinearEyeDepth({0})"; + private const string Linear01FuncFormat = "Linear01Depth({0})"; + + private const string LinearEyeFuncSRPFormat = "LinearEyeDepth({0},_ZBufferParams)"; + private const string Linear01FuncSRPFormat = "Linear01Depth({0},_ZBufferParams)"; + + private const string LinerValName = "depthToLinear"; + private const string ViewSpaceLabel = "View Space"; + + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + [SerializeField] + private int m_currentOption = 0; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + m_previewShaderGUID = "2b0785cc8b854974ab4e45419072705a"; + UpdateFromOption(); + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + void UpdateFromOption() + { + m_previewMaterialPassId = m_currentOption; + SetAdditonalTitleText( string.Format( Constants.SubTitleSpaceFormatStr, LinearModeLabels[ m_currentOption ] ) ); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_currentOption = m_upperLeftWidget.DrawWidget( this, m_currentOption, LinearModeLabels ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromOption(); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_currentOption = EditorGUILayoutPopup( ViewSpaceLabel, m_currentOption, LinearModeLabels ); + if( EditorGUI.EndChangeCheck() ) + { + SetAdditonalTitleText( string.Format( Constants.SubTitleSpaceFormatStr, LinearModeLabels[ m_currentOption ] ) ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + if( dataCollector.IsSRP ) + { + value = string.Format( ( ( m_currentOption == 0 ) ? LinearEyeFuncSRPFormat : Linear01FuncSRPFormat ), value ); + } + else + { + value = string.Format( ( ( m_currentOption == 0 ) ? LinearEyeFuncFormat : Linear01FuncFormat ), value ); + } + RegisterLocalVariable( 0, value, ref dataCollector, LinerValName + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentOption ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + int.TryParse( GetCurrentParam( ref nodeParams ), out m_currentOption ); + UpdateFromOption(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs.meta new file mode 100644 index 00000000..990a61fc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 8b8af65130c9ed64f95976ec67ac1adf +timeCreated: 1546438982 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs new file mode 100644 index 00000000..af6325bc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs @@ -0,0 +1,215 @@ +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Matrix From Vectors", "Matrix Operators", "Matrix From Vectors" )] + public sealed class MatrixFromVectors : ParentNode + { + private const string RowFromVector = "Input to Row"; + [SerializeField] + private WirePortDataType m_selectedOutputType = WirePortDataType.FLOAT3x3; + + [SerializeField] + private int m_selectedOutputTypeInt = 0; + + [SerializeField] + private Vector3[] m_defaultValuesV3 = { Vector3.zero, Vector3.zero, Vector3.zero }; + + [SerializeField] + private Vector4[] m_defaultValuesV4 = { Vector4.zero, Vector4.zero, Vector4.zero, Vector4.zero }; + + [SerializeField] + private bool m_rowsFromVector = true; + + private string[] m_defaultValuesStr = { "[0]", "[1]", "[2]", "[3]" }; + + private readonly string[] _outputValueTypes ={ "Matrix3X3", + "Matrix4X4"}; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT4, false, "[0]" ); + AddInputPort( WirePortDataType.FLOAT4, false, "[1]" ); + AddInputPort( WirePortDataType.FLOAT4, false, "[2]" ); + AddInputPort( WirePortDataType.FLOAT4, false, "[3]" ); + AddOutputPort( m_selectedOutputType, Constants.EmptyPortValue ); + m_textLabelWidth = 90; + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + UpdatePorts(); + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_selectedOutputTypeInt = m_upperLeftWidget.DrawWidget( this, m_selectedOutputTypeInt, _outputValueTypes ); + if( EditorGUI.EndChangeCheck() ) + { + switch( m_selectedOutputTypeInt ) + { + case 0: m_selectedOutputType = WirePortDataType.FLOAT3x3; break; + case 1: m_selectedOutputType = WirePortDataType.FLOAT4x4; break; + } + + UpdatePorts(); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + + EditorGUI.BeginChangeCheck(); + m_selectedOutputTypeInt = EditorGUILayoutPopup( "Output type", m_selectedOutputTypeInt, _outputValueTypes ); + if( EditorGUI.EndChangeCheck() ) + { + switch( m_selectedOutputTypeInt ) + { + case 0: m_selectedOutputType = WirePortDataType.FLOAT3x3; break; + case 1: m_selectedOutputType = WirePortDataType.FLOAT4x4; break; + } + + UpdatePorts(); + } + + int count = 0; + switch( m_selectedOutputType ) + { + case WirePortDataType.FLOAT3x3: + count = 3; + for( int i = 0; i < count; i++ ) + { + if( !m_inputPorts[ i ].IsConnected ) + m_defaultValuesV3[ i ] = EditorGUILayoutVector3Field( m_defaultValuesStr[ i ], m_defaultValuesV3[ i ] ); + } + break; + case WirePortDataType.FLOAT4x4: + count = 4; + for( int i = 0; i < count; i++ ) + { + if( !m_inputPorts[ i ].IsConnected ) + m_defaultValuesV4[ i ] = EditorGUILayoutVector4Field( m_defaultValuesStr[ i ], m_defaultValuesV4[ i ] ); + } + break; + } + m_rowsFromVector = EditorGUILayoutToggle( RowFromVector, m_rowsFromVector ); + } + + void UpdatePorts() + { + m_sizeIsDirty = true; + ChangeOutputType( m_selectedOutputType, false ); + switch( m_selectedOutputType ) + { + case WirePortDataType.FLOAT3x3: + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ 1 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ 2 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ 3 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_inputPorts[ 3 ].Visible = false; + break; + case WirePortDataType.FLOAT4x4: + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_inputPorts[ 1 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_inputPorts[ 2 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_inputPorts[ 3 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_inputPorts[ 3 ].Visible = true; + break; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + string result = ""; + switch( m_selectedOutputType ) + { + case WirePortDataType.FLOAT3x3: + if( m_rowsFromVector ) + { + result = "float3x3(" + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + ", " + + m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ) + ", " + + m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ) + ")"; + } + else + { + string vec0 = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string vec1 = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string vec2 = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + result = string.Format( "float3x3({0}.x,{1}.x,{2}.x,{0}.y,{1}.y,{2}.y,{0}.z,{1}.z,{2}.z )", vec0, vec1, vec2 ); + } + break; + case WirePortDataType.FLOAT4x4: + if( m_rowsFromVector ) + { + result = "float4x4(" + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + ", " + + m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ) + ", " + + m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ) + ", " + + m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ) + ")"; + } + else + { + string vec0 = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string vec1 = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string vec2 = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + string vec3 = m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ); + result = string.Format( "float4x4( {0}.x,{1}.x,{2}.x,{3}.x,{0}.y,{1}.y,{2}.y,{3}.y,{0}.z,{1}.z,{2}.z,{3}.z,{0}.w,{1}.w,{2}.w,{3}.w )", vec0, vec1, vec2, vec3 ); + } + break; + } + + return result; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_selectedOutputType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 15310 ) + { + m_rowsFromVector = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + switch( m_selectedOutputType ) + { + case WirePortDataType.FLOAT3x3: + m_selectedOutputTypeInt = 0; + break; + case WirePortDataType.FLOAT4x4: + m_selectedOutputTypeInt = 1; + break; + } + UpdatePorts(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedOutputType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_rowsFromVector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs.meta new file mode 100644 index 00000000..c3590180 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a313774cf0e4d1e4289d7395e8e49067 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs new file mode 100644 index 00000000..40eefa50 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs @@ -0,0 +1,34 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Position From Transform", "Matrix Operators", "Gets the position vector from a transformation matrix" )] + public sealed class PosFromTransformMatrix : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT4x4, true, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT4, "XYZW" ); + AddOutputPort( WirePortDataType.FLOAT, "X" ); + AddOutputPort( WirePortDataType.FLOAT, "Y" ); + AddOutputPort( WirePortDataType.FLOAT, "Z" ); + AddOutputPort( WirePortDataType.FLOAT, "W" ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string result = string.Format( "float4( {0},{1},{2},{3})", value + "[0][3]", value + "[1][3]", value + "[2][3]", value + "[3][3]" ); + RegisterLocalVariable( 0, result, ref dataCollector, "matrixToPos" + OutputId ); + + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs.meta new file mode 100644 index 00000000..2ee9c03c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7c7321a370f1f1b499d4655cc25f457b +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs new file mode 100644 index 00000000..2234646f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs @@ -0,0 +1,359 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Register Local Var", "Miscellaneous", "Forces a local variable to be written with the given name. Can then be fetched at any place with a Get Local Var node.", null, KeyCode.R )] + public sealed class RegisterLocalVarNode : ParentNode + { + private const double MaxEditingTimestamp = 1; + + private const string LocalDefaultNameStr = "myVarName"; + private const string LocalVarNameStr = "Var Name"; + private const string OrderIndexStr = "Order Index"; + private const string AutoOrderIndexStr = "Auto Order"; + private const string ReferencesStr = "References"; + + private const string GetLocalVarLabel = "( {0} ) Get Local Var"; + private string m_oldName = string.Empty; + private bool m_reRegisterName = false; + private int m_autoOrderIndex = int.MaxValue; + private bool m_forceUpdate = true; + private bool m_refSelect = false; + + private bool m_referencesVisible = false; + + [SerializeField] + private string m_variableName = LocalDefaultNameStr; + + [SerializeField] + private int m_orderIndex = -1; + + [SerializeField] + private bool m_autoIndexActive = true; + + [SerializeField] + private List m_registeredGetLocalVars = new List(); + + [NonSerialized] + private double m_editingTimestamp; + + [NonSerialized] + private bool m_editingTimestampFlag; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_inputPorts[ 0 ].SetFreeForAll(); + m_textLabelWidth = 85; + m_customPrecision = true; + + if( m_containerGraph != null ) + m_variableName += m_containerGraph.LocalVarNodes.NodesList.Count; + + m_oldName = m_variableName; + UpdateTitle(); + m_previewShaderGUID = "5aaa1d3ea9e1fa64781647e035a82334"; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_containerGraph.LocalVarNodes.AddNode( this ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + + for( int i = 0 ; i < m_registeredGetLocalVars.Count ; i++ ) + { + m_registeredGetLocalVars[ i ].UpdateLocalVar(); + } + } + + void UpdateTitle() + { + SetAdditonalTitleText( string.Format( Constants.SubTitleVarNameFormatStr, m_variableName ) ); + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + if( m_editingTimestampFlag && ( EditorApplication.timeSinceStartup - m_editingTimestamp ) > MaxEditingTimestamp ) + { + m_editingTimestampFlag = false; + CheckAndChangeName(); + } + } + + void DrawMainProperties() + { + EditorGUI.BeginChangeCheck(); + m_variableName = EditorGUILayoutTextField( LocalVarNameStr, m_variableName ); + if( EditorGUI.EndChangeCheck() ) + { + m_editingTimestampFlag = true; + m_editingTimestamp = EditorApplication.timeSinceStartup; + //CheckAndChangeName(); + } + + DrawPrecisionProperty(); + } + + public override void AfterDuplication() + { + base.AfterDuplication(); + CheckAndChangeName(); + } + + void CheckAndChangeName() + { + m_variableName = UIUtils.RemoveRegisterInvalidCharacters( m_variableName ); + if( string.IsNullOrEmpty( m_variableName ) ) + { + m_variableName = LocalDefaultNameStr + OutputId; + } + bool isNumericName = UIUtils.IsNumericName( m_variableName ); + bool isLocalVarNameAvailable = m_containerGraph.ParentWindow.DuplicatePrevBufferInstance.IsLocalvariableNameAvailable( m_variableName ); + if( !isNumericName && isLocalVarNameAvailable ) + { + m_containerGraph.ParentWindow.DuplicatePrevBufferInstance.ReleaseLocalVariableName( UniqueId, m_oldName ); + m_containerGraph.ParentWindow.DuplicatePrevBufferInstance.RegisterLocalVariableName( UniqueId, m_variableName ); + m_oldName = m_variableName; + m_containerGraph.LocalVarNodes.UpdateDataOnNode( UniqueId, m_variableName ); + UpdateTitle(); + m_forceUpdate = true; + } + else + { + if( isNumericName ) + { + UIUtils.ShowMessage( UniqueId, string.Format( "Local variable name '{0}' cannot start or be numerical values. Reverting back to '{1}'.", m_variableName, m_oldName ), MessageSeverity.Warning ); + } + else if( !isLocalVarNameAvailable ) + { + UIUtils.ShowMessage( UniqueId, string.Format( "Local variable name '{0}' already being used. Reverting back to '{1}'.", m_variableName, m_oldName ), MessageSeverity.Warning ); + } + + m_variableName = m_oldName; + m_containerGraph.LocalVarNodes.UpdateDataOnNode( UniqueId, m_variableName ); + } + } + + void DrawReferences() + { + int count = m_registeredGetLocalVars.Count; + if( m_registeredGetLocalVars.Count > 0 ) + { + for( int i = 0; i < count; i++ ) + { + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField( string.Format( GetLocalVarLabel, m_registeredGetLocalVars[ i ].UniqueId ) ); + if( GUILayout.Button( "\u25BA", "minibutton", GUILayout.Width( 17 ) ) ) + { + m_containerGraph.ParentWindow.FocusOnNode( m_registeredGetLocalVars[ i ], 0, false ); + } + EditorGUILayout.EndHorizontal(); + } + + if( GUILayout.Button( "Back" ) ) + { + m_containerGraph.ParentWindow.FocusOnNode( this, 0, false ); + } + } + else + { + EditorGUILayout.HelpBox( "This node is not being referenced by any Get Local Var.", MessageType.Info ); + } + } + + public override void DrawProperties() + { + NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, DrawMainProperties ); + NodeUtils.DrawPropertyGroup( ref m_referencesVisible, ReferencesStr, DrawReferences ); + //EditorGUILayout.LabelField(ConnStatus.ToString()+" "+m_activeConnections); + } + + public override void OnEnable() + { + base.OnEnable(); + m_reRegisterName = true; + } + + public void CheckReferenceSelection() + { + m_refSelect = false; + int count = m_registeredGetLocalVars.Count; + for( int i = 0; i < count; i++ ) + { + if( m_registeredGetLocalVars[ i ].Selected ) + m_refSelect = true; + } + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + base.OnNodeRepaint( drawInfo ); + if( m_isVisible && m_refSelect && !m_selected ) + { + GUI.color = Constants.SpecialRegisterLocalVarSelectionColor; + GUI.Label( m_globalPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ) ); + GUI.color = m_colorBuffer; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + + base.Draw( drawInfo ); + if( m_reRegisterName ) + { + m_reRegisterName = false; + m_containerGraph.ParentWindow.DuplicatePrevBufferInstance.RegisterLocalVariableName( UniqueId, m_variableName ); + } + + if( m_forceUpdate ) + { + m_forceUpdate = false; + UpdateTitle(); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + { + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + string result = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + if( m_inputPorts[ 0 ].DataType == WirePortDataType.OBJECT ) + m_outputPorts[ 0 ].SetLocalValue( result, dataCollector.PortCategory ); + else + { + var name = m_variableName; + name = name.Replace("/", "_"); + name = name.Replace(" ", "_"); + + RegisterLocalVariable(0, result, ref dataCollector, name + OutputId); + } + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_variableName = GetCurrentParam( ref nodeParams ); + m_oldName = m_variableName; + if( UIUtils.CurrentShaderVersion() > 14 ) + m_orderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + + if( UIUtils.CurrentShaderVersion() > 3106 ) + { + m_autoIndexActive = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + else + { + m_autoIndexActive = false; + } + if( !m_isNodeBeingCopied ) + { + m_containerGraph.LocalVarNodes.UpdateDataOnNode( UniqueId, m_variableName ); + m_containerGraph.ParentWindow.DuplicatePrevBufferInstance.ReleaseLocalVariableName( UniqueId, m_oldName ); + m_containerGraph.ParentWindow.DuplicatePrevBufferInstance.RegisterLocalVariableName( UniqueId, m_variableName ); + } + m_forceUpdate = true; + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_variableName ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_orderIndex ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_autoIndexActive ); + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + if( m_autoOrderIndex < nodeData.OrderIndex ) + { + nodeData.OrderIndex = m_autoOrderIndex - 1; + } + else + { + m_autoOrderIndex = nodeData.OrderIndex; + nodeData.OrderIndex -= 1; + } + + base.PropagateNodeData( nodeData, ref dataCollector ); + } + + public override void ResetNodeData() + { + base.ResetNodeData(); + m_autoOrderIndex = int.MaxValue; + } + + public void RegisterGetLocalVar( GetLocalVarNode node ) + { + if( !m_registeredGetLocalVars.Contains( node ) ) + { + m_registeredGetLocalVars.Add( node ); + CheckReferenceSelection(); + } + } + + public void UnregisterGetLocalVar( GetLocalVarNode node ) + { + if( m_registeredGetLocalVars.Contains( node ) ) + { + m_registeredGetLocalVars.Remove( node ); + CheckReferenceSelection(); + } + } + + public override void Destroy() + { + base.Destroy(); + m_containerGraph.LocalVarNodes.RemoveNode( this ); + m_containerGraph.ParentWindow.DuplicatePrevBufferInstance.ReleaseLocalVariableName( UniqueId, m_variableName ); + + int count = m_registeredGetLocalVars.Count; + for( int i = 0; i < count; i++ ) + { + //GetLocalVarNode node = m_containerGraph.GetNode( m_registeredGetLocalVars[ i ] ) as GetLocalVarNode; + if( m_registeredGetLocalVars[ i ] != null ) + m_registeredGetLocalVars[ i ].ResetReference(); + } + m_registeredGetLocalVars.Clear(); + m_registeredGetLocalVars = null; + + m_containerGraph.LocalVarNodes.RemoveNode( this ); + } + + public override void ActivateNode( int signalGenNodeId, int signalGenPortId, Type signalGenNodeType ) + { + base.ActivateNode( signalGenNodeId, signalGenPortId, signalGenNodeType ); + } + public override string DataToArray { get { return m_variableName; } } + public List NodeReferences { get { return m_registeredGetLocalVars; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs.meta new file mode 100644 index 00000000..970cf380 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ebd1a3b3014ccdd40b8fa805b4281c6f +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs new file mode 100644 index 00000000..baa612a7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs @@ -0,0 +1,39 @@ +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Relay", "Miscellaneous", "Relay" )] + public sealed class RelayNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.OBJECT, false, Constants.EmptyPortValue ); + m_inputPorts[ 0 ].SetFreeForAll(); + AddOutputPort( WirePortDataType.OBJECT, Constants.EmptyPortValue ); + m_previewShaderGUID = "74e4d859fbdb2c0468de3612145f4929"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + return m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs.meta new file mode 100644 index 00000000..0cd68304 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ef679ba7cdeda594aa3e5c02b25e66df +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs new file mode 100644 index 00000000..b9b0a6c2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs @@ -0,0 +1,95 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Rotate About Axis", "Vector Operators", "Rotates a vector around a normalized axis" )] + public class RotateAboutAxisNode : ParentNode + { + private const string FunctionHeader = "float3 RotateAroundAxis( float3 center, float3 original, float3 u, float angle )"; + private const string FunctionCall = "RotateAroundAxis( {0}, {1}, {2}, {3} )"; + private readonly string[] FunctionBody = + { + "float3 RotateAroundAxis( float3 center, float3 original, float3 u, float angle )\n", + "{\n", + "\toriginal -= center;\n", + "\tfloat C = cos( angle );\n", + "\tfloat S = sin( angle );\n", + "\tfloat t = 1 - C;\n", + "\tfloat m00 = t * u.x * u.x + C;\n", + "\tfloat m01 = t * u.x * u.y - S * u.z;\n", + "\tfloat m02 = t * u.x * u.z + S * u.y;\n", + "\tfloat m10 = t * u.x * u.y + S * u.z;\n", + "\tfloat m11 = t * u.y * u.y + C;\n", + "\tfloat m12 = t * u.y * u.z - S * u.x;\n", + "\tfloat m20 = t * u.x * u.z - S * u.y;\n", + "\tfloat m21 = t * u.y * u.z + S * u.x;\n", + "\tfloat m22 = t * u.z * u.z + C;\n", + "\tfloat3x3 finalMatrix = float3x3( m00, m01, m02, m10, m11, m12, m20, m21, m22 );\n", + "\treturn mul( finalMatrix, original ) + center;\n", + "}\n" + }; + + private const string NormalizeAxisLabel = "Rotation Axis"; + private const string NonNormalizeAxisLabel = "Normalized Rotation Axis"; + private const string NormalizeAxisStr = "Normalize Axis"; + + [UnityEngine.SerializeField] + private bool m_normalizeAxis = false; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, m_normalizeAxis? NormalizeAxisLabel: NonNormalizeAxisLabel ); + AddInputPort( WirePortDataType.FLOAT, false, "Rotation Angle" ); + AddInputPort( WirePortDataType.FLOAT3, false, "Pivot Point" ); + AddInputPort( WirePortDataType.FLOAT3, false, "Position" ); + AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_autoWrapProperties = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_normalizeAxis = EditorGUILayoutToggle( NormalizeAxisStr, m_normalizeAxis ); + if( EditorGUI.EndChangeCheck() ) + { + m_inputPorts[ 0 ].Name = (m_normalizeAxis ? NormalizeAxisLabel : NonNormalizeAxisLabel); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string normalizeRotAxis = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + if( m_normalizeAxis ) + { + normalizeRotAxis = string.Format( "normalize( {0} )", normalizeRotAxis ); + } + string rotationAngle = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string pivotPoint = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + string position = m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ); + dataCollector.AddFunction( FunctionHeader, FunctionBody, false ); + RegisterLocalVariable( 0, string.Format( FunctionCall, pivotPoint, position, normalizeRotAxis, rotationAngle ), ref dataCollector, "rotatedValue" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_normalizeAxis = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_normalizeAxis ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs.meta new file mode 100644 index 00000000..afc3860b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6190b6c1a4cd29b48bfd36ff9b2ea773 +timeCreated: 1513184612 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs new file mode 100644 index 00000000..735bcd9a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs @@ -0,0 +1,56 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Summed Blend", "Miscellaneous", "Mix all channels through weighted sum", null, KeyCode.None, true )] + public sealed class SummedBlendNode : WeightedAvgNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputData = new string[ 6 ]; + m_previewShaderGUID = "eda18b96e13f78b49bbdaa4da3fead19"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + GetInputData( ref dataCollector, ignoreLocalvar ); + + string result = string.Empty; + string localVarName = "weightedBlendVar" + OutputId; + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].DataType, localVarName, m_inputData[ 0 ] ); + + if ( m_activeCount == 0 ) + { + result = m_inputData[ 0 ]; + } + else if ( m_activeCount == 1 ) + { + result += localVarName + "*" + m_inputData[ 1 ]; + } + else + { + for ( int i = 0; i < m_activeCount; i++ ) + { + result += localVarName + Constants.VectorSuffixes[ i ] + "*" + m_inputData[ i + 1 ]; + if ( i != ( m_activeCount - 1 ) ) + { + result += " + "; + } + } + } + + result = UIUtils.AddBrackets( result ); + RegisterLocalVariable( 0, result, ref dataCollector, "weightedBlend" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs.meta new file mode 100644 index 00000000..ac55d687 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: da71cf021d98a7f468319e56eaefe6f1 +timeCreated: 1484229430 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs new file mode 100644 index 00000000..ae3d4107 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs @@ -0,0 +1,230 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Debug Switch", "Logical Operators", "Hard Switch between any of its input ports" )] + public class SwitchNode : ParentNode + { + private const string Info = "This is a Debug node which only generates the source for the selected port. This means that no properties are generated for other ports and information might be lost."; + private const string InputPortName = "In "; + + private const string CurrSelectedStr = "Current"; + private const string MaxAmountStr = "Max Amount"; + private const int MaxAllowedAmount = 8; + + [SerializeField] + private string[] m_availableInputsLabels = { "In 0", "In 1" }; + + [SerializeField] + private int[] m_availableInputsValues = { 0, 1 }; + + [SerializeField] + private int m_currentSelectedInput = 0; + + [SerializeField] + private int m_maxAmountInputs = 2; + + private int m_cachedPropertyId = -1; + + private GUIContent m_popContent; + + private Rect m_varRect; + private Rect m_imgRect; + private bool m_editing; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + for( int i = 0; i < MaxAllowedAmount; i++ ) + { + AddInputPort( WirePortDataType.FLOAT, false, InputPortName + i ); + m_inputPorts[ i ].Visible = ( i < 2 ); + } + AddOutputPort( WirePortDataType.FLOAT, " " ); + + m_popContent = new GUIContent(); + m_popContent.image = UIUtils.PopupIcon; + + m_insideSize.Set( 50, 25 ); + m_textLabelWidth = 100; + m_autoWrapProperties = false; + m_previewShaderGUID = "a58e46feaa5e3d14383bfeac24d008bc"; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_cachedPropertyId == -1 ) + m_cachedPropertyId = Shader.PropertyToID( "_Current" ); + + PreviewMaterial.SetInt( m_cachedPropertyId, m_currentSelectedInput ); + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + m_inputPorts[ inputPortId ].MatchPortToConnection(); + if( inputPortId == m_currentSelectedInput ) + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ inputPortId ].DataType, false ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ portId ].MatchPortToConnection(); + if( portId == m_currentSelectedInput ) + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ portId ].DataType, false ); + } + + public void UpdateLabels() + { + m_availableInputsLabels = new string[ m_maxAmountInputs ]; + m_availableInputsValues = new int[ m_maxAmountInputs ]; + + for( int i = 0; i < m_maxAmountInputs; i++ ) + { + m_availableInputsLabels[ i ] = InputPortName + i; + m_availableInputsValues[ i ] = i; + } + } + + //void UpdateOutput() + //{ + // m_outputPorts[ 0 ].ChangeProperties( m_inputPorts[ m_currentSelectedInput ].Name, m_inputPorts[ m_currentSelectedInput ].DataType, false ); + // m_sizeIsDirty = true; + //} + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + + m_varRect = m_remainingBox; + m_varRect.width = 50 * drawInfo.InvertedZoom; + m_varRect.height = 16 * drawInfo.InvertedZoom; + m_varRect.x = m_remainingBox.xMax - m_varRect.width; + //m_varRect.x += m_remainingBox.width * 0.5f - m_varRect.width * 0.5f; + m_varRect.y += 1 * drawInfo.InvertedZoom; + + m_imgRect = m_varRect; + m_imgRect.x = m_varRect.xMax - 16 * drawInfo.InvertedZoom; + m_imgRect.width = 16 * drawInfo.InvertedZoom; + m_imgRect.height = m_imgRect.width; + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if( drawInfo.CurrentEventType != EventType.MouseDown ) + return; + + if( m_varRect.Contains( drawInfo.MousePosition ) ) + { + m_editing = true; + } + else if( m_editing ) + { + m_editing = false; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( m_editing ) + { + EditorGUI.BeginChangeCheck(); + m_currentSelectedInput = EditorGUIIntPopup( m_varRect, m_currentSelectedInput, m_availableInputsLabels, m_availableInputsValues, UIUtils.GraphDropDown ); + if( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + m_editing = false; + } + } + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + base.OnNodeRepaint( drawInfo ); + + if( !m_isVisible ) + return; + + if( !m_editing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) + { + GUI.Label( m_varRect, m_availableInputsLabels[ m_currentSelectedInput ], UIUtils.GraphDropDown ); + GUI.Label( m_imgRect, m_popContent, UIUtils.GraphButtonIcon ); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, DrawDebugOptions ); + + EditorGUILayout.HelpBox( Info, MessageType.Warning ); + } + + void DrawDebugOptions() + { + EditorGUI.BeginChangeCheck(); + m_maxAmountInputs = EditorGUILayoutIntSlider( MaxAmountStr, m_maxAmountInputs, 2, MaxAllowedAmount ); + if( EditorGUI.EndChangeCheck() ) + { + for( int i = 0; i < MaxAllowedAmount; i++ ) + { + m_inputPorts[ i ].Visible = ( i < m_maxAmountInputs ); + } + + if( m_currentSelectedInput >= m_maxAmountInputs ) + { + m_currentSelectedInput = m_maxAmountInputs - 1; + } + + UpdateLabels(); + m_sizeIsDirty = true; + } + + m_currentSelectedInput = EditorGUILayoutIntPopup( CurrSelectedStr, m_currentSelectedInput, m_availableInputsLabels, m_availableInputsValues ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + return m_inputPorts[ m_currentSelectedInput ].GeneratePortInstructions( ref dataCollector ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_currentSelectedInput = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_maxAmountInputs = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + + for( int i = 0; i < MaxAllowedAmount; i++ ) + { + m_inputPorts[ i ].Visible = ( i < m_maxAmountInputs ); + } + + if( m_currentSelectedInput >= m_maxAmountInputs ) + { + m_currentSelectedInput = m_maxAmountInputs - 1; + } + + UpdateLabels(); + m_sizeIsDirty = true; + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentSelectedInput ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_maxAmountInputs ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs.meta new file mode 100644 index 00000000..a45e189c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ad88ed9f1b6010a4bb17685dec17a585 +timeCreated: 1483956795 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs new file mode 100644 index 00000000..55060303 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs @@ -0,0 +1,415 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Swizzle +// Donated by Tobias Pott - @ Tobias Pott +// www.tobiaspott.de + +using System; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Swizzle", "Vector Operators", "Swizzle components of vector types", null, KeyCode.Z, true, false, null, null, "Tobias Pott - @TobiasPott" )] + public sealed class SwizzleNode : SingleInputOp + { + + private const string OutputTypeStr = "Output type"; + + [SerializeField] + private WirePortDataType m_selectedOutputType = WirePortDataType.FLOAT4; + + [SerializeField] + private int m_selectedOutputTypeInt = 3; + + [SerializeField] + private int[] m_selectedOutputSwizzleTypes = new int[] { 0, 1, 2, 3 }; + + [SerializeField] + private int m_maskId; + + [SerializeField] + private Vector4 m_maskValue = Vector4.one; + + private readonly string[] SwizzleVectorChannels = { "x", "y", "z", "w" }; + private readonly string[] SwizzleColorChannels = { "r", "g", "b", "a" }; + private readonly string[] SwizzleChannelLabels = { "Channel 0", "Channel 1", "Channel 2", "Channel 3" }; + + private readonly string[] m_outputValueTypes ={ "Float", + "Vector 2", + "Vector 3", + "Vector 4"}; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + + + m_inputPorts[ 0 ].DataType = WirePortDataType.FLOAT4; + m_outputPorts[ 0 ].DataType = m_selectedOutputType; + m_textLabelWidth = 90; + m_autoWrapProperties = true; + m_autoUpdateOutputPort = false; + m_hasLeftDropdown = true; + m_previewShaderGUID = "d20531704ce28b14bafb296f291f6608"; + m_previewMaterialPassId = 0; + SetAdditonalTitleText( "Value( XYZW )" ); + CalculatePreviewData(); + } + + public override void OnEnable() + { + base.OnEnable(); + m_maskId = Shader.PropertyToID( "_Mask" ); + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + PreviewMaterial.SetVector( m_maskId, m_maskValue ); + } + + void CalculatePreviewData() + { + int inputMaxChannelId = 0; + switch ( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + inputMaxChannelId = 3; + break; + case WirePortDataType.FLOAT3: + inputMaxChannelId = 2; + break; + case WirePortDataType.FLOAT2: + inputMaxChannelId = 1; + break; + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + inputMaxChannelId = 0; + break; + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + break; + } + + for ( int i = 0; i < 4; i++ ) + { + int channel = m_selectedOutputSwizzleTypes[ Mathf.Min( m_selectedOutputTypeInt, i ) ]; + m_maskValue[ i ] = Mathf.Min( inputMaxChannelId, channel ); + } + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + + if ( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if ( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + UpdatePorts(); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdatePorts(); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + UpdatePorts(); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if ( m_dropdownEditing ) + { + EditorGUI.BeginChangeCheck(); + m_selectedOutputTypeInt = EditorGUIPopup( m_dropdownRect, m_selectedOutputTypeInt, m_outputValueTypes, UIUtils.PropertyPopUp ); + if ( EditorGUI.EndChangeCheck() ) + { + switch ( m_selectedOutputTypeInt ) + { + case 0: m_selectedOutputType = WirePortDataType.FLOAT; break; + case 1: m_selectedOutputType = WirePortDataType.FLOAT2; break; + case 2: m_selectedOutputType = WirePortDataType.FLOAT3; break; + case 3: m_selectedOutputType = WirePortDataType.FLOAT4; break; + } + + UpdatePorts(); + DropdownEditing = false; + } + } + } + + public override void DrawProperties() + { + + EditorGUILayout.BeginVertical(); + EditorGUI.BeginChangeCheck(); + m_selectedOutputTypeInt = EditorGUILayoutPopup( OutputTypeStr, m_selectedOutputTypeInt, m_outputValueTypes ); + if ( EditorGUI.EndChangeCheck() ) + { + switch ( m_selectedOutputTypeInt ) + { + case 0: m_selectedOutputType = WirePortDataType.FLOAT; break; + case 1: m_selectedOutputType = WirePortDataType.FLOAT2; break; + case 2: m_selectedOutputType = WirePortDataType.FLOAT3; break; + case 3: m_selectedOutputType = WirePortDataType.FLOAT4; break; + } + + UpdatePorts(); + } + EditorGUILayout.EndVertical(); + + // Draw base properties + base.DrawProperties(); + + EditorGUILayout.BeginVertical(); + + int count = 0; + + switch ( m_selectedOutputType ) + { + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + count = 4; + break; + case WirePortDataType.FLOAT3: + count = 3; + break; + case WirePortDataType.FLOAT2: + count = 2; + break; + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + count = 1; + break; + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + break; + } + + EditorGUI.BeginChangeCheck(); + if ( m_inputPorts[ 0 ].DataType == WirePortDataType.COLOR ) + { + for ( int i = 0; i < count; i++ ) + { + m_selectedOutputSwizzleTypes[ i ] = EditorGUILayoutPopup( SwizzleChannelLabels[ i ], m_selectedOutputSwizzleTypes[ i ], SwizzleColorChannels ); + } + } + else + { + for ( int i = 0; i < count; i++ ) + { + m_selectedOutputSwizzleTypes[ i ] = EditorGUILayoutPopup( SwizzleChannelLabels[ i ], m_selectedOutputSwizzleTypes[ i ], SwizzleVectorChannels ); + } + } + if ( EditorGUI.EndChangeCheck() ) + { + UpdatePorts(); + } + + EditorGUILayout.EndVertical(); + + } + + void UpdatePorts() + { + ChangeOutputType( m_selectedOutputType, false ); + + int count = 0; + switch ( m_selectedOutputType ) + { + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + count = 4; + break; + case WirePortDataType.FLOAT3: + count = 3; + break; + case WirePortDataType.FLOAT2: + count = 2; + break; + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + count = 1; + break; + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + break; + } + + int inputMaxChannelId = 0; + switch ( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + inputMaxChannelId = 3; + break; + case WirePortDataType.FLOAT3: + inputMaxChannelId = 2; + break; + case WirePortDataType.FLOAT2: + inputMaxChannelId = 1; + break; + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + inputMaxChannelId = 0; + break; + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + break; + } + + //for ( int i = 0; i < count; i++ ) + //{ + //m_selectedOutputSwizzleTypes[ i ] = Mathf.Clamp( m_selectedOutputSwizzleTypes[ i ], 0, inputMaxChannelId ); + //} + + // Update Title + string additionalText = string.Empty; + for ( int i = 0; i < count; i++ ) + { + int currentSwizzle = Mathf.Min( inputMaxChannelId, m_selectedOutputSwizzleTypes[ i ] ); + additionalText += GetSwizzleComponentForChannel( currentSwizzle ).ToUpper(); + } + + if ( additionalText.Length > 0 ) + SetAdditonalTitleText( "Value( " + additionalText + " )" ); + else + SetAdditonalTitleText( string.Empty ); + + CalculatePreviewData(); + m_sizeIsDirty = true; + } + + public string GetSwizzleComponentForChannel( int channel ) + { + if ( m_inputPorts[ 0 ].DataType == WirePortDataType.COLOR ) + { + return SwizzleColorChannels[ channel ]; + } + else + { + return SwizzleVectorChannels[ channel ]; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string value = string.Format( "({0}).", m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) ); + + int inputMaxChannelId = 0; + switch( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + inputMaxChannelId = 3; + break; + case WirePortDataType.FLOAT3: + inputMaxChannelId = 2; + break; + case WirePortDataType.FLOAT2: + inputMaxChannelId = 1; + break; + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + inputMaxChannelId = 0; + break; + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + break; + } + + int count = 0; + switch ( m_selectedOutputType ) + { + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + count = 4; + break; + case WirePortDataType.FLOAT3: + count = 3; + break; + case WirePortDataType.FLOAT2: + count = 2; + break; + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + count = 1; + break; + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + break; + } + + for ( int i = 0; i < count; i++ ) + { + int currentSwizzle = Mathf.Min( inputMaxChannelId, m_selectedOutputSwizzleTypes[ i ] ); + value += GetSwizzleComponentForChannel( currentSwizzle ); + } + + return CreateOutputLocalVariable( 0, value, ref dataCollector ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_selectedOutputType = ( WirePortDataType ) Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ); + switch ( m_selectedOutputType ) + { + case WirePortDataType.FLOAT: m_selectedOutputTypeInt = 0; break; + case WirePortDataType.FLOAT2: m_selectedOutputTypeInt = 1; break; + case WirePortDataType.FLOAT3: m_selectedOutputTypeInt = 2; break; + case WirePortDataType.COLOR: + case WirePortDataType.FLOAT4: m_selectedOutputTypeInt = 3; break; + } + for ( int i = 0; i < m_selectedOutputSwizzleTypes.Length; i++ ) + { + m_selectedOutputSwizzleTypes[ i ] = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + UpdatePorts(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedOutputType ); + for ( int i = 0; i < m_selectedOutputSwizzleTypes.Length; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedOutputSwizzleTypes[ i ] ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs.meta new file mode 100644 index 00000000..eb6152c1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3bb41488b4b3e034d838c73c2eb471f5 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs new file mode 100644 index 00000000..6b044978 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs @@ -0,0 +1,307 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Toggle Switch", "Logical Operators", "Switch between any of its input ports" )] + public class ToggleSwitchNode : PropertyNode + { + private const string InputPortName = "In "; + private const string CurrSelectedStr = "Toggle Value"; + private const string GenerateKeywordStr = "Generate Keyword"; + //private const string LerpOp = "lerp({0},{1},{2})"; + private const string LerpOp = "(( {2} )?( {1} ):( {0} ))"; + + [SerializeField] + private string[] AvailableInputsLabels = { "In 0", "In 1" }; + + [SerializeField] + private int[] AvailableInputsValues = { 0, 1 }; + + [SerializeField] + private int m_currentSelectedInput = 0; + + [SerializeField] + private WirePortDataType m_mainDataType = WirePortDataType.FLOAT; + + [SerializeField] + private bool m_generateKeyword = true; + + private int m_cachedPropertyId = -1; + + private GUIContent m_popContent; + + private Rect m_varRect; + private Rect m_imgRect; + private bool m_editing; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( m_mainDataType, false, InputPortName + "0" ); + AddInputPort( m_mainDataType, false, InputPortName + "1" ); + + AddOutputPort( m_mainDataType, " " ); + m_insideSize.Set( 80, 25 ); + m_currentParameterType = PropertyType.Property; + m_customPrefix = "Toggle Switch"; + + m_popContent = new GUIContent(); + m_popContent.image = UIUtils.PopupIcon; + + m_availableAttribs.Clear(); + //Need to maintain this because of retrocompatibility reasons + m_availableAttribs.Add( new PropertyAttributes( "Toggle", "[Toggle]" ) ); + + m_drawAttributes = false; + m_freeType = false; + m_useVarSubtitle = true; + m_useInternalPortData = true; + m_previewShaderGUID = "beeb138daeb592a4887454f81dba2b3f"; + + m_allowPropertyDuplicates = true; + m_showAutoRegisterUI = false; + + m_srpBatcherCompatible = true; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + UIUtils.RegisterPropertyNode( this ); + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if ( m_cachedPropertyId == -1 ) + m_cachedPropertyId = Shader.PropertyToID( "_Current" ); + + PreviewMaterial.SetInt( m_cachedPropertyId, m_currentSelectedInput ); + } + + public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); + UpdateConnection(); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnection(); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + UpdateConnection(); + } + + void UpdateConnection() + { + WirePortDataType type1 = WirePortDataType.FLOAT; + if( m_inputPorts[ 0 ].IsConnected ) + type1 = m_inputPorts[ 0 ].GetOutputConnection( 0 ).DataType; + + WirePortDataType type2 = WirePortDataType.FLOAT; + if( m_inputPorts[ 1 ].IsConnected ) + type2 = m_inputPorts[ 1 ].GetOutputConnection( 0 ).DataType; + + m_mainDataType = UIUtils.GetPriority( type1 ) > UIUtils.GetPriority( type2 ) ? type1 : type2; + + m_inputPorts[ 0 ].ChangeType( m_mainDataType, false ); + m_inputPorts[ 1 ].ChangeType( m_mainDataType, false ); + + + //m_outputPorts[ 0 ].ChangeProperties( m_out, m_mainDataType, false ); + m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + + m_varRect = m_remainingBox; + m_varRect.width = 50 * drawInfo.InvertedZoom; + m_varRect.height = 16 * drawInfo.InvertedZoom; + m_varRect.x = m_remainingBox.xMax - m_varRect.width; + m_varRect.y += 1 * drawInfo.InvertedZoom; + + m_imgRect = m_varRect; + m_imgRect.x = m_varRect.xMax - 16 * drawInfo.InvertedZoom; + m_imgRect.width = 16 * drawInfo.InvertedZoom; + m_imgRect.height = m_imgRect.width; + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if ( drawInfo.CurrentEventType != EventType.MouseDown ) + return; + + if ( m_varRect.Contains( drawInfo.MousePosition ) ) + { + m_editing = true; + } + else if ( m_editing ) + { + m_editing = false; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( m_editing ) + { + EditorGUI.BeginChangeCheck(); + m_currentSelectedInput = EditorGUIIntPopup( m_varRect, m_currentSelectedInput, AvailableInputsLabels, AvailableInputsValues, UIUtils.SwitchNodePopUp ); + if ( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + UpdateConnection(); + m_requireMaterialUpdate = true; + m_editing = false; + } + } + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + base.OnNodeRepaint( drawInfo ); + + if ( !m_isVisible ) + return; + + if ( !m_editing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) + { + GUI.Label( m_varRect, AvailableInputsLabels[ m_currentSelectedInput ], UIUtils.GraphDropDown ); + GUI.Label( m_imgRect, m_popContent, UIUtils.GraphButtonIcon ); + } + } + + public override void DrawMainPropertyBlock() + { + EditorGUILayout.BeginVertical(); + { + ShowPropertyInspectorNameGUI(); + ShowPropertyNameGUI( true ); + ShowVariableMode(); + ShowHybridInstanced(); + ShowAutoRegister(); + ShowPrecision(); + m_generateKeyword = EditorGUILayoutToggle( GenerateKeywordStr, m_generateKeyword ); + ShowToolbar(); + } + EditorGUILayout.EndVertical(); + + EditorGUILayout.Separator(); + EditorGUI.BeginChangeCheck(); + m_currentSelectedInput = EditorGUILayoutIntPopup( CurrSelectedStr, m_currentSelectedInput, AvailableInputsLabels, AvailableInputsValues ); + if ( EditorGUI.EndChangeCheck() ) + { + UpdateConnection(); + m_requireMaterialUpdate = true; + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + NodeUtils.DrawPropertyGroup( ref m_visibleCustomAttrFoldout, CustomAttrStr, DrawCustomAttributes, DrawCustomAttrAddRemoveButtons ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + + string resultA = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, m_mainDataType, ignoreLocalvar, true ); + string resultB = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, m_mainDataType, ignoreLocalvar, true ); + return string.Format( LerpOp, resultA, resultB, m_propertyName ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_currentSelectedInput = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 18806 ) + { + m_generateKeyword = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentSelectedInput ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_generateKeyword ); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + m_selectedAttribs.Clear(); + UpdateConnection(); + } + public override string GetPropertyValue() + { + string toggleAttribute = ( m_generateKeyword ) ? "[Toggle]":"[ToggleUI]"; + return PropertyAttributes + toggleAttribute + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + m_currentSelectedInput; + } + + public override string GetUniformValue() + { + int index = m_containerGraph.IsSRP ? 1 : 0; + return string.Format( Constants.UniformDec[ index ], UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT ), m_propertyName ); + } + + public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) + { + dataType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT ); + dataName = m_propertyName; + return true; + } + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + if ( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) + { + mat.SetFloat( m_propertyName, ( float ) m_currentSelectedInput ); + } + } + + public override void SetMaterialMode( Material mat , bool fetchMaterialValues ) + { + base.SetMaterialMode( mat , fetchMaterialValues ); + if ( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) + { + m_currentSelectedInput = ( int ) mat.GetFloat( m_propertyName ); + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) + { + m_currentSelectedInput = (int)material.GetFloat( m_propertyName ); + PreviewIsDirty = true; + } + } + + public override string GetPropertyValStr() + { + return PropertyName; //return m_currentSelectedInput.ToString(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs.meta new file mode 100644 index 00000000..85130d13 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c7f6ffd9a8c958e449321777764784de +timeCreated: 1484213504 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation.meta new file mode 100644 index 00000000..3dcf03fc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2505ed67ae6a9d647a25755a065e350e +folderAsset: yes +timeCreated: 1488205900 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs new file mode 100644 index 00000000..4f39ce95 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs @@ -0,0 +1,30 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Object To World", "Object Transform", "Transforms input to World Space" )] + public sealed class ObjectToWorldTransfNode : ParentTransfNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_matrixName = "unity_ObjectToWorld"; + m_matrixNameHDRP = "GetObjectToWorldMatrix()"; + m_matrixNameURP = "GetObjectToWorldMatrix()"; + m_previewShaderGUID = "a4044ee165813654486d0cecd0de478c"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + string result = base.GenerateShaderForOutput( 0, ref dataCollector, ignoreLocalvar ); + if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP && !string.IsNullOrEmpty( m_matrixNameHDRP ) ) + { + dataCollector.AddLocalVariable( UniqueId, string.Format( "{0}.xyz", result ), string.Format( "GetAbsolutePositionWS(({0}).xyz);", result ) ); + } + + return GetOutputVectorItem( 0, outputId, result ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs.meta new file mode 100644 index 00000000..ded20cd8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 545417ad304cea84b9f625a3b6ad4e56 +timeCreated: 1488205951 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs new file mode 100644 index 00000000..72ed933e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs @@ -0,0 +1,53 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + public class ParentTransfNode : ParentNode + { + protected string m_matrixName; + protected string m_matrixNameHDRP; + protected string m_matrixNameURP; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT4, false, string.Empty ); + AddOutputVectorPorts( WirePortDataType.FLOAT4, "XYZW" ); + m_useInternalPortData = true; + m_inputPorts[ 0 ].Vector4InternalData = new UnityEngine.Vector4( 0, 0, 0, 1 ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string matrixName = string.Empty; + if( dataCollector.IsTemplate ) + { + if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP && !string.IsNullOrEmpty( m_matrixNameHDRP ) ) + { + matrixName = m_matrixNameHDRP; + } + else if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.URP && !string.IsNullOrEmpty( m_matrixNameURP ) ) + { + matrixName = m_matrixNameURP; + } + else + { + matrixName = m_matrixName; + } + } + else + { + matrixName = m_matrixName; + } + + RegisterLocalVariable( 0, string.Format( "mul({0},{1})", matrixName, value ),ref dataCollector,"transform"+ OutputId ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs.meta new file mode 100644 index 00000000..76049c6c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 11f04432b7f1ffb43b584adb226614c6 +timeCreated: 1488206086 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs new file mode 100644 index 00000000..394e9f98 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs @@ -0,0 +1,54 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "World To Object", "Object Transform", "Transforms input to Object Space" )] + public sealed class WorldToObjectTransfNode : ParentTransfNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_matrixName = "unity_WorldToObject"; + m_matrixNameHDRP = "GetWorldToObjectMatrix()"; + m_matrixNameURP = "GetWorldToObjectMatrix()"; + m_previewShaderGUID = "79a5efd1e3309f54d8ba3e7fdf5e459b"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string matrixName = string.Empty; + if( dataCollector.IsTemplate ) + { + if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP && !string.IsNullOrEmpty( m_matrixNameHDRP ) ) + { + string varName = "localWorldVar" + OutputId; + dataCollector.AddLocalVariable( UniqueId, PrecisionType.Float, WirePortDataType.FLOAT4, varName, value ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "({0}).xyz", varName ), string.Format( "GetCameraRelativePositionWS(({0}).xyz);", varName ) ); + value = varName; + matrixName = m_matrixNameHDRP; + } + else if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.URP && !string.IsNullOrEmpty( m_matrixNameURP ) ) + { + matrixName = m_matrixNameURP; + } + else + { + matrixName = m_matrixName; + } + } + else + { + matrixName = m_matrixName; + } + + RegisterLocalVariable( 0, string.Format( "mul({0},{1})", matrixName, value ), ref dataCollector, "transform" + OutputId ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs.meta new file mode 100644 index 00000000..36589376 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 8a25ccf8973bfae46ae3df2823f58229 +timeCreated: 1488205986 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs new file mode 100644 index 00000000..61046038 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs @@ -0,0 +1,131 @@ +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public enum eVectorFromMatrixMode + { + Row, + Column + } + + [Serializable] + [NodeAttributes( "Vector From Matrix", "Matrix Operators", "Retrieve vector data from a matrix" )] + public sealed class VectorFromMatrixNode : ParentNode + { + private const string IndexStr = "Index"; + private const string ModeStr = "Mode"; + + [SerializeField] + private eVectorFromMatrixMode m_mode = eVectorFromMatrixMode.Row; + + [SerializeField] + private int m_index = 0; + + [SerializeField] + private int m_maxIndex = 3; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT4x4, false, Constants.EmptyPortValue ); + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.FLOAT3x3, WirePortDataType.FLOAT4x4 ); + AddOutputVectorPorts( WirePortDataType.FLOAT4, "XYZW" ); + m_useInternalPortData = true; + m_autoWrapProperties = true; + } + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdatePorts(); + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); + UpdatePorts(); + } + + void UpdatePorts() + { + m_inputPorts[ 0 ].MatchPortToConnection(); + + if ( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT3x3 ) + { + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_outputPorts[ 0 ].Name = "XYZ"; + m_maxIndex = 2; + m_outputPorts[ 4 ].Visible = false; + } + else + { + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_outputPorts[ 0 ].Name = "XYZW"; + m_maxIndex = 3; + m_outputPorts[ 4 ].Visible = true; + } + m_sizeIsDirty = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + if ( m_inputPorts[ 0 ].DataType != WirePortDataType.FLOAT4x4 && + m_inputPorts[ 0 ].DataType != WirePortDataType.FLOAT3x3 ) + { + value = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, value, m_inputPorts[ 0 ].DataType, WirePortDataType.FLOAT4x4, value ); + } + if ( m_mode == eVectorFromMatrixMode.Row ) + { + value += "[" + m_index + "]"; + } + else + { + string formatStr = value + "[{0}]" + "[" + m_index + "]"; + int count = 4; + if ( m_inputPorts[ 0 ].DataType != WirePortDataType.FLOAT3x3 ) + { + value = "float4( "; + } + else + { + count = 3; + value = "float3( "; + } + + for ( int i = 0; i < count; i++ ) + { + value += string.Format( formatStr, i ); + if ( i != ( count - 1 ) ) + { + value += ","; + } + } + value += " )"; + } + return GetOutputVectorItem( 0, outputId, value ); + } + + public override void DrawProperties() + { + m_mode = (eVectorFromMatrixMode)EditorGUILayoutEnumPopup( ModeStr, m_mode ); + m_index = EditorGUILayoutIntSlider( IndexStr, m_index, 0, m_maxIndex ); + base.DrawProperties(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_mode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_index ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_mode = ( eVectorFromMatrixMode ) Enum.Parse( typeof( eVectorFromMatrixMode ), GetCurrentParam( ref nodeParams ) ); + m_index = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs.meta new file mode 100644 index 00000000..c09a60bd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 31c07015a5f2aa44297aa7cfb80ffdd5 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs new file mode 100644 index 00000000..c9329ff8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs @@ -0,0 +1,182 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; +using UnityEditor; +namespace AmplifyShaderEditor +{ + [Serializable] + + public class WeightedAvgNode : ParentNode + { + protected string[] AmountsStr = { "Layer 1", "Layer 2", "Layer 3", "Layer 4" }; + + [SerializeField] + protected int m_minimumSize = 1; + + [SerializeField] + protected WirePortDataType m_mainDataType = WirePortDataType.FLOAT; + + [SerializeField] + protected string[] m_inputData; + [SerializeField] + protected int m_activeCount = 0; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "Weights" ); + AddInputPort( WirePortDataType.FLOAT, false, AmountsStr[ 0 ] ); + AddInputPort( WirePortDataType.FLOAT, false, AmountsStr[ 1 ] ); + AddInputPort( WirePortDataType.FLOAT, false, AmountsStr[ 2 ] ); + AddInputPort( WirePortDataType.FLOAT, false, AmountsStr[ 3 ] ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + m_inputPorts[ i ].AddPortForbiddenTypes( WirePortDataType.FLOAT3x3, + WirePortDataType.FLOAT4x4, + WirePortDataType.SAMPLER1D, + WirePortDataType.SAMPLER2D, + WirePortDataType.SAMPLER3D, + WirePortDataType.SAMPLERCUBE, + WirePortDataType.SAMPLER2DARRAY, + WirePortDataType.SAMPLERSTATE ); + } + UpdateConnection( 0 ); + m_useInternalPortData = true; + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); + UpdateConnection( inputPortId ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnection( portId ); + } + + void UpdateInputPorts( int activePorts ) + { + int idx = 1; + for ( ; idx < m_minimumSize + activePorts; idx++ ) + { + m_inputPorts[ idx ].Visible = true; + } + + m_activeCount = idx - 1; + + for ( ; idx < m_inputPorts.Count; idx++ ) + { + m_inputPorts[ idx ].Visible = false; + } + } + + protected void UpdateConnection( int portId ) + { + if ( portId == 0 ) + { + if( m_inputPorts[ portId ].IsConnected ) + m_inputPorts[ portId ].MatchPortToConnection(); + + switch ( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + { + UpdateInputPorts( 1 ); + m_previewMaterialPassId = 0; + } + break; + case WirePortDataType.FLOAT2: + { + UpdateInputPorts( 2 ); + m_previewMaterialPassId = 1; + } + break; + case WirePortDataType.FLOAT3: + { + UpdateInputPorts( 3 ); + m_previewMaterialPassId = 2; + } + break; + case WirePortDataType.COLOR: + case WirePortDataType.FLOAT4: + { + UpdateInputPorts( 4 ); + m_previewMaterialPassId = 3; + } + break; + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + for ( int i = 1; i < m_inputPorts.Count; i++ ) + { + m_inputPorts[ i ].Visible = false; + } + m_activeCount = 0; + } + break; + } + } + //else + //{ + // SetMainOutputType(); + //} + + SetMainOutputType(); + m_sizeIsDirty = true; + } + + protected void SetMainOutputType() + { + m_mainDataType = WirePortDataType.OBJECT; + int count = m_inputPorts.Count; + for ( int i = 1; i < count; i++ ) + { + if ( m_inputPorts[ i ].Visible ) + { + WirePortDataType portType = m_inputPorts[ i ].IsConnected ? m_inputPorts[ i ].ConnectionType() : WirePortDataType.FLOAT; + if ( m_mainDataType != portType && + UIUtils.GetPriority( portType ) > UIUtils.GetPriority( m_mainDataType ) ) + { + m_mainDataType = portType; + } + } + } + + for( int i = 1; i < count; i++ ) + { + if( m_inputPorts[ i ].Visible ) + { + m_inputPorts[ i ].ChangeType( m_mainDataType, false ); + } + } + + m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); + } + + protected void GetInputData( ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + m_inputData[ 0 ] = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + for ( int i = 1; i < m_inputPorts.Count; i++ ) + { + if ( m_inputPorts[ i ].Visible ) + { + m_inputData[ i ] = m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); + } + } + } + + public override void ReadInputDataFromString( ref string[] nodeParams ) + { + base.ReadInputDataFromString( ref nodeParams ); + UpdateConnection( 0 ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs.meta new file mode 100644 index 00000000..55c7c13c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 35c70c67524c86049a25b7ebd0de6ae3 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs new file mode 100644 index 00000000..dc5fc1b0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs @@ -0,0 +1,58 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Weighted Blend", "Miscellaneous", "Mix all channels through weighted average sum", null, KeyCode.None, true )] + public sealed class WeightedBlendNode : WeightedAvgNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputData = new string[ 6 ]; + m_previewShaderGUID = "6076cbeaa41ebb14c85ff81b58df7d88"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + GetInputData( ref dataCollector, ignoreLocalvar ); + + string result = string.Empty; + string avgSum = string.Empty; + + string localVarName = "weightedBlendVar" + OutputId; + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].DataType, localVarName, m_inputData[ 0 ] ); + + if ( m_activeCount < 2 ) + { + return CreateOutputLocalVariable( 0, m_inputData[ 1 ], ref dataCollector ); + } + else + { + for ( int i = 0; i < m_activeCount; i++ ) + { + result += localVarName + Constants.VectorSuffixes[ i ] + "*" + m_inputData[ i + 1 ]; + avgSum += localVarName + Constants.VectorSuffixes[ i ]; + if ( i != ( m_activeCount - 1 ) ) + { + result += " + "; + avgSum += " + "; + } + } + } + + result = UIUtils.AddBrackets( result ) + "/" + UIUtils.AddBrackets( avgSum ); + result = UIUtils.AddBrackets( result ); + RegisterLocalVariable( 0, result, ref dataCollector, "weightedAvg" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs.meta new file mode 100644 index 00000000..b5e16f6b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b91b2aefbfad5b444b25320e9ed53cac +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs new file mode 100644 index 00000000..4bcc5005 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs @@ -0,0 +1,484 @@ +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Wire Node", "Miscellaneous", "Wire Node", null, KeyCode.None, false )] + public sealed class WireNode : ParentNode + { + private bool m_markedToDelete = false; + + [SerializeField] + private WirePortDataType m_visualDataType = WirePortDataType.FLOAT; + + bool m_forceVisualDataUpdate = false; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.OBJECT, false, string.Empty ); + AddOutputPort( WirePortDataType.OBJECT, Constants.EmptyPortValue ); + m_tooltipText = string.Empty; + m_drawPreview = false; + m_drawPreviewExpander = false; + m_canExpand = false; + m_previewShaderGUID = "fa1e3e404e6b3c243b5527b82739d682"; + } + + public WirePortDataType GetLastInputDataTypeRecursively() + { + if( m_outputPorts[ 0 ].ExternalReferences.Count > 0 ) + { + WireNode rightWire = m_outputPorts[ 0 ].GetInputNode( 0 ) as WireNode; + if( rightWire != null ) + return rightWire.GetLastInputDataTypeRecursively(); + else + { + return m_outputPorts[ 0 ].GetInputConnection( 0 ).DataType; + } + } + + if( m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid ) + return m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.DataType; + else + return m_visualDataType; + } + + public override WirePortDataType GetInputPortVisualDataTypeByArrayIdx( int portArrayIdx ) + { + return m_visualDataType; + } + + public override WirePortDataType GetOutputPortVisualDataTypeById( int portId ) + { + return m_visualDataType; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + + m_forceVisualDataUpdate = true; + } + + public override void OnOutputPortConnected( int portId, int otherNodeId, int otherPortId ) + { + base.OnOutputPortConnected( portId, otherNodeId, otherPortId ); + + if( m_outputPorts[ portId ].ConnectionCount > 1 ) + { + for( int i = 0; i < m_outputPorts[ portId ].ExternalReferences.Count; i++ ) + { + if( m_outputPorts[ portId ].ExternalReferences[ i ].PortId != otherPortId ) + { + UIUtils.DeleteConnection( true, m_outputPorts[ portId ].ExternalReferences[ i ].NodeId, m_outputPorts[ portId ].ExternalReferences[ i ].PortId, false, true ); + } + } + } + + m_inputPorts[ 0 ].NotifyExternalRefencesOnChange(); + m_forceVisualDataUpdate = true; + } + + public override void OnConnectedInputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedInputNodeChanges( portId, otherNodeId, otherPortId, name, type ); + + m_inputPorts[ 0 ].NotifyExternalRefencesOnChange(); + m_forceVisualDataUpdate = true; + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + + m_forceVisualDataUpdate = true; + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + TestIfValid(); + + m_forceVisualDataUpdate = true; + m_outputPorts[ 0 ].NotifyExternalRefencesOnChange(); + } + + public override void OnOutputPortDisconnected( int portId ) + { + base.OnOutputPortDisconnected( portId ); + TestIfValid(); + + m_forceVisualDataUpdate = true; + m_inputPorts[ 0 ].NotifyExternalRefencesOnChange(); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + } + + public override void DrawProperties() + { + if( m_markedToDelete ) + return; + + base.DrawProperties(); + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + if( m_firstDraw ) + { + m_firstDraw = false; + AfterCommonInit(); + OnNodeChange(); + } + + if( m_forceVisualDataUpdate ) + { + m_forceVisualDataUpdate = false; + m_visualDataType = GetLastInputDataTypeRecursively(); + } + + if( m_repopulateDictionaries ) + { + m_repopulateDictionaries = false; + + m_inputPortsDict.Clear(); + int inputCount = m_inputPorts.Count; + for( int i = 0; i < inputCount; i++ ) + { + m_inputPortsDict.Add( m_inputPorts[ i ].PortId, m_inputPorts[ i ] ); + } + + m_outputPortsDict.Clear(); + int outputCount = m_outputPorts.Count; + for( int i = 0; i < outputCount; i++ ) + { + m_outputPortsDict.Add( m_outputPorts[ i ].PortId, m_outputPorts[ i ] ); + } + } + + if( m_sizeIsDirty ) + { + m_sizeIsDirty = false; + m_extraSize.Set( 20f, 20f ); + m_position.width = m_extraSize.x + UIUtils.PortsSize.x; + m_position.height = m_extraSize.y + UIUtils.PortsSize.y; + + Vec2Position -= Position.size * 0.5f; + if( OnNodeChangeSizeEvent != null ) + { + OnNodeChangeSizeEvent( this ); + } + + ChangeSizeFinished(); + //ChangeSize(); + } + + CalculatePositionAndVisibility( drawInfo ); + + // Input Ports + { + m_currInputPortPos = m_globalPosition; + m_currInputPortPos.width = drawInfo.InvertedZoom * UIUtils.PortsSize.x; + m_currInputPortPos.height = drawInfo.InvertedZoom * UIUtils.PortsSize.y; + m_currInputPortPos.position = m_globalPosition.center - m_currInputPortPos.size * 0.5f; + int inputCount = m_inputPorts.Count; + + for( int i = 0; i < inputCount; i++ ) + { + if( m_inputPorts[ i ].Visible ) + { + // Button + m_inputPorts[ i ].Position = m_currInputPortPos; + + if( !m_inputPorts[ i ].Locked ) + { + float overflow = 2; + float scaledOverflow = 3 * drawInfo.InvertedZoom; + m_auxRect = m_currInputPortPos; + m_auxRect.yMin -= scaledOverflow + overflow; + m_auxRect.yMax += scaledOverflow + overflow; + m_auxRect.xMin -= Constants.PORT_INITIAL_X * drawInfo.InvertedZoom + scaledOverflow + overflow; + m_auxRect.xMax += m_inputPorts[ i ].LabelSize.x + Constants.PORT_TO_LABEL_SPACE_X * drawInfo.InvertedZoom + scaledOverflow + overflow; + m_inputPorts[ i ].ActivePortArea = m_auxRect; + } + m_currInputPortPos.y += drawInfo.InvertedZoom * ( m_fontHeight + Constants.INPUT_PORT_DELTA_Y ); + } + } + } + + // Output Ports + { + m_currOutputPortPos = m_globalPosition; + m_currOutputPortPos.width = drawInfo.InvertedZoom * UIUtils.PortsSize.x; + m_currOutputPortPos.height = drawInfo.InvertedZoom * UIUtils.PortsSize.y; + m_currOutputPortPos.position = m_globalPosition.center - m_currOutputPortPos.size * 0.5f; + //m_currOutputPortPos.x += ( m_globalPosition.width - drawInfo.InvertedZoom * ( Constants.PORT_INITIAL_X + m_anchorAdjust ) ); + //m_currOutputPortPos.y += drawInfo.InvertedZoom * Constants.PORT_INITIAL_Y;// + m_extraHeaderHeight * drawInfo.InvertedZoom; + int outputCount = m_outputPorts.Count; + + for( int i = 0; i < outputCount; i++ ) + { + if( m_outputPorts[ i ].Visible ) + { + //Button + m_outputPorts[ i ].Position = m_currOutputPortPos; + + if( !m_outputPorts[ i ].Locked ) + { + float overflow = 2; + float scaledOverflow = 3 * drawInfo.InvertedZoom; + m_auxRect = m_currOutputPortPos; + m_auxRect.yMin -= scaledOverflow + overflow; + m_auxRect.yMax += scaledOverflow + overflow; + m_auxRect.xMin -= m_outputPorts[ i ].LabelSize.x + Constants.PORT_TO_LABEL_SPACE_X * drawInfo.InvertedZoom + scaledOverflow + overflow; + m_auxRect.xMax += Constants.PORT_INITIAL_X * drawInfo.InvertedZoom + scaledOverflow + overflow; + m_outputPorts[ i ].ActivePortArea = m_auxRect; + } + m_currOutputPortPos.y += drawInfo.InvertedZoom * ( m_fontHeight + Constants.INPUT_PORT_DELTA_Y ); + } + } + } + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + //base.OnRepaint( drawInfo ); + //return; + if( !m_isVisible ) + return; + + m_colorBuffer = GUI.color; + + // Output Ports + int outputCount = m_outputPorts.Count; + for( int i = 0; i < outputCount; i++ ) + { + if( m_outputPorts[ i ].Visible ) + { + // Output Port Icon + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) + { + if( m_outputPorts[ i ].Locked ) + GUI.color = Constants.LockedPortColor; + else if( ContainerGraph.ParentWindow.Options.ColoredPorts ) + GUI.color = UIUtils.GetColorForDataType( m_visualDataType, false, false ); + else + GUI.color = m_outputPorts[ i ].HasCustomColor ? m_outputPorts[ i ].CustomColor : UIUtils.GetColorForDataType( m_visualDataType, true, false ); + + GUIStyle style = m_outputPorts[ i ].IsConnected ? UIUtils.GetCustomStyle( CustomStyle.PortFullIcon ) : UIUtils.GetCustomStyle( CustomStyle.PortEmptyIcon ); + GUI.Label( m_outputPorts[ i ].Position, string.Empty, style ); + + GUI.color = m_colorBuffer; + } + + // Output Port Label + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + if( m_outputPorts[ i ].Locked ) + { + GUI.color = Constants.PortLockedTextColor; + GUI.Label( m_outputPorts[ i ].LabelPosition, m_outputPorts[ i ].Name, UIUtils.OutputPortLabel ); + GUI.color = m_colorBuffer; + } + else + { + GUI.Label( m_outputPorts[ i ].LabelPosition, m_outputPorts[ i ].Name, UIUtils.OutputPortLabel ); + } + } + } + } + + // Selection Box + if( m_selected ) + { + Rect selectionBox = m_globalPosition; + selectionBox.size = Vector2.one * 16 * drawInfo.InvertedZoom + Vector2.one * 4; + selectionBox.center = m_globalPosition.center; + GUI.DrawTexture( selectionBox, UIUtils.WireNodeSelection ); + GUI.color = m_colorBuffer; + } + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + //base.DrawGUIControls( drawInfo ); + } + + public override void Draw( DrawInfo drawInfo ) + { + if( m_markedToDelete ) + return; + + if( drawInfo.CurrentEventType == EventType.Repaint ) + OnNodeRepaint( drawInfo ); + //base.Draw( drawInfo ); + + if( drawInfo.CurrentEventType == EventType.Repaint ) + TestIfValid(); + } + + bool TestIfValid() + { + if( !Alive ) + return false; + + bool result = true; + if( !m_inputPorts[ 0 ].IsConnected ) + { + if( !m_containerGraph.ParentWindow.WireReferenceUtils.InputPortReference.IsValid || m_containerGraph.ParentWindow.WireReferenceUtils.InputPortReference.IsValid && m_containerGraph.ParentWindow.WireReferenceUtils.InputPortReference.NodeId != UniqueId ) + { + ContainerGraph.MarkWireNodeSequence( this, true ); + result = false; + } + } + + if( !m_outputPorts[ 0 ].IsConnected ) + { + if( !m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid || m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid && m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.NodeId != UniqueId ) + { + ContainerGraph.MarkWireNodeSequence( this, false ); + result = false; + } + } + return result; + } + + public Vector3 TangentDirection + { + get + { + ParentNode otherInputNode = null; + ParentNode otherOutputNode = null; + + //defaults to itself so it can still calculate tangents + WirePort otherInputPort = m_outputPorts[ 0 ]; + WirePort otherOutputPort = m_inputPorts[ 0 ]; + + if( m_outputPorts[ 0 ].ConnectionCount > 0 ) + { + otherInputNode = m_containerGraph.GetNode( m_outputPorts[ 0 ].ExternalReferences[ 0 ].NodeId ); + otherInputPort = otherInputNode.GetInputPortByUniqueId( m_outputPorts[ 0 ].ExternalReferences[ 0 ].PortId ); + } + + if( m_inputPorts[ 0 ].ConnectionCount > 0 ) + { + otherOutputNode = m_containerGraph.GetNode( m_inputPorts[ 0 ].ExternalReferences[ 0 ].NodeId ); + otherOutputPort = otherOutputNode.GetOutputPortByUniqueId( m_inputPorts[ 0 ].ExternalReferences[ 0 ].PortId ); + } + + //TODO: it still generates crooked lines if wire nodes get too close to non-wire nodes (the fix would be to calculate the non-wire nodes magnitude properly) + float mag = Constants.HORIZONTAL_TANGENT_SIZE * ContainerGraph.ParentWindow.CameraDrawInfo.InvertedZoom; + + Vector2 outPos; + if( otherOutputNode != null && otherOutputNode.GetType() != typeof( WireNode ) ) + outPos = otherOutputPort.Position.position + Vector2.right * mag * 0.66f; + else + outPos = otherOutputPort.Position.position; + + Vector2 inPos; + if( otherInputNode != null && otherInputNode.GetType() != typeof( WireNode ) ) + inPos = otherInputPort.Position.position - Vector2.right * mag * 0.66f; + else + inPos = otherInputPort.Position.position; + + Vector2 tangent = ( outPos - inPos ).normalized; + return new Vector3( tangent.x, tangent.y ); + } + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + + m_extraSize.Set( 20f, 20f ); + m_position.width = m_extraSize.x + UIUtils.PortsSize.x; + m_position.height = m_extraSize.y + UIUtils.PortsSize.y; + + Vec2Position += Position.size * 0.5f; + } + + public override void OnAfterDeserialize() + { + base.OnAfterDeserialize(); + m_sizeIsDirty = false; + } + + public WireReference FindNewValidInputNode( WireNode current ) + { + if( current.InputPorts[ 0 ].IsConnected ) + { + ParentNode node = m_containerGraph.GetNode( current.InputPorts[ 0 ].ExternalReferences[ 0 ].NodeId ); + if( node != null ) + { + WireNode wireNode = node as WireNode; + if( wireNode != null && wireNode.MarkToDelete ) + { + return FindNewValidInputNode( wireNode ); + } + else + { + return current.InputPorts[ 0 ].ExternalReferences[ 0 ]; + } + } + } + return null; + } + + public WireReference FindNewValidOutputNode( WireNode current ) + { + if( current.OutputPorts[ 0 ].IsConnected ) + { + ParentNode node = m_containerGraph.GetNode( current.OutputPorts[ 0 ].ExternalReferences[ 0 ].NodeId ); + + if( node != null ) + { + WireNode wireNode = node as WireNode; + if( wireNode != null && wireNode.MarkToDelete ) + { + return FindNewValidOutputNode( wireNode ); + } + else + { + return current.OutputPorts[ 0 ].ExternalReferences[ 0 ]; + } + } + } + return null; + } + + public override void Rewire() + { + //if ( m_inputPorts[ 0 ].ExternalReferences != null && m_inputPorts[ 0 ].ExternalReferences.Count > 0 ) + //{ + //WireReference backPort = m_inputPorts[ 0 ].ExternalReferences[ 0 ]; + //for ( int i = 0; i < m_outputPorts[ 0 ].ExternalReferences.Count; i++ ) + //{ + // UIUtils.CurrentWindow.ConnectInputToOutput( m_outputPorts[ 0 ].ExternalReferences[ i ].NodeId, m_outputPorts[ 0 ].ExternalReferences[ i ].PortId, backPort.NodeId, backPort.PortId ); + //} + //} + MarkToDelete = true; + WireReference outputReference = FindNewValidInputNode( this ); + WireReference inputReference = FindNewValidOutputNode( this ); + if( outputReference != null && inputReference != null ) + { + ContainerGraph.ParentWindow.ConnectInputToOutput( inputReference.NodeId, inputReference.PortId, outputReference.NodeId, outputReference.PortId ); + } + } + + public bool MarkToDelete + { + get { return m_markedToDelete; } + set { m_markedToDelete = value; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs.meta new file mode 100644 index 00000000..d2bbbe3e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7a566d6bf220cd74b8385a91f690b683 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs new file mode 100644 index 00000000..91e441ea --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs @@ -0,0 +1,97 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public enum NodeAvailability + { + SurfaceShader = 1 << 0, + ShaderFunction = 1 << 1, + CustomLighting = 1 << 2, + TemplateShader = 1 << 3 + } + + + [AttributeUsage( AttributeTargets.Class )] + public class NodeAttributes : Attribute + { + + public string Name; + public string Description; + public string Category; + public KeyCode ShortcutKey; + public bool Available; + public System.Type[] CastType; // Type that will be converted to AttribType if dropped on the canvas ... p.e. dropping a texture2d on the canvas will generate a sampler2d node + public bool Deprecated; + public string DeprecatedAlternative; + public System.Type DeprecatedAlternativeType; + public bool FromCommunity; + public string CustomCategoryColor; // Color created via a string containing its hexadecimal representation + public int SortOrderPriority; // to be used when name comparing on sorting + public int NodeAvailabilityFlags;// used to define where this node can be used + private string m_nodeUrl; + public string Community; + public string Tags; + public NodeAttributes( string name, string category, string description, System.Type castType = null, KeyCode shortcutKey = KeyCode.None, bool available = true, bool deprecated = false, string deprecatedAlternative = null, System.Type deprecatedAlternativeType = null, string community = null, string customCategoryColor = null, int sortOrderPriority = -1, int nodeAvailabilityFlags = int.MaxValue, string tags = null ) + { + Name = name; + Description = description; + Category = category; + if( castType != null ) + CastType = new System.Type[] { castType }; + + ShortcutKey = shortcutKey; + Available = available; + Deprecated = deprecated; + DeprecatedAlternative = deprecatedAlternative; + Community = community; + if( string.IsNullOrEmpty( Community ) ) + Community = string.Empty; + else + FromCommunity = true; + + if( !string.IsNullOrEmpty( customCategoryColor ) ) + CustomCategoryColor = customCategoryColor; + + DeprecatedAlternativeType = deprecatedAlternativeType; + SortOrderPriority = sortOrderPriority; + NodeAvailabilityFlags = nodeAvailabilityFlags; + Tags = tags; + if( string.IsNullOrEmpty( tags ) ) + Tags = string.Empty; + //m_nodeUrl = ( FromCommunity ? Constants.CommunityNodeCommonUrl : Constants.NodeCommonUrl ) + UIUtils.UrlReplaceInvalidStrings( Name ); + } + + public NodeAttributes( string name, string category, string description, KeyCode shortcutKey, bool available, int sortOrderPriority, int nodeAvailabilityFlags, params System.Type[] castTypes ) + { + Name = name; + Description = description; + Category = category; + if( castTypes != null && castTypes.Length > 0 ) + { + CastType = castTypes; + } + + ShortcutKey = shortcutKey; + Available = available; + SortOrderPriority = sortOrderPriority; + NodeAvailabilityFlags = nodeAvailabilityFlags; + //m_nodeUrl = ( FromCommunity ? Constants.CommunityNodeCommonUrl : Constants.NodeCommonUrl ) + UIUtils.UrlReplaceInvalidStrings( Name ); + } + + public string NodeUrl + { + get + { + if( string.IsNullOrEmpty( m_nodeUrl ) ) + { + m_nodeUrl = ( FromCommunity ? Constants.CommunityNodeCommonUrl : Constants.NodeCommonUrl ) + UIUtils.UrlReplaceInvalidStrings( Name ); + } + return m_nodeUrl; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs.meta new file mode 100644 index 00000000..bd805a48 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ec3cfdc3a4d1a7a4cb24c1c079e1750a +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs new file mode 100644 index 00000000..d68d8eb1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs @@ -0,0 +1,119 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +namespace AmplifyShaderEditor +{ + public class NodeRestrictionsData + { + private bool m_allPorts; + private Dictionary m_portRestrictions; + public NodeRestrictionsData() + { + m_portRestrictions = new Dictionary(); + } + + public NodeRestrictionsData( int port ) + { + m_portRestrictions = new Dictionary(); + m_portRestrictions.Add( port, true ); + } + + public void SetAllPortRestiction( bool value ) + { + m_allPorts = value; + } + + public void AddRestriction( int port ) + { + if ( !m_portRestrictions.ContainsKey( port ) ) + m_portRestrictions.Add( port, true ); + else + m_portRestrictions[ port ] = true; + } + + public void RemoveRestriction( int port ) + { + if ( m_portRestrictions.ContainsKey( port ) ) + m_portRestrictions[ port ] = true; + } + + public bool IsPortRestricted( int port ) + { + if ( m_portRestrictions.ContainsKey( port ) ) + return m_portRestrictions[ port ]; + return false; + } + + public void Destroy() + { + m_portRestrictions.Clear(); + m_portRestrictions = null; + } + + public bool AllPortsRestricted + { + get + { + return m_allPorts; + } + } + } + + public class NodeRestrictions + { + private Dictionary m_restrictions; + + public NodeRestrictions() + { + m_restrictions = new Dictionary(); + } + + public void AddTypeRestriction( System.Type type ) + { + if ( !m_restrictions.ContainsKey( type ) ) + m_restrictions.Add( type, new NodeRestrictionsData() ); + + m_restrictions[ type ].SetAllPortRestiction( true ); + + } + + public void AddPortRestriction( System.Type type, int port ) + { + if ( !m_restrictions.ContainsKey( type ) ) + m_restrictions.Add( type, new NodeRestrictionsData( port ) ); + else + { + m_restrictions[ type ].AddRestriction( port ); + } + } + + public bool GetRestiction( System.Type type, int port ) + { + if ( m_restrictions.Count == 0 || type == null ) + return false; + + if ( m_restrictions.ContainsKey( type ) ) + { + if ( m_restrictions[ type ].AllPortsRestricted ) + return true; + + return m_restrictions[ type ].IsPortRestricted( port ); + } + + return false; + } + + public void Destroy() + { + foreach ( KeyValuePair pair in m_restrictions ) + { + pair.Value.Destroy(); + } + + m_restrictions.Clear(); + m_restrictions = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs.meta new file mode 100644 index 00000000..9bed7883 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: bd1aff8475f370d4380918491184aef5 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs new file mode 100644 index 00000000..f71bc283 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs @@ -0,0 +1,208 @@ +using System; +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] public class UsageListSamplerNodes : NodeUsageRegister { } + [Serializable] public class UsageListFloatIntNodes : NodeUsageRegister { } + [Serializable] public class UsageListTexturePropertyNodes : NodeUsageRegister { } + [Serializable] public class UsageListTextureArrayNodes : NodeUsageRegister { } + [Serializable] public class UsageListPropertyNodes : NodeUsageRegister { } + [Serializable] public class UsageListScreenColorNodes : NodeUsageRegister { } + [Serializable] public class UsageListRegisterLocalVarNodes : NodeUsageRegister { } + [Serializable] public class UsageListFunctionInputNodes : NodeUsageRegister { } + [Serializable] public class UsageListFunctionNodes : NodeUsageRegister { } + [Serializable] public class UsageListFunctionOutputNodes : NodeUsageRegister { } + [Serializable] public class UsageListFunctionSwitchNodes : NodeUsageRegister { } + [Serializable] public class UsageListFunctionSwitchCopyNodes : NodeUsageRegister { } + [Serializable] public class UsageListTemplateMultiPassMasterNodes : NodeUsageRegister { } + [Serializable] public class UsageListCustomExpressionsOnFunctionMode : NodeUsageRegister { } + [Serializable] public class UsageListGlobalArrayNodes : NodeUsageRegister { } + [Serializable] public class UsageListStaticSwitchNodes : NodeUsageRegister { } + + [Serializable] + public class NodeUsageRegister where T : ParentNode + { + public delegate void ReorderEvent(); + public event ReorderEvent OnReorderEventComplete; + + [SerializeField] + public bool ReorderOnChange = false; + + // Sampler Nodes registry + [SerializeField] + private List m_nodes; + + [SerializeField] + private string[] m_nodesArr; + + [SerializeField] + private int[] m_nodeIDs; + + [SerializeField] + ParentGraph m_containerGraph; + + public NodeUsageRegister() + { + m_nodesArr = new string[ 0 ]; + m_nodeIDs = new int[ 0 ]; + m_nodes = new List(); + } + + public void Destroy() + { + m_nodes.Clear(); + m_nodes = null; + m_nodesArr = null; + m_nodeIDs = null; + } + + public void Clear() + { + m_nodes.Clear(); + } + + public int AddNode( T node ) + { + if( node == null ) + return -1; + + if( !m_nodes.Contains( node ) ) + { + if( m_containerGraph != null ) + { + UndoUtils.RegisterCompleteObjectUndo( m_containerGraph.ParentWindow, Constants.UndoRegisterNodeId ); + UndoUtils.RegisterCompleteObjectUndo( m_containerGraph, Constants.UndoRegisterNodeId ); + } + m_nodes.Add( node ); + ReorderNodes(); + UpdateNodeArr(); + return m_nodes.Count - 1; + } + else if( node.UniqueId > -1 ) + { + UpdateNodeArr(); + } + + return -1; + } + + public bool HasNode( int uniqueId ) + { + return m_nodes.FindIndex( x => x.UniqueId == uniqueId ) > -1 ? true : false; + } + + public void RemoveNode( T node ) + { + if( node == null ) + return; + + if( m_nodes.Contains( node ) ) + { + if( m_containerGraph != null ) + { + UndoUtils.RegisterCompleteObjectUndo( m_containerGraph.ParentWindow, Constants.UndoUnregisterNodeId ); + UndoUtils.RegisterCompleteObjectUndo( m_containerGraph, Constants.UndoUnregisterNodeId ); + } + + m_nodes.Remove( node ); + ReorderNodes(); + UpdateNodeArr(); + } + } + + public void ReorderNodes() + { + if( ReorderOnChange ) + { + UnityEngine.Profiling.Profiler.BeginSample( "ReorderNodes_Sort" ); + m_nodes.Sort( ( x, y ) => ( x.DataToArray.CompareTo( y.DataToArray ) ) ); + UnityEngine.Profiling.Profiler.EndSample(); + + if( OnReorderEventComplete != null ) + { + UnityEngine.Profiling.Profiler.BeginSample( "ReorderNodes_CallEvent" ); + OnReorderEventComplete(); + UnityEngine.Profiling.Profiler.EndSample(); + } + } + } + + public void UpdateNodeArr() + { + int nodeCount = m_nodes.Count; + if( nodeCount != m_nodesArr.Length ) + { + m_nodesArr = new string[ nodeCount ]; + m_nodeIDs = new int[ nodeCount ]; + } + + for( int i = 0; i < nodeCount; i++ ) + { + m_nodesArr[ i ] = m_nodes[ i ].DataToArray; + m_nodeIDs[ i ] = m_nodes[ i ].UniqueId; + } + } + + public T GetNode( int idx ) + { + if( idx > -1 && idx < m_nodes.Count ) + { + return m_nodes[ idx ]; + } + return null; + } + + public T GetNodeByUniqueId( int uniqueId ) + { + return m_nodes.Find( x => x.UniqueId == uniqueId ); + } + + public T GetNodeByDataToArray( string data ) + { + return m_nodes.Find( x => x.DataToArray.Equals( data )); + } + + public int GetNodeRegisterIdx( int uniqueId ) + { + return m_nodes.FindIndex( x => x.UniqueId == uniqueId ); + } + + public void UpdateDataOnNode( int uniqueId, string data ) + { + if( ReorderOnChange ) + { + ReorderNodes(); + UpdateNodeArr(); + } + else + { + int index = m_nodes.FindIndex( x => x.UniqueId == uniqueId ); + if( index > -1 ) + { + m_nodesArr[ index ] = data; + m_nodeIDs[ index ] = uniqueId; + } + } + } + + public void Dump() + { + string data = string.Empty; + + for( int i = 0; i < m_nodesArr.Length; i++ ) + { + data += m_nodesArr[ i ] + " " + m_nodeIDs[ i ] + '\n'; + } + Debug.Log( data ); + } + + public string[] NodesArr { get { return m_nodesArr; } } + public int[] NodeIds { get { return m_nodeIDs; } } + public List NodesList { get { return m_nodes; } } + public int Count { get { return m_nodes.Count; } } + public ParentGraph ContainerGraph { get { return m_containerGraph; } set { m_containerGraph = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs.meta new file mode 100644 index 00000000..2c28128f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2aa06a21e7f64094c91da5dd60ef35cf +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.cs new file mode 100644 index 00000000..0f27470c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.cs @@ -0,0 +1,291 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public class NodeUtils + { + + public delegate void DrawPropertySection(); + + public static void DrawPropertyGroup( string sectionName, DrawPropertySection DrawSection ) + { + Color cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); + EditorGUILayout.BeginHorizontal( UIUtils.MenuItemToolbarStyle ); + GUI.color = cachedColor; + + GUILayout.Label( sectionName, UIUtils.MenuItemToggleStyle ); + + EditorGUILayout.EndHorizontal(); + + + cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); + EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); + GUI.color = cachedColor; + DrawSection(); + EditorGUILayout.Separator(); + EditorGUILayout.EndVertical(); + } + + + public static void DrawNestedPropertyGroup( ref bool foldoutValue, string sectionName, DrawPropertySection DrawSection, int horizontalSpacing = 15 ) + { + GUILayout.BeginHorizontal(); + { + GUILayout.Space( horizontalSpacing ); + EditorGUILayout.BeginVertical( EditorStyles.helpBox ); + { + Color cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); + EditorGUILayout.BeginHorizontal(); + { + GUI.color = cachedColor; + bool value = GUILayout.Toggle( foldoutValue, sectionName, UIUtils.MenuItemToggleStyle ); + if( Event.current.button == Constants.FoldoutMouseId ) + { + foldoutValue = value; + } + } + EditorGUILayout.EndHorizontal(); + EditorGUI.indentLevel--; + if( foldoutValue ) + { + cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); + { + EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); + { + GUI.color = cachedColor; + DrawSection(); + } + EditorGUILayout.EndVertical(); + EditorGUILayout.Separator(); + } + } + EditorGUI.indentLevel++; + } + EditorGUILayout.EndVertical(); + } + GUILayout.EndHorizontal(); + } + + public static void DrawNestedPropertyGroup( ref bool foldoutValue, Rect rect, string sectionName, DrawPropertySection DrawSection, int horizontalSpacing = 15 ) + { + var box = rect; + box.height -= 2; + GUI.Label( box, string.Empty, EditorStyles.helpBox ); + + var tog = rect; + tog.y -= ( tog.height - ( EditorGUIUtility.singleLineHeight + 5 ) ) * 0.5f; + tog.xMin += 2; + tog.xMax -= 2; + tog.yMin += 2; + bool value = GUI.Toggle( tog, foldoutValue, sectionName, UIUtils.MenuItemToggleStyle ); + if( Event.current.button == Constants.FoldoutMouseId ) + { + foldoutValue = value; + } + + if( foldoutValue ) + { + DrawSection(); + } + } + + + public static void DrawNestedPropertyGroup( ref bool foldoutValue, string sectionName, DrawPropertySection DrawSection, DrawPropertySection HeaderSection ) + { + GUILayout.BeginHorizontal(); + { + GUILayout.Space( 15 ); + EditorGUILayout.BeginVertical( EditorStyles.helpBox ); + Color cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); + EditorGUILayout.BeginHorizontal(); + GUI.color = cachedColor; + + bool value = GUILayout.Toggle( foldoutValue, sectionName, UIUtils.MenuItemToggleStyle ); + if( Event.current.button == Constants.FoldoutMouseId ) + { + foldoutValue = value; + } + HeaderSection(); + EditorGUILayout.EndHorizontal(); + EditorGUI.indentLevel--; + if( foldoutValue ) + { + cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); + EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); + GUI.color = cachedColor; + DrawSection(); + EditorGUILayout.EndVertical(); + EditorGUILayout.Separator(); + } + EditorGUI.indentLevel++; + EditorGUILayout.EndVertical(); + } + GUILayout.EndHorizontal(); + } + + public static void DrawNestedPropertyGroup( UndoParentNode owner, ref bool foldoutValue, ref bool enabledValue, string sectionName, DrawPropertySection DrawSection ) + { + GUILayout.BeginHorizontal(); + { + GUILayout.Space( 15 ); + EditorGUILayout.BeginVertical( EditorStyles.helpBox ); + Color cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); + EditorGUILayout.BeginHorizontal(); + GUI.color = cachedColor; + + bool value = GUILayout.Toggle( foldoutValue, sectionName, UIUtils.MenuItemToggleStyle ); + if( Event.current.button == Constants.FoldoutMouseId ) + { + foldoutValue = value; + } + + value = ( (object)owner != null ) ? owner.GUILayoutToggle( enabledValue, string.Empty,UIUtils.MenuItemEnableStyle, GUILayout.Width( 16 ) ) : + GUILayout.Toggle( enabledValue, string.Empty, UIUtils.MenuItemEnableStyle, GUILayout.Width( 16 ) ); + if( Event.current.button == Constants.FoldoutMouseId ) + { + enabledValue = value; + } + + + EditorGUILayout.EndHorizontal(); + EditorGUI.indentLevel--; + if( foldoutValue ) + { + cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); + EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); + GUI.color = cachedColor; + DrawSection(); + EditorGUILayout.EndVertical(); + EditorGUILayout.Separator(); + } + EditorGUI.indentLevel++; + EditorGUILayout.EndVertical(); + } + GUILayout.EndHorizontal(); + } + + + public static void DrawPropertyGroup( ref bool foldoutValue, string sectionName, DrawPropertySection DrawSection ) + { + Color cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); + EditorGUILayout.BeginHorizontal( UIUtils.MenuItemToolbarStyle ); + GUI.color = cachedColor; + + bool value = GUILayout.Toggle( foldoutValue, sectionName, UIUtils.MenuItemToggleStyle ); + if( Event.current.button == Constants.FoldoutMouseId ) + { + foldoutValue = value; + } + EditorGUILayout.EndHorizontal(); + + if( foldoutValue ) + { + cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); + EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); + { + GUI.color = cachedColor; + EditorGUI.indentLevel++; + DrawSection(); + EditorGUI.indentLevel--; + EditorGUILayout.Separator(); + } + EditorGUILayout.EndVertical(); + } + } + + public static void DrawPropertyGroup( ref bool foldoutValue, string sectionName, DrawPropertySection DrawSection, DrawPropertySection HeaderSection ) + { + Color cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); + EditorGUILayout.BeginHorizontal( UIUtils.MenuItemToolbarStyle ); + GUI.color = cachedColor; + + bool value = GUILayout.Toggle( foldoutValue, sectionName, UIUtils.MenuItemToggleStyle ); + if( Event.current.button == Constants.FoldoutMouseId ) + { + foldoutValue = value; + } + HeaderSection(); + EditorGUILayout.EndHorizontal(); + + if( foldoutValue ) + { + cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); + EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); + { + GUI.color = cachedColor; + EditorGUI.indentLevel++; + DrawSection(); + EditorGUI.indentLevel--; + EditorGUILayout.Separator(); + } + EditorGUILayout.EndVertical(); + } + } + + + public static bool DrawPropertyGroup( UndoParentNode owner, ref bool foldoutValue, ref bool enabledValue, string sectionName, DrawPropertySection DrawSection ) + { + bool enableChanged = false; + Color cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); + EditorGUILayout.BeginHorizontal( UIUtils.MenuItemToolbarStyle ); + GUI.color = cachedColor; + bool value = GUILayout.Toggle( foldoutValue, sectionName, UIUtils.MenuItemToggleStyle, GUILayout.ExpandWidth( true ) ); + if( Event.current.button == Constants.FoldoutMouseId ) + { + foldoutValue = value; + } + EditorGUI.BeginChangeCheck(); + value = ( (object)owner != null ) ? owner.EditorGUILayoutToggle( string.Empty, enabledValue, UIUtils.MenuItemEnableStyle, GUILayout.Width( 16 ) ) : + EditorGUILayout.Toggle( string.Empty, enabledValue, UIUtils.MenuItemEnableStyle, GUILayout.Width( 16 ) ); + if( Event.current.button == Constants.FoldoutMouseId ) + { + enabledValue = value; + } + if( EditorGUI.EndChangeCheck() ) + { + enableChanged = true; + } + + EditorGUILayout.EndHorizontal(); + + if( foldoutValue ) + { + cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); + EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); + GUI.color = cachedColor; + + EditorGUILayout.Separator(); + EditorGUI.BeginDisabledGroup( !enabledValue ); + + EditorGUI.indentLevel += 1; + + DrawSection(); + + EditorGUI.indentLevel -= 1; + EditorGUI.EndDisabledGroup(); + EditorGUILayout.Separator(); + EditorGUILayout.EndVertical(); + } + + return enableChanged; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.cs.meta new file mode 100644 index 00000000..a16b2a02 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 9eb57a68790e6e343affe131e8a0f860 +timeCreated: 1487688956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators.meta new file mode 100644 index 00000000..6d6fbea5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f2a66c410f1e56b418ec994b6f57c2eb +folderAsset: yes +timeCreated: 1481126946 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs new file mode 100644 index 00000000..5186bc55 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "ACos", "Trigonometry Operators", "Arccosine of scalars and vectors" , tags: "arccosine" )] + public sealed class ACosOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "acos"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + m_previewShaderGUID = "710f3c0bbd7ba0c4aada6d7dfadd49c2"; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs.meta new file mode 100644 index 00000000..b20796b1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 8238f389c28938544b56035531b3f1be +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs new file mode 100644 index 00000000..34ba4122 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "ASin", "Trigonometry Operators", "Arcsine of scalars and vectors", tags: "arcsine" )] + public sealed class ASinOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "asin"; + m_previewShaderGUID = "2b016c135284add4cb3364d4a0bd0638"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs.meta new file mode 100644 index 00000000..54fe41d3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 268ebf76d03c2e84f8c80a375773b46c +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs new file mode 100644 index 00000000..391dd882 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs @@ -0,0 +1,28 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "ATan2", "Trigonometry Operators", "Arctangent of y/x",tags: "arctangent2" )] + public sealed class ATan2OpNode : DynamicTypeNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_dynamicOutputType = true; + m_useInternalPortData = true; + m_previewShaderGUID = "02e3ff61784e38840af6313936b6a730"; + } + + public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); + string result = "atan2( " + m_inputA + " , " + m_inputB + " )"; + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs.meta new file mode 100644 index 00000000..17edadd8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f5957d9ac2cc12146bc862cd0c92815a +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs new file mode 100644 index 00000000..8909e8f1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "ATan", "Trigonometry Operators", "Arctangent of scalars and vectors", tags: "Arctangent" )] + public sealed class ATanOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "atan"; + m_previewShaderGUID = "7d7f3331a98831241b017364e80625ea"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs.meta new file mode 100644 index 00000000..de6e25bf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d84f7e90e793aaa4891b4c1fe400dc4c +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs new file mode 100644 index 00000000..18adcbd9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Abs", "Math Operators", "Absolute value of scalars and vectors" )] + public sealed class AbsOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "abs"; + m_previewShaderGUID = "cd6d6dfa3df214a479f68a490e177db6"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs.meta new file mode 100644 index 00000000..607d4dfd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 46aea6c13d71ec74da7f23abba3704d6 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs new file mode 100644 index 00000000..6767231e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Ceil", "Math Operators", "Smallest integer not less than a scalar or each vector component" )] + public sealed class CeilOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "ceil"; + m_previewShaderGUID = "ce0588227a766a245a85291977c1f222"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR , + WirePortDataType.INT); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs.meta new file mode 100644 index 00000000..d1a0f21e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 555db3754f84db947846519630ea303b +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs new file mode 100644 index 00000000..2c960f3e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs @@ -0,0 +1,103 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Clamp", "Math Operators", "Value clamped to the range [min,max]" )] + public sealed class ClampOpNode : ParentNode + { + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddInputPort( WirePortDataType.FLOAT, false, "Min" ); + AddInputPort( WirePortDataType.FLOAT, false, "Max" ); + m_inputPorts[ m_inputPorts.Count - 1 ].FloatInternalData = 1; + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_textLabelWidth = 55; + m_previewShaderGUID = "ab6163c4b10bfc84da8e3c486520490a"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + if ( portId == 0 ) + { + m_inputPorts[ 0 ].MatchPortToConnection(); + m_inputPorts[ 1 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + m_inputPorts[ 2 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + //else + //{ + // _inputPorts[ portId ].MatchPortToConnection(); + //} + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + if ( outputPortId == 0 ) + { + m_inputPorts[ 0 ].MatchPortToConnection(); + m_inputPorts[ 1 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + m_inputPorts[ 2 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + WirePortDataType valueType = m_inputPorts[ 0 ].ConnectionType(); + WirePortDataType minType = m_inputPorts[ 1 ].ConnectionType(); + WirePortDataType maxType = m_inputPorts[ 2 ].ConnectionType(); + + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string min = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + if ( minType != valueType ) + { + min = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, null, m_inputPorts[ 1 ].DataType, m_inputPorts[ 0 ].DataType, min ); + } + + string max = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + if ( maxType != valueType ) + { + max = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, null, m_inputPorts[ 2 ].DataType, m_inputPorts[ 0 ].DataType, max ); + } + + string result = string.Empty; + switch ( valueType ) + { + case WirePortDataType.FLOAT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.INT: + case WirePortDataType.COLOR: + case WirePortDataType.OBJECT: + { + result = "clamp( " + value + " , " + min + " , " + max + " )"; + } + break; + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + return UIUtils.InvalidParameter( this ); + } + } + + RegisterLocalVariable( 0, result, ref dataCollector, "clampResult" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs.meta new file mode 100644 index 00000000..10d59c60 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5d7101830aa0c524f9519fef95c90dc3 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs new file mode 100644 index 00000000..606cb822 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs @@ -0,0 +1,123 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Clip", "Miscellaneous", "Conditionally kill a pixel before output" )] + public sealed class ClipNode : ParentNode + { + private const string ClipOpFormat = "clip( {0} );"; + private const string ClipSubOpFormat = "clip( {0} - {1});"; + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddInputPort( WirePortDataType.FLOAT, false, "Alpha" ); + AddInputPort( WirePortDataType.FLOAT, false, "Threshold" ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR , + WirePortDataType.INT); + + m_previewShaderGUID = "1fca7774f364aee4d8c64e8634ef4be4"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ portId ].MatchPortToConnection(); + UpdatePortConnection( portId ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ outputPortId ].MatchPortToConnection(); + UpdatePortConnection( outputPortId ); + } + + void UpdatePortConnection( int portId ) + { + if( portId == 0 ) + { + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + else + { + int otherPortId = portId == 1 ? 2 : 1; + if( m_inputPorts[ otherPortId ].IsConnected ) + { + WirePortDataType type1 = m_inputPorts[ portId ].DataType; + WirePortDataType type2 = m_inputPorts[ otherPortId ].DataType; + + WirePortDataType mainType = UIUtils.GetPriority( type1 ) > UIUtils.GetPriority( type2 ) ? type1 : type2; + + m_inputPorts[ portId ].ChangeType( mainType, false ); + m_inputPorts[ otherPortId ].ChangeType( mainType , false ); + } + else + { + m_inputPorts[ otherPortId ].ChangeType( m_inputPorts[ portId ].DataType,false ); + } + } + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + if( portId == 0 ) + return; + int otherPortId = portId == 1 ? 2 : 1; + if( m_inputPorts[ otherPortId ].IsConnected ) + { + m_inputPorts[ portId ].ChangeType( m_inputPorts[ otherPortId ].DataType, false ); + } + else + { + m_inputPorts[ portId ].ChangeType( WirePortDataType.FLOAT, false ); + m_inputPorts[ otherPortId ].ChangeType( WirePortDataType.FLOAT, false ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || + dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowMessage( UniqueId, "Clip can only be used in fragment functions", MessageSeverity.Warning ); + return GenerateErrorValue(); + } + + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string alpha = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + if( m_inputPorts[ 2 ].IsConnected ) + { + string threshold = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + dataCollector.AddLocalVariable( UniqueId, string.Format( ClipSubOpFormat, alpha , threshold) ); + } + else + { + if( m_inputPorts[ 2 ].IsZeroInternalData ) + { + dataCollector.AddLocalVariable( UniqueId, string.Format( ClipOpFormat, alpha ) ); + } + else + { + string threshold = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + dataCollector.AddLocalVariable( UniqueId, string.Format( ClipSubOpFormat, alpha, threshold ) ); + } + } + + return value; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs.meta new file mode 100644 index 00000000..da7f46e6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 78e9954f4d587b74fa38ae1dd9922d77 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs new file mode 100644 index 00000000..3ed727cd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs @@ -0,0 +1,382 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Component Mask", "Vector Operators", "Mask certain channels from vectors/color components", null, KeyCode.K )] + public sealed class ComponentMaskNode : ParentNode + { + private const string OutputLocalVarName = "componentMask"; + [SerializeField] + private bool[] m_selection = { true, true, true, true }; + + [SerializeField] + private int m_outputPortCount = 4; + + [SerializeField] + private string[] m_labels; + + private int m_cachedOrderId = -1; + private int m_cachedSingularId = -1; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT4, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_autoWrapProperties = true; + m_selectedLocation = PreviewLocation.TopCenter; + m_labels = new string[] { "X", "Y", "Z", "W" }; + m_previewShaderGUID = "b78e2b295c265cd439c80d218fb3e88e"; + SetAdditonalTitleText( "Value( XYZW )" ); + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + Vector4 order = new Vector4(-1,-1,-1,-1); + int lastIndex = 0; + int singularId = -1; + var datatype = m_inputPorts[ 0 ].DataType; + + if( m_selection[ 0 ] ) + { + order.Set( lastIndex, order.y, order.z, order.w ); + lastIndex++; + singularId = 0; + } + if( m_selection[ 1 ] && datatype >= WirePortDataType.FLOAT2 ) + { + order.Set( order.x, lastIndex, order.z, order.w ); + lastIndex++; + singularId = 1; + } + if( m_selection[ 2 ] && datatype >= WirePortDataType.FLOAT3 ) + { + order.Set( order.x, order.y, lastIndex, order.w ); + lastIndex++; + singularId = 2; + } + if( m_selection[ 3 ] && ( datatype == WirePortDataType.FLOAT4 || datatype == WirePortDataType.COLOR ) ) + { + order.Set( order.x, order.y, order.z, lastIndex ); + lastIndex++; + singularId = 3; + } + + if ( lastIndex != 1 ) + singularId = -1; + + if ( m_cachedOrderId == -1 ) + m_cachedOrderId = Shader.PropertyToID( "_Order" ); + + if ( m_cachedSingularId == -1 ) + m_cachedSingularId = Shader.PropertyToID( "_Singular" ); + + PreviewMaterial.SetVector( m_cachedOrderId, order ); + PreviewMaterial.SetFloat( m_cachedSingularId, singularId ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdatePorts(); + UpdateTitle(); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + UpdatePorts(); + UpdateTitle(); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + UpdateTitle(); + } + + void UpdatePorts() + { + m_inputPorts[ 0 ].MatchPortToConnection(); + int count = 0; + switch ( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.FLOAT4: + case WirePortDataType.OBJECT: + case WirePortDataType.COLOR: + { + count = 4; + } + break; + case WirePortDataType.FLOAT3: + { + count = 3; + } + break; + case WirePortDataType.FLOAT2: + { + count = 2; + } + break; + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { } + break; + } + + int activeCount = 0; + if ( count > 0 ) + { + for ( int i = 0; i < count; i++ ) + { + if ( m_selection[ i ] ) + activeCount += 1; + } + } + + m_outputPortCount = activeCount; + switch ( activeCount ) + { + case 0: ChangeOutputType( m_inputPorts[ 0 ].DataType, false ); break; + case 1: ChangeOutputType( WirePortDataType.FLOAT, false ); break; + case 2: ChangeOutputType( WirePortDataType.FLOAT2, false ); break; + case 3: ChangeOutputType( WirePortDataType.FLOAT3, false ); break; + case 4: ChangeOutputType( m_inputPorts[ 0 ].DataType, false ); break; + } + + } + + private void UpdateTitle() + { + int count = 0; + string additionalText = string.Empty; + switch ( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.FLOAT4: + case WirePortDataType.OBJECT: + case WirePortDataType.COLOR: + { + count = 4; + } + break; + case WirePortDataType.FLOAT3: + { + count = 3; + } + break; + case WirePortDataType.FLOAT2: + { + count = 2; + } + break; + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + { + count = 0; + } + break; + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { } + break; + } + + if ( count > 0 ) + { + for ( int i = 0; i < count; i++ ) + { + if ( m_selection[ i ] ) + { + additionalText += UIUtils.GetComponentForPosition( i, m_inputPorts[ 0 ].DataType ).ToUpper(); + } + } + } + + if ( additionalText.Length > 0 ) + SetAdditonalTitleText( "Value( " + additionalText + " )" ); + else + SetAdditonalTitleText( string.Empty ); + } + + public override void DrawProperties() + { + base.DrawProperties(); + + EditorGUILayout.BeginVertical(); + + int count = 0; + switch ( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.FLOAT4: + case WirePortDataType.OBJECT: + case WirePortDataType.COLOR: + { + count = 4; + } + break; + case WirePortDataType.FLOAT3: + { + count = 3; + } + break; + case WirePortDataType.FLOAT2: + { + count = 2; + } + break; + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { } + break; + } + + int activeCount = 0; + if ( count > 0 ) + { + for ( int i = 0; i < count; i++ ) + { + m_selection[ i ] = EditorGUILayoutToggleLeft( m_labels[i], m_selection[ i ] ); + m_labels[ i ] = UIUtils.GetComponentForPosition( i, m_inputPorts[ 0 ].DataType ).ToUpper(); + if ( m_selection[ i ] ) + { + activeCount += 1; + } + } + } + + if ( activeCount != m_outputPortCount ) + { + m_outputPortCount = activeCount; + switch ( activeCount ) + { + case 0: ChangeOutputType( m_inputPorts[ 0 ].DataType, false ); break; + case 1: ChangeOutputType( WirePortDataType.FLOAT, false ); break; + case 2: ChangeOutputType( WirePortDataType.FLOAT2, false ); break; + case 3: ChangeOutputType( WirePortDataType.FLOAT3, false ); break; + case 4: ChangeOutputType( m_inputPorts[ 0 ].DataType, false ); break; + } + UpdateTitle(); + SetSaveIsDirty(); + } + + EditorGUILayout.EndVertical(); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + int count = 0; + switch ( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.FLOAT4: + case WirePortDataType.OBJECT: + case WirePortDataType.COLOR: + { + count = 4; + } + break; + case WirePortDataType.FLOAT3: + { + count = 3; + } + break; + case WirePortDataType.FLOAT2: + { + count = 2; + } + break; + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + { + count = 0; + } + break; + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { } + break; + } + + if ( count > 0 ) + { + bool firstElement = true; + value = string.Format("({0})",value); + for ( int i = 0; i < count; i++ ) + { + if ( m_selection[ i ] ) + { + if( firstElement ) + { + firstElement = false; + value += "."; + } + value += UIUtils.GetComponentForPosition( i, m_inputPorts[ 0 ].DataType ); + } + } + } + + return CreateOutputLocalVariable( 0, value, ref dataCollector ); + } + + public string GetComponentForPosition( int i ) + { + switch ( i ) + { + case 0: + { + return ( ( m_outputPorts[ 0 ].DataType == WirePortDataType.COLOR ) ? "r" : "x" ); + } + case 1: + { + return ( ( m_outputPorts[ 0 ].DataType == WirePortDataType.COLOR ) ? "g" : "y" ); + } + case 2: + { + return ( ( m_outputPorts[ 0 ].DataType == WirePortDataType.COLOR ) ? "b" : "z" ); + } + case 3: + { + return ( ( m_outputPorts[ 0 ].DataType == WirePortDataType.COLOR ) ? "a" : "w" ); + } + } + return string.Empty; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + for ( int i = 0; i < 4; i++ ) + { + m_selection[ i ] = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + UpdateTitle(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + for ( int i = 0; i < 4; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_selection[ i ] ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs.meta new file mode 100644 index 00000000..5d64c862 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 85082b6932d1c9a4f8b64605534ef118 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs new file mode 100644 index 00000000..4d558742 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Cos", "Trigonometry Operators", "Cosine of scalars and vectors" ,tags: "cosine")] + public sealed class CosOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "cos"; + m_previewShaderGUID = "3dde9e80389196f459eb94137268de4a"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR , + WirePortDataType.INT); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs.meta new file mode 100644 index 00000000..e86d656f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ee9c446e7e41d524f8b4c93e6a8886c5 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs new file mode 100644 index 00000000..54484a17 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Cosh", "Trigonometry Operators", "Hyperbolic cosine of scalars and vectors",tags: "hyperbolic cosine" )] + public sealed class CoshOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "cosh"; + m_previewShaderGUID = "154a4c85fe88657489a54a02416402c0"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs.meta new file mode 100644 index 00000000..2feeae51 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2b50a187f488a004aaa2dabbe558ab3a +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs new file mode 100644 index 00000000..354db0d2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs @@ -0,0 +1,35 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Cross", "Vector Operators", "Cross product of two three-component vectors ( A x B )", null, KeyCode.X )] + public sealed class CrossProductOpNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "Lhs" ); + AddInputPort( WirePortDataType.FLOAT3, false, "Rhs" ); + AddOutputPort( WirePortDataType.FLOAT3, "Out" ); + m_useInternalPortData = true; + m_previewShaderGUID = "65a9be5cc7037654db8e148d669f03ee"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + string lhsStr = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string rhsStr = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + string result = "cross( " + lhsStr + " , " + rhsStr + " )"; + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs.meta new file mode 100644 index 00000000..14ecf91a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 283bc0645ce925346b33c024ff5a7dad +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs new file mode 100644 index 00000000..53b8821d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs @@ -0,0 +1,32 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "DDX", "Math Operators", "Approximate partial derivative with respect to window-space X" )] + public sealed class DdxOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "ddx"; + m_previewShaderGUID = "b54ea73d5568b3540977557813eb9c3c"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.IsFragmentCategory ) + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + else + return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs.meta new file mode 100644 index 00000000..bec5090d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2e14c4a7c0be9f146ac912130c280b15 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs new file mode 100644 index 00000000..604a341b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs @@ -0,0 +1,32 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "DDY", "Math Operators", "Approximate partial derivative with respect to window-space Y" )] + public sealed class DdyOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "ddy"; + m_previewShaderGUID = "197dcc7f05339da47b6b0e681c475c5e"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.IsFragmentCategory ) + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + else + return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs.meta new file mode 100644 index 00000000..4fdf1e01 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 722a2ad531fefdc4d8782d5c7cdfd012 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs new file mode 100644 index 00000000..4c2644e3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Degrees", "Trigonometry Operators", "Converts values of scalars and vectors from radians to degrees",tags: "radians" )] + public sealed class DegreesOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "degrees"; + m_previewShaderGUID = "2a8eebb5566830c4a9d7c4b9021bb743"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR , + WirePortDataType.INT); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs.meta new file mode 100644 index 00000000..8dc8b288 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3d88a21f3ece742408c7748897a21c79 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs new file mode 100644 index 00000000..d48f775d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs @@ -0,0 +1,25 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Determinant", "Matrix Operators", "Scalar determinant of a square matrix" )] + public sealed class DeterminantOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "determinant"; + m_drawPreview = false; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.FLOAT3x3, + WirePortDataType.FLOAT4x4 ); + + m_autoUpdateOutputPort = false; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4x4, false ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs.meta new file mode 100644 index 00000000..b8688d14 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e5cded78687f09442895bc96cc5b683d +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs new file mode 100644 index 00000000..8e3a6dbc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs @@ -0,0 +1,32 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Distance", "Vector Operators", "Euclidean distance between two points" )] + public sealed class DistanceOpNode : DynamicTypeNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_inputPorts[ 1 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); + m_dynamicOutputType = false; + m_useInternalPortData = true; + m_previewShaderGUID = "3be9a95031c0cb740ae982e465dfc242"; + } + + public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); + string result = "distance( " + m_inputA + " , " + m_inputB + " )"; + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs.meta new file mode 100644 index 00000000..e87dc76b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4b8bd7fecbc728f4b89d398cef86ada8 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs new file mode 100644 index 00000000..d208430c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs @@ -0,0 +1,61 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Dot", "Vector Operators", "Scalar dot product of two vectors ( A . B )", null, KeyCode.Period )] + public sealed class DotProductOpNode : DynamicTypeNode + { + static readonly int _Type_PID = Shader.PropertyToID( "_Type" ); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_inputPorts[ 1 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_dynamicOutputType = false; + m_useInternalPortData = true; + m_allowMatrixCheck = true; + m_previewShaderGUID = "85f11fd5cb9bb954c8615a45c57a3784"; + } + + public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); + string result = "dot( " + m_inputA + " , " + m_inputB + " )"; + RegisterLocalVariable( 0, result, ref dataCollector, "dotResult" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + private int GetInputPortType( int inputPort ) + { + int type; + switch ( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + type = 1; break; + case WirePortDataType.FLOAT2: + type = 2; break; + case WirePortDataType.FLOAT3: + type = 3; break; + case WirePortDataType.FLOAT4: + default: + type = 4; break; + } + return type; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + PreviewMaterial.SetInt( _Type_PID, Mathf.Max( GetInputPortType( 0 ), GetInputPortType( 1 ) ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs.meta new file mode 100644 index 00000000..d8eed9fc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c2bf0375fb75ce245b2f30857a111972 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs new file mode 100644 index 00000000..b94d5610 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Exp2", "Math Operators", "Base-2 exponential of scalars and vectors" )] + public sealed class Exp2OpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "exp2"; + m_previewShaderGUID = "ceb70ed5423a36647a504a41de7dbfe6"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs.meta new file mode 100644 index 00000000..b93e14a9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a9881734e0217bc45bb422dc83f6ee1a +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs new file mode 100644 index 00000000..29bded7b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Exp", "Math Operators", "Base-e exponential of scalars and vectors" )] + public sealed class ExpOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "exp"; + m_previewShaderGUID = "6416ff506137d97479a7ebde790b45e5"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR , + WirePortDataType.INT); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs.meta new file mode 100644 index 00000000..66a3cd29 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 81ef96bc69f897d4e8bc21e2731e065f +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs new file mode 100644 index 00000000..75ee9f48 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs @@ -0,0 +1,38 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "FWidth", "Math Operators", "Sum of approximate window-space partial derivatives magnitudes (Only valid on Fragment type ports)" )] + public sealed class FWidthOpNode : SingleInputOp + { + private const string FWidthErrorMsg = "Attempting to connect an FWidth to a {0} type port. It is only valid on Fragment type ports"; + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "fwidth"; + m_previewShaderGUID = "81ea481faaef9c8459a555479ba64df7"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR , + WirePortDataType.INT); + //m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || + dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowMessage( UniqueId, string.Format( FWidthErrorMsg, dataCollector.PortCategory ), MessageSeverity.Error ); + return GenerateErrorValue(); + } + + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs.meta new file mode 100644 index 00000000..1991dc95 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2e17448829221b04bb3185bef727b19f +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs new file mode 100644 index 00000000..5fe190e6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs @@ -0,0 +1,24 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Floor", "Math Operators", "Largest integer not greater than a scalar or each vector component" )] + public sealed class FloorOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "floor"; + m_previewShaderGUID = "46ae4a72a9a38de40a2d8f20cfccc67d"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR , + WirePortDataType.INT); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs.meta new file mode 100644 index 00000000..a148efd6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 176154e86c6c3544fab0d67e098c645d +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs new file mode 100644 index 00000000..698e3701 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs @@ -0,0 +1,36 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Fmod", "Math Operators", "Floating point remainder of x/y with the same sign as x" )] + public sealed class FmodOpNode : DynamicTypeNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_previewShaderGUID = "65083930f9d7812479fd6ff203ad2992"; + } + + public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); + if( m_inputPorts[ 0 ].DataType == WirePortDataType.INT ) + m_inputA = "(float)" + m_inputA; + + + if( m_inputPorts[ 1 ].DataType == WirePortDataType.INT ) + m_inputB = "(float)" + m_inputB; + + + string result = "fmod( " + m_inputA + " , " + m_inputB + " )"; + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs.meta new file mode 100644 index 00000000..baba8bd0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 599ae67e52ac45f46acc0efd9285b97c +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs new file mode 100644 index 00000000..62c54dcb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Fract", "Math Operators", "Fractional portion of a scalar or each vector component" )] + public sealed class FractNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "frac"; + m_previewShaderGUID = "53a335f8f18d4694b8d94e8aee21fdca"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs.meta new file mode 100644 index 00000000..9959bff3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: fd6da00dbcdf3d04cb35a61cda01ae77 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs new file mode 100644 index 00000000..c49342a5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs @@ -0,0 +1,231 @@ +using System; +using UnityEngine; +using UnityEditor; +using System.Collections; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Gradient Sample", "Miscellaneous", "Samples a gradient" )] + public sealed class GradientSampleNode : ParentNode + { + private string m_functionHeader = "SampleGradient( {0}, {1} )"; + private string m_functionBody = string.Empty; + + private GradientNode m_gradientNode = null; + private InputPort m_gradPort; + + private Gradient m_blankGrandient = new Gradient(); + + private int m_cachedTimeId = -1; + private int m_cachedTypeId = -1; + private int m_cachedColorNumId = -1; + private int m_cachedAlphaNumId = -1; + + private Vector4 m_auxVec4 = Vector4.zero; + + private string m_functionHeaderStruct = "Gradient( {0} )"; + private string m_functionBodyStruct = string.Empty; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.OBJECT, true, Constants.EmptyPortValue ); + AddInputPort( WirePortDataType.FLOAT, false, "Time" ); + AddOutputColorPorts( "RGBA", true ); + m_gradPort = m_inputPorts[ 0 ]; + m_useInternalPortData = true; + m_autoDrawInternalPortData = true; + m_drawPreviewExpander = false; + m_drawPreview = true; + m_showPreview = true; + m_selectedLocation = PreviewLocation.TopCenter; + m_previewShaderGUID = "8a09124cd6e4aa54a996e7487ec16b90"; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_cachedTypeId == -1 ) + m_cachedTypeId = Shader.PropertyToID( "_GType" ); + + if( m_cachedTimeId == -1 ) + m_cachedTimeId = Shader.PropertyToID( "_GTime" ); + + if( m_cachedColorNumId == -1 ) + m_cachedColorNumId = Shader.PropertyToID( "_GColorNum" ); + + if( m_cachedAlphaNumId == -1 ) + m_cachedAlphaNumId = Shader.PropertyToID( "_GAlphaNum" ); + + PreviewMaterial.SetTexture( m_cachedTimeId, m_inputPorts[ 1 ].InputPreviewTexture( ContainerGraph ) ); + + Gradient curGrad = m_blankGrandient; + if( m_gradientNode != null ) + curGrad = m_gradientNode.Gradient; + + PreviewMaterial.SetInt( m_cachedTypeId, (int)curGrad.mode ); + PreviewMaterial.SetInt( m_cachedColorNumId, curGrad.colorKeys.Length ); + PreviewMaterial.SetInt( m_cachedAlphaNumId, curGrad.alphaKeys.Length ); + + for( int i = 0; i < 8; i++ ) + { + if( i < curGrad.colorKeys.Length ) + { + m_auxVec4.x = curGrad.colorKeys[ i ].color.r; + m_auxVec4.y = curGrad.colorKeys[ i ].color.g; + m_auxVec4.z = curGrad.colorKeys[ i ].color.b; + m_auxVec4.w = curGrad.colorKeys[ i ].time; + PreviewMaterial.SetVector( "_Col" + i, m_auxVec4 ); + } + else + { + PreviewMaterial.SetVector( "_Col" + i, Vector4.zero ); + } + } + + for( int i = 0; i < 8; i++ ) + { + if( i < curGrad.alphaKeys.Length ) + { + m_auxVec4.x = curGrad.alphaKeys[ i ].alpha; + m_auxVec4.y = curGrad.alphaKeys[ i ].time; + PreviewMaterial.SetVector( "_Alp" + i, m_auxVec4 ); + } + else + { + PreviewMaterial.SetVector( "_Alp" + i, Vector4.zero ); + } + } + } + + public override void OnInputPortConnected( int portId , int otherNodeId , int otherPortId , bool activateNode = true ) + { + if( portId == 0 ) + m_gradientNode = RecursiveBackCheck( m_gradPort.GetOutputNode( 0 ) ); + + base.OnInputPortConnected( portId , otherNodeId , otherPortId , activateNode ); + } + + public override void OnInputPortDisconnected( int portId ) + { + if( portId == 0 ) + { + m_gradientNode = null; + } + + base.OnInputPortDisconnected( portId ); + } + + + //public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + //{ + // base.OnNodeLogicUpdate( drawInfo ); + + // if( m_gradPort.IsConnected ) + // { + // if( m_gradientNode == null ) + // { + // m_gradientNode = RecursiveBackCheck( m_gradPort.GetOutputNode( 0 ) ); + // PreviewIsDirty = true; + // } + // } + // else + // { + // m_gradientNode = null; + // } + //} + + GradientNode RecursiveBackCheck( ParentNode node ) + { + if( node is GradientNode ) + { + return node as GradientNode; + } + else + { + if( node is RelayNode || node is WireNode || node is RegisterLocalVarNode ) + { + return RecursiveBackCheck( node.InputPorts[ 0 ].GetOutputNode( 0 ) ); + } + else if( node is GetLocalVarNode) + { + var gnode = node as GetLocalVarNode; + if( gnode.CurrentSelected != null ) + return RecursiveBackCheck( gnode.CurrentSelected ); + else + return null; + } + else + { + return null; + } + } + + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + m_functionBodyStruct = string.Empty; + if( !dataCollector.IsSRP ) + { + GradientNode.GenerateGradientStruct( ref m_functionBodyStruct ); + dataCollector.AddFunctions( m_functionHeaderStruct, m_functionBodyStruct, "0" ); + } + else + { + dataCollector.AddToIncludes( UniqueId, "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" ); + } + + GenerateGradientSampler( dataCollector.IsSRP ); + + string gradient = "(Gradient)0"; + if( m_inputPorts[ 0 ].IsConnected && m_gradientNode != null ) + gradient = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + string time = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + string functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, gradient, time ); + return GetOutputVectorItem( 0, outputId, functionResult ); + } + + void GenerateGradientSampler( bool isSrp ) + { + m_functionBody = string.Empty; + IOUtils.AddFunctionHeader( ref m_functionBody, "float4 SampleGradient( Gradient gradient, float time )" ); + IOUtils.AddFunctionLine( ref m_functionBody, "float3 color = gradient.colors[0].rgb;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "UNITY_UNROLL" ); + IOUtils.AddFunctionLine( ref m_functionBody, "for (int c = 1; c < 8; c++)" ); + IOUtils.AddFunctionLine( ref m_functionBody, "{" ); + if( isSrp ) + IOUtils.AddFunctionLine( ref m_functionBody, "float colorPos = saturate((time - gradient.colors[c-1].w) / ( 0.00001 + (gradient.colors[c].w - gradient.colors[c-1].w)) * step(c, gradient.colorsLength-1));" ); + else + IOUtils.AddFunctionLine( ref m_functionBody, "float colorPos = saturate((time - gradient.colors[c-1].w) / ( 0.00001 + (gradient.colors[c].w - gradient.colors[c-1].w)) * step(c, (float)gradient.colorsLength-1));" ); + IOUtils.AddFunctionLine( ref m_functionBody, "color = lerp(color, gradient.colors[c].rgb, lerp(colorPos, step(0.01, colorPos), gradient.type));" ); + IOUtils.AddFunctionLine( ref m_functionBody, "}" ); + + IOUtils.AddFunctionLine( ref m_functionBody, "#ifndef UNITY_COLORSPACE_GAMMA" ); + if( isSrp ) + IOUtils.AddFunctionLine( ref m_functionBody, "color = SRGBToLinear(color);" ); + else + IOUtils.AddFunctionLine( ref m_functionBody, "color = half3(GammaToLinearSpaceExact(color.r), GammaToLinearSpaceExact(color.g), GammaToLinearSpaceExact(color.b));" ); + IOUtils.AddFunctionLine( ref m_functionBody, "#endif" ); + + IOUtils.AddFunctionLine( ref m_functionBody, "float alpha = gradient.alphas[0].x;" ); + IOUtils.AddFunctionLine( ref m_functionBody, "UNITY_UNROLL" ); + IOUtils.AddFunctionLine( ref m_functionBody, "for (int a = 1; a < 8; a++)" ); + IOUtils.AddFunctionLine( ref m_functionBody, "{" ); + if( isSrp ) + IOUtils.AddFunctionLine( ref m_functionBody, "float alphaPos = saturate((time - gradient.alphas[a-1].y) / ( 0.00001 + (gradient.alphas[a].y - gradient.alphas[a-1].y)) * step(a, gradient.alphasLength-1));" ); + else + IOUtils.AddFunctionLine( ref m_functionBody, "float alphaPos = saturate((time - gradient.alphas[a-1].y) / ( 0.00001 + (gradient.alphas[a].y - gradient.alphas[a-1].y)) * step(a, (float)gradient.alphasLength-1));" ); + IOUtils.AddFunctionLine( ref m_functionBody, "alpha = lerp(alpha, gradient.alphas[a].x, lerp(alphaPos, step(0.01, alphaPos), gradient.type));" ); + IOUtils.AddFunctionLine( ref m_functionBody, "}" ); + IOUtils.AddFunctionLine( ref m_functionBody, "return float4(color, alpha);" ); + IOUtils.CloseFunctionBody( ref m_functionBody ); + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs.meta new file mode 100644 index 00000000..437f296a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b90e416e2fa93a249952fabc78f659c8 +timeCreated: 1562847602 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs new file mode 100644 index 00000000..178fc545 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs @@ -0,0 +1,138 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// 4x4 Invert by DBN in +// http://answers.unity3d.com/questions/218333/shader-inversefloat4x4-function.html?childToView=641391#answer-641391 + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Inverse", "Matrix Operators", "Inverse matrix of a matrix" )] + public sealed class InverseOpNode : SingleInputOp + { + private string Inverse4x4Header = "Inverse4x4( {0} )"; + + //4x4 + private string[] Inverse4x4Function = + { + "{0}4x4 Inverse4x4({0}4x4 input)\n", + "{\n", + "\t#define minor(a,b,c) determinant({0}3x3(input.a, input.b, input.c))\n", + "\t{0}4x4 cofactors = {0}4x4(\n", + "\tminor( _22_23_24, _32_33_34, _42_43_44 ),\n", + "\t-minor( _21_23_24, _31_33_34, _41_43_44 ),\n", + "\tminor( _21_22_24, _31_32_34, _41_42_44 ),\n", + "\t-minor( _21_22_23, _31_32_33, _41_42_43 ),\n", + "\n", + "\t-minor( _12_13_14, _32_33_34, _42_43_44 ),\n", + "\tminor( _11_13_14, _31_33_34, _41_43_44 ),\n", + "\t-minor( _11_12_14, _31_32_34, _41_42_44 ),\n", + "\tminor( _11_12_13, _31_32_33, _41_42_43 ),\n", + "\n", + "\tminor( _12_13_14, _22_23_24, _42_43_44 ),\n", + "\t-minor( _11_13_14, _21_23_24, _41_43_44 ),\n", + "\tminor( _11_12_14, _21_22_24, _41_42_44 ),\n", + "\t-minor( _11_12_13, _21_22_23, _41_42_43 ),\n", + "\n", + "\t-minor( _12_13_14, _22_23_24, _32_33_34 ),\n", + "\tminor( _11_13_14, _21_23_24, _31_33_34 ),\n", + "\t-minor( _11_12_14, _21_22_24, _31_32_34 ),\n", + "\tminor( _11_12_13, _21_22_23, _31_32_33 ));\n", + "\t#undef minor\n", + "\treturn transpose( cofactors ) / determinant( input );\n", + "}\n" + }; + + private bool[] Inverse4x4FunctionFlags = + { + true, + false, + true, + true, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "inverse"; + m_drawPreview = false; + + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.FLOAT3x3, + WirePortDataType.FLOAT4x4 ); + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4x4, false ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4x4, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT ); + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + if ( m_outputPorts[ 0 ].DataType == WirePortDataType.FLOAT3x3 ) + { + GeneratorUtils.Add3x3InverseFunction( ref dataCollector, precisionString ); + RegisterLocalVariable( 0, string.Format( GeneratorUtils.Inverse3x3Header, value ), ref dataCollector, "invertVal" + OutputId ); + } + else + { + if ( !dataCollector.HasFunction( Inverse4x4Header ) ) + { + //Hack to be used util indent is properly used + int currIndent = UIUtils.ShaderIndentLevel; + + if ( dataCollector.IsTemplate ) + { + UIUtils.ShaderIndentLevel = 0; + } + else + { + UIUtils.ShaderIndentLevel = 1; + UIUtils.ShaderIndentLevel++; + } + + string finalFunction = string.Empty; + for ( int i = 0; i < Inverse4x4Function.Length; i++ ) + { + finalFunction += UIUtils.ShaderIndentTabs + ( Inverse4x4FunctionFlags[ i ] ? string.Format( Inverse4x4Function[ i ], precisionString ) : Inverse4x4Function[ i ] ); + } + + + UIUtils.ShaderIndentLevel = currIndent; + + dataCollector.AddFunction( Inverse4x4Header, finalFunction ); + } + + RegisterLocalVariable( 0, string.Format( Inverse4x4Header, value ), ref dataCollector, "invertVal" + OutputId ); + } + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs.meta new file mode 100644 index 00000000..7aa7ca17 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 785830160e033d24280df9c5b4cec368 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs new file mode 100644 index 00000000..c67f26b4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs @@ -0,0 +1,41 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Length", "Vector Operators", "Scalar Euclidean length of a vector" )] + public sealed class LengthOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "length"; + m_previewShaderGUID = "1c1f6d6512b758942a8b9dd1bea12f34"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR , + WirePortDataType.INT); + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_autoUpdateOutputPort = false; + } + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + switch( m_inputPorts[0].DataType ) + { + case WirePortDataType.OBJECT: + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + case WirePortDataType.UINT:m_previewMaterialPassId = 0;break; + case WirePortDataType.FLOAT2:m_previewMaterialPassId = 1;break; + case WirePortDataType.FLOAT3:m_previewMaterialPassId = 2;break; + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR:m_previewMaterialPassId = 3;break; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs.meta new file mode 100644 index 00000000..f5edf42d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: bb3fd570e41cfa24d93b53e80eac02d5 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs new file mode 100644 index 00000000..1ec7199d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs @@ -0,0 +1,116 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Lerp", "Math Operators", "Linear interpolation of two scalars or vectors based on a weight", null, KeyCode.L )] + public sealed class LerpOp : ParentNode + { + private const string LertOpFormat = "lerp( {0} , {1} , {2})"; + + [UnityEngine.SerializeField] + private WirePortDataType m_mainDataType = WirePortDataType.FLOAT; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_textLabelWidth = 55; + AddInputPort( WirePortDataType.FLOAT, false, "A" ); + AddInputPort( WirePortDataType.FLOAT, false, "B" ); + AddInputPort( WirePortDataType.FLOAT, false, "Alpha" ); + AddOutputPort( WirePortDataType.FLOAT,Constants.EmptyPortValue); + m_useInternalPortData = true; + m_previewShaderGUID = "34d9c4cdcf1fadb49af2de3f90bbc57d"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnection( portId ); + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); + UpdateConnection( inputPortId ); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + UpdateConnection( portId ); + } + + void UpdateConnection( int portId ) + { + WirePortDataType type1 = WirePortDataType.FLOAT; + if( m_inputPorts[ 0 ].IsConnected ) + type1 = m_inputPorts[ 0 ].GetOutputConnection( 0 ).DataType; + + WirePortDataType type2 = WirePortDataType.FLOAT; + if( m_inputPorts[ 1 ].IsConnected ) + type2 = m_inputPorts[ 1 ].GetOutputConnection( 0 ).DataType; + + WirePortDataType typealpha = WirePortDataType.FLOAT; + if( m_inputPorts[ 2 ].IsConnected ) + typealpha = m_inputPorts[ 2 ].GetOutputConnection( 0 ).DataType; + + m_mainDataType = UIUtils.GetPriority( type1 ) > UIUtils.GetPriority( type2 ) ? type1 : type2; + + if( !m_inputPorts[ 0 ].IsConnected && !m_inputPorts[ 1 ].IsConnected && m_inputPorts[ 2 ].IsConnected ) + m_mainDataType = m_inputPorts[ 2 ].GetOutputConnection( 0 ).DataType; + + m_inputPorts[ 0 ].ChangeType( m_mainDataType, false ); + + m_inputPorts[ 1 ].ChangeType( m_mainDataType, false ); + if( m_inputPorts[ 2 ].IsConnected && ( typealpha == WirePortDataType.FLOAT || typealpha == WirePortDataType.INT ) ) + m_inputPorts[ 2 ].ChangeType( WirePortDataType.FLOAT, false ); + else + m_inputPorts[ 2 ].ChangeType( m_mainDataType, false ); + + m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); + } + + //void UpdateDisconnection( int portId ) + //{ + // int otherPortId = ( portId + 1 ) % 2; + // if ( m_inputPorts[ otherPortId ].IsConnected ) + // { + // m_mainDataType = m_inputPorts[ otherPortId ].DataType; + // m_inputPorts[ portId ].ChangeType( m_mainDataType, false ); + // m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); + // } + //} + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string aValue = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, m_mainDataType, ignoreLocalVar, true ); + string bValue = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, m_mainDataType, ignoreLocalVar, true ); + string interp = string.Empty; + if( m_inputPorts[ 2 ].DataType == WirePortDataType.FLOAT ) + interp = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + else + interp = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, m_mainDataType, ignoreLocalVar,true ); + string result = string.Format( LertOpFormat, aValue,bValue,interp); + + RegisterLocalVariable( 0, result, ref dataCollector, "lerpResult"+OutputId ); + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + //public override void RefreshExternalReferences() + //{ + // if ( m_inputPorts[ 2 ].DataType != WirePortDataType.FLOAT ) + // { + // m_inputPorts[ 2 ].ChangeType( WirePortDataType.FLOAT, false ); + // } + //} + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs.meta new file mode 100644 index 00000000..908aeb6a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1e38abf6e3c7dfa409a5fe40d2ce8a19 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs new file mode 100644 index 00000000..35914c34 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Log10", "Math Operators", "Base-10 logarithm of scalars and vectors" )] + public sealed class Log10OpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "log10"; + m_previewShaderGUID = "9e7cfa357dd261f499d0ba8637ff2614"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR , + WirePortDataType.INT); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs.meta new file mode 100644 index 00000000..1c6cb6b2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: be47a76f1f42fbe47bf2568584c31196 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs new file mode 100644 index 00000000..614a82a2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Log2", "Math Operators", "Base-2 logarithm of scalars and vectors" )] + public sealed class Log2OpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "log2"; + m_previewShaderGUID = "5975a154432d4c64cacd78d015ed08ba"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR , + WirePortDataType.INT); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs.meta new file mode 100644 index 00000000..8e55a8d2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b9489308aad1f794982afc1faf646013 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs new file mode 100644 index 00000000..ff7d7863 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Log", "Math Operators", "Natural logarithm of scalars and vectors" )] + public sealed class LogOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "log"; + m_previewShaderGUID = "a3293e0a73834b24682775f5d8ee1e7c"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs.meta new file mode 100644 index 00000000..fb1b23b4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1ed2c12cea61a8c4fa67eebdc10d2a2a +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs new file mode 100644 index 00000000..9cb64e97 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs @@ -0,0 +1,3 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// Deprecated file diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs.meta new file mode 100644 index 00000000..0bc8ccd3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 8804c7e5888738547b5a704f788fc18b +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs new file mode 100644 index 00000000..00c174dc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs @@ -0,0 +1,46 @@ +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Negate", "Math Operators", "Negate or invert an input value" )] + public sealed class NegateNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_previewShaderGUID = "b035bc40da1ac7c4eafad4116382ec79"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + string result = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + if ( result.StartsWith( "-" ) ) + { + return result.Remove( 0, 1 ); + } + else + { + return "-" + result; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs.meta new file mode 100644 index 00000000..52301f02 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 01c91005470f6b94eba168a127cecd6c +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs new file mode 100644 index 00000000..fff830dc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs @@ -0,0 +1,104 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Normalize", "Vector Operators", "Normalizes a vector", null, KeyCode.N )] + public sealed class NormalizeNode : SingleInputOp + { + [SerializeField] + private bool m_safeNormalize = false; + + private const string SubtitleFormat = "({0})"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_selectedLocation = PreviewLocation.TopCenter; + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.FLOAT, WirePortDataType.FLOAT2, WirePortDataType.FLOAT3, WirePortDataType.FLOAT4, WirePortDataType.COLOR, WirePortDataType.OBJECT, WirePortDataType.INT ); + + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + + m_previewShaderGUID = "a51b11dfb6b32884e930595e5f9defa8"; + m_autoWrapProperties = true; + + m_textLabelWidth = 100; + + UpdateSubtitle(); + } + + private void UpdateSubtitle() + { + SetAdditonalTitleText( m_safeNormalize ? string.Format( SubtitleFormat, "Safe" ) : "" ); + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_safeNormalize = EditorGUILayoutToggle( "Safe Normalize", m_safeNormalize ); + if ( EditorGUI.EndChangeCheck() ) + { + UpdateSubtitle(); + } + EditorGUILayout.HelpBox( Constants.SafeNormalizeInfoStr, MessageType.Info ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string result = string.Empty; + switch ( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.FLOAT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.OBJECT: + case WirePortDataType.COLOR: + { + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + result = GeneratorUtils.NormalizeValue( ref dataCollector, m_safeNormalize, m_inputPorts[ 0 ].DataType, value ); + } + break; + case WirePortDataType.INT: + { + return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + } + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + result = UIUtils.InvalidParameter( this ); + } + break; + } + RegisterLocalVariable( 0, result, ref dataCollector, "normalizeResult" + OutputId ); + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if ( UIUtils.CurrentShaderVersion() > 18814 ) + { + m_safeNormalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + UpdateSubtitle(); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_safeNormalize ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs.meta new file mode 100644 index 00000000..e58e6a6a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: fa6682c371754094f88b3c2a7e96ae26 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs new file mode 100644 index 00000000..10792114 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs @@ -0,0 +1,45 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "One Minus", "Math Operators", "1 - input value", null, KeyCode.O )] + public sealed class OneMinusNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_previewShaderGUID = "bed5300b92e7bb0419d0f4accb853312"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string result = "( 1.0 - " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + " )"; + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs.meta new file mode 100644 index 00000000..200a7eae --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 727743b66e17d7b4f9c2fbe7dde98bd9 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs new file mode 100644 index 00000000..cab8e65e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs @@ -0,0 +1,93 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Power", "Math Operators", "Base to the Exp-th power of scalars and vectors", null, KeyCode.E )] + public sealed class PowerNode : ParentNode + { + public const string SafePowerStr = "abs( {0} )";//"max( {0} , 0.0001 )"; + public const string SafePowerLabel = "Safe Power"; + + [SerializeField] + private bool m_safePower = false; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "Base" ); + AddInputPort( WirePortDataType.FLOAT, false, "Exp" ); + m_inputPorts[ 1 ].FloatInternalData = 1; + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_autoWrapProperties = true; + m_textLabelWidth = 85; + m_previewShaderGUID = "758cc2f8b537b4e4b93d9833075d138c"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnections( portId ); + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); + UpdateConnections( inputPortId ); + } + + void UpdateConnections( int inputPort ) + { + m_inputPorts[ inputPort ].MatchPortToConnection(); + if ( inputPort == 0 ) + { + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + m_safePower = EditorGUILayoutToggle( SafePowerLabel, m_safePower ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string x = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + if( m_safePower ) + { + string safePowerName = "saferPower" + OutputId; + string safePowerValue = string.Format( SafePowerStr, x ); + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].DataType, safePowerName, safePowerValue ); + x = safePowerName; + } + + string y = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar, true ); + string result = "pow( " + x + " , " + y + " )"; + + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 17502 ) + m_safePower = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_safePower ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs.meta new file mode 100644 index 00000000..241e8231 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 520a55839e863ce47b3558be612f4691 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs new file mode 100644 index 00000000..42c0964b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Rsqrt", "Math Operators", "Reciprocal square root of scalars and vectors", tags: "reciprocal square root" )] + public sealed class RSqrtOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "rsqrt"; + m_previewShaderGUID = "c58c17cb1f7f6e6429a2c7a6cdaef87d"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR , + WirePortDataType.INT); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs.meta new file mode 100644 index 00000000..4111523c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 513de50bd4766d0448bb471ca272608f +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs new file mode 100644 index 00000000..86312010 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Radians", "Trigonometry Operators", "Converts values of scalars and vectors from degrees to radians",tags: "degrees" )] + public sealed class RadiansOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "radians"; + m_previewShaderGUID = "d27d189eaf6eeb04fae9913d9617ece5"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs.meta new file mode 100644 index 00000000..244382bc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b6ca01d5c16f73c42996318c140eddb7 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReciprocalOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReciprocalOpNode.cs new file mode 100644 index 00000000..55c9d9bd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReciprocalOpNode.cs @@ -0,0 +1,59 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Reciprocal", "Math Operators", "Reciprocal of scalars and vectors", tags: "rcp recip reciprocal" )] + public sealed class ReciprocalOpNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_previewShaderGUID = "51c79938d491c8244a633fe407c49327"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + var inputValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + var localVarType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); + var localVarName = "recip" + OutputId; + + dataCollector.AddLocalVariable( UniqueId, "#if ( SHADER_TARGET >= 50 )", true ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "{0} {1} = rcp( {2} );", localVarType, localVarName, inputValue ) ); + dataCollector.AddLocalVariable( UniqueId, "#else", true ); + dataCollector.AddLocalVariable( UniqueId, string.Format( "{0} {1} = 1.0 / {2};", localVarType, localVarName, inputValue ) ); + dataCollector.AddLocalVariable( UniqueId, "#endif", true ); + + m_outputPorts[ 0 ].SetLocalValue( localVarName, dataCollector.PortCategory ); + return localVarName; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReciprocalOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReciprocalOpNode.cs.meta new file mode 100644 index 00000000..160ea723 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReciprocalOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2044eccbb1e8a0d4a9be200e343c2f5c +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReciprocalOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs new file mode 100644 index 00000000..9c047a10 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs @@ -0,0 +1,33 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Reflect", "Vector Operators", "Reflection vector given an incidence vector and a normal vector", tags: "refl reflect reflection" )] + public sealed class ReflectOpNode : DynamicTypeNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 0 ].ChangeProperties( "Incident", WirePortDataType.FLOAT4, false ); + m_inputPorts[ 1 ].ChangeProperties( "Normal", WirePortDataType.FLOAT4, false ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + + m_textLabelWidth = 67; + m_previewShaderGUID = "fb520f2145c0fa0409320a9e6d720758"; + } + + public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); + string result = "reflect( " + m_inputA + " , " + m_inputB + " )"; + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs.meta new file mode 100644 index 00000000..021f56a0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: bcd77715f8db1564abc96d502312d476 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs new file mode 100644 index 00000000..ba59e2ca --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs @@ -0,0 +1,92 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Refract", "Vector Operators", "Computes a refraction vector" )] + public sealed class RefractOpVec : ParentNode + { + [UnityEngine.SerializeField] + private WirePortDataType m_mainDataType = WirePortDataType.FLOAT; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT4, false , "Incident" ); + AddInputPort( WirePortDataType.FLOAT4, false , "Normal" ); + AddInputPort( WirePortDataType.FLOAT, false, "Eta" ); + AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); + m_textLabelWidth = 67; + m_previewShaderGUID = "5ab44ca484bed8b4884b03b1c00fdc3d"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnection( portId ); + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); + UpdateConnection( inputPortId ); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + UpdateConnection( portId ); + } + + void UpdateConnection( int portId ) + { + if( portId == 2 ) + return; + + bool hasConnection = false; + + WirePortDataType type1 = WirePortDataType.FLOAT; + if( m_inputPorts[ 0 ].IsConnected ) + { + type1 = m_inputPorts[ 0 ].GetOutputConnection( 0 ).DataType; + hasConnection = true; + } + WirePortDataType type2 = WirePortDataType.FLOAT; + if( m_inputPorts[ 1 ].IsConnected ) + { + type2 = m_inputPorts[ 1 ].GetOutputConnection( 0 ).DataType; + hasConnection = true; + } + + if( hasConnection ) + { + m_mainDataType = UIUtils.GetPriority( type1 ) > UIUtils.GetPriority( type2 ) ? type1 : type2; + } + else + { + m_mainDataType = WirePortDataType.FLOAT4; + } + + m_inputPorts[ 0 ].ChangeType( m_mainDataType, false ); + m_inputPorts[ 1 ].ChangeType( m_mainDataType, false ); + m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string incident = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string normal = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string interp = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + string result = "refract( " + incident + " , " + normal + " , " + interp + " )"; + + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs.meta new file mode 100644 index 00000000..fd6533b4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c5bb608b83cdc894cab572c72baa5f84 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs new file mode 100644 index 00000000..95b1dd8f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Round", "Math Operators", "Rounded value of scalars or vectors" )] + public sealed class RoundOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "round"; + m_previewShaderGUID = "554d561417b207c4bb3cd4a0c86b6907"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR , + WirePortDataType.INT); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs.meta new file mode 100644 index 00000000..22f51ec4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f7b5f29bc7f6bb844ae4ea698404adc3 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs new file mode 100644 index 00000000..ed91f4d4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Saturate", "Math Operators", "Saturate clamps the input values into the [0,1] range" )] + public sealed class SaturateNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "saturate"; + m_previewShaderGUID = "d9e53418dc8b9d34fb395e3ea3c75985"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR , + WirePortDataType.INT); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs.meta new file mode 100644 index 00000000..1f2437fb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 9d56f68d94c889443af651140ef86948 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs new file mode 100644 index 00000000..0d79fe81 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs @@ -0,0 +1,78 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Scale And Offset", "Math Operators", "Scales and offsets an input value\n( ( Value * Scale ) + Offset )" )] + public sealed class ScaleAndOffsetNode : ParentNode + { + private const string ScaleOffsetOpStr = "({0}*{1} + {2})"; + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddInputPort( WirePortDataType.FLOAT, false, "Scale" ); + m_inputPorts[ 1 ].FloatInternalData = 1; + AddInputPort( WirePortDataType.FLOAT, false, "Offset" ); + AddOutputPort( WirePortDataType.FLOAT, " " ); + m_useInternalPortData = true; + m_previewShaderGUID = "a1f1053d4d9c3be439e0382038b74771"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnection( portId ); + } + + public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); + UpdateConnection( inputPortId ); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + m_inputPorts[ portId ].ChangeType( WirePortDataType.FLOAT, false ); + if( portId == 0 ) + { + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); + } + } + + void UpdateConnection( int portId ) + { + if( portId == 0 ) + { + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + else + { + WirePortDataType newDataType = m_inputPorts[ portId ].ConnectionType() == WirePortDataType.FLOAT ? WirePortDataType.FLOAT : m_outputPorts[ 0 ].DataType; + m_inputPorts[ portId ].ChangeType( newDataType, false ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + // If scale or offset ports are floats then there's no need to cast them to any other type since they can be multiplied with everything + WirePortDataType scaleType = ( m_inputPorts[ 1 ].ConnectionType() == WirePortDataType.FLOAT ) ? WirePortDataType.FLOAT : m_outputPorts[ 0 ].DataType; + string scale = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, scaleType, ignoreLocalvar , true ); + + WirePortDataType offsetType = ( m_inputPorts[ 2 ].ConnectionType() == WirePortDataType.FLOAT ) ? WirePortDataType.FLOAT : m_outputPorts[ 0 ].DataType; + string offset = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, offsetType, ignoreLocalvar, true ); + + string result = string.Format( ScaleOffsetOpStr, value, scale, offset ); + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs.meta new file mode 100644 index 00000000..2b977bbd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b594feaa69ad03449b563f834fe0c18e +timeCreated: 1484582091 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs new file mode 100644 index 00000000..7445a10d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs @@ -0,0 +1,152 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Scale", "Math Operators", "Scales input value by a float factor" )] + public sealed class ScaleNode : ParentNode + { + private const string ScaleFactorStr = "Scale"; + + [SerializeField] + private float m_scaleFactor = 1; + + private int m_cachedPropertyId = -1; + + private const float LabelWidth = 8; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, " " ); + AddOutputPort( WirePortDataType.FLOAT, " " ); + m_insideSize.Set( 50, 10 ); + m_autoWrapProperties = true; + m_previewShaderGUID = "6d8ec9d9dab62c44aa2dcc0e3987760d"; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if ( m_cachedPropertyId == -1 ) + m_cachedPropertyId = Shader.PropertyToID( "_ScaleFloat" ); + + PreviewMaterial.SetFloat( m_cachedPropertyId, m_scaleFactor ); + } + + public override void DrawProperties() + { + base.DrawProperties(); + m_scaleFactor = EditorGUILayoutFloatField( ScaleFactorStr, m_scaleFactor ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + + m_propertyDrawPos.x = m_remainingBox.x + Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * 0.5f; + m_propertyDrawPos.y = m_remainingBox.y + Constants.INPUT_PORT_DELTA_Y * drawInfo.InvertedZoom * 0.5f; + m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; + m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if ( drawInfo.CurrentEventType != EventType.MouseDown ) + return; + + Rect hitBox = m_remainingBox; + hitBox.xMin -= LabelWidth * drawInfo.InvertedZoom; + bool insideBox = hitBox.Contains( drawInfo.MousePosition ); + + if ( insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = true; + } + else if ( m_isEditingFields && !insideBox ) + { + GUI.FocusControl( null ); + m_isEditingFields = false; + } + } + + private bool m_isEditingFields; + private float m_previousValue; + private string m_fieldText = "0"; + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if ( !m_isVisible ) + return; + + if ( m_isEditingFields ) + { + UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_scaleFactor, LabelWidth ); + } + else if ( drawInfo.CurrentEventType == EventType.Repaint ) + { + Rect fakeField = m_propertyDrawPos; + fakeField.xMin += LabelWidth * drawInfo.InvertedZoom; + Rect fakeLabel = m_propertyDrawPos; + fakeLabel.xMax = fakeField.xMin; + EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); + EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); + + if ( m_previousValue != m_scaleFactor ) + { + m_previousValue = m_scaleFactor; + m_fieldText = m_scaleFactor.ToString(); + } + + GUI.Label( fakeField, m_fieldText, UIUtils.MainSkin.textField ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string portResult = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string result = "( " + portResult + " * " + m_scaleFactor + " )"; + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_scaleFactor ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_scaleFactor = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs.meta new file mode 100644 index 00000000..74ee5f4a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ec926b11f9c698c458f746e4e55fd7df +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs new file mode 100644 index 00000000..90f83dcf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Sign", "Math Operators", "Sign of scalar or each vector component" )] + public sealed class SignOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "sign"; + m_previewShaderGUID = "3aca80b49aadf5046b7133730818e18f"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT , + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR , + WirePortDataType.INT); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs.meta new file mode 100644 index 00000000..e484efe0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 429f407c2b590df45b215f0edfa49b97 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs new file mode 100644 index 00000000..4726b848 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs @@ -0,0 +1,32 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Simplified Fmod", "Math Operators", "Floating point remainder of x/y" )] + public sealed class SimplifiedFModOpNode : DynamicTypeNode + { + private const string FmodCustomOp = "frac({0}/{1})*{1}"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_previewShaderGUID = "2688236fb4f37ce47b81cc818c53321d"; + } + + public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + { + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); + RegisterLocalVariable( 0, string.Format( FmodCustomOp, m_inputA, m_inputB ), ref dataCollector, ( "fmodResult" + OutputId ) ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs.meta new file mode 100644 index 00000000..7ac44558 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f186e1b03a8ee2b4b9e45918576e8cf6 +timeCreated: 1484731588 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs new file mode 100644 index 00000000..34c0f99e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Sin", "Trigonometry Operators", "Sine of scalars and vectors",tags: "sine" )] + public sealed class SinOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "sin"; + m_previewShaderGUID = "bcd9f8749ddd3ac4f94f4c2071c1d0d4"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs.meta new file mode 100644 index 00000000..6be7c6e2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: be2a11b08ee8cbb458dbcc4c1a61ad1b +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs new file mode 100644 index 00000000..4af0cba4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs @@ -0,0 +1,67 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; + + +namespace AmplifyShaderEditor +{ + [Serializable] + public class SingleInputOp : ParentNode + { + + [SerializeField] + protected string m_opName; + //[SerializeField] + //protected int m_validTypes; + + protected bool m_autoUpdateOutputPort = true; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + //m_validTypes = 0; + m_useInternalPortData = true; + + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + if ( m_autoUpdateOutputPort ) + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + if ( m_autoUpdateOutputPort ) + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string result = "0"; + if ( m_inputPorts[ 0 ].IsConnected ) + { + ParentNode node = m_inputPorts[ 0 ].GetOutputNode(); + int localOutputId = m_inputPorts[ 0 ].ExternalReferences[ 0 ].PortId; + result = m_opName + "( " + node.GenerateShaderForOutput( localOutputId, ref dataCollector, ignoreLocalvar ) + " )"; + } + else + { + result = m_opName + "( " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + " )"; + } + + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs.meta new file mode 100644 index 00000000..6abbebd8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ed03e964ff9aa274cbf392769b61170b +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs new file mode 100644 index 00000000..efd80edc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Sinh", "Trigonometry Operators", "Hyperbolic sine of scalars and vectors",tags: "hyperbolic sine" )] + public sealed class SinhOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "sinh"; + m_previewShaderGUID = "4e9c00e6dceb4024f80d4e3d7786abad"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs.meta new file mode 100644 index 00000000..4b899c97 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 52092e3985c556943895f86c585bcd25 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs new file mode 100644 index 00000000..09d86cb0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs @@ -0,0 +1,122 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Smoothstep", "Math Operators", "Returns a smooth Hermite interpolation between 0 and 1, if input is in the range [min, max]." )] + public sealed class SmoothstepOpNode : ParentNode + { + //[UnityEngine.SerializeField] + //private WirePortDataType m_mainDataType = WirePortDataType.FLOAT; + + private int m_alphaPortId = 0; + private int m_minPortId = 0; + private int m_maxPortId = 0; + private const string SmoothstepOpFormat = "smoothstep( {0} , {1} , {2})";//min max alpha + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue, -1, MasterNodePortCategory.Fragment, 0 ); + m_alphaPortId = m_inputPorts.Count - 1; + AddInputPort( WirePortDataType.FLOAT, false, "Min", -1, MasterNodePortCategory.Fragment, 1 ); + m_minPortId = m_inputPorts.Count - 1; + AddInputPort( WirePortDataType.FLOAT, false, "Max", -1, MasterNodePortCategory.Fragment, 2 ); + m_maxPortId = m_inputPorts.Count - 1; + + GetInputPortByUniqueId( m_maxPortId ).FloatInternalData = 1; + + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_useInternalPortData = true; + m_textLabelWidth = 55; + m_previewShaderGUID = "954cdd40a7a528344a0a4d3ff1db5176"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + if( portId == 0 ) + { + m_inputPorts[ 0 ].MatchPortToConnection(); + m_inputPorts[ 1 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + m_inputPorts[ 2 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + if( outputPortId == 0 ) + { + m_inputPorts[ 0 ].MatchPortToConnection(); + m_inputPorts[ 1 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + m_inputPorts[ 2 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + } + + //public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + //{ + // base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + // UpdateConnection( portId ); + //} + + //public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + //{ + // base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); + // UpdateConnection( inputPortId ); + //} + + //public override void OnInputPortDisconnected( int portId ) + //{ + // base.OnInputPortDisconnected( portId ); + // UpdateConnection( portId ); + //} + + //void UpdateConnection( int portId ) + //{ + // WirePortDataType type1 = WirePortDataType.FLOAT; + // if( m_inputPorts[ m_minPortId ].IsConnected ) + // type1 = m_inputPorts[ m_minPortId ].GetOutputConnection( 0 ).DataType; + + // WirePortDataType type2 = WirePortDataType.FLOAT; + // if( m_inputPorts[ m_maxPortId ].IsConnected ) + // type2 = m_inputPorts[ m_maxPortId ].GetOutputConnection( 0 ).DataType; + + // m_mainDataType = UIUtils.GetPriority( type1 ) > UIUtils.GetPriority( type2 ) ? type1 : type2; + + // if( !m_inputPorts[ m_minPortId ].IsConnected && !m_inputPorts[ m_maxPortId ].IsConnected && m_inputPorts[ m_alphaPortId ].IsConnected ) + // m_mainDataType = m_inputPorts[ m_alphaPortId ].GetOutputConnection( 0 ).DataType; + + // m_inputPorts[ m_minPortId ].ChangeType( m_mainDataType, false ); + + // m_inputPorts[ m_maxPortId ].ChangeType( m_mainDataType, false ); + // if( m_inputPorts[ m_alphaPortId ].IsConnected && m_inputPorts[ m_alphaPortId ].GetOutputConnection( 0 ).DataType == WirePortDataType.FLOAT ) + // m_inputPorts[ m_alphaPortId ].ChangeType( WirePortDataType.FLOAT, false ); + // else + // m_inputPorts[ m_alphaPortId ].ChangeType( m_mainDataType, false ); + + // m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); + //} + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string aValue = m_inputPorts[ m_minPortId ].GeneratePortInstructions( ref dataCollector ); + string bValue = m_inputPorts[ m_maxPortId ].GeneratePortInstructions( ref dataCollector ); + string interp = m_inputPorts[ m_alphaPortId ].GeneratePortInstructions( ref dataCollector ); + + string result = string.Format( SmoothstepOpFormat, aValue, bValue, interp ); + + RegisterLocalVariable( 0, result, ref dataCollector, "smoothstepResult" + OutputId ); + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs.meta new file mode 100644 index 00000000..5c1d1cc6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 0f64eb769f843a349a0d249beacc6fc3 +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs new file mode 100644 index 00000000..6b83b4e4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Sqrt", "Math Operators", "Square root of scalars and vectors", tags: "square root" )] + public sealed class SqrtOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "sqrt"; + m_previewShaderGUID = "1791e2fbf36af084da7ecfc289e89b6e"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs.meta new file mode 100644 index 00000000..6dc09693 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4820b591b73a7fe4ab13261deebf76f7 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs new file mode 100644 index 00000000..ab1a1b86 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs @@ -0,0 +1,24 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Step", "Math Operators", "Step function returning either zero or one" )] + public sealed class StepOpNode : DynamicTypeNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_previewShaderGUID = "2c757add7f97ecd4abd9ce6ec4659697"; + } + + public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); + return "step( " + m_inputA + " , " + m_inputB + " )"; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs.meta new file mode 100644 index 00000000..298cb544 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c4305e64271097249a198b2e8aed3046 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs new file mode 100644 index 00000000..dc010aa2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs @@ -0,0 +1,74 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Remap +// Donated by The Four Headed Cat - @fourheadedcat +using UnityEngine; +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Remap", "Math Operators", "Remap value from old min - max range to new min - max range", null, KeyCode.None, true, false, null, null, "The Four Headed Cat - @fourheadedcat" )] + public sealed class TFHCRemapNode : DynamicTypeNode + { + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 0 ].Name = Constants.EmptyPortValue; + m_inputPorts[ 1 ].Name = "Min Old"; + AddInputPort( WirePortDataType.FLOAT, false, "Max Old" ); + m_inputPorts[ 2 ].FloatInternalData = 1; + m_inputPorts[ 2 ].Vector2InternalData = Vector2.one; + m_inputPorts[ 2 ].Vector3InternalData = Vector3.one; + m_inputPorts[ 2 ].Vector4InternalData = Vector4.one; + m_inputPorts[ 2 ].ColorInternalData = Color.white; + + AddInputPort( WirePortDataType.FLOAT, false, "Min New" ); + AddInputPort( WirePortDataType.FLOAT, false, "Max New" ); + m_inputPorts[ 4 ].FloatInternalData = 1; + m_inputPorts[ 4 ].Vector2InternalData = Vector2.one; + m_inputPorts[ 4 ].Vector3InternalData = Vector3.one; + m_inputPorts[ 4 ].Vector4InternalData = Vector4.one; + m_inputPorts[ 4 ].ColorInternalData = Color.white; + + m_textLabelWidth = 100; + m_useInternalPortData = true; + m_previewShaderGUID = "72dd1cbea889fa047b929d5191e360c0"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + UpdateConnections(); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + UpdateConnections(); + } + + void UpdateConnections() + { + m_inputPorts[ 0 ].MatchPortToConnection(); + m_inputPorts[ 1 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + m_inputPorts[ 2 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + m_inputPorts[ 3 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + m_inputPorts[ 4 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string oldMin = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar, true ); + string oldMax = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar, true ); + string newMin = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar, true ); + string newMax = m_inputPorts[ 4 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar, true ); + string strout = "(" + newMin + " + (" + value + " - " + oldMin + ") * (" + newMax + " - " + newMin + ") / (" + oldMax + " - " + oldMin + "))"; + + return CreateOutputLocalVariable( 0, strout, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs.meta new file mode 100644 index 00000000..bd82c7bd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 637508d44a97b5449a3d7223c461e58c +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs new file mode 100644 index 00000000..1f99d366 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Tan", "Trigonometry Operators", "Tangent of scalars and vectors" ,tags: "tangent")] + public sealed class TanOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "tan"; + m_previewShaderGUID = "312e291832cac5749a3626547dfc8607"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs.meta new file mode 100644 index 00000000..4749b74e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 535b4367719ca2146bb7ddac217dad94 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs new file mode 100644 index 00000000..1a799d5e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Tanh", "Trigonometry Operators", "Hyperbolic tangent of scalars and vectors", tags: "hyperbolic tangent" )] + public sealed class TanhOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "tanh"; + m_previewShaderGUID = "52f78d3a1c66d1c489cd63b0a9300b38"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs.meta new file mode 100644 index 00000000..91a04f72 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 792e48b83a6387a4d826d6445417372f +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs new file mode 100644 index 00000000..72d36120 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs @@ -0,0 +1,160 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public enum CoordinateSpaces + { + Tangent, + Local, + World, + View, + Clip, + Screen + } + + [Serializable] + [NodeAttributes( "Transform Vector", "Math Operators", "Transforma a vector into another", null, KeyCode.None, false )] + public sealed class TransformVectorOpNode : ParentNode + { + [SerializeField] + private CoordinateSpaces m_source = CoordinateSpaces.Tangent; + [SerializeField] + private CoordinateSpaces m_destination = CoordinateSpaces.World; + + private const string InputTangentrStr = "float4 tangent: TANGENT"; + private const string ColorValueStr = ".tangent"; + + private const string InputNormalStr = "float3 normal : NORMAL"; + private const string NormalValueStr = ".normal"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT4, false, Constants.EmptyPortValue ); + AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); + m_useInternalPortData = true; + } + + void AddTangentInfo( ref MasterNodeDataCollector dataCollector ) + { + dataCollector.AddToInput( UniqueId, InputTangentrStr, true ); + dataCollector.AddToInput( UniqueId, InputTangentrStr, true ); + dataCollector.AddToInput( UniqueId, InputNormalStr, true ); + dataCollector.AddToFragmentLocalVariables( UniqueId, "float3 binormal = cross( normalize( v.normal ), normalize( v.tangent.xyz ) ) * v.tangent.w;" ); + dataCollector.AddToFragmentLocalVariables( UniqueId, "float3x3 rotation = float3x3( v.tangent.xyz, binormal, v.normal );" ); + + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + + //if ( !InputPorts[ 0 ].IsConnected ) + //{ + // return UIUtils.NoConnection( this ); + //} + + string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + dataCollector.AddToIncludes( UniqueId, Constants.UnityShaderVariables ); + + + + switch ( m_source ) + { + case CoordinateSpaces.Tangent: + { + AddTangentInfo( ref dataCollector ); + switch ( m_destination ) + { + case CoordinateSpaces.Tangent: + { + return value; + } + //case eCoordinateSpaces.Local: + //{ + //} + //case eCoordinateSpaces.World: + //{ + //} + //case eCoordinateSpaces.View: + //{ + //} + } + } + break; + case CoordinateSpaces.Local: + { + switch ( m_destination ) + { + case CoordinateSpaces.Tangent: + { + AddTangentInfo( ref dataCollector ); + return "float4(mul( rotation , " + value + ".xyz ),1)"; + } + case CoordinateSpaces.Local: + { + return value; + } + case CoordinateSpaces.World: + { + return "mul( _Object2World , " + value + " )"; + } + case CoordinateSpaces.View: + { + return "mul( UNITY_MATRIX_MV , " + value + " )"; + } + } + } + break; + case CoordinateSpaces.World: + { + switch ( m_destination ) + { + //case eCoordinateSpaces.Tangent: + //{ + //} + case CoordinateSpaces.Local: + { + return "mul( _World2Object , " + value + " )"; + } + case CoordinateSpaces.World: + { + return value; + } + case CoordinateSpaces.View: + { + return "mul( UNITY_MATRIX_V , " + value + " )"; + } + } + } + break; + case CoordinateSpaces.View: + { + UIUtils.ShowMessage( UniqueId, "View as Source is not supported", MessageSeverity.Warning ); + return value; + } + } + + return UIUtils.UnknownError( this ); + } + + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_source = ( CoordinateSpaces ) Enum.Parse( typeof( CoordinateSpaces ), GetCurrentParam( ref nodeParams ) ); + m_destination = ( CoordinateSpaces ) Enum.Parse( typeof( CoordinateSpaces ), GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_source ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_destination ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs.meta new file mode 100644 index 00000000..f0f70f47 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 928c21155a9c1a74b953da2d24269035 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs new file mode 100644 index 00000000..6e83e512 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs @@ -0,0 +1,23 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Transpose", "Matrix Operators", "Transpose matrix of a matrix" )] + public sealed class TransposeOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "transpose"; + m_drawPreview = false; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.FLOAT3x3, + WirePortDataType.FLOAT4x4 ); + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4x4, false ); + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4x4, false ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs.meta new file mode 100644 index 00000000..911886c6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ba1613dad4af0da4b9f4619b90916cbf +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs new file mode 100644 index 00000000..f190b0c8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs @@ -0,0 +1,26 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Trunc", "Math Operators", "Largest integer not greater than a scalar or each vector component" )] + public sealed class TruncOpNode : SingleInputOp + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_opName = "trunc"; + m_previewShaderGUID = "c717aaa68f4ac9e469b15763e82933e1"; + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.INT ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs.meta new file mode 100644 index 00000000..66844e17 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5f78e9a796a94d54482caa15d4971feb +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs new file mode 100644 index 00000000..f5610899 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs @@ -0,0 +1,76 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + public class VariablePortTypeOpNode : ParentNode + { + private const string InputTypeStr = "Input type"; + + [SerializeField] + protected WirePortDataType m_selectedType = WirePortDataType.FLOAT; + + [SerializeField] + protected WirePortDataType m_lastSelectedType = WirePortDataType.FLOAT; + + [SerializeField] + protected int _inputAmount = 1; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddPorts(); + } + + void AddPorts() + { + for ( int i = 0; i < _inputAmount; i++ ) + { + AddInputPort( m_selectedType, true, i.ToString() ); + } + AddOutputPort( m_selectedType, Constants.EmptyPortValue ); + m_sizeIsDirty = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUILayout.BeginVertical(); + { + EditorGUILayout.LabelField( InputTypeStr ); + m_selectedType = ( WirePortDataType ) EditorGUILayoutEnumPopup( m_selectedType ); + } + EditorGUILayout.EndVertical(); + if ( m_selectedType != m_lastSelectedType ) + { + m_lastSelectedType = m_selectedType; + + DeleteAllInputConnections( true ); + DeleteAllOutputConnections( true ); + + AddPorts(); + + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedType ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_selectedType = ( WirePortDataType ) Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ); + m_lastSelectedType = m_selectedType; + DeleteAllInputConnections( true ); + DeleteAllOutputConnections( true ); + AddPorts(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs.meta new file mode 100644 index 00000000..731d1711 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 97be7adea7b8ae44c9bebb753277e0c2 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs new file mode 100644 index 00000000..0d2cd215 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs @@ -0,0 +1,3918 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public enum PreviewLocation + { + Auto, + TopCenter, + BottomCenter, + Left, + Right + } + + public enum NodeMessageType + { + Error, + Warning, + Info + } + + [Serializable] + public class ParentNode : UndoParentNode, ISerializationCallbackReceiver + { + + protected readonly string[] PrecisionLabels = { "Float", "Half" }; + protected readonly string[] PrecisionLabelsExtra = { "Float", "Half", "Inherit" }; + + private const double NodeClickTime = 0.2; + protected GUIContent PrecisionContent = new GUIContent( "Precision", "Changes the precision of internal calculations, using lower types saves some performance\nDefault: Float" ); + private const int MoveCountBuffer = 3;// When testing for stopped movement we need to take Layout and Repaint into account for them not to interfere with tests + private const float MinInsideBoxWidth = 20; + private const float MinInsideBoxHeight = 10; + + private const string WikiLinkStr = "online reference"; + + public delegate void OnNodeEvent( ParentNode node, bool testOnlySelected, InteractionMode interactionMode ); + public delegate void OnNodeGenericEvent( ParentNode node ); + public delegate void OnNodeReOrder( ParentNode node, int index ); + public delegate void DrawPropertySection(); + public delegate void OnSRPAction( int outputId, ref MasterNodeDataCollector dataCollector ); + + [SerializeField] + protected PrecisionType m_currentPrecisionType = PrecisionType.Inherit; + + [SerializeField] + protected bool m_customPrecision = false; + + [SerializeField] + protected InteractionMode m_defaultInteractionMode = InteractionMode.Other; + + public event OnNodeEvent OnNodeStoppedMovingEvent; + public OnNodeGenericEvent OnNodeChangeSizeEvent; + public OnNodeGenericEvent OnNodeDestroyedEvent; + public event OnNodeReOrder OnNodeReOrderEvent; + public OnSRPAction OnLightweightAction; + public OnSRPAction OnHDAction; + + [SerializeField] + private int m_uniqueId; + + [SerializeField] + protected Rect m_position; + + [SerializeField] + protected Rect m_unpreviewedPosition; + + [SerializeField] + protected GUIContent m_content; + + [SerializeField] + protected GUIContent m_additionalContent; + + [SerializeField] + protected bool m_initialized; + + [SerializeField] + protected NodeConnectionStatus m_connStatus; + protected bool m_selfPowered = false; + + [SerializeField] + protected int m_activeConnections; + + [SerializeField] + protected System.Type m_activeType; + + [SerializeField] + protected int m_activePort; + + [SerializeField] + protected int m_activeNode; + + protected NodeRestrictions m_restrictions; + + [SerializeField] + protected Color m_statusColor; + + [SerializeField] + protected Rect m_propertyDrawPos; + + // Ports + [SerializeField] + protected List m_inputPorts = new List(); + protected Dictionary m_inputPortsDict = new Dictionary(); + + [SerializeField] + protected bool m_sortInputPorts = false; + private List m_sortedInputPorts = new List(); + + [SerializeField] + protected List m_outputPorts = new List(); + protected Dictionary m_outputPortsDict = new Dictionary(); + + [SerializeField] + protected bool m_sortOutputPorts = false; + private List m_sortedOutputPorts = new List(); + + // Positions + [SerializeField] + protected Rect m_globalPosition; + + [SerializeField] + protected Rect m_headerPosition; + + //private Vector2 m_tooltipOffset; + + [SerializeField] + protected bool m_sizeIsDirty = false; + + [SerializeField] + protected Vector2 m_extraSize; + + [SerializeField] + protected Vector2 m_insideSize; + + [SerializeField] + protected float m_fontHeight; + + // Editor State save on Play Button + [SerializeField] + protected bool m_isDirty; + + [SerializeField] + private int m_isMoving = 0; + [SerializeField] + private Rect m_lastPosition; + + // Live Shader Gen + [SerializeField] + private bool m_saveIsDirty; + + [SerializeField] + protected bool m_requireMaterialUpdate = false; + + [SerializeField] + protected int m_commentaryParent = -1; + + [SerializeField] + protected int m_depth = -1; + + [SerializeField] + protected bool m_materialMode = false; + + [SerializeField] + protected bool m_showPreview = false; + + [SerializeField] + protected int m_previewMaterialPassId = -1; + + protected bool m_useSquareNodeTitle = false; + + [SerializeField] + protected bool m_continuousPreviewRefresh = false; + private bool m_previewIsDirty = true; + + // Error Box Messages + private Rect m_errorBox; + private bool m_previousErrorMessage = false; + protected bool m_showErrorMessage = false; + protected NodeMessageType m_errorMessageTypeIsError = NodeMessageType.Error; + protected string m_errorMessageTooltip = string.Empty; + + private GUIContent m_errorIcon = new GUIContent(); + private GUIContent m_errorMessage = new GUIContent(); + private GUIStyle m_errorCurrentStyle; + + private const string ErrorTitle = "ERROR"; + private const string WarningTitle = "WARNING"; + private const string InfoTitle = "INFO"; + + // Drawing Node + protected PreviewLocation m_selectedLocation = PreviewLocation.Auto; + private int m_extraHeaderHeight = 0; + protected bool m_isVisible; + protected bool m_selected = false; + protected bool m_rmbIgnore; + protected GUIContent m_sizeContentAux; + + protected uint m_currentReadParamIdx = 1; + protected bool m_reorderLocked = false; + + protected Rect m_cachedPos; + protected Vector2 m_accumDelta = Vector2.zero; + + private bool m_isOnGrid = false; + protected bool m_useInternalPortData = false; + protected bool m_autoDrawInternalPortData = true; + protected DrawOrder m_drawOrder = DrawOrder.Default; + + protected bool m_movingInFrame = false; + protected float m_anchorAdjust = -1; + + protected Color m_headerColor; + + [SerializeField] // needs to be serialized because of Undo + protected Color m_headerColorModifier = Color.white; + + protected bool m_infiniteLoopDetected = false; + protected int m_textLabelWidth = -1; + + private bool m_linkVisibility = false; + [SerializeField] + protected bool m_hasTooltipLink = true; + + protected int m_category = 0; + + protected double m_lastTimeSelected; + private double m_tooltipTimestamp; + protected string m_tooltipText; + + protected Rect m_unscaledRemainingBox; + protected Rect m_remainingBox; + + private int m_visibleInputs = 0; + private int m_visibleOutputs = 0; + + private double m_doubleClickTimestamp; + private const double DoubleClickTime = 0.25; + + protected bool m_canExpand = true; + + protected bool m_firstDraw = true; + + protected int m_matrixId = -1; + + private float m_paddingTitleLeft = 0; + private float m_paddingTitleRight = 0; + + // Preview Fields + private Material m_previewMaterial = null; + private Shader m_previewShader = null; + protected string m_previewShaderGUID = string.Empty; + protected float m_marginPreviewLeft = 0; + protected bool m_globalShowPreview = false; + protected Rect m_unscaledPreviewRect; + protected Rect m_previewRect; + protected bool m_drawPreviewMaskButtons = true; + private int m_channelNumber = 0; + protected bool m_firstPreviewDraw = true; + [SerializeField] + protected bool m_drawPreview = true; + protected bool m_drawPreviewExpander = true; + private bool m_spherePreview = false; + protected bool m_drawPreviewAsSphere = false; + protected bool m_forceDrawPreviewAsPlane = false; + private bool m_finishPreviewRender = false; + + private int m_cachedMainTexId = -1; + private int m_cachedMaskTexId = -1; + private int m_cachedPortsId = -1; + private int m_cachedPortId = -1; + + private int m_cachedDrawSphereId = -1; + private int m_cachedInvertedZoomId = -1; + //private int m_cachedIsLinearId = -1; + + private bool[] m_previewChannels = { true, true, true, false }; + + // Others + protected bool m_hasSubtitle = false; + protected bool m_showSubtitle = true; + protected bool m_hasLeftDropdown = false; + protected bool m_autoWrapProperties = false; + protected bool m_internalDataFoldout = true; + protected bool m_propertiesFoldout = true; + protected bool m_repopulateDictionaries = true; + + protected Vector2 m_lastInputBottomRight = Vector2.zero; + protected Vector2 m_lastOutputBottomLeft = Vector2.zero; + + private Vector4 m_portMask = Vector4.zero; + + private Vector2 m_auxVector2 = Vector4.zero; + protected Rect m_auxRect; + + protected PreviewLocation m_autoLocation; + protected Rect m_titlePos; + protected Rect m_addTitlePos; + protected Rect m_expandRect; + protected Rect m_dropdownRect; + protected Rect m_currInputPortPos; + protected Rect m_currOutputPortPos; + protected Color m_colorBuffer; + + [SerializeField] + protected bool m_docking = false; + + [SerializeField] + protected int m_visiblePorts = 0; + + protected int m_graphDepth = 0; + + protected int m_oldInputCount = -1; + + protected bool m_dropdownEditing = false; + + protected bool m_isNodeBeingCopied = false; + + protected string m_previousTitle = string.Empty; + + protected string m_previousAdditonalTitle = string.Empty; + protected string m_previousAdditonalTitleFormat = string.Empty; + + private bool m_alive = true; + + private bool m_wasDeprecated = false; + + private double m_timedUpdateInitialValue; + private double m_timedUpdateInterval; + private bool m_fireTimedUpdateRequest = false; + + public ParentNode() + { + m_position = new Rect( 0, 0, 0, 0 ); + m_content = new GUIContent( GUIContent.none ); + m_additionalContent = new GUIContent( GUIContent.none ); + CommonInit( -1 ); + } + + public ParentNode( int uniqueId, float x, float y, float width, float height ) + { + m_position = new Rect( x, y, width, height ); + m_content = new GUIContent( GUIContent.none ); + m_additionalContent = new GUIContent( GUIContent.none ); + CommonInit( uniqueId ); + } + + public virtual void OnEnable() + { + hideFlags = HideFlags.HideAndDontSave; + + RefreshUIHeaderColor(); + + m_tooltipTimestamp = Time.realtimeSinceStartup; + hideFlags = HideFlags.DontSave; + } + + public void RefreshUIHeaderColor() + { + // @diogo: handle special shader function case; this will have to do for now... + var functionNode = this as FunctionNode; + if ( functionNode != null && functionNode.Function != null ) + { + if ( functionNode.Function.Header == AmplifyShaderFunction.HeaderStyle.Custom ) + { + m_headerColor = functionNode.Function.HeaderColor; + } + else if ( functionNode.Function.Header == AmplifyShaderFunction.HeaderStyle.Category ) + { + m_headerColor = UIUtils.GetColorFromCategory( functionNode.Function.CustomNodeCategory ); + } + else + { + m_headerColor = UIUtils.GetColorFromCategory( "Functions" ); + } + } + else if ( m_nodeAttribs != null ) + { + if( UIUtils.HasColorCategory( m_nodeAttribs.Category ) ) + { + m_headerColor = UIUtils.GetColorFromCategory( m_nodeAttribs.Category ); + } + else + { + if( !string.IsNullOrEmpty( m_nodeAttribs.CustomCategoryColor ) ) + { + m_headerColor = UIUtils.AddColorCategory( m_nodeAttribs.Category, m_nodeAttribs.CustomCategoryColor ); + } + } + } + } + + protected virtual void CommonInit( int uniqueId ) + { + m_uniqueId = uniqueId; + + m_isOnGrid = false; + ConnStatus = NodeConnectionStatus.Not_Connected; + m_inputPorts = new List(); + m_inputPortsDict = new Dictionary(); + + m_outputPorts = new List(); + m_outputPortsDict = new Dictionary(); + + System.Reflection.MemberInfo info = this.GetType(); + m_nodeAttribs = info.GetCustomAttributes( typeof( NodeAttributes ), true ).FirstOrDefault() as NodeAttributes; + if( m_nodeAttribs != null ) + { + m_content.text = m_nodeAttribs.Name; + //m_content.tooltip = m_nodeAttribs.Description; + m_tooltipText = m_nodeAttribs.Description; + m_selected = false; + } + + m_sizeContentAux = new GUIContent(); + m_extraSize = new Vector2( 0, 0 ); + m_insideSize = new Vector2( 0, 0 ); + m_sizeIsDirty = true; + m_initialized = true; + m_restrictions = new NodeRestrictions(); + + m_propertyDrawPos = new Rect(); + } + + public virtual void AfterCommonInit() + { + if( PreviewShader && !HasPreviewShader ) + { + m_drawPreview = false; + m_drawPreviewExpander = false; + m_canExpand = false; + } + + if( m_drawPreviewExpander || m_hasLeftDropdown ) + { + m_paddingTitleRight += Constants.PreviewExpanderWidth + Constants.IconsLeftRightMargin; + m_paddingTitleLeft = Constants.PreviewExpanderWidth + Constants.IconsLeftRightMargin; + } + } + + public virtual void Destroy() + { + m_alive = false; + if( OnNodeDestroyedEvent != null ) + { + OnNodeDestroyedEvent( this ); + OnNodeDestroyedEvent = null; + } + + OnLightweightAction = null; + OnHDAction = null; + + OnNodeStoppedMovingEvent = null; + OnNodeChangeSizeEvent = null; + OnNodeReOrderEvent = null; + if( m_restrictions != null ) + m_restrictions.Destroy(); + m_restrictions = null; + + if( m_inputPorts != null ) + { + int inputCount = m_inputPorts.Count; + for( int i = 0; i < inputCount; i++ ) + { + m_inputPorts[ i ].Destroy(); + } + m_inputPorts.Clear(); + m_inputPorts = null; + } + + if( m_outputPorts != null ) + { + int outputCount = m_outputPorts.Count; + for( int i = 0; i < outputCount; i++ ) + { + m_outputPorts[ i ].Destroy(); + } + m_outputPorts.Clear(); + m_outputPorts = null; + } + + if( m_inputPortsDict != null ) + m_inputPortsDict.Clear(); + + m_inputPortsDict = null; + + if( m_outputPortsDict != null ) + m_outputPortsDict.Clear(); + + m_outputPortsDict = null; + + if( m_previewMaterial != null ) + DestroyImmediate( m_previewMaterial ); + m_previewMaterial = null; + + m_previewShader = null; + //m_containerGraph = null; + } + + public virtual void Move( Vector2 delta ) + { + if( m_docking ) + return; + + Move( delta, false ); + } + + public virtual void Move( Vector2 delta, bool snap ) + { + if( m_docking ) + return; + + if( m_isMoving == 0 ) + { + m_cachedPos = m_position; + m_accumDelta = Vector2.zero; + } + + m_isMoving = MoveCountBuffer; + m_accumDelta += delta; + + if( snap ) + { + m_position.x = Mathf.Round( ( m_cachedPos.x + m_accumDelta.x ) / 16 ) * 16; + m_position.y = Mathf.Round( ( m_cachedPos.y + m_accumDelta.y ) / 16 ) * 16; + } + else + { + m_position.x += delta.x; + m_position.y += delta.y; + } + //if(Event.current.type == EventType.Layout) + m_movingInFrame = true; + } + + public virtual void UpdateMaterial( Material mat ) + { + m_requireMaterialUpdate = false; + } + + public virtual void SetMaterialMode( Material mat, bool fetchMaterialValues ) + { + m_materialMode = ( mat != null ); + } + + public virtual bool UpdateShaderDefaults( ref Shader shader, ref TextureDefaultsDataColector defaultCol ) { return false; } + public virtual void ForceUpdateFromMaterial( Material material ) { } + public void SetSaveIsDirty() + { + if( m_connStatus == NodeConnectionStatus.Connected ) + { + SaveIsDirty = true; + } + } + + public void ActivateNodeReordering( int index ) + { + if( OnNodeReOrderEvent != null ) + OnNodeReOrderEvent( this, index ); + } + + void RecalculateInputPortIdx() + { + m_inputPortsDict.Clear(); + int count = m_inputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + int nodeId = m_inputPorts[ i ].ExternalReferences[ 0 ].NodeId; + int portId = m_inputPorts[ i ].ExternalReferences[ 0 ].PortId; + ParentNode node = UIUtils.GetNode( nodeId ); + if( node != null ) + { + OutputPort outputPort = node.GetOutputPortByUniqueId( portId ); + int outputCount = outputPort.ExternalReferences.Count; + for( int j = 0; j < outputCount; j++ ) + { + if( outputPort.ExternalReferences[ j ].NodeId == m_uniqueId && + outputPort.ExternalReferences[ j ].PortId == m_inputPorts[ i ].PortId ) + { + outputPort.ExternalReferences[ j ].PortId = i; + } + } + } + } + m_inputPorts[ i ].PortId = i; + m_inputPortsDict.Add( i, m_inputPorts[ i ] ); + } + } + + public void SwapInputPorts( int fromIdx, int toIdx ) + { + InputPort port = m_inputPorts[ fromIdx ]; + //if( toIdx > fromIdx ) + // toIdx--; + m_inputPorts.Remove( port ); + m_inputPorts.Insert( toIdx, port ); + RecalculateInputPortIdx(); + SetSaveIsDirty(); + } + + public void RemoveInputPort( int idx ) + { + if( idx < m_inputPorts.Count ) + { + m_inputPortsDict.Remove( m_inputPorts[ idx ].PortId ); + m_inputPorts.RemoveAt( idx ); + SetSaveIsDirty(); + m_sizeIsDirty = true; + } + } + + public void RemoveOutputPort( string name ) + { + int count = m_outputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( m_outputPorts[ i ].Name.Equals( name ) ) + { + if( m_outputPorts[ i ].IsConnected ) + { + m_containerGraph.DeleteConnection( false, m_uniqueId, m_outputPorts[ i ].PortId, false, true ); + m_outputPortsDict.Remove( m_outputPorts[ i ].PortId ); + m_outputPorts.RemoveAt( i ); + SetSaveIsDirty(); + m_sizeIsDirty = true; + } + } + } + } + + public void RemoveOutputPort( int idx, bool isArrayIndex = true ) + { + if( isArrayIndex ) + { + // idx represents a position on the output port array + if( idx < m_outputPorts.Count ) + { + if( m_outputPorts[ idx ].IsConnected ) + { + m_containerGraph.DeleteConnection( false, m_uniqueId, m_outputPorts[ idx ].PortId, false, true ); + } + + m_outputPortsDict.Remove( m_outputPorts[ idx ].PortId ); + m_outputPorts.RemoveAt( idx ); + SetSaveIsDirty(); + m_sizeIsDirty = true; + } + } + else + { + // idx represents a port unique id + int count = m_outputPorts.Count; + int arrIdx = -1; + for( int i = 0; i < count; i++ ) + { + if( m_outputPorts[ i ].PortId == idx ) + { + arrIdx = i; + break; + } + } + + if( arrIdx >= 0 ) + { + if( m_outputPorts[ arrIdx ].IsConnected ) + { + m_containerGraph.DeleteConnection( false, m_uniqueId, idx, false, true ); + } + + m_outputPortsDict.Remove( idx ); + m_outputPorts.RemoveAt( arrIdx ); + SetSaveIsDirty(); + m_sizeIsDirty = true; + } + } + } + + // Manually add Ports + public InputPort AddInputPort( WirePortDataType type, bool typeLocked, string name, int orderId = -1, MasterNodePortCategory category = MasterNodePortCategory.Fragment, int uniquePortId = -1 ) + { + InputPort port = new InputPort( m_uniqueId, ( uniquePortId < 0 ? m_inputPorts.Count : uniquePortId ), type, name, typeLocked, ( orderId >= 0 ? orderId : m_inputPorts.Count ), category ); + m_inputPorts.Add( port ); + m_inputPortsDict.Add( port.PortId, port ); + SetSaveIsDirty(); + m_sizeIsDirty = true; + return port; + } + + public InputPort AddInputPort( WirePortDataType type, bool typeLocked, string name, string dataName, int orderId = -1, MasterNodePortCategory category = MasterNodePortCategory.Fragment, int uniquePortId = -1 ) + { + InputPort port = new InputPort( m_uniqueId, ( uniquePortId < 0 ? m_inputPorts.Count : uniquePortId ), type, name, dataName, typeLocked, ( orderId >= 0 ? orderId : m_inputPorts.Count ), category ); + m_inputPorts.Add( port ); + m_inputPortsDict.Add( port.PortId, port ); + SetSaveIsDirty(); + m_sizeIsDirty = true; + return port; + } + + public InputPort AddInputPortAt( int idx, WirePortDataType type, bool typeLocked, string name, int orderId = -1, MasterNodePortCategory category = MasterNodePortCategory.Fragment, int uniquePortId = -1 ) + { + InputPort port = new InputPort( m_uniqueId, ( uniquePortId < 0 ? m_inputPorts.Count : uniquePortId ), type, name, typeLocked, ( orderId >= 0 ? orderId : m_inputPorts.Count ), category ); + m_inputPorts.Insert( idx, port ); + m_inputPortsDict.Add( port.PortId, port ); + SetSaveIsDirty(); + m_sizeIsDirty = true; + RecalculateInputPortIdx(); + return port; + } + + public void AddOutputPort( WirePortDataType type, string name, int uniquePortId = -1 ) + { + m_outputPorts.Add( new OutputPort( this, m_uniqueId, ( uniquePortId < 0 ? m_outputPorts.Count : uniquePortId ), type, name ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + SetSaveIsDirty(); + m_sizeIsDirty = true; + } + + public void AddOutputPortAt( int idx, WirePortDataType type, string name, int uniquePortId = -1 ) + { + OutputPort port = new OutputPort( this, m_uniqueId, ( uniquePortId < 0 ? m_outputPorts.Count : uniquePortId ), type, name ); + m_outputPorts.Insert( idx, port ); + m_outputPortsDict.Add( port.PortId, port ); + SetSaveIsDirty(); + m_sizeIsDirty = true; + } + + public void AddOutputVectorPorts( WirePortDataType type, string name ) + { + m_sizeIsDirty = true; + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, type, name ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + + switch( type ) + { + case WirePortDataType.FLOAT2: + { + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "X" ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "Y" ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + } + break; + case WirePortDataType.FLOAT3: + { + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "X" ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "Y" ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "Z" ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + } + break; + case WirePortDataType.FLOAT4: + { + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "X" ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "Y" ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "Z" ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "W" ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + } + break; + } + SetSaveIsDirty(); + } + + public void SetPreviewDirtyFromOutputs() + { + PreviewIsDirty = true; + } + + public string GetOutputVectorItem( int vectorPortId, int currentPortId, string result ) + { + if( m_outputPorts[ 0 ].DataType == WirePortDataType.COLOR ) + { + switch( currentPortId - vectorPortId ) + { + case 1: result += ".r"; break; + case 2: result += ".g"; break; + case 3: result += ".b"; break; + case 4: result += ".a"; break; + case 5: result += ".rgb"; break; + } + } + else + { + switch( currentPortId - vectorPortId ) + { + case 1: result += ".x"; break; + case 2: result += ".y"; break; + case 3: result += ".z"; break; + case 4: result += ".w"; break; + case 5: result += ".xyz"; break; + } + } + return result; + } + + public void AddOutputColorPorts( string name = "RGBA", bool addAlpha = true, bool addRGB = false ) + { + m_sizeIsDirty = true; + + // RGBA port + int startOrderId = ( m_outputPorts.Count > 0 ) ? m_outputPorts[ m_outputPorts.Count - 1 ].OrderId : 0; + + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, addAlpha ? WirePortDataType.COLOR : WirePortDataType.FLOAT3, name ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + m_outputPorts[ m_outputPorts.Count - 1 ].OrderId = startOrderId; + + // Red port + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "R" ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + m_outputPorts[ m_outputPorts.Count - 1 ].CustomColor = Color.red; + m_outputPorts[ m_outputPorts.Count - 1 ].OrderId = startOrderId + 2; + + // Green port + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "G" ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + m_outputPorts[ m_outputPorts.Count - 1 ].CustomColor = Color.green; + m_outputPorts[ m_outputPorts.Count - 1 ].OrderId = startOrderId + 3; + + // Blue port + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "B" ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + m_outputPorts[ m_outputPorts.Count - 1 ].CustomColor = Color.blue; + m_outputPorts[ m_outputPorts.Count - 1 ].OrderId = startOrderId + 4; + + if ( addAlpha ) + { + // Alpha port + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "A" ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + m_outputPorts[ m_outputPorts.Count - 1 ].CustomColor = Color.white; + m_outputPorts[ m_outputPorts.Count - 1 ].OrderId = startOrderId + 5; + } + + if ( addRGB && addAlpha ) + { + // RGB port (placed below RGBA) + m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT3, "RGB" ) ); + m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); + m_outputPorts[ m_outputPorts.Count - 1 ].OrderId = startOrderId + 1; + } + } + + public void ConvertFromVectorToColorPorts() + { + m_outputPorts[ 0 ].ChangeType( WirePortDataType.COLOR, false ); + + m_outputPorts[ 1 ].Name = "R"; + m_outputPorts[ 1 ].CustomColor = Color.red; + + m_outputPorts[ 2 ].Name = "G"; + m_outputPorts[ 2 ].CustomColor = Color.green; + + m_outputPorts[ 3 ].Name = "B"; + m_outputPorts[ 3 ].CustomColor = Color.blue; + + m_outputPorts[ 4 ].Name = "A"; + m_outputPorts[ 4 ].CustomColor = Color.white; + } + + + public string GetOutputColorItem( int vectorPortId, int currentPortId, string result ) + { + switch( currentPortId - vectorPortId ) + { + case 1: result += ".r"; break; + case 2: result += ".g"; break; + case 3: result += ".b"; break; + case 4: result += ".a"; break; + case 5: result += ".rgb"; break; + } + return result; + } + + public void ChangeOutputType( WirePortDataType type, bool invalidateConnections ) + { + int outputCount = m_outputPorts.Count; + for( int i = 0; i < outputCount; i++ ) + { + m_outputPorts[ i ].ChangeType( type, invalidateConnections ); + } + } + + public void ChangeInputType( WirePortDataType type, bool invalidateConnections ) + { + int inputCount = m_inputPorts.Count; + for( int i = 0; i < inputCount; i++ ) + { + m_inputPorts[ i ].ChangeType( type, invalidateConnections ); + } + } + + public void ChangeOutputProperties( int outputID, string newName, WirePortDataType newType, bool invalidateConnections = true ) + { + if( outputID < m_outputPorts.Count ) + { + m_outputPorts[ outputID ].ChangeProperties( newName, newType, invalidateConnections ); + IsDirty = true; + m_sizeIsDirty = true; + SetSaveIsDirty(); + } + } + + public void ChangeOutputName( int outputArrayIdx, string newName ) + { + if( outputArrayIdx < m_outputPorts.Count ) + { + m_outputPorts[ outputArrayIdx ].Name = newName; + IsDirty = true; + m_sizeIsDirty = true; + } + } + + public InputPort CheckInputPortAt( Vector3 pos ) + { + int count = m_inputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( m_inputPorts[ i ].InsideActiveArea( pos ) ) + return m_inputPorts[ i ]; + } + return null; + } + + public InputPort GetFirstInputPortOfType( WirePortDataType dataType, bool countObjectTypeAsValid ) + { + int count = m_inputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( ( m_inputPorts[ i ].CheckValidType( dataType ) ) || ( countObjectTypeAsValid && m_inputPorts[ i ].DataType == WirePortDataType.OBJECT ) ) + return m_inputPorts[ i ]; + } + return null; + } + + public OutputPort CheckOutputPortAt( Vector3 pos ) + { + int count = m_outputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( m_outputPorts[ i ].InsideActiveArea( pos ) ) + return m_outputPorts[ i ]; + } + return null; + } + + public OutputPort GetFirstOutputPortOfType( WirePortDataType dataType, bool checkForCasts ) + { + int count = m_outputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( ( m_outputPorts[ i ].CheckValidType( dataType ) ) || ( checkForCasts && UIUtils.CanCast( dataType, m_outputPorts[ i ].DataType ) ) ) + return m_outputPorts[ i ]; + } + return null; + } + + virtual protected void ChangeSizeFinished() { m_firstPreviewDraw = true; /*MarkForPreviewUpdate();*/ } + protected void ChangeSize() + { + m_cachedPos = m_position; + //UIUtils.ResetMainSkin(); + + Vector2 inSize = Vector2.zero; + int inputCount = 0; + int inputSize = m_inputPorts.Count; + for( int i = 0; i < inputSize; i++ ) + { + if( m_inputPorts[ i ].Visible ) + { + if( m_inputPorts[ i ].DirtyLabelSize || m_inputPorts[ i ].LabelSize == Vector2.zero ) + { + m_inputPorts[ i ].DirtyLabelSize = false; + m_sizeContentAux.text = m_inputPorts[ i ].Name; + m_inputPorts[ i ].UnscaledLabelSize = UIUtils.UnZoomedInputPortStyle.CalcSize( m_sizeContentAux ); + } + + inSize.x = Mathf.Max( inSize.x, m_inputPorts[ i ].UnscaledLabelSize.x ); + inSize.y = Mathf.Max( inSize.y, m_inputPorts[ i ].UnscaledLabelSize.y ); + inputCount += 1; + } + } + if( inSize.x > 0 ) + inSize.x += UIUtils.PortsSize.x + Constants.PORT_TO_LABEL_SPACE_X * 2; + inSize.x += m_marginPreviewLeft; + inSize.y = Mathf.Max( inSize.y, UIUtils.PortsSize.y ); + + + Vector2 outSize = Vector2.zero; + int outputCount = 0; + int outputSize = m_outputPorts.Count; + for( int i = 0; i < outputSize; i++ ) + { + if( m_outputPorts[ i ].Visible ) + { + if( m_outputPorts[ i ].DirtyLabelSize || m_outputPorts[ i ].LabelSize == Vector2.zero ) + { + m_outputPorts[ i ].DirtyLabelSize = false; + m_sizeContentAux.text = m_outputPorts[ i ].Name; + m_outputPorts[ i ].UnscaledLabelSize = UIUtils.UnZoomedOutputPortPortStyle.CalcSize( m_sizeContentAux ); + } + + outSize.x = Mathf.Max( outSize.x, m_outputPorts[ i ].UnscaledLabelSize.x ); + outSize.y = Mathf.Max( outSize.y, m_outputPorts[ i ].UnscaledLabelSize.y ); + outputCount += 1; + } + } + if( outSize.x > 0 ) + outSize.x += UIUtils.PortsSize.x + Constants.PORT_TO_LABEL_SPACE_X * 2; + outSize.y = Mathf.Max( outSize.y, UIUtils.PortsSize.y ); + + if( m_additionalContent.text.Length > 0 ) + { + m_extraHeaderHeight = (int)Constants.NODE_HEADER_EXTRA_HEIGHT; + m_hasSubtitle = true && m_showSubtitle; + } + else + { + m_extraHeaderHeight = 0; + m_hasSubtitle = false; + } + + float headerWidth = Mathf.Max( UIUtils.UnZoomedNodeTitleStyle.CalcSize( m_content ).x + m_paddingTitleLeft + m_paddingTitleRight, UIUtils.UnZoomedPropertyValuesTitleStyle.CalcSize( m_additionalContent ).x + m_paddingTitleLeft + m_paddingTitleRight ); + m_position.width = Mathf.Max(headerWidth, Mathf.Max(MinInsideBoxWidth, m_insideSize.x) + inSize.x + outSize.x);/* + Constants.NODE_HEADER_LEFTRIGHT_MARGIN * 2;*/ + m_position.width = Mathf.Round(m_position.width / 32) * 32 + 32; + //m_position.width += m_extraSize.x; + + m_fontHeight = Mathf.Max( inSize.y, outSize.y ); + + m_position.height = Mathf.Max( inputCount, outputCount ) * ( m_fontHeight + Constants.INPUT_PORT_DELTA_Y );// + Constants.INPUT_PORT_DELTA_Y; + m_position.height = Mathf.Max( m_position.height, Mathf.Max( MinInsideBoxHeight, m_insideSize.y ) ); + m_position.height += UIUtils.HeaderMaxHeight + /*m_extraHeaderHeight +*/ Constants.INPUT_PORT_DELTA_Y;// + m_extraSize.y; + if( m_showErrorMessage ) + m_position.height += 24; + + m_unpreviewedPosition = m_position; + //UIUtils.CurrentWindow.CameraDrawInfo.InvertedZoom = cachedZoom; + if( OnNodeChangeSizeEvent != null ) + { + OnNodeChangeSizeEvent( this ); + } + ChangeSizeFinished(); + } + + public virtual void Reset() { } + public virtual void OnOutputPortConnected( int portId, int otherNodeId, int otherPortId ) { } + + public virtual void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + InputPort port = GetInputPortByUniqueId( portId ); + if( activateNode && m_connStatus == NodeConnectionStatus.Connected ) + { + port.GetOutputNode().ActivateNode( m_activeNode, m_activePort, m_activeType ); + } + + PreviewIsDirty = true; + OnNodeChange(); + SetSaveIsDirty(); + } + + public virtual void OnInputPortDisconnected( int portId ) { PreviewIsDirty = true; OnNodeChange(); } + public virtual void OnOutputPortDisconnected( int portId ) { } + + public virtual void OnNodeChange() + { + CheckSpherePreview(); + int count = m_outputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( m_outputPorts[ i ].IsConnected ) + { + for( int f = 0; f < m_outputPorts[ i ].ExternalReferences.Count; f++ ) + { + ContainerGraph.GetNode( m_outputPorts[ i ].ExternalReferences[ f ].NodeId ).OnNodeChange(); + } + } + } + } + + public virtual void ActivateNode( int signalGenNodeId, int signalGenPortId, System.Type signalGenNodeType ) + { + if( m_selfPowered ) + return; + + ConnStatus = m_restrictions.GetRestiction( signalGenNodeType, signalGenPortId ) ? NodeConnectionStatus.Error : NodeConnectionStatus.Connected; + m_activeConnections += 1; + + if( m_activeConnections == 1 ) + { + m_activeType = signalGenNodeType; + m_activeNode = signalGenNodeId; + m_activePort = signalGenPortId; + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + m_inputPorts[ i ].GetOutputNode().ActivateNode( signalGenNodeId, signalGenPortId, signalGenNodeType ); + } + } + } + // saveisdirty might be needed, gonna leave this here for now + // SetSaveIsDirty(); + } + + public virtual void DeactivateInputPortNode( int deactivatedPort, bool forceComplete ) + { + GetInputPortByUniqueId( deactivatedPort ).GetOutputNode().DeactivateNode( deactivatedPort, false ); + } + + public virtual void DeactivateNode( int deactivatedPort, bool forceComplete ) + { + if( m_selfPowered ) + return; + + // saveisdirty might be needed, gonna leave this here for now + // SetSaveIsDirty(); + m_activeConnections -= 1; + if( forceComplete || m_activeConnections <= 0 ) + { + m_activeConnections = 0; + ConnStatus = NodeConnectionStatus.Not_Connected; + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + ParentNode node = m_inputPorts[ i ].GetOutputNode(); + if( node != null ) + node.DeactivateNode( deactivatedPort == -1 ? m_inputPorts[ i ].PortId : deactivatedPort, false ); + } + } + } + } + + public Rect GlobalToLocalPosition( DrawInfo drawInfo ) + { + float width = m_globalPosition.width / drawInfo.InvertedZoom; + float height = m_globalPosition.height / drawInfo.InvertedZoom; + + float x = m_globalPosition.x / drawInfo.InvertedZoom - drawInfo.CameraOffset.x; + float y = m_globalPosition.y / drawInfo.InvertedZoom - drawInfo.CameraOffset.y; + return new Rect( x, y, width, height ); + } + + protected void CalculatePositionAndVisibility( DrawInfo drawInfo ) + { + //m_movingInFrame = false; + m_globalPosition = m_position; + m_globalPosition.x = drawInfo.InvertedZoom * ( m_globalPosition.x + drawInfo.CameraOffset.x ); + m_globalPosition.y = drawInfo.InvertedZoom * ( m_globalPosition.y + drawInfo.CameraOffset.y ); + m_globalPosition.width *= drawInfo.InvertedZoom; + m_globalPosition.height *= drawInfo.InvertedZoom; + + m_isVisible = ( m_globalPosition.x + m_globalPosition.width > 0 ) && + ( m_globalPosition.x < drawInfo.CameraArea.width ) && + ( m_globalPosition.y + m_globalPosition.height > 0 ) && + ( m_globalPosition.y < drawInfo.CameraArea.height ); + + if( m_isMoving > 0 && drawInfo.CurrentEventType != EventType.MouseDrag ) + { + float deltaX = Mathf.Abs( m_lastPosition.x - m_position.x ); + float deltaY = Mathf.Abs( m_lastPosition.y - m_position.y ); + if( deltaX < 0.01f && deltaY < 0.01f ) + { + m_isMoving -= 1; + if( m_isMoving == 0 ) + { + OnSelfStoppedMovingEvent(); + } + } + else + { + m_isMoving = MoveCountBuffer; + } + m_lastPosition = m_position; + } + } + + public void FireStoppedMovingEvent( bool testOnlySelected, InteractionMode interactionMode ) + { + if( OnNodeStoppedMovingEvent != null ) + OnNodeStoppedMovingEvent( this, testOnlySelected, interactionMode ); + } + + public virtual void OnSelfStoppedMovingEvent() + { + FireStoppedMovingEvent( true, m_defaultInteractionMode ); + } + + protected void DrawPrecisionProperty( bool withInherit = true ) + { + if( withInherit ) + m_currentPrecisionType = (PrecisionType)EditorGUILayoutPopup( PrecisionContent.text, (int)m_currentPrecisionType, PrecisionLabelsExtra ); + else + m_currentPrecisionType = (PrecisionType)EditorGUILayoutPopup( PrecisionContent.text, (int)m_currentPrecisionType, PrecisionLabels ); + } + + public virtual void DrawTitle( Rect titlePos ) + { + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + GUI.Label( titlePos, m_content, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); + } + } + + public virtual void DrawPreview( DrawInfo drawInfo, Rect rect ) + { + //if ( !m_drawPreview ) + // return; + + if( m_cachedDrawSphereId == -1 ) + m_cachedDrawSphereId = Shader.PropertyToID( "_DrawSphere" ); + + if( m_cachedInvertedZoomId == -1 ) + m_cachedInvertedZoomId = Shader.PropertyToID( "_InvertedZoom" ); + + m_channelNumber = 0; + Vector4 mask = Vector4.one; + if( m_outputPorts.Count > 0 ) + { + switch( m_outputPorts[ 0 ].DataType ) + { + case WirePortDataType.FLOAT: + m_channelNumber = 1; + mask.Set( 1, 1, 1, 0 ); + break; + case WirePortDataType.FLOAT2: + m_channelNumber = 2; + mask.Set( m_previewChannels[ 0 ] ? 1 : 0, m_previewChannels[ 1 ] ? 1 : 0, 1, 0 ); + break; + case WirePortDataType.COLOR: + case WirePortDataType.FLOAT4: + case WirePortDataType.SAMPLER1D: + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.SAMPLER2DARRAY: + m_channelNumber = 4; + mask.Set( m_previewChannels[ 0 ] ? 1 : 0, m_previewChannels[ 1 ] ? 1 : 0, m_previewChannels[ 2 ] ? 1 : 0, m_previewChannels[ 3 ] ? 1 : 0 ); + break; + default: + m_channelNumber = 3; + mask.Set( m_previewChannels[ 0 ] ? 1 : 0, m_previewChannels[ 1 ] ? 1 : 0, m_previewChannels[ 2 ] ? 1 : 0, 0 ); + break; + } + } + + UIUtils.LinearMaterial.SetFloat( m_cachedDrawSphereId, ( SpherePreview ? 1 : 0 ) ); + UIUtils.LinearMaterial.SetFloat( m_cachedInvertedZoomId, drawInfo.InvertedZoom ); + UIUtils.LinearMaterial.SetVector( "_Mask", mask ); + + bool cached = GL.sRGBWrite; + GL.sRGBWrite = true; + //EditorGUI.DrawPreviewTexture( rect, PreviewTexture, UIUtils.LinearMaterial ); + int pass = 0; + if( SpherePreview ) + { + if( mask.w == 1 ) + pass = 3; + else + pass = 1; + } + else if( mask.w == 1 ) + pass = 2; + + Graphics.DrawTexture( rect, PreviewTexture, UIUtils.LinearMaterial, pass ); + GL.sRGBWrite = cached; + //Preview buttons + if( m_drawPreviewMaskButtons ) + DrawPreviewMaskButtonsRepaint( drawInfo, rect ); + } + + protected void DrawPreviewMaskButtonsLayout( DrawInfo drawInfo, Rect rect ) + { + if( rect.Contains( drawInfo.MousePosition ) && m_channelNumber > 1 && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) + { + Rect buttonRect = rect; + buttonRect.height = 14 * drawInfo.InvertedZoom; + buttonRect.y = rect.yMax - buttonRect.height; + buttonRect.width = 14 * drawInfo.InvertedZoom; + + if( m_channelNumber == 2 ) + { + m_previewChannels[ 0 ] = GUI.Toggle( buttonRect, m_previewChannels[ 0 ], string.Empty, GUIStyle.none ); + buttonRect.x += 14 * drawInfo.InvertedZoom; + m_previewChannels[ 1 ] = GUI.Toggle( buttonRect, m_previewChannels[ 1 ], string.Empty, GUIStyle.none ); + } + else if( m_channelNumber == 3 ) + { + m_previewChannels[ 0 ] = GUI.Toggle( buttonRect, m_previewChannels[ 0 ], string.Empty, GUIStyle.none ); + buttonRect.x += 14 * drawInfo.InvertedZoom; + m_previewChannels[ 1 ] = GUI.Toggle( buttonRect, m_previewChannels[ 1 ], string.Empty, GUIStyle.none ); + buttonRect.x += 14 * drawInfo.InvertedZoom; + m_previewChannels[ 2 ] = GUI.Toggle( buttonRect, m_previewChannels[ 2 ], string.Empty, GUIStyle.none ); + } + else if( m_channelNumber == 4 ) + { + m_previewChannels[ 0 ] = GUI.Toggle( buttonRect, m_previewChannels[ 0 ], string.Empty, GUIStyle.none ); + buttonRect.x += 14 * drawInfo.InvertedZoom; + m_previewChannels[ 1 ] = GUI.Toggle( buttonRect, m_previewChannels[ 1 ], string.Empty, GUIStyle.none ); + buttonRect.x += 14 * drawInfo.InvertedZoom; + m_previewChannels[ 2 ] = GUI.Toggle( buttonRect, m_previewChannels[ 2 ], string.Empty, GUIStyle.none ); + buttonRect.x += 14 * drawInfo.InvertedZoom; + m_previewChannels[ 3 ] = GUI.Toggle( buttonRect, m_previewChannels[ 3 ], string.Empty, GUIStyle.none ); + } + } + } + + protected void DrawPreviewMaskButtonsRepaint( DrawInfo drawInfo, Rect rect ) + { + if( drawInfo.CurrentEventType == EventType.Repaint && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 && rect.Contains( drawInfo.MousePosition ) && m_channelNumber > 1 ) + { + Rect buttonRect = rect; + buttonRect.height = 14 * drawInfo.InvertedZoom; + buttonRect.y = rect.yMax - buttonRect.height; + buttonRect.width = 14 * drawInfo.InvertedZoom; + + if( m_channelNumber == 2 ) + { + UIUtils.MiniButtonTopMid.Draw( buttonRect, "R", false, false, m_previewChannels[ 0 ], false ); + buttonRect.x += 14 * drawInfo.InvertedZoom; + UIUtils.MiniButtonTopRight.Draw( buttonRect, "G", false, false, m_previewChannels[ 1 ], false ); + } + else if( m_channelNumber == 3 ) + { + UIUtils.MiniButtonTopMid.Draw( buttonRect, "R", false, false, m_previewChannels[ 0 ], false ); + buttonRect.x += 14 * drawInfo.InvertedZoom; + UIUtils.MiniButtonTopMid.Draw( buttonRect, "G", false, false, m_previewChannels[ 1 ], false ); + buttonRect.x += 14 * drawInfo.InvertedZoom; + UIUtils.MiniButtonTopRight.Draw( buttonRect, "B", false, false, m_previewChannels[ 2 ], false ); + } + else if( m_channelNumber == 4 ) + { + UIUtils.MiniButtonTopMid.Draw( buttonRect, "R", false, false, m_previewChannels[ 0 ], false ); + buttonRect.x += 14 * drawInfo.InvertedZoom; + UIUtils.MiniButtonTopMid.Draw( buttonRect, "G", false, false, m_previewChannels[ 1 ], false ); + buttonRect.x += 14 * drawInfo.InvertedZoom; + UIUtils.MiniButtonTopMid.Draw( buttonRect, "B", false, false, m_previewChannels[ 2 ], false ); + buttonRect.x += 14 * drawInfo.InvertedZoom; + UIUtils.MiniButtonTopRight.Draw( buttonRect, "A", false, false, m_previewChannels[ 3 ], false ); + } + } + } + + public void SetTimedUpdate( double timerInterval ) + { + m_timedUpdateInitialValue = EditorApplication.timeSinceStartup; + m_timedUpdateInterval = timerInterval; + m_fireTimedUpdateRequest = true; + } + + public virtual void FireTimedUpdate() { } + /// + /// + /// + /// + public virtual void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + if( m_fireTimedUpdateRequest && ( EditorApplication.timeSinceStartup - m_timedUpdateInitialValue ) > m_timedUpdateInterval ) + { + m_fireTimedUpdateRequest = false; + FireTimedUpdate(); + } + + if( m_repopulateDictionaries ) + { + m_repopulateDictionaries = false; + + m_inputPortsDict.Clear(); + int inputCount = m_inputPorts.Count; + for( int i = 0; i < inputCount; i++ ) + { + m_inputPortsDict.Add( m_inputPorts[ i ].PortId, m_inputPorts[ i ] ); + } + + m_outputPortsDict.Clear(); + int outputCount = m_outputPorts.Count; + for( int i = 0; i < outputCount; i++ ) + { + m_outputPortsDict.Add( m_outputPorts[ i ].PortId, m_outputPorts[ i ] ); + } + } + } + + private void UpdateSortedInputPorts() + { + if ( m_sortInputPorts ) + { + m_sortedInputPorts.Clear(); + m_sortedInputPorts.AddRange( m_inputPorts ); + m_sortedInputPorts.Sort( ( x, y ) => x.OrderId.CompareTo( y.OrderId ) ); + } + else + { + m_sortedInputPorts = m_inputPorts; + } + } + + private void UpdateSortedOutputPorts() + { + if ( m_sortOutputPorts ) + { + m_sortedOutputPorts.Clear(); + m_sortedOutputPorts.AddRange( m_outputPorts ); + m_sortedOutputPorts.Sort( ( x, y ) => x.OrderId.CompareTo( y.OrderId ) ); + } + else + { + m_sortedOutputPorts = m_outputPorts; + } + + } + + /// + /// This method should only be called to calculate layouts of elements to be draw later, only runs once per frame and before wires are drawn + /// + /// + public virtual void OnNodeLayout( DrawInfo drawInfo ) + { + + if( ContainerGraph.ChangedLightingModel ) + { + m_sizeIsDirty = true; + m_firstPreviewDraw = true; + } + + if( m_firstDraw ) + { + m_firstDraw = false; + AfterCommonInit(); + OnNodeChange(); + } + + if( m_previousErrorMessage != m_showErrorMessage ) + { + m_sizeIsDirty = true; + } + + if( m_sizeIsDirty ) + { + m_sizeIsDirty = false; + ChangeSize(); + UpdateSortedInputPorts(); + UpdateSortedOutputPorts(); + } + + CalculatePositionAndVisibility( drawInfo ); + + m_unscaledRemainingBox = m_position; + m_remainingBox = m_globalPosition; + + m_lastInputBottomRight = m_position.position; + m_lastOutputBottomLeft = m_position.position; + m_lastOutputBottomLeft.x += m_position.width; + + m_visibleInputs = 0; + m_visibleOutputs = 0; + + if( m_hasSubtitle ) + m_extraHeaderHeight = (int)Constants.NODE_HEADER_EXTRA_HEIGHT; + else + m_extraHeaderHeight = 0; + + m_lastInputBottomRight.y += UIUtils.HeaderMaxHeight + m_extraHeaderHeight; + m_lastOutputBottomLeft.y += UIUtils.HeaderMaxHeight + m_extraHeaderHeight; + m_unscaledRemainingBox.y += UIUtils.HeaderMaxHeight + m_extraHeaderHeight; + + if( m_isVisible ) + { + // Header + m_headerPosition = m_globalPosition; + m_headerPosition.height = UIUtils.CurrentHeaderHeight + m_extraHeaderHeight * drawInfo.InvertedZoom; + + // Title + m_titlePos = m_globalPosition; + m_titlePos.height = m_headerPosition.height; + if( m_hasSubtitle ) + m_titlePos.yMin += ( 2 * drawInfo.InvertedZoom ); + else + m_titlePos.yMin += ( 8 * drawInfo.InvertedZoom ); + m_titlePos.width -= ( m_paddingTitleLeft + m_paddingTitleRight ) * drawInfo.InvertedZoom; + m_titlePos.x += m_paddingTitleLeft * drawInfo.InvertedZoom; + + // Additional Title + if( m_hasSubtitle ) + { + m_addTitlePos = m_titlePos; + m_addTitlePos.y = m_globalPosition.y; + m_addTitlePos.yMin += ( 15 * drawInfo.InvertedZoom ); + } + + // Left Dropdown + if( m_hasLeftDropdown && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) + { + m_dropdownRect = m_headerPosition; + m_dropdownRect.width = Constants.NodeButtonSizeX * drawInfo.InvertedZoom; + m_dropdownRect.x = m_globalPosition.x + ( Constants.IconsLeftRightMargin + 1 ) * drawInfo.InvertedZoom; + m_dropdownRect.height = Constants.NodeButtonSizeY * drawInfo.InvertedZoom; + m_dropdownRect.y = m_globalPosition.y + m_headerPosition.height * 0.5f - 14 * drawInfo.InvertedZoom * 0.5f; + } + + // Expander + if( m_drawPreviewExpander && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) + { + m_expandRect = m_globalPosition; + m_expandRect.width = Constants.PreviewExpanderWidth * drawInfo.InvertedZoom; + m_expandRect.x = m_globalPosition.x + m_globalPosition.width - ( Constants.IconsLeftRightMargin + Constants.PreviewExpanderWidth ) * drawInfo.InvertedZoom; //titlePos.x + titlePos.width; + m_expandRect.height = Constants.PreviewExpanderHeight * drawInfo.InvertedZoom; + m_expandRect.y = m_globalPosition.y + m_headerPosition.height * 0.5f - Constants.PreviewExpanderHeight * drawInfo.InvertedZoom * 0.5f; + } + } + + if( m_anchorAdjust < 0 ) + { + m_anchorAdjust = UIUtils.GetCustomStyle( CustomStyle.PortEmptyIcon ).normal.background.width; + } + + m_unscaledRemainingBox.y += Constants.INPUT_PORT_DELTA_Y; + m_lastOutputBottomLeft.y += Constants.INPUT_PORT_DELTA_Y; + m_lastInputBottomRight.y += Constants.INPUT_PORT_DELTA_Y; + + // Input Ports + { + m_currInputPortPos = m_globalPosition; + m_currInputPortPos.width = drawInfo.InvertedZoom * UIUtils.PortsSize.x; + m_currInputPortPos.height = drawInfo.InvertedZoom * UIUtils.PortsSize.y; + + m_currInputPortPos.x += drawInfo.InvertedZoom * Constants.PORT_INITIAL_X; + m_currInputPortPos.y += drawInfo.InvertedZoom * Constants.PORT_INITIAL_Y + m_extraHeaderHeight * drawInfo.InvertedZoom; + int inputCount = m_sortedInputPorts.Count; + + float initialX = m_lastInputBottomRight.x; + + for ( int i = 0; i < inputCount; i++ ) + { + if( m_sortedInputPorts[ i ].Visible ) + { + m_visibleInputs++; + // Button + m_sortedInputPorts[ i ].Position = m_currInputPortPos; + + // Label + m_sortedInputPorts[ i ].LabelPosition = m_currInputPortPos; + float deltaX = 1f * drawInfo.InvertedZoom * ( UIUtils.PortsSize.x + Constants.PORT_TO_LABEL_SPACE_X ); + m_auxRect = m_sortedInputPorts[ i ].LabelPosition; + m_auxRect.x += deltaX; + m_sortedInputPorts[ i ].LabelPosition = m_auxRect; + + //if( m_sortedInputPorts[ i ].DirtyLabelSize || m_sortedInputPorts[ i ].LabelSize == Vector2.zero ) + //{ + // m_sortedInputPorts[ i ].DirtyLabelSize = false; + // m_sizeContentAux.text = m_sortedInputPorts[ i ].Name; + // m_sortedInputPorts[ i ].UnscaledLabelSize = UIUtils.UnZoomedInputPortStyle.CalcSize( m_sizeContentAux ); + //} + + m_sortedInputPorts[ i ].LabelSize = m_sortedInputPorts[ i ].UnscaledLabelSize * drawInfo.InvertedZoom; + + m_lastInputBottomRight.x = Mathf.Max( m_lastInputBottomRight.x, initialX + m_sortedInputPorts[ i ].UnscaledLabelSize.x + Constants.PORT_INITIAL_X + Constants.PORT_TO_LABEL_SPACE_X + UIUtils.PortsSize.x ); + + if( !m_sortedInputPorts[ i ].Locked ) + { + float overflow = 2; + float scaledOverflow = 4 * drawInfo.InvertedZoom; + m_auxRect = m_currInputPortPos; + m_auxRect.yMin -= scaledOverflow + overflow; + m_auxRect.yMax += scaledOverflow + overflow; + m_auxRect.xMin -= Constants.PORT_INITIAL_X * drawInfo.InvertedZoom + scaledOverflow + overflow; + if( m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid ) + m_auxRect.xMax += m_sortedInputPorts[ i ].LabelSize.x + Constants.PORT_TO_LABEL_SPACE_X * drawInfo.InvertedZoom + scaledOverflow + overflow; + else + m_auxRect.xMax += Constants.PORT_TO_LABEL_SPACE_X * drawInfo.InvertedZoom + scaledOverflow + overflow; + m_sortedInputPorts[ i ].ActivePortArea = m_auxRect; + } + m_currInputPortPos.y += drawInfo.InvertedZoom * ( m_fontHeight + Constants.INPUT_PORT_DELTA_Y ); + //GUI.Label( m_sortedInputPorts[ i ].ActivePortArea, string.Empty, UIUtils.Box ); + } + } + if( m_visibleInputs > 0 ) + m_lastInputBottomRight.y += m_fontHeight * m_visibleInputs + Constants.INPUT_PORT_DELTA_Y * ( m_visibleInputs - 1 ); + } + + // Output Ports + { + m_currOutputPortPos = m_globalPosition; + m_currOutputPortPos.width = drawInfo.InvertedZoom * UIUtils.PortsSize.x; + m_currOutputPortPos.height = drawInfo.InvertedZoom * UIUtils.PortsSize.y; + + m_currOutputPortPos.x += ( m_globalPosition.width - drawInfo.InvertedZoom * ( Constants.PORT_INITIAL_X + m_anchorAdjust ) ); + m_currOutputPortPos.y += drawInfo.InvertedZoom * Constants.PORT_INITIAL_Y + m_extraHeaderHeight * drawInfo.InvertedZoom; + + float initialX = m_lastOutputBottomLeft.x; + + int outputCount = m_sortedOutputPorts.Count; + + for ( int i = 0; i < outputCount; i++ ) + { + if( m_sortedOutputPorts[ i ].Visible ) + { + m_visibleOutputs++; + //Button + m_sortedOutputPorts[ i ].Position = m_currOutputPortPos; + + // Label + m_sortedOutputPorts[ i ].LabelPosition = m_currOutputPortPos; + float deltaX = 1f * drawInfo.InvertedZoom * ( UIUtils.PortsSize.x + Constants.PORT_TO_LABEL_SPACE_X ); + m_auxRect = m_sortedOutputPorts[ i ].LabelPosition; + m_auxRect.x -= deltaX; + m_sortedOutputPorts[ i ].LabelPosition = m_auxRect; + + m_sortedOutputPorts[ i ].LabelSize = m_sortedOutputPorts[ i ].UnscaledLabelSize * drawInfo.InvertedZoom; + + m_lastOutputBottomLeft.x = Mathf.Min( m_lastOutputBottomLeft.x, initialX - m_sortedOutputPorts[ i ].UnscaledLabelSize.x - Constants.PORT_INITIAL_X - Constants.PORT_TO_LABEL_SPACE_X - UIUtils.PortsSize.x ); + + if( !m_sortedOutputPorts[ i ].Locked ) + { + float overflow = 2; + float scaledOverflow = 4 * drawInfo.InvertedZoom; + m_auxRect = m_currOutputPortPos; + m_auxRect.yMin -= scaledOverflow + overflow; + m_auxRect.yMax += scaledOverflow + overflow; + if( m_containerGraph.ParentWindow.WireReferenceUtils.InputPortReference.IsValid ) + m_auxRect.xMin -= m_sortedOutputPorts[ i ].LabelSize.x + Constants.PORT_TO_LABEL_SPACE_X * drawInfo.InvertedZoom + scaledOverflow + overflow; + else + m_auxRect.xMin -= Constants.PORT_TO_LABEL_SPACE_X * drawInfo.InvertedZoom + scaledOverflow + overflow; + m_auxRect.xMax += Constants.PORT_INITIAL_X * drawInfo.InvertedZoom + scaledOverflow + overflow; + m_sortedOutputPorts[ i ].ActivePortArea = m_auxRect; + } + m_currOutputPortPos.y += drawInfo.InvertedZoom * ( m_fontHeight + Constants.INPUT_PORT_DELTA_Y ); + //GUI.Label( m_sortedOutputPorts[ i ].ActivePortArea, string.Empty, UIUtils.Box ); + } + } + if( m_visibleOutputs > 0 ) + m_lastOutputBottomLeft.y += m_fontHeight * m_visibleOutputs + Constants.INPUT_PORT_DELTA_Y * ( m_visibleOutputs - 1 ); + } + + m_lastInputBottomRight.x += m_marginPreviewLeft; + + //Vector2 scaledLastOutputBottomLeft = ( m_lastOutputBottomLeft + drawInfo.CameraOffset ) * drawInfo.InvertedZoom; + //GUI.Label( new Rect( scaledLastOutputBottomLeft, Vector2.one * 2 ), string.Empty, UIUtils.CurrentWindow.CustomStylesInstance.Box ); + + m_unscaledRemainingBox.xMin = m_lastInputBottomRight.x; + //m_unscaledRemainingBox.yMin = m_lastInputBottomRight.y; + m_unscaledRemainingBox.xMax = m_lastOutputBottomLeft.x; + m_unscaledRemainingBox.yMax = Mathf.Max( m_lastOutputBottomLeft.y, m_lastInputBottomRight.y ); + + m_remainingBox.position = ( m_unscaledRemainingBox.position + drawInfo.CameraOffset ) * drawInfo.InvertedZoom; + m_remainingBox.size = m_unscaledRemainingBox.size * drawInfo.InvertedZoom; + + //GUI.Label( m_remainingBox, string.Empty, UIUtils.Box ); + + if( m_visibleInputs == 0 ) + { + m_remainingBox.x += Constants.PORT_INITIAL_X * drawInfo.InvertedZoom; + m_remainingBox.width -= Constants.PORT_INITIAL_X * drawInfo.InvertedZoom; + } + + if( m_visibleOutputs == 0 ) + { + m_remainingBox.width -= Constants.PORT_INITIAL_X * drawInfo.InvertedZoom; + } + + if( ContainerGraph.ParentWindow.GlobalPreview != m_globalShowPreview ) + { + m_globalShowPreview = ContainerGraph.ParentWindow.GlobalPreview; + m_sizeIsDirty = true; + ContainerGraph.ParentWindow.RequestRepaint(); + } + + // Generate Proper Preview Rect + float marginAround = 10; + float scaledMarginAround = marginAround * drawInfo.InvertedZoom; + float previewSize = 128; + PreviewLocation m_autoLocation = m_selectedLocation; + if( m_selectedLocation == PreviewLocation.Auto ) + { + if( m_visibleOutputs > m_visibleInputs ) + { + m_autoLocation = PreviewLocation.Left; + } + else if( m_visibleOutputs < m_visibleInputs ) + { + m_autoLocation = PreviewLocation.Right; + } + else if( m_unscaledRemainingBox.width > previewSize ) + { + m_autoLocation = PreviewLocation.TopCenter; + } + else + { + m_autoLocation = PreviewLocation.BottomCenter; + } + } + + if( m_canExpand && ( m_showPreview || m_globalShowPreview ) ) + { + if( m_autoLocation == PreviewLocation.TopCenter ) + { + m_unscaledPreviewRect.y = m_unscaledRemainingBox.y; + m_unscaledPreviewRect.x = m_unscaledRemainingBox.center.x - 0.5f * ( previewSize + 2 * marginAround ); + } + else if( m_autoLocation == PreviewLocation.BottomCenter ) + { + m_unscaledPreviewRect.y = Mathf.Max( m_lastOutputBottomLeft.y, m_lastInputBottomRight.y ); + m_unscaledPreviewRect.x = m_position.x + 0.5f * m_position.width - 0.5f * ( previewSize + 2 * marginAround ); + } + else if( m_autoLocation == PreviewLocation.Left ) + { + m_unscaledPreviewRect.y = m_lastInputBottomRight.y; + m_unscaledPreviewRect.x = m_position.x; + } + else if( m_autoLocation == PreviewLocation.Right ) + { + m_unscaledPreviewRect.y = m_lastOutputBottomLeft.y; + m_unscaledPreviewRect.x = m_lastInputBottomRight.x; + } + if( m_autoLocation == PreviewLocation.BottomCenter ) + m_unscaledPreviewRect.height = previewSize + 2 * marginAround; + else if( m_autoLocation == PreviewLocation.TopCenter ) + m_unscaledPreviewRect.height = previewSize + marginAround; + else + m_unscaledPreviewRect.height = previewSize + ( m_visibleInputs > 0 && m_visibleOutputs > 0 ? 2 * marginAround : marginAround ); + m_unscaledPreviewRect.width = previewSize + 2 * marginAround; + + m_previewRect = m_unscaledPreviewRect; + m_previewRect.position = ( m_previewRect.position + drawInfo.CameraOffset ) * drawInfo.InvertedZoom; + m_auxVector2.Set( previewSize * drawInfo.InvertedZoom, previewSize * drawInfo.InvertedZoom ); + m_previewRect.size = m_auxVector2; + + if( m_autoLocation == PreviewLocation.BottomCenter ) + { + m_auxVector2.Set( m_previewRect.position.x + scaledMarginAround, m_previewRect.position.y + scaledMarginAround ); + m_previewRect.position = m_auxVector2; + } + else if( m_autoLocation == PreviewLocation.TopCenter ) + { + m_auxVector2.Set( m_previewRect.position.x + scaledMarginAround, m_previewRect.position.y ); + m_previewRect.position = m_auxVector2; + } + else + { + m_previewRect.position += new Vector2( scaledMarginAround, ( m_visibleInputs > 0 && m_visibleOutputs > 0 ? scaledMarginAround : 0 ) ); + } + } + + // Adjust node rect after preview + if( m_firstPreviewDraw ) + { + m_firstPreviewDraw = false; + ContainerGraph.ParentWindow.RequestRepaint(); + if( m_canExpand && ( m_showPreview || m_globalShowPreview ) ) + { + if( m_autoLocation == PreviewLocation.TopCenter ) + { + float fillWidth = m_unscaledRemainingBox.width - m_unscaledPreviewRect.width; + m_extraSize.x = Mathf.Max( -fillWidth, 0 ); + float fillHeight = m_position.yMax - m_unscaledPreviewRect.yMax; + m_extraSize.y = Mathf.Max( -fillHeight, 0 ); + } + if( m_autoLocation == PreviewLocation.BottomCenter ) + { + float fillWidth = m_position.width - m_unscaledPreviewRect.width; + m_extraSize.x = Mathf.Max( -fillWidth, 0 ); + float fillHeight = m_position.yMax - m_unscaledPreviewRect.yMax; + m_extraSize.y = Mathf.Max( -fillHeight, 0 ); + } + else if( m_autoLocation == PreviewLocation.Left ) + { + float fillWidth = m_lastOutputBottomLeft.x - m_unscaledPreviewRect.xMax; + m_extraSize.x = Mathf.Max( -fillWidth, 0 ); + float fillHeight = m_position.yMax - m_unscaledPreviewRect.yMax; + m_extraSize.y = Mathf.Max( -fillHeight, 0 ); + } + else if( m_autoLocation == PreviewLocation.Right ) + { + float fillWidth = m_position.xMax - m_unscaledPreviewRect.xMax; + m_extraSize.x = Mathf.Max( -fillWidth, 0 ); + float fillHeight = m_position.yMax - m_unscaledPreviewRect.yMax; + m_extraSize.y = Mathf.Max( -fillHeight, 0 ); + } + + if( m_showErrorMessage ) + m_extraSize.y += 24; + } + else if( m_canExpand ) + { + m_extraSize.y = 0; + m_extraSize.x = 0; + } + + m_position.width = m_unpreviewedPosition.width + m_extraSize.x; + m_position.height = m_unpreviewedPosition.height + m_extraSize.y; + } + + + if( m_showErrorMessage ) + { + m_errorBox = m_globalPosition; + m_errorBox.y = ( m_globalPosition.yMax - 28 * drawInfo.InvertedZoom ) + 3 * drawInfo.InvertedZoom; + m_errorBox.height = 25 * drawInfo.InvertedZoom; + } + + m_previousErrorMessage = m_showErrorMessage; + } + + /// + /// This method should only be called to draw elements, runs once per frame and after wires are drawn + /// + /// + public virtual void OnNodeRepaint( DrawInfo drawInfo ) + { + if( !m_isVisible ) + return; + + m_colorBuffer = GUI.color; + // Background + GUI.color = m_infiniteLoopDetected ? Constants.InfiniteLoopColor : Constants.NodeBodyColor; + if( m_useSquareNodeTitle || ContainerGraph.LodLevel >= ParentGraph.NodeLOD.LOD2 ) + GUI.Label( m_globalPosition, string.Empty, UIUtils.NodeWindowOffSquare ); + else + GUI.Label( m_globalPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeWindowOff ) ); + + // Header + //GUI + GUI.color = m_headerColor * m_headerColorModifier; + if( m_useSquareNodeTitle || ContainerGraph.LodLevel >= ParentGraph.NodeLOD.LOD2 ) + GUI.Label( m_headerPosition, string.Empty, UIUtils.NodeHeaderSquare ); + else + GUI.Label( m_headerPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeHeader ) ); + GUI.color = m_colorBuffer; + + // @diogo: shader function icon + var functionNode = this as FunctionNode; + if ( functionNode != null ) + { + float scaledSize = FunctionNode.HeaderIconSize * drawInfo.InvertedZoom; + GUI.DrawTexture( new Rect( m_globalPosition.x, m_globalPosition.y, scaledSize, scaledSize ), functionNode.HeaderIcon, ScaleMode.ScaleAndCrop, true ); + } + + // Title + DrawTitle( m_titlePos ); + + // Additional Tile + if( m_hasSubtitle && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + GUI.Label( m_addTitlePos, m_additionalContent, UIUtils.GetCustomStyle( CustomStyle.PropertyValuesTitle ) ); + + // Dropdown + if( m_hasLeftDropdown && !m_dropdownEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) + GUI.Label( m_dropdownRect, string.Empty, UIUtils.PropertyPopUp ); + + // Expander + if( m_drawPreviewExpander && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) + GUI.Label( m_expandRect, string.Empty, ( m_showPreview ? UIUtils.PreviewCollapser : UIUtils.PreviewExpander ) ); + + // Input Ports + int inputCount = m_inputPorts.Count; + + for( int i = 0; i < inputCount; i++ ) + { + if( m_inputPorts[ i ].Visible ) + { + // Input Port Icon + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) + { + if( m_inputPorts[ i ].Locked ) + GUI.color = Constants.LockedPortColor; + else if( ContainerGraph.ParentWindow.Options.ColoredPorts ) + GUI.color = UIUtils.GetColorForDataType( m_inputPorts[ i ].DataType, false, true ); + else + GUI.color = m_inputPorts[ i ].HasCustomColor ? m_inputPorts[ i ].CustomColor : UIUtils.GetColorForDataType( m_inputPorts[ i ].DataType, true, true ); + + GUIStyle style = m_inputPorts[ i ].IsConnected ? UIUtils.GetCustomStyle( CustomStyle.PortFullIcon ) : UIUtils.GetCustomStyle( CustomStyle.PortEmptyIcon ); + GUI.Label( m_inputPorts[ i ].Position, string.Empty, style ); + + GUI.color = m_colorBuffer; + } + + // Input Port Label + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + if( m_inputPorts[ i ].Locked ) + { + GUI.color = Constants.PortLockedTextColor; + GUI.Label( m_inputPorts[ i ].LabelPosition, m_inputPorts[ i ].Name, UIUtils.InputPortLabel ); + GUI.color = m_colorBuffer; + } + else + { + if( m_containerGraph.ParentWindow.GlobalShowInternalData && !m_inputPorts[ i ].IsConnected && UIUtils.InternalDataOnPort.fontSize > 1f && ( m_inputPorts[ i ].AutoDrawInternalData || ( m_autoDrawInternalPortData && m_useInternalPortData ) ) && m_inputPorts[ i ].DisplayInternalData.Length > 4 && ( ( m_inputPorts[ i ].DataType >= WirePortDataType.FLOAT && m_inputPorts[ i ].DataType <= WirePortDataType.INT ) || m_inputPorts[ i ].DataType == WirePortDataType.UINT ) ) + { + GUI.color = Constants.NodeBodyColor/* * new Color( 1f, 1f, 1f, 0.75f )*/; + Rect internalBox = m_inputPorts[ i ].LabelPosition; + m_sizeContentAux.text = m_inputPorts[ i ].DisplayInternalData; + Vector2 portText = UIUtils.InternalDataOnPort.CalcSize( m_sizeContentAux ); + internalBox.width = portText.x; + internalBox.height = portText.y; + internalBox.y = m_inputPorts[ i ].LabelPosition.center.y - internalBox.height * 0.5f; + internalBox.x = GlobalPosition.x - internalBox.width - 4 * drawInfo.InvertedZoom - 1; + Rect backBox = new Rect( internalBox ); + backBox.xMin -= 4 * drawInfo.InvertedZoom; + backBox.xMax += 4 * drawInfo.InvertedZoom; + backBox.yMin -= 2 * drawInfo.InvertedZoom; + backBox.yMax += 2 * drawInfo.InvertedZoom; + GUI.Label( backBox, string.Empty, UIUtils.InternalDataBackground ); + GUI.color *= new Color( 1f, 1f, 1f, 0.5f ); + GUI.Label( internalBox, m_sizeContentAux, UIUtils.InternalDataOnPort ); + GUI.color = m_colorBuffer; + } + GUI.Label( m_inputPorts[ i ].LabelPosition, m_inputPorts[ i ].Name, UIUtils.InputPortLabel ); + } + } + } + } + + // Output Ports + int outputCount = m_outputPorts.Count; + for( int i = 0; i < outputCount; i++ ) + { + if( m_outputPorts[ i ].Visible ) + { + // Output Port Icon + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) + { + if( m_outputPorts[ i ].Locked ) + GUI.color = Constants.LockedPortColor; + else if( ContainerGraph.ParentWindow.Options.ColoredPorts ) + GUI.color = UIUtils.GetColorForDataType( m_outputPorts[ i ].DataType, false, false ); + else + GUI.color = m_outputPorts[ i ].HasCustomColor ? m_outputPorts[ i ].CustomColor : UIUtils.GetColorForDataType( m_outputPorts[ i ].DataType, true, false ); + + GUIStyle style = m_outputPorts[ i ].IsConnected ? UIUtils.GetCustomStyle( CustomStyle.PortFullIcon ) : UIUtils.GetCustomStyle( CustomStyle.PortEmptyIcon ); + GUI.Label( m_outputPorts[ i ].Position, string.Empty, style ); + + GUI.color = m_colorBuffer; + } + + // Output Port Label + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + if( m_outputPorts[ i ].Locked ) + { + GUI.color = Constants.PortLockedTextColor; + GUI.Label( m_outputPorts[ i ].LabelPosition, m_outputPorts[ i ].Name, UIUtils.OutputPortLabel ); + GUI.color = m_colorBuffer; + } + else + { + GUI.Label( m_outputPorts[ i ].LabelPosition, m_outputPorts[ i ].Name, UIUtils.OutputPortLabel ); + } + } + } + } + + // Preview + if( ( m_showPreview || m_globalShowPreview ) && m_drawPreview ) + DrawPreview( drawInfo, m_previewRect ); + + // Error and Warning bottom message + if( m_showErrorMessage ) + { + GUI.color = new Color( 0.0f, 0.0f, 0.0f, 0.5f ); + GUI.Label( m_errorBox, string.Empty, UIUtils.Separator ); + GUI.color = m_colorBuffer; + + switch( m_errorMessageTypeIsError ) + { + default: + case NodeMessageType.Error: + { + m_errorMessage.text = ErrorTitle; + m_errorIcon.image = UIUtils.SmallErrorIcon; + m_errorCurrentStyle = UIUtils.BoldErrorStyle; + } + break; + case NodeMessageType.Warning: + { + m_errorMessage.text = WarningTitle; + m_errorIcon.image = UIUtils.SmallWarningIcon; + m_errorCurrentStyle = UIUtils.BoldWarningStyle; + } + break; + case NodeMessageType.Info: + { + m_errorMessage.text = InfoTitle; + m_errorIcon.image = UIUtils.SmallInfoIcon; + m_errorCurrentStyle = UIUtils.BoldInfoStyle; + } + break; + } + + Rect textBox = m_errorBox; + textBox.y += 1 * drawInfo.InvertedZoom; + textBox.height = 24 * drawInfo.InvertedZoom; + + float textWidth = m_errorCurrentStyle.CalcSize( m_errorMessage ).x; + + GUI.Label( textBox, m_errorMessage, m_errorCurrentStyle ); + textBox.x -= textWidth * 0.5f + 12 * drawInfo.InvertedZoom; + GUI.Label( textBox, m_errorIcon, m_errorCurrentStyle ); + textBox.x += textWidth + 24 * drawInfo.InvertedZoom; + GUI.Label( textBox, m_errorIcon, m_errorCurrentStyle ); + } + + // Selection Box + if( m_selected ) + { + GUI.color = Constants.NodeSelectedColor; + if( m_useSquareNodeTitle || ContainerGraph.LodLevel >= ParentGraph.NodeLOD.LOD2 ) + GUI.Label( m_globalPosition, string.Empty, UIUtils.NodeWindowOnSquare ); + else + GUI.Label( m_globalPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ) ); + GUI.color = m_colorBuffer; + } + + // Debug Visualizers + //if( FinishPreviewRender || m_continuousPreviewRefresh ) + //{ + // GUI.color = new Color( 0, 1, 0.5f, 1f ); + // Rect r = m_globalPosition; + // r.width = 8; + // r.height = 8; + // r.x -= 5 * drawInfo.InvertedZoom; + // r.y -= 5 * drawInfo.InvertedZoom; + // GUI.Label( r, string.Empty, UIUtils.GetCustomStyle( CustomStyle.PortFullIcon ) ); + // GUI.color = m_colorBuffer; + // FinishPreviewRender = false; + //} + //GUI.Label( m_remainingBox, string.Empty, UIUtils.Box ); + } + + public bool DropdownEditing { get { return m_dropdownEditing; } set { m_dropdownEditing = value; PreviewIsDirty = true; } } + public void DisablePreview() + { + m_showPreview = false; + m_sizeIsDirty = true; + } + /// + /// Handles gui controls, runs before node layout + /// + /// + public virtual void DrawGUIControls( DrawInfo drawInfo ) + { + if( !m_initialized ) + return; + + if( !m_isVisible ) + return; + + if( drawInfo.CurrentEventType == EventType.MouseDown && drawInfo.LeftMouseButtonPressed ) + { + if( m_expandRect.Contains( drawInfo.MousePosition ) ) + { + m_showPreview = !m_showPreview; + m_sizeIsDirty = true; + ContainerGraph.ParentWindow.MouseInteracted = true; + } + + if( m_hasLeftDropdown && m_dropdownRect.Contains( drawInfo.MousePosition ) ) + { + m_dropdownEditing = true; + } + else if( m_dropdownEditing ) + { + DropdownEditing = false; + } + } + + DrawGuiPorts( drawInfo ); + } + + //public static bool MyRepeatButton( DrawInfo drawInfo, Rect position, string text, GUIStyle style ) + //{ + // if(/* drawInfo.CurrentEventType == EventType.MouseDown &&*/ position.Contains( drawInfo.MousePosition ) ) + // { + // UIUtils.CurrentWindow.MouseInteracted = true; + // return true; + // } + // return false; + //} + + public void DrawGuiPorts( DrawInfo drawInfo ) + { + if( !m_initialized ) + return; + + if( !m_isVisible ) + return; + + if( drawInfo.CurrentEventType == EventType.MouseDown ) + { + int inputCount = m_inputPorts.Count; + int outputCount = m_outputPorts.Count; + + for( int i = 0; i < inputCount; i++ ) + { + if( m_inputPorts[ i ].Visible && !m_inputPorts[ i ].Locked && m_isVisible && m_inputPorts[ i ].ActivePortArea.Contains( drawInfo.MousePosition ) && drawInfo.LeftMouseButtonPressed ) + { + UIUtils.CurrentWindow.MouseInteracted = true; + m_inputPorts[ i ].Click(); + // need to put the mouse button on a hot state so it will detect the Mouse Up event correctly on the Editor Window + int controlID = GUIUtility.GetControlID( FocusType.Passive ); + //int controlID = GUIUtility.GetControlID( "repeatButton".GetHashCode(), FocusType.Passive, m_inputPorts[ i ].ActivePortArea ); + GUIUtility.hotControl = controlID; + + bool saveReference = true; + if( m_inputPorts[ i ].IsConnected ) + { + double doubleTapTime = EditorApplication.timeSinceStartup; + bool doubleTap = ( doubleTapTime - m_doubleClickTimestamp ) < DoubleClickTime; + m_doubleClickTimestamp = doubleTapTime; + + if( doubleTap ) + { + m_containerGraph.DeleteConnection( true, UniqueId, m_inputPorts[ i ].PortId, true, true ); + Event.current.Use(); + } + else + //if ( AppyModifierToPort( _inputPorts[ i ], true ) ) + //{ + //saveReference = false; + //} + if( !ApplyModifierToPort( m_inputPorts[ i ], true ) ) + { + UIUtils.ShowContextOnPick = false; + PickInput( m_inputPorts[ i ] ); + } + saveReference = false; + } + + if( saveReference && !m_containerGraph.ParentWindow.WireReferenceUtils.InputPortReference.IsValid ) + //if ( !modifierApplied && !UIUtils.InputPortReference.IsValid ) + { + m_containerGraph.ParentWindow.WireReferenceUtils.SetInputReference( m_uniqueId, m_inputPorts[ i ].PortId, m_inputPorts[ i ].DataType, m_inputPorts[ i ].TypeLocked ); + } + + IsDirty = true; + inputCount = m_inputPorts.Count; + } + } + + for( int i = 0; i < outputCount; i++ ) + { + if( m_outputPorts[ i ].Visible && m_outputPorts[ i ].ActivePortArea.Contains( drawInfo.MousePosition ) && drawInfo.LeftMouseButtonPressed ) + { + UIUtils.CurrentWindow.MouseInteracted = true; + m_outputPorts[ i ].Click(); + // need to put the mouse button on a hot state so it will detect the Mouse Up event correctly on the Editor Window + int controlID = GUIUtility.GetControlID( FocusType.Passive ); + //int controlID = GUIUtility.GetControlID( "aseRepeatButton".GetHashCode(), FocusType.Passive, m_outputPorts[ i ].ActivePortArea ); + GUIUtility.hotControl = controlID; + + bool saveReference = true; + if( m_outputPorts[ i ].IsConnected ) + { + if( ApplyModifierToPort( m_outputPorts[ i ], false ) ) + { + saveReference = false; + } + } + + if( saveReference && !m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid ) + { + m_containerGraph.ParentWindow.WireReferenceUtils.SetOutputReference( m_uniqueId, m_outputPorts[ i ].PortId, m_outputPorts[ i ].DataType, false ); + } + + IsDirty = true; + outputCount = m_outputPorts.Count; + } + } + } + + //Preview buttons + if( m_drawPreviewMaskButtons && ( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp ) ) + DrawPreviewMaskButtonsLayout( drawInfo, m_previewRect ); + } + + /// + /// Can be used to draw an entire node, runs after wires + /// + /// + public virtual void Draw( DrawInfo drawInfo ) + { + if( !m_initialized ) + return; + + if( drawInfo.CurrentEventType == EventType.Repaint ) + OnNodeRepaint( drawInfo ); + } + + public virtual void SetPreviewInputs() + { + if( !HasPreviewShader || !m_initialized ) + return; + + int count = m_inputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( m_inputPorts[ i ].IsConnected && m_inputPorts[ i ].InputNodeHasPreview( ContainerGraph ) ) + { + m_inputPorts[ i ].SetPreviewInputTexture( ContainerGraph ); + } + else + { + m_inputPorts[ i ].SetPreviewInputValue( ContainerGraph ); + } + } + } + + + public bool SafeDraw( DrawInfo drawInfo ) + { + EditorGUI.BeginChangeCheck(); + Draw( drawInfo ); + if( EditorGUI.EndChangeCheck() ) + { + SaveIsDirty = true; + return true; + } + return false; + } + + public bool ShowTooltip( DrawInfo drawInfo ) + { + if( string.IsNullOrEmpty( m_tooltipText ) ) + return false; + + if( m_globalPosition.Contains( drawInfo.MousePosition ) || m_linkVisibility ) + { + if( m_tooltipTimestamp + 0.6f < Time.realtimeSinceStartup || m_linkVisibility ) + { + bool errorTooltip = false; + if( m_showErrorMessage && m_errorBox.Contains( drawInfo.MousePosition ) && !string.IsNullOrEmpty( m_errorMessageTooltip ) ) + errorTooltip = true; + + Rect globalTooltipPos = m_globalPosition; + GUIContent temp = new GUIContent( errorTooltip ? m_errorMessageTooltip : m_tooltipText ); + UIUtils.TooltipBox.wordWrap = false; + Vector2 optimal = UIUtils.TooltipBox.CalcSize( temp ); + if( optimal.x > 300f ) + { + UIUtils.TooltipBox.wordWrap = true; + optimal.x = 300f; + optimal.y = UIUtils.TooltipBox.CalcHeight( temp, 300f ); + } + + globalTooltipPos.width = Mathf.Max( 120, optimal.x ); + globalTooltipPos.height = optimal.y; + globalTooltipPos.center = m_globalPosition.center; + + if( !errorTooltip && m_hasTooltipLink ) + globalTooltipPos.height += 16; + + if( errorTooltip ) + globalTooltipPos.y = 10 + m_globalPosition.yMax; + else + globalTooltipPos.y = m_globalPosition.yMin - 10 - globalTooltipPos.height; + + if ( globalTooltipPos.x < 10 ) + globalTooltipPos.x = 10; + + if( globalTooltipPos.x + globalTooltipPos.width > Screen.width - 10 ) + globalTooltipPos.x = Screen.width - globalTooltipPos.width - 10; + + //UNCOMMENT this for auto adjust tooltip to the top window box + //if( globalTooltipPos.y < 40 ) + // globalTooltipPos.y = 40; + + if( errorTooltip && globalTooltipPos.y + globalTooltipPos.height > Screen.height - 32 ) + globalTooltipPos.y = Screen.height - 32 - globalTooltipPos.height; + + GUI.Label( globalTooltipPos, temp, UIUtils.TooltipBox ); + + if( !errorTooltip && m_hasTooltipLink ) + { + Rect link = globalTooltipPos; + link.y = globalTooltipPos.yMax - 16; + link.height = 16; + link.width = 86; + link.x = globalTooltipPos.center.x - 43; + Rect hover = globalTooltipPos; + hover.yMax += 15;// m_globalPosition.yMax; + m_linkVisibility = hover.Contains( drawInfo.MousePosition ); + if( link.Contains( drawInfo.MousePosition ) ) + { + if( drawInfo.CurrentEventType == EventType.MouseDown ) + { + if( m_tooltipTimestamp + 1.25f < Time.realtimeSinceStartup ) + { + Application.OpenURL( Attributes.NodeUrl ); + } + } + else + { + UIUtils.MainSkin.customStyles[ 52 ].Draw( link, WikiLinkStr, true, false, false, false ); + } + } + else + { + GUI.Label( link, WikiLinkStr, UIUtils.MainSkin.customStyles[ 52 ] ); + } + } + ContainerGraph.ParentWindow.RequestRepaint(); + return true; + } + } + else + { + if( !m_linkVisibility ) + m_tooltipTimestamp = Time.realtimeSinceStartup; + } + + return false; + } + + public virtual bool SafeDrawProperties() + { + EditorGUI.BeginChangeCheck(); + PreDrawProperties(); + if( m_autoWrapProperties ) + { + NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, DrawProperties ); + } + else + { + DrawProperties(); + } + if( EditorGUI.EndChangeCheck() ) + { + PreviewIsDirty = true; + //UIUtils.RecordObject(this); + //MarkForPreviewUpdate(); + return true; + } + return false; + } + + + public void PreDrawProperties() + { + if( m_useInternalPortData && m_autoDrawInternalPortData ) + { + DrawInternalDataGroup(); + } + } + + virtual public void DrawProperties() { } + + protected void DrawInternalDataGroup() + { + bool drawInternalDataUI = false; + int inputCount = m_inputPorts.Count; + if( inputCount > 0 ) + { + for( int i = 0; i < inputCount; i++ ) + { + if( m_inputPorts[ i ].Available && m_inputPorts[ i ].ValidInternalData && !m_inputPorts[ i ].IsConnected /*&& ( m_inputPorts[ i ].AutoDrawInternalData || ( m_autoDrawInternalPortData && m_useInternalPortData ) )*/ /*&& m_inputPorts[ i ].AutoDrawInternalData*/ ) + { + drawInternalDataUI = true; + break; + } + } + } + + if( drawInternalDataUI ) + NodeUtils.DrawPropertyGroup( ref m_internalDataFoldout, Constants.InternalDataLabelStr, () => + { + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].ValidInternalData && !m_inputPorts[ i ].IsConnected && m_inputPorts[ i ].Visible /*&& m_inputPorts[ i ].AutoDrawInternalData*/ ) + { + m_inputPorts[ i ].ShowInternalData( this ); + } + } + } ); + } + + protected void PickInput( InputPort port ) + { + WireReference connection = port.GetConnection( 0 ); + OutputPort from = port.GetOutputConnection( 0 ); + + m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.SetReference( from.NodeId, from.PortId, from.DataType, connection.TypeLocked ); + m_containerGraph.DeleteConnection( true, UniqueId, port.PortId, true, true ); + //TODO: check if not necessary + Event.current.Use(); + IsDirty = true; + SetSaveIsDirty(); + } + + protected bool ApplyModifierToPort( WirePort port, bool isInput ) + { + bool modifierApplied = false; + switch( Event.current.modifiers ) + { + case EventModifiers.Alt: + { + m_containerGraph.DeleteConnection( isInput, UniqueId, port.PortId, true, true ); + modifierApplied = true; + m_containerGraph.ParentWindow.InvalidateAlt(); + } + break; + case EventModifiers.Control: + { + //WireReference connection = port.GetConnection( 0 ); + //if ( isInput ) + //{ + // UIUtils.OutputPortReference.SetReference( connection.NodeId, connection.PortId, connection.DataType, connection.TypeLocked ); + //} + //else + //{ + // UIUtils.InputPortReference.SetReference( connection.NodeId, connection.PortId, connection.DataType, connection.TypeLocked ); + //} + + //UIUtils.DeleteConnection( isInput, UniqueId, port.PortId, true ); + //modifierApplied = true; + + if( !isInput ) + { + WireReference connection = port.GetConnection( 0 ); + m_containerGraph.ParentWindow.WireReferenceUtils.InputPortReference.SetReference( connection.NodeId, connection.PortId, connection.DataType, connection.TypeLocked ); + m_containerGraph.DeleteConnection( isInput, UniqueId, port.PortId, true, true ); + modifierApplied = true; + } + } + break; + } + + if( isInput ) + m_containerGraph.ParentWindow.WireReferenceUtils.SwitchPortReference.SetReference( port.NodeId, port.PortId, port.DataType, false ); //always save last connection + else + m_containerGraph.ParentWindow.WireReferenceUtils.SwitchPortReference.SetReference( -1, -1, WirePortDataType.OBJECT, false ); //invalidate connection + + if( modifierApplied ) + { + Event.current.Use(); + IsDirty = true; + SetSaveIsDirty(); + } + return modifierApplied; + } + + public void DeleteAllInputConnections( bool alsoDeletePorts , bool inhibitWireNodeAutoDel = false ) + { + int count = m_inputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + ParentNode connNode = null; + if( inhibitWireNodeAutoDel ) + { + connNode = m_inputPorts[ i ].GetOutputNode(); + connNode.Alive = false; + } + m_containerGraph.DeleteConnection( true, UniqueId, m_inputPorts[ i ].PortId, false, true ); + if( inhibitWireNodeAutoDel ) + { + connNode.Alive = true; + } + } + + } + if( alsoDeletePorts ) + { + m_inputPorts.Clear(); + m_inputPortsDict.Clear(); + } + SetSaveIsDirty(); + } + + public void DeleteAllOutputConnections( bool alsoDeletePorts ) + { + int count = m_outputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( m_outputPorts[ i ].IsConnected ) + m_containerGraph.DeleteConnection( false, UniqueId, m_outputPorts[ i ].PortId, false, true ); + } + + if( alsoDeletePorts ) + { + m_outputPorts.Clear(); + m_outputPortsDict.Clear(); + } + SetSaveIsDirty(); + } + + public void DeleteInputPortByArrayIdx( int arrayIdx ) + { + if( arrayIdx >= m_inputPorts.Count ) + return; + + m_containerGraph.DeleteConnection( true, UniqueId, m_inputPorts[ arrayIdx ].PortId, false, true ); + m_inputPortsDict.Remove( m_inputPorts[ arrayIdx ].PortId ); + m_inputPorts.RemoveAt( arrayIdx ); + + m_sizeIsDirty = true; + SetSaveIsDirty(); + RecalculateInputPortIdx(); + } + + public void DeleteOutputPortByArrayIdx( int portIdx ) + { + if( portIdx >= m_outputPorts.Count ) + return; + + m_containerGraph.DeleteConnection( false, UniqueId, m_outputPorts[ portIdx ].PortId, false, true ); + m_outputPortsDict.Remove( m_outputPorts[ portIdx ].PortId ); + m_outputPorts.RemoveAt( portIdx ); + m_sizeIsDirty = true; + } + + public InputPort GetInputPortByArrayId( int id ) + { + if( id < m_inputPorts.Count ) + return m_inputPorts[ id ]; + + return null; + } + + public OutputPort GetOutputPortByArrayId( int id ) + { + if( id < m_outputPorts.Count ) + return m_outputPorts[ id ]; + + return null; + } + + public InputPort GetInputPortByUniqueId( int id ) + { + if( m_inputPortsDict.ContainsKey( id ) ) + return m_inputPortsDict[ id ]; + + if( m_inputPortsDict.Count != m_inputPorts.Count ) + m_repopulateDictionaries = true; + + int inputCount = m_inputPorts.Count; + for( int i = 0; i < inputCount; i++ ) + { + if( m_inputPorts[ i ].PortId == id ) + { + return m_inputPorts[ i ]; + } + } + return null; + } + + public InputPort GetInputPortByName( string name ) + { + return InputPorts.Find( x => x.Name.Equals( name ) ); + } + + public InputPort GetInputPortByExternalLinkId( string internalDataName ) + { + return InputPorts.Find( x => x.ExternalLinkId.Equals( internalDataName ) ); + } + + public OutputPort GetOutputPortByUniqueId( int id ) + { + if( m_outputPortsDict.ContainsKey( id ) ) + return m_outputPortsDict[ id ]; + + if( m_outputPortsDict.Count != m_outputPorts.Count ) + m_repopulateDictionaries = true; + + int outputCount = m_outputPorts.Count; + for( int i = 0; i < outputCount; i++ ) + { + if( m_outputPorts[ i ].PortId == id ) + return m_outputPorts[ i ]; + } + return null; + } + + public virtual void AfterDuplication(){} + + public override string ToString() + { + string dump = ""; + dump += ( "Type: " + GetType() ); + dump += ( " Unique Id: " + UniqueId + "\n" ); + dump += ( " Inputs: \n" ); + + int inputCount = m_inputPorts.Count; + int outputCount = m_outputPorts.Count; + + for( int inputIdx = 0; inputIdx < inputCount; inputIdx++ ) + { + dump += ( m_inputPorts[ inputIdx ] + "\n" ); + } + dump += ( "Outputs: \n" ); + for( int outputIdx = 0; outputIdx < outputCount; outputIdx++ ) + { + dump += ( m_outputPorts[ outputIdx ] + "\n" ); + } + return dump; + } + + public string GetValueFromOutputStr( int outputId, WirePortDataType inputPortType, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( ignoreLocalvar ) + { + return GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + } + OutputPort outPort = GetOutputPortByUniqueId( outputId ); + if( outPort.IsLocalValue( dataCollector.PortCategory ) ) + { + if( outPort.DataType != WirePortDataType.OBJECT && outPort.DataType != inputPortType ) + { + return UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, null, outPort.DataType, inputPortType, outPort.LocalValue( dataCollector.PortCategory ) ); + } + else + { + return outPort.LocalValue( dataCollector.PortCategory ); + } + } + + string result = GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + result = CreateOutputLocalVariable( outputId, result, ref dataCollector ); + + if( outPort.DataType != WirePortDataType.OBJECT && outPort.DataType != inputPortType ) + { + result = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, null, outPort.DataType, inputPortType, result ); + } + return result; + } + + public virtual string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.IsSRP ) + { + switch( dataCollector.CurrentSRPType ) + { + case TemplateSRPType.HDRP: if(OnHDAction!=null) OnHDAction( outputId, ref dataCollector ); break; + case TemplateSRPType.URP:if(OnLightweightAction != null) OnLightweightAction( outputId, ref dataCollector ); break; + } + } + return string.Empty; + } + + public string GenerateValueInVertex( ref MasterNodeDataCollector dataCollector, WirePortDataType dataType, string dataValue, string dataName, bool createInterpolator ) + { + + if( !dataCollector.IsFragmentCategory ) + return dataValue; + + //TEMPLATES + if( dataCollector.IsTemplate ) + { + if( createInterpolator && dataCollector.TemplateDataCollectorInstance.HasCustomInterpolatedData( dataName ) ) + return dataName; + + MasterNodePortCategory category = dataCollector.PortCategory; + dataCollector.PortCategory = MasterNodePortCategory.Vertex; + + dataCollector.PortCategory = category; + + if( createInterpolator ) + { + dataCollector.TemplateDataCollectorInstance.RegisterCustomInterpolatedData( dataName, dataType, CurrentPrecisionType, dataValue ); + } + else + { + dataCollector.AddToVertexLocalVariables( -1, CurrentPrecisionType, dataType, dataName, dataValue ); + } + + return dataName; + } + + //SURFACE + { + if( dataCollector.TesselationActive ) + { + UIUtils.ShowMessage( UniqueId, "Unable to use Vertex to Frag when Tessellation is active" ); + return m_outputPorts[ 0 ].ErrorValue; + } + + if( createInterpolator ) + dataCollector.AddToInput( UniqueId, dataName, dataType, CurrentPrecisionType ); + + MasterNodePortCategory portCategory = dataCollector.PortCategory; + dataCollector.PortCategory = MasterNodePortCategory.Vertex; + if( createInterpolator ) + { + dataCollector.AddLocalVariable( UniqueId, Constants.VertexShaderOutputStr + "." + dataName, dataValue + ";" ); + } + else + { + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, dataType, dataName, dataValue ); + } + dataCollector.PortCategory = portCategory; + return createInterpolator ? Constants.InputVarStr + "." + dataName : dataName; + } + } + + public string GenerateInputInVertex( ref MasterNodeDataCollector dataCollector , int inputPortUniqueId , string varName , bool createInterpolator , bool noInterpolationFlag = false , bool sampleFlag = false ) + { + InputPort inputPort = GetInputPortByUniqueId( inputPortUniqueId ); + if( !dataCollector.IsFragmentCategory ) + { + string value = inputPort.GeneratePortInstructions( ref dataCollector ); + dataCollector.AddLocalVariable( -1 , CurrentPrecisionType , inputPort.DataType , varName , value ); + return varName; + } + + //TEMPLATES + if( dataCollector.IsTemplate ) + { + if( createInterpolator && dataCollector.TemplateDataCollectorInstance.HasCustomInterpolatedData( varName ) ) + return varName; + + MasterNodePortCategory category = dataCollector.PortCategory; + dataCollector.PortCategory = MasterNodePortCategory.Vertex; + //bool dirtyVertexVarsBefore = dataCollector.DirtyVertexVariables; + //ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); + + string data = inputPort.GeneratePortInstructions( ref dataCollector ); + + dataCollector.PortCategory = category; + //if( !dirtyVertexVarsBefore && dataCollector.DirtyVertexVariables ) + //{ + // dataCollector.AddVertexInstruction( dataCollector.VertexLocalVariablesFromList, UniqueId, false ); + // dataCollector.ClearVertexLocalVariables(); + // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); + //} + + //ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Fragment ); + + if( createInterpolator ) + { + dataCollector.TemplateDataCollectorInstance.RegisterCustomInterpolatedData( varName, inputPort.DataType, CurrentPrecisionType, data,true,MasterNodePortCategory.Fragment,noInterpolationFlag,sampleFlag ); + } + else + { + dataCollector.AddToVertexLocalVariables( -1, CurrentPrecisionType, inputPort.DataType, varName, data ); + } + + return varName; + } + + //SURFACE + { + if( dataCollector.TesselationActive ) + { + UIUtils.ShowMessage( UniqueId, "Unable to use Vertex to Frag when Tessellation is active" ); + return m_outputPorts[ 0 ].ErrorValue; + } + + if( createInterpolator ) + dataCollector.AddToInput( UniqueId, varName, inputPort.DataType, CurrentPrecisionType ); + + MasterNodePortCategory portCategory = dataCollector.PortCategory; + dataCollector.PortCategory = MasterNodePortCategory.Vertex; + + //bool dirtyVertexVarsBefore = dataCollector.DirtyVertexVariables; + + //ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); + + string vertexVarValue = inputPort.GeneratePortInstructions( ref dataCollector ); + if( createInterpolator ) + { + dataCollector.AddLocalVariable( UniqueId, Constants.VertexShaderOutputStr + "." + varName, vertexVarValue + ";" ); + } + else + { + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, inputPort.DataType, varName, vertexVarValue ); + } + + dataCollector.PortCategory = portCategory; + + //if( !dirtyVertexVarsBefore && dataCollector.DirtyVertexVariables ) + //{ + // dataCollector.AddVertexInstruction( dataCollector.VertexLocalVariables, UniqueId, false ); + // dataCollector.ClearVertexLocalVariables(); + // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); + //} + + //ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Fragment ); + + return createInterpolator ? Constants.InputVarStr + "." + varName : varName; + } + } + + + protected virtual void OnUniqueIDAssigned() { } + + public string CreateOutputLocalVariable( int outputArrayId, string value, ref MasterNodeDataCollector dataCollector ) + { + OutputPort port = GetOutputPortByUniqueId( outputArrayId ); + + if( port.IsLocalValue( dataCollector.PortCategory ) ) + return port.LocalValue( dataCollector.PortCategory ); + + if( port.ConnectionCount > 1 ) + { + RegisterLocalVariable( outputArrayId, value, ref dataCollector ); + return port.LocalValue( dataCollector.PortCategory ); + } + else + { + // revisit later (break to components case) + port.SetLocalValue( value, dataCollector.PortCategory ); + } + + return value; + } + + public void RegisterLocalVariable( int outputArrayId, string value, ref MasterNodeDataCollector dataCollector, string customName = null ) + { + OutputPort port = GetOutputPortByUniqueId( outputArrayId ); + if( (int)port.DataType >= (int)( 1 << 10 ) || port.DataType == WirePortDataType.OBJECT ) //10 is the flag start of sampler types + { + port.SetLocalValue( value, dataCollector.PortCategory ); + return; + } + + bool vertexMode = dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation; + string localVar = port.ConfigOutputLocalValue( CurrentPrecisionType, value, customName, dataCollector.PortCategory ); + + if( vertexMode ) + { + dataCollector.AddToVertexLocalVariables( m_uniqueId, localVar ); + } + else + { + dataCollector.AddToFragmentLocalVariables( m_uniqueId, localVar ); + } + } + + public void InvalidateConnections() + { + int inputCount = m_inputPorts.Count; + int outputCount = m_outputPorts.Count; + + for( int i = 0; i < inputCount; i++ ) + { + m_inputPorts[ i ].InvalidateAllConnections(); + } + + for( int i = 0; i < outputCount; i++ ) + { + m_outputPorts[ i ].InvalidateAllConnections(); + } + } + + public virtual bool OnClick( Vector2 currentMousePos2D ) + { + bool singleClick = true; + if( ( EditorApplication.timeSinceStartup - m_lastTimeSelected ) < NodeClickTime ) + { + OnNodeDoubleClicked( currentMousePos2D ); + singleClick = false; + } + + m_lastTimeSelected = EditorApplication.timeSinceStartup; + return singleClick; + } + + public virtual void OnNodeDoubleClicked( Vector2 currentMousePos2D ) + { + ContainerGraph.ParentWindow.ParametersWindow.IsMaximized = !ContainerGraph.ParentWindow.ParametersWindow.IsMaximized; + } + + public virtual void OnNodeSelected( bool value ) + { + if( !value ) + { + if( m_inputPorts != null ) + { + int count = m_inputPorts.Count; + for( int i = 0; i < count; i++ ) + { + m_inputPorts[ i ].ResetEditing(); + } + } + + if( m_outputPorts != null ) + { + int count = m_outputPorts.Count; + for( int i = 0; i < count; i++ ) + { + m_outputPorts[ i ].ResetEditing(); + } + } + } + } + + public void ResetOutputLocals() + { + int outputCount = m_outputPorts.Count; + for( int i = 0; i < outputCount; i++ ) + { + m_outputPorts[ i ].ResetLocalValue(); + } + } + + + public void ResetOutputLocalsIfNot( MasterNodePortCategory category ) + { + int outputCount = m_outputPorts.Count; + for( int i = 0; i < outputCount; i++ ) + { + //if( !m_outputPorts[ i ].IsLocalOnCategory( category ) ) + // m_outputPorts[ i ].ResetLocalValue(); + m_outputPorts[ i ].ResetLocalValueIfNot( category ); + } + } + + public virtual void Rewire() { } + + //public virtual List NodeReferences { get { return null; } } + + public int UniqueId + { + get { return m_uniqueId; } + + set + { + m_uniqueId = value; + + int inputCount = m_inputPorts.Count; + int outputCount = m_outputPorts.Count; + + for( int inputIdx = 0; inputIdx < inputCount; inputIdx++ ) + { + m_inputPorts[ inputIdx ].NodeId = value; + } + + for( int outputIdx = 0; outputIdx < outputCount; outputIdx++ ) + { + m_outputPorts[ outputIdx ].NodeId = value; + } + OnUniqueIDAssigned(); + } + } + public void SetBaseUniqueId( int uniqueId, bool setOnPorts = false ) + { + m_uniqueId = uniqueId; + if( setOnPorts ) + { + int inputCount = m_inputPorts.Count; + int outputCount = m_outputPorts.Count; + + for( int inputIdx = 0; inputIdx < inputCount; inputIdx++ ) + { + m_inputPorts[ inputIdx ].NodeId = uniqueId; + } + + for( int outputIdx = 0; outputIdx < outputCount; outputIdx++ ) + { + m_outputPorts[ outputIdx ].NodeId = uniqueId; + } + } + } + + public string OutputId + { + get + { + if( ContainerGraph.GraphId > 0 ) + return UniqueId + "_g" + ContainerGraph.GraphId; + else + return UniqueId.ToString(); + } + } + + + public virtual Rect Position { get { return m_position; } } + public Rect TruePosition { get { return m_position; } } + + public Vector2 CenterPosition { get { return new Vector2( m_position.x + m_position.width * 0.5f, m_position.y + m_position.height * 0.5f ); ; } } + + public Rect GlobalPosition { get { return m_globalPosition; } } + + public Vector2 Corner { get { return new Vector2( m_position.x + m_position.width, m_position.y + m_position.height ); } } + public Vector2 Vec2Position + { + get { return new Vector2( m_position.x, m_position.y ); } + + set + { + m_position.x = value.x; + m_position.y = value.y; + } + } + + public Vector3 Vec3Position + { + get { return new Vector3( m_position.x, m_position.y, 0f ); } + + set + { + m_position.x = value.x; + m_position.y = value.y; + } + } + + + public bool Selected + { + get { return m_selected; } + set + { + m_infiniteLoopDetected = false; + m_selected = value; + OnNodeSelected( value ); + } + } + + public List InputPorts { get { return m_inputPorts; } } + + public List OutputPorts + { + get { return m_outputPorts; } + } + + public bool IsConnected { get { return m_connStatus == NodeConnectionStatus.Connected; } } + public NodeConnectionStatus ConnStatus + { + get { return m_connStatus; } + set + { + if( m_selfPowered ) + { + m_connStatus = NodeConnectionStatus.Connected; + } + else + { + m_connStatus = value; + } + + switch( m_connStatus ) + { + case NodeConnectionStatus.Island: + case NodeConnectionStatus.Not_Connected: m_statusColor = Constants.NodeDefaultColor; break; + case NodeConnectionStatus.Connected: m_statusColor = Constants.NodeConnectedColor; break; + case NodeConnectionStatus.Error: m_statusColor = Constants.NodeErrorColor; break; + } + + } + } + + public bool SelfPowered + { + set + { + m_selfPowered = value; + if( value ) + { + ConnStatus = NodeConnectionStatus.Connected; + } + } + } + + // This is also called when recording on Undo + public virtual void OnBeforeSerialize() { } + public virtual void OnAfterDeserialize() + { + m_selected = false; + m_isOnGrid = false; + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + m_inputPorts[ i ].ResetWireReferenceStatus(); + } + m_repopulateDictionaries = true; + m_sizeIsDirty = true; + m_previewIsDirty = true; + } + + public virtual int InputIdFromDeprecated( int oldInputId ) { return oldInputId; } + + public virtual int OutputIdFromDeprecated( int oldOutputId ) { return oldOutputId; } + + public virtual void ReadFromDeprecated( ref string[] nodeParams, Type oldType = null ) { } + + //Inherited classes must call this base method in order to setup id and position + public virtual void ReadFromString( ref string[] nodeParams ) + { + ParentReadFromString( ref nodeParams ); + } + + public void ParentReadFromString( ref string[] nodeParams ) + { + m_currentReadParamIdx = IOUtils.NodeTypeId + 1; + + UniqueId = Convert.ToInt32( nodeParams[ m_currentReadParamIdx++ ] ); + + string[] posCoordinates = nodeParams[ m_currentReadParamIdx++ ].Split( IOUtils.VECTOR_SEPARATOR ); + + m_position.x = Convert.ToSingle( posCoordinates[ 0 ] ); + m_position.y = Convert.ToSingle( posCoordinates[ 1 ] ); + + if( UIUtils.CurrentShaderVersion() > 22 ) + { + string val = GetCurrentParam( ref nodeParams ); + if( m_customPrecision ) + { + if( val.Equals("Fixed") ) + m_currentPrecisionType = PrecisionType.Half; + else + m_currentPrecisionType = (PrecisionType)Enum.Parse( typeof( PrecisionType ), val ); + } + else + { + m_currentPrecisionType = PrecisionType.Inherit; + } + } + + if( UIUtils.CurrentShaderVersion() > 5004 ) + m_showPreview = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + + } + + //should be called after ReadFromString + public virtual void ReadInputDataFromString( ref string[] nodeParams ) + { + int count = 0; + if( UIUtils.CurrentShaderVersion() > 7003 ) + { + try + { + count = Convert.ToInt32( nodeParams[ m_currentReadParamIdx++ ] ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + else + { + count = ( m_oldInputCount < 0 ) ? m_inputPorts.Count : m_oldInputCount; + } + + for( int i = 0; i < count && i < nodeParams.Length && m_currentReadParamIdx < nodeParams.Length; i++ ) + { + if( UIUtils.CurrentShaderVersion() < 5003 ) + { + int newId = VersionConvertInputPortId( i ); + if( UIUtils.CurrentShaderVersion() > 23 ) + { + m_inputPorts[ newId ].DataType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), nodeParams[ m_currentReadParamIdx++ ] ); + } + + m_inputPorts[ newId ].InternalData = nodeParams[ m_currentReadParamIdx++ ]; + if( m_inputPorts[ newId ].IsEditable && UIUtils.CurrentShaderVersion() >= 3100 && m_currentReadParamIdx < nodeParams.Length ) + { + m_inputPorts[ newId ].Name = nodeParams[ m_currentReadParamIdx++ ]; + } + m_inputPorts[ newId ].UpdatePreviewInternalData(); + } + else + { + string portIdStr = nodeParams[ m_currentReadParamIdx++ ]; + int portId = -1; + try + { + portId = Convert.ToInt32( portIdStr ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + WirePortDataType DataType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), nodeParams[ m_currentReadParamIdx++ ] ); + string InternalData = nodeParams[ m_currentReadParamIdx++ ]; + bool isEditable = Convert.ToBoolean( nodeParams[ m_currentReadParamIdx++ ] ); + string Name = string.Empty; + if( isEditable && m_currentReadParamIdx < nodeParams.Length ) + { + Name = nodeParams[ m_currentReadParamIdx++ ]; + } + + InputPort inputPort = GetInputPortByUniqueId( portId ); + if( inputPort != null ) + { + if( UIUtils.IsValidType( DataType ) ) + inputPort.DataType = DataType; + + inputPort.InternalData = InternalData; + if( !string.IsNullOrEmpty( Name ) ) + { + inputPort.Name = Name; + } + inputPort.UpdatePreviewInternalData(); + } + } + } + } + + public virtual void ReadOutputDataFromString( ref string[] nodeParams ) + { + int count = 0; + if( UIUtils.CurrentShaderVersion() > 7003 ) + { + count = Convert.ToInt32( nodeParams[ m_currentReadParamIdx++ ] ); + } + else + { + count = m_outputPorts.Count; + } + + for( int i = 0; i < count && i < nodeParams.Length && m_currentReadParamIdx < nodeParams.Length; i++ ) + { + try + { + WirePortDataType dataType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), nodeParams[ m_currentReadParamIdx++ ] ); + int portId = -1; + if( UIUtils.CurrentShaderVersion() > 13903 ) + { + portId = Convert.ToInt32( nodeParams[ m_currentReadParamIdx++ ] ); ; + } + else + { + portId = i; + } + + OutputPort port = GetOutputPortByUniqueId( portId ); + if( port != null && UIUtils.IsValidType( dataType ) ) + { + port.DataType = dataType; + } + + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + } + + public virtual void ReadAdditionalClipboardData( ref string[] nodeParams ) { } + + protected string GetCurrentParam( ref string[] nodeParams ) + { + if( m_currentReadParamIdx < nodeParams.Length ) + { + return nodeParams[ m_currentReadParamIdx++ ]; + } + + UIUtils.ShowMessage( UniqueId, "Invalid params number in node " + m_uniqueId + " of type " + GetType(), MessageSeverity.Error ); + return string.Empty; + } + + protected string GetCurrentParam( int index, ref string[] nodeParams ) + { + if( m_currentReadParamIdx < nodeParams.Length ) + { + return nodeParams[ index ]; + } + + UIUtils.ShowMessage( UniqueId, "Invalid params number in node " + m_uniqueId + " of type " + GetType(), MessageSeverity.Error ); + return string.Empty; + } + + + public virtual void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + IOUtils.AddTypeToString( ref nodeInfo, IOUtils.NodeParam ); + IOUtils.AddFieldValueToString( ref nodeInfo, GetType() ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_uniqueId ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_position.x.ToString() + IOUtils.VECTOR_SEPARATOR + m_position.y.ToString() ) ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentPrecisionType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_showPreview ); + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + m_inputPorts[ i ].WriteToString( ref connectionsInfo ); + } + } + + public virtual void WriteInputDataToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts.Count ); + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts[ i ].PortId ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts[ i ].DataType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts[ i ].InternalData ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts[ i ].IsEditable ); + if( m_inputPorts[ i ].IsEditable ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts[ i ].Name ); + } + } + } + + public void WriteOutputDataToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_outputPorts.Count ); + for( int i = 0; i < m_outputPorts.Count; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_outputPorts[ i ].DataType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_outputPorts[ i ].PortId ); + } + } + + public virtual void WriteAdditionalClipboardData( ref string nodeInfo ) { } + + public virtual string GetIncludes() { return string.Empty; } + public virtual void OnObjectDropped( UnityEngine.Object obj ) { } + public virtual void SetupFromCastObject( UnityEngine.Object obj ) { } + public virtual bool OnNodeInteraction( ParentNode node ) { return false; } + public virtual void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) { } + public virtual void OnConnectedInputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) { } + + public Rect CachedPos { get { return m_cachedPos; } } + + public bool IsOnGrid + { + set { m_isOnGrid = value; } + get { return m_isOnGrid; } + } + + public uint CurrentReadParamIdx + { + get { return m_currentReadParamIdx++; } + set { m_currentReadParamIdx = value; } + } + + public Dictionary InputPortsDict + { + get + { + Dictionary dict = new Dictionary(); + for( int i = 0; i < m_inputPorts.Count; i++ ) + { + dict.Add( m_inputPorts[ i ].Name, m_inputPorts[ i ] ); + } + return dict; + } + } + + public bool IsDirty + { + set { m_isDirty = value && UIUtils.DirtyMask; } + get + { + bool value = m_isDirty; + m_isDirty = false; + return value; + } + } + + public virtual void ResetNodeData() + { + m_category = 0; + m_graphDepth = 0; + } + + public virtual void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + UIUtils.SetCategoryInBitArray( ref m_category, nodeData.Category ); + nodeData.GraphDepth += 1; + if( nodeData.GraphDepth > m_graphDepth ) + { + m_graphDepth = nodeData.GraphDepth; + } + int count = m_inputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + m_inputPorts[ i ].GetOutputNode().PropagateNodeData( nodeData, ref dataCollector ); + } + } + } + + public void SetTitleTextOnCallback( string compareTitle, Action callback ) + { + if( !m_previousTitle.Equals( compareTitle ) ) + { + m_previousTitle = compareTitle; + m_sizeIsDirty = true; + callback( this, compareTitle ); + } + } + + public void SetAdditonalTitleTextOnCallback( string compareTitle, Action callback ) + { + if( !m_previousAdditonalTitle.Equals( compareTitle ) ) + { + m_previousAdditonalTitle = compareTitle; + m_sizeIsDirty = true; + callback( this, compareTitle ); + } + } + + public void SetAdditonalTitleTextOnCallback( string compareTitle, string compareTitleFormat, Action callback ) + { + if ( !m_previousAdditonalTitle.Equals( compareTitle ) || !m_previousAdditonalTitleFormat.Equals( compareTitleFormat )) + { + m_previousAdditonalTitle = compareTitle; + m_previousAdditonalTitleFormat = compareTitleFormat; + m_sizeIsDirty = true; + callback( this, compareTitle ); + } + } + + public virtual void SetClippedTitle( string newText, int maxSize = 170, string endString = "..." ) + { + m_content.text = GenerateClippedTitle( newText,maxSize,endString ); + m_sizeIsDirty = true; + } + + public virtual void SetClippedAdditionalTitle( string newText, int maxSize = 170, string endString = "..." ) + { + m_additionalContent.text = GenerateClippedTitle( newText, maxSize, endString ); + m_sizeIsDirty = true; + } + + + public void SetTitleText( string newText ) + { + if( !newText.Equals( m_content.text ) ) + { + m_content.text = newText; + m_sizeIsDirty = true; + } + } + + public void SetAdditonalTitleText( string newText ) + { + if( !newText.Equals( m_additionalContent.text ) ) + { + m_additionalContent.text = newText; + m_sizeIsDirty = true; + } + } + + public string GenerateErrorValue( int outputIdx = 0 ) + { + switch( m_outputPorts[ outputIdx ].DataType ) + { + case WirePortDataType.FLOAT2: + { + return "(0).xx"; + } + case WirePortDataType.FLOAT3: + { + return "(0).xxx"; + } + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + { + return "(0).xxxx"; + } + } + return "0"; + } + + //Methods created to take into account new ports added on nodes newer versions + //This way we can convert connections from previous versions to newer ones and not brake shader graph + public virtual int VersionConvertInputPortId( int portId ) { return portId; } + public virtual int VersionConvertOutputPortId( int portId ) { return portId; } + + public virtual string DataToArray { get { return string.Empty; } } + + public bool SaveIsDirty + { + set { m_saveIsDirty = value && UIUtils.DirtyMask; } + get + { + bool value = m_saveIsDirty; + m_saveIsDirty = false; + return value; + } + } + + public GUIContent TitleContent { get { return m_content; } } + public GUIContent AdditonalTitleContent { get { return m_additionalContent; } } + public bool IsVisible { get { return m_isVisible; } } + public NodeAttributes Attributes { get { return m_nodeAttribs; } } + public bool ReorderLocked { get { return m_reorderLocked; } } + public bool RequireMaterialUpdate { get { return m_requireMaterialUpdate; } } + public bool RMBIgnore { get { return m_rmbIgnore; } } + public float TextLabelWidth { get { return m_textLabelWidth; } } + public bool IsMoving { get { return m_isMoving > 0; } } + public bool MovingInFrame { get { return m_movingInFrame; } set { m_movingInFrame = value; } } + public bool SizeIsDirty { get { return m_sizeIsDirty; } set { m_sizeIsDirty = value; } } + public int Category { get { return m_category; } } + public int CommentaryParent + { + get { return m_commentaryParent; } + set { m_commentaryParent = value; } + } + + public int Depth + { + get { return m_depth; } + set { m_depth = value; } + } + + public int MatrixId + { + get { return m_matrixId; } + set { m_matrixId = value; } + } + + public float PaddingTitleRight + { + get { return m_paddingTitleRight; } + set { m_paddingTitleRight += value; } + } + + public float PaddingTitleLeft + { + get { return m_paddingTitleLeft; } + set { m_paddingTitleLeft += value; } + } + + public int CachedPortsId + { + get + { + return m_cachedPortsId; + } + } + + public virtual bool RecursivePreviewUpdate( Dictionary duplicatesDict = null ) + { + if( duplicatesDict == null ) + { + duplicatesDict = ContainerGraph.ParentWindow.VisitedChanged; + } + + for( int i = 0; i < InputPorts.Count; i++ ) + { + ParentNode outNode = null; + if( InputPorts[ i ].ExternalReferences.Count > 0 ) + { + outNode = ContainerGraph.GetNode( InputPorts[ i ].ExternalReferences[ 0 ].NodeId ); + } + if( outNode != null ) + { + if( !duplicatesDict.ContainsKey( outNode.OutputId ) ) + { + bool result = outNode.RecursivePreviewUpdate(); + if( result ) + PreviewIsDirty = true; + } else if( duplicatesDict[ outNode.OutputId ] ) + { + PreviewIsDirty = true; + } + } + } + + bool needsUpdate = PreviewIsDirty; + RenderNodePreview(); + if( !duplicatesDict.ContainsKey( OutputId ) ) + duplicatesDict.Add( OutputId, needsUpdate ); + return needsUpdate; + } + + public virtual void RenderNodePreview() + { + //Runs at least one time + if( !HasPreviewShader || !m_initialized ) + { + // nodes with no preview don't update at all + PreviewIsDirty = false; + return; + } + + if( !PreviewIsDirty && !m_continuousPreviewRefresh ) + return; + + //Debug.Log( "PREVIEW " + this ); + + SetPreviewInputs(); + + if( m_cachedMainTexId == -1 ) + m_cachedMainTexId = Shader.PropertyToID( "_MainTex" ); + + if( m_cachedMaskTexId == -1 ) + m_cachedMaskTexId = Shader.PropertyToID( "_MaskTex" ); + + if( m_cachedPortsId == -1 ) + m_cachedPortsId = Shader.PropertyToID( "_Ports" ); + + if( m_cachedPortId == -1 ) + m_cachedPortId = Shader.PropertyToID( "_Port" ); + + if (!Preferences.User.DisablePreviews) + { + RenderTexture temp = RenderTexture.active; + RenderTexture beforeMask = RenderTexture.GetTemporary(Constants.PreviewSize, Constants.PreviewSize, 0, Constants.PreviewFormat, RenderTextureReadWrite.Linear); + + int count = m_outputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if ( i == 0 ) + { + RenderTexture.active = beforeMask; + if ( m_previewMaterialPassId < PreviewMaterial.passCount ) + { + Graphics.Blit( null, beforeMask, PreviewMaterial, m_previewMaterialPassId ); + } + + m_portMask.Set( 0, 0, 0, 0 ); + + switch( m_outputPorts[ i ].DataType ) + { + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + m_portMask.Set( 1, 1, 1, 1 ); + break; + case WirePortDataType.FLOAT2: + m_portMask.Set( 1, 1, 0, 0 ); + break; + case WirePortDataType.FLOAT3: + m_portMask.Set( 1, 1, 1, 0 ); + break; + case WirePortDataType.COLOR: + case WirePortDataType.FLOAT4: + m_portMask.Set( 1, 1, 1, 1 ); + break; + default: + m_portMask.Set( 1, 1, 1, 1 ); + break; + } + + if( m_outputPorts[ i ].DataType == WirePortDataType.FLOAT3x3 || m_outputPorts[ i ].DataType == WirePortDataType.FLOAT4x4 ) + { + m_outputPorts[ i ].MaskingMaterial.SetTexture( m_cachedMainTexId, EditorGUIUtility.whiteTexture ); + } + else + { + m_outputPorts[ i ].MaskingMaterial.SetTexture( m_cachedMainTexId, beforeMask ); + } + m_outputPorts[ i ].MaskingMaterial.SetVector( m_cachedPortsId, m_portMask ); + + RenderTexture.active = m_outputPorts[ i ].OutputPreviewTexture; + Graphics.Blit( null , m_outputPorts[ i ].OutputPreviewTexture , m_outputPorts[ i ].MaskingMaterial , 0 ); + } + else + { + m_outputPorts[ i ].MaskingMaterial.SetTexture( m_cachedMaskTexId , PreviewTexture ); + m_outputPorts[ i ].MaskingMaterial.SetFloat( m_cachedPortId , i ); + + RenderTexture.active = m_outputPorts[ i ].OutputPreviewTexture; + Graphics.Blit( null , m_outputPorts[ i ].OutputPreviewTexture , m_outputPorts[ i ].MaskingMaterial , 1 ); + } + } + + RenderTexture.ReleaseTemporary(beforeMask); + RenderTexture.active = temp; + } + + PreviewIsDirty = m_continuousPreviewRefresh; + + FinishPreviewRender = true; + } + + protected void ShowTab( NodeMessageType type, string tooltip ) + { + m_showErrorMessage = true; + m_errorMessageTypeIsError = type; + m_errorMessageTooltip = tooltip; + } + + protected void ShowTab() + { + m_showErrorMessage = true; + } + + protected void HideTab() + { + m_showErrorMessage = false; + } + + public virtual RenderTexture PreviewTexture + { + get + { + if( m_outputPorts.Count > 0 ) + return m_outputPorts[ 0 ].OutputPreviewTexture; + else + return null; + } + } + + public void FullWriteToString( ref string nodesInfo, ref string connectionsInfo ) + { + WriteToString( ref nodesInfo, ref connectionsInfo ); + WriteInputDataToString( ref nodesInfo ); + WriteOutputDataToString( ref nodesInfo ); + } + + public void ClipboardFullWriteToString( ref string nodesInfo, ref string connectionsInfo ) + { + FullWriteToString( ref nodesInfo, ref connectionsInfo ); + WriteAdditionalClipboardData( ref nodesInfo ); + } + + public void FullReadFromString( ref string[] parameters ) + { + try + { + ReadFromString( ref parameters ); + ReadInputDataFromString( ref parameters ); + ReadOutputDataFromString( ref parameters ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + + public void ClipboardFullReadFromString( ref string[] parameters ) + { + try + { + FullReadFromString( ref parameters ); + ReadAdditionalClipboardData( ref parameters ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + + public string GenerateClippedTitle( string original , int maxSize = 170, string endString = "..." ) + { + if( UIUtils.UnZoomedNodeTitleStyle == null ) + return original; + + GUIContent content = new GUIContent( original ); + + string finalTitle = string.Empty; + bool addEllipsis = false; + for( int i = 1; i <= original.Length; i++ ) + { + content.text = original.Substring( 0, i ); + Vector2 titleSize = UIUtils.UnZoomedNodeTitleStyle.CalcSize( content ); + if( titleSize.x > maxSize ) + { + addEllipsis = true; + break; + } + else + { + finalTitle = content.text; + } + } + if( addEllipsis ) + finalTitle += endString; + + return finalTitle; + } + + public virtual void RefreshOnUndo() { } + public virtual void CalculateCustomGraphDepth() { } + public int GraphDepth { get { return m_graphDepth; } } + + public PrecisionType CurrentPrecisionType { get { return m_currentPrecisionType == PrecisionType.Inherit ? ContainerGraph.CurrentPrecision : m_currentPrecisionType; } } + + + public Material PreviewMaterial + { + get + { + if( m_previewMaterial == null ) + { + m_previewMaterial = new Material( PreviewShader ); + } + return m_previewMaterial; + } + } + + public Shader PreviewShader + { + get + { + if( m_previewShader == null ) + { + m_previewShader = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( m_previewShaderGUID ) ); + } + + if( m_previewShader == null ) + { + m_previewShader = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "d9ca47581ac157145bff6f72ac5dd73e" ) ); //ranged float guid + } + + if( m_previewShader == null ) + m_previewShader = Shader.Find( "Unlit/Colored Transparent" ); + + return m_previewShader; + } + } + + public bool HasPreviewShader + { + get { return !string.IsNullOrEmpty( m_previewShaderGUID ); } + } + + public void CheckSpherePreview() + { + bool oneIsSphere = false; + + if( m_drawPreviewAsSphere ) + oneIsSphere = true; + int count = m_inputPorts.Count; + for( int i = 0; i < count; i++ ) + { + ParentNode node = null; + if( m_inputPorts[ i ].ExternalReferences.Count > 0) + { + node = ContainerGraph.GetNode( m_inputPorts[ i ].ExternalReferences[ 0 ].NodeId ); + } + if( node != null && node.SpherePreview ) + oneIsSphere = true; + } + + if( m_forceDrawPreviewAsPlane ) + oneIsSphere = false; + + SpherePreview = oneIsSphere; + } + + public bool SpherePreview + { + get { return m_spherePreview; } + set { m_spherePreview = value; } + } + + public bool ShowPreview + { + get { return m_showPreview; } + set { m_showPreview = value; } + } + + public int VisiblePorts + { + get { return m_visiblePorts; } + set { m_visiblePorts = value; } + } + + public bool Docking + { + get { return m_docking; } + set { m_docking = value; } + } + + public bool UseSquareNodeTitle + { + get { return m_useSquareNodeTitle; } + set { m_useSquareNodeTitle = value; } + } + + public bool InsideShaderFunction + { + get { return ContainerGraph != ContainerGraph.ParentWindow.CurrentGraph; } + } + + public virtual void SetContainerGraph( ParentGraph newgraph ) + { + m_containerGraph = newgraph; + } + public virtual void OnMasterNodeReplaced( MasterNode newMasterNode ) { PreviewIsDirty = true; } + public virtual void RefreshExternalReferences() { } + + public Rect DropdownRect { get { return m_dropdownRect; } } + + public virtual bool Contains( Vector2 pos ) { return m_globalPosition.Contains( pos ); } + public virtual bool Contains( Vector3 pos ) { return m_globalPosition.Contains( pos ); } + public bool IsNodeBeingCopied { get { return m_isNodeBeingCopied; } set { m_isNodeBeingCopied = value; } } + + public virtual WirePortDataType GetInputPortVisualDataTypeByArrayIdx( int portArrayIdx ) + { + return m_inputPorts[ portArrayIdx ].DataType; + } + + public virtual WirePortDataType GetOutputPortVisualDataTypeById( int portId ) + { + return GetOutputPortByUniqueId( portId ).DataType; + } + + + public virtual bool CheckFindText( string text ) + { + return TitleContent.text.IndexOf( text, StringComparison.CurrentCultureIgnoreCase ) >= 0; + } + + public virtual ParentNode ExecuteStubCode(){ return this; } + public virtual float HeightEstimate + { + get + { + float heightEstimate = 0; + heightEstimate = 32 + Constants.INPUT_PORT_DELTA_Y; + for( int i = 0; i < InputPorts.Count; i++ ) + { + if( InputPorts[ i ].Visible ) + heightEstimate += 18 + Constants.INPUT_PORT_DELTA_Y; + } + + return heightEstimate; + // Magic number 18 represents m_fontHeight that might not be set yet + //return Constants.NODE_HEADER_EXTRA_HEIGHT + Mathf.Max( 18 + m_inputPorts.Count, m_outputPorts.Count ) * Constants.INPUT_PORT_DELTA_Y; + } + } + public bool WasDeprecated { get { return m_wasDeprecated; } set { m_wasDeprecated = value; } } + public bool Alive { get { return m_alive;} set { m_alive = value; } } + public string TypeName { get { if( m_nodeAttribs != null ) return m_nodeAttribs.Name;return GetType().ToString(); } } + public bool PreviewIsDirty { set { m_previewIsDirty = value; } get { return m_previewIsDirty; } } + protected bool FinishPreviewRender { get { return m_finishPreviewRender; } set { m_finishPreviewRender = value; } } + public virtual bool IsStubNode { get { return false; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs.meta new file mode 100644 index 00000000..b7d4d590 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 33e0374f361d5c642a257b9957e4cfa0 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs new file mode 100644 index 00000000..8bd85dc4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs @@ -0,0 +1,170 @@ +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class ReordenatorNode : PropertyNode + { + [SerializeField] + private List m_propertyList; + + [SerializeField] + private string m_headerTitle = string.Empty; + + [SerializeField] + private bool m_isInside; + + public ReordenatorNode() : base() + { + + } + + public void Init( string entryName, string entryInspectorName, List list, bool register = true ) + { + m_propertyName = entryName; + m_propertyInspectorName = entryInspectorName; + + m_propertyList = list; + + if( register ) + UIUtils.RegisterPropertyNode( this ); + } + + public override void Destroy() + { + base.Destroy(); + + m_propertyList.Clear(); + m_propertyList = null; + + UIUtils.UnregisterPropertyNode( this ); + } + + //public List PropertyList + //{ + // get { return m_propertyList; } + //} + + public int PropertyListCount + { + get { if ( m_propertyList != null ) return m_propertyList.Count; else return -1; } + } + + public string HeaderTitle { get { return m_headerTitle; } set { m_headerTitle = value; } } + + public bool HasTitle { get { return !string.IsNullOrEmpty( m_headerTitle ); } } + + public bool IsInside { get { return m_isInside; } set { m_isInside = value; } } + + public int RecursiveSetOrderOffset( int offset, bool lockit, int order = -1 ) + { + //Debug.Log( Locked + " " + PropertyName ); + + if ( Locked ) + return offset; + + if( order > -1 ) + OrderIndex = order; + + int currentOffset = offset; + + if( m_propertyList != null ) + m_propertyList.Sort( ( x, y ) => { return ( x as PropertyNode ).OrderIndex.CompareTo( ( y as PropertyNode ).OrderIndex ); } ); + + OrderIndexOffset = currentOffset - RawOrderIndex; + currentOffset++; + + if ( m_propertyList != null ) + for ( int i = 0; i < m_propertyList.Count; i++ ) + { + ReordenatorNode rnode = m_propertyList[ i ] as ReordenatorNode; + if ( rnode != null ) + { + currentOffset = rnode.RecursiveSetOrderOffset( currentOffset, false ); + } + else + { + PropertyNode pnode = m_propertyList[ i ] as PropertyNode; + { + pnode.OrderIndexOffset = currentOffset - pnode.RawOrderIndex;// + ( HasTitle ? 1 : 0 ); + } + currentOffset++; + } + } + + if ( lockit ) + Locked = true; + + return currentOffset; + } + + public int RecursiveCount() + { + int amount = 0; + if ( HasTitle ) + amount += 1; + for ( int i = 0; i < m_propertyList.Count; i++ ) + { + if ( ( m_propertyList[ i ] is ReordenatorNode ) ) + amount += ( m_propertyList[ i ] as ReordenatorNode ).RecursiveCount(); + else + amount +=1; + } + return amount; + } + + public void RecursiveLog() + { + Debug.LogWarning( OrderIndex+" HEADER "+ PropertyName ); + for( int i = 0; i < m_propertyList.Count; i++ ) + { + if( ( m_propertyList[ i ] is ReordenatorNode ) ) + ( m_propertyList[ i ] as ReordenatorNode ).RecursiveLog(); + else + Debug.Log( ( m_propertyList[ i ] as PropertyNode ).OrderIndex+" "+( m_propertyList[ i ] as PropertyNode).PropertyName ); + } + } + + public bool Locked = false; + + public void RecursiveClear() + { + Locked = false; + if( m_propertyList != null) + for ( int i = 0; i < m_propertyList.Count; i++ ) + { + ReordenatorNode renode = ( m_propertyList[ i ] as ReordenatorNode ); + if ( renode != null ) + { + renode.RecursiveClear(); + } + } + } + + public bool RecursiveConnectedProperties() + { + bool connected = false; + if ( m_propertyList != null ) + { + for ( int i = 0; i < m_propertyList.Count; i++ ) + { + ReordenatorNode renode = ( m_propertyList[ i ] as ReordenatorNode ); + if ( renode != null ) + { + bool temp = renode.RecursiveConnectedProperties(); + if( temp ) + connected = true; + } else + { + if ( ( m_propertyList[ i ] as PropertyNode ).IsConnected ) + connected = true; + } + } + } + return connected; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs.meta new file mode 100644 index 00000000..19f0d9ec --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 91aad2b9cfaf3954c8c450c32d218981 +timeCreated: 1493053838 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs + uploadId: 723576 diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP.meta similarity index 67% rename from Assets/External/Horizon Based Ambient Occlusion/SRP.meta rename to Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP.meta index 4d695dcf..11d8b84b 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP.meta +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: b9eaca9eab5e52347a811cead6015f6f +guid: 7283c593c3b4be64e957cb2b91abe1af folderAsset: yes -timeCreated: 1582907081 +timeCreated: 1556618802 licenseType: Store DefaultImporter: userData: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs new file mode 100644 index 00000000..dcce16ec --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs @@ -0,0 +1,212 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "SRP Baked GI", "Miscellaneous", "Gets Baked GI info." )] + public sealed class BakedGINode : ParentNode + { + private const string BakedGIHeaderHDRP = "ASEBakedGI( {0}, {1}, {2}, {3} )"; + private readonly string[] BakedGIBodyHDRP = + { + "float3 ASEBakedGI( float3 positionWS, float3 normalWS, float2 uvStaticLightmap, float2 uvDynamicLightmap )\n", + "{\n", + "\tfloat3 positionRWS = GetCameraRelativePositionWS( positionWS );\n", + "\treturn SampleBakedGI( positionRWS, normalWS, uvStaticLightmap, uvDynamicLightmap );\n", + "}\n" + }; + + private const string BakedGIHeaderHDRP2 = "ASEBakedGI( {0}, {1}, {2}, {3}, {4} )"; + private readonly string[] BakedGIBodyHDRP2 = + { + "float3 ASEBakedGI( float3 positionWS, float3 normalWS, uint2 positionSS, float2 uvStaticLightmap, float2 uvDynamicLightmap )\n", + "{\n", + "\tfloat3 positionRWS = GetCameraRelativePositionWS( positionWS );\n", + "\tbool needToIncludeAPV = true;\n", + "\treturn SampleBakedGI( positionRWS, normalWS, positionSS, uvStaticLightmap, uvDynamicLightmap, needToIncludeAPV );\n", + "}\n" + }; + + private readonly string BakedGIHeaderURP = "ASEBakedGI( {0}, {1}, {2})"; + private readonly string[] BakedGIBodyURP = + { + "float3 ASEBakedGI( float3 normalWS, float2 uvStaticLightmap, bool applyScaling )\n", + "{\n", + "#ifdef LIGHTMAP_ON\n", + "\tif( applyScaling )\n", + "\t\tuvStaticLightmap = uvStaticLightmap * unity_LightmapST.xy + unity_LightmapST.zw;\n", + "\treturn SampleLightmap( uvStaticLightmap, normalWS );\n", + "#else\n", + "\treturn SampleSH(normalWS);\n", + "#endif\n", + "}\n" + }; + + private readonly string BakedGIHeaderURP2 = "ASEBakedGI( {0}, {1}, {2}, {3}, {4}, {5})"; + private readonly string[] BakedGIBodyURP2 = + { + "float3 ASEBakedGI( float3 positionWS, float3 normalWS, uint2 positionSS, float2 uvStaticLightmap, float2 uvDynamicLightmap, bool applyScaling )\n", + "{\n", + "#ifdef LIGHTMAP_ON\n", + "\tif (applyScaling)\n", + "\t{\n", + "\t\tuvStaticLightmap = uvStaticLightmap * unity_LightmapST.xy + unity_LightmapST.zw;\n", + "\t\tuvDynamicLightmap = uvDynamicLightmap * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;\n", + "\t}\n", + "#if defined(DYNAMICLIGHTMAP_ON)\n", + "\treturn SampleLightmap(uvStaticLightmap, uvDynamicLightmap, normalWS);\n", + "#else\n", + "\treturn SampleLightmap(uvStaticLightmap, normalWS);\n", + "#endif\n", + "#else\n", + "#if (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2))\n", + "\tif (_EnableProbeVolumes)\n", + "\t{\n", + "\t\tfloat3 bakeDiffuseLighting;\n", + "\t\tEvaluateAdaptiveProbeVolume(positionWS, normalWS, GetWorldSpaceNormalizeViewDir(positionWS), positionSS, bakeDiffuseLighting);\n", + "\t\treturn bakeDiffuseLighting;\n", + "\t}\n", + "\telse\n", + "\treturn SampleSH(normalWS);\n", + "#else\n", + "\treturn SampleSH(normalWS);\n", + "#endif\n", + "#endif\n", + "}\n" + }; + + private const string ApplyScalingStr = "Apply Scaling"; + + [SerializeField] + private bool m_applyScaling = true; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "World Position" ); + AddInputPort( WirePortDataType.FLOAT3, false, "World Normal" ); + AddInputPort( WirePortDataType.FLOAT2, false, "Static UV" ); + AddInputPort( WirePortDataType.FLOAT2, false, "Dynamic UV" ); + AddInputPort( WirePortDataType.FLOAT4, false, "Screen Position" ); + AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue ); + m_textLabelWidth = 95; + m_autoWrapProperties = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + + EditorGUILayout.HelpBox( "Screen Position input must be Normalized (xyz/w), which is the default setting for Screen Position node.", MessageType.Info ); + + m_applyScaling = EditorGUILayoutToggle( ApplyScalingStr, m_applyScaling ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( !dataCollector.IsSRP ) + { + UIUtils.ShowMessage( "Node only intended to use on HDRP and URP rendering pipelines" ); + return GenerateErrorValue(); + } + + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string positionWS; + if ( m_inputPorts[ 0 ].IsConnected ) + { + positionWS = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + } + else + { + positionWS = GeneratorUtils.GenerateWorldPosition( ref dataCollector, UniqueId ); + } + + string normalWS; + if ( m_inputPorts[ 1 ].IsConnected ) + { + normalWS = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + } + else + { + normalWS = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId ); + } + + string uvStaticLightmap = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + string uvDynamicLightmap = m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ); + + string screenPos; + string positionSS; + + if ( m_inputPorts[ 4 ].IsConnected ) + { + screenPos = m_inputPorts[ 4 ].GeneratePortInstructions( ref dataCollector ); + positionSS = string.Format( "( uint2 )( {0}.xy * _ScreenSize.xy )", screenPos ); + } + else + { + screenPos = GeneratorUtils.GenerateScreenPositionRaw( ref dataCollector, UniqueId, CurrentPrecisionType ); + positionSS = string.Format( "( uint2 )( {0}.xy / {0}.w * _ScreenSize.xy )", screenPos ); + } + + + string localVarName = "bakedGI" + OutputId; + + if ( dataCollector.TemplateDataCollectorInstance.IsHDRP ) + { + bool unityIsBeta = TemplateHelperFunctions.GetUnityBetaVersion( out int betaVersion ); + int unityVersion = TemplateHelperFunctions.GetUnityVersion(); + + if ( ASEPackageManagerHelper.CurrentHDRPBaseline == ASESRPBaseline.ASE_SRP_14 && unityVersion >= 20220326 || + ASEPackageManagerHelper.CurrentHDRPBaseline == ASESRPBaseline.ASE_SRP_16 && unityVersion >= 20230220 || + ASEPackageManagerHelper.CurrentHDRPBaseline == ASESRPBaseline.ASE_SRP_17 && unityIsBeta && betaVersion >= 15 || + ASEPackageManagerHelper.CurrentSRPVersion >= ( int )170003 ) + { + dataCollector.AddToPragmas( UniqueId, "multi_compile_fragment _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2" ); + + dataCollector.AddFunction( BakedGIBodyHDRP2[ 0 ], BakedGIBodyHDRP2, false ); + RegisterLocalVariable( 0, string.Format( BakedGIHeaderHDRP2, positionWS, normalWS, positionSS, uvStaticLightmap, uvDynamicLightmap ), ref dataCollector, localVarName ); + } + else + { + dataCollector.AddFunction( BakedGIBodyHDRP[ 0 ], BakedGIBodyHDRP, false ); + RegisterLocalVariable( 0, string.Format( BakedGIHeaderHDRP, positionWS, normalWS, uvStaticLightmap, uvDynamicLightmap ), ref dataCollector, localVarName ); + } + } + else + { + if ( ASEPackageManagerHelper.CurrentURPBaseline >= ASESRPBaseline.ASE_SRP_15 ) + { + dataCollector.AddToPragmas( UniqueId, "multi_compile_fragment _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2" ); + + dataCollector.AddFunction( BakedGIBodyURP2[ 0 ], BakedGIBodyURP2, false ); + RegisterLocalVariable( 0, string.Format( BakedGIHeaderURP2, positionWS, normalWS, positionSS, uvStaticLightmap, uvDynamicLightmap, m_applyScaling ? "true" : "false" ), ref dataCollector, localVarName ); + } + else + { + dataCollector.AddFunction( BakedGIBodyURP[ 0 ], BakedGIBodyURP, false ); + RegisterLocalVariable( 0, string.Format( BakedGIHeaderURP, normalWS, uvStaticLightmap, m_applyScaling ? "true" : "false" ), ref dataCollector, localVarName ); + } + } + return localVarName; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_applyScaling = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_applyScaling ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs.meta new file mode 100644 index 00000000..33cad499 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 6aacdecbe4e41f44988580058f7e0000 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/ExposureNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/ExposureNode.cs new file mode 100644 index 00000000..19232161 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/ExposureNode.cs @@ -0,0 +1,41 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Exposure", "Lighting", "Get camera exposure value." )] + public sealed class Exposure : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + bool isHDRP = ( dataCollector.CurrentSRPType == TemplateSRPType.HDRP ); + bool isURP17xOrAbove = ( dataCollector.CurrentSRPType == TemplateSRPType.URP && ASEPackageManagerHelper.CurrentSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_17 ); + string result; + + if ( isHDRP || isURP17xOrAbove ) + { + result = "GetCurrentExposureMultiplier()"; + } + else + { + result = "( 1.0 )"; + } + + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/ExposureNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/ExposureNode.cs.meta new file mode 100644 index 00000000..f920b284 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/ExposureNode.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: ea093c9de958f3e4f85654376b4933eb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/ExposureNode.cs + uploadId: 723576 diff --git a/Assets/External/Horizon Based Ambient Occlusion.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP.meta similarity index 77% rename from Assets/External/Horizon Based Ambient Occlusion.meta rename to Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP.meta index 9dd956ea..fc70ae8a 100644 --- a/Assets/External/Horizon Based Ambient Occlusion.meta +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a3239084a7d52634ab69a498b1832189 +guid: 8469536c6560ff64aaac451c6f38dbba folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/ASEDiffusionProfile.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/ASEDiffusionProfile.cs new file mode 100644 index 00000000..b4ae5fe5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/ASEDiffusionProfile.cs @@ -0,0 +1,87 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +#if UNITY_2019_3_OR_NEWER +using UnityEditor; +using UnityEngine; +using System; +using System.Reflection; + +namespace AmplifyShaderEditor +{ + public class ASEDiffusionProfile : MaterialPropertyDrawer + { + string m_hashField = string.Empty; + + public ASEDiffusionProfile( object guidField ) + { + m_hashField = guidField.ToString(); + } + + public override void OnGUI( Rect position, MaterialProperty prop, String label, MaterialEditor editor ) + { + var guid = HDUtilsEx.ConvertVector4ToGUID( prop.vectorValue ); + var profile = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( guid ), DiffusionProfileSettingsEx.Type ); + + EditorGUI.BeginChangeCheck(); + profile = EditorGUI.ObjectField( position, new GUIContent( label ), profile, DiffusionProfileSettingsEx.Type, false ); + if( EditorGUI.EndChangeCheck() ) + { + Vector4 newGuid = Vector4.zero; + float hash = 0; + if( profile != null ) + { + var guid2 = AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( profile ) ); + newGuid = HDUtilsEx.ConvertGUIDToVector4( guid2 ); + hash = HDShadowUtilsEx.Asfloat( DiffusionProfileSettingsEx.Hash( profile ) ); + } + prop.vectorValue = newGuid; + + var hashField = MaterialEditor.GetMaterialProperty( new UnityEngine.Object[] { editor.target }, m_hashField ); + if( hashField != null ) + { + hashField.floatValue = hash; + } + } + + if( profile == null ) + prop.vectorValue = Vector4.zero; + + DiffusionProfileMaterialUIEx.DrawDiffusionProfileWarning( profile ); + } + + private static class DiffusionProfileMaterialUIEx + { + private static System.Type type = null; + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.Rendering.HighDefinition.DiffusionProfileMaterialUI, Unity.RenderPipelines.HighDefinition.Editor" ) : type; } } + + public static void DrawDiffusionProfileWarning( UnityEngine.Object obj ) + { + object[] parameters = new object[] { obj }; + MethodInfo method = Type.GetMethod( "DrawDiffusionProfileWarning", BindingFlags.Static | BindingFlags.NonPublic ); + method.Invoke( null, parameters ); + } + } + + private static class HDShadowUtilsEx + { + private static System.Type type = null; + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.Rendering.HighDefinition.HDShadowUtils, Unity.RenderPipelines.HighDefinition.Runtime" ) : type; } } + + public static float Asfloat( uint val ) + { + object[] parameters = new object[] { val }; + MethodInfo method = Type.GetMethod( "Asfloat", new Type[] { typeof( uint ) } ); + return (float)method.Invoke( null, parameters ); + } + + public static uint Asuint( float val ) + { + object[] parameters = new object[] { val }; + MethodInfo method = Type.GetMethod( "Asuint", new Type[] { typeof( float ) } ); + return (uint)method.Invoke( null, parameters ); + } + } + } +} +#endif //UNITY_2019_3_OR_NEWER diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/ASEDiffusionProfile.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/ASEDiffusionProfile.cs.meta new file mode 100644 index 00000000..94c26234 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/ASEDiffusionProfile.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 9e6450dc84bf1ed4cad27fcf99cad3fb +timeCreated: 1520330108 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/ASEDiffusionProfile.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/DiffusionProfileNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/DiffusionProfileNode.cs new file mode 100644 index 00000000..d8ae201f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/DiffusionProfileNode.cs @@ -0,0 +1,466 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +#if UNITY_2019_1_OR_NEWER +using UnityEditor; +using UnityEngine; +using System; +using System.Text; +using System.Reflection; + +namespace AmplifyShaderEditor +{ + public static class HDUtilsEx + { + private static System.Type type = null; +#if UNITY_2019_3_OR_NEWER + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.Rendering.HighDefinition.HDUtils, Unity.RenderPipelines.HighDefinition.Runtime" ) : type; } } +#else + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.Experimental.Rendering.HDPipeline.HDUtils, Unity.RenderPipelines.HighDefinition.Runtime" ) : type; } } +#endif + + public static string ConvertVector4ToGUID( Vector4 vector ) + { + object[] parameters = new object[] { vector }; + MethodInfo method; + method = Type.GetMethod( "ConvertVector4ToGUID", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof( Vector4 ) }, null ); + if( method == null ) + method = Type.GetMethod( "ConvertVector4ToGUID", new Type[] { typeof( Vector4 ) } ); + return (string)method.Invoke( null, parameters ); + } + + public static Vector4 ConvertGUIDToVector4( string guid ) + { + object[] parameters = new object[] { guid }; + MethodInfo method; + method = Type.GetMethod( "ConvertGUIDToVector4", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof( string ) }, null ); + if( method == null ) + method = Type.GetMethod( "ConvertGUIDToVector4", new Type[] { typeof( string ) } ); + return (Vector4)method.Invoke( null, parameters ); + } + } + + public static class DiffusionProfileSettingsEx + { + private static System.Type type = null; +#if UNITY_2019_3_OR_NEWER + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.Rendering.HighDefinition.DiffusionProfileSettings, Unity.RenderPipelines.HighDefinition.Runtime" ) : type; } } +#else + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.Experimental.Rendering.HDPipeline.DiffusionProfileSettings, Unity.RenderPipelines.HighDefinition.Runtime" ) : type; } } +#endif + + public static uint Hash( UnityEngine.Object m_instance ) + { + FieldInfo field; + field = Type.GetField( "profile", BindingFlags.Instance | BindingFlags.NonPublic ); + if( field == null ) + field = Type.GetField( "profile" ); + var profile = field.GetValue( m_instance ); + var hashField = profile.GetType().GetField( "hash" ); + return (uint)hashField.GetValue( profile ); + } + } + + [Serializable] + [NodeAttributes( "Diffusion Profile", "Constants And Properties", "Returns Diffusion Profile Hash Id. To be used on Diffusion Profile port on HDRP templates.", KeyCode.None, true, 0, int.MaxValue )] + public sealed class DiffusionProfileNode : PropertyNode + { + [SerializeField] + private UnityEngine.Object m_defaultValue; + + [SerializeField] + private UnityEngine.Object m_materialValue; + + [SerializeField] + private bool m_defaultInspector = false; + + private bool m_isEditingFields; + //[NonSerialized] + //private DiffusionProfileSettings m_previousValue; + + public const string NodeErrorMsg = "Only valid on HDRP"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_drawPrecisionUI = false; + m_currentPrecisionType = PrecisionType.Float; + m_srpBatcherCompatible = true; + m_freeType = false; +#if UNITY_2019_3_OR_NEWER + m_freeType = true; +#endif + m_errorMessageTypeIsError = NodeMessageType.Error; + m_errorMessageTooltip = NodeErrorMsg; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + UIUtils.RegisterPropertyNode( this ); + } + + public override void CopyDefaultsToMaterial() + { + m_materialValue = m_defaultValue; + } + + public override void DrawSubProperties() + { + m_defaultValue = EditorGUILayoutObjectField( Constants.DefaultValueLabel, m_defaultValue, DiffusionProfileSettingsEx.Type, true ) /*as UnityEngine.Object*/; + } + + public override void DrawMaterialProperties() + { + if( m_materialMode ) + EditorGUI.BeginChangeCheck(); + + m_materialValue = EditorGUILayoutObjectField( Constants.MaterialValueLabel, m_materialValue, DiffusionProfileSettingsEx.Type, true ) /*as DiffusionProfileSettings*/; + + if( m_materialMode && EditorGUI.EndChangeCheck() ) + { + m_requireMaterialUpdate = true; + } + } + + public override void DrawMainPropertyBlock() + { + EditorGUILayout.BeginVertical(); + { + if( m_freeType ) + { + PropertyType parameterType = (PropertyType)EditorGUILayoutEnumPopup( ParameterTypeStr, m_currentParameterType ); + if( parameterType != m_currentParameterType ) + { + ChangeParameterType( parameterType ); + BeginPropertyFromInspectorCheck(); + } + } + + if( m_freeName ) + { + switch( m_currentParameterType ) + { + case PropertyType.Property: + case PropertyType.InstancedProperty: + { + m_defaultInspector = EditorGUILayoutToggle( "Default Inspector", m_defaultInspector ); + if( m_defaultInspector ) + EditorGUILayout.HelpBox("While \"Default Inspector\" is turned ON you can't reorder this property or change it's name, and you can only have one per shader, use it only if you intend to share this shader with non-ASE users",MessageType.Info); + EditorGUI.BeginDisabledGroup( m_defaultInspector ); + ShowPropertyInspectorNameGUI(); + ShowPropertyNameGUI( true ); + EditorGUI.EndDisabledGroup(); + ShowVariableMode(); + ShowAutoRegister(); + ShowPrecision(); + ShowToolbar(); + } + break; + case PropertyType.Global: + { + ShowPropertyInspectorNameGUI(); + ShowPropertyNameGUI( false ); + ShowVariableMode(); + ShowAutoRegister(); + ShowPrecision(); + ShowDefaults(); + } + break; + case PropertyType.Constant: + { + ShowPropertyInspectorNameGUI(); + ShowPrecision(); + ShowDefaults(); + } + break; + } + } + } + EditorGUILayout.EndVertical(); + } + + public override void OnNodeLogicUpdate(DrawInfo drawInfo) + { + base.OnNodeLogicUpdate( drawInfo ); + m_showErrorMessage = ( ContainerGraph.CurrentCanvasMode == NodeAvailability.SurfaceShader ) || + ( ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader && ContainerGraph.CurrentSRPType != TemplateSRPType.HDRP ); + } + + public override void DrawProperties() + { + base.DrawProperties(); + if ( m_showErrorMessage ) + { + EditorGUILayout.HelpBox(NodeErrorMsg, MessageType.Error ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + + if( m_currentParameterType != PropertyType.Constant ) + { + if( m_defaultInspector ) + return "_DiffusionProfileHash"; + return PropertyData( dataCollector.PortCategory ); + } + +#if UNITY_2019_3_OR_NEWER + return RoundTrip.ToRoundTrip( HDShadowUtilsEx.Asfloat( DefaultHash ) ); +#else + return "asfloat(" + DefaultHash.ToString() + ")"; +#endif + } + + + public override string GetUniformValue() + { + if( m_defaultInspector ) + return "float _DiffusionProfileHash"; + return base.GetUniformValue(); + } + + public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) + { + if( m_defaultInspector ) + { + dataType = "float"; + dataName = "_DiffusionProfileHash"; + return true; + } + return base.GetUniformData( out dataType, out dataName, ref fullValue ); + } + + public override string GetPropertyValue() + { + Vector4 asset = Vector4.zero; + if( m_defaultValue != null ) + asset = HDUtilsEx.ConvertGUIDToVector4( AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_defaultValue ) ) ); + string assetVec = RoundTrip.ToRoundTrip( asset.x ) + ", " + RoundTrip.ToRoundTrip( asset.y ) + ", " + RoundTrip.ToRoundTrip( asset.z ) + ", " + RoundTrip.ToRoundTrip( asset.w ); + string lineOne = string.Empty; + string lineTwo = string.Empty; + if( m_defaultInspector ) + { + lineOne = PropertyAttributes + "[HideInInspector]_DiffusionProfileAsset(\"" + m_propertyInspectorName + "\", Vector) = ( " + assetVec + " )"; + lineTwo = "\n[HideInInspector]_DiffusionProfileHash(\"" + m_propertyInspectorName + "\", Float) = " + RoundTrip.ToRoundTrip( HDShadowUtilsEx.Asfloat( DefaultHash ) ); + } + else + { +#if UNITY_2020_2_OR_NEWER + lineOne = "\n[DiffusionProfile]" + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + RoundTrip.ToRoundTrip( HDShadowUtilsEx.Asfloat( DefaultHash ) ); + lineTwo = PropertyAttributes + "[HideInInspector]" + m_propertyName + "_Asset(\"" + m_propertyInspectorName + "\", Vector) = ( " + assetVec + " )"; +#else + lineOne = PropertyAttributes + "[ASEDiffusionProfile(" + m_propertyName + ")]" + m_propertyName + "_asset(\"" + m_propertyInspectorName + "\", Vector) = ( " + assetVec + " )"; + lineTwo = "\n[HideInInspector]" + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + RoundTrip.ToRoundTrip( HDShadowUtilsEx.Asfloat( DefaultHash ) ); +#endif + } + + return lineOne + lineTwo; + } + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + + if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) + { + if( m_materialValue != null ) + { + Vector4 asset = HDUtilsEx.ConvertGUIDToVector4( AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_materialValue ) ) ); + if( m_defaultInspector ) + { + mat.SetVector( "_DiffusionProfileAsset", asset ); + mat.SetFloat( "_DiffusionProfileHash", HDShadowUtilsEx.Asfloat( MaterialHash ) ); + } + else + { + mat.SetVector( m_propertyName + "_asset", asset ); + mat.SetFloat( m_propertyName, HDShadowUtilsEx.Asfloat( MaterialHash ) ); + } + } + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + string propertyAsset = m_propertyName + "_asset"; + if( m_defaultInspector ) + propertyAsset = "_DiffusionProfileAsset"; + + if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( propertyAsset ) ) + { + var guid = HDUtilsEx.ConvertVector4ToGUID( material.GetVector( propertyAsset ) ); + var profile = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( guid ), DiffusionProfileSettingsEx.Type ); + if( profile != null ) + m_materialValue = profile; + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + string defaultGuid = ( m_defaultValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_defaultValue ) ) : "0"; + IOUtils.AddFieldValueToString( ref nodeInfo, defaultGuid ); + string materialGuid = ( m_materialValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_materialValue ) ) : "0"; + IOUtils.AddFieldValueToString( ref nodeInfo, materialGuid ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultInspector ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + if( UIUtils.CurrentShaderVersion() > 17004 ) + base.ReadFromString( ref nodeParams ); + else + ParentReadFromString( ref nodeParams ); + + string defaultGuid = GetCurrentParam( ref nodeParams ); + if( defaultGuid.Length > 1 ) + { + m_defaultValue = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( defaultGuid ), DiffusionProfileSettingsEx.Type ); + } + if( UIUtils.CurrentShaderVersion() > 17004 ) + { + string materialGuid = GetCurrentParam( ref nodeParams ); + if( materialGuid.Length > 1 ) + { + m_materialValue = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( materialGuid ), DiffusionProfileSettingsEx.Type ); + } + } + if( UIUtils.CurrentShaderVersion() > 17900 ) + { + m_defaultInspector = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void ReadOutputDataFromString( ref string[] nodeParams ) + { + base.ReadOutputDataFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() < 17005 ) + m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, WirePortDataType.FLOAT, false ); + } + + public override string GetPropertyValStr() + { + if( m_defaultInspector ) + return "_DiffusionProfileHash"; + return PropertyName; + } + + //Vector4 ProfileGUID { get { return ( m_diffusionProfile != null ) ? HDUtils.ConvertGUIDToVector4( AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_diffusionProfile ) ) ) : Vector4.zero; } } + uint DefaultHash { get { return ( m_defaultValue != null ) ? DiffusionProfileSettingsEx.Hash( m_defaultValue ) : 0; } } + uint MaterialHash { get { return ( m_materialValue != null ) ? DiffusionProfileSettingsEx.Hash( m_materialValue ) : 0; } } + + private static class HDShadowUtilsEx + { + private static System.Type type = null; + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.Rendering.HighDefinition.HDShadowUtils, Unity.RenderPipelines.HighDefinition.Runtime" ) : type; } } + + public static float Asfloat( uint val ) + { +#if UNITY_2019_3_OR_NEWER + object[] parameters = new object[] { val }; + MethodInfo method = Type.GetMethod( "Asfloat", new Type[] { typeof( uint ) } ); + return (float)method.Invoke( null, parameters ); +#else + return HDShadowUtils.Asfloat( val ); +#endif + } + + public static uint Asuint( float val ) + { +#if UNITY_2019_3_OR_NEWER + + object[] parameters = new object[] { val }; + MethodInfo method = Type.GetMethod( "Asuint", new Type[] { typeof( float ) } ); + return (uint)method.Invoke( null, parameters ); +#else + return HDShadowUtils.Asuint( val ); +#endif + } + } + + private static class RoundTrip + { + private static String[] zeros = new String[ 1000 ]; + + static RoundTrip() + { + for( int i = 0; i < zeros.Length; i++ ) + { + zeros[ i ] = new String( '0', i ); + } + } + + public static String ToRoundTrip( double value ) + { + String str = value.ToString( "r" ); + int x = str.IndexOf( 'E' ); + if( x < 0 ) return str; + + int x1 = x + 1; + String exp = str.Substring( x1, str.Length - x1 ); + int e = int.Parse( exp ); + + String s = null; + int numDecimals = 0; + if( value < 0 ) + { + int len = x - 3; + if( e >= 0 ) + { + if( len > 0 ) + { + s = str.Substring( 0, 2 ) + str.Substring( 3, len ); + numDecimals = len; + } + else + s = str.Substring( 0, 2 ); + } + else + { + // remove the leading minus sign + if( len > 0 ) + { + s = str.Substring( 1, 1 ) + str.Substring( 3, len ); + numDecimals = len; + } + else + s = str.Substring( 1, 1 ); + } + } + else + { + int len = x - 2; + if( len > 0 ) + { + s = str[ 0 ] + str.Substring( 2, len ); + numDecimals = len; + } + else + s = str[ 0 ].ToString(); + } + + if( e >= 0 ) + { + e = e - numDecimals; + String z = ( e < zeros.Length ? zeros[ e ] : new String( '0', e ) ); + s = s + z; + } + else + { + e = ( -e - 1 ); + String z = ( e < zeros.Length ? zeros[ e ] : new String( '0', e ) ); + if( value < 0 ) + s = "-0." + z + s; + else + s = "0." + z + s; + } + + return s; + } + } + } +} +#endif diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/DiffusionProfileNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/DiffusionProfileNode.cs.meta new file mode 100644 index 00000000..378f818c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/DiffusionProfileNode.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 3998227d1294c2d4d98caf969b04f89a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/DiffusionProfileNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/HDEmissionNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/HDEmissionNode.cs new file mode 100644 index 00000000..8cfd816e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/HDEmissionNode.cs @@ -0,0 +1,152 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + using UnityEngine; + + [Serializable] + [NodeAttributes( "HD Emission", "Miscellaneous", "Get emission HDR Color. Only available on HDRP." )] + public sealed class HDEmissionNode : ParentNode + { + public enum HDEmissionIntensityUnit + { + Luminance, + EV100 + }; + + public readonly string[] EmissionFunctionWithNormalize = + { + "float3 ASEGetEmissionHDRColorNormalize(float3 ldrColor, float luminanceIntensity, float exposureWeight, float inverseCurrentExposureMultiplier)\n", + "{\n", + "\tldrColor = ldrColor * rcp(max(Luminance(ldrColor), 1e-6));\n", + "\tfloat3 hdrColor = ldrColor * luminanceIntensity;\n", + "\thdrColor = lerp( hdrColor* inverseCurrentExposureMultiplier, hdrColor, exposureWeight);\n", + "\treturn hdrColor;\n", + "}\n", + }; + + public readonly string[] EmissionFunction = + { + "float3 ASEGetEmissionHDRColor(float3 ldrColor, float luminanceIntensity, float exposureWeight, float inverseCurrentExposureMultiplier)\n", + "{\n", + "\tfloat3 hdrColor = ldrColor * luminanceIntensity;\n", + "\thdrColor = lerp( hdrColor* inverseCurrentExposureMultiplier, hdrColor, exposureWeight);\n", + "\treturn hdrColor;\n", + "}\n", + }; + + public const string CommonLightingLib = "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl"; + public const string EmissionHeaderLuminance = "ASEGetEmissionHDRColor{0}({1},{2},{3},GetInverseCurrentExposureMultiplier())"; + public const string EmissionHeaderEV100 = "ASEGetEmissionHDRColor{0}({1},ConvertEvToLuminance({2}),{3},GetInverseCurrentExposureMultiplier())"; + + public const string IntensityUnityLabel = "Intensity Unit"; + + public const string NormalizeColorLabel = "Normalize Color"; + public const string ErrorOnCompilationMsg = "Attempting to use HDRP specific node on incorrect SRP or Builtin RP."; + public const string MinorVersionMsg = "This node require at least Unity 2019.1/HDRP v5 to properly work."; + public const string NodeErrorMsg = "Only valid on HDRP"; + public const string MinorNodeErrorMsg = "Invalid Unity/HDRP version"; + + [SerializeField] + private HDEmissionIntensityUnit m_intensityUnit = HDEmissionIntensityUnit.Luminance; + + [SerializeField] + private bool m_normalizeColor = false; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "Color" ); + AddInputPort( WirePortDataType.FLOAT, false, "Intensity" ); + AddInputPort( WirePortDataType.FLOAT, false, "Exposition Weight" ); + AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue ); + + m_errorMessageTooltip = NodeErrorMsg; + m_errorMessageTypeIsError = NodeMessageType.Error; + m_autoWrapProperties = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + m_intensityUnit = (HDEmissionIntensityUnit)EditorGUILayoutEnumPopup( IntensityUnityLabel, m_intensityUnit ); + m_normalizeColor = EditorGUILayoutToggle( NormalizeColorLabel, m_normalizeColor ); + if( m_showErrorMessage ) + { + EditorGUILayout.HelpBox( NodeErrorMsg , MessageType.Error ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( !dataCollector.IsSRP || !dataCollector.TemplateDataCollectorInstance.IsHDRP ) + { + UIUtils.ShowMessage( ErrorOnCompilationMsg , MessageSeverity.Error ); + return GenerateErrorValue(); + } + + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + +#if UNITY_2020_3_OR_NEWER + dataCollector.AddToIncludes( UniqueId , CommonLightingLib ); +#endif + string colorValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string intensityValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string expositionWeightValue = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + string functionPrefix = string.Empty; + if( m_normalizeColor ) + { + functionPrefix = "Normalize"; + dataCollector.AddFunction( EmissionFunctionWithNormalize[ 0 ], EmissionFunctionWithNormalize , false); + } + else + { + dataCollector.AddFunction( EmissionFunction[ 0 ], EmissionFunction, false ); + } + + string varName = "hdEmission" + OutputId; + string varValue = string.Empty; + switch( m_intensityUnit ) + { + default: + case HDEmissionIntensityUnit.Luminance: + varValue = string.Format( EmissionHeaderLuminance, functionPrefix, colorValue, intensityValue, expositionWeightValue ); + break; + case HDEmissionIntensityUnit.EV100: + varValue = string.Format( EmissionHeaderEV100, functionPrefix, colorValue, intensityValue, expositionWeightValue ); + break; + } + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, varName, varValue ); + m_outputPorts[ 0 ].SetLocalValue( varName, dataCollector.PortCategory ); + return varName; + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + m_showErrorMessage = ( ContainerGraph.CurrentCanvasMode == NodeAvailability.SurfaceShader ) || + ( ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader && ContainerGraph.CurrentSRPType != TemplateSRPType.HDRP ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + Enum.TryParse( GetCurrentParam( ref nodeParams ), out m_intensityUnit ); + m_normalizeColor = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_intensityUnit ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_normalizeColor ); + } + } +} +//#endif diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/HDEmissionNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/HDEmissionNode.cs.meta new file mode 100644 index 00000000..11383399 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/HDEmissionNode.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: d6b42642ffce2754fba2cf8305e1da68 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/HDRP/HDEmissionNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs new file mode 100644 index 00000000..b6981ace --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs @@ -0,0 +1,128 @@ +// Amplify Shader Editor - Visual Shader vEditing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [NodeAttributes( "Material Quality", "Logical Operators", "Choose between separate branches according to currently selected Quality (SRP only) ", Available = true )] + public class MaterialQualityNode : ParentNode + { + private const string SRPError = "Node intended to be used only on SRP templates as it makes use of keywords defined over that environment."; + + private const string MaxKeyword = "MATERIAL_QUALITY_HIGH"; + private const string MedKeyword = "MATERIAL_QUALITY_MEDIUM"; + private const string MinKeyword = "MATERIAL_QUALITY_LOW"; + private const string MaterialPragmas = "#pragma shader_feature " + MaxKeyword + " " + MedKeyword + " " + MinKeyword; + private readonly string[] MaterialCode = + { + "#if defined("+MaxKeyword+")", + "#elif defined("+MedKeyword+")", + "#else", + "#endif" + }; + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "High" ); + AddInputPort( WirePortDataType.FLOAT, false, "Medium" ); + AddInputPort( WirePortDataType.FLOAT, false, "Low" ); + AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_errorMessageTypeIsError = NodeMessageType.Error; + m_errorMessageTooltip = SRPError; + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + if( !ContainerGraph.IsSRP ) + { + if( !m_showErrorMessage ) + { + m_showErrorMessage = true; + } + } + else + { + if( m_showErrorMessage ) + { + m_showErrorMessage = false; + } + } + } + public override void OnInputPortConnected( int portId , int otherNodeId , int otherPortId , bool activateNode = true ) + { + base.OnInputPortConnected( portId , otherNodeId , otherPortId , activateNode ); + UpdateConnections(); + } + + public override void OnConnectedOutputNodeChanges( int inputPortId , int otherNodeId , int otherPortId , string name , WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId , otherNodeId , otherPortId , name , type ); + UpdateConnections(); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + UpdateConnections(); + } + + private void UpdateConnections() + { + WirePortDataType mainType = WirePortDataType.FLOAT; + + int highest = UIUtils.GetPriority( mainType ); + for( int i = 0 ; i < m_inputPorts.Count ; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + WirePortDataType portType = m_inputPorts[ i ].GetOutputConnection().DataType; + if( UIUtils.GetPriority( portType ) > highest ) + { + mainType = portType; + highest = UIUtils.GetPriority( portType ); + } + } + } + + for( int i = 0 ; i < m_inputPorts.Count ; i++ ) + { + m_inputPorts[ i ].ChangeType( mainType , false ); + } + + m_outputPorts[ 0 ].ChangeType( mainType , false ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + dataCollector.AddToDirectives( MaterialPragmas ); + string maxQualityValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string medQualityValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string minQualityValue = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + string localVarName = "currQuality" + OutputId; + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, localVarName, "0" ); + + //High + dataCollector.AddLocalVariable( UniqueId, MaterialCode[ 0 ], true ); + dataCollector.AddLocalVariable( UniqueId, localVarName, maxQualityValue, false, true ); + + //Medium + dataCollector.AddLocalVariable( UniqueId, MaterialCode[ 1 ], true ); + dataCollector.AddLocalVariable( UniqueId, localVarName, medQualityValue, false, true ); + + //Low + dataCollector.AddLocalVariable( UniqueId, MaterialCode[ 2 ], true ); + dataCollector.AddLocalVariable( UniqueId, localVarName, minQualityValue,false,true ); + m_outputPorts[ 0 ].SetLocalValue( localVarName, dataCollector.PortCategory ); + + dataCollector.AddLocalVariable( UniqueId, MaterialCode[ 3 ], true ); + return localVarName; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs.meta new file mode 100644 index 00000000..e0e4974d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 8245233e0833c884b8a176943d80514b +timeCreated: 1570027418 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/URP.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/URP.meta new file mode 100644 index 00000000..e036885f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/URP.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2d54cc941c4e4d249be04d0d3760659a +folderAsset: yes +timeCreated: 1617727953 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/URP/ReflectionProbeNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/URP/ReflectionProbeNode.cs new file mode 100644 index 00000000..d7f55858 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/URP/ReflectionProbeNode.cs @@ -0,0 +1,114 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Reflection Probe", "Miscellaneous", "Provides access to the nearest Reflection Probe to the object. Only available on URP.\n\nView Dir OS: View Direction in Object-space\nNormal OS: Normal in Object-space\nLOD: Index of level-of-detail" )] + public class ReflectionProbeNode : ParentNode + { + private const string ReflectionProbeStr = "SHADERGRAPH_REFLECTION_PROBE({0},{1},{2})"; + private const string InfoTransformSpace = "Both View Dir and Normal vectors are set in Object Space"; + public const string NodeErrorMsg = "Only valid on URP"; + public const string ErrorOnCompilationMsg = "Attempting to use URP specific node on incorrect SRP or Builtin RP."; + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "View Dir OS" ); + AddInputPort( WirePortDataType.FLOAT3, false, "Normal OS" ); + AddInputPort( WirePortDataType.FLOAT, false, "LOD" ); + AddOutputPort( WirePortDataType.FLOAT3, "Out" ); + m_autoWrapProperties = true; + m_errorMessageTooltip = NodeErrorMsg; + m_errorMessageTypeIsError = NodeMessageType.Error; + m_previewShaderGUID = "f7d3fa6f91f1f184f89060feb01051a1"; + m_drawPreviewAsSphere = true; + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + m_showErrorMessage = ( ContainerGraph.CurrentCanvasMode == NodeAvailability.SurfaceShader ) || + ( ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader && ContainerGraph.CurrentSRPType != TemplateSRPType.URP ); + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUILayout.HelpBox( InfoTransformSpace, MessageType.Info ); + if ( m_showErrorMessage ) + { + EditorGUILayout.HelpBox( NodeErrorMsg, MessageType.Error ); + } + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + PreviewMaterial.SetInt( "viewDirInput", m_inputPorts[ 0 ].IsConnected ? 1 : 0 ); + PreviewMaterial.SetInt( "normalInput", m_inputPorts[ 1 ].IsConnected ? 1 : 0 ); + PreviewMaterial.SetInt( "lodInput", m_inputPorts[ 2 ].IsConnected ? 1 : 0 ); + } + + uint viewDirInput; + uint normalInput; + uint lodInput; + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( !dataCollector.IsSRP || !dataCollector.TemplateDataCollectorInstance.IsLWRP ) + { + UIUtils.ShowMessage( ErrorOnCompilationMsg, MessageSeverity.Error ); + return GenerateErrorValue(); + } + + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + if ( dataCollector.IsSRP && dataCollector.CurrentSRPType == TemplateSRPType.URP ) + { + if ( ASEPackageManagerHelper.PackageSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_12 ) + { + dataCollector.AddToPragmas( UniqueId, "multi_compile_fragment _ _REFLECTION_PROBE_BLENDING" ); + dataCollector.AddToPragmas( UniqueId, "multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION" ); + + } + + if ( ASEPackageManagerHelper.PackageSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_14 ) + { + dataCollector.AddToPragmas( UniqueId, "multi_compile _ _FORWARD_PLUS" ); + } + } + + string viewDirOS; + if ( m_inputPorts[ 0 ].IsConnected ) + { + viewDirOS = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + } + else + { + viewDirOS = dataCollector.TemplateDataCollectorInstance.GetViewDir( CurrentPrecisionType, space: ViewSpace.Object ); + } + + string normalOS; + if ( m_inputPorts[ 1 ].IsConnected ) + { + normalOS = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + } + else + { + normalOS = dataCollector.TemplateDataCollectorInstance.GetVertexNormal( CurrentPrecisionType ); + } + + string lod = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + + RegisterLocalVariable( outputId, string.Format( ReflectionProbeStr, viewDirOS, normalOS, lod ), ref dataCollector ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/URP/ReflectionProbeNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/URP/ReflectionProbeNode.cs.meta new file mode 100644 index 00000000..275ddeae --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/URP/ReflectionProbeNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 391a18455087a034bb4c09be42caa46a +timeCreated: 1617727965 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/URP/ReflectionProbeNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs new file mode 100644 index 00000000..1e8c6d49 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs @@ -0,0 +1,41 @@ +using System; + +namespace AmplifyShaderEditor +{ + public class SignalGeneratorNode : ParentNode, ISignalGenerator + { + public SignalGeneratorNode() : base() { } + public SignalGeneratorNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + SelfPowered = true; + } + + public void GenerateSignalPropagation() + { + System.Type myType = GetType(); + for ( int i = 0; i < m_inputPorts.Count; i++ ) + { + if ( m_inputPorts[ i ].IsConnected ) + { + m_inputPorts[ i ].GetOutputNode().ActivateNode( UniqueId, i, myType ); + } + } + } + + public void GenerateSignalInibitor() + { + for ( int i = 0; i < m_inputPorts.Count; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + ParentNode node = m_inputPorts[ i ].GetOutputNode(); + if( node != null ) + node.DeactivateNode( i, false ); + } + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs.meta new file mode 100644 index 00000000..1d60e907 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2f92560b009046f4a86504e682834405 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes.meta new file mode 100644 index 00000000..4f6f807b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 899b55cb557ca594f926ad64dfa4ad8f +folderAsset: yes +timeCreated: 1481126946 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs new file mode 100644 index 00000000..463528fd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs @@ -0,0 +1,58 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Add", "Math Operators", "Addition of two or more values ( A + B + .. )", null, KeyCode.A )] + public sealed class SimpleAddOpNode : DynamicTypeNode + { + private int m_cachedPropertyId = -1; + + protected override void CommonInit( int uniqueId ) + { + m_dynamicRestrictions = new WirePortDataType[] + { + WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.FLOAT3x3, + WirePortDataType.FLOAT4x4, + WirePortDataType.INT + }; + + base.CommonInit( uniqueId ); + m_extensibleInputPorts = true; + m_previewShaderGUID = "9eb150cbc752cbc458a0a37984b9934a"; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if ( m_cachedPropertyId == -1 ) + m_cachedPropertyId = Shader.PropertyToID( "_Count" ); + + PreviewMaterial.SetInt( m_cachedPropertyId, m_inputPorts.Count); + } + + public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); + string result = "( " + m_extensibleInputResults[ 0 ]; + for ( int i = 1; i < m_extensibleInputResults.Count; i++ ) + { + result += " + " + m_extensibleInputResults[ i ]; + } + result += " )"; + return result; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs.meta new file mode 100644 index 00000000..ea01ea39 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6ca9162ab6c708f40bbc21f0c22909fa +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs new file mode 100644 index 00000000..0cafeb3c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs @@ -0,0 +1,45 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Divide", "Math Operators", "Division of two values ( A / B )", null, KeyCode.D )] + public sealed class SimpleDivideOpNode : DynamicTypeNode + { + protected override void CommonInit( int uniqueId ) + { + m_dynamicRestrictions = new WirePortDataType[] + { + WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.FLOAT3x3, + WirePortDataType.FLOAT4x4, + WirePortDataType.INT + }; + + base.CommonInit( uniqueId ); + m_allowMatrixCheck = true; + m_previewShaderGUID = "409f06d00d1094849b0834c52791fa72"; + } + + public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + SetExtensibleInputData( outputId, ref dataCollector, ignoreLocalvar ); + string result = "( " + m_extensibleInputResults[ 0 ]; + for ( int i = 1; i < m_extensibleInputResults.Count; i++ ) + { + result += " / " + m_extensibleInputResults[ i ]; + } + result += " )"; + return result; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs.meta new file mode 100644 index 00000000..e0e6bf17 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e80e305761a1e6c4898e401a64b17f84 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs new file mode 100644 index 00000000..fdb3c8ce --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs @@ -0,0 +1,24 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Max", "Math Operators", "Maximum of two scalars or each respective component of two vectors" )] + public sealed class SimpleMaxOpNode : DynamicTypeNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_previewShaderGUID = "79d7f2a11092ac84a95ef6823b34adf2"; + } + + public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); + return "max( " + m_inputA + " , " + m_inputB + " )"; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs.meta new file mode 100644 index 00000000..65ffb4ac --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4ea5a2904ca58164086eeb8ef3084ed2 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs new file mode 100644 index 00000000..4b24eb3c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs @@ -0,0 +1,24 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Min", "Math Operators", "Minimum of two scalars or each respective component of two vectors" )] + public sealed class SimpleMinOpNode : DynamicTypeNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_previewShaderGUID = "d6033298044f0f14aa9932ca46e58ce6"; + } + + public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); + return "min( " + m_inputA + " , " + m_inputB + " )"; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs.meta new file mode 100644 index 00000000..854f20a6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1b19c8479d7a7a9458a6f556bf6545d5 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs new file mode 100644 index 00000000..fe5d9bf0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs @@ -0,0 +1,175 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Multiply", "Math Operators", "Multiplication of two or more values ( A * B * .. )\nIt also handles Matrices multiplication", null, KeyCode.M )] + public sealed class SimpleMultiplyOpNode : DynamicTypeNode + { + protected override void CommonInit( int uniqueId ) + { + m_dynamicRestrictions = new WirePortDataType[] + { + WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.FLOAT3x3, + WirePortDataType.FLOAT4x4, + WirePortDataType.INT + }; + + base.CommonInit( uniqueId ); + m_extensibleInputPorts = true; + m_vectorMatrixOps = true; + m_previewShaderGUID = "1ba1e43e86415ff4bbdf4d81dfcf035b"; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + int count = 0; + int inputCount = m_inputPorts.Count; + for( int i = 2; i < inputCount; i++ ) + { + count++; + if( !m_inputPorts[ i ].IsConnected ) + PreviewMaterial.SetTexture( ( "_" + Convert.ToChar( i + 65 ) ), UnityEditor.EditorGUIUtility.whiteTexture ); + } + + m_previewMaterialPassId = count; + } + + public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT3x3 || + m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT4x4 || + m_inputPorts[ 1 ].DataType == WirePortDataType.FLOAT3x3 || + m_inputPorts[ 1 ].DataType == WirePortDataType.FLOAT4x4 ) + { + m_inputA = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + m_inputB = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + + WirePortDataType autoCast = WirePortDataType.OBJECT; + // Check matrix on first input + if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT3x3 ) + { + switch( m_inputPorts[ 1 ].DataType ) + { + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + { + m_inputB = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, m_inputB, m_inputPorts[ 1 ].DataType, WirePortDataType.FLOAT3, m_inputB ); + autoCast = WirePortDataType.FLOAT3; + } + break; + case WirePortDataType.FLOAT4x4: + { + m_inputA = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, m_inputA, m_inputPorts[ 0 ].DataType, WirePortDataType.FLOAT4x4, m_inputA ); + } + break; + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT3x3: break; + } + } + + if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT4x4 ) + { + switch( m_inputPorts[ 1 ].DataType ) + { + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + { + m_inputB = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, m_inputB, m_inputPorts[ 1 ].DataType, WirePortDataType.FLOAT4, m_inputB ); + autoCast = WirePortDataType.FLOAT4; + } + break; + case WirePortDataType.FLOAT3x3: + { + m_inputB = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, m_inputB, m_inputPorts[ 1 ].DataType, WirePortDataType.FLOAT4x4, m_inputB ); + } + break; + case WirePortDataType.FLOAT4x4: + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: break; + } + } + + // Check matrix on second input + if( m_inputPorts[ 1 ].DataType == WirePortDataType.FLOAT3x3 ) + { + switch( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + { + m_inputA = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, m_inputA, m_inputPorts[ 0 ].DataType, WirePortDataType.FLOAT3, m_inputA ); + autoCast = WirePortDataType.FLOAT3; + } + break; + case WirePortDataType.FLOAT4x4: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT3x3: break; + } + } + + if( m_inputPorts[ 1 ].DataType == WirePortDataType.FLOAT4x4 ) + { + switch( m_inputPorts[ 0 ].DataType ) + { + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + { + m_inputA = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, m_inputA, m_inputPorts[ 0 ].DataType, WirePortDataType.FLOAT4, m_inputA ); + autoCast = WirePortDataType.FLOAT4; + } + break; + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: break; + } + } + string result = "mul( " + m_inputA + ", " + m_inputB + " )"; + if( autoCast != WirePortDataType.OBJECT && autoCast != m_outputPorts[ 0 ].DataType ) + { + result = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, result, autoCast, m_outputPorts[ 0 ].DataType, result ); + } + return result; + } + else + { + base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); + string result = "( " + m_extensibleInputResults[ 0 ]; + for( int i = 1; i < m_extensibleInputResults.Count; i++ ) + { + result += " * " + m_extensibleInputResults[ i ]; + } + result += " )"; + return result; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs.meta new file mode 100644 index 00000000..b9d44829 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 647081578ac7f014d98090d36b5b1bc8 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs new file mode 100644 index 00000000..7209b94a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs @@ -0,0 +1,60 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Remainder", "Math Operators", "Remainder between two int variables",tags:"modulo fmod" )] + public sealed class SimpleRemainderNode : DynamicTypeNode + { + private const string VertexFragRemainder = "( {0} % {1} )"; + //private const string SurfaceRemainder = "fmod( {0} , {1} )"; + private const string RemainderCalculationInt = "( {0} - {1} * ({0}/{1}))"; + private const string RemainderCalculationFloat = "( {0} - {1} * floor({0}/{1}))"; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_useInternalPortData = true; + m_textLabelWidth = 35; + ChangeInputType( WirePortDataType.INT, false ); + ChangeOutputType( WirePortDataType.INT, false ); + m_useInternalPortData = true; + m_previewShaderGUID = "8fdfc429d6b191c4985c9531364c1a95"; + } + + public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); + string opMode = VertexFragRemainder; + string result = string.Empty; + switch( m_outputPorts[ 0 ].DataType ) + { + case WirePortDataType.FLOAT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.INT: + case WirePortDataType.COLOR: + case WirePortDataType.OBJECT: + { + result = string.Format( opMode, m_inputA, m_inputB ); + } + break; + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + result = UIUtils.InvalidParameter( this ); + } + break; + } + + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs.meta new file mode 100644 index 00000000..657830d7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5785c326a26d2ba4ab642fc2bdd41e9a +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs new file mode 100644 index 00000000..eaabab20 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs @@ -0,0 +1,39 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Subtract", "Math Operators", "Subtraction of two values ( A - B )", null, UnityEngine.KeyCode.S )] + public sealed class SimpleSubtractOpNode : DynamicTypeNode + { + protected override void CommonInit( int uniqueId ) + { + m_dynamicRestrictions = new WirePortDataType[] + { + WirePortDataType.OBJECT, + WirePortDataType.FLOAT, + WirePortDataType.FLOAT2, + WirePortDataType.FLOAT3, + WirePortDataType.FLOAT4, + WirePortDataType.COLOR, + WirePortDataType.FLOAT3x3, + WirePortDataType.FLOAT4x4, + WirePortDataType.INT + }; + + base.CommonInit( uniqueId ); + m_allowMatrixCheck = true; + m_previewShaderGUID = "5725e8300be208449973f771ab6682f2"; + } + + public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); + return "( " + m_inputA + " - " + m_inputB + " )"; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs.meta new file mode 100644 index 00000000..f60d0874 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 204f935dafd0a984297e242583de1da5 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/StickyNoteNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/StickyNoteNode.cs new file mode 100644 index 00000000..f9a91e61 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/StickyNoteNode.cs @@ -0,0 +1,502 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Sticky Note", "Miscellaneous", "Allows adding notes into canvas" )] + public sealed class StickyNoteNode : ParentNode, ISerializationCallbackReceiver + { + private const string WarningText = "Characters $ and @ are NOT allowed inside notes since they are internally used as delimiters over the node meta.\nThey will be automatically removed when saving the shader."; + + private const string CommentaryTitle = "Comment"; + private const string NoteTitle = "Note Title"; + private const float BORDER_SIZE_X = 50; + private const float BORDER_SIZE_Y = 50; + private const float MIN_SIZE_X = 100; + private const float MIN_SIZE_Y = 100; + private const float COMMENTARY_BOX_HEIGHT = 30; + private const float NOTE_AREA_ADJUST = 5; + + private readonly Vector2 ResizeButtonPos = new Vector2( 1, 1 ); + + [SerializeField] + private string m_innerTitleText = "New Note"; + + [SerializeField] + private string m_titleText = string.Empty; + + [SerializeField] + private string m_noteText = string.Empty; + + [SerializeField] + private eResizeAxis m_resizeAxis = eResizeAxis.ALL; + + + [SerializeField] + private Rect m_resizeLeftIconCoords; + + [SerializeField] + private Rect m_resizeRightIconCoords; + + [SerializeField] + private Rect m_auxHeaderPos; + + [SerializeField] + private Rect m_innerTitleArea; + + [SerializeField] + private Rect m_noteTextArea; + + + private Texture2D m_resizeIconTex; + + private bool m_isResizingRight = false; + private bool m_isResizingLeft = false; + + private Vector2 m_resizeStartPoint = Vector2.zero; + + private string m_focusTitleName = "StickyNoteTitleText"; + private string m_focusNoteName = "StickyNoteInnerText"; + private bool m_focusOnTitle = false; + + private bool m_checkCommentText = true; + private bool m_checkTitleText = true; + + public Color m_frameColor = Color.white; + + + private bool m_isEditingInnerTitle; + private bool m_stopEditingInnerTitle; + private bool m_startEditingInnerTitle; + + private bool m_isEditingNoteText; + private bool m_stopEditingNoteText; + private bool m_startEditingNoteText; + + private double m_clickTimeTitle; + private double m_doubleClickTimeTitle = 0.3; + + private double m_clickTimeNote; + private double m_doubleClickTimeNote = 0.3; + + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_reorderLocked = true; + m_rmbIgnore = true; + m_defaultInteractionMode = InteractionMode.Both; + m_connStatus = NodeConnectionStatus.Island; + m_textLabelWidth = 90; + m_position.width = 150; + m_position.height = 100; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_focusTitleName = CommentaryTitle + OutputId; + m_focusNoteName = NoteTitle + OutputId; + } + + public override void DrawProperties() + { + base.DrawProperties(); + NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr,()=> + { + EditorGUI.BeginChangeCheck(); + m_titleText = EditorGUILayoutTextField( "Frame Title", m_titleText ); + if ( EditorGUI.EndChangeCheck() ) + { + m_checkTitleText = true; + } + EditorGUI.BeginChangeCheck(); + m_innerTitleText = EditorGUILayoutTextField( NoteTitle, m_innerTitleText ); + if ( EditorGUI.EndChangeCheck() ) + { + m_checkCommentText = true; + } + + m_noteText = EditorGUILayoutTextArea( m_noteText , UIUtils.MainSkin.textArea ); + + m_frameColor = EditorGUILayoutColorField( "Frame Color", m_frameColor ); + } ); + EditorGUILayout.HelpBox( WarningText, MessageType.Warning ); + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + //base.OnLayout( drawInfo ); + CalculatePositionAndVisibility( drawInfo ); + + m_headerPosition = m_globalPosition; + m_headerPosition.height = UIUtils.CurrentHeaderHeight; + + m_auxHeaderPos = m_position; + m_auxHeaderPos.height = UIUtils.HeaderMaxHeight; + + m_innerTitleArea = m_globalPosition; + m_innerTitleArea.height = COMMENTARY_BOX_HEIGHT * drawInfo.InvertedZoom; + m_innerTitleArea.xMin += 10 * drawInfo.InvertedZoom; + m_innerTitleArea.xMax -= 10 * drawInfo.InvertedZoom; + + + m_noteTextArea = m_globalPosition; + m_noteTextArea.height -= m_innerTitleArea.height; + m_noteTextArea.yMin += m_innerTitleArea.height + NOTE_AREA_ADJUST * drawInfo.InvertedZoom; + m_noteTextArea.yMax += 4*NOTE_AREA_ADJUST * drawInfo.InvertedZoom; + m_noteTextArea.xMin += 10 * drawInfo.InvertedZoom; + m_noteTextArea.xMax -= 10 * drawInfo.InvertedZoom; + + if ( m_resizeIconTex == null ) + { + m_resizeIconTex = UIUtils.GetCustomStyle( CustomStyle.CommentaryResizeButton ).normal.background; + } + + // LEFT RESIZE BUTTON + m_resizeLeftIconCoords = m_globalPosition; + m_resizeLeftIconCoords.x = m_globalPosition.x + 2; + m_resizeLeftIconCoords.y = m_globalPosition.y + m_globalPosition.height - 2 - ( m_resizeIconTex.height + ResizeButtonPos.y ) * drawInfo.InvertedZoom; + m_resizeLeftIconCoords.width = m_resizeIconTex.width * drawInfo.InvertedZoom; + m_resizeLeftIconCoords.height = m_resizeIconTex.height * drawInfo.InvertedZoom; + + // RIGHT RESIZE BUTTON + m_resizeRightIconCoords = m_globalPosition; + m_resizeRightIconCoords.x = m_globalPosition.x + m_globalPosition.width - 1 - ( m_resizeIconTex.width + ResizeButtonPos.x ) * drawInfo.InvertedZoom; + m_resizeRightIconCoords.y = m_globalPosition.y + m_globalPosition.height - 2 - ( m_resizeIconTex.height + ResizeButtonPos.y ) * drawInfo.InvertedZoom; + m_resizeRightIconCoords.width = m_resizeIconTex.width * drawInfo.InvertedZoom; + m_resizeRightIconCoords.height = m_resizeIconTex.height * drawInfo.InvertedZoom; + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + if ( !m_isVisible ) + return; + + m_colorBuffer = GUI.color; + // Background + GUI.color = Constants.NodeBodyColor * m_frameColor; + GUI.Label( m_globalPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.CommentaryBackground ) ); + + // Header + GUI.color = m_headerColor * m_headerColorModifier * m_frameColor; + GUI.Label( m_headerPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeHeader ) ); + GUI.color = m_colorBuffer; + + // Fixed Title ( only renders when not editing ) + if ( !m_isEditingInnerTitle && !m_startEditingInnerTitle && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + GUI.Label( m_innerTitleArea, m_innerTitleText, UIUtils.CommentaryTitle ); + } + + + // Note Text ( only renders when not editing ) + if( !m_isEditingNoteText && !m_startEditingNoteText && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + GUI.Label( m_noteTextArea, m_noteText, UIUtils.StickyNoteText ); + } + + // Buttons + GUI.Label( m_resizeLeftIconCoords, string.Empty, UIUtils.GetCustomStyle( CustomStyle.CommentaryResizeButtonInv ) ); + GUI.Label( m_resizeRightIconCoords, string.Empty, UIUtils.GetCustomStyle( CustomStyle.CommentaryResizeButton ) ); + + // Selection Box + if ( m_selected ) + { + GUI.color = Constants.NodeSelectedColor; + RectOffset cache = UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ).border; + UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ).border = UIUtils.RectOffsetSix; + GUI.Label( m_globalPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ) ); + UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ).border = cache; + GUI.color = m_colorBuffer; + } + + if ( !string.IsNullOrEmpty( m_titleText ) ) + { + Rect titleRect = m_globalPosition; + titleRect.y -= 24; + titleRect.height = 24; + GUI.Label( titleRect, m_titleText, UIUtils.GetCustomStyle( CustomStyle.CommentarySuperTitle ) ); + } + } + + public override void Move( Vector2 delta, bool snap ) + { + if( m_isResizingRight || m_isResizingLeft ) + return; + + base.Move( delta, snap ); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + // Custom Editable Title + if ( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + if( !m_startEditingNoteText && !m_isEditingNoteText ) + { + if( !m_isEditingInnerTitle && ( ( !ContainerGraph.ParentWindow.MouseInteracted && drawInfo.CurrentEventType == EventType.MouseDown && m_innerTitleArea.Contains( drawInfo.MousePosition ) ) ) ) + { + if( ( EditorApplication.timeSinceStartup - m_clickTimeTitle ) < m_doubleClickTimeTitle ) + m_startEditingInnerTitle = true; + else + GUI.FocusControl( null ); + m_clickTimeTitle = EditorApplication.timeSinceStartup; + } + else if( m_isEditingInnerTitle && ( ( drawInfo.CurrentEventType == EventType.MouseDown && !m_innerTitleArea.Contains( drawInfo.MousePosition ) ) || !EditorGUIUtility.editingTextField ) ) + { + m_stopEditingInnerTitle = true; + } + + if( m_isEditingInnerTitle || m_startEditingInnerTitle ) + { + EditorGUI.BeginChangeCheck(); + GUI.SetNextControlName( m_focusTitleName ); + m_innerTitleText = EditorGUITextField( m_innerTitleArea, string.Empty, m_innerTitleText, UIUtils.CommentaryTitle ); + if( EditorGUI.EndChangeCheck() ) + { + m_checkCommentText = true; + } + + if( m_startEditingInnerTitle ) + EditorGUI.FocusTextInControl( m_focusTitleName ); + } + + if( drawInfo.CurrentEventType == EventType.Repaint ) + { + if( m_startEditingInnerTitle ) + { + m_startEditingInnerTitle = false; + m_isEditingInnerTitle = true; + } + + if( m_stopEditingInnerTitle ) + { + m_stopEditingInnerTitle = false; + m_isEditingInnerTitle = false; + GUI.FocusControl( null ); + } + } + } + + //////////////////////// + if( !m_startEditingInnerTitle && !m_isEditingInnerTitle ) + { + if( !m_isEditingNoteText && ( ( !ContainerGraph.ParentWindow.MouseInteracted && drawInfo.CurrentEventType == EventType.MouseDown && m_noteTextArea.Contains( drawInfo.MousePosition ) ) ) ) + { + if( ( EditorApplication.timeSinceStartup - m_clickTimeNote ) < m_doubleClickTimeNote ) + m_startEditingNoteText = true; + else + GUI.FocusControl( null ); + m_clickTimeNote = EditorApplication.timeSinceStartup; + } + else if( m_isEditingNoteText && ( ( drawInfo.CurrentEventType == EventType.MouseDown && !m_noteTextArea.Contains( drawInfo.MousePosition ) ) || !EditorGUIUtility.editingTextField ) ) + { + m_stopEditingInnerTitle = true; + } + + if( m_isEditingNoteText || m_startEditingNoteText ) + { + GUI.SetNextControlName( m_focusNoteName ); + m_noteText = EditorGUITextArea( m_noteTextArea, m_noteText, UIUtils.StickyNoteText ); + if( m_startEditingNoteText ) + EditorGUI.FocusTextInControl( m_focusNoteName ); + } + + if( drawInfo.CurrentEventType == EventType.Repaint ) + { + if( m_startEditingNoteText ) + { + m_startEditingNoteText = false; + m_isEditingNoteText = true; + } + + if( m_stopEditingInnerTitle ) + { + m_stopEditingInnerTitle = false; + m_isEditingNoteText = false; + GUI.FocusControl( null ); + } + } + } + //////////////////////// + } + + if ( drawInfo.CurrentEventType == EventType.MouseDown && drawInfo.LeftMouseButtonPressed ) + { + // Left Button + if( m_resizeLeftIconCoords.Contains( drawInfo.MousePosition ) && ContainerGraph.ParentWindow.CurrentEvent.modifiers != EventModifiers.Shift ) + { + if ( !m_isResizingLeft ) + { + m_isResizingLeft = true; + ContainerGraph.ParentWindow.ForceAutoPanDir = true; + m_resizeStartPoint = drawInfo.TransformedMousePos; + } + } + + // Right Button + if ( m_resizeRightIconCoords.Contains( drawInfo.MousePosition ) && ContainerGraph.ParentWindow.CurrentEvent.modifiers != EventModifiers.Shift ) + { + if ( !m_isResizingRight ) + { + m_isResizingRight = true; + ContainerGraph.ParentWindow.ForceAutoPanDir = true; + m_resizeStartPoint = drawInfo.TransformedMousePos; + } + } + } + + if ( drawInfo.CurrentEventType == EventType.Repaint || drawInfo.CurrentEventType == EventType.MouseUp ) + { + // Left Button + EditorGUIUtility.AddCursorRect( m_resizeLeftIconCoords, MouseCursor.ResizeUpRight ); + if ( m_isResizingLeft ) + { + if ( drawInfo.CurrentEventType == EventType.MouseUp ) + { + m_isResizingLeft = false; + ContainerGraph.ParentWindow.ForceAutoPanDir = false; + FireStoppedMovingEvent( false, InteractionMode.Target ); + } + else + { + Vector2 currSize = ( drawInfo.TransformedMousePos - m_resizeStartPoint ) /*/ drawInfo.InvertedZoom*/; + m_resizeStartPoint = drawInfo.TransformedMousePos; + if ( m_resizeAxis != eResizeAxis.Y_AXIS ) + { + m_position.x += currSize.x; + m_position.width -= currSize.x; + if ( m_position.width < MIN_SIZE_X ) + { + m_position.x -= ( MIN_SIZE_X - m_position.width ); + m_position.width = MIN_SIZE_X; + } + } + + if ( m_resizeAxis != eResizeAxis.X_AXIS ) + { + m_position.height += currSize.y; + if ( m_position.height < MIN_SIZE_Y ) + { + m_position.height = MIN_SIZE_Y; + } + } + } + } + + // Right Button + EditorGUIUtility.AddCursorRect( m_resizeRightIconCoords, MouseCursor.ResizeUpLeft ); + if ( m_isResizingRight ) + { + if ( drawInfo.CurrentEventType == EventType.MouseUp ) + { + m_isResizingRight = false; + ContainerGraph.ParentWindow.ForceAutoPanDir = false; + FireStoppedMovingEvent( false, InteractionMode.Target ); + } + else + { + Vector2 currSize = ( drawInfo.TransformedMousePos - m_resizeStartPoint ) /*/ drawInfo.InvertedZoom*/; + m_resizeStartPoint = drawInfo.TransformedMousePos; + if ( m_resizeAxis != eResizeAxis.Y_AXIS ) + { + m_position.width += currSize.x; + if ( m_position.width < MIN_SIZE_X ) + { + m_position.width = MIN_SIZE_X; + } + } + + if ( m_resizeAxis != eResizeAxis.X_AXIS ) + { + m_position.height += currSize.y; + if ( m_position.height < MIN_SIZE_Y ) + { + m_position.height = MIN_SIZE_Y; + } + } + } + } + } + + if ( m_checkCommentText ) + { + m_checkCommentText = false; + m_innerTitleText = m_innerTitleText.Replace( IOUtils.FIELD_SEPARATOR, ' ' ); + } + + if ( m_checkTitleText ) + { + m_checkTitleText = false; + m_titleText = m_titleText.Replace( IOUtils.FIELD_SEPARATOR, ' ' ); + } + + if ( m_focusOnTitle && drawInfo.CurrentEventType == EventType.KeyUp ) + { + m_focusOnTitle = false; + m_startEditingInnerTitle = true; + } + } + + public void Focus() + { + m_focusOnTitle = true; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_position.width = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + m_position.height = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + m_innerTitleText = GetCurrentParam( ref nodeParams ); + m_titleText = GetCurrentParam( ref nodeParams ); + string[] colorChannels = GetCurrentParam( ref nodeParams ).Split( IOUtils.VECTOR_SEPARATOR ); + if ( colorChannels.Length == 4 ) + { + m_frameColor.r = Convert.ToSingle( colorChannels[ 0 ] ); + m_frameColor.g = Convert.ToSingle( colorChannels[ 1 ] ); + m_frameColor.b = Convert.ToSingle( colorChannels[ 2 ] ); + m_frameColor.a = Convert.ToSingle( colorChannels[ 3 ] ); + } + else + { + UIUtils.ShowMessage( UniqueId, "Incorrect number of color values", MessageSeverity.Error ); + } + m_noteText = GetCurrentParam( ref nodeParams ); + m_noteText = m_noteText.Replace( Constants.LineFeedSeparator, '\n' ); + m_noteText = m_noteText.Replace( Constants.SemiColonSeparator, ';' ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_position.width ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_position.height ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_innerTitleText ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_titleText ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_frameColor.r.ToString() + IOUtils.VECTOR_SEPARATOR + m_frameColor.g.ToString() + IOUtils.VECTOR_SEPARATOR + m_frameColor.b.ToString() + IOUtils.VECTOR_SEPARATOR + m_frameColor.a.ToString() ); + + m_noteText = m_noteText.Replace( Constants.LineFeedSeparator.ToString(), string.Empty); + m_noteText = m_noteText.Replace( Constants.SemiColonSeparator.ToString(), string.Empty ); + m_noteText = UIUtils.ForceLFLineEnding( m_noteText ); + + string parsedText = m_noteText.Replace( '\n', Constants.LineFeedSeparator ); + parsedText = parsedText.Replace( ';', Constants.SemiColonSeparator ); + IOUtils.AddFieldValueToString( ref nodeInfo, parsedText ); + } + + public override Rect Position { get { return Event.current.alt ? m_position : m_auxHeaderPos; } } + public override bool Contains( Vector3 pos ) + { + return Event.current.alt ? m_globalPosition.Contains( pos ) : ( m_headerPosition.Contains( pos ) || m_resizeRightIconCoords.Contains( pos ) || m_resizeLeftIconCoords.Contains( pos ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/StickyNoteNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/StickyNoteNode.cs.meta new file mode 100644 index 00000000..628f4ba8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/StickyNoteNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6d517b63dc9604043985eb4a82d2d135 +timeCreated: 1607962893 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/StickyNoteNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs.meta new file mode 100644 index 00000000..4487ca30 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ddb697d654917eb4aada5b2caeef2db8 +folderAsset: yes +timeCreated: 1481126946 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs new file mode 100644 index 00000000..e4223e1b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs @@ -0,0 +1,17 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Color", "Surface Data", "Interpolated per-vertex color", null, UnityEngine.KeyCode.None, true, true, "Vertex Color", typeof( VertexColorNode ) )] + public sealed class ColorInputsNode : SurfaceShaderINParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentInput = SurfaceInputs.COLOR; + InitialSetup(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs.meta new file mode 100644 index 00000000..69adbb87 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ee44f086d7aa7804ea035860c5735cfb +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs new file mode 100644 index 00000000..3e2a5117 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs @@ -0,0 +1,118 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Grab Screen Position", "Camera And Screen", "Screen position correctly transformed to be used with Grab Screen Color" )] + public sealed class GrabScreenPosition : ParentNode + { + private readonly string[] m_outputTypeStr = { "Normalized", "Screen" }; + + [SerializeField] + private int m_outputTypeInt = 0; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputVectorPorts( WirePortDataType.FLOAT4, "XYZW" ); + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + m_textLabelWidth = 65; + ConfigureHeader(); + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_outputTypeInt = m_upperLeftWidget.DrawWidget( this, m_outputTypeInt, m_outputTypeStr ); + if( EditorGUI.EndChangeCheck() ) + { + ConfigureHeader(); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + + EditorGUI.BeginChangeCheck(); + m_outputTypeInt = EditorGUILayoutPopup( "Type", m_outputTypeInt, m_outputTypeStr ); + if( EditorGUI.EndChangeCheck() ) + { + ConfigureHeader(); + } + } + + void ConfigureHeader() + { + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_outputTypeStr[ m_outputTypeInt ] ) ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + string localVarName = string.Empty; + + if( m_outputTypeInt == 0 ) + localVarName = GeneratorUtils.GenerateGrabScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); + else + localVarName = GeneratorUtils.GenerateGrabScreenPosition( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); + + m_outputPorts[ 0 ].SetLocalValue( localVarName, dataCollector.PortCategory ); + return GetOutputColorItem( 0, outputId, localVarName ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 3108 ) + { + if( UIUtils.CurrentShaderVersion() < 6102 ) + { + bool project = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_outputTypeInt = project ? 0 : 1; + } + else + { + m_outputTypeInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + } + + ConfigureHeader(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_outputTypeInt ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs.meta new file mode 100644 index 00000000..556f8157 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 47af62ad6a29d1b409d526d352b5e677 +timeCreated: 1485198163 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs new file mode 100644 index 00000000..785e39fa --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs @@ -0,0 +1,50 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "[Deprecated] Local Position", "Surface Data", "Interpolated Vertex Position in Local Space", null, KeyCode.None, true, true, "Vertex Position", typeof( PosVertexDataNode ) )] + public sealed class LocalVertexPosNode : ParentNode + { + private const string VertexVarName = "localVertexPos"; + private readonly string VertexOnFrag = Constants.InputVarStr + "." + VertexVarName; + private readonly string VertexOnVert = Constants.VertexShaderInputStr + ".vertex"; + + + [SerializeField] + private bool m_addInstruction = false; + + public override void Reset() + { + base.Reset(); + m_addInstruction = true; + } + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); + } + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + return GetOutputVectorItem( 0, outputId, VertexOnVert ); + } + else + { + if ( m_addInstruction ) + { + dataCollector.AddToInput( UniqueId, VertexVarName, WirePortDataType.FLOAT3 ); + dataCollector.AddVertexInstruction( Constants.VertexShaderOutputStr + "." + VertexVarName + " = " + Constants.VertexShaderInputStr + ".vertex.xyz ", UniqueId ); + m_addInstruction = false; + } + + return GetOutputVectorItem( 0, outputId, VertexOnFrag ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs.meta new file mode 100644 index 00000000..4d3217d3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2528fbf85b5823a4499871c2a6eecc0a +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/PositionNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/PositionNode.cs new file mode 100644 index 00000000..f0a99f62 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/PositionNode.cs @@ -0,0 +1,117 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Position", "Surface Data", "Surface position. Absolute World-space, by default.\n\n" + + "Object: Object-space position, local to object.\n\n" + + "World: Absolute world position, global to scene origin.\n\n" + + "Relative World: Camera-relative world position.\n\n" + + "View: View-space position.\n\n" )] + public sealed class PositionNode : SurfaceShaderINParentNode + { + public enum Space + { + Object, + World, + RelativeWorld, + View + } + + private readonly string[] m_outputSpaceStr = { "Object", "World", "Relative World", "View" }; + + [SerializeField] + private int m_outputSpaceIndex = ( int )Space.World; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentInput = SurfaceInputs.WORLD_POS; + m_drawPreviewAsSphere = true; + m_previewShaderGUID = "62a28fcb1f1dd5640a572771eb121a3b"; + m_hasLeftDropdown = true; + m_textLabelWidth = 65; + m_autoWrapProperties = true; + InitialSetup(); + + m_previewMaterialPassId = ( int )m_outputSpaceIndex; + ConfigureHeader(); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_outputSpaceIndex = m_upperLeftWidget.DrawWidget( this, m_outputSpaceIndex, m_outputSpaceStr ); + if ( EditorGUI.EndChangeCheck() ) + { + ConfigureHeader(); + } + } + + public override void DrawProperties() + { + EditorGUI.BeginChangeCheck(); + m_outputSpaceIndex = EditorGUILayoutPopup( "Mode", m_outputSpaceIndex, m_outputSpaceStr ); + if ( EditorGUI.EndChangeCheck() ) + { + ConfigureHeader(); + } + + if ( m_outputSpaceIndex == ( int )Space.World ) + { + EditorGUILayout.HelpBox( "World refers to absolute World-Space coordinates, in full coordinates around the origin.", MessageType.Info ); + } + else if ( m_outputSpaceIndex == ( int )Space.RelativeWorld ) + { + EditorGUILayout.HelpBox( "Relative World refers to Camera-relative World-space, where values are kept relative to the Camera position, making them less prone to the numerical precision degradation of large floating point values.", MessageType.Info ); + } + } + + void ConfigureHeader() + { + SetAdditonalTitleText( string.Format( Constants.SubTitleModeFormatStr, m_outputSpaceStr[ m_outputSpaceIndex ] ) ); + m_previewMaterialPassId = m_outputSpaceIndex; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowNoVertexModeNodeMessage( this ); + return string.Format( "{0}( 0, 0, 0 )", UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT3 ) ); + } + + if ( dataCollector.IsTemplate ) + { + string varName = dataCollector.TemplateDataCollectorInstance.GetPosition( ( Space )m_outputSpaceIndex ); + return GetOutputVectorItem( 0, outputId, varName ); + } + else + { + string worldPosition = GeneratorUtils.GeneratePosition( ref dataCollector, UniqueId, ( Space )m_outputSpaceIndex ); + return GetOutputVectorItem( 0, outputId, worldPosition ); + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_outputSpaceIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + ConfigureHeader(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_outputSpaceIndex ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/PositionNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/PositionNode.cs.meta new file mode 100644 index 00000000..11b1682f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/PositionNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 283369e6e1d68954190b3e4b02a644c3 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/PositionNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs new file mode 100644 index 00000000..86e9fa99 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs @@ -0,0 +1,714 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + + [Serializable] + [NodeAttributes( "Grab Screen Color" , "Camera And Screen" , "Grabed pixel color value from screen" )] + public sealed class ScreenColorNode : PropertyNode + { + private readonly string[] ASEDeclareMacro = + { + "#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)", + "#define ASE_DECLARE_SCREENSPACE_TEXTURE(tex) UNITY_DECLARE_SCREENSPACE_TEXTURE(tex);", + "#else", + "#define ASE_DECLARE_SCREENSPACE_TEXTURE(tex) UNITY_DECLARE_SCREENSPACE_TEXTURE(tex)", + "#endif" + }; + + private readonly Color ReferenceHeaderColor = new Color( 0.6f , 3.0f , 1.25f , 1.0f ); + + private const string SamplerType = "tex2D"; + private const string GrabTextureDefault = "_GrabTexture"; + private const string ScreenColorStr = "screenColor"; + + [SerializeField] + private TexReferenceType m_referenceType = TexReferenceType.Object; + + [SerializeField] + private int m_referenceArrayId = -1; + + [SerializeField] + private int m_referenceNodeId = -1; + + [SerializeField] + private GUIStyle m_referenceIconStyle = null; + + private ScreenColorNode m_referenceNode = null; + + [SerializeField] + private bool m_normalize = false; + + [SerializeField] + private bool m_useCustomGrab = false; + + [SerializeField] + private float m_referenceWidth = -1; + + [SerializeField] + private bool m_exposure = false; + + [SerializeField] + private bool m_isURP2D = false; + + //SRP specific code + private const string OpaqueTextureDefine = "REQUIRE_OPAQUE_TEXTURE 1"; + private const string FetchVarName = "fetchOpaqueVal"; + + //private string LWFetchOpaqueTexture = "SAMPLE_TEXTURE2D( _CameraOpaqueTexture, sampler_CameraOpaqueTexture, {0})"; + + private string LWFetchOpaqueTexture = "float4( SHADERGRAPH_SAMPLE_SCENE_COLOR( {0}.xy ), 1.0 )"; + +#if UNITY_2021_1_OR_NEWER + private const string URP2DHelpBox = "For the Grab Screen Color to properly work a proper setup is required:" + + "\n- On the 2D Asset Renderer the \"Foremost Sorting Layer\" must be set to the last layer which is going to be caught by the Grab Screen Color" + + "\n- The \"Sorting Layer\" of the sprite itself which will be using the shader with the Grab Screen Color must be set to one which is above the one specified on the previous step"; + + private readonly string[] URP2DDeclaration = { "TEXTURE2D_X( _CameraSortingLayerTexture );", + "SAMPLER( sampler_CameraSortingLayerTexture );" }; + private readonly string URP2DFunctionHeader = "float4( ASESample2DSortingLayer({0}.xy), 1.0 )"; + private readonly string[] URP2DFunctionBody = + { + "float3 ASESample2DSortingLayer( float2 uv )\n" + + "{\n"+ + "\treturn SAMPLE_TEXTURE2D_X(_CameraSortingLayerTexture, sampler_CameraSortingLayerTexture, UnityStereoTransformScreenSpaceTex(uv)).rgb;\n"+ + "}\n" + }; +#endif + + private const string HDSampleSceneColorHeader5 = "ASEHDSampleSceneColor({0}.xy, {1}, {2})"; + private readonly string[] HDSampleSceneColorFunc5 = + { + "float4 ASEHDSampleSceneColor(float2 uv, float lod, float exposureMultiplier)\n", + "{\n", + "\t#if defined(REQUIRE_OPAQUE_TEXTURE) && defined(_SURFACE_TYPE_TRANSPARENT) && defined(SHADERPASS) && (SHADERPASS != SHADERPASS_LIGHT_TRANSPORT)\n", + "\treturn float4( SampleCameraColor(uv, lod) * exposureMultiplier, 1.0 );\n", + "\t#endif\n", + "\treturn float4(0.0, 0.0, 0.0, 1.0);\n", + "}\n", + }; + + private const string HDSampleSceneColorHeader4 = "ASEHDSampleSceneColor({0}.xy)"; + private readonly string[] HDSampleSceneColorFunc4 = + { + "float4 ASEHDSampleSceneColor( float2 uv )\n", + "{\n", + "\t#if defined(REQUIRE_OPAQUE_TEXTURE) && defined(_SURFACE_TYPE_TRANSPARENT) && defined(SHADERPASS) && (SHADERPASS != SHADERPASS_LIGHT_TRANSPORT)\n", + "\treturn float4( SampleCameraColor(uv), 1.0 );\n", + "\t#endif\n", + "\treturn float4(0.0, 0.0, 0.0, 1.0);\n", + "}\n", + }; + + public ScreenColorNode() : base() { } + public ScreenColorNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + + AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); + AddInputPort( WirePortDataType.FLOAT, false, "LOD" ); + m_inputPorts[ 1 ].FloatInternalData = 0; + + AddOutputColorPorts( "RGBA" ); + + m_currentParameterType = PropertyType.Global; + m_underscoredGlobal = true; + m_useVarSubtitle = true; + m_customPrefix = "Grab Screen "; + m_freeType = false; + m_drawAttributes = false; + m_showTitleWhenNotEditing = false; + m_textLabelWidth = 125; + m_showAutoRegisterUI = true; + m_globalDefaultBehavior = false; + m_showVariableMode = true; + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + if( m_referenceType == TexReferenceType.Object ) + UIUtils.RegisterScreenColorNode( this ); + + if( UniqueId > -1 ) + ContainerGraph.ScreenColorNodes.OnReorderEventComplete += OnReorderEventComplete; + + } + + private void OnReorderEventComplete() + { + if( m_referenceType == TexReferenceType.Instance && m_referenceNode != null ) + { + m_referenceArrayId = ContainerGraph.ScreenColorNodes.GetNodeRegisterIdx( m_referenceNode.UniqueId ); + } + } + + void UpdateHeaderColor() + { + m_headerColorModifier = ( m_referenceType == TexReferenceType.Object ) ? Color.white : ReferenceHeaderColor; + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + if( m_referenceNodeId > -1 && m_referenceNode == null ) + { + m_referenceNode = UIUtils.GetScreenColorNode( m_referenceNodeId ) as ScreenColorNode; + if( m_referenceNode == null ) + { + m_referenceNodeId = -1; + m_referenceArrayId = -1; + m_sizeIsDirty = true; + } + } + + if( m_showSubtitle == m_containerGraph.IsSRP ) + { + m_showSubtitle = !m_containerGraph.IsSRP; + m_sizeIsDirty = true; + } + + if( ContainerGraph.IsHDRP || ContainerGraph.ParentWindow.IsShaderFunctionWindow ) + { + m_inputPorts[ 1 ].Visible = true; + } + else + { + m_inputPorts[ 1 ].Visible = false; + } + } + + protected override void ChangeSizeFinished() + { + if( m_referenceType == TexReferenceType.Instance ) + { + m_position.width += 20; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + CheckReference(); + + if( SoftValidReference ) + { + m_content.text = m_referenceNode.TitleContent.text + Constants.InstancePostfixStr; + SetAdditonalTitleText( m_referenceNode.AdditonalTitleContent.text ); + + if( m_referenceIconStyle == null ) + { + m_referenceIconStyle = UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ); + } + + Rect iconPos = m_globalPosition; + iconPos.width = 19 * drawInfo.InvertedZoom; + iconPos.height = 19 * drawInfo.InvertedZoom; + + iconPos.y += 6 * drawInfo.InvertedZoom; + iconPos.x += m_globalPosition.width - iconPos.width - 7 * drawInfo.InvertedZoom; + + if( GUI.Button( iconPos, string.Empty, m_referenceIconStyle ) ) + { + UIUtils.FocusOnNode( m_referenceNode, 1, true ); + } + } + } + + void CheckReference() + { + if( m_referenceType != TexReferenceType.Instance ) + { + return; + } + + if( m_referenceArrayId > -1 ) + { + ParentNode newNode = UIUtils.GetScreenColorNode( m_referenceArrayId ); + if( newNode == null || newNode.UniqueId != m_referenceNodeId ) + { + m_referenceNode = null; + int count = UIUtils.GetScreenColorNodeAmount(); + for( int i = 0; i < count; i++ ) + { + ParentNode node = UIUtils.GetScreenColorNode( i ); + if( node.UniqueId == m_referenceNodeId ) + { + m_referenceNode = node as ScreenColorNode; + m_referenceArrayId = i; + break; + } + } + } + } + + if( m_referenceNode == null && m_referenceNodeId > -1 ) + { + m_referenceNodeId = -1; + m_referenceArrayId = -1; + } + } + + public override void DrawMainPropertyBlock() + { + EditorGUI.BeginChangeCheck(); + m_referenceType = (TexReferenceType)EditorGUILayoutPopup( Constants.ReferenceTypeStr, (int)m_referenceType, Constants.ReferenceArrayLabels ); + if( EditorGUI.EndChangeCheck() ) + { + m_sizeIsDirty = true; + if( m_referenceType == TexReferenceType.Object ) + { + UIUtils.RegisterScreenColorNode( this ); + m_content.text = m_propertyInspectorName; + } + else + { + UIUtils.UnregisterScreenColorNode( this ); + if( SoftValidReference ) + { + m_content.text = m_referenceNode.TitleContent.text + Constants.InstancePostfixStr; + } + } + UpdateHeaderColor(); + } + + if( m_referenceType == TexReferenceType.Object ) + { + EditorGUI.BeginDisabledGroup( m_containerGraph.IsSRP ); + { + EditorGUI.BeginChangeCheck(); + m_useCustomGrab = EditorGUILayoutToggle( "Custom Grab Pass", m_useCustomGrab ); + EditorGUI.BeginDisabledGroup( !m_useCustomGrab ); + DrawMainPropertyBlockNoPrecision(); + EditorGUI.EndDisabledGroup(); + + m_normalize = EditorGUILayoutToggle( "Normalize", m_normalize ); + if( EditorGUI.EndChangeCheck() ) + { + UpdatePort(); + if( m_useCustomGrab ) + { + BeginPropertyFromInspectorCheck(); + } + } + } + EditorGUI.EndDisabledGroup(); + } + else + { + string[] arr = UIUtils.ScreenColorNodeArr(); + bool guiEnabledBuffer = GUI.enabled; + if( arr != null && arr.Length > 0 ) + { + GUI.enabled = true; + } + else + { + m_referenceArrayId = -1; + GUI.enabled = false; + } + + m_referenceArrayId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceArrayId, arr ); + GUI.enabled = guiEnabledBuffer; + EditorGUI.BeginDisabledGroup( m_containerGraph.IsSRP ); + { + EditorGUI.BeginChangeCheck(); + m_normalize = EditorGUILayoutToggle( "Normalize", m_normalize ); + if( EditorGUI.EndChangeCheck() ) + { + UpdatePort(); + } + } + EditorGUI.EndDisabledGroup(); + } + ShowVariableMode(); + ShowAutoRegister(); + if( ContainerGraph.IsHDRP || ContainerGraph.ParentWindow.IsShaderFunctionWindow ) + { + m_exposure = EditorGUILayoutToggle( "Exposure", m_exposure ); + } + +#if UNITY_2021_1_OR_NEWER + if( ( ContainerGraph.IsLWRP || ContainerGraph.ParentWindow.IsShaderFunctionWindow ) && ASEPackageManagerHelper.CurrentHDRPBaseline >= ASESRPBaseline.ASE_SRP_11 ) + { + m_isURP2D = EditorGUILayoutToggle( "2D Renderer" , m_isURP2D); + if( m_isURP2D ) + { + EditorGUILayout.HelpBox( URP2DHelpBox , MessageType.Info ); + } + } +#endif + } + + private void UpdatePort() + { + if( m_normalize ) + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + else + m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); + } + + public override void DrawTitle( Rect titlePos ) + { + if( !m_isEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + GUI.Label( titlePos, "Grab Screen Color", UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); + } + + if( m_useCustomGrab || SoftValidReference ) + { + base.DrawTitle( titlePos ); + m_previousAdditonalTitle = m_additionalContent.text; + } + else + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) + { + SetAdditonalTitleTextOnCallback( GrabTextureDefault, ( instance, newSubTitle ) => instance.AdditonalTitleContent.text = string.Format( Constants.SubTitleVarNameFormatStr, newSubTitle ) ); + //GUI.Label( titlePos, PropertyInspectorName, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); + } + } + + public void SetMacros( ref MasterNodeDataCollector dataCollector ) + { + if( !dataCollector.IsTemplate || dataCollector.CurrentSRPType == TemplateSRPType.BiRP ) + { + for( int i = 0; i < ASEDeclareMacro.Length; i++ ) + { + dataCollector.AddToDirectives( ASEDeclareMacro[ i ] ); + } + } + } + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + SetMacros( ref dataCollector ); + + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + string valueName = string.Empty; + if( dataCollector.IsSRP ) + { + valueName = FetchVarName + OutputId; + dataCollector.AddToDirectives( OpaqueTextureDefine, -1 , AdditionalLineType.Define); + string uvCoords = GetUVCoords( ref dataCollector, ignoreLocalVar, false ); + if( dataCollector.TemplateDataCollectorInstance.IsLWRP ) + { + +#if UNITY_2021_1_OR_NEWER + if( m_isURP2D ) + { + dataCollector.AddToUniforms( UniqueId , URP2DDeclaration[ 0 ] ); + dataCollector.AddToUniforms( UniqueId , URP2DDeclaration[ 1 ] ); + dataCollector.AddFunction( URP2DFunctionBody[ 0 ] , URP2DFunctionBody , false ); + dataCollector.AddLocalVariable( UniqueId , CurrentPrecisionType , WirePortDataType.FLOAT4 , valueName , string.Format( URP2DFunctionHeader , uvCoords ) ); + } + else +#endif + { + dataCollector.AddLocalVariable( UniqueId , CurrentPrecisionType , WirePortDataType.FLOAT4 , valueName , string.Format( LWFetchOpaqueTexture , uvCoords ) ); + } + } + else + { + string lod = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + dataCollector.AddFunction( HDSampleSceneColorFunc5[ 0 ], HDSampleSceneColorFunc5, false ); + string exposureValue = m_exposure ? "1.0" : "GetInverseCurrentExposureMultiplier()"; + dataCollector.AddLocalVariable( UniqueId, m_currentPrecisionType, WirePortDataType.FLOAT4, valueName, string.Format( HDSampleSceneColorHeader5, uvCoords, lod, exposureValue ) ); + } + } + else + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); + string propertyName = CurrentPropertyReference; + OnPropertyNameChanged(); + //bool emptyName = string.IsNullOrEmpty( m_propertyInspectorName ) || propertyName == GrabTextureDefault; + bool emptyName = string.IsNullOrEmpty( m_propertyInspectorName ) || !m_useCustomGrab; + dataCollector.AddGrabPass( emptyName ? string.Empty : propertyName ); + valueName = SetFetchedData( ref dataCollector, ignoreLocalVar ); + } + + m_outputPorts[ 0 ].SetLocalValue( valueName, dataCollector.PortCategory ); + return GetOutputColorItem( 0, outputId, valueName ); + } + + + public override void OnPropertyNameChanged() + { + base.OnPropertyNameChanged(); + UIUtils.UpdateScreenColorDataNode( UniqueId, DataToArray ); + } + + public string SetFetchedData( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + string propertyName = CurrentPropertyReference; + + bool isProjecting = m_normalize; + + if( !m_inputPorts[ 0 ].IsConnected ) // to generate proper screen pos by itself + isProjecting = true; + + if( ignoreLocalVar ) + { + string samplerValue = SamplerType + ( isProjecting ? "proj" : "" ) + "( " + propertyName + ", " + GetUVCoords( ref dataCollector, ignoreLocalVar, isProjecting ) + " )"; + return samplerValue; + } + + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string uvValue = GetUVCoords( ref dataCollector, ignoreLocalVar, isProjecting ); + if( isProjecting ) + { + uvValue = string.Format( "{0}.xy/{0}.w", uvValue ); + } + string samplerOp = string.Format( "UNITY_SAMPLE_SCREENSPACE_TEXTURE({0},{1})", propertyName, uvValue ); + dataCollector.AddLocalVariable( UniqueId, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ) + " " + ScreenColorStr + OutputId + " = " + samplerOp + ";" ); + return ScreenColorStr + OutputId; + } + + private string GetUVCoords( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar, bool isProjecting ) + { + string result = string.Empty; + + if( m_inputPorts[ 0 ].IsConnected ) + { + result = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, ( isProjecting ? WirePortDataType.FLOAT4 : WirePortDataType.FLOAT2 ), ignoreLocalVar, true ); + } + else + { + string customScreenPos = null; + + if( dataCollector.IsTemplate ) + customScreenPos = dataCollector.TemplateDataCollectorInstance.GetScreenPosRaw( CurrentPrecisionType ); + + if( isProjecting ) + result = GeneratorUtils.GenerateGrabScreenPosition( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos, customScreenPos ); + else + result = GeneratorUtils.GenerateGrabScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos, customScreenPos ); + } + + if( isProjecting && !dataCollector.IsSRP ) + return result; + else + return result; + } + + public override void Destroy() + { + base.Destroy(); + if( m_referenceType == TexReferenceType.Object ) + { + UIUtils.UnregisterScreenColorNode( this ); + } + if( UniqueId > -1 ) + ContainerGraph.ScreenColorNodes.OnReorderEventComplete -= OnReorderEventComplete; + } + + public bool SoftValidReference + { + get + { + if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 ) + { + m_referenceNode = UIUtils.GetScreenColorNode( m_referenceArrayId ); + if( m_referenceNode == null ) + { + m_referenceArrayId = -1; + m_referenceWidth = -1; + } + else if( m_referenceWidth != m_referenceNode.Position.width ) + { + m_referenceWidth = m_referenceNode.Position.width; + m_sizeIsDirty = true; + } + return m_referenceNode != null; + } + return false; + } + } + + public string CurrentPropertyReference + { + get + { + string propertyName = string.Empty; + if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 ) + { + ScreenColorNode node = UIUtils.GetScreenColorNode( m_referenceArrayId ); + propertyName = ( node != null ) ? node.PropertyName : m_propertyName; + } + else if( !m_useCustomGrab ) + { + propertyName = GrabTextureDefault; + } + else + { + propertyName = m_propertyName; + } + return propertyName; + } + } + + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 12 ) + { + m_referenceType = (TexReferenceType)Enum.Parse( typeof( TexReferenceType ), GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 22 ) + { + m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + else + { + m_referenceArrayId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + if( m_referenceType == TexReferenceType.Instance ) + { + UIUtils.UnregisterScreenColorNode( this ); + } + + UpdateHeaderColor(); + } + + if( UIUtils.CurrentShaderVersion() > 12101 ) + { + m_useCustomGrab = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + else + { + m_useCustomGrab = true; + } + + if( UIUtils.CurrentShaderVersion() > 14102 ) + { + m_normalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 18801 ) + { + m_exposure = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 18923 ) + { + m_isURP2D = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + if( !m_isNodeBeingCopied && m_referenceType == TexReferenceType.Object ) + { + ContainerGraph.ScreenColorNodes.UpdateDataOnNode( UniqueId, DataToArray ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceType ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( ( m_referenceNode != null ) ? m_referenceNode.UniqueId : -1 ) ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_useCustomGrab ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_normalize ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_exposure ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_isURP2D ); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( m_referenceType == TexReferenceType.Instance ) + { + if( UIUtils.CurrentShaderVersion() > 22 ) + { + m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as ScreenColorNode; + m_referenceArrayId = UIUtils.GetScreenColorNodeRegisterId( m_referenceNodeId ); + } + else + { + m_referenceNode = UIUtils.GetScreenColorNode( m_referenceArrayId ); + if( m_referenceNode != null ) + { + m_referenceNodeId = m_referenceNode.UniqueId; + } + } + } + + if( UIUtils.CurrentShaderVersion() <= 14102 ) + { + if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT4 ) + m_normalize = true; + else + m_normalize = false; + } + } + + public override string PropertyName + { + get + { + if( m_useCustomGrab ) + return base.PropertyName; + else + return GrabTextureDefault; + } + } + + public override string GetPropertyValStr() + { + return PropertyName; + } + + public override string DataToArray { get { return m_propertyName; } } + + public override string GetUniformValue() + { + if( SoftValidReference ) + { + if( m_referenceNode.IsConnected ) + return string.Empty; + + return m_referenceNode.GetUniformValue(); + } + return "ASE_DECLARE_SCREENSPACE_TEXTURE( " + PropertyName + " )"; + } + + public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) + { + if( SoftValidReference ) + { + //if ( m_referenceNode.IsConnected ) + //{ + // dataType = string.Empty; + // dataName = string.Empty; + //} + + return m_referenceNode.GetUniformData( out dataType, out dataName, ref fullValue ); + } + dataName = "ASE_DECLARE_SCREENSPACE_TEXTURE( " + PropertyName + " )"; + dataType = string.Empty; + fullValue = true; + return true; + } + + public override void CheckIfAutoRegister( ref MasterNodeDataCollector dataCollector ) + { + if( m_autoRegister && (m_connStatus != NodeConnectionStatus.Connected || InsideShaderFunction )) + { + SetMacros( ref dataCollector ); + RegisterProperty( ref dataCollector ); + string propertyName = CurrentPropertyReference; + bool emptyName = string.IsNullOrEmpty( m_propertyInspectorName ) || propertyName == GrabTextureDefault; + dataCollector.AddGrabPass( emptyName ? string.Empty : propertyName ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs.meta new file mode 100644 index 00000000..6a1f073a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b266c7cca236bcb469d6d4f13df55df5 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs new file mode 100644 index 00000000..60c1200b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs @@ -0,0 +1,179 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Screen Depth", "Camera And Screen", "Given a screen position returns the depth of the scene to the object as seen by the camera" )] + public sealed class ScreenDepthNode : ParentNode + { + + + [SerializeField] + private int m_viewSpaceInt = ( int )DepthMode.DepthEye; + private DepthMode m_depthMode { get { return ( DepthMode )m_viewSpaceInt; } } + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT4, false, "Pos" ); + AddOutputPort( WirePortDataType.FLOAT, "Depth" ); + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + UpdateAdditonalTitleText(); + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + private void UpdateAdditonalTitleText() + { + SetAdditonalTitleText( string.Format( Constants.SubTitleModeFormatStr, GeneratorUtils.DepthModeStr[ m_viewSpaceInt ] ) ); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_viewSpaceInt = m_upperLeftWidget.DrawWidget( this, m_viewSpaceInt, GeneratorUtils.DepthModeStr ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateAdditonalTitleText(); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_viewSpaceInt = EditorGUILayoutPopup( "Depth Mode", m_viewSpaceInt, GeneratorUtils.DepthModeStr ); + if ( EditorGUI.EndChangeCheck() ) + { + UpdateAdditonalTitleText(); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowNoVertexModeNodeMessage( this ); + return "0"; + } + + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + if ( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) + dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); + + if ( !dataCollector.IsTemplate || dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.HDRP ) + { + if ( dataCollector.IsTemplate && dataCollector.CurrentSRPType == TemplateSRPType.URP ) + { + dataCollector.AddToDirectives( Constants.CameraDepthTextureLWEnabler, -1, AdditionalLineType.Define ); + } + else + { + dataCollector.AddToUniforms( UniqueId, Constants.CameraDepthTextureValue ); + dataCollector.AddToUniforms( UniqueId, Constants.CameraDepthTextureTexelSize ); + } + } + + + string screenPosNorm = string.Empty; + if ( m_inputPorts[ 0 ].IsConnected ) + { + screenPosNorm = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + } + else + { + if ( dataCollector.IsTemplate ) + { + if ( !dataCollector.TemplateDataCollectorInstance.GetCustomInterpolatedData( TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED, WirePortDataType.FLOAT4, PrecisionType.Float, ref screenPosNorm, true, MasterNodePortCategory.Fragment ) ) + { + screenPosNorm = GeneratorUtils.GenerateScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); + } + } + else + { + screenPosNorm = GeneratorUtils.GenerateScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); + } + } + + string screenDepthInstruction = TemplateHelperFunctions.CreateDepthFetch( dataCollector, screenPosNorm ); + + if ( m_depthMode == DepthMode.DepthLinearEye || m_depthMode == DepthMode.DepthLinear01 ) + { + string viewSpace = ( m_depthMode == DepthMode.DepthLinearEye ) ? "LinearEyeDepth" : "Linear01Depth"; + if ( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + screenDepthInstruction = string.Format( "{0}( {1}, _ZBufferParams )", viewSpace, screenDepthInstruction ); + } + else + { + screenDepthInstruction = string.Format( "{0}( {1} )", viewSpace, screenDepthInstruction ); + } + } + else if ( m_depthMode == DepthMode.DepthEye ) + { + screenDepthInstruction = string.Format( "{0} * ( _ProjectionParams.z - _ProjectionParams.y )", screenDepthInstruction ); + } + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, GeneratorUtils.DepthModeVarNameStr[ m_viewSpaceInt ] + OutputId, screenDepthInstruction ); + + m_outputPorts[ 0 ].SetLocalValue( GeneratorUtils.DepthModeVarNameStr[ m_viewSpaceInt ] + OutputId, dataCollector.PortCategory ); + return GetOutputColorItem( 0, outputId, GeneratorUtils.DepthModeVarNameStr[ m_viewSpaceInt ] + OutputId ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_viewSpaceInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() >= 13901 && UIUtils.CurrentShaderVersion() < 19702 ) + { + bool convertToLinear = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + if ( !convertToLinear ) + { + if ( m_viewSpaceInt == ( int )DepthMode.DepthLinearEye ) + { + m_viewSpaceInt = ( int )DepthMode.DepthEye; + } + else if ( m_viewSpaceInt == ( int )DepthMode.DepthLinear01 ) + { + m_viewSpaceInt = ( int )DepthMode.Depth01; + } + } + } + + UpdateAdditonalTitleText(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_viewSpaceInt ); + } + } + +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs.meta new file mode 100644 index 00000000..35d24f76 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 52266d8a6f7f4fe428dcee2ddb0514ac +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs new file mode 100644 index 00000000..9aeeaa6b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs @@ -0,0 +1,163 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Screen Position", "Camera And Screen", "Gives access to the screen coordinates of the mesh vertex or fragment, where the X and Y values represent the horizontal and vertical positions. Use the Mode dropdown to choose the desired output mode." )] + public sealed class ScreenPosInputsNode : SurfaceShaderINParentNode + { + enum Mode + { + Normalized = 0, + Raw, + Center, + Tiled, + Pixel + }; + + private readonly string[] m_outputTypeStr = { "Normalized", "Raw", "Center", "Tiled", "Pixel" }; + + [SerializeField] + private int m_outputTypeInt = ( int )Mode.Normalized; + + [SerializeField] + private bool m_scaleAndOffset = false; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentInput = SurfaceInputs.SCREEN_POS; + InitialSetup(); + m_textLabelWidth = 65; + m_autoWrapProperties = true; + + m_hasLeftDropdown = true; + m_previewShaderGUID = "a5e7295278a404175b732f1516fb68a6"; + + if( UIUtils.CurrentWindow != null && UIUtils.CurrentWindow.CurrentGraph != null && UIUtils.CurrentShaderVersion() <= 2400 ) + { + m_outputTypeInt = ( int )Mode.Raw; + m_previewMaterialPassId = ( int )m_outputTypeInt; + } + + ConfigureHeader(); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_outputTypeInt = m_upperLeftWidget.DrawWidget( this, m_outputTypeInt, m_outputTypeStr ); + if( EditorGUI.EndChangeCheck() ) + { + ConfigureHeader(); + } + } + + public override void DrawProperties() + { + //base.DrawProperties(); + + EditorGUI.BeginChangeCheck(); + m_outputTypeInt = EditorGUILayoutPopup( "Mode", m_outputTypeInt, m_outputTypeStr ); + if( EditorGUI.EndChangeCheck() ) + { + ConfigureHeader(); + } + } + + void ConfigureHeader() + { + SetAdditonalTitleText( string.Format( Constants.SubTitleModeFormatStr, m_outputTypeStr[ m_outputTypeInt ] ) ); + m_previewMaterialPassId = m_outputTypeInt; + } + + public override void Reset() + { + base.Reset(); + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + { + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + m_currentPrecisionType = PrecisionType.Float; + + // TODO: these kinds of calls need a serious cleanup, too much redundancy + string screenPos = string.Empty; + if ( dataCollector.TesselationActive && dataCollector.IsFragmentCategory || dataCollector.IsTemplate ) + { + switch ( ( Mode )m_outputTypeInt ) + { + case Mode.Normalized: screenPos = GeneratorUtils.GenerateScreenPositionNormalizedOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); break; + case Mode.Raw: screenPos = GeneratorUtils.GenerateScreenPositionRawOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); break; + case Mode.Center: screenPos = GeneratorUtils.GenerateScreenPositionCenterOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); break; + case Mode.Tiled: screenPos = GeneratorUtils.GenerateScreenPositionTiledOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); break; + case Mode.Pixel: screenPos = GeneratorUtils.GenerateScreenPositionPixelOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); break; + } + } + else + { + switch ( ( Mode )m_outputTypeInt ) + { + case Mode.Normalized: screenPos = GeneratorUtils.GenerateScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType ); break; + case Mode.Raw: screenPos = GeneratorUtils.GenerateScreenPositionRaw( ref dataCollector, UniqueId, CurrentPrecisionType ); break; + case Mode.Center: screenPos = GeneratorUtils.GenerateScreenPositionCenter( ref dataCollector, UniqueId, CurrentPrecisionType ); break; + case Mode.Tiled: screenPos = GeneratorUtils.GenerateScreenPositionTiled( ref dataCollector, UniqueId, CurrentPrecisionType ); break; + case Mode.Pixel: screenPos = GeneratorUtils.GenerateScreenPositionPixel( ref dataCollector, UniqueId, CurrentPrecisionType ); break; + } + } + + m_outputPorts[ 0 ].SetLocalValue( screenPos, dataCollector.PortCategory ); + return GetOutputVectorItem( 0, outputId, screenPos ); + + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 2400 ) + { + if( UIUtils.CurrentShaderVersion() < 6102 ) + { + bool project = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_outputTypeInt = project ? ( int )Mode.Normalized : ( int )Mode.Raw; + } + else + { + m_outputTypeInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + } + + if( UIUtils.CurrentShaderVersion() > 3107 ) + { + m_scaleAndOffset = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_scaleAndOffset = false; + } + + ConfigureHeader(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_outputTypeInt ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_scaleAndOffset ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs.meta new file mode 100644 index 00000000..710eecab --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 32cea8ff65efa3844a0047477ec789da +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs new file mode 100644 index 00000000..07c55dff --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs @@ -0,0 +1,122 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class SurfaceShaderINParentNode : ParentNode + { + [SerializeField] + protected SurfaceInputs m_currentInput; + + [SerializeField] + protected string m_currentInputValueStr; + + [SerializeField] + protected string m_currentInputDecStr; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentInput = SurfaceInputs.UV_COORDS; + m_textLabelWidth = 65; + m_customPrecision = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + DrawPrecisionProperty(); + } + //This needs to be called on the end of the CommonInit on all children + protected void InitialSetup() + { + m_currentInputValueStr = Constants.InputVarStr + "." + UIUtils.GetInputValueFromType( m_currentInput ); + + string outputName = "Out"; + switch ( m_currentInput ) + { + case SurfaceInputs.DEPTH: + { + AddOutputPort( WirePortDataType.FLOAT, outputName ); + } + break; + case SurfaceInputs.UV_COORDS: + { + outputName = "UV"; + AddOutputVectorPorts( WirePortDataType.FLOAT2, outputName ); + } + break; + case SurfaceInputs.UV2_COORDS: + { + outputName = "UV"; + AddOutputVectorPorts( WirePortDataType.FLOAT2, outputName ); + } + break; + case SurfaceInputs.VIEW_DIR: + { + outputName = "XYZ"; + AddOutputVectorPorts( WirePortDataType.FLOAT3, outputName ); + } + break; + case SurfaceInputs.COLOR: + { + outputName = "RGBA"; + AddOutputVectorPorts( WirePortDataType.FLOAT4, outputName ); + } + break; + case SurfaceInputs.SCREEN_POS: + { + outputName = "XYZW"; + AddOutputVectorPorts( WirePortDataType.FLOAT4, outputName ); + } + break; + case SurfaceInputs.WORLD_POS: + { + outputName = "XYZ"; + AddOutputVectorPorts( WirePortDataType.FLOAT3, outputName ); + } + break; + case SurfaceInputs.WORLD_REFL: + { + outputName = "XYZ"; + AddOutputVectorPorts( WirePortDataType.FLOAT3, outputName ); + } + break; + case SurfaceInputs.WORLD_NORMAL: + { + outputName = "XYZ"; + AddOutputVectorPorts( WirePortDataType.FLOAT3, outputName ); + } + break; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + dataCollector.AddToInput( UniqueId, m_currentInput, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + switch ( m_currentInput ) + { + case SurfaceInputs.VIEW_DIR: + case SurfaceInputs.WORLD_REFL: + case SurfaceInputs.WORLD_NORMAL: + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + } + break; + case SurfaceInputs.WORLD_POS: + case SurfaceInputs.DEPTH: + case SurfaceInputs.UV_COORDS: + case SurfaceInputs.UV2_COORDS: + case SurfaceInputs.COLOR: + case SurfaceInputs.SCREEN_POS: break; + }; + + return GetOutputVectorItem( 0, outputId, m_currentInputValueStr ); + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs.meta new file mode 100644 index 00000000..7687da3c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 71628885b2fde0944bf7dd8e4eb2770f +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs new file mode 100644 index 00000000..07db369a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs @@ -0,0 +1,340 @@ +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +using System; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Texel Size", "Textures", "Texel Size for a given texture object" )] + public sealed class TexelSizeNode : ParentNode + { + private readonly string[] Dummy = { string.Empty }; + + [SerializeField] + private int m_referenceSamplerId = -1; + + [SerializeField] + private int m_referenceNodeId = -1; + + [SerializeField] + private TexturePropertyNode m_inputReferenceNode = null; + + private TexturePropertyNode m_referenceNode = null; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + [SerializeField] + private string m_previousTexture = string.Empty; + + [SerializeField] + private VariableMode m_variableMode = VariableMode.Create; + + private int m_cachedSamplerId = -1; + private int m_cachedSamplerIdArray = -1; + private int m_cachedSamplerIdCube = -1; + private int m_cachedSamplerId3D = -1; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.SAMPLER2D, false, "Tex" ); + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.SAMPLER2DARRAY, WirePortDataType.OBJECT ); + AddOutputVectorPorts( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); + ChangeOutputName( 1, "1/Width" ); + ChangeOutputName( 2, "1/Height" ); + ChangeOutputName( 3, "Width" ); + ChangeOutputName( 4, "Height" ); + m_textLabelWidth = 80; + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + m_previewShaderGUID = "6b20226576a059443b58aa2d0b942276"; + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_inputReferenceNode = m_inputPorts[ 0 ].GetOutputNodeWhichIsNotRelay() as TexturePropertyNode; + UpdateTitle(); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + m_inputReferenceNode = null; + UpdateTitle(); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + UpdateTitle(); + } + + void UpdateTitle() + { + if( m_inputReferenceNode != null ) + { + m_additionalContent.text = string.Format( Constants.PropertyValueLabel, m_inputReferenceNode.PropertyInspectorName ); + } + else if( m_referenceSamplerId > -1 && m_referenceNode != null ) + { + m_additionalContent.text = string.Format( Constants.PropertyValueLabel, m_referenceNode.PropertyInspectorName ); + } + else + { + m_additionalContent.text = string.Empty; + } + m_sizeIsDirty = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + bool guiEnabledBuffer = GUI.enabled; + EditorGUI.BeginChangeCheck(); + List arr = new List( UIUtils.TexturePropertyNodeArr() ); + + if( arr != null && arr.Count > 0 ) + { + arr.Insert( 0, "None" ); + GUI.enabled = true && ( !m_inputPorts[ 0 ].IsConnected ); + m_referenceSamplerId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceSamplerId + 1, arr.ToArray() ) - 1; + } + else + { + m_referenceSamplerId = -1; + GUI.enabled = false; + EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceSamplerId, Dummy ); + } + + GUI.enabled = guiEnabledBuffer; + if( EditorGUI.EndChangeCheck() ) + { + m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId ); + if( m_referenceNode != null ) + { + m_referenceNodeId = m_referenceNode.UniqueId; + } + else + { + m_referenceNodeId = -1; + m_referenceSamplerId = -1; + } + UpdateTitle(); + } + + m_variableMode = ( VariableMode )EditorGUILayoutEnumPopup( "Variable Mode", m_variableMode ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + string texelName = string.Empty; + + if( m_inputPorts[ 0 ].IsConnected ) + { + texelName = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + "_TexelSize"; + } + else if( m_referenceNode != null ) + { + m_referenceNode.BaseGenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + texelName = m_referenceNode.PropertyName + "_TexelSize"; + } + else + { + texelName = "_TexelSize"; + UIUtils.ShowMessage( UniqueId, "Please specify a texture sample on the Texel Size node", MessageSeverity.Warning ); + } + + if ( m_variableMode == VariableMode.Create ) + { + dataCollector.AddToUniforms( UniqueId, "float4 " + texelName + ";", dataCollector.IsSRP ); + } + + switch( outputId ) + { + case 0: return texelName; + case 1: return ( texelName + ".x" ); + case 2: return ( texelName + ".y" ); + case 3: return ( texelName + ".z" ); + case 4: return ( texelName + ".w" ); + } + + return string.Empty; + } + + void SetPreviewTexture( Texture newValue ) + { + if( newValue is Cubemap ) + { + m_previewMaterialPassId = 3; + if( m_cachedSamplerIdCube == -1 ) + m_cachedSamplerIdCube = Shader.PropertyToID( "_Cube" ); + + PreviewMaterial.SetTexture( m_cachedSamplerIdCube, newValue as Cubemap ); + } + else if( newValue is Texture2DArray ) + { + + m_previewMaterialPassId = 2; + if( m_cachedSamplerIdArray == -1 ) + m_cachedSamplerIdArray = Shader.PropertyToID( "_Array" ); + + PreviewMaterial.SetTexture( m_cachedSamplerIdArray, newValue as Texture2DArray ); + } + else if( newValue is Texture3D ) + { + m_previewMaterialPassId = 1; + if( m_cachedSamplerId3D == -1 ) + m_cachedSamplerId3D = Shader.PropertyToID( "_Sampler3D" ); + + PreviewMaterial.SetTexture( m_cachedSamplerId3D, newValue as Texture3D ); + } + else + { + m_previewMaterialPassId = 0; + if( m_cachedSamplerId == -1 ) + m_cachedSamplerId = Shader.PropertyToID( "_Sampler" ); + + PreviewMaterial.SetTexture( m_cachedSamplerId, newValue ); + } + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + if( m_inputPorts[ 0 ].IsConnected ) + { + SetPreviewTexture( m_inputPorts[ 0 ].InputPreviewTexture( ContainerGraph ) ); + } + else if( m_referenceNode != null ) + { + if( m_referenceNode.Value != null ) + { + SetPreviewTexture( m_referenceNode.Value ); + } + else + { + SetPreviewTexture( m_referenceNode.PreviewTexture ); + } + } + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + + if( m_referenceNode != null && m_previousTexture != m_referenceNode.AdditonalTitleContent.text ) + { + m_previousTexture = m_referenceNode.AdditonalTitleContent.text; + PreviewIsDirty = true; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + EditorGUI.BeginChangeCheck(); + { + List arr = new List( UIUtils.TexturePropertyNodeArr() ); + bool guiEnabledBuffer = GUI.enabled; + + if( arr != null && arr.Count > 0 ) + { + arr.Insert( 0, "None" ); + GUI.enabled = true && ( !m_inputPorts[ 0 ].IsConnected ); + m_referenceSamplerId = m_upperLeftWidget.DrawWidget( this, m_referenceSamplerId + 1, arr.ToArray() ) - 1; + } + else + { + m_referenceSamplerId = -1; + GUI.enabled = false; + m_upperLeftWidget.DrawWidget( this, m_referenceSamplerId, Dummy ); + } + GUI.enabled = guiEnabledBuffer; + } + if( EditorGUI.EndChangeCheck() ) + { + m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId ); + if( m_referenceNode != null ) + { + m_referenceNodeId = m_referenceNode.UniqueId; + } + else + { + m_referenceNodeId = -1; + m_referenceSamplerId = -1; + } + UpdateTitle(); + } + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( UIUtils.CurrentShaderVersion() > 2404 ) + { + m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as TexturePropertyNode; + m_referenceSamplerId = UIUtils.GetTexturePropertyNodeRegisterId( m_referenceNodeId ); + } + else + { + m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId ); + if( m_referenceNode != null ) + { + m_referenceNodeId = m_referenceNode.UniqueId; + } + } + UpdateTitle(); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 2404 ) + { + m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + else + { + m_referenceSamplerId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + if ( UIUtils.CurrentShaderVersion() >= 19801 ) + { + m_variableMode = ( VariableMode )Enum.Parse( typeof( VariableMode ), GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceNodeId ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_variableMode ); + } + + public override void Destroy() + { + base.Destroy(); + m_referenceNode = null; + m_inputReferenceNode = null; + m_upperLeftWidget = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs.meta new file mode 100644 index 00000000..7a8cf4c6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1a23decd88779d24f9af6ae30c3d5a5f +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs new file mode 100644 index 00000000..b259d89f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs @@ -0,0 +1,112 @@ +//// Amplify Shader Editor - Visual Shader Editing Tool +//// Copyright (c) Amplify Creations, Lda + +//using UnityEngine; +//using UnityEditor; +//using System; + +//namespace AmplifyShaderEditor +//{ +// [Serializable] +// [NodeAttributes( "[Old]Texture Coordinates", "Surface Data", "Texture UV coordinates set", null, KeyCode.U, false )] +// public sealed class UVCoordsParentNode : ParentNode +// { +// private const string TilingStr = "Tiling"; + +// [SerializeField] +// private int m_textureCoordChannel = 0; + +// [SerializeField] +// private int m_textureCoordSet = 0; + +// [SerializeField] +// private Vector2 m_tiling = new Vector2( 1, 1 ); + +// protected override void CommonInit( int uniqueId ) +// { +// base.CommonInit( uniqueId ); +// AddOutputVectorPorts( WirePortDataType.FLOAT2, Constants.EmptyPortValue ); +// m_textLabelWidth = 75; +// } + +// public override void DrawProperties() +// { +// base.DrawProperties(); +// int newChannel = EditorGUILayoutIntPopup( Constants.AvailableUVChannelLabel, m_textureCoordChannel, Constants.AvailableUVChannelsStr, Constants.AvailableUVChannels ); +// if ( newChannel != m_textureCoordChannel ) +// { +// if ( UIUtils.IsChannelAvailable( newChannel ) ) +// { +// UIUtils.ShowMessage( "Attempting to use an unoccupied used texture channel" ); +// } +// else +// { +// m_textureCoordChannel = newChannel; +// } +// } +// else if ( m_textureCoordChannel > -1 && UIUtils.IsChannelAvailable( m_textureCoordChannel ) ) +// { +// UIUtils.ShowMessage( "Texture Channel " + m_textureCoordChannel + " is unavailable for TextureCoordinate node" ); +// m_textureCoordChannel = -1; +// } + +// m_textureCoordSet = EditorGUILayoutIntPopup( Constants.AvailableUVSetsLabel, m_textureCoordSet, Constants.AvailableUVSetsStr, Constants.AvailableUVSets ); + +// m_tiling = EditorGUILayoutVector2Field( TilingStr, m_tiling ); +// } + +// public override void Draw( DrawInfo drawInfo ) +// { +// base.Draw( drawInfo ); +// if ( m_isVisible ) +// { +// m_propertyDrawPos.x = m_globalPosition.x + Constants.FLOAT_WIDTH_SPACING; +// m_propertyDrawPos.y = m_outputPorts[ 1 ].Position.y; +// m_propertyDrawPos.width = 2.7f * drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; +// m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; + +// m_propertyDrawPos.y = m_outputPorts[ 1 ].Position.y; +// UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_tiling.x ); + +// m_propertyDrawPos.y = m_outputPorts[ 2 ].Position.y; +// UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_tiling.y ); +// } +// } + +// public override void ReadFromString( ref string[] nodeParams ) +// { +// base.ReadFromString( ref nodeParams ); +// m_textureCoordChannel = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); +// m_tiling.x = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); +// m_tiling.y = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); +// } + +// public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) +// { +// base.WriteToString( ref nodeInfo, ref connectionsInfo ); +// IOUtils.AddFieldValueToString( ref nodeInfo, m_textureCoordChannel ); +// IOUtils.AddFieldValueToString( ref nodeInfo, m_tiling.x ); +// IOUtils.AddFieldValueToString( ref nodeInfo, m_tiling.y ); +// } + +// public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) +// { +// string uvChannelDeclaration = IOUtils.GetUVChannelDeclaration( UIUtils.GetChannelName( m_textureCoordChannel ), m_textureCoordChannel, m_textureCoordSet ); +// dataCollector.AddToInput( UniqueId, uvChannelDeclaration, true ); + +// if ( dataCollector.GetChannelUsage( m_textureCoordChannel ) != TextureChannelUsage.Used ) +// dataCollector.SetChannelUsage( m_textureCoordChannel, TextureChannelUsage.Required ); + +// string uvTileStr = string.Empty; +// switch ( outputId ) +// { +// case 0: { uvTileStr = "float2( " + m_tiling.x + " , " + m_tiling.y + " )"; } break; +// case 1: { uvTileStr = m_tiling.x.ToString(); } break; +// case 2: { uvTileStr = m_tiling.y.ToString(); } break; +// } +// string uvChannelName = IOUtils.GetUVChannelName( UIUtils.GetChannelName( m_textureCoordChannel ), m_textureCoordSet ); +// return ( uvTileStr + "*" + GetOutputVectorItem( 0, outputId, Constants.InputVarStr + "." + uvChannelName ) ); +// } + +// } +//} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs.meta new file mode 100644 index 00000000..9aeb9516 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 73fb18e7d547d514695cb0b83a29f80e +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs new file mode 100644 index 00000000..5578a1c7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs @@ -0,0 +1,151 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public enum ViewSpace + { + Tangent, + World, + Object, + View + } + + [Serializable] + [NodeAttributes( "View Dir", "Camera And Screen", "Normalized View Direction vector.", tags: "camera vector" )] + public sealed class ViewDirInputsCoordNode : SurfaceShaderINParentNode + { + private const string SpaceStr = "Space"; + private const string NormalizeOptionStr = "Safe Normalize"; + + [SerializeField] + private bool m_safeNormalize = false; + + [SerializeField] + private ViewSpace m_viewDirSpace = ViewSpace.World; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentInput = SurfaceInputs.VIEW_DIR; + InitialSetup(); + m_textLabelWidth = 120; + m_autoWrapProperties = true; + m_drawPreviewAsSphere = true; + m_hasLeftDropdown = true; + UpdateTitle(); + m_previewShaderGUID = "07b57d9823df4bd4d8fe6dcb29fca36a"; + } + + private void UpdateTitle() + { + m_additionalContent.text = string.Format( Constants.SubTitleSpaceFormatStr, m_viewDirSpace.ToString() ); + m_sizeIsDirty = true; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + m_upperLeftWidget.DrawWidget( ref m_viewDirSpace, this, OnWidgetUpdate ); + } + + private readonly Action OnWidgetUpdate = ( x ) => + { + ( x as ViewDirInputsCoordNode ).UpdateTitle(); + }; + + public override void DrawProperties() + { + //base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_viewDirSpace = (ViewSpace)EditorGUILayoutEnumPopup( SpaceStr, m_viewDirSpace ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateTitle(); + } + m_safeNormalize = EditorGUILayoutToggle( NormalizeOptionStr, m_safeNormalize ); + EditorGUILayout.HelpBox( "Having safe normalize ON makes sure your view vector is not zero even if you are using your shader with no cameras.", MessageType.None ); + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + m_previewMaterialPassId = ( int )m_viewDirSpace; + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + if( m_viewDirSpace == ViewSpace.Tangent ) + dataCollector.DirtyNormal = true; + + if( m_safeNormalize ) + dataCollector.SafeNormalizeViewDir = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if( dataCollector.IsTemplate ) + { + TemplateDataCollector inst = dataCollector.TemplateDataCollectorInstance; + string varName = inst.GetViewDir(useMasterNodeCategory: true, customCategory: MasterNodePortCategory.Fragment, normalizeType: m_safeNormalize ? NormalizeType.Safe : NormalizeType.Regular, space: m_viewDirSpace ); + return GetOutputVectorItem( 0, outputId, varName ); + } + + + if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + string result = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId, normalizeType: m_safeNormalize ? NormalizeType.Safe : NormalizeType.Regular, space: m_viewDirSpace ); + return GetOutputVectorItem( 0, outputId, result ); + } + else + { + if ( m_viewDirSpace == ViewSpace.Tangent ) + { + string result = base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); + if ( m_safeNormalize ) + { + result = TemplateHelperFunctions.SafeNormalize( dataCollector, result ); + } + return result; + } + else + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); + string result = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId, m_safeNormalize ? NormalizeType.Safe : NormalizeType.Regular, space: m_viewDirSpace ); + return GetOutputVectorItem( 0, outputId, result ); + } + + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 2402 ) + { + m_viewDirSpace = ( ViewSpace )Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 15201 ) + { + m_safeNormalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + UpdateTitle(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_viewDirSpace ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_safeNormalize ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs.meta new file mode 100644 index 00000000..d0de73b7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4755b85e957e31d4b96d341070b156b5 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewVectorNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewVectorNode.cs new file mode 100644 index 00000000..b23c2a33 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewVectorNode.cs @@ -0,0 +1,120 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "View Vector", "Camera And Screen", "Unnormalized View Direction vector.", tags: "camera vector" )] + public sealed class ViewVectorNode : ParentNode + { + private const string SpaceStr = "Space"; + + [SerializeField] + private ViewSpace m_viewDirSpace = ViewSpace.World; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + + AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); + //m_outputPorts[ 4 ].Visible = false; + + m_textLabelWidth = 120; + m_autoWrapProperties = true; + m_drawPreviewAsSphere = true; + m_hasLeftDropdown = true; + UpdateTitle(); + m_previewShaderGUID = "30c17cf801c339f489ed656ff9d66a5b"; + } + + private void UpdateTitle() + { + m_additionalContent.text = string.Format( Constants.SubTitleSpaceFormatStr, m_viewDirSpace.ToString() ); + m_sizeIsDirty = true; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + m_upperLeftWidget.DrawWidget( ref m_viewDirSpace, this, OnWidgetUpdate ); + } + + private readonly Action OnWidgetUpdate = ( x ) => + { + ( x as ViewVectorNode ).UpdateTitle(); + }; + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_viewDirSpace = ( ViewSpace )EditorGUILayoutEnumPopup( SpaceStr, m_viewDirSpace ); + if ( EditorGUI.EndChangeCheck() ) + { + UpdateTitle(); + } + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + m_previewMaterialPassId = ( int )m_viewDirSpace; + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + if ( m_viewDirSpace == ViewSpace.Tangent ) + { + dataCollector.DirtyNormal = true; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if ( dataCollector.IsTemplate ) + { + TemplateDataCollector inst = dataCollector.TemplateDataCollectorInstance; + string varName = inst.GetViewVector( useMasterNodeCategory: true, customCategory: MasterNodePortCategory.Fragment, space: m_viewDirSpace ); + return GetOutputVectorItem( 0, outputId, varName ); + } + + if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + string result = GeneratorUtils.GenerateViewVector( ref dataCollector, UniqueId, space: m_viewDirSpace ); + return GetOutputVectorItem( 0, outputId, result ); + } + else + { + if ( m_viewDirSpace == ViewSpace.Tangent ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + dataCollector.ForceNormal = true; + } + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); + string result = GeneratorUtils.GenerateViewVector( ref dataCollector, UniqueId, space: m_viewDirSpace ); + return GetOutputVectorItem( 0, outputId, result ); + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_viewDirSpace = ( ViewSpace )Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ); + UpdateTitle(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_viewDirSpace ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewVectorNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewVectorNode.cs.meta new file mode 100644 index 00000000..9307a4e3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewVectorNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 558019813ea988c418aa3f28bd104b29 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewVectorNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs new file mode 100644 index 00000000..1a4b28b6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs @@ -0,0 +1,119 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "[Deprecated] World Normal", "Surface Data", "Vertex Normal World", null, KeyCode.None, true, true, "World Normal", typeof( WorldNormalVector ) )] + public sealed class WorldNormalInputsNode : SurfaceShaderINParentNode + { + private const string PerPixelLabelStr = "Per Pixel"; + + [SerializeField] + private bool m_perPixel = true; + + [SerializeField] + private string m_precisionString; + + [SerializeField] + private bool m_addInstruction = false; + + public override void Reset() + { + base.Reset(); + m_addInstruction = true; + } + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentInput = SurfaceInputs.WORLD_NORMAL; + InitialSetup(); + //UIUtils.AddNormalDependentCount(); + } + + //public override void Destroy() + //{ + // ContainerGraph.RemoveNormalDependentCount(); + // base.Destroy(); + //} + + public override void DrawProperties() + { + base.DrawProperties(); + m_perPixel = EditorGUILayoutToggleLeft( PerPixelLabelStr, m_perPixel ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + if ( m_addInstruction ) + { + string precision = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT3 ); + dataCollector.AddVertexInstruction( precision + " worldNormal = UnityObjectToWorldNormal(" + Constants.VertexShaderInputStr + ".normal)", UniqueId ); + m_addInstruction = false; + } + + return GetOutputVectorItem( 0, outputId, "worldNormal" ); + } + else + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + if ( dataCollector.PortCategory != MasterNodePortCategory.Debug && m_perPixel && dataCollector.DirtyNormal ) + { + //string result = "WorldNormalVector( " + Constants.InputVarStr + " , float3( 0,0,1 ))"; + m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT3 ); + string result = string.Format( Constants.WorldNormalLocalDecStr, m_precisionString ); + int count = 0; + for ( int i = 0; i < m_outputPorts.Count; i++ ) + { + if ( m_outputPorts[ i ].IsConnected ) + { + if ( m_outputPorts[ i ].ConnectionCount > 2 ) + { + count = 2; + break; + } + count += 1; + if ( count > 1 ) + break; + } + } + if ( count > 1 ) + { + string localVarName = "WorldNormal" + OutputId; + dataCollector.AddToLocalVariables( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, localVarName, result ); + return GetOutputVectorItem( 0, outputId, localVarName ); + } + else + { + return GetOutputVectorItem( 0, outputId, result ); + } + } + else + { + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); + } + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if ( UIUtils.CurrentShaderVersion() > 2504 ) + m_perPixel = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_perPixel ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs.meta new file mode 100644 index 00000000..5b54857e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 891e3ffa10c12c54e83a1e40df03df2f +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs new file mode 100644 index 00000000..2e32d5a4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs @@ -0,0 +1,178 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "World Normal", "Surface Data", "Per pixel world normal vector, accepts a Normal vector in tangent space (ie: normalmap)" )] + public sealed class WorldNormalVector : ParentNode + { + private const string NormalVecValStr = "newWorldNormal"; + private const string NormalVecDecStr = "float3 {0} = {1};"; + + private const string NormalizeOptionStr = "Normalize"; + private const string NormalizeFunc = "normalize( {0} )"; + + [SerializeField] + private bool m_normalize = false; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "Normal" ); + AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); + m_inputPorts[ 0 ].Vector3InternalData = Vector3.forward; + m_previewShaderGUID = "5f55f4841abb61e45967957788593a9d"; + m_drawPreviewAsSphere = true; + m_autoWrapProperties = true; + m_textLabelWidth = 80; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_inputPorts[ 0 ].IsConnected ) + m_previewMaterialPassId = 1; + else + m_previewMaterialPassId = 0; + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + if( m_inputPorts[ 0 ].IsConnected ) + dataCollector.DirtyNormal = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + m_normalize = EditorGUILayoutToggle( NormalizeOptionStr, m_normalize ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.IsTemplate ) + { + if( m_inputPorts[ 0 ].IsConnected ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + + string value = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), OutputId ); + if( m_normalize ) + { + value = string.Format( NormalizeFunc, value ); + } + RegisterLocalVariable( 0, value, ref dataCollector, "worldNormal" + OutputId ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + else + { + string value = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( CurrentPrecisionType ); + string name; + if( m_normalize ) + { + name = "normalizedWorldNormal"; + value = string.Format( NormalizeFunc, value ); + RegisterLocalVariable( 0, value, ref dataCollector, name ); + } + else + { + name = value; + } + return GetOutputVectorItem( 0, outputId, name ); + } + } + + if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + + string result = string.Empty; + if( m_inputPorts[ 0 ].IsConnected ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + dataCollector.ForceNormal = true; + + result = "(WorldNormalVector( " + Constants.InputVarStr + " , " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + " ))"; + if( m_normalize ) + { + result = string.Format( NormalizeFunc, result ); + } + + int connCount = 0; + for( int i = 0; i < m_outputPorts.Count; i++ ) + { + connCount += m_outputPorts[ i ].ConnectionCount; + } + + if( connCount > 1 ) + { + dataCollector.AddToFragmentLocalVariables( UniqueId, string.Format( NormalVecDecStr, NormalVecValStr + OutputId, result ) ); + return GetOutputVectorItem( 0, outputId, NormalVecValStr + OutputId ); + } + } + else + { + if( !dataCollector.DirtyNormal ) + { + result = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, m_normalize ); + } + else + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + result = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, m_normalize ); + dataCollector.ForceNormal = true; + } + } + + return GetOutputVectorItem( 0, outputId, result ); + } + else + { + if( m_inputPorts[ 0 ].IsConnected ) + { + string inputTangent = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + string normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId ); + string tangent = GeneratorUtils.GenerateWorldTangent( ref dataCollector, UniqueId ); + dataCollector.AddToVertexLocalVariables( UniqueId, "float3x3 tangentToWorld = CreateTangentToWorldPerVertex( " + normal + ", " + tangent + ", " + Constants.VertexShaderInputStr + ".tangent.w );" ); + dataCollector.AddToVertexLocalVariables( UniqueId, "float3 tangentNormal" + OutputId + " = " + inputTangent + ";" ); + string result = "(tangentToWorld[0] * tangentNormal" + OutputId + ".x + tangentToWorld[1] * tangentNormal" + OutputId + ".y + tangentToWorld[2] * tangentNormal" + OutputId + ".z)"; + if( m_normalize ) + { + result = string.Format( NormalizeFunc, result ); + } + dataCollector.AddToVertexLocalVariables( UniqueId, "float3 modWorldNormal" + OutputId + " = " + result + ";" ); + return GetOutputVectorItem( 0, outputId, "modWorldNormal" + OutputId ); + } + else + { + string result = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, m_normalize ); + return GetOutputVectorItem( 0, outputId, result ); + } + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 14202 ) + { + m_normalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_normalize ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs.meta new file mode 100644 index 00000000..3dab2cf7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d61a084db19701c4fb3030ee953ac509 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs new file mode 100644 index 00000000..15c0b29f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs @@ -0,0 +1,37 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "World Position", "Surface Data", "World space position" )] + public sealed class WorldPosInputsNode : SurfaceShaderINParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentInput = SurfaceInputs.WORLD_POS; + m_drawPreviewAsSphere = true; + m_previewShaderGUID = "70d5405009b31a349a4d8285f30cf5d9"; + InitialSetup(); + } + + public override void DrawProperties() { } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if ( dataCollector.IsTemplate ) + { + string varName = dataCollector.TemplateDataCollectorInstance.GetWorldPos(); + return GetOutputVectorItem( 0, outputId, varName ); + } + + string worldPosition = GeneratorUtils.GenerateWorldPosition( ref dataCollector, UniqueId ); + + return GetOutputVectorItem( 0, outputId, worldPosition ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs.meta new file mode 100644 index 00000000..5eef5e56 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 850bb0065928b7f499b869b8adc1ce5c +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs new file mode 100644 index 00000000..99b49780 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs @@ -0,0 +1,18 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "[Deprecated] World Reflection", "Surface Data", "World reflection vector", null, KeyCode.None, true, true, "World Reflection", typeof( WorldReflectionVector ) )] + public sealed class WorldReflInputsNode : SurfaceShaderINParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentInput = SurfaceInputs.WORLD_REFL; + InitialSetup(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs.meta new file mode 100644 index 00000000..9bd05145 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e4f39f3a52f10644392decce9d1e6790 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs new file mode 100644 index 00000000..d9fd77b6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs @@ -0,0 +1,215 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "World Reflection", "Surface Data", "Per pixel world reflection vector, accepts a Normal vector in tangent space (ie: normalmap)" )] + public sealed class WorldReflectionVector : ParentNode + { + private const string ReflectionVecValStr = "newWorldReflection"; + private const string ReflectionVecDecStr = "{0} {1} = {2};"; + + private const string NormalizeOptionStr = "Normalize"; + private const string NormalizeFunc = "normalize( {0} )"; + + [SerializeField] + private bool m_normalize = false; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "Normal" ); + AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); + m_drawPreviewAsSphere = true; + m_previewShaderGUID = "8e267e9aa545eeb418585a730f50273e"; + m_autoWrapProperties = true; + m_textLabelWidth = 80; + //UIUtils.AddNormalDependentCount(); + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( m_inputPorts[ 0 ].IsConnected ) + m_previewMaterialPassId = 1; + else + m_previewMaterialPassId = 0; + } + + public override void DrawProperties() + { + base.DrawProperties(); + m_normalize = EditorGUILayoutToggle( NormalizeOptionStr, m_normalize ); + } + + //public override void Destroy() + //{ + // ContainerGraph.RemoveNormalDependentCount(); + // base.Destroy(); + //} + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + if( m_inputPorts[ 0 ].IsConnected ) + dataCollector.DirtyNormal = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if( dataCollector.IsTemplate ) + { + if( m_inputPorts[ 0 ].IsConnected ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + + string value = dataCollector.TemplateDataCollectorInstance.GetWorldReflection( CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) ); + if( m_normalize ) + { + value = string.Format( NormalizeFunc, value ); + } + RegisterLocalVariable( 0, value, ref dataCollector, "worldRefl" + OutputId ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + else + { + string name; + string value = dataCollector.TemplateDataCollectorInstance.GetWorldReflection( CurrentPrecisionType ); + if( m_normalize ) + { + name = "normalizedWorldRefl"; + value = string.Format( NormalizeFunc, value ); + RegisterLocalVariable( 0, value, ref dataCollector, name ); + } + else + { + name = value; + } + return GetOutputVectorItem( 0, outputId, name ); + } + } + + bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation || dataCollector.PortCategory == MasterNodePortCategory.Vertex ); + if( isVertex ) + { + if( m_inputPorts[ 0 ].IsConnected ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + string normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId ); + string tangent = GeneratorUtils.GenerateWorldTangent( ref dataCollector, UniqueId ); + dataCollector.AddToVertexLocalVariables( UniqueId, "float3x3 tangentToWorld = CreateTangentToWorldPerVertex( " + normal + ", "+ tangent + ", "+ Constants.VertexShaderInputStr + ".tangent.w );" ); + string inputTangent = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + dataCollector.AddToVertexLocalVariables( UniqueId, "float3 tangentNormal" + OutputId + " = " + inputTangent + ";" ); + + string viewDir = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId ); + dataCollector.AddToVertexLocalVariables( UniqueId, "float3 modWorldNormal" + OutputId + " = ( tangentToWorld[0] * tangentNormal" + OutputId + ".x + tangentToWorld[1] * tangentNormal" + OutputId + ".y + tangentToWorld[2] * tangentNormal" + OutputId + ".z);" ); + + string value = "reflect( -" + viewDir + ", modWorldNormal" + OutputId + " )"; + if( m_normalize ) + { + value = string.Format( NormalizeFunc, value ); + } + + RegisterLocalVariable( 0, value, ref dataCollector, "modReflection" + OutputId ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + else + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + string worldNormal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId ); + string viewDir = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId ); + + string value = "reflect( -" + viewDir + ", " + worldNormal + " )"; + if( m_normalize ) + { + value = string.Format( NormalizeFunc, value ); + } + RegisterLocalVariable( 0, value, ref dataCollector, ReflectionVecValStr + OutputId ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + } + else + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_REFL, CurrentPrecisionType ); + + string result = string.Empty; + if( m_inputPorts[ 0 ].IsConnected ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + dataCollector.ForceNormal = true; + + result = "WorldReflectionVector( " + Constants.InputVarStr + " , " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + " )"; + if( m_normalize ) + { + result = String.Format( NormalizeFunc, result ); + } + int connCount = 0; + for( int i = 0; i < m_outputPorts.Count; i++ ) + { + connCount += m_outputPorts[ i ].ConnectionCount; + } + + if( connCount > 1 ) + { + string precisionType = UIUtils.PrecisionWirePortToCgType( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, WirePortDataType.FLOAT3 ); + + dataCollector.AddToFragmentLocalVariables( UniqueId, string.Format( ReflectionVecDecStr, precisionType, ReflectionVecValStr + OutputId, result ) ); + RegisterLocalVariable( 0, result, ref dataCollector, ReflectionVecValStr + OutputId ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + } + else + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + result = GeneratorUtils.GenerateWorldReflection( ref dataCollector, UniqueId , m_normalize ); + if( dataCollector.DirtyNormal ) + dataCollector.ForceNormal = true; + } + + return GetOutputVectorItem( 0, outputId, result ); + //RegisterLocalVariable( 0, result, ref dataCollector, "worldrefVec" + OutputId ); + //return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue ); + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 14202 ) + { + m_normalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_normalize ); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( UIUtils.CurrentShaderVersion() <= 14202 ) + { + if( !m_inputPorts[ 0 ].IsConnected ) + { + m_normalize = true; + } + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs.meta new file mode 100644 index 00000000..205f81e9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: bd82e1d90bd90fc4d924e97e5fdcc7de +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs + uploadId: 723576 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures.meta similarity index 67% rename from Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures.meta rename to Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures.meta index 68d6039a..263b4f74 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures.meta +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: d8a5653e008d6c545b047c7dd9b89368 +guid: 3ab7ef71451065148bf8221d353c5020 folderAsset: yes -timeCreated: 1455959813 +timeCreated: 1481126945 licenseType: Store DefaultImporter: userData: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs new file mode 100644 index 00000000..1c5db39c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs @@ -0,0 +1,104 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Blend Normals", "Textures", "Blend Normals" )] + public class BlendNormalsNode : ParentNode + { + public readonly static string[] ModeListStr = { "Tangent Normals", "Reoriented Tangent Normals", "Reoriented World Normals" }; + public readonly static int[] ModeListInt = { 0, 1, 2 }; + + [SerializeField] + public int m_selectedMode = 0; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT3, false, "Normal A" ); + AddInputPort( WirePortDataType.FLOAT3, false, "Normal B" ); + AddInputPort( WirePortDataType.FLOAT3, false, "Vertex Normal" ); + m_inputPorts[ 2 ].Visible = false; + AddOutputPort( WirePortDataType.FLOAT3, "XYZ" ); + m_useInternalPortData = true; + m_previewShaderGUID = "bcdf750ff5f70444f98b8a3efa50dc6f"; + } + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + m_previewMaterialPassId = m_selectedMode; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) + dataCollector.AddToIncludes( UniqueId, Constants.UnityStandardUtilsLibFuncs ); + + string _inputA = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string _inputB = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string result = "BlendNormals( " + _inputA + " , " + _inputB + " )"; + + if( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + switch( m_selectedMode ) + { + default: + case 0: + result = "BlendNormal( " + _inputA + " , " + _inputB + " )"; + break; + case 1: + result = "BlendNormalRNM( " + _inputA + " , " + _inputB + " )"; + break; + case 2: + string inputC = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + result = "BlendNormalWorldspaceRNM( " + _inputA + " , " + _inputB + ", " + inputC + " )"; + break; + } + } + return CreateOutputLocalVariable( 0, result, ref dataCollector ); + } + + public override void DrawProperties() + { + base.DrawProperties(); + if( ContainerGraph.IsSRP ) + { + NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, () => + { + EditorGUI.BeginChangeCheck(); + m_selectedMode = EditorGUILayoutIntPopup( "Mode", m_selectedMode, ModeListStr, ModeListInt ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_selectedMode == 2 ) + { + m_inputPorts[ 2 ].Visible = true; + } + else + { + m_inputPorts[ 2 ].Visible = false; + } + m_sizeIsDirty = true; + } + } ); + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 14503 ) + m_selectedMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedMode ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs.meta new file mode 100644 index 00000000..19671f4f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: eceb6029efe39524d83b45c10a979943 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs new file mode 100644 index 00000000..56216412 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs @@ -0,0 +1,80 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node HeightMap Texture Masking +// Donated by Rea + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "HeightMap Texture Blend", "Textures", "Advanced Texture Blending by using heightMap and splatMask, usefull for texture layering ", null, KeyCode.None, true, false, null, null, "Rea" )] + public sealed class HeightMapBlendNode : ParentNode + { + private const string PreventNaNLabel = "Prevent NaN"; + private const string PreventNaNInfo = "Prevent NaN clamps negative base numbers over the internal pow instruction to 0 since these originate NaN."; + [SerializeField] + private bool m_preventNaN = false; + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "HeightMap" ); + AddInputPort( WirePortDataType.FLOAT, false, "SplatMask" ); + AddInputPort( WirePortDataType.FLOAT, false, "BlendStrength" ); + AddOutputVectorPorts( WirePortDataType.FLOAT, Constants.EmptyPortValue ); + m_textLabelWidth = 120; + m_useInternalPortData = true; + m_inputPorts[ 2 ].FloatInternalData = 1; + m_autoWrapProperties = true; + m_previewShaderGUID = "b2ac23d6d5dcb334982b6f31c2e7a734"; + } + + public override void DrawProperties() + { + base.DrawProperties(); + m_preventNaN = EditorGUILayoutToggle( PreventNaNLabel , m_preventNaN ); + EditorGUILayout.HelpBox( PreventNaNInfo , MessageType.Info ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string HeightMap = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string SplatMask = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector); + string Blend = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + string baseOp = "((" + HeightMap + "*" + SplatMask + ")*4)+(" + SplatMask + "*2)"; + if( m_preventNaN ) + baseOp = "max( (" + baseOp + "), 0 )"; + string HeightMask = "saturate(pow("+baseOp+"," + Blend + "))"; + string varName = "HeightMask" + OutputId; + + RegisterLocalVariable( 0, HeightMask, ref dataCollector , varName ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + /* + A = (heightMap * SplatMask)*4 + B = SplatMask*2 + C = pow(A+B,Blend) + saturate(C) + saturate(pow(((heightMap * SplatMask)*4)+(SplatMask*2),Blend)); + */ + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 18910 ) + m_preventNaN = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo , ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo , ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_preventNaN ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs.meta new file mode 100644 index 00000000..7276f8ed --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b80a218ca12b89948b83d0dee41fc056 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs new file mode 100644 index 00000000..e20c8c05 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs @@ -0,0 +1,110 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Panner", "UV Coordinates", "Pans UV texture coordinates according to its inputs" )] + public sealed class PannerNode : ParentNode + { + private const string _speedXStr = "Speed X"; + private const string _speedYStr = "Speed Y"; + + private int m_cachedUsingEditorId = -1; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT2, false, "UV" ,-1,MasterNodePortCategory.Fragment,0); + AddInputPort( WirePortDataType.FLOAT2, false, "Speed", -1, MasterNodePortCategory.Fragment, 2 ); + AddInputPort( WirePortDataType.FLOAT, false, "Time", -1, MasterNodePortCategory.Fragment, 1 ); + AddOutputPort( WirePortDataType.FLOAT2, "Out" ); + m_textLabelWidth = 70; + m_useInternalPortData = true; + m_previewShaderGUID = "6f89a5d96bdad114b9bbd0c236cac622"; + m_inputPorts[ 2 ].FloatInternalData = 1; + m_continuousPreviewRefresh = true; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if ( m_cachedUsingEditorId == -1 ) + m_cachedUsingEditorId = Shader.PropertyToID( "_UsingEditor" ); + + PreviewMaterial.SetFloat( m_cachedUsingEditorId, ( m_inputPorts[ 2 ].IsConnected ? 0 : 1 ) ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + if( portId == 1 ) + { + m_continuousPreviewRefresh = false; + } + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + if( portId == 1 ) + { + m_continuousPreviewRefresh = true; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string timePort = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + + if( !m_inputPorts[ 2 ].IsConnected ) + { + if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) + dataCollector.AddToIncludes( UniqueId, Constants.UnityShaderVariables ); + timePort += " * _Time.y"; + } + + string speed = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string result = "( " + timePort + " * " + speed + " + " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + ")"; + + RegisterLocalVariable( 0, result, ref dataCollector, "panner" + OutputId ); + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() < 13107 ) + { + // The internal data for the new port can be set in here since it didn't existed + // on older shader versions + float speedX = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + float speedY = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); + m_inputPorts[ 1 ].Vector2InternalData = new Vector2( speedX, speedY ); + } + } + + public override void ReadInputDataFromString( ref string[] nodeParams ) + { + base.ReadInputDataFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() < 13107 ) + { + //Time Port must be rewritten after internal data is read + // already existed in previous shaders + m_inputPorts[ 2 ].FloatInternalData = 1; + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs.meta new file mode 100644 index 00000000..e10d4392 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 08ddf1dd61719944b9e50d4bc87c0413 +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs new file mode 100644 index 00000000..18aa7781 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs @@ -0,0 +1,96 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Rotator", "UV Coordinates", "Rotates UVs or any Vector2 value from an Anchor point for a specified Time value")] + public sealed class RotatorNode : ParentNode + { + private int m_cachedUsingEditorId = -1; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); + AddInputPort( WirePortDataType.FLOAT2, false, "Anchor" ); + AddInputPort( WirePortDataType.FLOAT, false, "Time" ); + AddOutputPort( WirePortDataType.FLOAT2, "Out" ); + m_useInternalPortData = true; + m_inputPorts[ 2 ].FloatInternalData = 1; + m_textLabelWidth = 50; + m_previewShaderGUID = "e21408a1c7f12f14bbc2652f69bce1fc"; + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if ( m_cachedUsingEditorId == -1 ) + m_cachedUsingEditorId = Shader.PropertyToID( "_UsingEditor" ); + + PreviewMaterial.SetFloat( m_cachedUsingEditorId, (m_inputPorts[ 2 ].IsConnected ? 0 : 1 ) ); + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + if( portId == 2 ) + { + m_continuousPreviewRefresh = false; + } + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + if( portId == 2 ) + { + m_continuousPreviewRefresh = true; + } + } + + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + string result = string.Empty; + string uv = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string anchor = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + string time = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + if ( !m_inputPorts[ 2 ].IsConnected ) + { + if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) + dataCollector.AddToIncludes( UniqueId, Constants.UnityShaderVariables ); + time += " * _Time.y"; + } + + result += uv; + + string cosVar = "cos" + OutputId; + string sinVar = "sin" + OutputId; + dataCollector.AddLocalVariable( UniqueId, "float " + cosVar + " = cos( "+time+" );"); + dataCollector.AddLocalVariable( UniqueId, "float " + sinVar + " = sin( "+time+" );"); + + string value = "mul( " + result + " - " + anchor + " , float2x2( "+cosVar+" , -"+sinVar+" , "+sinVar+" , "+cosVar+" )) + "+anchor; + RegisterLocalVariable( 0, value, ref dataCollector, "rotator" + OutputId ); + + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( UIUtils.CurrentShaderVersion() < 13107 ) + { + m_inputPorts[ 2 ].FloatInternalData = 1; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs.meta new file mode 100644 index 00000000..71d770de --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e228d03a789934a4f90f9587396692e3 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs new file mode 100644 index 00000000..3ad3fceb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs @@ -0,0 +1,2306 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + // Disabling Substance Deprecated warning + + public enum TexReferenceType + { + Object = 0, + Instance + } + + public enum MipType + { + Auto, + MipLevel, + MipBias, + Derivative + } + + public enum ReferenceState + { + Self, + Connected, + Instance + } + + [Serializable] + [NodeAttributes( "Texture Sample", "Textures", "Samples a chosen texture and returns its color values, Texture and UVs can be overriden and you can select different mip modes and levels. It can also unpack and scale textures marked as normalmaps.", KeyCode.T, true, 0, int.MaxValue, typeof( Texture ), typeof( Texture2D ), typeof( Texture3D ), typeof( Cubemap ), typeof( CustomRenderTexture ), Tags = "Array" )] + public sealed class SamplerNode : TexturePropertyNode + { + private const string MipModeStr = "Mip Mode"; + + private const string DefaultTextureUseSematicsStr = "Use Semantics"; + private const string DefaultTextureIsNormalMapsStr = "Is Normal Map"; + + private const string NormalScaleStr = "Scale"; + + private float InstanceIconWidth = 19; + private float InstanceIconHeight = 19; + + private readonly Color ReferenceHeaderColor = new Color( 2.66f, 1.02f, 0.6f, 1.0f ); + + public readonly static int[] AvailableAutoCast = { 0, 1, 2, 3, 4 }; + public readonly static string[] AvailableAutoCastStr = { "Auto", "Locked To Texture 1D", "Locked To Texture 2D", "Locked To Texture 3D", "Locked To Cube" }; + + [SerializeField] + private int m_textureCoordSet = 0; + + [SerializeField] + private bool m_autoUnpackNormals = false; + + [SerializeField] + private bool m_useSemantics; + + [SerializeField] + private string m_samplerType; + + [SerializeField] + private MipType m_mipMode = MipType.Auto; + + [SerializeField] + private TexReferenceType m_referenceType = TexReferenceType.Object; + + [SerializeField] + private int m_referenceArrayId = -1; + + [SerializeField] + private int m_referenceNodeId = -1; + + private SamplerNode m_referenceSampler = null; + + [SerializeField] + private GUIStyle m_referenceStyle = null; + + [SerializeField] + private GUIStyle m_referenceIconStyle = null; + + [SerializeField] + private GUIContent m_referenceContent = null; + + [SerializeField] + private float m_referenceWidth = -1; + + [SerializeField] + private SamplerStateAutoGenerator m_samplerStateAutoGenerator = new SamplerStateAutoGenerator(); + + private Vector4Node m_texCoordsHelper; + + private string m_previousAdditionalText = string.Empty; + + private int m_cachedUvsId = -1; + private int m_cachedUnpackId = -1; + private int m_cachedLodId = -1; + + private InputPort m_texPort; + private InputPort m_uvPort; + private InputPort m_lodPort; + private InputPort m_ddxPort; + private InputPort m_ddyPort; + private InputPort m_normalPort; + private InputPort m_samplerPort; + private InputPort m_indexPort; + private OutputPort m_colorPort; + + private TexturePropertyNode m_previewTextProp = null; + private ReferenceState m_state = ReferenceState.Self; + + private Rect m_iconPos; + + public SamplerNode() : base() { } + public SamplerNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + if( m_useSamplerArrayIdx < 0 ) + { + m_useSamplerArrayIdx = 0; + } + + m_defaultTextureValue = TexturePropertyValues.white; + AddInputPort( WirePortDataType.SAMPLER2D, false, "Tex" ); + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.SAMPLER2DARRAY, WirePortDataType.OBJECT ); + AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); + AddInputPort( WirePortDataType.FLOAT, false, "Level" ); + AddInputPort( WirePortDataType.FLOAT2, false, "DDX" ); + AddInputPort( WirePortDataType.FLOAT2, false, "DDY" ); + AddInputPort( WirePortDataType.FLOAT, false, NormalScaleStr ); + AddInputPort( WirePortDataType.FLOAT, false, "Index" ); + AddInputPort( WirePortDataType.SAMPLERSTATE, false, "SS" ); + m_inputPorts[ 7 ].CreatePortRestrictions( WirePortDataType.SAMPLERSTATE ); + + m_texPort = m_inputPorts[ 0 ]; + m_uvPort = m_inputPorts[ 1 ]; + m_lodPort = m_inputPorts[ 2 ]; + m_ddxPort = m_inputPorts[ 3 ]; + m_ddyPort = m_inputPorts[ 4 ]; + m_normalPort = m_inputPorts[ 5 ]; + m_indexPort = m_inputPorts[ 6 ]; + m_samplerPort = m_inputPorts[ 7 ]; + m_lodPort.AutoDrawInternalData = true; + m_indexPort.AutoDrawInternalData = true; + m_normalPort.AutoDrawInternalData = true; + m_lodPort.Visible = false; + m_ddxPort.Visible = false; + m_ddyPort.Visible = false; + m_indexPort.Visible = false; + m_normalPort.Visible = m_autoUnpackNormals; + m_normalPort.FloatInternalData = 1.0f; + + //Remove output port (sampler) + m_outputPortsDict.Remove( m_outputPorts[ 1 ].PortId ); + m_outputPorts.RemoveAt( 1 ); + + m_outputPortsDict.Remove( m_outputPorts[ 0 ].PortId ); + m_outputPorts.RemoveAt( 0 ); + + AddOutputColorPorts( "RGBA", addRGB: true ); + m_sortOutputPorts = true; + + m_colorPort = m_outputPorts[ 0 ]; + m_currentParameterType = PropertyType.Property; + // m_useCustomPrefix = true; + m_customPrefix = "Texture Sample "; + m_referenceContent = new GUIContent( string.Empty ); + m_freeType = false; + m_useSemantics = true; + m_drawPicker = false; + ConfigTextureData( TextureType.Texture2D ); + m_selectedLocation = PreviewLocation.TopCenter; + m_previewShaderGUID = "7b4e86a89b70ae64993bf422eb406422"; + + m_errorMessageTooltip = "A texture object marked as normal map is connected to this sampler. Please consider turning on the Unpack Normal Map option"; + m_errorMessageTypeIsError = NodeMessageType.Warning; + m_textLabelWidth = 135; + m_customPrecision = false; + } + + public override void SetPreviewInputs() + { + //TODO: rewrite this to be faster + base.SetPreviewInputs(); + + if( m_cachedUvsId == -1 ) + m_cachedUvsId = Shader.PropertyToID( "_CustomUVs" ); + + PreviewMaterial.SetInt( m_cachedUvsId, ( m_uvPort.IsConnected ? 1 : 0 ) ); + + if( m_cachedUnpackId == -1 ) + m_cachedUnpackId = Shader.PropertyToID( "_Unpack" ); + + PreviewMaterial.SetInt( m_cachedUnpackId, m_autoUnpackNormals ? 1 : 0 ); + + if( m_cachedLodId == -1 ) + m_cachedLodId = Shader.PropertyToID( "_LodType" ); + + PreviewMaterial.SetInt( m_cachedLodId, ( m_mipMode == MipType.MipLevel ? 1 : ( m_mipMode == MipType.MipBias ? 2 : 0 ) ) ); + + if( m_typeId == -1 ) + m_typeId = Shader.PropertyToID( "_Type" ); + + bool usingTexture = false; + if( m_texPort.IsConnected ) + { + usingTexture = true; + SetPreviewTexture( m_texPort.InputPreviewTexture( ContainerGraph ) ); + } + else if( SoftValidReference && m_referenceSampler.TextureProperty != null ) + { + if( m_referenceSampler.TextureProperty.Value != null ) + { + usingTexture = true; + SetPreviewTexture( m_referenceSampler.TextureProperty.Value ); + } + else + { + usingTexture = true; + SetPreviewTexture( m_referenceSampler.PreviewTexture ); + } + } + else if( TextureProperty != null ) + { + if( TextureProperty.Value != null ) + { + usingTexture = true; + SetPreviewTexture( TextureProperty.Value ); + } + } + + if( m_defaultId == -1 ) + m_defaultId = Shader.PropertyToID( "_Default" ); + + if( usingTexture ) + { + PreviewMaterial.SetInt( m_defaultId, 0 ); + m_previewMaterialPassId = 1; + } + else + { + PreviewMaterial.SetInt( m_defaultId, ( (int)m_defaultTextureValue ) + 1 ); + m_previewMaterialPassId = 0; + } + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + if( m_referenceType == TexReferenceType.Object ) + { + UIUtils.RegisterSamplerNode( this ); + UIUtils.RegisterPropertyNode( this ); + } + m_textureProperty = this; + + if( UniqueId > -1 ) + ContainerGraph.SamplerNodes.OnReorderEventComplete += OnReorderEventComplete; + } + + private void OnReorderEventComplete() + { + if( m_referenceType == TexReferenceType.Instance && m_referenceSampler != null ) + { + m_referenceArrayId = ContainerGraph.SamplerNodes.GetNodeRegisterIdx( m_referenceSampler.UniqueId ); + } + } + + public void ConfigSampler() + { + switch( m_currentType ) + { + case TextureType.Texture1D: + m_samplerType = "tex1D"; + break; + case TextureType.ProceduralTexture: + case TextureType.Texture2D: + m_samplerType = "tex2D"; + break; + case TextureType.Texture2DArray: + m_samplerType = "tex2DArray"; + break; + case TextureType.Texture3D: + m_samplerType = "tex3D"; + break; + case TextureType.Cube: + m_samplerType = "texCUBE"; + break; + } + } + + public override void DrawSubProperties() + { + ShowDefaults(); + + DrawSamplerOptions(); + + EditorGUI.BeginChangeCheck(); + Type currType = ( m_autocastMode == AutoCastType.Auto ) ? typeof( Texture ) : m_textureType; + m_defaultValue = EditorGUILayoutObjectField( Constants.DefaultValueLabel, m_defaultValue, currType, false ) as Texture; + if( EditorGUI.EndChangeCheck() ) + { + CheckTextureImporter( true ); + SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); + ConfigureInputPorts(); + ConfigureOutputPorts(); + //ResizeNodeToPreview(); + } + } + + public override void DrawMaterialProperties() + { + ShowDefaults(); + + DrawSamplerOptions(); + + EditorGUI.BeginChangeCheck(); + Type currType = ( m_autocastMode == AutoCastType.Auto ) ? typeof( Texture ) : m_textureType; + m_materialValue = EditorGUILayoutObjectField( Constants.MaterialValueLabel, m_materialValue, currType, false ) as Texture; + if( EditorGUI.EndChangeCheck() ) + { + CheckTextureImporter( true ); + SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); + ConfigureInputPorts(); + ConfigureOutputPorts(); + } + } + + new void ShowDefaults() + { + m_defaultTextureValue = (TexturePropertyValues)EditorGUILayoutEnumPopup( DefaultTextureStr, m_defaultTextureValue ); + //AutoCastType newAutoCast = (AutoCastType)EditorGUILayoutIntPopup( AutoCastModeStr, (int)m_autocastMode, AvailableAutoCastStr, AvailableAutoCast ); + AutoCastType newAutoCast = (AutoCastType)EditorGUILayoutEnumPopup( AutoCastModeStr, m_autocastMode ); + if( newAutoCast != m_autocastMode ) + { + m_autocastMode = newAutoCast; + if( m_autocastMode != AutoCastType.Auto ) + { + ConfigTextureData( m_currentType ); + ConfigureInputPorts(); + ConfigureOutputPorts(); + } + } + } + + public override void AdditionalCheck() + { + m_autoUnpackNormals = m_isNormalMap; + ConfigureInputPorts(); + ConfigureOutputPorts(); + } + + + public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); + if( portId == m_texPort.PortId ) + { + m_texPort.MatchPortToConnection(); + m_textureProperty = m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode; + if( m_textureProperty != null ) + { + m_currentType = m_textureProperty.CurrentType; + ConfigureInputPorts(); + ConfigureOutputPorts(); + } + else + { + m_currentType = Constants.WireToTexture[ type ]; + ConfigureInputPorts(); + ConfigureOutputPorts(); + } + } + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + + if( portId == m_texPort.PortId ) + { + m_texPort.MatchPortToConnection(); + m_textureProperty = m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode; + if( m_textureProperty == null ) + { + if( Constants.WireToTexture.TryGetValue( m_texPort.ConnectionType() , out m_currentType ) ) + { + //m_currentType = Constants.WireToTexture[ m_texPort.ConnectionType() ]; + m_textureProperty = this; + // This cast fails only from within shader functions if connected to a Sampler Input + // and in this case property is set by what is connected to that input + UIUtils.UnregisterPropertyNode( this ); + UIUtils.UnregisterTexturePropertyNode( this ); + } + } + else + { + m_currentType = m_textureProperty.CurrentType; + + UIUtils.UnregisterPropertyNode( this ); + UIUtils.UnregisterTexturePropertyNode( this ); + } + + ConfigureInputPorts(); + ConfigureOutputPorts(); + //ResizeNodeToPreview(); + } + + UpdateTitle(); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + + if( portId == m_texPort.PortId ) + { + m_textureProperty = this; + + if( m_referenceType == TexReferenceType.Object ) + { + UIUtils.RegisterPropertyNode( this ); + UIUtils.RegisterTexturePropertyNode( this ); + } + + ConfigureOutputPorts(); + //ResizeNodeToPreview(); + } + + UpdateTitle(); + } + + private void ForceInputPortsChange() + { + m_texPort.ChangeType( Constants.TextureToWire[ m_currentType ], false ); + m_normalPort.ChangeType( WirePortDataType.FLOAT, false ); + switch( m_currentType ) + { + case TextureType.Texture1D: + m_uvPort.ChangeType( WirePortDataType.FLOAT, false ); + m_ddxPort.ChangeType( WirePortDataType.FLOAT, false ); + m_ddyPort.ChangeType( WirePortDataType.FLOAT, false ); + break; + case TextureType.ProceduralTexture: + case TextureType.Texture2D: + case TextureType.Texture2DArray: + m_uvPort.ChangeType( WirePortDataType.FLOAT2, false ); + m_ddxPort.ChangeType( WirePortDataType.FLOAT2, false ); + m_ddyPort.ChangeType( WirePortDataType.FLOAT2, false ); + break; + case TextureType.Texture3D: + case TextureType.Cube: + m_uvPort.ChangeType( WirePortDataType.FLOAT3, false ); + m_ddxPort.ChangeType( WirePortDataType.FLOAT3, false ); + m_ddyPort.ChangeType( WirePortDataType.FLOAT3, false ); + break; + } + } + + public override void ConfigureInputPorts() + { + m_normalPort.Visible = AutoUnpackNormals; + + switch( m_mipMode ) + { + case MipType.Auto: + m_lodPort.Visible = false; + m_ddxPort.Visible = false; + m_ddyPort.Visible = false; + break; + case MipType.MipLevel: + m_lodPort.Name = "Level"; + m_lodPort.Visible = true; + m_ddxPort.Visible = false; + m_ddyPort.Visible = false; + break; + case MipType.MipBias: + m_lodPort.Name = "Bias"; + m_lodPort.Visible = true; + m_ddxPort.Visible = false; + m_ddyPort.Visible = false; + break; + case MipType.Derivative: + m_lodPort.Visible = false; + m_ddxPort.Visible = true; + m_ddyPort.Visible = true; + break; + } + + switch( m_currentType ) + { + case TextureType.Texture1D: + m_uvPort.ChangeType( WirePortDataType.FLOAT, false ); + m_ddxPort.ChangeType( WirePortDataType.FLOAT, false ); + m_ddyPort.ChangeType( WirePortDataType.FLOAT, false ); + break; + case TextureType.ProceduralTexture: + case TextureType.Texture2D: + case TextureType.Texture2DArray: + m_uvPort.ChangeType( WirePortDataType.FLOAT2, false ); + m_ddxPort.ChangeType( WirePortDataType.FLOAT2, false ); + m_ddyPort.ChangeType( WirePortDataType.FLOAT2, false ); + break; + case TextureType.Texture3D: + case TextureType.Cube: + m_uvPort.ChangeType( WirePortDataType.FLOAT3, false ); + m_ddxPort.ChangeType( WirePortDataType.FLOAT3, false ); + m_ddyPort.ChangeType( WirePortDataType.FLOAT3, false ); + break; + } + + if( m_currentType == TextureType.Texture2DArray ) + m_indexPort.Visible = true; + else + m_indexPort.Visible = false; + + m_sizeIsDirty = true; + } + + public override void ConfigureOutputPorts() + { + m_outputPorts[ m_colorPort.PortId + 4 ].Visible = !AutoUnpackNormals; + m_outputPorts[ m_colorPort.PortId + 5 ].Visible = !AutoUnpackNormals; + + if( !AutoUnpackNormals ) + { + m_colorPort.ChangeProperties( "RGBA", WirePortDataType.COLOR, false ); + m_outputPorts[ m_colorPort.PortId + 1 ].ChangeProperties( "R", WirePortDataType.FLOAT, false ); + m_outputPorts[ m_colorPort.PortId + 2 ].ChangeProperties( "G", WirePortDataType.FLOAT, false ); + m_outputPorts[ m_colorPort.PortId + 3 ].ChangeProperties( "B", WirePortDataType.FLOAT, false ); + m_outputPorts[ m_colorPort.PortId + 4 ].ChangeProperties( "A", WirePortDataType.FLOAT, false ); + + } + else + { + m_colorPort.ChangeProperties( "XYZ", WirePortDataType.FLOAT3, false ); + m_outputPorts[ m_colorPort.PortId + 1 ].ChangeProperties( "X", WirePortDataType.FLOAT, false ); + m_outputPorts[ m_colorPort.PortId + 2 ].ChangeProperties( "Y", WirePortDataType.FLOAT, false ); + m_outputPorts[ m_colorPort.PortId + 3 ].ChangeProperties( "Z", WirePortDataType.FLOAT, false ); + } + + m_sizeIsDirty = true; + } + + void UpdateTitle() + { + if( m_referenceType == TexReferenceType.Object ) + { + SetTitleText( m_propertyInspectorName ); + SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); + } + + m_sizeIsDirty = true; + } + + public override void OnObjectDropped( UnityEngine.Object obj ) + { + base.OnObjectDropped( obj ); + ConfigFromObject( obj ); + } + + public override void SetupFromCastObject( UnityEngine.Object obj ) + { + base.SetupFromCastObject( obj ); + ConfigFromObject( obj ); + } + + void UpdateHeaderColor() + { + m_headerColorModifier = ( m_referenceType == TexReferenceType.Object ) ? Color.white : ReferenceHeaderColor; + } + + void ShowSamplerUI() + { + EditorGUI.BeginDisabledGroup( m_samplerPort.IsConnected ); + string[] contents = UIUtils.TexturePropertyNodeArr(); + string[] arr = new string[ contents.Length + 1 ]; + arr[ 0 ] = ""; + for( int i = 1; i < contents.Length + 1; i++ ) + { + arr[ i ] = contents[ i - 1 ]; + } + m_useSamplerArrayIdx = EditorGUILayoutPopup( "Reference Sampler", m_useSamplerArrayIdx, arr ); + EditorGUI.EndDisabledGroup(); + } + + public void DrawSamplerOptions() + { + if( !m_indexPort.IsConnected ) + { + m_indexPort.FloatInternalData = EditorGUILayoutFloatField( "Index", m_indexPort.FloatInternalData ); + } + + m_textureCoordSet = EditorGUILayoutIntPopup( Constants.AvailableUVSetsLabel, m_textureCoordSet, Constants.AvailableUVSetsStr, Constants.AvailableUVSets ); + + MipType newMipMode = (MipType)EditorGUILayoutEnumPopup( MipModeStr, m_mipMode ); + if( newMipMode != m_mipMode ) + { + m_mipMode = newMipMode; + ConfigureInputPorts(); + ConfigureOutputPorts(); + //ResizeNodeToPreview(); + } + + if( !m_lodPort.IsConnected && m_lodPort.Visible ) + { + m_lodPort.FloatInternalData = EditorGUILayoutFloatField( newMipMode == MipType.MipBias ? "Mip Bias" : "Mip Level", m_lodPort.FloatInternalData ); + } + + if( m_currentType == TextureType.Texture2DArray && ( newMipMode == MipType.Derivative || newMipMode == MipType.MipBias ) && !UIUtils.CurrentWindow.OutsideGraph.IsSRP ) + { + EditorGUILayout.HelpBox( "Derivative and Bias mip modes for Texture Arrays only works on some platforms (D3D11 XBOXONE GLES3 GLCORE)", MessageType.Warning ); + } + + EditorGUI.BeginChangeCheck(); + m_autoUnpackNormals = EditorGUILayoutToggle( "Unpack Normal Map", m_autoUnpackNormals ); + if( m_autoUnpackNormals && !m_normalPort.IsConnected ) + { + m_normalPort.FloatInternalData = EditorGUILayoutFloatField( NormalScaleStr, m_normalPort.FloatInternalData ); + } + + if( EditorGUI.EndChangeCheck() ) + { + ConfigureInputPorts(); + ConfigureOutputPorts(); + //ResizeNodeToPreview(); + } + ShowSamplerUI(); + if( m_showErrorMessage ) + { + EditorGUILayout.HelpBox( m_errorMessageTooltip, MessageType.Warning ); + } + } + + public override void DrawMainPropertyBlock() + { + EditorGUI.BeginChangeCheck(); + m_referenceType = (TexReferenceType)EditorGUILayoutPopup( Constants.ReferenceTypeStr, (int)m_referenceType, Constants.ReferenceArrayLabels ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_referenceType == TexReferenceType.Object ) + { + UIUtils.RegisterSamplerNode( this ); + UIUtils.RegisterPropertyNode( this ); + if( !m_texPort.IsConnected ) + UIUtils.RegisterTexturePropertyNode( this ); + + SetTitleText( m_propertyInspectorName ); + SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); + m_referenceArrayId = -1; + m_referenceNodeId = -1; + m_referenceSampler = null; + m_textureProperty = m_texPort.IsConnected ? m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode : this; + + } + else + { + UIUtils.UnregisterSamplerNode( this ); + UIUtils.UnregisterPropertyNode( this ); + if( !m_texPort.IsConnected ) + UIUtils.UnregisterTexturePropertyNode( this ); + } + UpdateHeaderColor(); + } + + if( m_referenceType == TexReferenceType.Object ) + { + EditorGUI.BeginChangeCheck(); + if( m_texPort.IsConnected ) + { + m_drawAttributes = false; + DrawSamplerOptions(); + } + else + { + m_drawAttributes = true; + base.DrawMainPropertyBlock(); + } + if( EditorGUI.EndChangeCheck() ) + { + OnPropertyNameChanged(); + } + } + else + { + m_drawAttributes = true; + string[] arr = UIUtils.SamplerNodeArr(); + bool guiEnabledBuffer = GUI.enabled; + if( arr != null && arr.Length > 0 ) + { + GUI.enabled = true; + } + else + { + m_referenceArrayId = -1; + GUI.enabled = false; + } + + EditorGUI.BeginChangeCheck(); + m_referenceArrayId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceArrayId, arr ); + if( EditorGUI.EndChangeCheck() ) + { + m_referenceSampler = ContainerGraph.SamplerNodes.GetNode( m_referenceArrayId ); + if( m_referenceSampler != null ) + { + m_referenceNodeId = m_referenceSampler.UniqueId; + } + else + { + m_referenceArrayId = -1; + m_referenceNodeId = -1; + } + } + GUI.enabled = guiEnabledBuffer; + + DrawSamplerOptions(); + } + } + + public override void OnPropertyNameChanged() + { + base.OnPropertyNameChanged(); + UIUtils.UpdateSamplerDataNode( UniqueId, PropertyName ); + UIUtils.UpdateTexturePropertyDataNode( UniqueId, PropertyName ); + } + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if( m_state != ReferenceState.Self && drawInfo.CurrentEventType == EventType.MouseDown && m_previewRect.Contains( drawInfo.MousePosition ) && drawInfo.LeftMouseButtonPressed ) + { + UIUtils.FocusOnNode( m_previewTextProp, 1, true ); + Event.current.Use(); + } + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + CheckReference(); + + if( SoftValidReference ) + { + m_state = ReferenceState.Instance; + m_previewTextProp = m_referenceSampler.TextureProperty; + } + else if( m_texPort.IsConnected ) + { + m_state = ReferenceState.Connected; + m_previewTextProp = TextureProperty; + } + else + { + m_state = ReferenceState.Self; + } + + if( m_previewTextProp == null ) + m_previewTextProp = this; + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + + if( m_drawPreview ) + { + m_iconPos = m_globalPosition; + m_iconPos.width = InstanceIconWidth * drawInfo.InvertedZoom; + m_iconPos.height = InstanceIconHeight * drawInfo.InvertedZoom; + + m_iconPos.y += 10 * drawInfo.InvertedZoom; + m_iconPos.x += m_globalPosition.width - m_iconPos.width - 5 * drawInfo.InvertedZoom; + } + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + base.OnNodeRepaint( drawInfo ); + + if( !m_isVisible ) + return; + + if( drawInfo.CurrentEventType != EventType.Repaint ) + return; + + switch( m_state ) + { + default: + case ReferenceState.Self: + { + m_drawPreview = false; + //SetTitleText( PropertyInspectorName /*m_propertyInspectorName*/ ); + //small optimization, string format or concat on every frame generates garbage + //string tempVal = GetPropertyValStr(); + //if ( !m_previousAdditionalText.Equals( tempVal ) ) + //{ + // m_previousAdditionalText = tempVal; + // m_additionalContent.text = string.Concat( "Value( ", tempVal, " )" ); + //} + + m_drawPicker = true; + } + break; + case ReferenceState.Connected: + { + m_drawPreview = true; + m_drawPicker = false; + + SetTitleText( m_previewTextProp.PropertyInspectorName + " (Input)" ); + m_previousAdditionalText = m_previewTextProp.AdditonalTitleContent.text; + SetAdditonalTitleText( m_previousAdditionalText ); + // Draw chain lock + GUI.Label( m_iconPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ) ); + + // Draw frame around preview + GUI.Label( m_previewRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); + } + break; + case ReferenceState.Instance: + { + m_drawPreview = true; + m_drawPicker = false; + + //SetTitleText( m_previewTextProp.PropertyInspectorName + Constants.InstancePostfixStr ); + //m_previousAdditionalText = m_previewTextProp.AdditonalTitleContent.text; + //SetAdditonalTitleText( m_previousAdditionalText ); + + SetTitleTextOnCallback( m_previewTextProp.PropertyInspectorName, ( instance, newTitle ) => instance.TitleContent.text = newTitle + Constants.InstancePostfixStr ); + if( m_previewTextProp.AdditonalTitleContent.text != m_additionalContent.text ) + { + PreviewIsDirty = true; + } + SetAdditonalTitleText( m_previewTextProp.AdditonalTitleContent.text ); + + // Draw chain lock + GUI.Label( m_iconPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ) ); + + // Draw frame around preview + GUI.Label( m_previewRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); + } + break; + } + } + + void CheckReference() + { + if( m_referenceType != TexReferenceType.Instance ) + { + return; + } + + if( m_referenceArrayId > -1 ) + { + ParentNode newNode = ContainerGraph.SamplerNodes.GetNode( m_referenceArrayId ); + if( newNode == null || newNode.UniqueId != m_referenceNodeId ) + { + m_referenceSampler = null; + int count = ContainerGraph.SamplerNodes.NodesList.Count; + for( int i = 0; i < count; i++ ) + { + ParentNode node = ContainerGraph.SamplerNodes.GetNode( i ); + if( node.UniqueId == m_referenceNodeId ) + { + m_referenceSampler = node as SamplerNode; + m_referenceArrayId = i; + break; + } + } + } + else + { + m_texPort.DataType = m_referenceSampler.TexPort.DataType; + // Set current type + TextureType newTextureType = m_referenceSampler.CurrentType; + + // Set References Options + AutoCastType newAutoCast = m_referenceSampler.AutocastMode; + if( newAutoCast != m_autocastMode || newTextureType != m_currentType ) + { + m_currentType = newTextureType; + m_autocastMode = newAutoCast; + //if( m_autocastMode != AutoCastType.Auto ) + { + ConfigTextureData( m_currentType ); + ConfigureInputPorts(); + ConfigureOutputPorts(); + //ResizeNodeToPreview(); + } + } + } + } + + if( m_referenceSampler == null && m_referenceNodeId > -1 ) + { + m_referenceNodeId = -1; + m_referenceArrayId = -1; + } + } + + public void SetTitleTextDelay( string newText ) + { + if( !newText.Equals( m_content.text ) ) + { + m_content.text = newText; + BeginDelayedDirtyProperty(); + } + } + + public void SetAdditonalTitleTextDelay( string newText ) + { + if( !newText.Equals( m_additionalContent.text ) ) + { + m_additionalContent.text = newText; + BeginDelayedDirtyProperty(); + } + } + + private void DrawTexturePropertyPreview( DrawInfo drawInfo, bool instance ) + { + if( drawInfo.CurrentEventType != EventType.Repaint ) + return; + + Rect newPos = m_previewRect; + + TexturePropertyNode texProp = null; + if( instance ) + texProp = m_referenceSampler.TextureProperty; + else + texProp = TextureProperty; + + if( texProp == null ) + texProp = this; + + float previewSizeX = PreviewSizeX; + float previewSizeY = PreviewSizeY; + newPos.width = previewSizeX * drawInfo.InvertedZoom; + newPos.height = previewSizeY * drawInfo.InvertedZoom; + + SetTitleText( texProp.PropertyInspectorName + ( instance ? Constants.InstancePostfixStr : " (Input)" ) ); + SetAdditonalTitleText( texProp.AdditonalTitleContent.text ); + + if( m_referenceStyle == null ) + { + m_referenceStyle = UIUtils.GetCustomStyle( CustomStyle.SamplerTextureRef ); + } + + if( m_referenceIconStyle == null || m_referenceIconStyle.normal == null ) + { + m_referenceIconStyle = UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ); + if( m_referenceIconStyle != null && m_referenceIconStyle.normal != null && m_referenceIconStyle.normal.background != null ) + { + InstanceIconWidth = m_referenceIconStyle.normal.background.width; + InstanceIconHeight = m_referenceIconStyle.normal.background.height; + } + } + + Rect iconPos = m_globalPosition; + iconPos.width = InstanceIconWidth * drawInfo.InvertedZoom; + iconPos.height = InstanceIconHeight * drawInfo.InvertedZoom; + + iconPos.y += 10 * drawInfo.InvertedZoom; + iconPos.x += m_globalPosition.width - iconPos.width - 5 * drawInfo.InvertedZoom; + + //if ( GUI.Button( newPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerTextureRef )/* m_referenceStyle */) || + // GUI.Button( iconPos, string.Empty, m_referenceIconStyle ) + // ) + //{ + // UIUtils.FocusOnNode( texProp, 1, true ); + //} + + if( texProp.Value != null ) + { + DrawPreview( drawInfo, m_previewRect ); + GUI.Label( newPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); + //UIUtils.GetCustomStyle( CustomStyle.SamplerButton ).fontSize = ( int )Mathf.Round( 9 * drawInfo.InvertedZoom ); + } + } + + public override string GenerateSamplerPropertyName( int outputId, ref MasterNodeDataCollector dataCollector ) + { + string generatedSamplerState = PropertyName; + if( m_forceSamplingMacrosGen ) + { + generatedSamplerState = GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, PropertyName, m_variableMode ); + } + + if( outputId > 0 ) + return generatedSamplerState; + else + return PropertyName; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " cannot be used on Master Node Tessellation port" ); + return "(-1)"; + } + + OnPropertyNameChanged(); + + ConfigSampler(); + + string portProperty = string.Empty; + if( m_texPort.IsConnected ) + portProperty = m_texPort.GenerateShaderForOutput( ref dataCollector, true ); + + if( SoftValidReference ) + { + OrderIndex = m_referenceSampler.RawOrderIndex; + if( m_referenceSampler.TexPort.IsConnected ) + { + portProperty = m_referenceSampler.TexPort.GeneratePortInstructions( ref dataCollector ); + } + else + { + m_referenceSampler.RegisterProperty( ref dataCollector ); + } + } + + if( IsObject && ( !m_texPort.IsConnected || portProperty == "0.0" ) ) + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); + + string valueName = SetFetchedData( ref dataCollector, ignoreLocalVar, outputId, portProperty ); + if( TextureProperty is VirtualTextureObject ) + { + return valueName; + } + else + { + + return GetOutputColorItem( 0, outputId, valueName ); + } + } + + public string SampleVirtualTexture( VirtualTextureObject node, string coord ) + { + string sampler = string.Empty; + switch( node.Channel ) + { + default: + case VirtualChannel.Albedo: + case VirtualChannel.Base: + sampler = "VTSampleAlbedo( " + coord + " )"; + break; + case VirtualChannel.Normal: + case VirtualChannel.Height: + case VirtualChannel.Occlusion: + case VirtualChannel.Displacement: + sampler = "VTSampleNormal( " + coord + " )"; + break; + case VirtualChannel.Specular: + case VirtualChannel.SpecMet: + case VirtualChannel.Material: + sampler = "VTSampleSpecular( " + coord + " )"; + break; + } + return sampler; + } + + public string SampleTexture( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar, string portProperty, MipType currMipMode, string propertyName , VariableMode varMode ) + { + string samplerValue = string.Empty; + string uvCoords = GetUVCoords( ref dataCollector, ignoreLocalVar, portProperty ); + + bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ); + + bool useMacros = false; + + ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; + if( outsideGraph.SamplingMacros || m_currentType == TextureType.Texture2DArray ) + { + useMacros = Constants.TexSampleSRPMacros.ContainsKey( m_currentType ); + } + + if( useMacros || m_currentType == TextureType.Texture2DArray ) + { + string suffix = string.Empty; + switch( currMipMode ) + { + default: + case MipType.Auto: break; + case MipType.MipLevel: suffix = "_LOD"; break; + case MipType.MipBias: suffix = "_BIAS"; break; + case MipType.Derivative: suffix = "_GRAD"; break; + } + + if( isVertex ) + suffix = "_LOD"; + + string samplerToUse = string.Empty; + + if( !m_samplerPort.IsConnected && m_useSamplerArrayIdx > 0 ) + { + TexturePropertyNode samplerNode = UIUtils.GetTexturePropertyNode( m_useSamplerArrayIdx - 1 ); + if( samplerNode != null ) + { + if( samplerNode.IsConnected ) + { + string property = samplerNode.CurrentPropertyReference; + samplerToUse = GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, property, varMode ); + } + else + { + UIUtils.ShowMessage( UniqueId, string.Format( "{0} attempting to use sampler from unconnected {1} node. Reference Sampler nodes must be in use for their samplers to be created.", m_propertyName, samplerNode.PropertyName ), MessageSeverity.Warning ); + dataCollector.AddToUniforms( UniqueId, string.Format( Constants.SamplerDeclarationSRPMacros[ m_currentType ], propertyName ) ); + samplerToUse = propertyName; + } + } + else + { + UIUtils.ShowMessage( UniqueId, m_propertyName + " attempting to use sampler from invalid node.", MessageSeverity.Warning ); + dataCollector.AddToUniforms( UniqueId, string.Format( Constants.SamplerDeclarationSRPMacros[ m_currentType ], propertyName ) ); + samplerToUse = propertyName; + } + } + else + { + string samplerState = m_samplerPort.GeneratePortInstructions( ref dataCollector ); + if( m_samplerPort.IsConnected && !string.IsNullOrEmpty( samplerState ) && !samplerState.Equals( "0" ) ) + { + samplerToUse = samplerState; + } + else + { + samplerToUse = GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, propertyName , varMode ); + } + } + + if( outsideGraph.IsSRP ) + { + if( m_currentType == TextureType.Texture3D && ( currMipMode == MipType.MipBias || currMipMode == MipType.Derivative ) ) + GeneratorUtils.AddCustom3DSRPMacros( ref dataCollector ); + samplerValue = string.Format( Constants.TexSampleSRPMacros[ m_currentType ], suffix, propertyName, samplerToUse, uvCoords ); + } + else + { + GeneratorUtils.AddCustomStandardSamplingMacros( ref dataCollector, m_currentType, currMipMode ); + samplerValue = string.Format( Constants.TexSampleSamplerStandardMacros[ m_currentType ], suffix, propertyName, samplerToUse, uvCoords ); + } + } + else + { + string mipType = ""; + if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + mipType = "lod"; + } + + switch( currMipMode ) + { + case MipType.Auto: + break; + case MipType.MipLevel: + mipType = "lod"; + break; + case MipType.MipBias: + mipType = "bias"; + break; + case MipType.Derivative: + break; + } + samplerValue = m_samplerType + mipType + "( " + propertyName + ", " + uvCoords + " )"; + } + + return samplerValue; + } + + public string SetFetchedData( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar, int outputId, string portProperty = null ) + { + m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_colorPort.DataType ); + string propertyName = CurrentPropertyReference; + VariableMode varMode = VarModeReference; + if( !string.IsNullOrEmpty( portProperty ) && portProperty != "0.0" ) + { + propertyName = portProperty; + } + + MipType currMipMode = m_mipMode; + + if( ignoreLocalVar ) + { + if( TextureProperty is VirtualTextureObject ) + Debug.Log( "TODO" ); + + if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + currMipMode = MipType.MipLevel; + } + + string samplerValue = SampleTexture( ref dataCollector, ignoreLocalVar, portProperty, currMipMode, propertyName , varMode ); + + AddNormalMapTag( ref dataCollector, ref samplerValue ); + return samplerValue; + } + + VirtualTextureObject vtex = ( TextureProperty as VirtualTextureObject ); + + if( vtex != null ) + { + string atPathname = AssetDatabase.GUIDToAssetPath( Constants.ATSharedLibGUID ); + if( string.IsNullOrEmpty( atPathname ) ) + { + UIUtils.ShowMessage( UniqueId, "Could not find Amplify Texture on your project folder. Please install it and re-compile the shader.", MessageSeverity.Error ); + } + else + { + //Need to see if the asset really exists because AssetDatabase.GUIDToAssetPath() can return a valid path if + // the asset was previously imported and deleted after that + UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath( atPathname ); + if( obj == null ) + { + UIUtils.ShowMessage( UniqueId, "Could not find Amplify Texture on your project folder. Please install it and re-compile the shader.", MessageSeverity.Error ); + } + else + { + if( m_colorPort.IsLocalValue( dataCollector.PortCategory ) ) + return m_colorPort.LocalValue( dataCollector.PortCategory ); + + //string remapPortR = ".r"; + //string remapPortG = ".g"; + //string remapPortB = ".b"; + //string remapPortA = ".a"; + + //if ( vtex.Channel == VirtualChannel.Occlusion ) + //{ + // remapPortR = ".r"; remapPortG = ".r"; remapPortB = ".r"; remapPortA = ".r"; + //} + //else if ( vtex.Channel == VirtualChannel.SpecMet && ( ContainerGraph.CurrentStandardSurface != null && ContainerGraph.CurrentStandardSurface.CurrentLightingModel == StandardShaderLightModel.Standard ) ) + //{ + // remapPortR = ".r"; remapPortG = ".r"; remapPortB = ".r"; + //} + //else if ( vtex.Channel == VirtualChannel.Height || vtex.Channel == VirtualChannel.Displacement ) + //{ + // remapPortR = ".b"; remapPortG = ".b"; remapPortB = ".b"; remapPortA = ".b"; + //} + + dataCollector.AddToPragmas( UniqueId, IOUtils.VirtualTexturePragmaHeader ); + dataCollector.AddToIncludes( UniqueId, atPathname ); + + string lodBias = string.Empty; + if( dataCollector.IsFragmentCategory ) + { + lodBias = m_mipMode == MipType.MipLevel ? "Lod" : m_mipMode == MipType.MipBias ? "Bias" : ""; + } + else + { + lodBias = "Lod"; + } + + int virtualCoordId = dataCollector.GetVirtualCoordinatesId( UniqueId, GetVirtualUVCoords( ref dataCollector, ignoreLocalVar, portProperty ), lodBias ); + string virtualSampler = SampleVirtualTexture( vtex, Constants.VirtualCoordNameStr + virtualCoordId ); + string virtualVariable = dataCollector.AddVirtualLocalVariable( UniqueId, "virtualNode" + OutputId, virtualSampler ); + + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, virtualVariable, virtualSampler ); + + AddNormalMapTag( ref dataCollector, ref virtualVariable ); + + switch( vtex.Channel ) + { + default: + case VirtualChannel.Albedo: + case VirtualChannel.Base: + case VirtualChannel.Normal: + case VirtualChannel.Specular: + case VirtualChannel.SpecMet: + case VirtualChannel.Material: + virtualVariable = GetOutputColorItem( 0, outputId, virtualVariable ); + break; + case VirtualChannel.Displacement: + case VirtualChannel.Height: + { + if( outputId > 0 ) + virtualVariable += ".b"; + else + { + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, "virtual_cast_" + OutputId, virtualVariable + ".b" ); + virtualVariable = "virtual_cast_" + OutputId; + } + //virtualVariable = UIUtils.CastPortType( dataCollector.PortCategory, m_currentPrecisionType, new NodeCastInfo( UniqueId, outputId ), virtualVariable, WirePortDataType.FLOAT, WirePortDataType.FLOAT4, virtualVariable ); + } + break; + case VirtualChannel.Occlusion: + { + if( outputId > 0 ) + virtualVariable += ".r"; + else + { + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, "virtual_cast_" + OutputId, virtualVariable + ".r" ); + virtualVariable = "virtual_cast_" + OutputId; + } + } + break; + } + + //for ( int i = 0; i < m_outputPorts.Count; i++ ) + //{ + // if ( m_outputPorts[ i ].IsConnected ) + // { + + // //TODO: make the sampler not generate local variables at all times + // m_textureFetchedValue = "virtualNode" + OutputId; + // m_isTextureFetched = true; + + // //dataCollector.AddToLocalVariables( m_uniqueId, m_precisionString + " " + m_textureFetchedValue + " = " + virtualSampler + ";" ); + // if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + // dataCollector.AddToVertexLocalVariables( UniqueId, m_precisionString + " " + m_textureFetchedValue + " = " + virtualSampler + ";" ); + // else + // dataCollector.AddToLocalVariables( UniqueId, m_precisionString + " " + m_textureFetchedValue + " = " + virtualSampler + ";" ); + + // m_colorPort.SetLocalValue( m_textureFetchedValue ); + // m_outputPorts[ m_colorPort.PortId + 1 ].SetLocalValue( m_textureFetchedValue + remapPortR ); + // m_outputPorts[ m_colorPort.PortId + 2 ].SetLocalValue( m_textureFetchedValue + remapPortG ); + // m_outputPorts[ m_colorPort.PortId + 3 ].SetLocalValue( m_textureFetchedValue + remapPortB ); + // m_outputPorts[ m_colorPort.PortId + 4 ].SetLocalValue( m_textureFetchedValue + remapPortA ); + // return m_textureFetchedValue; + // } + //} + + return virtualVariable; + } + } + } + + if( m_colorPort.IsLocalValue( dataCollector.PortCategory ) ) + return m_colorPort.LocalValue( dataCollector.PortCategory ); + + if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + currMipMode = MipType.MipLevel; + //mipType = "lod"; + } + + string samplerOp = SampleTexture( ref dataCollector, ignoreLocalVar, portProperty, currMipMode, propertyName , varMode ); + + AddNormalMapTag( ref dataCollector, ref samplerOp ); + + int connectedPorts = 0; + for( int i = 0; i < m_outputPorts.Count; i++ ) + { + if( m_outputPorts[ i ].IsConnected ) + { + connectedPorts += 1; + if( connectedPorts > 1 || m_outputPorts[ i ].ConnectionCount > 1 ) + { + // Create common local var and mark as fetched + string textureFetchedValue = m_samplerType + "Node" + OutputId; + + if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + dataCollector.AddToVertexLocalVariables( UniqueId, m_precisionString + " " + textureFetchedValue + " = " + samplerOp + ";" ); + else + dataCollector.AddToFragmentLocalVariables( UniqueId, m_precisionString + " " + textureFetchedValue + " = " + samplerOp + ";" ); + + + m_colorPort.SetLocalValue( textureFetchedValue, dataCollector.PortCategory ); + m_outputPorts[ m_colorPort.PortId + 1 ].SetLocalValue( textureFetchedValue + ".r", dataCollector.PortCategory ); + m_outputPorts[ m_colorPort.PortId + 2 ].SetLocalValue( textureFetchedValue + ".g", dataCollector.PortCategory ); + m_outputPorts[ m_colorPort.PortId + 3 ].SetLocalValue( textureFetchedValue + ".b", dataCollector.PortCategory ); + m_outputPorts[ m_colorPort.PortId + 4 ].SetLocalValue( textureFetchedValue + ".a", dataCollector.PortCategory ); + return textureFetchedValue; + } + } + } + return samplerOp; + } + + public string GetUVCoords( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar, string portProperty ) + { + bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ); + + // make sure the final result is always a float4 with empty 0's in the middle + string uvAppendix = ", "; + int coordSize = 3; + if( m_uvPort.DataType == WirePortDataType.FLOAT2 ) + { + uvAppendix = ", 0, "; + coordSize = 2; + } + else if( m_uvPort.DataType == WirePortDataType.FLOAT ) + { + uvAppendix = ", 0, 0, "; + coordSize = 1; + } + + string uvs = m_uvPort.GeneratePortInstructions( ref dataCollector ); + + // generate automatic UVs if not connected + if( !m_uvPort.IsConnected ) + { + string propertyName = CurrentPropertyReference; + + // check for references + if( !string.IsNullOrEmpty( portProperty ) && portProperty != "0.0" ) + propertyName = portProperty; + + int coordSet = ( ( m_textureCoordSet < 0 ) ? 0 : m_textureCoordSet ); + string uvName = IOUtils.GetUVChannelName( propertyName, coordSet ); + string dummyPropUV = "_tex" /*+ ( coordSize != 2 ? "" + coordSize : "" )*/ + "coord" + ( coordSet > 0 ? ( coordSet + 1 ).ToString() : "" ); + string dummyUV = "uv" + ( coordSet > 0 ? ( coordSet + 1 ).ToString() : "" ) + dummyPropUV; + + string attr = GetPropertyValue(); + bool scaleOffset = true; + if( attr.IndexOf( "[NoScaleOffset]" ) > -1 ) + scaleOffset = false; + + string texCoordsST = string.Empty; + if( scaleOffset ) + { + if( m_texCoordsHelper == null ) + { + m_texCoordsHelper = CreateInstance(); + m_texCoordsHelper.ContainerGraph = ContainerGraph; + m_texCoordsHelper.SetBaseUniqueId( UniqueId, true ); + m_texCoordsHelper.RegisterPropertyOnInstancing = false; + m_texCoordsHelper.AddGlobalToSRPBatcher = true; + } + + if( UIUtils.CurrentWindow.OutsideGraph.IsInstancedShader ) + { + m_texCoordsHelper.CurrentParameterType = PropertyType.InstancedProperty; + } + else + { + m_texCoordsHelper.CurrentParameterType = PropertyType.Global; + } + m_texCoordsHelper.ResetOutputLocals(); + m_texCoordsHelper.SetRawPropertyName( propertyName + "_ST" ); + texCoordsST = m_texCoordsHelper.GenerateShaderForOutput( 0, ref dataCollector, false ); + } + + string coordInput = string.Empty; + if( !dataCollector.IsTemplate && coordSet > 3 ) + { + coordInput = GeneratorUtils.GenerateAutoUVs( ref dataCollector, UniqueId, coordSet, null, m_uvPort.DataType ); + } + else + { + dataCollector.AddToProperties( UniqueId, "[HideInInspector] " + dummyPropUV + "( \"\", 2D ) = \"white\" {}", 9999 ); + if( isVertex ) + { + coordInput = Constants.VertexShaderInputStr + ".texcoord"; + if( coordSet > 0 ) + coordInput += coordSet.ToString(); + } + else + { + coordInput = Constants.InputVarStr + "." + dummyUV; + dataCollector.AddToInput( UniqueId, dummyUV, dataCollector.GetMaxTextureChannelSize( coordSet )); + } + } + + if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + string result = string.Empty; + if( dataCollector.TemplateDataCollectorInstance.GetCustomInterpolatedData( TemplateHelperFunctions.IntToUVChannelInfo[ m_textureCoordSet ], m_uvPort.DataType, PrecisionType.Float, ref result, false, dataCollector.PortCategory ) ) + { + coordInput = result; + } + else + if( dataCollector.TemplateDataCollectorInstance.HasUV( m_textureCoordSet ) ) + coordInput = dataCollector.TemplateDataCollectorInstance.GetUVName( m_textureCoordSet, m_uvPort.DataType ); + else + coordInput = dataCollector.TemplateDataCollectorInstance.RegisterUV( m_textureCoordSet, m_uvPort.DataType ); + } + + if( !scaleOffset ) + uvName += OutputId; + + if( coordSize > 2 ) + { + uvName += coordSize; + dataCollector.UsingHigherSizeTexcoords = true; + dataCollector.AddLocalVariable( UniqueId, "float" + coordSize + " " + uvName + " = " + coordInput + ";" ); + if( scaleOffset ) + { + string scaleOffsetValue = GeneratorUtils.GenerateScaleOffsettedUV( m_currentType , coordInput+".xy" , texCoordsST, false ); + dataCollector.AddLocalVariable( UniqueId , uvName + ".xy = " + scaleOffsetValue+";" ); + } + } + else + { + if( coordSize == 1 ) + uvName += coordSize; + + if( scaleOffset ) + { + string scaleOffsetValue = GeneratorUtils.GenerateScaleOffsettedUV( m_currentType , coordInput , texCoordsST, false ); + dataCollector.AddLocalVariable( UniqueId , PrecisionType.Float , m_uvPort.DataType , uvName , scaleOffsetValue ); + } + else + dataCollector.AddLocalVariable( UniqueId , PrecisionType.Float , m_uvPort.DataType , uvName , coordInput ); + } + + uvs = uvName; + } + + + ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; + if( m_currentType == TextureType.Texture2DArray ) + { + string index = m_indexPort.GeneratePortInstructions( ref dataCollector ); + uvs = string.Format( "{0},{1}", uvs, index ); + + if( !( ( outsideGraph.SamplingMacros || m_currentType == TextureType.Texture2DArray ) && outsideGraph.IsSRP ) ) + { + uvs = "float3(" + uvs + ")"; + } + } + + if( isVertex ) + { + string lodLevel = m_lodPort.GeneratePortInstructions( ref dataCollector ); + if( ( outsideGraph.SamplingMacros || m_currentType == TextureType.Texture2DArray ) && m_currentType != TextureType.Texture1D ) + return uvs + ", " + lodLevel; + else + return UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT4 ) + "( " + uvs + uvAppendix + lodLevel + ")"; + } + else + { + if( ( m_mipMode == MipType.MipLevel || m_mipMode == MipType.MipBias ) /*&& m_lodPort.IsConnected*/ ) + { + string lodLevel = m_lodPort.GeneratePortInstructions( ref dataCollector ); + if( ( outsideGraph.SamplingMacros || m_currentType == TextureType.Texture2DArray ) && m_currentType != TextureType.Texture1D ) + return uvs + ", " + lodLevel; + else + return UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT4 ) + "( " + uvs + uvAppendix + lodLevel + ")"; + } + else if( m_mipMode == MipType.Derivative ) + { + string ddx = m_ddxPort.GeneratePortInstructions( ref dataCollector ); + string ddy = m_ddyPort.GeneratePortInstructions( ref dataCollector ); + + return uvs + ", " + ddx + ", " + ddy; + } + else + { + return uvs; + } + } + } + + public string GetVirtualUVCoords( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar, string portProperty ) + { + string bias = ""; + if( !dataCollector.IsFragmentCategory || m_mipMode == MipType.MipBias || m_mipMode == MipType.MipLevel ) + { + string lodLevel = m_lodPort.GeneratePortInstructions( ref dataCollector ); + bias += ", " + lodLevel; + } + + if( m_uvPort.IsConnected ) + { + string uvs = m_uvPort.GeneratePortInstructions( ref dataCollector ); + return uvs + bias; + } + else + { + string propertyName = CurrentPropertyReference; + if( !string.IsNullOrEmpty( portProperty ) ) + { + propertyName = portProperty; + } + string uvChannelName = IOUtils.GetUVChannelName( propertyName, m_textureCoordSet ); + + + string uvCoord = string.Empty; + if( dataCollector.IsTemplate ) + { + string uvName = string.Empty; + if( dataCollector.TemplateDataCollectorInstance.HasUV( m_textureCoordSet ) ) + { + uvName = dataCollector.TemplateDataCollectorInstance.GetUVName( m_textureCoordSet, m_uvPort.DataType ); + } + else + { + uvName = dataCollector.TemplateDataCollectorInstance.RegisterUV( m_textureCoordSet, m_uvPort.DataType ); + } + + string attr = GetPropertyValue(); + + if( attr.IndexOf( "[NoScaleOffset]" ) > -1 ) + { + dataCollector.AddLocalVariable( UniqueId, PrecisionType.Float, WirePortDataType.FLOAT2, uvChannelName, uvName ); + } + else + { + dataCollector.AddToUniforms( UniqueId, "uniform float4 " + propertyName + "_ST;" ); + dataCollector.AddLocalVariable( UniqueId , PrecisionType.Float , WirePortDataType.FLOAT2 , uvChannelName , GeneratorUtils.GenerateScaleOffsettedUV( m_currentType , uvName , propertyName,true ) ); + } + uvCoord = uvChannelName; + } + else + { + if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + uvCoord = Constants.VertexShaderInputStr + ".texcoord"; + if( m_textureCoordSet > 0 ) + { + uvCoord += m_textureCoordSet.ToString(); + } + } + else + { + propertyName = CurrentPropertyReference; + if( !string.IsNullOrEmpty( portProperty ) && portProperty != "0.0" ) + { + propertyName = portProperty; + } + uvChannelName = IOUtils.GetUVChannelName( propertyName, m_textureCoordSet ); + + string dummyPropUV = "_texcoord" + ( m_textureCoordSet > 0 ? ( m_textureCoordSet + 1 ).ToString() : "" ); + string dummyUV = "uv" + ( m_textureCoordSet > 0 ? ( m_textureCoordSet + 1 ).ToString() : "" ) + dummyPropUV; + + dataCollector.AddToProperties( UniqueId, "[HideInInspector] " + dummyPropUV + "( \"\", 2D ) = \"white\" {}", 100 ); + dataCollector.AddToInput( UniqueId, dummyUV, WirePortDataType.FLOAT2 ); + + string attr = GetPropertyValue(); + + if( attr.IndexOf( "[NoScaleOffset]" ) > -1 ) + { + dataCollector.AddToLocalVariables( UniqueId, PrecisionType.Float, WirePortDataType.FLOAT2, uvChannelName, Constants.InputVarStr + "." + dummyUV ); + } + else + { + dataCollector.AddToUniforms( UniqueId, "uniform float4 " + propertyName + "_ST;" ); + string offsettedUV = GeneratorUtils.GenerateScaleOffsettedUV( m_currentType , dummyUV , propertyName,true ); + dataCollector.AddToLocalVariables( UniqueId, PrecisionType.Float, WirePortDataType.FLOAT2, uvChannelName, Constants.InputVarStr + "." + offsettedUV ); + } + uvCoord = uvChannelName; + } + } + return uvCoord + bias; + } + } + + private void AddNormalMapTag( ref MasterNodeDataCollector dataCollector, ref string value ) + { + if( m_autoUnpackNormals ) + { + bool isScaledNormal = false; + if( m_normalPort.IsConnected ) + { + isScaledNormal = true; + } + else + { + if( m_normalPort.FloatInternalData != 1 ) + { + isScaledNormal = true; + } + } + + string scaleValue = isScaledNormal ? m_normalPort.GeneratePortInstructions( ref dataCollector ) : "1.0f"; + value = GeneratorUtils.GenerateUnpackNormalStr( ref dataCollector, CurrentPrecisionType, UniqueId, OutputId, value, isScaledNormal, scaleValue, UnpackInputMode.Tangent ); + + if( isScaledNormal ) + { + if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) + { + dataCollector.AddToIncludes( UniqueId, Constants.UnityStandardUtilsLibFuncs ); + } + } + } + } + + public override void ReadOutputDataFromString( ref string[] nodeParams ) + { + base.ReadOutputDataFromString( ref nodeParams ); + ConfigureOutputPorts(); + } + + public override int InputIdFromDeprecated( int oldInputId ) + { + // this is not a good solution, it doesn't check for the deprecated type and thus assumes it always comes from texture array + switch( oldInputId ) + { + default: + return oldInputId; + case 0: + return 1; + case 1: + return 6; + case 2: + return 2; + case 3: + return 5; + case 4: + return 3; + case 5: + return 4; + case 6: + return 0; + } + } + + public override void ReadFromDeprecated( ref string[] nodeParams, Type oldType = null ) + { + base.ReadFromDeprecated( ref nodeParams, oldType ); + if( oldType == typeof( TextureArrayNode ) ) + { + base.ReadFromStringArray( ref nodeParams ); + string textureName = GetCurrentParam( ref nodeParams ); + m_defaultValue = AssetDatabase.LoadAssetAtPath( textureName ); + if( m_defaultValue ) + { + m_materialValue = m_defaultValue; + } + + m_textureCoordSet = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_referenceType = (TexReferenceType)Enum.Parse( typeof( TexReferenceType ), GetCurrentParam( ref nodeParams ) ); + m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( m_referenceType == TexReferenceType.Instance ) + { + UIUtils.UnregisterSamplerNode( this ); + UIUtils.UnregisterPropertyNode( this ); + } + UpdateHeaderColor(); + + if( UIUtils.CurrentShaderVersion() > 3202 ) + m_mipMode = (MipType)Enum.Parse( typeof( MipType ), GetCurrentParam( ref nodeParams ) ); + + if( UIUtils.CurrentShaderVersion() > 5105 ) + m_autoUnpackNormals = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + + m_currentType = TextureType.Texture2DArray; + //m_autocastMode = AutoCastType.LockedToTexture2DArray; + + if( m_defaultValue == null ) + { + ConfigureInputPorts(); + ConfigureOutputPorts(); + //ResizeNodeToPreview(); + } + else + { + if( m_materialValue == null ) + { + ConfigFromObject( m_defaultValue, false, false ); + } + else + { + CheckTextureImporter( false, false ); + } + ConfigureInputPorts(); + ConfigureOutputPorts(); + } + + if( !m_isNodeBeingCopied && m_referenceType == TexReferenceType.Object ) + { + ContainerGraph.SamplerNodes.UpdateDataOnNode( UniqueId, DataToArray ); + } + + // reading input data due to internal data being lost + int count = 0; + if( UIUtils.CurrentShaderVersion() > 7003 ) + { + try + { + count = Convert.ToInt32( nodeParams[ m_currentReadParamIdx++ ] ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + else + { + count = ( m_oldInputCount < 0 ) ? m_inputPorts.Count : m_oldInputCount; + } + + for( int i = 0; i < count && i < nodeParams.Length && m_currentReadParamIdx < nodeParams.Length; i++ ) + { + if( UIUtils.CurrentShaderVersion() < 5003 ) + { + int newId = VersionConvertInputPortId( i ); + string InternalData = string.Empty; + + if( UIUtils.CurrentShaderVersion() > 23 ) + { + Enum.Parse( typeof( WirePortDataType ), nodeParams[ m_currentReadParamIdx++ ] ); + } + + InternalData = nodeParams[ m_currentReadParamIdx++ ]; + if( UIUtils.CurrentShaderVersion() >= 3100 && m_currentReadParamIdx < nodeParams.Length ) + { + nodeParams[ m_currentReadParamIdx++ ].ToString(); + } + + if( newId == 2 ) + { + m_indexPort.InternalData = InternalData; + m_indexPort.UpdatePreviewInternalData(); + } + + if( newId == 3 ) + { + m_lodPort.InternalData = InternalData; + m_lodPort.UpdatePreviewInternalData(); + } + } + else + { + string portIdStr = nodeParams[ m_currentReadParamIdx++ ]; + int portId = -1; + try + { + portId = Convert.ToInt32( portIdStr ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + Enum.Parse( typeof( WirePortDataType ), nodeParams[ m_currentReadParamIdx++ ] ); + string InternalData = nodeParams[ m_currentReadParamIdx++ ]; + bool isEditable = Convert.ToBoolean( nodeParams[ m_currentReadParamIdx++ ] ); + if( isEditable && m_currentReadParamIdx < nodeParams.Length ) + { + nodeParams[ m_currentReadParamIdx++ ].ToString(); + } + + if( portId == 1 ) + { + m_indexPort.InternalData = InternalData; + m_indexPort.UpdatePreviewInternalData(); + } + + if( portId == 2 ) + { + m_lodPort.InternalData = InternalData; + m_lodPort.UpdatePreviewInternalData(); + } + } + } + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + string defaultTextureGUID = GetCurrentParam( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 14101 ) + { + m_defaultValue = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( defaultTextureGUID ) ); + string materialTextureGUID = GetCurrentParam( ref nodeParams ); + m_materialValue = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( materialTextureGUID ) ); + } + else + { + m_defaultValue = AssetDatabase.LoadAssetAtPath( defaultTextureGUID ); + } + m_useSemantics = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_textureCoordSet = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_isNormalMap = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_defaultTextureValue = (TexturePropertyValues)Enum.Parse( typeof( TexturePropertyValues ), GetCurrentParam( ref nodeParams ) ); + m_autocastMode = (AutoCastType)Enum.Parse( typeof( AutoCastType ), GetCurrentParam( ref nodeParams ) ); + m_autoUnpackNormals = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + + if( UIUtils.CurrentShaderVersion() > 12 ) + { + m_referenceType = (TexReferenceType)Enum.Parse( typeof( TexReferenceType ), GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 22 ) + { + m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + else + { + m_referenceArrayId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + if( m_referenceType == TexReferenceType.Instance ) + { + UIUtils.UnregisterSamplerNode( this ); + UIUtils.UnregisterPropertyNode( this ); + } + UpdateHeaderColor(); + } + if( UIUtils.CurrentShaderVersion() > 2406 ) + m_mipMode = (MipType)Enum.Parse( typeof( MipType ), GetCurrentParam( ref nodeParams ) ); + + + if( UIUtils.CurrentShaderVersion() > 3201 ) + m_currentType = (TextureType)Enum.Parse( typeof( TextureType ), GetCurrentParam( ref nodeParams ) ); + + if( m_defaultValue == null ) + { + ConfigureInputPorts(); + ConfigureOutputPorts(); + //ResizeNodeToPreview(); + } + else + { + if( m_materialValue == null ) + { + ConfigFromObject( m_defaultValue, false, false ); + } + else + { + CheckTextureImporter( false, false ); + } + ConfigureInputPorts(); + ConfigureOutputPorts(); + } + + if( !m_isNodeBeingCopied && m_referenceType == TexReferenceType.Object ) + { + ContainerGraph.SamplerNodes.UpdateDataOnNode( UniqueId, DataToArray ); + } + + if( UIUtils.CurrentShaderVersion() >= 6001 && UIUtils.CurrentShaderVersion() < 7003 ) + { + m_oldInputCount = 6; + } + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + ForceInputPortsChange(); + + if( m_useSamplerArrayIdx > -1 ) + { + m_useSamplerArrayIdx = UIUtils.GetTexturePropertyNodeRegisterId( m_useSamplerArrayIdx ) + 1; + } + else + { + m_useSamplerArrayIdx = 0; + } + + EditorGUI.BeginChangeCheck(); + if( m_referenceType == TexReferenceType.Instance ) + { + if( UIUtils.CurrentShaderVersion() > 22 ) + { + + + m_referenceSampler = ContainerGraph.GetNode( m_referenceNodeId ) as SamplerNode; + m_referenceArrayId = ContainerGraph.SamplerNodes.GetNodeRegisterIdx( m_referenceNodeId ); + } + else + { + m_referenceSampler = ContainerGraph.SamplerNodes.GetNode( m_referenceArrayId ); + if( m_referenceSampler != null ) + { + m_referenceNodeId = m_referenceSampler.UniqueId; + } + } + } + + if( EditorGUI.EndChangeCheck() ) + { + OnPropertyNameChanged(); + } + } + + public override void ReadAdditionalData( ref string[] nodeParams ) { } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_defaultValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_defaultValue ) ) : Constants.NoStringValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_materialValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_materialValue ) ) : Constants.NoStringValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_useSemantics.ToString() ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_textureCoordSet.ToString() ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_isNormalMap.ToString() ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultTextureValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_autocastMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_autoUnpackNormals ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceType ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( ( m_referenceSampler != null ) ? m_referenceSampler.UniqueId : -1 ) ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_mipMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentType ); + } + + public override void WriteAdditionalToString( ref string nodeInfo, ref string connectionsInfo ) { } + + public override int VersionConvertInputPortId( int portId ) + { + int newPort = portId; + //change normal scale port to last + if( UIUtils.CurrentShaderVersion() < 2407 ) + { + if( portId == 1 ) + newPort = 4; + } + + if( UIUtils.CurrentShaderVersion() < 2408 ) + { + newPort = newPort + 1; + } + + return newPort; + } + + public override void Destroy() + { + base.Destroy(); + + //Not calling m_texCoordsHelper.Destroy() on purpose so UIUtils does not incorrectly unregister stuff + if( m_texCoordsHelper != null ) + { + DestroyImmediate( m_texCoordsHelper ); + m_texCoordsHelper = null; + } + + m_samplerStateAutoGenerator.Destroy(); + m_samplerStateAutoGenerator = null; + m_defaultValue = null; + m_materialValue = null; + m_referenceSampler = null; + m_referenceStyle = null; + m_referenceContent = null; + m_texPort = null; + m_uvPort = null; + m_lodPort = null; + m_ddxPort = null; + m_ddyPort = null; + m_normalPort = null; + m_colorPort = null; + m_samplerPort = null; + m_indexPort = null; + + if( m_referenceType == TexReferenceType.Object ) + { + UIUtils.UnregisterSamplerNode( this ); + UIUtils.UnregisterPropertyNode( this ); + } + if( UniqueId > -1 ) + ContainerGraph.SamplerNodes.OnReorderEventComplete -= OnReorderEventComplete; + } + + public override string GetPropertyValStr() + { + return m_materialMode ? ( m_materialValue != null ? m_materialValue.name : IOUtils.NO_TEXTURES ) : ( m_defaultValue != null ? m_defaultValue.name : IOUtils.NO_TEXTURES ); + } + + public TexturePropertyNode TextureProperty + { + get + { + if( m_referenceSampler != null ) + { + m_textureProperty = m_referenceSampler as TexturePropertyNode; + } + else if( m_texPort.IsConnected ) + { + m_textureProperty = m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode; + } + + if( m_textureProperty == null ) + return this; + + return m_textureProperty; + } + } + + public override string GetPropertyValue() + { + if( SoftValidReference ) + { + if( m_referenceSampler.TexPort.IsConnected ) + { + return string.Empty; + } + else + { + return m_referenceSampler.TextureProperty.GetPropertyValue(); + } + } + else + if( m_texPort.IsConnected && ( m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode ) != null ) + { + return TextureProperty.GetPropertyValue(); + } + + switch( m_currentType ) + { + case TextureType.Texture1D: + { + return PropertyAttributes + GetTexture1DPropertyValue(); + } + case TextureType.ProceduralTexture: + case TextureType.Texture2D: + { + return PropertyAttributes + GetTexture2DPropertyValue(); + } + case TextureType.Texture3D: + { + return PropertyAttributes + GetTexture3DPropertyValue(); + } + case TextureType.Cube: + { + return PropertyAttributes + GetCubePropertyValue(); + } + case TextureType.Texture2DArray: + { + return PropertyAttributes + GetTexture2DArrayPropertyValue(); + } + } + return string.Empty; + } + + public override string GetUniformValue() + { + + if( SoftValidReference ) + { + if( m_referenceSampler.TexPort.IsConnected ) + return string.Empty; + else + return m_referenceSampler.TextureProperty.GetUniformValue(); + } + else if( m_texPort.IsConnected && ( m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode ) != null ) + { + return TextureProperty.GetUniformValue(); + } + + return base.GetUniformValue(); + } + + public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) + { + if( SoftValidReference ) + { + if( m_referenceSampler.TexPort.IsConnected ) + { + base.GetUniformData( out dataType, out dataName, ref fullValue ); + return false; + } + else + return m_referenceSampler.TextureProperty.GetUniformData( out dataType, out dataName, ref fullValue ); + } + else if( m_texPort.IsConnected && ( m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode ) != null ) + { + return TextureProperty.GetUniformData( out dataType, out dataName, ref fullValue ); + + } + + return base.GetUniformData( out dataType, out dataName, ref fullValue ); + } + + public string UVCoordsName { get { return Constants.InputVarStr + "." + IOUtils.GetUVChannelName( CurrentPropertyReference, m_textureCoordSet ); } } + public bool HasPropertyReference + { + get + { + if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 ) + { + SamplerNode node = ContainerGraph.SamplerNodes.GetNode( m_referenceArrayId ); + if( node != null ) + return true; + } + + if( m_texPort.IsConnected ) + { + return true; + } + + return false; + } + } + + public override string CurrentPropertyReference + { + get + { + string propertyName = string.Empty; + if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 ) + { + SamplerNode node = ContainerGraph.SamplerNodes.GetNode( m_referenceArrayId ); + propertyName = ( node != null ) ? node.TextureProperty.PropertyName : PropertyName; + } + else if( m_texPort.IsConnected && ( m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode ) != null ) + { + propertyName = TextureProperty.PropertyName; + } + else + { + propertyName = PropertyName; + } + return propertyName; + } + } + + public VariableMode VarModeReference + { + get + { + VariableMode mode; + if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 ) + { + SamplerNode node = ContainerGraph.SamplerNodes.GetNode( m_referenceArrayId ); + mode = ( node != null ) ? node.CurrentVariableMode : m_variableMode; + } + else if( m_texPort.IsConnected && ( m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode ) != null ) + { + mode = TextureProperty.CurrentVariableMode; + } + else + { + mode = m_variableMode; + } + return mode; + } + } + + public bool SoftValidReference + { + get + { + if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 ) + { + m_referenceSampler = ContainerGraph.SamplerNodes.GetNode( m_referenceArrayId ); + + m_texPort.Locked = true; + + if( m_referenceContent == null ) + m_referenceContent = new GUIContent(); + + + if( m_referenceSampler != null ) + { + m_referenceContent.image = m_referenceSampler.Value; + if( m_referenceWidth != m_referenceSampler.Position.width ) + { + m_referenceWidth = m_referenceSampler.Position.width; + m_sizeIsDirty = true; + } + } + else + { + m_referenceArrayId = -1; + m_referenceWidth = -1; + } + + return m_referenceSampler != null; + } + m_texPort.Locked = false; + return false; + } + } + public override void ForceUpdateFromMaterial( Material material ) + { + if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( PropertyName ) ) + { + m_materialValue = material.GetTexture( PropertyName ); + CheckTextureImporter( true ); + PreviewIsDirty = true; + } + + } + public override void SetContainerGraph( ParentGraph newgraph ) + { + base.SetContainerGraph( newgraph ); + m_textureProperty = m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode; + if( m_textureProperty == null ) + { + m_textureProperty = this; + } + } + + public bool AutoUnpackNormals + { + get { return m_autoUnpackNormals; } + set + { + if( value != m_autoUnpackNormals ) + { + m_autoUnpackNormals = value; + if( !UIUtils.IsLoading ) + { + m_defaultTextureValue = value ? TexturePropertyValues.bump : TexturePropertyValues.white; + } + } + } + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + if( dataCollector.IsTemplate ) + { + if( !m_texPort.IsConnected ) + dataCollector.TemplateDataCollectorInstance.SetUVUsage( m_textureCoordSet , m_uvPort.DataType ); + } + else + { + if( !m_uvPort.IsConnected ) + dataCollector.SetTextureChannelSize( m_textureCoordSet , m_uvPort.DataType ); + + if( m_textureCoordSet > 3 ) + { + dataCollector.AddCustomAppData( string.Format( TemplateHelperFunctions.TexUVFullSemantic , m_textureCoordSet ) ); + } + } + } + + private InputPort TexPort { get { return m_texPort; } } + public bool IsObject { get { return ( m_referenceType == TexReferenceType.Object ) || ( m_referenceSampler == null ); } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs.meta new file mode 100644 index 00000000..df06cc12 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 057d23b232d9c044cbf3f1d0b1a06909 +timeCreated: 1481126953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerStateNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerStateNode.cs new file mode 100644 index 00000000..4e041c41 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerStateNode.cs @@ -0,0 +1,402 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Sampler State", "Textures", "Creates a custom sampler state or returns the default one of a selected texture object" )] + public class SamplerStateNode : ParentNode + { + private readonly string[] Dummy = { string.Empty }; + private const string WrapModeStr = "Wrap Mode"; + private const string UAxisStr = "U axis"; + private const string VAxisStr = "V axis"; + private const string FilterModeStr = "Filter Mode"; + private const string AnisotropicFilteringStr = "Aniso. Filtering"; + private const string MessageMacrosOFF = "Sampling Macros option is turned OFF, this node will not generate any sampler state"; + private const string MessageTextureObject = "Only Texture Objects that are actually being sampled within the shader generate valid sampler states.\n\nPlease make sure the referenced Texture Object is being sampled otherwise the shader will fail to compile."; + private const string MessageUnitSuppport = "Unity support for sampler states in versions below Unity 2018.1 is limited.\n\nNotably, only vertex/frag shaders support it and not surfaces shaders and sampler states can only be reused and not created if the version is below 2017.1"; + + [SerializeField] + protected int m_wrapMode = 0; + + [SerializeField] + protected TextureWrapMode m_wrapModeU = TextureWrapMode.Repeat; + + [SerializeField] + protected TextureWrapMode m_wrapModeV = TextureWrapMode.Repeat; + + [SerializeField] + protected FilterMode m_filterMode = FilterMode.Bilinear; + + + public enum AnisoModes + { + None, + X2, + X4, + X8, + X16 + } + + [SerializeField] + protected AnisoModes m_anisoMode = AnisoModes.None; + + [SerializeField] + private int m_referenceSamplerId = -1; + + [SerializeField] + private int m_referenceNodeId = -1; + + [SerializeField] + private TexturePropertyNode m_inputReferenceNode = null; + + private TexturePropertyNode m_referenceNode = null; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + private InputPort m_texPort; + + private readonly string[] m_wrapModeStr = { + "Repeat", + "Clamp", + "Mirror", + "Mirror Once", + "Per-axis" + }; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.SAMPLER2D, false, "Tex" ); + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.SAMPLER2DARRAY ); + AddOutputPort( WirePortDataType.SAMPLERSTATE, "Out" ); + m_texPort = m_inputPorts[ 0 ]; + m_hasLeftDropdown = true; + m_autoWrapProperties = true; + m_errorMessageTypeIsError = NodeMessageType.Warning; + m_errorMessageTooltip = MessageMacrosOFF; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_inputReferenceNode = m_inputPorts[ 0 ].GetOutputNodeWhichIsNotRelay() as TexturePropertyNode; + UpdateTitle(); + + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + m_inputReferenceNode = null; + UpdateTitle(); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + UpdateTitle(); + } + + void UpdateTitle() + { + if( m_inputReferenceNode != null ) + { + m_additionalContent.text = string.Format( Constants.PropertyValueLabel, m_inputReferenceNode.PropertyInspectorName ); + } + else if( m_referenceSamplerId > -1 && m_referenceNode != null ) + { + m_additionalContent.text = string.Format( Constants.PropertyValueLabel, m_referenceNode.PropertyInspectorName ); + } + else + { + m_additionalContent.text = string.Empty; + } + m_sizeIsDirty = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + bool guiEnabledBuffer = GUI.enabled; + EditorGUI.BeginChangeCheck(); + List arr = new List( UIUtils.TexturePropertyNodeArr() ); + + if( arr != null && arr.Count > 0 ) + { + arr.Insert( 0, "None" ); + GUI.enabled = true && ( !m_inputPorts[ 0 ].IsConnected ); + m_referenceSamplerId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceSamplerId + 1, arr.ToArray() ) - 1; + } + else + { + m_referenceSamplerId = -1; + GUI.enabled = false; + EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceSamplerId, Dummy ); + } + + GUI.enabled = guiEnabledBuffer; + if( EditorGUI.EndChangeCheck() ) + { + m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId ); + if( m_referenceNode != null ) + { + m_referenceNodeId = m_referenceNode.UniqueId; + } + else + { + m_referenceNodeId = -1; + m_referenceSamplerId = -1; + } + UpdateTitle(); + } + + EditorGUI.BeginDisabledGroup( m_texPort.IsConnected || m_referenceNodeId >= 0 ); + EditorGUI.BeginChangeCheck(); + m_wrapMode = EditorGUILayoutPopup( WrapModeStr, m_wrapMode, m_wrapModeStr ); + if( EditorGUI.EndChangeCheck() ) + { + switch( m_wrapMode ) + { + case 0: + m_wrapModeU = TextureWrapMode.Repeat; + m_wrapModeV = TextureWrapMode.Repeat; + break; + case 1: + m_wrapModeU = TextureWrapMode.Clamp; + m_wrapModeV = TextureWrapMode.Clamp; + break; + case 2: + m_wrapModeU = TextureWrapMode.Mirror; + m_wrapModeV = TextureWrapMode.Mirror; + break; + case 3: + m_wrapModeU = TextureWrapMode.MirrorOnce; + m_wrapModeV = TextureWrapMode.MirrorOnce; + break; + } + } + + if( m_wrapMode == 4 ) + { + EditorGUI.indentLevel++; + m_wrapModeU = (TextureWrapMode)EditorGUILayoutEnumPopup( UAxisStr, m_wrapModeU ); + m_wrapModeV = (TextureWrapMode)EditorGUILayoutEnumPopup( VAxisStr, m_wrapModeV ); + EditorGUI.indentLevel--; + } + + m_filterMode = (FilterMode)EditorGUILayoutEnumPopup( FilterModeStr, m_filterMode ); + +#if UNITY_2021_2_OR_NEWER + m_anisoMode = (AnisoModes)EditorGUILayoutEnumPopup( AnisotropicFilteringStr , m_anisoMode ); +#endif + EditorGUI.EndDisabledGroup(); + + if( !UIUtils.CurrentWindow.OutsideGraph.SamplingMacros ) + EditorGUILayout.HelpBox( MessageMacrosOFF, MessageType.Warning ); + + if( m_texPort.IsConnected || m_referenceNodeId >= 0 ) + EditorGUILayout.HelpBox( MessageTextureObject, MessageType.Info ); + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + if( !UIUtils.CurrentWindow.OutsideGraph.SamplingMacros && ContainerGraph.CurrentShaderFunction == null ) + m_showErrorMessage = true; + else + m_showErrorMessage = false; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + { + List arr = new List( UIUtils.TexturePropertyNodeArr() ); + bool guiEnabledBuffer = GUI.enabled; + + if( arr != null && arr.Count > 0 ) + { + arr.Insert( 0, "None" ); + GUI.enabled = true && ( !m_inputPorts[ 0 ].IsConnected ); + m_referenceSamplerId = m_upperLeftWidget.DrawWidget( this, m_referenceSamplerId + 1, arr.ToArray() ) - 1; + } + else + { + m_referenceSamplerId = -1; + GUI.enabled = false; + m_upperLeftWidget.DrawWidget( this, m_referenceSamplerId, Dummy ); + } + GUI.enabled = guiEnabledBuffer; + } + if( EditorGUI.EndChangeCheck() ) + { + m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId ); + if( m_referenceNode != null ) + { + m_referenceNodeId = m_referenceNode.UniqueId; + } + else + { + m_referenceNodeId = -1; + m_referenceSamplerId = -1; + } + UpdateTitle(); + } + } + + public string GenerateSamplerAttributes() + { + string result = string.Empty; + switch( m_filterMode ) + { + case FilterMode.Point: + result += "_Point"; + break; + default: + case FilterMode.Bilinear: + result += "_Linear"; + break; + case FilterMode.Trilinear: + result += "_Trilinear"; + break; + } + + int finalWrap = m_wrapModeU == m_wrapModeV ? (int)m_wrapModeU : m_wrapMode; + switch( finalWrap ) + { + case 0: + default: + result += "_Repeat"; + break; + case 1: + result += "_Clamp"; + break; + case 2: + result += "_Mirror"; + break; + case 3: + result += "_MirrorOnce"; + break; + case 4: + { + switch( m_wrapModeU ) + { + default: + case TextureWrapMode.Repeat: + result += "_RepeatU"; + break; + case TextureWrapMode.Clamp: + result += "_ClampU"; + break; + case TextureWrapMode.Mirror: + result += "_MirrorU"; + break; + case TextureWrapMode.MirrorOnce: + result += "_MirrorOnceU"; + break; + } + switch( m_wrapModeV ) + { + default: + case TextureWrapMode.Repeat: + result += "_RepeatV"; + break; + case TextureWrapMode.Clamp: + result += "_ClampV"; + break; + case TextureWrapMode.Mirror: + result += "_MirrorV"; + break; + case TextureWrapMode.MirrorOnce: + result += "_MirrorOnceV"; + break; + } + } + break; + } +#if UNITY_2021_2_OR_NEWER + switch( m_anisoMode ) + { + default: + case AnisoModes.None:break; + case AnisoModes.X2: result += "_Aniso2";break; + case AnisoModes.X4: result += "_Aniso4"; break; + case AnisoModes.X8: result += "_Aniso8"; break; + case AnisoModes.X16: result += "_Aniso16"; break; + } +#endif + + return result; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( !m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + { + string propertyOrOptions = string.Empty; + if( m_texPort.IsConnected ) + { + propertyOrOptions = m_texPort.GeneratePortInstructions( ref dataCollector ); + } + else if( m_referenceNode != null ) + { + m_referenceNode.BaseGenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + propertyOrOptions = m_referenceNode.PropertyName; + } + else + { + propertyOrOptions = GenerateSamplerAttributes(); + } + + string sampler = GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, propertyOrOptions , VariableMode.Create ); + + m_outputPorts[ 0 ].SetLocalValue( sampler, dataCollector.PortCategory ); + } + + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as TexturePropertyNode; + m_referenceSamplerId = UIUtils.GetTexturePropertyNodeRegisterId( m_referenceNodeId ); + UpdateTitle(); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_wrapMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_wrapModeU = (TextureWrapMode)Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_wrapModeV = (TextureWrapMode)Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_filterMode = (FilterMode)Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 18926 ) + { + m_anisoMode = (AnisoModes)Enum.Parse( typeof( AnisoModes ) , GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_wrapMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, (int)m_wrapModeU ); + IOUtils.AddFieldValueToString( ref nodeInfo, (int)m_wrapModeV ); + IOUtils.AddFieldValueToString( ref nodeInfo, (int)m_filterMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceNodeId ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_anisoMode ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerStateNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerStateNode.cs.meta new file mode 100644 index 00000000..e2422132 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerStateNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 43b6f20fe0e24ff40bf9f25b001b40d8 +timeCreated: 1593535352 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerStateNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs new file mode 100644 index 00000000..dc007aff --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs @@ -0,0 +1,257 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Flipbook UV Animation +// Donated by The Four Headed Cat - @fourheadedcat + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + + [Serializable] + [NodeAttributes( "Flipbook UV Animation", "UV Coordinates", "Animate a Flipbook Texture Modifying UV Coordinates.", null, KeyCode.None, true, false, null, null, "The Four Headed Cat - @fourheadedcat" )] + public sealed class TFHCFlipBookUVAnimation : ParentNode + + { + + private const string TextureVerticalDirectionStr = "Texture Direction"; + private const string NegativeSpeedBehaviorStr = "If Negative Speed"; + + [SerializeField] + private int m_selectedTextureVerticalDirection = 0; + + [SerializeField] + private int m_negativeSpeedBehavior = 0; + + [SerializeField] + private readonly string[] m_textureVerticalDirectionValues = { "Top To Bottom", "Bottom To Top" }; + + [SerializeField] + private readonly string[] m_negativeSpeedBehaviorValues = { "Switch to Positive", "Reverse Animation" }; + + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); + AddInputPort( WirePortDataType.FLOAT, false, "Columns" ); + AddInputPort( WirePortDataType.FLOAT, false, "Rows" ); + AddInputPort( WirePortDataType.FLOAT, false, "Speed" ); + AddInputPort( WirePortDataType.FLOAT, false, "Start Frame" ); + AddInputPort( WirePortDataType.FLOAT, false, "Time" ); + AddInputPort( WirePortDataType.FLOAT, false, "Max Frame" ); + + m_inputPorts[ 6 ].FloatInternalData = -1; + + AddOutputVectorPorts( WirePortDataType.FLOAT2, "UV" ); + m_outputPorts[ 1 ].Name = "U"; + m_outputPorts[ 2 ].Name = "V"; + + AddOutputPort( WirePortDataType.INT, "Frame" ); + + m_textLabelWidth = 125; + m_useInternalPortData = true; + m_autoWrapProperties = true; + m_previewShaderGUID = "04fe24be792bfd5428b92132d7cf0f7d"; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + if( portId == 5 ) + { + m_previewMaterialPassId = 1; + } + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + if( portId == 5 ) + { + m_previewMaterialPassId = 0; + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUILayout.BeginVertical(); + m_selectedTextureVerticalDirection = EditorGUILayoutPopup( TextureVerticalDirectionStr, m_selectedTextureVerticalDirection, m_textureVerticalDirectionValues ); + m_negativeSpeedBehavior = EditorGUILayoutPopup( NegativeSpeedBehaviorStr, m_negativeSpeedBehavior, m_negativeSpeedBehaviorValues ); + EditorGUILayout.EndVertical(); + EditorGUILayout.HelpBox( "Flipbook UV Animation:\n\n - UV: Texture Coordinates to Flipbook.\n - Columns: number of Columns (X) of the Flipbook Texture.\n - Rows: number of Rows (Y) of the Flipbook Textures.\n - Speed: speed of the animation.\n - Texture Direction: set the vertical order of the texture tiles.\n - If Negative Speed: set the behavior when speed is negative.\n\n - Out: UV Coordinates.", MessageType.None ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_selectedTextureVerticalDirection = ( int ) int.Parse( GetCurrentParam( ref nodeParams ) ); + m_negativeSpeedBehavior = ( int ) int.Parse( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedTextureVerticalDirection ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_negativeSpeedBehavior ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + // OPTIMIZATION NOTES + // + // round( fmod( x, y ) ) can be replaced with a faster + // floor( frac( x / y ) * y + 0.5 ) => div can be muls with 1/y, almost always static/constant + // + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + string uv = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string columns = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + + if ( !m_inputPorts[ 1 ].IsConnected ) + columns = ( float.Parse( columns ) == 0f ? "1" : columns ); + + string rows = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + if ( !m_inputPorts[ 2 ].IsConnected ) + rows = ( float.Parse( rows ) == 0f ? "1" : rows ); + + string speed = m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ); + string startframe = m_inputPorts[ 4 ].GeneratePortInstructions( ref dataCollector ); + string timer = m_inputPorts[ 5 ].IsConnected ? m_inputPorts[ 5 ].GeneratePortInstructions( ref dataCollector ) : "_Time[ 1 ]"; + + string vcomment1 = "// *** BEGIN Flipbook UV Animation vars ***"; + string vcomment2 = "// Total tiles of Flipbook Texture"; + string vtotaltiles; + if ( m_inputPorts[ 6 ].IsConnected || m_inputPorts[ 6 ].FloatInternalData >= 0 ) // MaxFrame + { + string maxframe = m_inputPorts[ 6 ].GeneratePortInstructions( ref dataCollector ); + vtotaltiles = "float fbtotaltiles" + OutputId + " = min( " + columns + " * " + rows + ", " + maxframe + " + 1 );"; + } + else + { + vtotaltiles = "float fbtotaltiles" + OutputId + " = " + columns + " * " + rows + ";"; + } + + string vcomment3 = "// Offsets for cols and rows of Flipbook Texture"; + string vcolsoffset = "float fbcolsoffset" + OutputId + " = 1.0f / " + columns + ";"; + string vrowssoffset = "float fbrowsoffset" + OutputId + " = 1.0f / " + rows + ";"; + string vcomment4 = "// Speed of animation"; + + string vspeed = string.Format( "float fbspeed{0} = {1} * {2};", OutputId,timer,speed); + string vcomment5 = "// UV Tiling (col and row offset)"; + string vtiling = "float2 fbtiling" + OutputId + " = float2(fbcolsoffset" + OutputId + ", fbrowsoffset" + OutputId + ");"; + string vcomment6 = "// UV Offset - calculate current tile linear index, and convert it to (X * coloffset, Y * rowoffset)"; + string vcomment7 = "// Calculate current tile linear index"; + //float fbcurrenttileindex1 = round( fmod( fbspeed1 + _Float0, fbtotaltiles1 ) ); + string vcurrenttileindex = "float fbcurrenttileindex" + OutputId + " = floor( fmod( fbspeed" + OutputId + " + " + startframe + ", fbtotaltiles" + OutputId + ") );"; + string vcurrenttileindex1 = "fbcurrenttileindex" + OutputId + " += ( fbcurrenttileindex" + OutputId + " < 0) ? fbtotaltiles" + OutputId + " : 0;"; + //fbcurrenttileindex1 += ( fbcurrenttileindex1 < 0 ) ? fbtotaltiles1 : 0; + //string vcurrenttileindex = "int fbcurrenttileindex" + m_uniqueId + " = (int)fmod( fbspeed" + m_uniqueId + ", fbtotaltiles" + m_uniqueId + ") + " + startframe + ";"; + string vcomment8 = "// Obtain Offset X coordinate from current tile linear index"; + + //float fblinearindextox1 = round( fmod( fbcurrenttileindex1, 5.0 ) ); + //string voffsetx1 = "int fblinearindextox" + m_uniqueId + " = fbcurrenttileindex" + m_uniqueId + " % (int)" + columns + ";"; + string voffsetx1 = "float fblinearindextox" + OutputId + " = round ( fmod ( fbcurrenttileindex" + OutputId + ", " + columns + " ) );"; + string vcomment9 = String.Empty; + string voffsetx2 = String.Empty; + if ( m_negativeSpeedBehavior != 0 ) + { + vcomment9 = "// Reverse X animation if speed is negative"; + voffsetx2 = "fblinearindextox" + OutputId + " = (" + speed + " > 0 ? fblinearindextox" + OutputId + " : (int)" + columns + " - fblinearindextox" + OutputId + ");"; + } + string vcomment10 = "// Multiply Offset X by coloffset"; + string voffsetx3 = "float fboffsetx" + OutputId + " = fblinearindextox" + OutputId + " * fbcolsoffset" + OutputId + ";"; + string vcomment11 = "// Obtain Offset Y coordinate from current tile linear index"; + //float fblinearindextoy1 = round( fmod( ( fbcurrenttileindex1 - fblinearindextox1 ) / 5.0, 5.0 ) ); + string voffsety1 = "float fblinearindextoy" + OutputId + " = round( fmod( ( fbcurrenttileindex" + OutputId + " - fblinearindextox" + OutputId + " ) / " + columns + ", " + rows + " ) );"; + //string voffsety1 = "int fblinearindextoy" + m_uniqueId + " = (int)( ( fbcurrenttileindex" + m_uniqueId + " - fblinearindextox" + m_uniqueId + " ) / " + columns + " ) % (int)" + rows + ";"; + //string vcomment10 = "// Reverse Y to get from Top to Bottom"; + //string voffsety2 = "fblinearindextoy" + m_uniqueId + " = (int)" + rows + " - fblinearindextoy" + m_uniqueId + ";"; + string vcomment12 = String.Empty; + string voffsety2 = String.Empty; + if ( m_negativeSpeedBehavior == 0 ) + { + if ( m_selectedTextureVerticalDirection == 0 ) + { + vcomment12 = "// Reverse Y to get tiles from Top to Bottom"; + voffsety2 = "fblinearindextoy" + OutputId + " = (int)(" + rows + "-1) - fblinearindextoy" + OutputId + ";"; + } + } + else + { + string reverseanimationoperator = String.Empty; + if ( m_selectedTextureVerticalDirection == 0 ) + { + vcomment12 = "// Reverse Y to get tiles from Top to Bottom and Reverse Y animation if speed is negative"; + reverseanimationoperator = " < "; + } + else + { + vcomment12 = "// Reverse Y animation if speed is negative"; + reverseanimationoperator = " > "; + } + voffsety2 = "fblinearindextoy" + OutputId + " = (" + speed + reverseanimationoperator + " 0 ? fblinearindextoy" + OutputId + " : (int)" + rows + " - fblinearindextoy" + OutputId + ");"; + } + string vcomment13 = "// Multiply Offset Y by rowoffset"; + string voffsety3 = "float fboffsety" + OutputId + " = fblinearindextoy" + OutputId + " * fbrowsoffset" + OutputId + ";"; + string vcomment14 = "// UV Offset"; + string voffset = "float2 fboffset" + OutputId + " = float2(fboffsetx" + OutputId + ", fboffsety" + OutputId + ");"; + //string voffset = "float2 fboffset" + m_uniqueId + " = float2( ( ( (int)fmod( fbspeed" + m_uniqueId + " , fbtotaltiles" + m_uniqueId + ") % (int)" + columns + " ) * fbcolsoffset" + m_OutputId + " ) , ( ( (int)" + rows + " - ( (int)( ( (int)fmod( fbspeed" + m_uniqueId + " , fbtotaltiles" + m_uniqueId + " ) - ( (int)fmod( fbspeed" + m_uniqueId + " , fbtotaltiles" + m_uniqueId + " ) % (int)" + columns + " ) ) / " + columns + " ) % (int)" + rows + " ) ) * fbrowsoffset" + m_uniqueId + " ) );"; + string vcomment15 = "// Flipbook UV"; + string vfbuv = "half2 fbuv" + OutputId + " = " + uv + " * fbtiling" + OutputId + " + fboffset" + OutputId + ";"; + string vcomment16 = "// *** END Flipbook UV Animation vars ***"; + string result = "fbuv" + OutputId; + + dataCollector.AddLocalVariable( UniqueId, vcomment1 ); + dataCollector.AddLocalVariable( UniqueId, vcomment2 ); + dataCollector.AddLocalVariable( UniqueId, vtotaltiles ); + dataCollector.AddLocalVariable( UniqueId, vcomment3 ); + dataCollector.AddLocalVariable( UniqueId, vcolsoffset ); + dataCollector.AddLocalVariable( UniqueId, vrowssoffset ); + dataCollector.AddLocalVariable( UniqueId, vcomment4 ); + dataCollector.AddLocalVariable( UniqueId, vspeed ); + dataCollector.AddLocalVariable( UniqueId, vcomment5 ); + dataCollector.AddLocalVariable( UniqueId, vtiling ); + dataCollector.AddLocalVariable( UniqueId, vcomment6 ); + dataCollector.AddLocalVariable( UniqueId, vcomment7 ); + dataCollector.AddLocalVariable( UniqueId, vcurrenttileindex ); + dataCollector.AddLocalVariable( UniqueId, vcurrenttileindex1 ); + dataCollector.AddLocalVariable( UniqueId, vcomment8 ); + dataCollector.AddLocalVariable( UniqueId, voffsetx1 ); + if ( m_negativeSpeedBehavior != 0 ) + { + dataCollector.AddLocalVariable( UniqueId, vcomment9 ); + dataCollector.AddLocalVariable( UniqueId, voffsetx2 ); + } + dataCollector.AddLocalVariable( UniqueId, vcomment10 ); + dataCollector.AddLocalVariable( UniqueId, voffsetx3 ); + dataCollector.AddLocalVariable( UniqueId, vcomment11 ); + dataCollector.AddLocalVariable( UniqueId, voffsety1 ); + if ( m_selectedTextureVerticalDirection == 0 || m_negativeSpeedBehavior != 0 ) + { + dataCollector.AddLocalVariable( UniqueId, vcomment12 ); + dataCollector.AddLocalVariable( UniqueId, voffsety2 ); + } + dataCollector.AddLocalVariable( UniqueId, vcomment13 ); + dataCollector.AddLocalVariable( UniqueId, voffsety3 ); + dataCollector.AddLocalVariable( UniqueId, vcomment14 ); + dataCollector.AddLocalVariable( UniqueId, voffset ); + dataCollector.AddLocalVariable( UniqueId, vcomment15 ); + dataCollector.AddLocalVariable( UniqueId, vfbuv ); + dataCollector.AddLocalVariable( UniqueId, vcomment16 ); + + string frame = "int flipbookFrame" + OutputId + " = ( ( int )fbcurrenttileindex" + OutputId + ");"; + dataCollector.AddLocalVariable( UniqueId, frame ); + + m_outputPorts[ 0 ].SetLocalValue( result, dataCollector.PortCategory ); + m_outputPorts[ 3 ].SetLocalValue( "flipbookFrame" + OutputId, dataCollector.PortCategory ); + + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs.meta new file mode 100644 index 00000000..d0b3f07d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 38b8c76e7f2dc294581195a669942706 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs new file mode 100644 index 00000000..3d778d9c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs @@ -0,0 +1,54 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Pixelate UV +// Donated by The Four Headed Cat - @fourheadedcat + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Pixelate UV", "UV Coordinates", "Pixelate Texture Modifying UV.", null, KeyCode.None, true, false, null, null, "The Four Headed Cat - @fourheadedcat" )] + public sealed class TFHCPixelate : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT2, true, "UV" ); + AddInputPort( WirePortDataType.FLOAT, false, "Pixels X" ); + AddInputPort( WirePortDataType.FLOAT, false, "Pixels Y" ); + AddOutputPort( WirePortDataType.FLOAT2, "Out" ); + m_useInternalPortData = true; + m_previewShaderGUID = "e2f7e3c513ed18340868b8cbd0d85cfb"; + } + + public override void DrawProperties() + { + base.DrawProperties (); + EditorGUILayout.HelpBox ("Pixelate UV.\n\n - UV is the Texture Coordinates to pixelate.\n - Pixels X is the number of horizontal pixels\n - Pixels Y is the number of vertical pixels.", MessageType.None); + + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + string uv = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + string PixelCount_X = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); + string PixelCount_Y = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); + + string pixelWidth = "float pixelWidth" + OutputId + " = 1.0f / " + PixelCount_X + ";"; + string pixelHeight = "float pixelHeight" + OutputId + " = 1.0f / " + PixelCount_Y + ";"; + string pixelatedUV = "half2 pixelateduv" + OutputId + " = half2((int)(" + uv + ".x / pixelWidth" + OutputId + ") * pixelWidth" + OutputId + ", (int)(" + uv + ".y / pixelHeight" + OutputId + ") * pixelHeight" + OutputId + ");"; + string result = "pixelateduv" + OutputId; + + dataCollector.AddLocalVariable( UniqueId, pixelWidth ); + dataCollector.AddLocalVariable( UniqueId, pixelHeight ); + dataCollector.AddLocalVariable( UniqueId, pixelatedUV ); + + return GetOutputVectorItem( 0, outputId, result); + + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs.meta new file mode 100644 index 00000000..c07c3b55 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 72a1a810ace8ea440ba20d4a4f9086ce +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs new file mode 100644 index 00000000..fb97426a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs @@ -0,0 +1,633 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Texture Coordinates", "UV Coordinates", "Texture UV coordinates set, if Tex is connected to a texture object it will use that texture scale factors, otherwise uses Tilling and Offset port values", null, KeyCode.U, tags: "uv" )] + public sealed class TextureCoordinatesNode : ParentNode + { + + private const string DummyPropertyDec = "[HideInInspector] _DummyTex{0}( \"\", 2D ) = \"white\""; + private const string DummyUniformDec = "uniform sampler2D _DummyTex{0};"; + private const string DummyTexCoordDef = "uv{0}_DummyTex{0}"; + private const string DummyTexCoordSurfDef = "float2 texCoordDummy{0} = {1}.uv{2}_DummyTex{2}*{3} + {4};"; + private const string DummyTexCoordSurfVar = "texCoordDummy{0}"; + + private readonly string[] Dummy = { string.Empty }; + + private const string TilingStr = "Tiling"; + private const string OffsetStr = "Offset"; + private const string TexCoordStr = "texcoord_"; + + [SerializeField] + private int m_referenceArrayId = -1; + + [SerializeField] + private int m_referenceNodeId = -1; + + [SerializeField] + private int m_textureCoordChannel = 0; + + //[SerializeField] + //private int m_texcoordId = -1; + + [SerializeField] + private int m_texcoordSize = 2; + + [SerializeField] + private string m_surfaceTexcoordName = string.Empty; + + [SerializeField] + private TexturePropertyNode m_inputReferenceNode = null; + + private Vector4Node m_texCoordsHelper; + + private TexturePropertyNode m_referenceNode = null; + + private InputPort m_texPort = null; + private InputPort m_tilingPort = null; + private InputPort m_offsetPort = null; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.SAMPLER2D, false, "Tex", -1, MasterNodePortCategory.Fragment, 2 ); + m_texPort = m_inputPorts[ m_inputPorts.Count - 1 ]; + m_texPort.CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.SAMPLER2DARRAY, WirePortDataType.OBJECT ); + + AddInputPort( WirePortDataType.FLOAT2, false, "Tiling", -1, MasterNodePortCategory.Fragment, 0 ); + m_tilingPort = m_inputPorts[ m_inputPorts.Count - 1 ]; + m_tilingPort.Vector2InternalData = new Vector2( 1, 1 ); + AddInputPort( WirePortDataType.FLOAT2, false, "Offset", -1, MasterNodePortCategory.Fragment, 1 ); + m_offsetPort = m_inputPorts[ m_inputPorts.Count - 1 ]; + + + AddOutputVectorPorts( WirePortDataType.FLOAT2, "UV" ); + m_outputPorts[ 1 ].Name = "U"; + m_outputPorts[ 2 ].Name = "V"; + AddOutputPort( WirePortDataType.FLOAT, "W" ); + AddOutputPort( WirePortDataType.FLOAT, "T" ); + m_textLabelWidth = 90; + m_useInternalPortData = true; + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + m_tilingPort.Category = MasterNodePortCategory.Vertex; + m_offsetPort.Category = MasterNodePortCategory.Vertex; + UpdateOutput(); + m_previewShaderGUID = "085e462b2de441a42949be0e666cf5d2"; + } + + public override void Reset() + { + m_surfaceTexcoordName = string.Empty; + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + if( portId == 2 ) + { + m_texPort.MatchPortToConnection(); + m_inputReferenceNode = m_texPort.GetOutputNodeWhichIsNotRelay() as TexturePropertyNode; + UpdatePorts(); + } + UpdateTitle(); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + if( portId == 2 ) + { + m_inputReferenceNode = null; + UpdatePorts(); + } + UpdateTitle(); + } + + public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); + if( portId == 2 ) + { + m_texPort.MatchPortToConnection(); + UpdateTitle(); + } + } + + void UpdateTitle() + { + if( m_inputReferenceNode != null ) + { + m_additionalContent.text = string.Format( "Value( {0} )", m_inputReferenceNode.PropertyInspectorName ); + } + else if( m_referenceArrayId > -1 && m_referenceNode != null ) + { + m_additionalContent.text = string.Format( "Value( {0} )", m_referenceNode.PropertyInspectorName ); + } + else + { + m_additionalContent.text = string.Empty; + } + m_sizeIsDirty = true; + } + + void UpdatePorts() + { + if( m_inputReferenceNode != null || m_texPort.IsConnected ) + { + m_tilingPort.Locked = true; + m_offsetPort.Locked = true; + } + else if( m_referenceArrayId > -1 ) + { + m_tilingPort.Locked = true; + m_offsetPort.Locked = true; + } + else + { + m_tilingPort.Locked = false; + m_offsetPort.Locked = false; + } + } + + public override void DrawProperties() + { + bool guiEnabledBuffer = GUI.enabled; + + EditorGUI.BeginChangeCheck(); + List arr = new List( UIUtils.TexturePropertyNodeArr() ); + if( arr != null && arr.Count > 0 ) + { + arr.Insert( 0, "None" ); + GUI.enabled = true && ( !m_texPort.IsConnected ); + m_referenceArrayId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceArrayId + 1, arr.ToArray() ) - 1; + } + else + { + m_referenceArrayId = -1; + GUI.enabled = false; + EditorGUILayoutPopup( Constants.AvailableReferenceStr, 0, Dummy ); + } + + GUI.enabled = guiEnabledBuffer; + if( EditorGUI.EndChangeCheck() ) + { + m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceArrayId ); + if( m_referenceNode != null ) + { + m_referenceNodeId = m_referenceNode.UniqueId; + } + else + { + m_referenceNodeId = -1; + m_referenceArrayId = -1; + } + + UpdateTitle(); + UpdatePorts(); + } + + EditorGUI.BeginChangeCheck(); + m_texcoordSize = EditorGUILayoutIntPopup( Constants.AvailableUVSizesLabel, m_texcoordSize, Constants.AvailableUVSizesStr, Constants.AvailableUVSizes ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateOutput(); + } + + m_textureCoordChannel = EditorGUILayoutIntPopup( Constants.AvailableUVSetsLabel, m_textureCoordChannel, Constants.AvailableUVSetsStr, Constants.AvailableUVSets ); + + + if( m_referenceArrayId > -1 ) + GUI.enabled = false; + + base.DrawProperties(); + + GUI.enabled = guiEnabledBuffer; + } + + private void UpdateOutput() + { + if( m_texcoordSize == 3 ) + { + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_outputPorts[ 0 ].Name = "UVW"; + m_outputPorts[ 3 ].Visible = true; + m_outputPorts[ 4 ].Visible = false; + } + else if( m_texcoordSize == 4 ) + { + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_outputPorts[ 0 ].Name = "UVWT"; + m_outputPorts[ 3 ].Visible = true; + m_outputPorts[ 4 ].Visible = true; + } + else + { + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); + m_outputPorts[ 0 ].Name = "UV"; + m_outputPorts[ 3 ].Visible = false; + m_outputPorts[ 4 ].Visible = false; + } + m_sizeIsDirty = true; + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + CheckReference(); + } + + //public override void Draw( DrawInfo drawInfo ) + //{ + // base.Draw( drawInfo ); + // //CheckReference(); + //} + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( m_dropdownEditing ) + { + EditorGUI.BeginChangeCheck(); + m_texcoordSize = EditorGUIIntPopup( m_dropdownRect, m_texcoordSize, Constants.AvailableUVSizesStr, Constants.AvailableUVSizes, UIUtils.PropertyPopUp ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateOutput(); + DropdownEditing = false; + } + } + } + + void CheckReference() + { + if( m_referenceArrayId > -1 ) + { + ParentNode newNode = UIUtils.GetTexturePropertyNode( m_referenceArrayId ); + if( newNode == null || newNode.UniqueId != m_referenceNodeId ) + { + m_referenceNode = null; + int count = UIUtils.GetTexturePropertyNodeAmount(); + for( int i = 0; i < count; i++ ) + { + ParentNode node = UIUtils.GetTexturePropertyNode( i ); + if( node.UniqueId == m_referenceNodeId ) + { + m_referenceNode = node as TexturePropertyNode; + m_referenceArrayId = i; + break; + } + } + } + } + + if( m_referenceNode == null && m_referenceNodeId > -1 ) + { + m_referenceNodeId = -1; + m_referenceArrayId = -1; + UpdateTitle(); + UpdatePorts(); + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_textureCoordChannel = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 2402 ) + { + if( UIUtils.CurrentShaderVersion() > 2404 ) + { + m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + else + { + m_referenceArrayId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + } + + if( UIUtils.CurrentShaderVersion() > 5001 ) + { + m_texcoordSize = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + UpdateOutput(); + } + } + + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + if( UIUtils.CurrentShaderVersion() > 2402 ) + { + if( UIUtils.CurrentShaderVersion() > 2404 ) + { + m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as TexturePropertyNode; + if( m_referenceNodeId > -1 ) + m_referenceArrayId = UIUtils.GetTexturePropertyNodeRegisterId( m_referenceNodeId ); + } + else + { + m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceArrayId ); + if( m_referenceNode != null ) + { + m_referenceNodeId = m_referenceNode.UniqueId; + } + } + UpdateTitle(); + UpdatePorts(); + } + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + if( dataCollector != null && dataCollector.TesselationActive ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + return; + } + + if( dataCollector.IsTemplate ) + { + dataCollector.TemplateDataCollectorInstance.SetUVUsage( m_textureCoordChannel , m_texcoordSize ); + } + else + { + dataCollector.SetTextureChannelSize( m_textureCoordChannel , m_outputPorts[0].DataType ); + + if( m_textureCoordChannel > 3 ) + { + dataCollector.AddCustomAppData( string.Format( TemplateHelperFunctions.TexUVFullSemantic , m_textureCoordChannel ) ); + } + } + UIUtils.SetCategoryInBitArray( ref m_category, nodeData.Category ); + + MasterNodePortCategory propagateCategory = ( nodeData.Category != MasterNodePortCategory.Vertex && nodeData.Category != MasterNodePortCategory.Tessellation ) ? MasterNodePortCategory.Vertex : nodeData.Category; + nodeData.Category = propagateCategory; + nodeData.GraphDepth += 1; + if( nodeData.GraphDepth > m_graphDepth ) + { + m_graphDepth = nodeData.GraphDepth; + } + + int count = m_inputPorts.Count; + for( int i = 0; i < count; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + //m_inputPorts[ i ].GetOutputNode().PropagateNodeCategory( category ); + m_inputPorts[ i ].GetOutputNode().PropagateNodeData( nodeData, ref dataCollector ); + } + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_textureCoordChannel ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( ( m_referenceNode != null ) ? m_referenceNode.UniqueId : -1 ) ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_texcoordSize ); + } + + string GetValidPropertyName() + { + string propertyName = string.Empty; + if( m_inputReferenceNode != null ) + { + propertyName = m_inputReferenceNode.PropertyName; + } + else if( m_referenceArrayId > -1 ) + { + m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceArrayId ); + if( m_referenceNode != null ) + { + propertyName = m_referenceNode.PropertyName; + } + } + + return propertyName; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " cannot be used on Master Node Tessellation port" ); + return "-1"; + } + + //bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ); + + string tiling = string.Empty; + string offset = string.Empty; + + string portProperty = string.Empty; + if( m_texPort.IsConnected ) + { + portProperty = m_texPort.GeneratePortInstructions( ref dataCollector ); + } + else if( m_referenceArrayId > -1 ) + { + TexturePropertyNode temp = UIUtils.GetTexturePropertyNode( m_referenceArrayId ); + if( temp != null ) + { + portProperty = temp.BaseGenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); + } + } + + //TEMPLATES + if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + string uvName = string.Empty; + string result = string.Empty; + string indexStr = m_textureCoordChannel > 0 ? ( m_textureCoordChannel + 1 ).ToString() : ""; + string sizeDif = string.Empty; + if( m_texcoordSize == 3 ) + sizeDif = "3"; + else if( m_texcoordSize == 4 ) + sizeDif = "4"; + + if( dataCollector.TemplateDataCollectorInstance.GetCustomInterpolatedData( TemplateHelperFunctions.IntToUVChannelInfo[ m_textureCoordChannel ], m_outputPorts[ 0 ].DataType, PrecisionType.Float, ref result, false, dataCollector.PortCategory ) ) + { + uvName = result; + } + else if( dataCollector.TemplateDataCollectorInstance.HasUV( m_textureCoordChannel ) ) + { + uvName = dataCollector.TemplateDataCollectorInstance.GetUVName( m_textureCoordChannel, m_outputPorts[ 0 ].DataType ); + } + else + { + uvName = dataCollector.TemplateDataCollectorInstance.RegisterUV( m_textureCoordChannel, m_outputPorts[ 0 ].DataType ); + } + string currPropertyName = GetValidPropertyName(); + if( !string.IsNullOrEmpty( portProperty ) && portProperty != "0.0" ) + { + currPropertyName = portProperty; + } + if( !string.IsNullOrEmpty( currPropertyName ) ) + { + string finalTexCoordName = "uv" + indexStr + ( m_texcoordSize > 2 ? "s" + sizeDif : "" ) + currPropertyName; + string dummyPropertyTexcoords = currPropertyName + "_ST"; + + if( m_texCoordsHelper == null ) + { + m_texCoordsHelper = CreateInstance(); + m_texCoordsHelper.ContainerGraph = ContainerGraph; + m_texCoordsHelper.SetBaseUniqueId( UniqueId, true ); + m_texCoordsHelper.RegisterPropertyOnInstancing = false; + m_texCoordsHelper.AddGlobalToSRPBatcher = true; + } + + if( UIUtils.CurrentWindow.OutsideGraph.IsInstancedShader ) + { + m_texCoordsHelper.CurrentParameterType = PropertyType.InstancedProperty; + } + else + { + m_texCoordsHelper.CurrentParameterType = PropertyType.Global; + } + m_texCoordsHelper.ResetOutputLocals(); + m_texCoordsHelper.SetRawPropertyName( dummyPropertyTexcoords ); + dummyPropertyTexcoords = m_texCoordsHelper.GenerateShaderForOutput( 0, ref dataCollector, false ); + + if( m_texcoordSize > 2 ) + { + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, finalTexCoordName, uvName ); + dataCollector.AddLocalVariable( UniqueId, finalTexCoordName + ".xy", string.Format( Constants.TilingOffsetFormat, uvName + ".xy", dummyPropertyTexcoords + ".xy", dummyPropertyTexcoords + ".zw" ) + ";" ); + m_outputPorts[ 0 ].SetLocalValue( finalTexCoordName, dataCollector.PortCategory ); + } + else + { + RegisterLocalVariable( 0, string.Format( Constants.TilingOffsetFormat, uvName, dummyPropertyTexcoords + ".xy", dummyPropertyTexcoords + ".zw" ), ref dataCollector, finalTexCoordName ); + } + //RegisterLocalVariable( 0, string.Format( Constants.TilingOffsetFormat, uvName, dummyPropertyTexcoords+".xy", dummyPropertyTexcoords+".zw" ), ref dataCollector, finalTexCoordName ); + } + else + { + string finalTexCoordName = "texCoord" + OutputId; + tiling = m_tilingPort.GeneratePortInstructions( ref dataCollector ); + offset = m_offsetPort.GeneratePortInstructions( ref dataCollector ); + + if( m_texcoordSize > 2 ) + { + dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, finalTexCoordName, uvName ); + dataCollector.AddLocalVariable( UniqueId, finalTexCoordName + ".xy", string.Format( Constants.TilingOffsetFormat, uvName + ".xy", tiling, offset ) + ";" ); + m_outputPorts[ 0 ].SetLocalValue( finalTexCoordName, dataCollector.PortCategory ); + } + else + { + RegisterLocalVariable( 0, string.Format( Constants.TilingOffsetFormat, uvName, tiling, offset ), ref dataCollector, finalTexCoordName ); + } + //RegisterLocalVariable( 0, string.Format( Constants.TilingOffsetFormat, uvName, tiling, offset ), ref dataCollector, finalTexCoordName ); + } + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + + //SURFACE + string propertyName = GetValidPropertyName(); + if( !string.IsNullOrEmpty( portProperty ) && portProperty != "0.0" ) + { + propertyName = portProperty; + } + + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + + if( !m_tilingPort.IsConnected && m_tilingPort.Vector2InternalData == Vector2.one ) + tiling = null; + else + tiling = m_tilingPort.GeneratePortInstructions( ref dataCollector ); + + if( !m_offsetPort.IsConnected && m_offsetPort.Vector2InternalData == Vector2.zero ) + offset = null; + else + offset = m_offsetPort.GeneratePortInstructions( ref dataCollector ); + + if( !string.IsNullOrEmpty( propertyName ) /*m_referenceArrayId > -1*/ ) + { + m_surfaceTexcoordName = GeneratorUtils.GenerateAutoUVs( ref dataCollector, UniqueId, m_textureCoordChannel, propertyName, m_outputPorts[ 0 ].DataType, tiling, offset, OutputId ); + } + else + { + m_surfaceTexcoordName = GeneratorUtils.GenerateAutoUVs( ref dataCollector, UniqueId, m_textureCoordChannel, null, m_outputPorts[ 0 ].DataType, tiling, offset, OutputId ); + } + + m_outputPorts[ 0 ].SetLocalValue( m_surfaceTexcoordName, dataCollector.PortCategory ); + return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); + } + + public override void ReadInputDataFromString( ref string[] nodeParams ) + { + if( UIUtils.CurrentShaderVersion() > 7003 ) + { + base.ReadInputDataFromString( ref nodeParams ); + } + else + { + for( int i = 0; i < 2 && i < nodeParams.Length && m_currentReadParamIdx < nodeParams.Length; i++ ) + { + if( UIUtils.CurrentShaderVersion() < 5003 ) + { + int newId = VersionConvertInputPortId( i ) + 1; + if( UIUtils.CurrentShaderVersion() > 23 ) + { + m_inputPorts[ newId ].DataType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), nodeParams[ m_currentReadParamIdx++ ] ); + } + + m_inputPorts[ newId ].InternalData = nodeParams[ m_currentReadParamIdx++ ]; + if( m_inputPorts[ newId ].IsEditable && UIUtils.CurrentShaderVersion() >= 3100 && m_currentReadParamIdx < nodeParams.Length ) + { + m_inputPorts[ newId ].Name = nodeParams[ m_currentReadParamIdx++ ]; + } + } + else + { + int portId = Convert.ToInt32( nodeParams[ m_currentReadParamIdx++ ] ); + WirePortDataType DataType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), nodeParams[ m_currentReadParamIdx++ ] ); + string InternalData = nodeParams[ m_currentReadParamIdx++ ]; + bool isEditable = Convert.ToBoolean( nodeParams[ m_currentReadParamIdx++ ] ); + string Name = string.Empty; + if( isEditable && m_currentReadParamIdx < nodeParams.Length ) + { + Name = nodeParams[ m_currentReadParamIdx++ ]; + } + + InputPort inputPort = GetInputPortByUniqueId( portId ); + if( inputPort != null ) + { + inputPort.DataType = DataType; + inputPort.InternalData = InternalData; + if( !string.IsNullOrEmpty( Name ) ) + { + inputPort.Name = Name; + } + } + } + } + } + } + + public override void Destroy() + { + base.Destroy(); + m_referenceNode = null; + + if( m_texCoordsHelper != null ) + { + //Not calling m_texCoordsHelper.Destroy() on purpose so UIUtils does not incorrectly unregister stuff + DestroyImmediate( m_texCoordsHelper ); + m_texCoordsHelper = null; + } + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs.meta new file mode 100644 index 00000000..edeb24a7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 872b1da17041cd64482c826cbfd9c8c6 +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs new file mode 100644 index 00000000..7946d46f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs @@ -0,0 +1,1115 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + public enum TexturePropertyValues + { + white, + black, + gray, + bump, + linearGrey, + red + } + + public enum TextureType + { + Texture1D, + Texture2D, + Texture3D, + Cube, + Texture2DArray, + ProceduralTexture + } + + public enum AutoCastType + { + Auto = 0, + LockedToTexture1D, + LockedToTexture2D, + LockedToTexture3D, + LockedToCube, + LockedToTexture2DArray + } + + + [Serializable] + [NodeAttributes( "Texture Object", "Textures", "Represents a Texture Asset. Can be used in samplers Tex inputs or shader function inputs to reuse the same texture multiple times.", SortOrderPriority = 1 )] + public class TexturePropertyNode : PropertyNode + { + private const string ObjectSelectorCmdStr = "ObjectSelectorClosed"; + + protected readonly string[] AvailablePropertyTypeLabels = { PropertyType.Property.ToString(), PropertyType.Global.ToString() }; + protected readonly int[] AvailablePropertyTypeValues = { (int)PropertyType.Property, (int)PropertyType.Global }; + + protected const int OriginalFontSizeUpper = 9; + protected const int OriginalFontSizeLower = 9; + + protected const string DefaultTextureStr = "Default Texture"; + protected const string AutoCastModeStr = "Auto-Cast Mode"; + + protected const string AutoUnpackNormalsStr = "Normal"; + + [SerializeField] + protected Texture m_defaultValue; + + [SerializeField] + protected Texture m_materialValue; + + [SerializeField] + protected TexturePropertyValues m_defaultTextureValue; + + [SerializeField] + protected bool m_isNormalMap; + + [SerializeField] + protected System.Type m_textureType = typeof( Texture2D ); + + [SerializeField] + protected int m_useSamplerArrayIdx = -1; + + //[SerializeField] + //protected bool m_isTextureFetched; + + //[SerializeField] + //protected string m_textureFetchedValue; + + [SerializeField] + protected TextureType m_currentType = TextureType.Texture2D; + + [SerializeField] + protected AutoCastType m_autocastMode = AutoCastType.Auto; + + protected int PreviewSizeX = 128; + protected int PreviewSizeY = 128; + + protected bool m_linearTexture; + + protected TexturePropertyNode m_textureProperty = null; + + protected bool m_drawPicker; + + protected bool m_drawAutocast = true; + + protected int m_cachedSamplerId = -1; + protected int m_cachedSamplerIdArray = -1; + protected int m_cachedSamplerIdCube = -1; + protected int m_cachedSamplerId3D = -1; + protected int m_defaultId = -1; + protected int m_typeId = -1; + + private TextureType m_previousType = TextureType.Texture2D; + private string m_labelText = "None (Texture2D)"; + + protected bool m_isEditingPicker; + + protected bool m_forceSamplingMacrosGen = false; + + public TexturePropertyNode() : base() { } + public TexturePropertyNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Texture" ); + m_defaultTextureValue = TexturePropertyValues.white; + m_insideSize.Set( PreviewSizeX, PreviewSizeY + 5 ); + AddOutputPort( WirePortDataType.SAMPLER2D, "Tex" ); + AddOutputPort( WirePortDataType.SAMPLERSTATE, "SS" ); + m_outputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.SAMPLER2DARRAY, WirePortDataType.OBJECT ); + m_currentParameterType = PropertyType.Property; + m_customPrefix = "Texture "; + m_drawPrecisionUI = false; + m_showVariableMode = true; + m_freeType = false; + m_drawPicker = true; + m_hasLeftDropdown = true; + m_textLabelWidth = 115; + m_longNameSize = 225; + m_availableAttribs.Add( new PropertyAttributes( "No Scale Offset", "[NoScaleOffset]" ) ); + m_availableAttribs.Add( new PropertyAttributes( "Normal", "[Normal]" ) ); + m_availableAttribs.Add( new PropertyAttributes( "Single Line Texture", "[SingleLineTexture]" ) ); + m_showPreview = true; + m_drawPreviewExpander = false; + m_drawPreview = false; + m_drawPreviewMaskButtons = false; + m_previewShaderGUID = "e53988745ec6e034694ee2640cd3d372"; + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + m_hasLeftDropdown = true; + } + + protected void SetPreviewTexture( Texture newValue ) + { + if( newValue is Cubemap ) + { + PreviewMaterial.SetInt( m_typeId, 3 ); + + if( m_cachedSamplerIdCube == -1 ) + m_cachedSamplerIdCube = Shader.PropertyToID( "_Cube" ); + + PreviewMaterial.SetTexture( m_cachedSamplerIdCube, newValue as Cubemap ); + } + else if( newValue is Texture2DArray ) + { + PreviewMaterial.SetInt( m_typeId, 4 ); + + if( m_cachedSamplerIdArray == -1 ) + m_cachedSamplerIdArray = Shader.PropertyToID( "_Array" ); + + PreviewMaterial.SetTexture( m_cachedSamplerIdArray, newValue as Texture2DArray ); + } + else if( newValue is Texture3D ) + { + PreviewMaterial.SetInt( m_typeId, 2 ); + + if( m_cachedSamplerId3D == -1 ) + m_cachedSamplerId3D = Shader.PropertyToID( "_Sampler3D" ); + + PreviewMaterial.SetTexture( m_cachedSamplerId3D, newValue as Texture3D ); + } + else + { + PreviewMaterial.SetInt( m_typeId, 1 ); + + if( m_cachedSamplerId == -1 ) + m_cachedSamplerId = Shader.PropertyToID( "_Sampler" ); + + PreviewMaterial.SetTexture( m_cachedSamplerId, newValue ); + } + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + + if( Value == null ) + { + if( m_defaultId == -1 ) + m_defaultId = Shader.PropertyToID( "_Default" ); + + PreviewMaterial.SetInt( m_defaultId, ( (int)m_defaultTextureValue ) + 1 ); + m_previewMaterialPassId = 0; + } + else + { + if( m_defaultId == -1 ) + m_defaultId = Shader.PropertyToID( "_Default" ); + + PreviewMaterial.SetInt( m_defaultId, 0 ); + + if( m_typeId == -1 ) + m_typeId = Shader.PropertyToID( "_Type" ); + + m_previewMaterialPassId = 1; + SetPreviewTexture( Value ); + //if( Value is Cubemap ) + //{ + // PreviewMaterial.SetInt( m_typeId, 3 ); + + // if( m_cachedSamplerIdCube == -1 ) + // m_cachedSamplerIdCube = Shader.PropertyToID( "_Cube" ); + + // PreviewMaterial.SetTexture( m_cachedSamplerIdCube, Value as Cubemap ); + //} + //else if( Value is Texture2DArray ) + //{ + // PreviewMaterial.SetInt( m_typeId, 4 ); + + // if( m_cachedSamplerIdArray == -1 ) + // m_cachedSamplerIdArray = Shader.PropertyToID( "_Array" ); + + // PreviewMaterial.SetTexture( m_cachedSamplerIdArray, Value as Texture2DArray ); + //} + //else if( Value is Texture3D ) + //{ + // PreviewMaterial.SetInt( m_typeId, 2 ); + + // if( m_cachedSamplerId3D == -1 ) + // m_cachedSamplerId3D = Shader.PropertyToID( "_Sampler3D" ); + + // PreviewMaterial.SetTexture( m_cachedSamplerId3D, Value as Texture3D ); + //} + //else + //{ + // PreviewMaterial.SetInt( m_typeId, 1 ); + + // if( m_cachedSamplerId == -1 ) + // m_cachedSamplerId = Shader.PropertyToID( "_Sampler" ); + + // PreviewMaterial.SetTexture( m_cachedSamplerId, Value ); + //} + } + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + m_textureProperty = this; + UIUtils.RegisterPropertyNode( this ); + UIUtils.RegisterTexturePropertyNode( this ); + } + + protected void ConfigTextureData( TextureType type ) + { + switch( m_autocastMode ) + { + case AutoCastType.Auto: + { + m_currentType = type; + } + break; + case AutoCastType.LockedToTexture1D: + { + m_currentType = TextureType.Texture1D; + } + break; + case AutoCastType.LockedToTexture2DArray: + { + m_currentType = TextureType.Texture2DArray; + } + break; + case AutoCastType.LockedToTexture2D: + { + m_currentType = TextureType.Texture2D; + } + break; + case AutoCastType.LockedToTexture3D: + { + m_currentType = TextureType.Texture3D; + } + break; + case AutoCastType.LockedToCube: + { + m_currentType = TextureType.Cube; + } + break; + } + + ConfigTextureType(); + } + + protected void ConfigTextureType() + { + switch( m_currentType ) + { + case TextureType.Texture1D: + { + m_textureType = typeof( Texture ); + } + break; + case TextureType.Texture2DArray: + { + m_textureType = typeof( Texture2DArray ); + } + break; + case TextureType.Texture2D: + { + m_textureType = typeof( Texture2D ); + } + break; + case TextureType.Texture3D: + { + m_textureType = typeof( Texture3D ); + } + break; + case TextureType.Cube: + { + m_textureType = typeof( Cubemap ); + } + break; + } + } + + protected void DrawTexturePropertyType() + { + PropertyType parameterType = (PropertyType)EditorGUILayoutIntPopup( ParameterTypeStr, (int)m_currentParameterType, AvailablePropertyTypeLabels, AvailablePropertyTypeValues ); + if( parameterType != m_currentParameterType ) + { + ChangeParameterType( parameterType ); + } + } + + // Texture1D + public string GetTexture1DPropertyValue() + { + return PropertyName + "(\"" + m_propertyInspectorName + "\", 2D) = \"" + m_defaultTextureValue + "\" {}"; + } + + public string GetTexture1DUniformValue() + { + return "uniform sampler1D " + PropertyName + ";"; + } + + // Texture2D + public string GetTexture2DPropertyValue() + { + return PropertyName + "(\"" + m_propertyInspectorName + "\", 2D) = \"" + m_defaultTextureValue + "\" {}"; + } + + public string GetTexture2DUniformValue() + { + if( PropertyName == "_CameraDepthTexture" ) + return Constants.CameraDepthTextureValue; + else + return GeneratorUtils.GetPropertyDeclaraction( PropertyName, TextureType.Texture2D, ";" ); + } + + //Texture3D + public string GetTexture3DPropertyValue() + { + return PropertyName + "(\"" + m_propertyInspectorName + "\", 3D) = \"" + m_defaultTextureValue + "\" {}"; + } + + public string GetTexture3DUniformValue() + { + return GeneratorUtils.GetPropertyDeclaraction( PropertyName, TextureType.Texture3D, ";" ); + } + + // Cube + public string GetCubePropertyValue() + { + return PropertyName + "(\"" + m_propertyInspectorName + "\", CUBE) = \"" + m_defaultTextureValue + "\" {}"; + } + + public string GetCubeUniformValue() + { + return GeneratorUtils.GetPropertyDeclaraction( PropertyName, TextureType.Cube, ";" ); + } + + // Texture2DArray + public string GetTexture2DArrayPropertyValue() + { + return PropertyName + "(\"" + m_propertyInspectorName + "\", 2DArray) = \"" + m_defaultTextureValue + "\" {}"; + } + + public string GetTexture2DArrayUniformValue() + { + return GeneratorUtils.GetPropertyDeclaraction( PropertyName, TextureType.Texture2DArray, ";" ); + } + + public override void DrawMainPropertyBlock() + { + DrawTexturePropertyType(); + base.DrawMainPropertyBlock(); + } + + public override void DrawSubProperties() + { + ShowDefaults(); + + + EditorGUI.BeginChangeCheck(); + Type currType = ( m_autocastMode == AutoCastType.Auto ) ? typeof( Texture ) : m_textureType; + m_defaultValue = EditorGUILayoutObjectField( Constants.DefaultValueLabel, m_defaultValue, currType, false ) as Texture; + if( EditorGUI.EndChangeCheck() ) + { + CheckTextureImporter( true ); + SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); + } + } + + public override void DrawMaterialProperties() + { + ShowDefaults(); + + EditorGUI.BeginChangeCheck(); + Type currType = ( m_autocastMode == AutoCastType.Auto ) ? typeof( Texture ) : m_textureType; + m_materialValue = EditorGUILayoutObjectField( Constants.MaterialValueLabel, m_materialValue, currType, false ) as Texture; + if( EditorGUI.EndChangeCheck() ) + { + CheckTextureImporter( true ); + SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); + } + } + + new void ShowDefaults() + { + m_defaultTextureValue = (TexturePropertyValues)EditorGUILayoutEnumPopup( DefaultTextureStr, m_defaultTextureValue ); + + if( !m_drawAutocast ) + return; + + AutoCastType newAutoCast = (AutoCastType)EditorGUILayoutEnumPopup( AutoCastModeStr, m_autocastMode ); + if( newAutoCast != m_autocastMode ) + { + m_autocastMode = newAutoCast; + if( m_autocastMode != AutoCastType.Auto ) + { + ConfigTextureData( m_currentType ); + ConfigureInputPorts(); + ConfigureOutputPorts(); + } + } + } + + private void ConfigurePortsFromReference() + { + m_sizeIsDirty = true; + } + + public virtual void ConfigureOutputPorts() + { + switch( m_currentType ) + { + case TextureType.Texture1D: + m_outputPorts[ 0 ].ChangeType( WirePortDataType.SAMPLER1D, false ); + break; + case TextureType.ProceduralTexture: + case TextureType.Texture2D: + m_outputPorts[ 0 ].ChangeType( WirePortDataType.SAMPLER2D, false ); + break; + case TextureType.Texture3D: + m_outputPorts[ 0 ].ChangeType( WirePortDataType.SAMPLER3D, false ); + break; + case TextureType.Cube: + m_outputPorts[ 0 ].ChangeType( WirePortDataType.SAMPLERCUBE, false ); + break; + case TextureType.Texture2DArray: + m_outputPorts[ 0 ].ChangeType( WirePortDataType.SAMPLER2DARRAY, false ); + break; + } + + m_sizeIsDirty = true; + } + + public virtual void ConfigureInputPorts() + { + } + + public virtual void AdditionalCheck() + { + } + + public virtual void CheckTextureImporter( bool additionalCheck, bool writeDefault = true ) + { + m_requireMaterialUpdate = true; + Texture texture = m_materialMode ? m_materialValue : m_defaultValue; + TextureImporter importer = AssetImporter.GetAtPath( AssetDatabase.GetAssetPath( texture ) ) as TextureImporter; + if( importer != null ) + { + + m_isNormalMap = importer.textureType == TextureImporterType.NormalMap; + + if( writeDefault && !UIUtils.IsLoading ) + { + if( m_defaultTextureValue == TexturePropertyValues.bump && !m_isNormalMap ) + m_defaultTextureValue = TexturePropertyValues.white; + else if( m_isNormalMap ) + m_defaultTextureValue = TexturePropertyValues.bump; + } + + if( additionalCheck ) + AdditionalCheck(); + m_linearTexture = !importer.sRGBTexture; + } + + if( ( texture as Texture2DArray ) != null ) + { + ConfigTextureData( TextureType.Texture2DArray ); + } + else if( ( texture as Texture2D ) != null ) + { + ConfigTextureData( TextureType.Texture2D ); + } + else if( ( texture as Texture3D ) != null ) + { + ConfigTextureData( TextureType.Texture3D ); + } + else if( ( texture as Cubemap ) != null ) + { + ConfigTextureData( TextureType.Cube ); + } + + ConfigureInputPorts(); + ConfigureOutputPorts(); + } + + public override void OnObjectDropped( UnityEngine.Object obj ) + { + base.OnObjectDropped( obj ); + ConfigFromObject( obj ); + } + + public override void SetupFromCastObject( UnityEngine.Object obj ) + { + base.SetupFromCastObject( obj ); + ConfigFromObject( obj ); + } + + protected void ConfigFromObject( UnityEngine.Object obj, bool writeDefault = true, bool additionalCheck = true ) + { + Texture texture = obj as Texture; + if( texture ) + { + m_materialValue = texture; + m_defaultValue = texture; + CheckTextureImporter( additionalCheck, writeDefault ); + } + } + + + + public override void DrawGUIControls( DrawInfo drawInfo ) + { + base.DrawGUIControls( drawInfo ); + + if( !( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp || drawInfo.CurrentEventType == EventType.ExecuteCommand || drawInfo.CurrentEventType == EventType.DragPerform ) ) + return; + + bool insideBox = m_previewRect.Contains( drawInfo.MousePosition ); + + bool closePicker = false; + if( insideBox ) + { + m_isEditingPicker = true; + } + else if( m_isEditingPicker && !insideBox && drawInfo.CurrentEventType != EventType.ExecuteCommand ) + { + closePicker = true; + } + + if( m_isEditingPicker && drawInfo.CurrentEventType == EventType.ExecuteCommand && + Event.current.commandName.Equals( ObjectSelectorCmdStr ) ) + { + closePicker = true; + } + + if( closePicker ) + { + GUI.FocusControl( null ); + m_isEditingPicker = false; + } + + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + base.OnNodeLayout( drawInfo ); + ConfigTextureType(); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + if( m_dropdownEditing ) + { + PropertyType parameterType = (PropertyType)EditorGUIIntPopup( m_dropdownRect, (int)m_currentParameterType, AvailablePropertyTypeLabels, AvailablePropertyTypeValues, UIUtils.PropertyPopUp ); + if( parameterType != m_currentParameterType ) + { + ChangeParameterType( parameterType ); + DropdownEditing = false; + } + } + + if( m_isEditingPicker && m_drawPicker && m_currentParameterType != PropertyType.Global ) + { + Rect hitRect = m_previewRect; + hitRect.height = 14 * drawInfo.InvertedZoom; + hitRect.y = m_previewRect.yMax - hitRect.height; + hitRect.width = 4 * 14 * drawInfo.InvertedZoom; + + bool restoreMouse = false; + if( Event.current.type == EventType.MouseDown && hitRect.Contains( drawInfo.MousePosition ) ) + { + restoreMouse = true; + Event.current.type = EventType.Ignore; + } + + EditorGUI.BeginChangeCheck(); + m_colorBuffer = GUI.color; + GUI.color = Color.clear; + Type currType = ( m_autocastMode == AutoCastType.Auto ) ? typeof( Texture ) : m_textureType; + if( m_materialMode ) + { + m_materialValue = EditorGUIObjectField( m_previewRect, m_materialValue, currType, false ) as Texture; + } + else + { + m_defaultValue = EditorGUIObjectField( m_previewRect, m_defaultValue, currType, false ) as Texture; + } + GUI.color = m_colorBuffer; + + if( EditorGUI.EndChangeCheck() ) + { + CheckTextureImporter( true ); + SetTitleText( m_propertyInspectorName ); + SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); + ConfigureInputPorts(); + ConfigureOutputPorts(); + BeginDelayedDirtyProperty(); + PreviewIsDirty = true; + } + //else if( drawInfo.CurrentEventType == EventType.ExecuteCommand ) + //{ + // GUI.FocusControl( null ); + // m_isEditingPicker = false; + //} + + if( restoreMouse ) + { + Event.current.type = EventType.MouseDown; + } + + if( ( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp ) ) + DrawPreviewMaskButtonsLayout( drawInfo, m_previewRect ); + } + + if( !m_drawPicker ) + return; + + if( drawInfo.CurrentEventType == EventType.Repaint ) + { + DrawTexturePicker( drawInfo ); + } + } + + + + protected void DrawTexturePicker( DrawInfo drawInfo ) + { + Rect newRect = m_previewRect; + Texture currentValue = m_materialMode ? m_materialValue : m_defaultValue; + + //??? + //m_showPreview = true; + bool showButtons = m_currentParameterType != PropertyType.Global; + + if( currentValue == null ) + GUI.Label( newRect, string.Empty, UIUtils.ObjectFieldThumb ); + else + DrawPreview( drawInfo, m_previewRect ); + + if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) + { + Rect butRect = m_previewRect; + butRect.y -= 1; + butRect.x += 1; + + Rect smallButton = newRect; + smallButton.height = 14 * drawInfo.InvertedZoom; + smallButton.y = newRect.yMax - smallButton.height - 2; + smallButton.width = 40 * drawInfo.InvertedZoom; + smallButton.x = newRect.xMax - smallButton.width - 2; + if( currentValue == null ) + { + if( m_previousType != m_currentType ) + { + m_previousType = m_currentType; + m_labelText = "None (" + m_currentType.ToString() + ")"; + } + + GUI.Label( newRect, m_labelText, UIUtils.ObjectFieldThumbOverlay ); + } + else if( showButtons ) + { + DrawPreviewMaskButtonsRepaint( drawInfo, butRect ); + } + + if( showButtons ) + GUI.Label( smallButton, "Select", UIUtils.GetCustomStyle( CustomStyle.SamplerButton ) ); + } + + GUI.Label( newRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); + } + + public override void CheckIfAutoRegister( ref MasterNodeDataCollector dataCollector ) + { + // Also testing inside shader function because node can be used indirectly over a custom expression and directly over a Function Output node + // That isn't being used externaly making it to not be registered ( since m_connStatus it set to Connected by being connected to an output node + if( CurrentParameterType != PropertyType.Constant && m_autoRegister && ( m_connStatus != NodeConnectionStatus.Connected || InsideShaderFunction ) ) + { + RegisterProperty( ref dataCollector ); + if( m_autoRegister && m_containerGraph.ParentWindow.OutsideGraph.SamplingMacros ) + { + GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, PropertyName , m_variableMode ); + } + } + } + + public string GenerateSamplerState( ref MasterNodeDataCollector dataCollector ) + { + return GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, PropertyName , m_variableMode ); + } + + public virtual string GenerateSamplerPropertyName( int outputId, ref MasterNodeDataCollector dataCollector ) + { + string generatedSamplerState = string.Empty; + + if( outputId > 0 || m_forceSamplingMacrosGen ) + { + generatedSamplerState = GeneratorUtils.GenerateSamplerState( ref dataCollector, UniqueId, PropertyName , m_variableMode ); + } + + if( outputId > 0 ) + return generatedSamplerState; + else + return PropertyName; + } + + public string BaseGenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); + return GenerateSamplerPropertyName( outputId , ref dataCollector ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + return BaseGenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); + } + + public override void UpdateMaterial( Material mat ) + { + base.UpdateMaterial( mat ); + if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) + { + OnPropertyNameChanged(); + if( mat.HasProperty( PropertyName ) ) + { + mat.SetTexture( PropertyName, m_materialValue ); + } + } + } + + public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) + { + base.SetMaterialMode( mat, fetchMaterialValues ); + if( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) ) + { + if( mat.HasProperty( PropertyName ) ) + { + m_materialValue = mat.GetTexture( PropertyName ); + CheckTextureImporter( false, false ); + } + } + } + + public override void ForceUpdateFromMaterial( Material material ) + { + if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( PropertyName ) ) + { + m_materialValue = material.GetTexture( PropertyName ); + CheckTextureImporter( false, false ); + PreviewIsDirty = true; + } + } + + public override bool UpdateShaderDefaults( ref Shader shader, ref TextureDefaultsDataColector defaultCol/* ref string metaStr */) + { + if( m_defaultValue != null ) + { + defaultCol.AddValue( PropertyName, m_defaultValue ); + } + + return true; + } + + public void ReadFromStringArray( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + ReadAdditionalData( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 17101 ) + { + m_useSamplerArrayIdx = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + } + + public virtual void ReadAdditionalData( ref string[] nodeParams ) + { + string defaultTextureGUID = GetCurrentParam( ref nodeParams ); + //m_defaultValue = AssetDatabase.LoadAssetAtPath( textureName ); + if( UIUtils.CurrentShaderVersion() > 14101 ) + { + m_defaultValue = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( defaultTextureGUID ) ); + string materialTextureGUID = GetCurrentParam( ref nodeParams ); + m_materialValue = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( materialTextureGUID ) ); + } + else + { + m_defaultValue = AssetDatabase.LoadAssetAtPath( defaultTextureGUID ); + } + + m_isNormalMap = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_defaultTextureValue = (TexturePropertyValues)Enum.Parse( typeof( TexturePropertyValues ), GetCurrentParam( ref nodeParams ) ); + m_autocastMode = (AutoCastType)Enum.Parse( typeof( AutoCastType ), GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 15306 ) + { + m_currentType = (TextureType)Enum.Parse( typeof( TextureType ), GetCurrentParam( ref nodeParams ) ); + } + else + { + m_currentType = TextureType.Texture2D; + } + + ConfigTextureData( m_currentType ); + + //ConfigFromObject( m_defaultValue ); + if( m_materialValue == null ) + { + ConfigFromObject( m_defaultValue ); + } + else + { + CheckTextureImporter( true, true ); + } + ConfigureInputPorts(); + ConfigureOutputPorts(); + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + ConfigureInputPorts(); + ConfigureOutputPorts(); + } + + public override void ReadAdditionalClipboardData( ref string[] nodeParams ) + { + base.ReadAdditionalClipboardData( ref nodeParams ); + string textureName = GetCurrentParam( ref nodeParams ); + m_materialValue = AssetDatabase.LoadAssetAtPath( textureName ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + WriteAdditionalToString( ref nodeInfo, ref connectionsInfo ); + if( m_useSamplerArrayIdx > 0 ) + { + TexturePropertyNode samplerNode = UIUtils.GetTexturePropertyNode( m_useSamplerArrayIdx - 1 ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( samplerNode != null ? samplerNode.UniqueId : -1 ) ); + } + else + { + IOUtils.AddFieldValueToString( ref nodeInfo, -1 ); + } + } + + public virtual void WriteAdditionalToString( ref string nodeInfo, ref string connectionsInfo ) + { + //IOUtils.AddFieldValueToString( ref nodeInfo, ( m_defaultValue != null ) ? AssetDatabase.GetAssetPath( m_defaultValue ) : Constants.NoStringValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_defaultValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_defaultValue ) ) : Constants.NoStringValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_materialValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_materialValue ) ) : Constants.NoStringValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_isNormalMap.ToString() ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultTextureValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_autocastMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentType ); + } + + public override void WriteAdditionalClipboardData( ref string nodeInfo ) + { + base.WriteAdditionalClipboardData( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_materialValue != null ) ? AssetDatabase.GetAssetPath( m_materialValue ) : Constants.NoStringValue ); + } + + public override void Destroy() + { + base.Destroy(); + m_defaultValue = null; + m_materialValue = null; + m_textureProperty = null; + UIUtils.UnregisterPropertyNode( this ); + UIUtils.UnregisterTexturePropertyNode( this ); + } + + public override string GetPropertyValStr() + { + return m_materialMode ? ( m_materialValue != null ? m_materialValue.name : IOUtils.NO_TEXTURES ) : ( m_defaultValue != null ? m_defaultValue.name : IOUtils.NO_TEXTURES ); + } + + public override string GetPropertyValue() + { + switch( m_currentType ) + { + case TextureType.Texture1D: + { + return PropertyAttributes + GetTexture1DPropertyValue(); + } + case TextureType.ProceduralTexture: + case TextureType.Texture2D: + { + return PropertyAttributes + GetTexture2DPropertyValue(); + } + case TextureType.Texture3D: + { + return PropertyAttributes + GetTexture3DPropertyValue(); + } + case TextureType.Cube: + { + return PropertyAttributes + GetCubePropertyValue(); + } + case TextureType.Texture2DArray: + { + return PropertyAttributes + GetTexture2DArrayPropertyValue(); + } + } + return string.Empty; + } + + public override string GetUniformValue() + { + switch( m_currentType ) + { + case TextureType.Texture1D: + { + return GetTexture1DUniformValue(); + } + case TextureType.ProceduralTexture: + case TextureType.Texture2D: + { + return GetTexture2DUniformValue(); + } + case TextureType.Texture3D: + { + return GetTexture3DUniformValue(); + } + case TextureType.Cube: + { + return GetCubeUniformValue(); + } + case TextureType.Texture2DArray: + { + return GetTexture2DArrayUniformValue(); + } + } + + return string.Empty; + } + + public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) + { + m_excludeUniform = false; + ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; + if( outsideGraph.SamplingMacros || m_currentType == TextureType.Texture2DArray ) + { + if( outsideGraph.IsSRP ) + { + if( Constants.TexDeclarationSRPMacros.ContainsKey( m_currentType ) ) + { + dataName = GeneratorUtils.GetPropertyDeclaraction( PropertyName, m_currentType, ";" ); + dataType = string.Empty; + fullValue = true; + return true; + } + } + else if( Constants.TexDeclarationStandardMacros.ContainsKey( m_currentType ) ) + { + dataName = GeneratorUtils.GetPropertyDeclaraction( PropertyName, m_currentType, ";" ); + dataType = string.Empty; + fullValue = true; + return true; + } + } + + //TODO: this is a hack and needs to be properly fixed + if( PropertyName == "_CameraDepthTexture" ) + { + if( m_containerGraph.ParentWindow.OutsideGraph.IsSRP ) + { + UIUtils.ShowMessage( "Use Sampling Macros flag on master node properties is required to be turned on in order to properly declare _CameraDepthTexture over an SRP shader!" , MessageSeverity.Warning ); + } + else + { + m_excludeUniform = true; + dataType = "UNITY_DECLARE_DEPTH_TEXTURE("; + dataName = m_propertyName + " )"; + return true; + } + } + + dataType = UIUtils.TextureTypeToCgType( m_currentType ); + dataName = m_propertyName; + return true; + } + + public virtual string CurrentPropertyReference + { + get + { + string propertyName = string.Empty; + propertyName = PropertyName; + return propertyName; + } + } + + public Texture Value + { + get { return m_materialMode ? m_materialValue : m_defaultValue; } + set + { + if( m_materialMode ) + m_materialValue = value; + else + m_defaultValue = value; + } + } + + public Texture MaterialValue + { + get { return m_materialValue; } + set { m_materialValue = value; } + } + + public Texture DefaultValue + { + get { return m_defaultValue; } + set { m_defaultValue = value; } + } + + public void SetInspectorName( string newName ) + { + m_propertyInspectorName = newName; + } + + public void SetPropertyName( string newName ) + { + m_propertyName = newName; + } + + public bool IsValid { get { return m_materialMode ? ( m_materialValue != null ) : ( m_defaultValue != null ); } } + + public virtual bool IsNormalMap { get { return m_isNormalMap; } } + public bool IsLinearTexture { get { return m_linearTexture; } } + + public override void OnPropertyNameChanged() + { + base.OnPropertyNameChanged(); + UIUtils.UpdateTexturePropertyDataNode( UniqueId, PropertyName ); + } + + public override void SetGlobalValue() { Shader.SetGlobalTexture( m_propertyName, m_defaultValue ); } + public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalTexture( m_propertyName ); } + public override string DataToArray { get { return PropertyName; } } + public TextureType CurrentType { get { return m_currentType; } } + + public bool DrawAutocast + { + get { return m_drawAutocast; } + set { m_drawAutocast = value; } + } + + public TexturePropertyValues DefaultTextureValue + { + get { return m_defaultTextureValue; } + set { m_defaultTextureValue = value; } + } + + public AutoCastType AutocastMode + { + get { return m_autocastMode; } + } + public bool ForceSamplingMacrosGen { set { m_forceSamplingMacrosGen = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs.meta new file mode 100644 index 00000000..260bed27 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c1210b3dd22dafe418c5a998df2c3443 +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs new file mode 100644 index 00000000..63533eef --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs @@ -0,0 +1,364 @@ +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Texture Transform", "Textures", "Gives access to texture tiling and offset as set on the material inspector" )] + public sealed class TextureTransformNode : ParentNode + { + private readonly string[] Dummy = { string.Empty }; + private const string InstancedLabelStr = "Instanced"; + + [SerializeField] + private bool m_instanced = false; + + [SerializeField] + private int m_referenceSamplerId = -1; + + [SerializeField] + private int m_referenceNodeId = -1; + + [SerializeField] + private TexturePropertyNode m_inputReferenceNode = null; + + private TexturePropertyNode m_referenceNode = null; + + private Vector4Node m_texCoordsHelper; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + private int m_cachedSamplerId = -1; + private int m_cachedSamplerIdArray = -1; + private int m_cachedSamplerIdCube = -1; + private int m_cachedSamplerId3D = -1; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.SAMPLER2D, false, "Tex" ); + m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.SAMPLER2DARRAY, WirePortDataType.OBJECT ); + AddOutputPort( WirePortDataType.FLOAT2, "Tiling" ); + AddOutputPort( WirePortDataType.FLOAT2, "Offset" ); + m_textLabelWidth = 80; + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + m_previewShaderGUID = "25ba2903568b00343ae06788994cab54"; + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void RenderNodePreview() + { + //Runs at least one time + if( !m_initialized ) + { + // nodes with no preview don't update at all + PreviewIsDirty = false; + return; + } + + if( !PreviewIsDirty ) + return; + + SetPreviewInputs(); + + if( !Preferences.User.DisablePreviews ) + { + RenderTexture temp = RenderTexture.active; + + RenderTexture.active = m_outputPorts[ 0 ].OutputPreviewTexture; + PreviewMaterial.SetInt( "_PreviewID" , 0 ); + Graphics.Blit( null , m_outputPorts[ 0 ].OutputPreviewTexture , PreviewMaterial , m_previewMaterialPassId ); + + RenderTexture.active = m_outputPorts[ 1 ].OutputPreviewTexture; + PreviewMaterial.SetInt( "_PreviewID" , 1 ); + Graphics.Blit( null , m_outputPorts[ 1 ].OutputPreviewTexture , PreviewMaterial , m_previewMaterialPassId ); + RenderTexture.active = temp; + + } + + PreviewIsDirty = m_continuousPreviewRefresh; + FinishPreviewRender = true; + } + + void SetPreviewTexture( Texture newValue ) + { + if( newValue is Cubemap ) + { + m_previewMaterialPassId = 3; + if( m_cachedSamplerIdCube == -1 ) + m_cachedSamplerIdCube = Shader.PropertyToID( "_Cube" ); + + PreviewMaterial.SetTexture( m_cachedSamplerIdCube, newValue as Cubemap ); + } + else if( newValue is Texture2DArray ) + { + + m_previewMaterialPassId = 2; + if( m_cachedSamplerIdArray == -1 ) + m_cachedSamplerIdArray = Shader.PropertyToID( "_Array" ); + + PreviewMaterial.SetTexture( m_cachedSamplerIdArray, newValue as Texture2DArray ); + } + else if( newValue is Texture3D ) + { + m_previewMaterialPassId = 1; + if( m_cachedSamplerId3D == -1 ) + m_cachedSamplerId3D = Shader.PropertyToID( "_Sampler3D" ); + + PreviewMaterial.SetTexture( m_cachedSamplerId3D, newValue as Texture3D ); + } + else + { + m_previewMaterialPassId = 0; + if( m_cachedSamplerId == -1 ) + m_cachedSamplerId = Shader.PropertyToID( "_Sampler" ); + + PreviewMaterial.SetTexture( m_cachedSamplerId, newValue ); + } + } + + public override void SetPreviewInputs() + { + base.SetPreviewInputs(); + if( m_inputPorts[ 0 ].IsConnected ) + { + SetPreviewTexture( m_inputPorts[ 0 ].InputPreviewTexture( ContainerGraph ) ); + } + else if( m_referenceNode != null ) + { + if( m_referenceNode.Value != null ) + { + SetPreviewTexture( m_referenceNode.Value ); + } + else + { + SetPreviewTexture( m_referenceNode.PreviewTexture ); + } + } + } + + public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) + { + base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); + m_inputPorts[ 0 ].MatchPortToConnection(); + m_inputReferenceNode = m_inputPorts[ 0 ].GetOutputNodeWhichIsNotRelay() as TexturePropertyNode; + UpdateTitle(); + + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + m_inputReferenceNode = null; + UpdateTitle(); + } + + public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); + m_inputPorts[ 0 ].MatchPortToConnection(); + UpdateTitle(); + } + + void UpdateTitle() + { + if( m_inputReferenceNode != null ) + { + m_additionalContent.text = string.Format( Constants.PropertyValueLabel, m_inputReferenceNode.PropertyInspectorName ); + } + else if( m_referenceSamplerId > -1 && m_referenceNode != null ) + { + m_additionalContent.text = string.Format( Constants.PropertyValueLabel, m_referenceNode.PropertyInspectorName ); + } + else + { + m_additionalContent.text = string.Empty; + } + m_sizeIsDirty = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + bool guiEnabledBuffer = GUI.enabled; + EditorGUI.BeginChangeCheck(); + List arr = new List( UIUtils.TexturePropertyNodeArr() ); + + if( arr != null && arr.Count > 0 ) + { + arr.Insert( 0, "None" ); + GUI.enabled = true && ( !m_inputPorts[ 0 ].IsConnected ); + m_referenceSamplerId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceSamplerId + 1, arr.ToArray() ) - 1; + } + else + { + m_referenceSamplerId = -1; + GUI.enabled = false; + EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceSamplerId, Dummy ); + } + + GUI.enabled = guiEnabledBuffer; + if( EditorGUI.EndChangeCheck() ) + { + m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId ); + if( m_referenceNode != null ) + { + m_referenceNodeId = m_referenceNode.UniqueId; + } + else + { + m_referenceNodeId = -1; + m_referenceSamplerId = -1; + } + UpdateTitle(); + } + + m_instanced = EditorGUILayoutToggle( InstancedLabelStr, m_instanced ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( !m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + string texTransform = string.Empty; + + if( m_inputPorts[ 0 ].IsConnected ) + { + texTransform = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + "_ST"; + } + else if( m_referenceNode != null ) + { + m_referenceNode.BaseGenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); + texTransform = m_referenceNode.PropertyName + "_ST"; + } + else + { + texTransform = "_ST"; + UIUtils.ShowMessage( UniqueId, "Please specify a texture sample on the Texture Transform Size node", MessageSeverity.Warning ); + } + + //bool excludeUniformKeyword = UIUtils.CurrentWindow.OutsideGraph.IsInstancedShader || UIUtils.CurrentWindow.OutsideGraph.IsSRP; + //string uniformRegister = UIUtils.GenerateUniformName( excludeUniformKeyword, WirePortDataType.FLOAT4, texTransform ); + //dataCollector.AddToUniforms( UniqueId, uniformRegister, true ); + if( m_texCoordsHelper == null ) + { + m_texCoordsHelper = CreateInstance(); + m_texCoordsHelper.ContainerGraph = ContainerGraph; + m_texCoordsHelper.SetBaseUniqueId( UniqueId, true ); + m_texCoordsHelper.RegisterPropertyOnInstancing = false; + m_texCoordsHelper.AddGlobalToSRPBatcher = true; + } + + if( m_instanced ) + { + m_texCoordsHelper.CurrentParameterType = PropertyType.InstancedProperty; + } + else + { + m_texCoordsHelper.CurrentParameterType = PropertyType.Global; + } + m_texCoordsHelper.ResetOutputLocals(); + m_texCoordsHelper.SetRawPropertyName( texTransform ); + texTransform = m_texCoordsHelper.GenerateShaderForOutput( 0, ref dataCollector, false ); + + m_outputPorts[ 0 ].SetLocalValue( texTransform + ".xy", dataCollector.PortCategory ); + m_outputPorts[ 1 ].SetLocalValue( texTransform + ".zw", dataCollector.PortCategory ); + } + + return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + EditorGUI.BeginChangeCheck(); + { + List arr = new List( UIUtils.TexturePropertyNodeArr() ); + bool guiEnabledBuffer = GUI.enabled; + + if( arr != null && arr.Count > 0 ) + { + arr.Insert( 0, "None" ); + GUI.enabled = true && ( !m_inputPorts[ 0 ].IsConnected ); + m_referenceSamplerId = m_upperLeftWidget.DrawWidget( this, m_referenceSamplerId + 1, arr.ToArray() ) - 1; + } + else + { + m_referenceSamplerId = -1; + GUI.enabled = false; + m_upperLeftWidget.DrawWidget( this, m_referenceSamplerId, Dummy ); + } + GUI.enabled = guiEnabledBuffer; + } + if( EditorGUI.EndChangeCheck() ) + { + m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId ); + if( m_referenceNode != null ) + { + m_referenceNodeId = m_referenceNode.UniqueId; + } + else + { + m_referenceNodeId = -1; + m_referenceSamplerId = -1; + } + UpdateTitle(); + } + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as TexturePropertyNode; + m_referenceSamplerId = UIUtils.GetTexturePropertyNodeRegisterId( m_referenceNodeId ); + UpdateTitle(); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 17200 ) + { + m_instanced = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceNodeId ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_instanced ); + } + + public override void Destroy() + { + base.Destroy(); + m_referenceNode = null; + m_inputReferenceNode = null; + m_upperLeftWidget = null; + if( m_texCoordsHelper != null ) + { + //Not calling m_texCoordsHelper.Destroy() on purpose so UIUtils does not incorrectly unregister stuff + DestroyImmediate( m_texCoordsHelper ); + m_texCoordsHelper = null; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs.meta new file mode 100644 index 00000000..f88657d2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4f9ca941b3f5014448e530c761a418d9 +timeCreated: 1512045037 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs new file mode 100644 index 00000000..c5ec75a7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs @@ -0,0 +1,101 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public enum UnpackInputMode + { + Tangent, + Object + } + + [NodeAttributes( "Unpack Scale Normal", "Textures", "Applies UnpackNormal/UnpackScaleNormal function" )] + [Serializable] + public class UnpackScaleNormalNode : ParentNode + { + + [SerializeField] + private UnpackInputMode m_inputMode = UnpackInputMode.Tangent; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT4, false, "Value" ); + AddInputPort( WirePortDataType.FLOAT, false, "Scale" ); + m_inputPorts[ 1 ].FloatInternalData = 1; + AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); + m_useInternalPortData = true; + m_autoWrapProperties = true; + m_previewShaderGUID = "8b0ae05e25d280c45af81ded56f8012e"; + } + + public override void DrawProperties() + { + base.DrawProperties(); + m_inputMode = (UnpackInputMode)EditorGUILayoutEnumPopup( "Type" , m_inputMode ); + } + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + string src = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + + bool isScaledNormal = false; + if ( m_inputPorts[ 1 ].IsConnected ) + { + isScaledNormal = true; + } + else + { + if ( m_inputPorts[ 1 ].FloatInternalData != 1 ) + { + isScaledNormal = true; + } + } + + string normalMapUnpackMode = string.Empty; + string scaleValue = isScaledNormal?m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ):"1.0"; + normalMapUnpackMode = GeneratorUtils.GenerateUnpackNormalStr( ref dataCollector, CurrentPrecisionType, UniqueId, OutputId, src, isScaledNormal, scaleValue , m_inputMode ); + if( isScaledNormal && !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) + { + dataCollector.AddToIncludes( UniqueId, Constants.UnityStandardUtilsLibFuncs ); + } + + int outputUsage = 0; + for ( int i = 0; i < m_outputPorts.Count; i++ ) + { + if ( m_outputPorts[ i ].IsConnected ) + outputUsage += 1; + } + + + if ( outputUsage > 1 && !dataCollector.IsSRP ) + { + string varName = "localUnpackNormal" + OutputId; + dataCollector.AddLocalVariable( UniqueId, "float3 " + varName + " = " + normalMapUnpackMode + ";" ); + return GetOutputVectorItem( 0, outputId, varName ); + } + else + { + return GetOutputVectorItem( 0, outputId, normalMapUnpackMode ); + } + } + + public override void WriteToString( ref string nodeInfo , ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo , ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_inputMode ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 18912 ) + { + m_inputMode = (UnpackInputMode)Enum.Parse( typeof( UnpackInputMode ) , GetCurrentParam( ref nodeParams ) ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs.meta new file mode 100644 index 00000000..c2947dfe --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ad04713692e9f124e86030d792c3e648 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs new file mode 100644 index 00000000..339cdc24 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs @@ -0,0 +1,296 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + public enum VirtualPreset + { + Unity_Legacy, + Unity5, + Alloy, + UBER, + Skyshop, + Lux + } + + public enum VirtualChannel + { + Albedo = 0, + Base, + Normal, + Height, + Occlusion, + Displacement, + Specular, + SpecMet, + Material, + } + + [Serializable] + [NodeAttributes( "Virtual Texture Object", "Textures", "Represents a Virtual Texture Asset", SortOrderPriority = 1 )] + public class VirtualTextureObject : TexturePropertyNode + { + protected const string VirtualPresetStr = "Layout Preset"; + protected const string VirtualChannelStr = "Virtual Layer"; + + private const string VirtualTextureObjectInfo = "Can only be used alongside a Texture Sample node by connecting to its Tex Input Port.\n" + + "\nProperty name must match the value set on your Virtual Texture.\n" + + "Default e.g Albedo = _MainTex\n" + + "\nName your node according to the respective channel property in your Virtual Texture. The Albedo must be set to _MainTex ( temporary requirement )."; + private readonly string[] ChannelTypeStr = { + "Albedo - D.RGBA", + "Base - D.RGBA", + "Normal - N.GA", + "Height - N.B", + "Occlusion - N.R", + "Displacement - N.B", + "Specular - S.RGBA", + "Specular|Metallic - S.RGBA", + "Material - S.RGBA",}; + + private readonly string[] Dummy = { string.Empty }; + private string[] m_channelTypeStr; + + [SerializeField] + protected VirtualPreset m_virtualPreset = VirtualPreset.Unity5; + + [SerializeField] + protected VirtualChannel m_virtualChannel = VirtualChannel.Albedo; + + [SerializeField] + private int m_selectedChannelInt = 0; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + ChangeChannels(); + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + if ( UniqueId != -1 ) + UIUtils.AddVirtualTextureCount(); + } + + public override void DrawSubProperties() + { + ShowDefaults(); + + base.DrawSubProperties(); + } + + public override void DrawMaterialProperties() + { + ShowDefaults(); + + base.DrawMaterialProperties(); + } + + new void ShowDefaults() + { + EditorGUI.BeginChangeCheck(); + m_virtualPreset = ( VirtualPreset ) EditorGUILayoutEnumPopup( VirtualPresetStr, m_virtualPreset ); + if ( EditorGUI.EndChangeCheck() ) + { + ChangeChannels(); + } + + EditorGUI.BeginChangeCheck(); + m_selectedChannelInt = EditorGUILayoutPopup( VirtualChannelStr, m_selectedChannelInt, m_channelTypeStr ); + if ( EditorGUI.EndChangeCheck() ) + { + m_virtualChannel = GetChannel( m_selectedChannelInt ); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUILayout.HelpBox( VirtualTextureObjectInfo, MessageType.Info ); + } + + private VirtualChannel GetChannel( int popupInt ) + { + int remapInt = 0; + switch ( m_virtualPreset ) + { + case VirtualPreset.Unity_Legacy: + remapInt = popupInt == 0 ? 1 : popupInt == 1 ? 2 : popupInt == 2 ? 4 : popupInt == 3 ? 5 : 0; + break; + default: + case VirtualPreset.Unity5: + case VirtualPreset.UBER: + remapInt = popupInt == 0 ? 0 : popupInt == 1 ? 7 : popupInt == 2 ? 2 : popupInt == 3 ? 3 : popupInt == 4 ? 4 : 0; + break; + case VirtualPreset.Alloy: + remapInt = popupInt == 0 ? 1 : popupInt == 1 ? 2 : popupInt == 2 ? 8 : popupInt == 3 ? 3 : 0; + break; + case VirtualPreset.Skyshop: + case VirtualPreset.Lux: + remapInt = popupInt == 0 ? 1 : popupInt == 1 ? 2 : popupInt == 2 ? 6 : 0; + break; + } + + return ( VirtualChannel ) remapInt; + } + + private void ChangeChannels() + { + m_channelTypeStr = Dummy; + switch ( m_virtualPreset ) + { + case VirtualPreset.Unity_Legacy: + m_channelTypeStr = new string[] { ChannelTypeStr[ 1 ], ChannelTypeStr[ 2 ], ChannelTypeStr[ 4 ], ChannelTypeStr[ 5 ] }; + break; + default: + case VirtualPreset.Unity5: + case VirtualPreset.UBER: + m_channelTypeStr = new string[] { ChannelTypeStr[ 0 ], ChannelTypeStr[ 7 ], ChannelTypeStr[ 2 ], ChannelTypeStr[ 3 ], ChannelTypeStr[ 4 ] }; + break; + case VirtualPreset.Alloy: + m_channelTypeStr = new string[] { ChannelTypeStr[ 1 ], ChannelTypeStr[ 2 ], ChannelTypeStr[ 8 ], ChannelTypeStr[ 3 ] }; + break; + case VirtualPreset.Skyshop: + case VirtualPreset.Lux: + m_channelTypeStr = new string[] { ChannelTypeStr[ 1 ], ChannelTypeStr[ 2 ], ChannelTypeStr[ 6 ] }; + break; + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); + dataCollector.AddToProperties( UniqueId, "[HideInInspector] _VTInfoBlock( \"VT( auto )\", Vector ) = ( 0, 0, 0, 0 )", -1 ); + + return PropertyName; + } + + public override string GetPropertyValue() + { + string propertyValue = string.Empty; + switch ( m_virtualChannel ) + { + default: + case VirtualChannel.Albedo: + case VirtualChannel.Base: + propertyValue = PropertyName + "(\"" + m_propertyInspectorName + "\", 2D) = \"" + m_defaultTextureValue + "\" {}"; + break; + case VirtualChannel.Normal: + propertyValue = PropertyName + "(\"" + m_propertyInspectorName + "\", 2D) = \"" + m_defaultTextureValue + "\" {}"; + break; + case VirtualChannel.SpecMet: + propertyValue = PropertyName + "(\"" + m_propertyInspectorName + "\", 2D) = \"" + m_defaultTextureValue + "\" {}"; + break; + } + return PropertyAttributes + propertyValue; + } + + public override string GetUniformValue() + { + return "uniform sampler2D " + PropertyName + ";"; + } + + public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) + { + dataType = "sampler2D"; + dataName = PropertyName; + return true; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + string defaultTextureGUID = GetCurrentParam( ref nodeParams ); + //m_defaultValue = AssetDatabase.LoadAssetAtPath( textureName ); + if( UIUtils.CurrentShaderVersion() > 14101 ) + { + m_defaultValue = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( defaultTextureGUID ) ); + string materialTextureGUID = GetCurrentParam( ref nodeParams ); + m_materialValue = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( materialTextureGUID ) ); + } + else + { + m_defaultValue = AssetDatabase.LoadAssetAtPath( defaultTextureGUID ); + } + m_isNormalMap = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + m_defaultTextureValue = ( TexturePropertyValues ) Enum.Parse( typeof( TexturePropertyValues ), GetCurrentParam( ref nodeParams ) ); + m_autocastMode = ( AutoCastType ) Enum.Parse( typeof( AutoCastType ), GetCurrentParam( ref nodeParams ) ); + m_virtualPreset = ( VirtualPreset ) Enum.Parse( typeof( VirtualPreset ), GetCurrentParam( ref nodeParams ) ); + m_selectedChannelInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + ChangeChannels(); + m_virtualChannel = GetChannel( m_selectedChannelInt ); + + //m_forceNodeUpdate = true; + + //ConfigFromObject( m_defaultValue ); + if( m_materialValue == null ) + { + ConfigFromObject( m_defaultValue ); + } + else + { + CheckTextureImporter( true, true ); + } + ConfigureInputPorts(); + ConfigureOutputPorts(); + } + + public override void ReadAdditionalData( ref string[] nodeParams ) { } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + //IOUtils.AddFieldValueToString( ref nodeInfo, ( m_defaultValue != null ) ? AssetDatabase.GetAssetPath( m_defaultValue ) : Constants.NoStringValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_defaultValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_defaultValue ) ) : Constants.NoStringValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_materialValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_materialValue ) ) : Constants.NoStringValue ); + + IOUtils.AddFieldValueToString( ref nodeInfo, m_isNormalMap.ToString() ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultTextureValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_autocastMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_virtualPreset ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedChannelInt ); + } + + public override void WriteAdditionalToString( ref string nodeInfo, ref string connectionsInfo ) { } + + //public override string PropertyName + //{ + // get + // { + // string propertyName = string.Empty; + // switch ( m_virtualChannel ) + // { + // default: + // case VirtualChannel.Albedo: + // case VirtualChannel.Base: + // propertyName = "_MainTex"; + // break; + // case VirtualChannel.Normal: + // propertyName = "_BumpMap"; + // break; + // case VirtualChannel.SpecMet: + // propertyName = "_MetallicGlossMap"; + // break; + // case VirtualChannel.Occlusion: + // propertyName = "_OcclusionMap"; + // break; + // } + // return propertyName; + // } + //} + + public override void Destroy() + { + base.Destroy(); + UIUtils.RemoveVirtualTextureCount(); + } + + public override bool IsNormalMap { get { return m_isNormalMap || m_virtualChannel == VirtualChannel.Normal; } } + public VirtualChannel Channel { get { return m_virtualChannel; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs.meta new file mode 100644 index 00000000..8b43dd94 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: bacb12043c5bc504aa49e0a5a9bbc534 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs new file mode 100644 index 00000000..e4c4247b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs @@ -0,0 +1,702 @@ +using UnityEditor; +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class UndoParentNode : ScriptableObject + { + private const string MessageFormat = "Changing value {0} on node {1}"; + + [SerializeField] + protected NodeAttributes m_nodeAttribs; + + [SerializeField] + protected ParentGraph m_containerGraph; + + public void UndoRecordObject( string name ) + { + UIUtils.MarkUndoAction(); + UndoUtils.RegisterCompleteObjectUndo( UIUtils.CurrentWindow, name ); + UndoUtils.RecordObject( this, name ); + } + + public virtual void RecordObject( string Id ) + { + UndoUtils.RecordObject( this, Id ); + } + public virtual void RecordObjectOnDestroy( string Id ) + { + UndoUtils.RecordObject( this, Id ); + } + + public string EditorGUILayoutStringField( string name, string value, params GUILayoutOption[] options ) + { + string newValue = EditorGUILayout.TextField( name, value, options ); + if( !newValue.Equals( value ) ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUILayoutStringField", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public string EditorGUILayoutTextField( GUIContent label, string text, params GUILayoutOption[] options ) + { + string newValue = EditorGUILayout.TextField( label, text, options ); + if( !text.Equals( newValue ) ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public string EditorGUILayoutTextField( string text, params GUILayoutOption[] options ) + { + string newValue = EditorGUILayout.TextField( text, options ); + if( !text.Equals( newValue ) ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUILayoutTextField", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public string EditorGUILayoutTextField( string label, string text, params GUILayoutOption[] options ) + { + string newValue = EditorGUILayout.TextField( label, text, options ); + if( !text.Equals( newValue ) ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public Enum EditorGUILayoutEnumPopup( GUIContent label, Enum selected, params GUILayoutOption[] options ) + { + Enum newValue = EditorGUILayout.EnumPopup( label, selected, options ); + if( !newValue.ToString().Equals( selected.ToString() ) ) + { + UndoRecordObject( string.Concat( "Changing value ", label, " on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + //UndoRecordObject(string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public Enum EditorGUILayoutEnumPopup( string label, Enum selected, params GUILayoutOption[] options ) + { + Enum newValue = EditorGUILayout.EnumPopup( label, selected, options ); + if( !newValue.ToString().Equals( selected.ToString() ) ) + { + UndoRecordObject( string.Concat( "Changing value ", label, " on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + //UndoRecordObject(string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public Enum EditorGUILayoutEnumPopup( Enum selected, params GUILayoutOption[] options ) + { + Enum newValue = EditorGUILayout.EnumPopup( selected, options ); + if( !newValue.ToString().Equals( selected.ToString() ) ) + { + UndoRecordObject( string.Concat( "Changing value EditorGUILayoutEnumPopup on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + //UndoRecordObject(string.Format( MessageFormat, "EditorGUILayoutEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public int EditorGUILayoutIntPopup( string label, int selectedValue, string[] displayedOptions, int[] optionValues, params GUILayoutOption[] options ) + { + int newValue = EditorGUILayout.IntPopup( label, selectedValue, displayedOptions, optionValues, options ); + if( newValue != selectedValue ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + + public int EditorGUILayoutPopup( string label, int selectedIndex, string[] displayedOptions, GUIStyle style, params GUILayoutOption[] options ) + { + int newValue = EditorGUILayout.Popup( label, selectedIndex, displayedOptions, style, options ); + if( newValue != selectedIndex ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + + public int EditorGUILayoutPopup( GUIContent label, int selectedIndex, GUIContent[] displayedOptions, params GUILayoutOption[] options ) + { + int newValue = EditorGUILayout.Popup( label, selectedIndex, displayedOptions, options ); + if( newValue != selectedIndex ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public int EditorGUILayoutPopup( GUIContent label, int selectedIndex, GUIContent[] displayedOptions, GUIStyle style, params GUILayoutOption[] options ) + { + int newValue = EditorGUILayout.Popup( label, selectedIndex, displayedOptions, style, options ); + if( newValue != selectedIndex ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public int EditorGUILayoutPopup( int selectedIndex, string[] displayedOptions, params GUILayoutOption[] options ) + { + int newValue = EditorGUILayout.Popup( selectedIndex, displayedOptions, options ); + if( newValue != selectedIndex ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUILayoutPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public int EditorGUILayoutPopup( string label, int selectedIndex, string[] displayedOptions, params GUILayoutOption[] options ) + { + int newValue = EditorGUILayout.Popup( label, selectedIndex, displayedOptions, options ); + if( newValue != selectedIndex ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public bool EditorGUILayoutToggle( GUIContent label, bool value, params GUILayoutOption[] options ) + { + bool newValue = EditorGUILayout.Toggle( label, value, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public bool EditorGUILayoutToggle( string label, bool value, params GUILayoutOption[] options ) + { + bool newValue = EditorGUILayout.Toggle( label, value, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public bool EditorGUILayoutToggle( string label, bool value, GUIStyle style, params GUILayoutOption[] options ) + { + bool newValue = EditorGUILayout.Toggle( label, value, style, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public int EditorGUILayoutIntField( int value, params GUILayoutOption[] options ) + { + int newValue = EditorGUILayout.IntField( value, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUILayoutIntField", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public int EditorGUILayoutIntField( GUIContent label, int value, params GUILayoutOption[] options ) + { + int newValue = EditorGUILayout.IntField( label, value, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public int EditorGUILayoutIntField( string label, int value, params GUILayoutOption[] options ) + { + int newValue = EditorGUILayout.IntField( label, value, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public float EditorGUILayoutFloatField( GUIContent label, float value, params GUILayoutOption[] options ) + { + float newValue = EditorGUILayout.FloatField( label, value, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public float EditorGUILayoutFloatField( string label, float value, params GUILayoutOption[] options ) + { + float newValue = EditorGUILayout.FloatField( label, value, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public float EditorGUILayoutRangedFloatField( string label, float value, float min, float max, params GUILayoutOption[] options ) + { + float newValue = Mathf.Clamp( EditorGUILayout.FloatField( label, value, options ), min, max ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public Color EditorGUILayoutColorField( string label, Color value, params GUILayoutOption[] options ) + { + Color newValue = EditorGUILayout.ColorField( label, value, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public Color EditorGUILayoutColorField( GUIContent label, Color value, bool showEyedropper, bool showAlpha, bool hdr, params GUILayoutOption[] options ) + { + Color newValue = EditorGUILayout.ColorField( label, value, showEyedropper, showAlpha, hdr, options ); + if( newValue != value ) + { + UndoRecordObject(string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public float EditorGUILayoutSlider( string label, float value, float leftValue, float rightValue, params GUILayoutOption[] options ) + { + float newValue = EditorGUILayout.Slider( label, value, leftValue, rightValue, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public float EditorGUILayoutSlider( GUIContent label, float value, float leftValue, float rightValue, params GUILayoutOption[] options ) + { + float newValue = EditorGUILayout.Slider( label, value, leftValue, rightValue, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + public UnityEngine.Object EditorGUILayoutObjectField( string label, UnityEngine.Object obj, System.Type objType, bool allowSceneObjects, params GUILayoutOption[] options ) + { + UnityEngine.Object newValue = EditorGUILayout.ObjectField( label, obj, objType, allowSceneObjects, options ); + if( newValue != obj ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public Vector2 EditorGUIVector2Field( Rect position, string label, Vector2 value ) + { + Vector2 newValue = EditorGUI.Vector2Field( position, label, value ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + + public Vector2 EditorGUILayoutVector2Field( string label, Vector2 value, params GUILayoutOption[] options ) + { + Vector2 newValue = EditorGUILayout.Vector2Field( label, value, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public Vector3 EditorGUIVector3Field( Rect position, string label, Vector3 value ) + { + Vector3 newValue = EditorGUI.Vector3Field( position, label, value ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public Vector3 EditorGUILayoutVector3Field( string label, Vector3 value, params GUILayoutOption[] options ) + { + Vector3 newValue = EditorGUILayout.Vector3Field( label, value, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public Vector4 EditorGUIVector4Field( Rect position, string label, Vector4 value ) + { + Vector4 newValue = EditorGUI.Vector4Field( position, label, value ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public Vector4 EditorGUILayoutVector4Field( string label, Vector4 value, params GUILayoutOption[] options ) + { + Vector4 newValue = EditorGUILayout.Vector4Field( label, value, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public int EditorGUILayoutIntSlider( GUIContent label, int value, int leftValue, int rightValue, params GUILayoutOption[] options ) + { + int newValue = EditorGUILayout.IntSlider( label, value, leftValue, rightValue, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public int EditorGUILayoutIntSlider( string label, int value, int leftValue, int rightValue, params GUILayoutOption[] options ) + { + int newValue = EditorGUILayout.IntSlider( label, value, leftValue, rightValue, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public bool EditorGUILayoutToggleLeft( string label, bool value, params GUILayoutOption[] options ) + { + bool newValue = EditorGUILayout.ToggleLeft( label, value, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public bool EditorGUILayoutToggleLeft( GUIContent label, bool value, params GUILayoutOption[] options ) + { + bool newValue = EditorGUILayout.ToggleLeft( label, value, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public string EditorGUILayoutTextArea( string text, GUIStyle style, params GUILayoutOption[] options ) + { + string newValue = EditorGUILayout.TextArea( text, style, options ); + if( !newValue.Equals( text ) ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUILayoutTextArea", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public bool EditorGUILayoutFoldout( bool foldout, string content ) + { + bool newValue = EditorGUILayout.Foldout( foldout, content ); + if( newValue != foldout ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUILayoutFoldout", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public bool EditorGUIFoldout( Rect position, bool foldout, string content ) + { + bool newValue = EditorGUI.Foldout( position, foldout, content ); + if( newValue != foldout ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUIFoldout", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public string EditorGUITextField( Rect position, string label, string text ) + { + string newValue = EditorGUI.TextField( position, label, text ); + if( !newValue.Equals( text ) ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public string EditorGUITextArea( Rect position, string text ) + { + string newValue = EditorGUI.TextArea( position, text ); + if( !newValue.Equals( text ) ) + { + UndoRecordObject( string.Format( MessageFormat, "TextArea", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public string EditorGUITextArea( Rect position, string text, [UnityEngine.Internal.DefaultValue( "EditorStyles.textField" )] GUIStyle style ) + { + string newValue = EditorGUI.TextArea( position, text,style ); + if( !newValue.Equals( text ) ) + { + UndoRecordObject( string.Format( MessageFormat, "TextArea", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public string EditorGUITextField( Rect position, string label, string text, [UnityEngine.Internal.DefaultValue( "EditorStyles.textField" )] GUIStyle style ) + { + string newValue = EditorGUI.TextField( position, label, text, style ); + if( !newValue.Equals( text ) ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public Color EditorGUIColorField( Rect position, GUIContent label, Color value, bool showEyedropper, bool showAlpha, bool hdr ) + { + Color newValue = EditorGUI.ColorField( position, label, value, showEyedropper, showAlpha, hdr ); + if( newValue != value ) + { + UndoRecordObject(string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public Color EditorGUIColorField( Rect position, string label, Color value ) + { + Color newValue = EditorGUI.ColorField( position, label, value ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + + public int EditorGUIIntField( Rect position, string label, int value ) + { + int newValue = EditorGUI.IntField( position, label, value ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public int EditorGUIIntField( Rect position, string label, int value, [UnityEngine.Internal.DefaultValue( "EditorStyles.numberField" )] GUIStyle style ) + { + int newValue = EditorGUI.IntField( position, label, value, style ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public float EditorGUIFloatField( Rect position, string label, float value ) + { + float newValue = EditorGUI.FloatField( position, label, value ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public float EditorGUIFloatField( Rect position, string label, float value, [UnityEngine.Internal.DefaultValue( "EditorStyles.numberField" )] GUIStyle style ) + { + float newValue = EditorGUI.FloatField( position, label, value, style ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public float EditorGUIFloatField( Rect position, float value, [UnityEngine.Internal.DefaultValue( "EditorStyles.numberField" )] GUIStyle style ) + { + float newValue = EditorGUI.FloatField( position, value, style ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUIFloatField", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public float GUIHorizontalSlider( Rect position, float value, float leftValue, float rightValue, GUIStyle slider, GUIStyle thumb ) + { + float newValue = GUI.HorizontalSlider( position, value, leftValue, rightValue, slider, thumb ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, "GUIHorizontalSlider", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public Enum EditorGUIEnumPopup( Rect position, Enum selected ) + { + Enum newValue = EditorGUI.EnumPopup( position, selected ); + if( !newValue.ToString().Equals( selected.ToString() ) ) + { + UndoRecordObject( string.Concat( "Changing value EditorGUIEnumPopup on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + //UndoRecordObject(string.Format( MessageFormat, "EditorGUIEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public Enum EditorGUIEnumPopup( Rect position, Enum selected, [UnityEngine.Internal.DefaultValue( "EditorStyles.popup" )] GUIStyle style ) + { + Enum newValue = EditorGUI.EnumPopup( position, selected, style ); + if( !newValue.ToString().Equals( selected.ToString() ) ) + { + UndoRecordObject( string.Concat( "Changing value EditorGUIEnumPopup on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + //UndoRecordObject(string.Format( MessageFormat, "EditorGUIEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public int EditorGUIIntPopup( Rect position, int selectedValue, GUIContent[] displayedOptions, int[] optionValues, [UnityEngine.Internal.DefaultValue( "EditorStyles.popup" )] GUIStyle style ) + { + int newValue = EditorGUI.IntPopup( position, selectedValue, displayedOptions, optionValues, style ); + if( newValue != selectedValue ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUIIntEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public int EditorGUIPopup( Rect position, string label, int selectedIndex, string[] displayedOptions ) + { + int newValue = EditorGUI.Popup( position, label, selectedIndex, displayedOptions ); + if( newValue != selectedIndex ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUIEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public int EditorGUIPopup( Rect position, int selectedIndex, GUIContent[] displayedOptions, [UnityEngine.Internal.DefaultValue( "EditorStyles.popup" )] GUIStyle style ) + { + int newValue = EditorGUI.Popup( position, selectedIndex, displayedOptions, style ); + if( newValue != selectedIndex ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUIEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public int EditorGUIPopup( Rect position, int selectedIndex, string[] displayedOptions, [UnityEngine.Internal.DefaultValue( "EditorStyles.popup" )] GUIStyle style ) + { + int newValue = EditorGUI.Popup( position, selectedIndex, displayedOptions, style ); + if( newValue != selectedIndex ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUIEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public UnityEngine.Object EditorGUIObjectField( Rect position, UnityEngine.Object obj, System.Type objType, bool allowSceneObjects ) + { + UnityEngine.Object newValue = EditorGUI.ObjectField( position, obj, objType, allowSceneObjects ); + if( newValue != obj ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUIObjectField", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + public int EditorGUIIntPopup( Rect position, int selectedValue, string[] displayedOptions, int[] optionValues, [UnityEngine.Internal.DefaultValue( "EditorStyles.popup" )] GUIStyle style ) + { + int newValue = EditorGUI.IntPopup( position, selectedValue, displayedOptions, optionValues, style ); + if( newValue != selectedValue ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUIIntPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public bool EditorGUIToggle( Rect position, bool value ) + { + bool newValue = EditorGUI.Toggle( position, value ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUIToggle", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public bool EditorGUIToggle( Rect position, string text, bool value ) + { + bool newValue = EditorGUI.Toggle( position,text, value ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, "EditorGUIToggle", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public string GUITextField( Rect position, string text, GUIStyle style ) + { + string newValue = GUI.TextField( position, text, style ); + if( !newValue.Equals( text ) ) + { + UndoRecordObject( string.Format( MessageFormat, "GUITextfield", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + + public bool GUILayoutToggle( bool value, string text, GUIStyle style, params GUILayoutOption[] options ) + { + bool newValue = GUILayout.Toggle( value, text, style, options ); + if( newValue != value ) + { + UndoRecordObject( string.Format( MessageFormat, "GUILayoutToggle", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return newValue; + } + + public bool GUILayoutButton( string text, GUIStyle style, params GUILayoutOption[] options ) + { + bool value = GUILayout.Button( text, style, options ); + if( value ) + { + UndoRecordObject( string.Format( MessageFormat, "GUILayoutButton", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); + } + return value; + } + + /// + /// It's the graph the node exists in, this is set after node creation and it's not available on CommonInit + /// + public ParentGraph ContainerGraph + { + get { return m_containerGraph; } + set { m_containerGraph = value; } + } + } +} + diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs.meta new file mode 100644 index 00000000..6e9cf539 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: bcc69b2f388d45f43a9157ce814b5aae +timeCreated: 1490183752 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex.meta new file mode 100644 index 00000000..9c22229c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 579ecde4d9d1a0e45a655588b39f457a +folderAsset: yes +timeCreated: 1481126945 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs new file mode 100644 index 00000000..52420a67 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs @@ -0,0 +1,135 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Billboard", "Miscellaneous", "Calculates new Vertex positions and normals to achieve a billboard effect." )] + public sealed class BillboardNode : ParentNode + { + private const string ErrorMessage = "Billboard node should only be connected to vertex ports."; + private const string WarningMessage = "This node is a bit different from all others as it injects the necessary code into the vertex body and writes directly on the vertex position and normal.\nIt outputs a value of 0 so it can be connected directly to a vertex port.\n[Only if that port is a relative vertex offset]."; + + [SerializeField] + private BillboardType m_billboardType = BillboardType.Cylindrical; + + [SerializeField] + private bool m_rotationIndependent = false; + + [SerializeField] + private bool m_affectNormalTangent = true; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.FLOAT3, "Out" ); + m_textLabelWidth = 115; + m_hasLeftDropdown = true; + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_billboardType ) ); + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + m_upperLeftWidget.DrawWidget( ref m_billboardType, this, OnWidgetUpdate ); + } + + private readonly Action OnWidgetUpdate = ( x ) => + { + x.SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, ( x as BillboardNode ).Type ) ); + }; + + public override void DrawProperties() + { + base.DrawProperties(); + NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, () => + { + EditorGUI.BeginChangeCheck(); + m_billboardType = (BillboardType)EditorGUILayoutEnumPopup( BillboardOpHelper.BillboardTypeStr, m_billboardType ); + if( EditorGUI.EndChangeCheck() ) + { + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_billboardType ) ); + } + m_rotationIndependent = EditorGUILayoutToggle( BillboardOpHelper.BillboardRotIndStr, m_rotationIndependent ); + m_affectNormalTangent = EditorGUILayoutToggle( BillboardOpHelper.BillboardAffectNormalTangentStr , m_affectNormalTangent ); + } ); + EditorGUILayout.HelpBox( WarningMessage, MessageType.Warning ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.IsFragmentCategory ) + { + UIUtils.ShowMessage( UniqueId, ErrorMessage,MessageSeverity.Error ); + return m_outputPorts[0].ErrorValue; + } + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].ErrorValue; + + m_outputPorts[ 0 ].SetLocalValue( "0", dataCollector.PortCategory ); + string vertexPosValue = dataCollector.IsTemplate ? dataCollector.TemplateDataCollectorInstance.GetVertexPosition( WirePortDataType.OBJECT, CurrentPrecisionType ) : "v.vertex"; + string vertexNormalValue = dataCollector.IsTemplate ? dataCollector.TemplateDataCollectorInstance.GetVertexNormal( CurrentPrecisionType ) : "v.normal"; + string vertexTangentValue = dataCollector.IsTemplate ? dataCollector.TemplateDataCollectorInstance.GetVertexTangent( WirePortDataType.FLOAT4, CurrentPrecisionType ) : "v.tangent"; + + bool vertexIsFloat3 = false; + if( dataCollector.IsTemplate ) + { + InterpDataHelper info = dataCollector.TemplateDataCollectorInstance.GetInfo( TemplateInfoOnSematics.POSITION ); + if( info != null ) + { + vertexIsFloat3 = info.VarType == WirePortDataType.FLOAT3; + } + } + + BillboardOpHelper.FillDataCollector( ref dataCollector, m_billboardType, m_rotationIndependent, vertexPosValue, vertexNormalValue, vertexTangentValue, vertexIsFloat3, m_affectNormalTangent ); + + return "0"; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_billboardType = (BillboardType)Enum.Parse( typeof( BillboardType ), GetCurrentParam( ref nodeParams ) ); + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr , m_billboardType ) ); + m_rotationIndependent = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 18918 ) + { + m_affectNormalTangent = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_billboardType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_rotationIndependent ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_affectNormalTangent ); + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_billboardType ) ); + } + + public BillboardType Type { get { return m_billboardType; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs.meta new file mode 100644 index 00000000..6d3ff206 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 08fd3dd8f623aca42b7eb9962a89753d +timeCreated: 1501161489 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs new file mode 100644 index 00000000..47025b4f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs @@ -0,0 +1,37 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Vertex Bitangent", "Vertex Data", "Calculated bitangent vector in object space, can be used in both local vertex offset and fragment outputs. Already has tangent sign and object transform into account" )] + public sealed class BitangentVertexDataNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); + m_drawPreviewAsSphere = true; + m_previewShaderGUID = "76873532ab67d2947beaf07151383cbe"; + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + dataCollector.DirtyNormal = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if ( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) + { + dataCollector.ForceNormal = true; + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + } + + string vertexBitangent = GeneratorUtils.GenerateVertexBitangent( ref dataCollector, UniqueId, CurrentPrecisionType ); + return GetOutputVectorItem( 0, outputId, vertexBitangent ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs.meta new file mode 100644 index 00000000..98756a8b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 839ecbdfc8ed4fd4d8a08ec07f7159fa +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendIndicesNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendIndicesNode.cs new file mode 100644 index 00000000..17279e7f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendIndicesNode.cs @@ -0,0 +1,56 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Bone Blend Indices" , "Vertex Data" , "Bone indices for skinned Meshes" )] + public sealed class BlendIndicesNode : VertexDataNode + { + private const string IncorrectUnityVersionMessage = "This info is only available on Unity 2019.1 or above."; + private const string StandardSurfaceErrorMessage = "This info is not available on standard surface shaders."; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_outputPorts[ 1 ].ChangeType( WirePortDataType.UINT , false ); + m_outputPorts[ 2 ].ChangeType( WirePortDataType.UINT , false ); + m_outputPorts[ 3 ].ChangeType( WirePortDataType.UINT , false ); + m_outputPorts[ 4 ].ChangeType( WirePortDataType.UINT , false ); + m_currentVertexData = GeneratorUtils.VertexBlendIndicesStr; + m_errorMessageTypeIsError = NodeMessageType.Error; + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + if( UIUtils.CurrentWindow.OutsideGraph.IsStandardSurface ) + { + if( !m_showErrorMessage ) + { + m_showErrorMessage = true; + m_errorMessageTooltip = StandardSurfaceErrorMessage; + } + } + else + { + m_showErrorMessage = false; + } + } + + public override string GenerateShaderForOutput( int outputId , ref MasterNodeDataCollector dataCollector , bool ignoreLocalVar ) + { + string blendIndices = string.Empty; + if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + blendIndices = dataCollector.TemplateDataCollectorInstance.GetBlendIndices(); + return GetOutputVectorItem( 0 , outputId , blendIndices ); + } + + return GenerateErrorValue( outputId ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendIndicesNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendIndicesNode.cs.meta new file mode 100644 index 00000000..c8c434ae --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendIndicesNode.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: c2f0572db8612644b8e7fc2bcd16312b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendIndicesNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendWeightsNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendWeightsNode.cs new file mode 100644 index 00000000..70a74a31 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendWeightsNode.cs @@ -0,0 +1,52 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Bone Blend Weights" , "Vertex Data" , "Bone blend weights for skinned Meshes" )] + public sealed class BlendWeightsNode : VertexDataNode + { + private const string IncorrectUnityVersionMessage = "This info is only available on Unity 2019.1 or above."; + private const string StandardSurfaceErrorMessage = "This info is not available on standard surface shaders."; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentVertexData = GeneratorUtils.VertexBlendWeightsStr; + m_errorMessageTypeIsError = NodeMessageType.Error; + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + if( UIUtils.CurrentWindow.OutsideGraph.IsStandardSurface ) + { + if( !m_showErrorMessage ) + { + m_showErrorMessage = true; + m_errorMessageTooltip = StandardSurfaceErrorMessage; + } + } + else + { + m_showErrorMessage = false; + } + } + + public override string GenerateShaderForOutput( int outputId , ref MasterNodeDataCollector dataCollector , bool ignoreLocalVar ) + { + string blendWeights = string.Empty; + if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + blendWeights = dataCollector.TemplateDataCollectorInstance.GetBlendWeights(); + return GetOutputVectorItem( 0 , outputId , blendWeights ); + } + + return GenerateErrorValue( outputId ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendWeightsNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendWeightsNode.cs.meta new file mode 100644 index 00000000..b0e84be8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendWeightsNode.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: cb9d9029b584a7645a3d4aa2b45e34ab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BlendWeightsNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs new file mode 100644 index 00000000..0cea1618 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs @@ -0,0 +1,18 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "[VS] Vertex Color", "Vertex Data", "Vertex color. Only works on Vertex Shaders ports ( p.e. Local Vertex Offset Port ).", null,KeyCode.None,true,true,"Vertex Color",typeof(VertexColorNode))] + public sealed class ColorVertexDataNode : VertexDataNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentVertexData = "color"; + ConvertFromVectorToColorPorts(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs.meta new file mode 100644 index 00000000..16d0d5ff --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ca76669baa9fa204b8ce5200eb07c1db +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs new file mode 100644 index 00000000..c9e7c779 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs @@ -0,0 +1,44 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Vertex Normal", "Vertex Data", "Vertex normal vector in object space, can be used in both local vertex offset and fragment outputs" )] + public sealed class NormalVertexDataNode : VertexDataNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentVertexData = "normal"; + ChangeOutputProperties( 0, "XYZ", WirePortDataType.FLOAT3 ); + m_outputPorts[ 4 ].Visible = false; + m_drawPreviewAsSphere = true; + m_previewShaderGUID = "6b24b06c33f9fe84c8a2393f13ab5406"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + string vertexNormal = string.Empty; + + if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + vertexNormal = dataCollector.TemplateDataCollectorInstance.GetVertexNormal( CurrentPrecisionType ); + return GetOutputVectorItem( 0, outputId, vertexNormal ); + } + + if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + if( dataCollector.DirtyNormal ) + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + dataCollector.ForceNormal = true; + } + } + + vertexNormal = GeneratorUtils.GenerateVertexNormal( ref dataCollector, UniqueId, CurrentPrecisionType ); + return GetOutputVectorItem( 0, outputId, vertexNormal ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs.meta new file mode 100644 index 00000000..e8d02482 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4c7b60515f9cf6043bf8d03531d268f9 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectBoundsNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectBoundsNode.cs new file mode 100644 index 00000000..8b89993c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectBoundsNode.cs @@ -0,0 +1,68 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Object Bounds", "Object", "Object Bounds extracted from SRP per-object data" )] + public class ObjectBoundsNode : ParentNode + { + public const string NodeErrorMsg = "This node requires Universal or High-definition rendering pipeline version 14.0.4 or higher."; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.FLOAT3, "Min" ); + AddOutputPort( WirePortDataType.FLOAT3, "Max" ); + AddOutputPort( WirePortDataType.FLOAT3, "Size" ); + m_drawPreviewAsSphere = true; + m_textLabelWidth = 180; + m_errorMessageTooltip = NodeErrorMsg; + m_errorMessageTypeIsError = NodeMessageType.Error; + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + + bool isTemplate = ( ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader ); + bool isSRP = ( ContainerGraph.CurrentSRPType == TemplateSRPType.URP || ContainerGraph.CurrentSRPType == TemplateSRPType.HDRP ); + bool isSRPCompatible = ( ASEPackageManagerHelper.PackageSRPVersion >= 140004 ); + m_showErrorMessage = !isTemplate || !isSRP || !isSRPCompatible; + } + + public override void DrawProperties() + { + base.DrawProperties(); + if ( m_showErrorMessage ) + { + EditorGUILayout.HelpBox( NodeErrorMsg, MessageType.Error ); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( m_showErrorMessage ) + { + UIUtils.ShowMessage( NodeErrorMsg ); + return GenerateErrorValue(); + } + + if ( outputId == 0 ) + { + return dataCollector.TemplateDataCollectorInstance.GenerateObjectBoundsMin( ref dataCollector, UniqueId ); + } + else if ( outputId == 1 ) + { + return dataCollector.TemplateDataCollectorInstance.GenerateObjectBoundsMax( ref dataCollector, UniqueId ); + } + else + { + return dataCollector.TemplateDataCollectorInstance.GenerateObjectBoundsSize( ref dataCollector, UniqueId ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectBoundsNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectBoundsNode.cs.meta new file mode 100644 index 00000000..9cd19824 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectBoundsNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 84b78711d1fdc1243bf714605eab8be8 +timeCreated: 1493993914 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectBoundsNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectPositionNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectPositionNode.cs new file mode 100644 index 00000000..f5b83863 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectPositionNode.cs @@ -0,0 +1,28 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Object Position", "Object", "Object Position extracted directly from its transform matrix" )] + public class ObjectPositionNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); + m_drawPreviewAsSphere = true; + m_previewShaderGUID = "e95171394c12a0646b8e9ec9c3f87d56"; + m_textLabelWidth = 180; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + string objectPosition = GeneratorUtils.GenerateObjectPosition( ref dataCollector, UniqueId ); + return GetOutputVectorItem( 0, outputId, objectPosition ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectPositionNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectPositionNode.cs.meta new file mode 100644 index 00000000..63d7ebf3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectPositionNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 61472e4097698ac409caa9215d30441c +timeCreated: 1493993914 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectPositionNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs new file mode 100644 index 00000000..91c70d25 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs @@ -0,0 +1,75 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Object Scale", "Object", "Object Scale extracted directly from its transform matrix" )] + public class ObjectScaleNode : ParentNode + { + private const string RotationIndependentScaleStr = "Rotation Independent Scale"; + + [SerializeField] + private bool m_rotationIndependentScale = false; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); + m_drawPreviewAsSphere = true; + m_previewShaderGUID = "5540033c6c52f51468938c1a42bd2730"; + m_textLabelWidth = 180; + UpdateMaterialPass(); + m_autoWrapProperties = true; + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_rotationIndependentScale = EditorGUILayoutToggle( RotationIndependentScaleStr, m_rotationIndependentScale ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateMaterialPass(); + } + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + string objectScale = m_rotationIndependentScale ? GeneratorUtils.GenerateRotationIndependentObjectScale( ref dataCollector, UniqueId ): + GeneratorUtils.GenerateObjectScale( ref dataCollector, UniqueId ); + + return GetOutputVectorItem( 0, outputId, objectScale ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() < 17402 ) + { + m_rotationIndependentScale = false; + } + else + { + m_rotationIndependentScale = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + UpdateMaterialPass(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_rotationIndependentScale ); + } + + void UpdateMaterialPass() + { + m_previewMaterialPassId = m_rotationIndependentScale ? 1 : 0; + PreviewIsDirty = true; + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs.meta new file mode 100644 index 00000000..daa6dc11 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ef1fe46d0cc472e45ad13ac737db2c1e +timeCreated: 1493993914 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs new file mode 100644 index 00000000..e008e913 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs @@ -0,0 +1,421 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +using UnityEngine; +using UnityEditor; +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Outline", "Miscellaneous", "Uses vertices to simulate an outline around the object" )] + public sealed class OutlineNode : ParentNode + { + enum OutlineAlphaModes + { + None = 0, + Masked, + Transparent, + AlphaPremultiplied + }; + + private const string CullModePortNameStr = "Cull Mode"; + private const string AlphaModePortNameStr = "Alpha"; + private const string MaskedModePortNamStr = "Opacity Mask"; + private const string OutlineAlphaModeStr = "Alpha Mode"; + private const string OpacityMaskClipValueStr = "Mask Clip Value"; + private const string FragmentErrorMessage = "Outline node should only be connected to vertex ports."; + + private const string TemplateErrorMessage = "Outline node is only valid on the Standard Surface type"; + + [SerializeField] + private bool m_noFog = true; + + [SerializeField] + private string[] AvailableOutlineModes = { "Vertex Offset", "Vertex Scale", "Custom" }; + + [SerializeField] + private int[] AvailableOutlineValues = { 0, 1, 2 }; + + [SerializeField] + private int m_currentSelectedMode = 0; + + [SerializeField] + private OutlineAlphaModes m_currentAlphaMode = OutlineAlphaModes.None; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + [NonSerialized] + private StandardSurfaceOutputNode m_masterNode = null; + + [SerializeField] + private int m_zTestMode = 0; + + [SerializeField] + private int m_zWriteMode = 0; + + [SerializeField] + private CullMode m_cullMode = CullMode.Front; + + [SerializeField] + private ColorMaskHelper m_colorMaskHelper = new ColorMaskHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_colorMaskHelper.HideInlineButton(); + AddOutputPort( WirePortDataType.FLOAT3, "Out" ); + + AddInputPort( WirePortDataType.FLOAT3, false, "Color", -1, MasterNodePortCategory.Fragment, 0 ); + AddInputPort( WirePortDataType.FLOAT, false, "Alpha", -1, MasterNodePortCategory.Fragment, 2 ); + AddInputPort( WirePortDataType.FLOAT, false, "Width", -1, MasterNodePortCategory.Fragment, 1 ); + GetInputPortByUniqueId( 2 ).Visible = false; + m_textLabelWidth = 115; + m_hasLeftDropdown = true; + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, AvailableOutlineModes[ m_currentSelectedMode ] ) ); + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + if( GetInputPortByUniqueId( 0 ).IsConnected ) + dataCollector.UsingCustomOutlineColor = true; + + if( GetInputPortByUniqueId( 1 ).IsConnected ) + dataCollector.UsingCustomOutlineWidth = true; + + if( GetInputPortByUniqueId( 2 ).IsConnected ) + dataCollector.UsingCustomOutlineAlpha = true; + + if( !dataCollector.IsTemplate ) + { + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.ZWriteMode = m_zWriteMode; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.OffsetMode = m_currentSelectedMode; + } + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_currentSelectedMode = m_upperLeftWidget.DrawWidget( this, m_currentSelectedMode, AvailableOutlineModes ); + if( EditorGUI.EndChangeCheck() ) + { + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, AvailableOutlineModes[ m_currentSelectedMode ] ) ); + UpdatePorts(); + } + } + + void CheckAlphaPortVisibility() + { + InputPort alphaPort = GetInputPortByUniqueId( 2 ); + if( m_currentAlphaMode != OutlineAlphaModes.None ) + { + if( !alphaPort.Visible ) + alphaPort.Visible = true; + + if( m_currentAlphaMode == OutlineAlphaModes.Masked ) + { + GetInputPortByUniqueId( 2 ).Name = MaskedModePortNamStr; + } + else + { + GetInputPortByUniqueId( 2 ).Name = AlphaModePortNameStr; + } + m_sizeIsDirty = true; + } + + if( m_currentAlphaMode == OutlineAlphaModes.None && alphaPort.Visible ) + { + alphaPort.Visible = false; + m_sizeIsDirty = true; + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + + if ( m_showErrorMessage ) + { + EditorGUILayout.HelpBox( TemplateErrorMessage, MessageType.Error ); + } + + NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, () => + { + EditorGUI.BeginChangeCheck(); + m_currentSelectedMode = EditorGUILayoutIntPopup( "Type", m_currentSelectedMode, AvailableOutlineModes, AvailableOutlineValues ); + if( EditorGUI.EndChangeCheck() ) + { + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, AvailableOutlineModes[ m_currentSelectedMode ] ) ); + UpdatePorts(); + } + + EditorGUI.BeginChangeCheck(); + m_currentAlphaMode = (OutlineAlphaModes)EditorGUILayoutEnumPopup( OutlineAlphaModeStr, m_currentAlphaMode ); + if( EditorGUI.EndChangeCheck() ) + { + CheckAlphaPortVisibility(); + } + + if( m_currentAlphaMode == OutlineAlphaModes.Masked ) + { + if( m_masterNode == null ) + { + m_masterNode = UIUtils.CurrentWindow.OutsideGraph.CurrentMasterNode as StandardSurfaceOutputNode; + } + + if( m_masterNode != null ) + { + m_masterNode.ShowOpacityMaskValueUI(); + } + } + + m_cullMode = (CullMode)EditorGUILayoutEnumPopup( CullModePortNameStr, m_cullMode ); + m_zWriteMode = EditorGUILayoutPopup( ZBufferOpHelper.ZWriteModeStr, m_zWriteMode, ZBufferOpHelper.ZWriteModeValues ); + m_zTestMode = EditorGUILayoutPopup( ZBufferOpHelper.ZTestModeStr, m_zTestMode, ZBufferOpHelper.ZTestModeLabels ); + m_colorMaskHelper.Draw( this ); + m_noFog = EditorGUILayoutToggle( "No Fog", m_noFog ); + } ); + } + + void UpdatePorts() + { + if( m_currentSelectedMode == 2 ) //custom mode + { + GetInputPortByUniqueId( 1 ).ChangeProperties( "Offset", WirePortDataType.FLOAT3, false ); + } + else + { + GetInputPortByUniqueId( 1 ).ChangeProperties( "Width", WirePortDataType.FLOAT, false ); + } + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + m_showErrorMessage = ( m_containerGraph.CurrentShaderFunction == null ) ? !m_containerGraph.IsStandardSurface : false; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if( dataCollector.IsTemplate ) + { + UIUtils.ShowMessage( UniqueId , TemplateErrorMessage, MessageSeverity.Error ); + return m_outputPorts[ 0 ].ErrorValue; + } + + if( dataCollector.IsFragmentCategory ) + { + UIUtils.ShowMessage( UniqueId, FragmentErrorMessage , MessageSeverity.Error ); + return m_outputPorts[ 0 ].ErrorValue; + } + + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].ErrorValue; + + m_outputPorts[ 0 ].SetLocalValue( "0", dataCollector.PortCategory ); + + StandardSurfaceOutputNode masterNode = UIUtils.CurrentWindow.OutsideGraph.CurrentMasterNode as StandardSurfaceOutputNode; + + MasterNodeDataCollector outlineDataCollector = new MasterNodeDataCollector(); + outlineDataCollector.IsOutlineDataCollector = true; + outlineDataCollector.DirtyNormal = true; + + if( dataCollector.SurfaceCustomShadowCaster && dataCollector.CustomOutline ) + outlineDataCollector.CopyTextureChannelSizeFrom( ref dataCollector ); + + InputPort colorPort = GetInputPortByUniqueId( 0 ); + InputPort alphaPort = GetInputPortByUniqueId( 2 ); + InputPort vertexPort = GetInputPortByUniqueId( 1 ); + + //if( vertexPort.IsConnected ) + //{ + // outlineDataCollector.PortCategory = MasterNodePortCategory.Vertex; + // string outlineWidth = vertexPort.GenerateShaderForOutput( ref outlineDataCollector, vertexPort.DataType, true, true ); + // outlineDataCollector.AddToVertexLocalVariables( UniqueId, PrecisionType.Float, vertexPort.DataType, "outlineVar", outlineWidth ); + + // outlineDataCollector.AddVertexInstruction( outlineDataCollector.SpecialLocalVariables, UniqueId, false ); + // outlineDataCollector.ClearSpecialLocalVariables(); + + // outlineDataCollector.AddVertexInstruction( outlineDataCollector.VertexLocalVariables, UniqueId, false ); + // outlineDataCollector.ClearVertexLocalVariables(); + + // // need to check whether this breaks other outputs or not + // UIUtils.CurrentWindow.OutsideGraph.ResetNodesLocalVariables(); + //} + + outlineDataCollector.PortCategory = MasterNodePortCategory.Fragment; + string outlineColor = colorPort.GeneratePortInstructions( ref outlineDataCollector );// "\to.Emission = " + colorPort.GeneratePortInstructions( ref outlineDataCollector ) + ";"; + string alphaValue = alphaPort.Visible ? alphaPort.GeneratePortInstructions( ref outlineDataCollector ) : string.Empty; + + + + bool addTabs = outlineDataCollector.DirtySpecialLocalVariables || alphaPort.Available; + outlineDataCollector.AddInstructions( "\t" + outlineDataCollector.SpecialLocalVariables.TrimStart( '\t' ) ); + outlineDataCollector.ClearSpecialLocalVariables(); + outlineDataCollector.AddInstructions( ( addTabs ? "\t\t\t" : "" ) + "o.Emission = " + outlineColor + ";" ); + if( alphaPort.Visible ) + { + if( m_currentAlphaMode == OutlineAlphaModes.Masked ) + { + float maskClipValue = 0.5f; + + if( masterNode != null ) + maskClipValue = masterNode.OpacityMaskClipValue; + + if( masterNode.InlineOpacityMaskClipValue.IsValid ) + { + RangedFloatNode fnode = UIUtils.GetNode( masterNode.InlineOpacityMaskClipValue.NodeId ) as RangedFloatNode; + if( fnode != null ) + { + outlineDataCollector.AddToProperties( fnode.UniqueId, fnode.GetPropertyValue(), fnode.OrderIndex ); + outlineDataCollector.AddToUniforms( fnode.UniqueId, fnode.GetUniformValue() ); + } + else + { + IntNode inode = UIUtils.GetNode( masterNode.InlineOpacityMaskClipValue.NodeId ) as IntNode; + outlineDataCollector.AddToProperties( inode.UniqueId, inode.GetPropertyValue(), inode.OrderIndex ); + outlineDataCollector.AddToUniforms( inode.UniqueId, inode.GetUniformValue() ); + } + } + else + { + outlineDataCollector.AddToProperties( -1, string.Format( IOUtils.MaskClipValueProperty, OpacityMaskClipValueStr, maskClipValue ), -1 ); + outlineDataCollector.AddToUniforms( -1, string.Format( IOUtils.MaskClipValueUniform, maskClipValue ) ); + } + + outlineDataCollector.AddInstructions( ( addTabs ? "\n\t\t\t" : "" ) + "clip( " + alphaValue + " - " + masterNode.InlineOpacityMaskClipValue.GetValueOrProperty( IOUtils.MaskClipValueName, false ) + " );" ); + } + else + { + outlineDataCollector.AddInstructions( ( addTabs ? "\n\t\t\t" : "" ) + "o.Alpha = " + alphaValue + ";" ); + } + } + + if( outlineDataCollector.UsingWorldNormal ) + outlineDataCollector.AddInstructions( ( addTabs ? "\n\t\t\t" : "" ) + "o.Normal = float3(0,0,-1);" ); + + //Moved vertex port code generation from ln.227 to this after fragment ones + //to correctly include vertex instructions generated by them + UIUtils.CurrentWindow.OutsideGraph.ResetNodesLocalVariables(); + outlineDataCollector.PortCategory = MasterNodePortCategory.Vertex; + string outlineWidth = vertexPort.GenerateShaderForOutput( ref outlineDataCollector, vertexPort.DataType, true, true ); + + + outlineDataCollector.AddToVertexLocalVariables( UniqueId, PrecisionType.Float, vertexPort.DataType, "outlineVar", outlineWidth ); + + outlineDataCollector.AddVertexInstruction( outlineDataCollector.SpecialLocalVariables, UniqueId, false ); + outlineDataCollector.ClearSpecialLocalVariables(); + + outlineDataCollector.AddVertexInstruction( outlineDataCollector.VertexLocalVariables, UniqueId, false ); + outlineDataCollector.ClearVertexLocalVariables(); + + outlineDataCollector.AddASEMacros(); + + // need to check whether this breaks other outputs or not + UIUtils.CurrentWindow.OutsideGraph.ResetNodesLocalVariables(); + + if( masterNode != null ) + { + masterNode.CheckSamplingMacrosFlag(); + //masterNode.AdditionalIncludes.AddToDataCollector( ref outlineDataCollector ); + //masterNode.AdditionalPragmas.AddToDataCollector( ref outlineDataCollector ); + //masterNode.AdditionalDefines.AddToDataCollector( ref outlineDataCollector ); + if( !masterNode.CustomShadowCaster ) + masterNode.AdditionalDirectives.AddAllToDataCollector( ref outlineDataCollector ); + } + + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.InputList = outlineDataCollector.InputList; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Inputs = outlineDataCollector.Inputs; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.DirtyInput = outlineDataCollector.DirtyInputs; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Includes = outlineDataCollector.Includes; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Pragmas = outlineDataCollector.Pragmas; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Defines = outlineDataCollector.Defines; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.StandardAdditionalDirectives = outlineDataCollector.StandardAdditionalDirectives; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Uniforms = outlineDataCollector.Uniforms; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.InstancedProperties = outlineDataCollector.InstancedProperties; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.GrabPasses = outlineDataCollector.GrabPass; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.UniformList = outlineDataCollector.UniformsList; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.InstancedPropertiesList = outlineDataCollector.InstancedPropertiesList; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.VertexData = outlineDataCollector.VertexData; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Instructions = outlineDataCollector.Instructions; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Functions = outlineDataCollector.Functions; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.LocalFunctions = outlineDataCollector.LocalFunctions; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.OutlineCullMode = m_cullMode; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.ZTestMode = m_zTestMode; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.ZWriteMode = m_zWriteMode; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.OffsetMode = m_currentSelectedMode; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.CustomNoFog = m_noFog; + UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.ColorMask = m_colorMaskHelper.ColorMask; + dataCollector.CustomOutlineSelectedAlpha = (int)m_currentAlphaMode; + + for( int i = 0; i < outlineDataCollector.PropertiesList.Count; i++ ) + { + dataCollector.AddToProperties( UniqueId, outlineDataCollector.PropertiesList[ i ].PropertyName, outlineDataCollector.PropertiesList[ i ].OrderIndex ); + } + + dataCollector.UsingInternalData = dataCollector.UsingInternalData || outlineDataCollector.UsingInternalData; + UIUtils.CurrentWindow.OutsideGraph.ResetNodesLocalVariablesIfNot( MasterNodePortCategory.Vertex ); + return "0"; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_currentSelectedMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_noFog = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > 14202 ) + m_currentAlphaMode = (OutlineAlphaModes)Enum.Parse( typeof( OutlineAlphaModes ), GetCurrentParam( ref nodeParams ) ); + + if( UIUtils.CurrentShaderVersion() > 14302 ) + { + m_zWriteMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_zTestMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 15304 ) + { + m_cullMode = (CullMode)Enum.Parse( typeof( CullMode ), GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 18926 ) + { + m_colorMaskHelper.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, AvailableOutlineModes[ m_currentSelectedMode ] ) ); + UpdatePorts(); + CheckAlphaPortVisibility(); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentSelectedMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_noFog ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentAlphaMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_zWriteMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_zTestMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_cullMode ); + m_colorMaskHelper.WriteToString( ref nodeInfo ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs.meta new file mode 100644 index 00000000..6ec85c30 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 24f267627c002964badad2901309c96a +timeCreated: 1501161489 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs new file mode 100644 index 00000000..4994f06b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs @@ -0,0 +1,143 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Vertex Position", "Vertex Data", "Vertex position vector in object space, can be used in both local vertex offset and fragment outputs" )] + public sealed class PosVertexDataNode : VertexDataNode + { + private const string PropertyLabel = "Size"; + private readonly string[] SizeLabels = { "XYZ", "XYZW" }; + + [SerializeField] + private int m_sizeOption = 0; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentVertexData = "vertex"; + ChangeOutputProperties( 0, "XYZ", WirePortDataType.FLOAT3 ); + m_drawPreviewAsSphere = true; + m_outputPorts[ 4 ].Visible = false; + m_hasLeftDropdown = true; + m_autoWrapProperties = true; + m_previewShaderGUID = "a5c14f759dd021b4b8d4b6eeb85ac227"; + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_sizeOption = m_upperLeftWidget.DrawWidget( this, m_sizeOption, SizeLabels ); + if( EditorGUI.EndChangeCheck() ) + { + UpdatePorts(); + } + } + + public override void DrawProperties() + { + EditorGUI.BeginChangeCheck(); + m_sizeOption = EditorGUILayoutPopup( PropertyLabel, m_sizeOption, SizeLabels ); + if ( EditorGUI.EndChangeCheck() ) + { + UpdatePorts(); + } + } + + void UpdatePorts() + { + if ( m_sizeOption == 0 ) + { + ChangeOutputProperties( 0, SizeLabels[ 0 ], WirePortDataType.FLOAT3, false ); + m_outputPorts[ 4 ].Visible = false; + } + else + { + ChangeOutputProperties( 0, SizeLabels[ 1 ], WirePortDataType.FLOAT4, false ); + m_outputPorts[ 4 ].Visible = true; + } + } + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowNoVertexModeNodeMessage( this ); + return "0"; + } + + if ( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + string vertexPos = dataCollector.TemplateDataCollectorInstance.GetVertexPosition( ( m_sizeOption == 0 ) ? WirePortDataType.FLOAT3 : WirePortDataType.FLOAT4, CurrentPrecisionType ); + return GetOutputVectorItem( 0, outputId, vertexPos ); + } + + + if ( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); + + WirePortDataType sizeType = m_sizeOption == 0 ? WirePortDataType.FLOAT3 : WirePortDataType.FLOAT4; + + string vertexPosition = GeneratorUtils.GenerateVertexPosition( ref dataCollector, UniqueId, sizeType ); + return GetOutputVectorItem( 0, outputId, vertexPosition ); + + //if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + //{ + // string vertexVar = base.GenerateShaderForOutput( 0, ref dataCollector, ignoreLocalVar ); + // if ( outputId != 0 ) + // { + // return GetOutputVectorItem( 0, outputId, vertexVar ); + // } + // else if ( m_sizeOption == 0 ) + // { + // vertexVar += ".xyz"; + // } + + // return vertexVar; + //} + //else + //{ + + // string vertexVar = GeneratorUtils.GenerateVertexPositionOnFrag( ref dataCollector, UniqueId, m_currentPrecisionType ); + // if ( outputId != 0 ) + // { + // return GetOutputVectorItem( 0, outputId, vertexVar ); + // } + // else if ( m_sizeOption == 0 ) + // { + // vertexVar += ".xyz"; + // } + // return GetOutputVectorItem( 0, outputId, vertexVar ); + //} + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if ( UIUtils.CurrentShaderVersion() > 7101 ) + { + m_sizeOption = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + UpdatePorts(); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_sizeOption ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs.meta new file mode 100644 index 00000000..9882e520 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: fc77801277f0faf4ca0be33f565b5604 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs new file mode 100644 index 00000000..f9beb05c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs @@ -0,0 +1,23 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Vertex Tangent Sign", "Vertex Data", "Vertex tangent sign in object space, return the W value of tangent vector that contains only the sign of the tangent" )] + public sealed class TangentSignVertexDataNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputVectorPorts( WirePortDataType.FLOAT, "Sign" ); + m_drawPreviewAsSphere = true; + m_previewShaderGUID = "f5466d126f4bb1f49917eac88b1cb6af"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + return GeneratorUtils.GenerateVertexTangentSign( ref dataCollector, UniqueId, CurrentPrecisionType ); ; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs.meta new file mode 100644 index 00000000..8b6cd7e8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1f79f23d5c10c9e4fb6a59c1ef70f6fc +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs new file mode 100644 index 00000000..e7492558 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs @@ -0,0 +1,120 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Vertex Tangent", "Vertex Data", "Vertex tangent vector in object space, can be used in both local vertex offset and fragment outputs" )] + public sealed class TangentVertexDataNode : VertexDataNode + { + private const string PropertyLabel = "Size"; + private readonly string[] SizeLabels = { "XYZ", "XYZW" }; + + [SerializeField] + private int m_sizeOption = 0; + + private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentVertexData = "tangent"; + ChangeOutputProperties( 0, "XYZ", WirePortDataType.FLOAT3 ); + m_outputPorts[ 4 ].Visible = false; + m_drawPreviewAsSphere = true; + m_hasLeftDropdown = true; + m_previewShaderGUID = "0a44bb521d06d6143a4acbc3602037f8"; + } + + public override void Destroy() + { + base.Destroy(); + m_upperLeftWidget = null; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + EditorGUI.BeginChangeCheck(); + m_sizeOption = m_upperLeftWidget.DrawWidget( this, m_sizeOption, SizeLabels ); + if( EditorGUI.EndChangeCheck() ) + { + UpdatePorts(); + } + } + + public override void DrawProperties() + { + EditorGUI.BeginChangeCheck(); + m_sizeOption = EditorGUILayoutPopup( PropertyLabel, m_sizeOption, SizeLabels ); + if( EditorGUI.EndChangeCheck() ) + { + UpdatePorts(); + } + } + + void UpdatePorts() + { + if( m_sizeOption == 0 ) + { + ChangeOutputProperties( 0, SizeLabels[ 0 ], WirePortDataType.FLOAT3, false ); + m_outputPorts[ 4 ].Visible = false; + } + else + { + ChangeOutputProperties( 0, SizeLabels[ 1 ], WirePortDataType.FLOAT4, false ); + m_outputPorts[ 4 ].Visible = true; + } + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + dataCollector.DirtyNormal = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + string vertexTangent = string.Empty; + if ( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + vertexTangent = dataCollector.TemplateDataCollectorInstance.GetVertexTangent( WirePortDataType.FLOAT4, CurrentPrecisionType ); + if( m_sizeOption == 0 ) + vertexTangent += ".xyz"; + + return GetOutputVectorItem( 0, outputId, vertexTangent ); + } + + if ( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) + { + dataCollector.ForceNormal = true; + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + } + + WirePortDataType sizeType = m_sizeOption == 0 ? WirePortDataType.FLOAT3 : WirePortDataType.FLOAT4; + + vertexTangent = GeneratorUtils.GenerateVertexTangent( ref dataCollector, UniqueId, CurrentPrecisionType, sizeType ); + return GetOutputVectorItem( 0, outputId, vertexTangent ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 16100 ) + { + m_sizeOption = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + UpdatePorts(); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_sizeOption ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs.meta new file mode 100644 index 00000000..a4db98b9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b544118f39abfe84581b8249973d52c5 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation.meta new file mode 100644 index 00000000..89948ec8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 518d8e72c2385b9488817fee5368f56c +folderAsset: yes +timeCreated: 1482150091 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs new file mode 100644 index 00000000..c49df07f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs @@ -0,0 +1,30 @@ + +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Distance-based Tessellation", "Miscellaneous", "Calculates tessellation based on distance from camera" )] + public sealed class DistanceBasedTessNode : TessellationParentNode + { + private const string FunctionBody = "UnityDistanceBasedTess( v0.vertex, v1.vertex, v2.vertex, {0},{1},{2})"; + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false,"Factor"); + AddInputPort( WirePortDataType.FLOAT, false, "Min Dist" ); + AddInputPort( WirePortDataType.FLOAT, false, "Max Dist" ); + AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); + } + + protected override string BuildTessellationFunction( ref MasterNodeDataCollector dataCollector ) + { + return string.Format( FunctionBody, + m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ), + m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ), + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs.meta new file mode 100644 index 00000000..709cc77f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5a83fb450d164d34bb756f46b3f4290e +timeCreated: 1482150091 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs new file mode 100644 index 00000000..48c5db07 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs @@ -0,0 +1,27 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Edge Length Tessellation With Cull", "Miscellaneous", "Tessellation level computed based on triangle edge length on the screen with patch frustum culling" )] + public sealed class EdgeLengthCullTessNode : TessellationParentNode + { + private const string FunctionBody = "UnityEdgeLengthBasedTessCull( v0.vertex, v1.vertex, v2.vertex, {0},{1})"; + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "Edge Length" ); + AddInputPort( WirePortDataType.FLOAT, false, "Max Disp." ); + AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); + } + + protected override string BuildTessellationFunction( ref MasterNodeDataCollector dataCollector ) + { + return string.Format( FunctionBody, + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), + m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs.meta new file mode 100644 index 00000000..35e4c82d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4b09c64ce2fd06a4cb4036d8cc0f8b2a +timeCreated: 1482150962 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs new file mode 100644 index 00000000..f4905bf1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs @@ -0,0 +1,23 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Edge Length Tessellation", "Miscellaneous", "Tessellation level computed based on triangle edge length on the screen" )] + public sealed class EdgeLengthTessNode : TessellationParentNode + { + private const string FunctionBody = "UnityEdgeLengthBasedTess (v0.vertex, v1.vertex, v2.vertex, {0})"; + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddInputPort( WirePortDataType.FLOAT, false, "Edge Length" ); + AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); + } + + protected override string BuildTessellationFunction( ref MasterNodeDataCollector dataCollector ) + { + return string.Format( FunctionBody, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs.meta new file mode 100644 index 00000000..1a966a64 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: abe3e8fa4d49c9742a95ac801fd14d7d +timeCreated: 1482150962 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs new file mode 100644 index 00000000..be14febc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs @@ -0,0 +1,29 @@ +namespace AmplifyShaderEditor +{ + public class TessellationParentNode : ParentNode + { + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_useInternalPortData = true; + } + + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( dataCollector.PortCategory != MasterNodePortCategory.Tessellation ) + { + UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " can only be used on Master Node Tessellation port" ); + return "(-1)"; + } + + return BuildTessellationFunction( ref dataCollector ); + } + + protected virtual string BuildTessellationFunction( ref MasterNodeDataCollector dataCollector ) + { + return string.Empty; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs.meta new file mode 100644 index 00000000..7cbe6862 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 79c24faef1fec884d937e74bdc9209da +timeCreated: 1482162387 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs new file mode 100644 index 00000000..5297ac7d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs @@ -0,0 +1,16 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "[VS] Vertex TexCoord1", "Vertex Data", "Second set of vertex texture coordinates. Only works on Vertex Shaders ports ( p.e. Local Vertex Offset Port )." ,null,UnityEngine.KeyCode.None,true,true, "[VS] Vertex TexCoord" )] + public sealed class TexCoord1VertexDataNode : VertexDataNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentVertexData = "texcoord1"; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs.meta new file mode 100644 index 00000000..c575c524 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ebd7eb3a7f6149e4e9dacbcda2d8089f +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs new file mode 100644 index 00000000..c066304d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs @@ -0,0 +1,245 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Vertex TexCoord", "Vertex Data", "Vertex texture coordinates, can be used in both local vertex offset and fragment outputs", tags: "uv" )] + public sealed class TexCoordVertexDataNode : VertexDataNode + { + [SerializeField] + private int m_texcoordSize = 2; + + [SerializeField] + private int m_index = 0; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentVertexData = "texcoord"; + ChangeOutputProperties( 0, "UV", WirePortDataType.FLOAT2, false ); + m_outputPorts[ 1 ].Name = "U"; + m_outputPorts[ 2 ].Name = "V"; + m_outputPorts[ 3 ].Visible = false; + m_outputPorts[ 4 ].Visible = false; + m_outputPorts[ 3 ].Name = "W"; + m_outputPorts[ 4 ].Name = "T"; + m_autoWrapProperties = true; + m_hasLeftDropdown = true; + m_previewShaderGUID = "6c1bee77276896041bbb73b1b9e7f8ac"; + } + + public override void DrawProperties() + { + base.DrawProperties(); + EditorGUI.BeginChangeCheck(); + m_texcoordSize = EditorGUILayoutIntPopup( Constants.AvailableUVSizesLabel, m_texcoordSize, Constants.AvailableUVSizesStr, Constants.AvailableUVSizes ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateOutput(); + } + + EditorGUI.BeginChangeCheck(); + m_index = EditorGUILayoutIntPopup( Constants.AvailableUVChannelLabel, m_index, Constants.AvailableUVSetsStr, Constants.AvailableUVChannels ); + if( EditorGUI.EndChangeCheck() ) + { + m_currentVertexData = ( m_index == 0 ) ? "texcoord" : "texcoord" + Constants.AvailableUVChannelsStr[ m_index ]; + } + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( m_dropdownEditing ) + { + EditorGUI.BeginChangeCheck(); + m_texcoordSize = EditorGUIIntPopup( m_dropdownRect, m_texcoordSize, Constants.AvailableUVSizesStr, Constants.AvailableUVSizes, UIUtils.PropertyPopUp ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateOutput(); + DropdownEditing = false; + } + } + } + + private void UpdateOutput() + { + if( m_texcoordSize == 3 ) + { + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); + m_outputPorts[ 0 ].Name = "UVW"; + m_outputPorts[ 3 ].Visible = true; + m_outputPorts[ 4 ].Visible = false; + } + else if( m_texcoordSize == 4 ) + { + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); + m_outputPorts[ 0 ].Name = "UVWT"; + m_outputPorts[ 3 ].Visible = true; + m_outputPorts[ 4 ].Visible = true; + } + else + { + m_texcoordSize = 2; + m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); + m_outputPorts[ 0 ].Name = "UV"; + m_outputPorts[ 3 ].Visible = false; + m_outputPorts[ 4 ].Visible = false; + } + m_sizeIsDirty = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if( dataCollector.IsTemplate ) + { + if( !dataCollector.TemplateDataCollectorInstance.HasUV( m_index ) ) + { + dataCollector.TemplateDataCollectorInstance.RegisterUV( m_index, m_outputPorts[ 0 ].DataType ); + } + + string result = string.Empty; + if( dataCollector.TemplateDataCollectorInstance.GetCustomInterpolatedData( TemplateHelperFunctions.IntToUVChannelInfo[ m_index ], m_outputPorts[ 0 ].DataType, PrecisionType.Float, ref result, false, dataCollector.PortCategory ) ) + { + return GetOutputVectorItem( 0, outputId, result ); + } + else + if( dataCollector.TemplateDataCollectorInstance.HasUV( m_index ) ) + { + InterpDataHelper info = dataCollector.TemplateDataCollectorInstance.GetUVInfo( m_index ); + if( outputId == 0 ) + { + return dataCollector.TemplateDataCollectorInstance.GetUVName( m_index, m_outputPorts[ 0 ].DataType ); + } + else if( outputId <= TemplateHelperFunctions.DataTypeChannelUsage[ info.VarType ] ) + { + return GetOutputVectorItem( 0, outputId, info.VarName ); + } + Debug.LogWarning( "Attempting to access inexisting UV channel" ); + } + else + { + Debug.LogWarning( "Attempting to access non-registered UV" ); + } + return "0"; + } + + if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) + { + if( m_texcoordSize > 2 ) + dataCollector.UsingHigherSizeTexcoords = true; + } + + WirePortDataType size = (WirePortDataType)( 1 << ( m_texcoordSize + 1 ) ); + string texcoords = GeneratorUtils.GenerateAutoUVs( ref dataCollector, UniqueId, m_index, null, size ); + return GetOutputVectorItem( 0, outputId, texcoords ); + } + + /// + /// Generates UV properties and uniforms and returns the varible name to use in the fragment shader + /// + /// + /// + /// + /// frag variable name + static public string GenerateFragUVs( ref MasterNodeDataCollector dataCollector, int uniqueId, int index, string propertyName = null, WirePortDataType size = WirePortDataType.FLOAT2 ) + { + string dummyPropUV = "_texcoord" + ( index > 0 ? ( index + 1 ).ToString() : "" ); + string dummyUV = "uv" + ( index > 0 ? ( index + 1 ).ToString() : "" ) + dummyPropUV; + + dataCollector.AddToProperties( uniqueId, "[HideInInspector] " + dummyPropUV + "( \"\", 2D ) = \"white\" {}", 100 ); + dataCollector.AddToInput( uniqueId, dummyUV, size ); + + string result = Constants.InputVarStr + "." + dummyUV; + if( !string.IsNullOrEmpty( propertyName ) ) + { + dataCollector.AddToUniforms( uniqueId, "uniform float4 " + propertyName + "_ST;" ); + dataCollector.AddToLocalVariables( uniqueId, PrecisionType.Float, size, "uv" + propertyName, result + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw" ); + result = "uv" + propertyName; + } + + return result; + } + + static public string GenerateVertexUVs( ref MasterNodeDataCollector dataCollector, int uniqueId, int index, string propertyName = null, WirePortDataType size = WirePortDataType.FLOAT2 ) + { + + string result = Constants.VertexShaderInputStr + ".texcoord"; + if( index > 0 ) + { + result += index.ToString(); + } + + switch( size ) + { + default: + case WirePortDataType.FLOAT2: + { + result += ".xy"; + } + break; + case WirePortDataType.FLOAT3: + { + result += ".xyz"; + } + break; + case WirePortDataType.FLOAT4: break; + } + + if( !string.IsNullOrEmpty( propertyName ) ) + { + dataCollector.AddToUniforms( uniqueId, "uniform float4 " + propertyName + "_ST;" ); + dataCollector.AddToVertexLocalVariables( uniqueId, UIUtils.WirePortToCgType( size ) + " uv" + propertyName + " = " + Constants.VertexShaderInputStr + ".texcoord" + ( index > 0 ? index.ToString() : string.Empty ) + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw;" ); + result = "uv" + propertyName; + } + + return result; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 2502 ) + { + m_index = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 5111 ) + { + m_texcoordSize = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + UpdateOutput(); + } + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_index ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_texcoordSize ); + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + if( dataCollector.IsTemplate ) + { + dataCollector.TemplateDataCollectorInstance.SetUVUsage( m_index , m_texcoordSize ); + } + else + { + dataCollector.SetTextureChannelSize( m_index , m_outputPorts[ 0 ].DataType ); + if( m_index > 3 ) + { + dataCollector.AddCustomAppData( string.Format( TemplateHelperFunctions.TexUVFullSemantic , m_index ) ); + } + } + } + + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs.meta new file mode 100644 index 00000000..243f346e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b865968ce22b9d949993e5e60126eb11 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs new file mode 100644 index 00000000..924ffa24 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs @@ -0,0 +1,48 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Vertex Binormal World +// Donated by Community Member Kebrus + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "World Bitangent", "Surface Data", "Per pixel world bitangent vector", null, KeyCode.None, true, false, null, null, "kebrus" )] + public sealed class VertexBinormalNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); + m_drawPreviewAsSphere = true; + m_previewShaderGUID = "76873532ab67d2947beaf07151383cbe"; + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData, ref dataCollector ); + dataCollector.DirtyNormal = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( dataCollector.IsTemplate ) + return GetOutputVectorItem( 0, outputId, dataCollector.TemplateDataCollectorInstance.GetWorldBinormal( CurrentPrecisionType ) ); + + if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) + { + dataCollector.ForceNormal = true; + + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + } + + string worldBitangent = GeneratorUtils.GenerateWorldBitangent( ref dataCollector, UniqueId ); + + return GetOutputVectorItem( 0, outputId, worldBitangent ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs.meta new file mode 100644 index 00000000..9e8fbd40 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 8ae297dac4e208f4e86c8f7a022fc5bd +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs new file mode 100644 index 00000000..53ef5763 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs @@ -0,0 +1,47 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Vertex Color", "Vertex Data", "Vertex color interpolated on fragment" )] + public sealed class VertexColorNode : VertexDataNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentVertexData = "color"; + m_outputPorts[ 0 ].Name = "RGBA"; + ConvertFromVectorToColorPorts(); + m_drawPreviewAsSphere = true; + m_previewShaderGUID = "ca1d22db6470c5f4d9f93a9873b4f5bc"; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + string color = dataCollector.TemplateDataCollectorInstance.GetVertexColor( CurrentPrecisionType ); + return GetOutputColorItem( 0, outputId, color ); + } + + if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); + } + else + { + dataCollector.AddToInput( UniqueId, SurfaceInputs.COLOR ); + string result = Constants.InputVarStr + "." + Constants.ColorVariable; + switch( outputId ) + { + case 1: result += ".r"; break; + case 2: result += ".g"; break; + case 3: result += ".b"; break; + case 4: result += ".a"; break; + } + return result; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs.meta new file mode 100644 index 00000000..4e803f42 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6271f602b9ab61e4c9a96a91e473c1e0 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs new file mode 100644 index 00000000..9fa8cffd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs @@ -0,0 +1,50 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + //public enum VertexData + //{ + // vertex = 0, + // tangent, + // normal, + // texcoord, + // texcoord1, + // color + //} + + [Serializable] + public class VertexDataNode : ParentNode + { + [SerializeField] + protected string m_currentVertexData; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_currentVertexData = "vertex"; + +// Type type = typeof( StandardSurfaceOutputNode ); + //m_restictions.AddPortRestriction( type, 0 ); + //m_restictions.AddPortRestriction( type, 2 ); + //m_restictions.AddPortRestriction( type, 3 ); + //m_restictions.AddPortRestriction( type, 4 ); + //m_restictions.AddPortRestriction( type, 5 ); + //m_restictions.AddPortRestriction( type, 6 ); + //m_restictions.AddPortRestriction( type, 7 ); + //m_restictions.AddPortRestriction( type, 8 ); + //m_restictions.AddPortRestriction( type, 9 ); + //m_restictions.AddPortRestriction( type, 10 ); + AddOutputVectorPorts( WirePortDataType.FLOAT4, "Out" ); + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); + return GetOutputVectorItem( 0, outputId, Constants.VertexShaderInputStr + "." + m_currentVertexData ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs.meta new file mode 100644 index 00000000..89189312 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e5f8fa23e49e4be478b283a704459767 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs new file mode 100644 index 00000000..57bc4ea6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs @@ -0,0 +1,50 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Vertex Tangent World +// Donated by Community Member Kebrus + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "World Tangent", "Surface Data", "Per pixel world tangent vector", null, KeyCode.None, true, false, null, null, "kebrus" )] + public sealed class VertexTangentNode : ParentNode + { + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); + m_drawPreviewAsSphere = true; + m_previewShaderGUID = "61f0b80493c9b404d8c7bf56d59c3f81"; + } + + public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) + { + base.PropagateNodeData( nodeData , ref dataCollector ); + dataCollector.DirtyNormal = true; + } + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) + { + if ( dataCollector.IsTemplate ) + { + return GetOutputVectorItem( 0, outputId, dataCollector.TemplateDataCollectorInstance.GetWorldTangent( CurrentPrecisionType ) ); + } + + if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) + { + dataCollector.ForceNormal = true; + + dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + } + + string worldTangent = GeneratorUtils.GenerateWorldTangent( ref dataCollector, UniqueId ); + + return GetOutputVectorItem( 0, outputId, worldTangent ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs.meta new file mode 100644 index 00000000..e3038180 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3aca1dfe55df44d4cbaf99d5a40f7470 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs new file mode 100644 index 00000000..68de3f0e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs @@ -0,0 +1,187 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +// +// Custom Node Vertex To Fragment +// Donated by Jason Booth - http://u3d.as/DND + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [System.Serializable] + [NodeAttributes( "Vertex To Fragment", "Miscellaneous", "Pass vertex data to the pixel shader", null, KeyCode.None, true, false, null, null, "Jason Booth - http://u3d.as/DND" )] + public sealed class VertexToFragmentNode : SingleInputOp + { + private const string DisabledInterpolatorMsg = "No Interpolation option cannot be used over Standard Surface type as we must be able to directly control interpolators registry, which does't happen over this shader type. Please disable it."; + private const string NoInterpolationUsageMsg = "No interpolation is performed when passing value from vertex to fragment during rasterization. Please note this option will not work across all API's and can even throw compilation errors on some of them ( p.e. Metal and GLES 2.0 )"; + + private const string SampleInfoMessage = "Interpolate at sample location rather than at the pixel center. This causes the pixel shader to execute per-sample rather than per-pixel. Only available in shader model 4.1 or higher"; + + [SerializeField] + private bool m_noInterpolation; + + [SerializeField] + private bool m_sample; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_inputPorts[ 0 ].AddPortForbiddenTypes( WirePortDataType.FLOAT3x3, + WirePortDataType.FLOAT4x4, + WirePortDataType.SAMPLER1D, + WirePortDataType.SAMPLER2D, + WirePortDataType.SAMPLER3D, + WirePortDataType.SAMPLERCUBE, + WirePortDataType.SAMPLER2DARRAY, + WirePortDataType.SAMPLERSTATE ); + m_inputPorts[ 0 ].Name = "(VS) In"; + m_outputPorts[ 0 ].Name = "Out"; + m_useInternalPortData = false; + m_autoWrapProperties = true; + m_errorMessageTypeIsError = NodeMessageType.Warning; + m_previewShaderGUID = "74e4d859fbdb2c0468de3612145f4929"; + } + + public override void DrawProperties() + { + base.DrawProperties(); + bool isSurface = ContainerGraph.IsStandardSurface; + EditorGUI.BeginDisabledGroup( isSurface && !m_noInterpolation ); + m_noInterpolation = EditorGUILayoutToggle( "No Interpolation" , m_noInterpolation ); + EditorGUI.EndDisabledGroup(); + if( m_noInterpolation ) + { + if( isSurface ) + { + EditorGUILayout.HelpBox( DisabledInterpolatorMsg, MessageType.Warning ); + } else + { + EditorGUILayout.HelpBox( NoInterpolationUsageMsg, MessageType.Info ); + } + } + + EditorGUI.BeginDisabledGroup( isSurface && !m_sample ); + m_sample = EditorGUILayoutToggle( "Sample" , m_sample ); + EditorGUI.EndDisabledGroup(); + if( m_sample ) + EditorGUILayout.HelpBox( SampleInfoMessage , MessageType.Info ); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + m_showErrorMessage = ContainerGraph.IsStandardSurface && m_noInterpolation || + ContainerGraph.IsStandardSurface && m_sample; + } + + + public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) + return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); + + bool noInterpolationFlag = dataCollector.IsTemplate ? m_noInterpolation : false; + bool sampleFlag = dataCollector.IsTemplate ? m_sample : false; + string varName = GenerateInputInVertex( ref dataCollector, 0, "vertexToFrag" + OutputId,true, noInterpolationFlag, sampleFlag ); + m_outputPorts[ 0 ].SetLocalValue( varName, dataCollector.PortCategory ); + + return varName; + + ////TEMPLATES + //if( dataCollector.IsTemplate ) + //{ + // if( !dataCollector.IsFragmentCategory ) + // return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + // string varName = "vertexToFrag" + OutputId; + // if( dataCollector.TemplateDataCollectorInstance.HasCustomInterpolatedData( varName ) ) + // return varName; + + // MasterNodePortCategory category = dataCollector.PortCategory; + // dataCollector.PortCategory = MasterNodePortCategory.Vertex; + // bool dirtyVertexVarsBefore = dataCollector.DirtyVertexVariables; + // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); + + // string data = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + + // dataCollector.PortCategory = category; + // if( !dirtyVertexVarsBefore && dataCollector.DirtyVertexVariables ) + // { + // dataCollector.AddVertexInstruction( dataCollector.VertexLocalVariables, UniqueId, false ); + // dataCollector.ClearVertexLocalVariables(); + // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); + // } + + // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Fragment ); + + // dataCollector.TemplateDataCollectorInstance.RegisterCustomInterpolatedData( varName, m_inputPorts[ 0 ].DataType, m_currentPrecisionType, data ); + // //return varName; + + // m_outputPorts[ 0 ].SetLocalValue( varName ); + // return m_outputPorts[ 0 ].LocalValue; + //} + + ////SURFACE + //{ + // if( !dataCollector.IsFragmentCategory ) + // { + // return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + // } + + // if( dataCollector.TesselationActive ) + // { + // UIUtils.ShowMessage( "Unable to use Vertex to Frag when Tessellation is active" ); + // return m_outputPorts[ 0 ].ErrorValue; + // } + + + // string interpName = "data" + OutputId; + // dataCollector.AddToInput( UniqueId, interpName, m_inputPorts[ 0 ].DataType, m_currentPrecisionType ); + + // MasterNodePortCategory portCategory = dataCollector.PortCategory; + // dataCollector.PortCategory = MasterNodePortCategory.Vertex; + + // bool dirtyVertexVarsBefore = dataCollector.DirtyVertexVariables; + + // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); + + // string vertexVarValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); + // dataCollector.AddLocalVariable( UniqueId, Constants.VertexShaderOutputStr + "." + interpName, vertexVarValue + ";" ); + + // dataCollector.PortCategory = portCategory; + + // if( !dirtyVertexVarsBefore && dataCollector.DirtyVertexVariables ) + // { + // dataCollector.AddVertexInstruction( dataCollector.VertexLocalVariables, UniqueId, false ); + // dataCollector.ClearVertexLocalVariables(); + // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); + // } + + // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Fragment ); + + // //return Constants.InputVarStr + "." + interpName; + + // m_outputPorts[ 0 ].SetLocalValue( Constants.InputVarStr + "." + interpName ); + // return m_outputPorts[ 0 ].LocalValue; + //} + } + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > 18707 ) + m_noInterpolation = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + + if( UIUtils.CurrentShaderVersion() > 18808 ) + m_sample = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_noInterpolation ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_sample ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs.meta new file mode 100644 index 00000000..9f48ecee --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 9ecea5c13558ad4499dd4bc558670b8e +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs new file mode 100644 index 00000000..e6fd5c67 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs @@ -0,0 +1,47 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; + +using System.Collections.Generic; +namespace AmplifyShaderEditor +{ + public class PreMadeShaders + { + public static readonly string FlatColorSequenceId = "Flat Color"; + private Dictionary m_actionLib; + public PreMadeShaders() + { + m_actionLib = new Dictionary(); + ActionSequence sequence = new ActionSequence( FlatColorSequenceId ); + sequence.AddToSequence( new CreateNodeActionData( 1, typeof( ColorNode ), new Vector2( -250, 125 ) ) ); + sequence.AddToSequence( new CreateConnectionActionData( 0, 4, 1, 0 ) ); + m_actionLib.Add( sequence.Name, sequence ); + } + + public ActionSequence GetSequence( string name ) + { + if ( m_actionLib.ContainsKey( name ) ) + { + return m_actionLib[ name ]; + } + return null; + } + + public void Destroy() + { + var items = m_actionLib.GetEnumerator(); + while ( items.MoveNext() ) + { + items.Current.Value.Destroy(); + } + m_actionLib.Clear(); + m_actionLib = null; + } + + public ActionSequence FlatColorSequence + { + get { return m_actionLib[ FlatColorSequenceId ]; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs.meta new file mode 100644 index 00000000..381e5cb9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b4e28cbcd41f3b04ca36fc1b34d2c10f +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates.meta new file mode 100644 index 00000000..d2ecd461 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c1807893b16b7724e840f3d8099a6394 +folderAsset: yes +timeCreated: 1481126944 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs new file mode 100644 index 00000000..fb4d7569 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs @@ -0,0 +1,31 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateAdditionalDefinesHelper : TemplateAdditionalParentHelper + { + public TemplateAdditionalDefinesHelper() : base( "Additional Defines" ) + { + m_helpBoxMessage = "Please add your defines without the #define keywords"; + } + + public override void AddToDataCollector( ref MasterNodeDataCollector dataCollector, TemplateIncludePragmaContainter nativesContainer ) + { + for( int i = 0; i < m_additionalItems.Count; i++ ) + { + if( !string.IsNullOrEmpty( m_additionalItems[ i ] ) && !nativesContainer.HasDefine( m_additionalItems[ i ] ) ) + dataCollector.AddToDefines( -1, m_additionalItems[ i ] ); + } + + for( int i = 0; i < m_outsideItems.Count; i++ ) + { + if( !string.IsNullOrEmpty( m_outsideItems[ i ] ) && !nativesContainer.HasDefine( m_outsideItems[ i ] ) ) + dataCollector.AddToDefines( -1, m_outsideItems[ i ] ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs.meta new file mode 100644 index 00000000..fd7e2b26 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 35a7fdfdb9a6b0048aa322a9fe58a371 +timeCreated: 1520275148 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs new file mode 100644 index 00000000..fa150e91 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs @@ -0,0 +1,962 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.IO; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; +using UnityEditorInternal; +using System.Linq; + +namespace AmplifyShaderEditor +{ + public enum AdditionalLineType + { + Include, + Define, + Pragma, + Custom + } + + public enum AdditionalContainerOrigin + { + Native, + ShaderFunction, + Custom + } + + + [Serializable] + public class AdditionalDirectiveContainerSaveItem + { + public AdditionalLineType LineType = AdditionalLineType.Include; + public string LineValue = string.Empty; + public bool GUIDToggle = false; + public string GUIDValue = string.Empty; + public bool ShowConditionals = false; + public int VersionMin = 0; + public int VersionMax = 0; + public string Passes = string.Empty; + public AdditionalContainerOrigin Origin = AdditionalContainerOrigin.Custom; + + public AdditionalDirectiveContainerSaveItem( AdditionalDirectiveContainer container ) + { + LineType = container.LineType; + LineValue = container.LineValue; + GUIDToggle = container.GUIDToggle; + GUIDValue = container.GUIDValue; + ShowConditionals = container.ShowConditionals; + VersionMin = container.VersionMin; + VersionMax = container.VersionMax; + Passes = container.Passes; + Origin = container.Origin; + } + } + + [Serializable] + public class AdditionalDirectiveContainer : ScriptableObject + { + public AdditionalLineType LineType = AdditionalLineType.Include; + public string LineValue = string.Empty; + public bool GUIDToggle = false; + public string GUIDValue = string.Empty; + public bool ShowConditionals = false; + public int VersionMin = 0; + public int VersionMax = 0; + public string Passes = string.Empty; + public AdditionalContainerOrigin Origin = AdditionalContainerOrigin.Custom; + public TextAsset LibObject = null; + public string OwnerId = string.Empty; + + public void Init( string ownerId, AdditionalDirectiveContainer item ) + { + LineType = item.LineType; + LineValue = item.LineValue; + GUIDToggle = item.GUIDToggle; + GUIDValue = item.GUIDValue; + ShowConditionals = item.ShowConditionals; + VersionMin = item.VersionMin; + VersionMax = item.VersionMax; + Passes = item.Passes; + Origin = item.Origin; + LibObject = item.LibObject; + OwnerId = ownerId; + } + + public void Init( AdditionalDirectiveContainerSaveItem item ) + { + LineType = item.LineType; + LineValue = item.LineValue; + GUIDToggle = item.GUIDToggle; + GUIDValue = item.GUIDValue; + ShowConditionals = item.ShowConditionals; + VersionMin = item.VersionMin; + VersionMax = item.VersionMax; + Passes = item.Passes; + Origin = item.Origin; + if( GUIDToggle ) + { + LibObject = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( GUIDValue ) ); + } + } + + public void OnDestroy() + { + //Debug.Log( "Destoying directives" ); + LibObject = null; + } + + public string Value + { + get + { + switch( LineType ) + { + case AdditionalLineType.Include: + { + if( GUIDToggle ) + { + string shaderPath = AssetDatabase.GUIDToAssetPath( GUIDValue ); + if( !string.IsNullOrEmpty( shaderPath ) ) + return shaderPath; + } + return LineValue; + } + case AdditionalLineType.Define: return LineValue; + case AdditionalLineType.Pragma: return LineValue; + } + return LineValue; + } + } + + public string FormattedValue + { + get + { + switch( LineType ) + { + case AdditionalLineType.Include: + { + if( GUIDToggle ) + { + string shaderPath = AssetDatabase.GUIDToAssetPath( GUIDValue ); + if( !string.IsNullOrEmpty( shaderPath ) ) + return string.Format( Constants.IncludeFormat, shaderPath ); + } + + return string.Format( Constants.IncludeFormat, LineValue ); + } + case AdditionalLineType.Define: + return string.Format( Constants.DefineFormat, LineValue ); + case AdditionalLineType.Pragma: + return string.Format( Constants.PragmaFormat, LineValue ); + } + return LineValue; + } + } + } + + + + public enum ReordableAction + { + None, + Add, + Remove + } + + [Serializable] + public sealed class TemplateAdditionalDirectivesHelper : TemplateModuleParent + { + private string NativeFoldoutStr = "Native"; + + [SerializeField] + private List m_additionalDirectives = new List(); + + [SerializeField] + private List m_shaderFunctionDirectives = new List(); + + [SerializeField] + private List m_nativeDirectives = new List(); + + [SerializeField] + private int m_nativeDirectivesIndex = -1; + + [SerializeField] + private bool m_nativeDirectivesFoldout = false; + + //ONLY USED BY SHADER FUNCTIONS + // Since AdditionalDirectiveContainer must be a ScriptableObject because of serialization shenanigans it will not serialize the info correctly into the shader function when saving it into a file ( it only saves the id ) + // For it to properly work, each AdditionalDirectiveContainer should be added to the SF asset, but that would make it to have children ( which are seen on the project inspector ) + // Must revisit this later on and come up with a proper solution + [SerializeField] + private List m_directivesSaveItems = new List(); + + + private ReordableAction m_actionType = ReordableAction.None; + private int m_actionIndex = 0; + private ReorderableList m_reordableList = null; + private GUIStyle m_propertyAdjustment; + private UndoParentNode m_currOwner; + private Rect m_nativeRect = Rect.zero; + + public TemplateAdditionalDirectivesHelper( string moduleName ) : base( moduleName ) { } + + //public void AddShaderFunctionItem( AdditionalLineType type, string item ) + //{ + // UpdateShaderFunctionDictionary(); + // string id = type + item; + // if( !m_shaderFunctionDictionary.ContainsKey( id ) ) + // { + // AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance(); + // newItem.LineType = type; + // newItem.LineValue = item; + // newItem.hideFlags = HideFlags.HideAndDontSave; + // m_shaderFunctionDirectives.Add( newItem ); + // m_shaderFunctionDictionary.Add( id, newItem ); + // } + //} + + public void AddShaderFunctionItems( string ownerOutputId, List functionList ) + { + RemoveShaderFunctionItems( ownerOutputId ); + if( functionList.Count > 0 ) + { + for( int i = 0; i < functionList.Count; i++ ) + { + AdditionalDirectiveContainer item = ScriptableObject.CreateInstance(); + item.Init( ownerOutputId, functionList[ i ] ); + item.hideFlags = HideFlags.HideAndDontSave; + m_shaderFunctionDirectives.Add( item ); + } + } + //if( functionList.Count > 0 ) + //{ + + // m_shaderFunctionDirectives.AddRange( functionList ); + //} + } + + public void RemoveShaderFunctionItems( string ownerOutputId/*, List functionList */) + { + List list = m_shaderFunctionDirectives.FindAll( ( x ) => x.OwnerId.Equals( ownerOutputId )); + for( int i = 0; i < list.Count; i++ ) + { + m_shaderFunctionDirectives.Remove( list[ i ] ); + ScriptableObject.DestroyImmediate( list[ i ] ); + } + list.Clear(); + list = null; + + //for( int i = 0; i < functionList.Count; i++ ) + //{ + // m_shaderFunctionDirectives.Remove( functionList[ i ] ); + //} + } + + //public void RemoveShaderFunctionItem( AdditionalLineType type, string item ) + //{ + // m_shaderFunctionDirectives.RemoveAll( x => x.LineType == type && x.LineValue.Equals( item ) ); + //} + + public void AddItems( AdditionalLineType type, List items ) + { + int count = items.Count; + for( int i = 0; i < count; i++ ) + { + AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance(); + newItem.LineType = type; + newItem.LineValue = items[ i ]; + newItem.hideFlags = HideFlags.HideAndDontSave; + m_additionalDirectives.Add( newItem ); + } + UpdateNativeIndex(); + } + + public void AddNativeContainer() + { + if( m_nativeDirectives.Count > 0 ) + { + if( m_additionalDirectives.FindIndex( x => x.Origin.Equals( AdditionalContainerOrigin.Native ) ) == -1 ) + { + AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance(); + newItem.Origin = AdditionalContainerOrigin.Native; + newItem.hideFlags = HideFlags.HideAndDontSave; + //m_additionalDirectives.Add( newItem ); + //m_nativeDirectivesIndex = m_additionalDirectives.Count - 1; + m_additionalDirectives.Insert( 0, newItem ); + m_nativeDirectivesIndex = 0; + } + } + } + + public void FillNativeItems( List nativeItems ) + { + m_nativeDirectives.Clear(); + m_nativeDirectives.AddRange( nativeItems ); + AddNativeContainer(); + } + + void DrawNativeItems() + { + EditorGUILayout.Separator(); + EditorGUI.indentLevel++; + int count = m_nativeDirectives.Count; + for( int i = 0; i < count; i++ ) + { + EditorGUILayout.LabelField( m_nativeDirectives[ i ] ); + } + EditorGUI.indentLevel--; + EditorGUILayout.Separator(); + } + + void DrawNativeItemsRect() + { + int count = m_nativeDirectives.Count; + m_nativeRect.y += EditorGUIUtility.singleLineHeight; + for( int i = 0; i < count; i++ ) + { + EditorGUI.LabelField( m_nativeRect, m_nativeDirectives[ i ] ); + m_nativeRect.y += EditorGUIUtility.singleLineHeight; + } + } + + void DrawButtons() + { + EditorGUILayout.Separator(); + + // Add keyword + if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( Constants.PlusMinusButtonLayoutWidth ) ) ) + { + AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance(); + newItem.hideFlags = HideFlags.HideAndDontSave; + m_additionalDirectives.Add( newItem ); + UpdateNativeIndex(); + EditorGUI.FocusTextInControl( null ); + m_isDirty = true; + } + + //Remove keyword + if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( Constants.PlusMinusButtonLayoutWidth ) ) ) + { + if( m_additionalDirectives.Count > 0 ) + { + AdditionalDirectiveContainer itemToDelete = m_additionalDirectives[ m_additionalDirectives.Count - 1 ]; + m_additionalDirectives.RemoveAt( m_additionalDirectives.Count - 1 ); + ScriptableObject.DestroyImmediate( itemToDelete ); + EditorGUI.FocusTextInControl( null ); + } + m_isDirty = true; + } + } + + void DrawConditionals( Rect rect, AdditionalDirectiveContainer directive ) + { + var tog = rect; + tog.width = 15; + tog.x += 5; + tog.y -= ( tog.height - ( EditorGUIUtility.singleLineHeight + 5 ) ) * 0.5f + 1; + tog.xMin += 2; + tog.yMin -= 2; + bool value = GUI.Toggle( tog, directive.ShowConditionals, "", UIUtils.MenuItemToggleStyle ); + if ( Event.current.button == Constants.FoldoutMouseId ) + { + directive.ShowConditionals = value; + } + if ( directive.ShowConditionals ) + { + const int labelWidth = 70; + const int versionEditWidth = 55; + Rect condPos = rect; + condPos.height = EditorGUIUtility.singleLineHeight; + + // List of passes to apply directive + directive.Passes = ( directive.Passes != null ) ? directive.Passes : string.Empty; + condPos.x = rect.x + 23; + condPos.y += EditorGUIUtility.singleLineHeight + 2; + condPos.width = labelWidth; + EditorGUI.LabelField( condPos, new GUIContent( "Passes", "Template pass names separated by semicolon (;). Empty means it will be included in all passes." ) ); + condPos.x += labelWidth; + condPos.xMax = rect.xMax + 1; + directive.Passes = m_currOwner.EditorGUITextField( condPos, string.Empty, directive.Passes ); + + // Range of SRP versions to apply directive + condPos.x = rect.x + 23; + condPos.y += EditorGUIUtility.singleLineHeight + 2; + condPos.width = labelWidth; + EditorGUI.LabelField( condPos, new GUIContent( "SRPVersion", "Valid SRP version numbers must have 6 digits and be equal or higher than 100000, the lowest supported version." ) ); + condPos.x += labelWidth; + + condPos.width = versionEditWidth; + string minText = ( directive.VersionMin == 0 ) ? string.Empty : directive.VersionMin.ToString(); + minText = m_currOwner.EditorGUITextField( condPos, string.Empty, minText ); + directive.VersionMin = int.TryParse( minText, out int min ) ? min : 0; + condPos.x += versionEditWidth + 5; + + EditorGUI.LabelField( condPos, "to" ); + condPos.x += 20; + + string maxText = ( directive.VersionMax == 0 ) ? string.Empty : directive.VersionMax.ToString(); + maxText = m_currOwner.EditorGUITextField( condPos, string.Empty, maxText ); + directive.VersionMax = int.TryParse( maxText, out int max ) ? max : 0; + condPos.x = rect.x + 40; + } + } + + public override void Draw( UndoParentNode currOwner, bool style = true ) + { + m_currOwner = currOwner; + if( m_reordableList == null ) + { + m_reordableList = new ReorderableList( m_additionalDirectives, typeof( AdditionalDirectiveContainer ), true, false, false, false ) + { + headerHeight = 0, + footerHeight = 0, + showDefaultBackground = false, + elementHeightCallback = ( index ) => + { + if( m_additionalDirectives[ index ].Origin == AdditionalContainerOrigin.Native && m_nativeDirectivesFoldout ) + { + return ( m_nativeDirectives.Count + 1 ) * ( EditorGUIUtility.singleLineHeight ) + 5; + } + int lineCount = ( m_additionalDirectives[ index ].ShowConditionals ) ? 3 : 1; + return EditorGUIUtility.singleLineHeight * lineCount + 5; + }, + drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => + { + if( m_additionalDirectives[ index ].Origin == AdditionalContainerOrigin.Native && m_nativeDirectivesFoldout ) + { + rect.height = ( m_nativeDirectives.Count + 1 ) * ( EditorGUIUtility.singleLineHeight ) + 5; + } + + if( m_additionalDirectives[ index ] != null ) + { + float labelWidthStyleAdjust = 0; + + if ( m_additionalDirectives[ index ].Origin == AdditionalContainerOrigin.Native ) + { + rect.xMin -= 5; + rect.xMax += 1; + + m_nativeRect = rect; + m_nativeRect.y -= ( m_nativeRect.height - ( EditorGUIUtility.singleLineHeight + 5 ) ) * 0.5f; + m_nativeRect.xMin += 2; + m_nativeRect.xMax -= 2; + m_nativeRect.yMax -= 2; + + NodeUtils.DrawNestedPropertyGroup( ref m_nativeDirectivesFoldout, rect, NativeFoldoutStr, DrawNativeItemsRect, 4 ); + return; + } + else + { + rect.xMin -= 10; + labelWidthStyleAdjust = 15; + + DrawConditionals( rect, m_additionalDirectives[ index ] ); + } + + const int conditionalsOffset = 20; + rect.x += conditionalsOffset; + + float popUpWidth = 88; + float widthAdjust = m_additionalDirectives[ index ].LineType == AdditionalLineType.Include ? -14 : 0; + widthAdjust -= conditionalsOffset; + Rect popupPos = new Rect( rect.x, rect.y, popUpWidth, EditorGUIUtility.singleLineHeight ); + Rect GUIDTogglePos = m_additionalDirectives[ index ].LineType == AdditionalLineType.Include ? new Rect( rect.x + rect.width - 3 * Constants.PlusMinusButtonLayoutWidth - conditionalsOffset + 3, rect.y, Constants.PlusMinusButtonLayoutWidth, Constants.PlusMinusButtonLayoutWidth ) : new Rect(); + Rect buttonPlusPos = new Rect( rect.x + rect.width - 2 * Constants.PlusMinusButtonLayoutWidth - conditionalsOffset + 1, rect.y - 2, Constants.PlusMinusButtonLayoutWidth, Constants.PlusMinusButtonLayoutWidth ); + Rect buttonMinusPos = new Rect( rect.x + rect.width - Constants.PlusMinusButtonLayoutWidth - conditionalsOffset + 1, rect.y - 2, Constants.PlusMinusButtonLayoutWidth, Constants.PlusMinusButtonLayoutWidth ); + float labelWidthBuffer = EditorGUIUtility.labelWidth; + Rect labelPos = new Rect( rect.x + popupPos.width - labelWidthStyleAdjust, rect.y, labelWidthStyleAdjust + rect.width - popupPos.width - buttonPlusPos.width - buttonMinusPos.width + widthAdjust, EditorGUIUtility.singleLineHeight ); + + + + m_additionalDirectives[ index ].LineType = (AdditionalLineType)m_currOwner.EditorGUIEnumPopup( popupPos, m_additionalDirectives[ index ].LineType ); + + if( m_additionalDirectives[ index ].LineType == AdditionalLineType.Include ) + { + if( m_additionalDirectives[ index ].GUIDToggle ) + { + //if( m_additionalDirectives[ index ].LibObject == null && !string.IsNullOrEmpty( m_additionalDirectives[ index ].GUIDValue ) ) + //{ + // m_additionalDirectives[ index ].LibObject = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( m_additionalDirectives[ index ].GUIDValue ) ); + //} + + EditorGUI.BeginChangeCheck(); + TextAsset obj = m_currOwner.EditorGUIObjectField( labelPos, m_additionalDirectives[ index ].LibObject, typeof( TextAsset ), false ) as TextAsset; + if( EditorGUI.EndChangeCheck() ) + { + string pathName = AssetDatabase.GetAssetPath( obj ); + string extension = Path.GetExtension( pathName ); + extension = extension.ToLower(); + if( extension.Equals( ".cginc" ) || extension.Equals( ".hlsl" ) ) + { + m_additionalDirectives[ index ].LibObject = obj; + m_additionalDirectives[ index ].GUIDValue = AssetDatabase.AssetPathToGUID( pathName ); + } + } + } + else + { + m_additionalDirectives[ index ].LineValue = m_currOwner.EditorGUITextField( labelPos, string.Empty, m_additionalDirectives[ index ].LineValue ); + } + + if( GUI.Button( GUIDTogglePos, m_additionalDirectives[ index ].GUIDToggle ? UIUtils.FloatIntIconOFF : UIUtils.FloatIntIconON, UIUtils.FloatIntPickerONOFF ) ) + m_additionalDirectives[ index ].GUIDToggle = !m_additionalDirectives[ index ].GUIDToggle; + } + else + { + m_additionalDirectives[ index ].LineValue = m_currOwner.EditorGUITextField( labelPos, string.Empty, m_additionalDirectives[ index ].LineValue ); + } + + //NodeUtils.DrawNestedPropertyGroup( ref m_additionalDirectives[ index ].ShowConditionals, rect, "TEMP", DrawConditionals, 4 ); + + if ( GUI.Button( buttonPlusPos, string.Empty, UIUtils.PlusStyle ) ) + { + m_actionType = ReordableAction.Add; + m_actionIndex = index; + } + + if( GUI.Button( buttonMinusPos, string.Empty, UIUtils.MinusStyle ) ) + { + m_actionType = ReordableAction.Remove; + m_actionIndex = index; + } + } + }, + onReorderCallback = ( ReorderableList list ) => + { + UpdateNativeIndex(); + } + }; + } + + if( m_actionType != ReordableAction.None ) + { + switch( m_actionType ) + { + case ReordableAction.Add: + { + AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance(); + newItem.hideFlags = HideFlags.HideAndDontSave; + m_additionalDirectives.Insert( m_actionIndex + 1, newItem ); + } + break; + case ReordableAction.Remove: + AdditionalDirectiveContainer itemToDelete = m_additionalDirectives[ m_actionIndex ]; + m_additionalDirectives.RemoveAt( m_actionIndex ); + ScriptableObject.DestroyImmediate( itemToDelete ); + break; + } + m_isDirty = true; + m_actionType = ReordableAction.None; + EditorGUI.FocusTextInControl( null ); + } + bool foldoutValue = currOwner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDirectives; + if( style ) + { + NodeUtils.DrawPropertyGroup( ref foldoutValue, m_moduleName, DrawReordableList, DrawButtons ); + } + else + { + NodeUtils.DrawNestedPropertyGroup( ref foldoutValue, m_moduleName, DrawReordableList, DrawButtons ); + } + currOwner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDirectives = foldoutValue; + } + + void DrawReordableList() + { + if( m_reordableList != null ) + { + if( m_propertyAdjustment == null ) + { + m_propertyAdjustment = new GUIStyle(); + m_propertyAdjustment.padding.left = 17; + } + //EditorGUILayout.BeginVertical( m_propertyAdjustment ); + EditorGUILayout.Space(); + if( m_nativeDirectives.Count > 0 ) + { + //NodeUtils.DrawNestedPropertyGroup( ref m_nativeDirectivesFoldout, NativeFoldoutStr, DrawNativeItems, 4 ); + } + if( m_additionalDirectives.Count == 0 ) + { + EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one.", MessageType.Info ); + } + else + { + m_reordableList.DoLayoutList(); + } + EditorGUILayout.Space(); + //EditorGUILayout.EndVertical(); + } + } + + public void AddAllToDataCollector( ref MasterNodeDataCollector dataCollector, TemplatePass pass, TemplateIncludePragmaContainter nativesContainer ) + { + //List list = m_additionalDirectives; + //int count = list.FindIndex( x => x.Origin.Equals( AdditionalContainerOrigin.Native ) ); + //for( int i = 0; i < count; i++ ) + //{ + // switch( list[ i ].LineType ) + // { + // case AdditionalLineType.Include: + // { + // string value = list[ i ].Value; + // if( !string.IsNullOrEmpty( value ) && + // !nativesContainer.HasInclude( value ) ) + // { + // dataCollector.AddToMisc( list[ i ].FormattedValue ); + // } + // } + // break; + // case AdditionalLineType.Define: + // { + // if( !string.IsNullOrEmpty( list[ i ].LineValue ) && + // !nativesContainer.HasDefine( list[ i ].LineValue ) ) + // { + // dataCollector.AddToMisc( list[ i ].FormattedValue ); + // } + // } + // break; + // case AdditionalLineType.Pragma: + // { + // if( !string.IsNullOrEmpty( list[ i ].LineValue ) && + // !nativesContainer.HasPragma( list[ i ].LineValue ) ) + // { + // dataCollector.AddToMisc( list[ i ].FormattedValue ); + // } + // } + // break; + // default: + // case AdditionalLineType.Custom: + // dataCollector.AddToMisc( list[ i ].LineValue ); + // break; + // } + //} + + AddToDataCollector( ref dataCollector, pass, nativesContainer, false ); + AddToDataCollector( ref dataCollector, pass, nativesContainer, true ); + } + + public void AddAllToDataCollector( ref MasterNodeDataCollector dataCollector ) + { + AddToDataCollector( ref dataCollector, null, false ); + AddToDataCollector( ref dataCollector, null, true ); + } + + bool TestConditionals( TemplatePass pass, AdditionalDirectiveContainer directive ) + { + bool isSRP = ASEPackageManagerHelper.CurrentSRPVersion > 0; + if ( isSRP && directive.VersionMin != 0 && ASEPackageManagerHelper.CurrentSRPVersion < directive.VersionMin ) + { + return false; + } + + if ( isSRP && directive.VersionMax != 0 && ASEPackageManagerHelper.CurrentSRPVersion > directive.VersionMax ) + { + return false; + } + + if ( pass != null && !string.IsNullOrEmpty( directive.Passes ) ) + { + string[] passes = directive.Passes.Split( ';' ); + if ( !passes.Contains( pass.PassNameContainer.Data ) ) + { + return false; + } + } + + return true; + } + + void AddToDataCollector( ref MasterNodeDataCollector dataCollector, TemplatePass pass, TemplateIncludePragmaContainter nativesContainer, bool fromSF ) + { + List list = fromSF ? m_shaderFunctionDirectives : m_additionalDirectives; + int count = list.Count; + for( int i = 0; i < count; i++ ) + { + AdditionalDirectiveContainer directive = list[ i ]; + int orderIdx = fromSF ? 1 : ( i > m_nativeDirectivesIndex ? 1 : -1 ); + + if ( !TestConditionals( pass, directive ) ) + { + continue; + } + + switch( directive.LineType ) + { + case AdditionalLineType.Include: + { + string value = directive.Value; + if( !string.IsNullOrEmpty( value ) && + !nativesContainer.HasInclude( value ) ) + { + dataCollector.AddToDirectives( directive.FormattedValue, orderIdx ); + } + } + break; + case AdditionalLineType.Define: + { + if( !string.IsNullOrEmpty( directive.LineValue ) && + !nativesContainer.HasDefine( directive.LineValue ) ) + { + dataCollector.AddToDirectives( directive.FormattedValue, orderIdx ); + } + } + break; + case AdditionalLineType.Pragma: + { + if( !string.IsNullOrEmpty( directive.LineValue ) && + !nativesContainer.HasPragma( directive.LineValue ) ) + { + dataCollector.AddToDirectives( directive.FormattedValue, orderIdx ); + } + } + break; + default: + case AdditionalLineType.Custom: + dataCollector.AddToDirectives( directive.LineValue, orderIdx ); + break; + } + } + } + + void AddToDataCollector( ref MasterNodeDataCollector dataCollector, TemplatePass pass, bool fromSF ) + { + List list = fromSF ? m_shaderFunctionDirectives : m_additionalDirectives; + int orderIdx = 1; + int count = list.Count; + for( int i = 0; i < count; i++ ) + { + AdditionalDirectiveContainer directive = list[ i ]; + + if ( !TestConditionals( pass, directive ) ) + { + continue; + } + + switch ( directive.LineType ) + { + case AdditionalLineType.Include: + { + string value = directive.FormattedValue; + if( !string.IsNullOrEmpty( value ) ) + { + dataCollector.AddToDirectives( value, orderIdx ); + } + } + break; + case AdditionalLineType.Define: + { + if( !string.IsNullOrEmpty( directive.LineValue ) ) + { + dataCollector.AddToDirectives( directive.FormattedValue, orderIdx ); + } + } + break; + case AdditionalLineType.Pragma: + { + if( !string.IsNullOrEmpty( directive.LineValue ) ) + { + dataCollector.AddToDirectives( directive.FormattedValue, orderIdx ); + } + } + break; + default: + case AdditionalLineType.Custom: + dataCollector.AddToDirectives( directive.LineValue, orderIdx ); + break; + } + } + } + + public override void ReadFromString( ref uint index, ref string[] nodeParams ) + { + try + { + m_nativeDirectivesIndex = -1; + int count = Convert.ToInt32( nodeParams[ index++ ] ); + m_additionalDirectives.Clear(); + for( int i = 0; i < count; i++ ) + { + AdditionalLineType lineType = (AdditionalLineType)Enum.Parse( typeof( AdditionalLineType ), nodeParams[ index++ ] ); + string lineValue = nodeParams[ index++ ]; + AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance(); + newItem.hideFlags = HideFlags.HideAndDontSave; + newItem.LineType = lineType; + newItem.LineValue = lineValue.Replace( Constants.SemiColonSeparator, ';' ); + if( UIUtils.CurrentShaderVersion() > 15607 ) + { + newItem.GUIDToggle = Convert.ToBoolean( nodeParams[ index++ ] ); + newItem.GUIDValue = nodeParams[ index++ ]; + if( newItem.GUIDToggle ) + { + newItem.LibObject = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( newItem.GUIDValue ) ); + if( newItem.LibObject == null ) + { + Debug.LogWarning( "Include file not found with GUID " + newItem.GUIDValue ); + } + } + } + AdditionalContainerOrigin origin = AdditionalContainerOrigin.Custom; + if( UIUtils.CurrentShaderVersion() > 16902 ) + { + origin = (AdditionalContainerOrigin)Enum.Parse( typeof( AdditionalContainerOrigin ), nodeParams[ index++ ] ); + newItem.Origin = origin; + } + if ( UIUtils.CurrentShaderVersion() > 19103 ) + { + newItem.ShowConditionals = Convert.ToBoolean( nodeParams[ index++ ] ); + newItem.VersionMin = Convert.ToInt32( nodeParams[ index++ ] ); + newItem.VersionMax = Convert.ToInt32( nodeParams[ index++ ] ); + newItem.Passes = nodeParams[ index++ ]; + newItem.Passes.Replace( Constants.SemiColonSeparator, ';' ); + } + + m_additionalDirectives.Add( newItem ); + + if( origin == AdditionalContainerOrigin.Native ) + { + m_nativeDirectivesIndex = i; + } + } + AddNativeContainer(); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + + public override void WriteToString( ref string nodeInfo ) + { + if( m_additionalDirectives.Count == 1 && m_additionalDirectives[ 0 ].Origin == AdditionalContainerOrigin.Native ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, 0 ); + return; + } + + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives.Count ); + for( int i = 0; i < m_additionalDirectives.Count; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives[ i ].LineType ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives[ i ].LineValue.Replace( ';', Constants.SemiColonSeparator ) ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives[ i ].GUIDToggle ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives[ i ].GUIDValue ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives[ i ].Origin ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives[ i ].ShowConditionals ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives[ i ].VersionMin ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives[ i ].VersionMax ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives[ i ].Passes.Replace( ';', Constants.SemiColonSeparator ) ); + } + } + + // read comment on m_directivesSaveItems declaration + public void UpdateSaveItemsFromDirectives() + { + bool foundNull = false; + m_directivesSaveItems.Clear(); + for( int i = 0; i < m_additionalDirectives.Count; i++ ) + { + if( m_additionalDirectives[ i ] != null ) + { + m_directivesSaveItems.Add( new AdditionalDirectiveContainerSaveItem( m_additionalDirectives[ i ] ) ); + } + else + { + foundNull = true; + } + } + + if( foundNull ) + { + m_additionalDirectives.RemoveAll( item => item == null ); + } + } + + public void CleanNullDirectives() + { + m_additionalDirectives.RemoveAll( item => item == null ); + } + + public void ResetDirectivesOrigin() + { + for( int i = 0; i < m_directivesSaveItems.Count; i++ ) + { + m_directivesSaveItems[ i ].Origin = AdditionalContainerOrigin.Custom; + } + } + + // read comment on m_directivesSaveItems declaration + public void UpdateDirectivesFromSaveItems() + { + if( m_directivesSaveItems.Count > 0 ) + { + for( int i = 0; i < m_additionalDirectives.Count; i++ ) + { + if( m_additionalDirectives[ i ] != null ) + ScriptableObject.DestroyImmediate( m_additionalDirectives[ i ] ); + } + + m_additionalDirectives.Clear(); + + for( int i = 0; i < m_directivesSaveItems.Count; i++ ) + { + AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance(); + newItem.hideFlags = HideFlags.HideAndDontSave; + newItem.Init( m_directivesSaveItems[ i ] ); + m_additionalDirectives.Add( newItem ); + } + UpdateNativeIndex(); + //m_directivesSaveItems.Clear(); + } + } + + void UpdateNativeIndex() + { + m_nativeDirectivesIndex = -1; + int count = m_additionalDirectives.Count; + for( int i = 0; i < count; i++ ) + { + if( m_additionalDirectives[ i ].Origin == AdditionalContainerOrigin.Native ) + { + m_nativeDirectivesIndex = i; + break; + } + } + } + + public override void Destroy() + { + base.Destroy(); + + m_nativeDirectives.Clear(); + m_nativeDirectives = null; + + for( int i = 0; i < m_additionalDirectives.Count; i++ ) + { + ScriptableObject.DestroyImmediate( m_additionalDirectives[ i ] ); + } + + m_additionalDirectives.Clear(); + m_additionalDirectives = null; + + for( int i = 0; i < m_shaderFunctionDirectives.Count; i++ ) + { + ScriptableObject.DestroyImmediate( m_shaderFunctionDirectives[ i ] ); + } + + m_shaderFunctionDirectives.Clear(); + m_shaderFunctionDirectives = null; + + + m_propertyAdjustment = null; + m_reordableList = null; + } + + + public List DirectivesList { get { return m_additionalDirectives; } } + public bool IsValid { get { return m_validData; } set { m_validData = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs.meta new file mode 100644 index 00000000..d6a7b8f7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c6b57deeb826a674f9715fab4dfb4cb1 +timeCreated: 1528278077 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs new file mode 100644 index 00000000..7d58666b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs @@ -0,0 +1,31 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateAdditionalIncludesHelper : TemplateAdditionalParentHelper + { + public TemplateAdditionalIncludesHelper() : base( "Additional Includes" ) + { + m_helpBoxMessage = "Please add your includes without the #include \"\" keywords"; + } + + public override void AddToDataCollector( ref MasterNodeDataCollector dataCollector , TemplateIncludePragmaContainter nativesContainer ) + { + for( int i = 0; i < m_additionalItems.Count; i++ ) + { + if( !string.IsNullOrEmpty( m_additionalItems[ i ] ) && !nativesContainer.HasInclude( m_additionalItems[ i ] ) ) + dataCollector.AddToIncludes( -1, m_additionalItems[ i ] ); + } + + for( int i = 0; i < m_outsideItems.Count; i++ ) + { + if( !string.IsNullOrEmpty( m_outsideItems[ i ] ) && !nativesContainer.HasInclude( m_outsideItems[ i ] ) ) + dataCollector.AddToIncludes( -1, m_outsideItems[ i ] ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs.meta new file mode 100644 index 00000000..e94b96f6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 0ab4c474dfddce2429da08f56e651ed4 +timeCreated: 1520275148 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs new file mode 100644 index 00000000..da765cca --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs @@ -0,0 +1,193 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateAdditionalParentHelper : TemplateModuleParent + { + private string NativeFoldoutStr = "Native"; + + protected string m_helpBoxMessage = string.Empty; + private const float ShaderKeywordButtonLayoutWidth = 15; + private ParentNode m_currentOwner; + + [SerializeField] + protected List m_nativeItems = new List(); + + [SerializeField] + protected bool m_nativeItemsFoldout = false; + + [SerializeField] + protected List m_additionalItems = new List(); + + [SerializeField] + protected List m_outsideItems = new List(); + + public TemplateAdditionalParentHelper( string moduleName ) : base( moduleName ) { } + public bool IsValid { set{ m_validData = value; } get{ return m_validData; } } + + public void FillNativeItems( List nativeItems ) + { + m_nativeItems.Clear(); + m_nativeItems.AddRange( nativeItems ); + } + + public void Draw( ParentNode owner ) + { + m_currentOwner = owner; + bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDefines; + NodeUtils.DrawNestedPropertyGroup( ref foldout, m_moduleName, DrawMainBody, DrawButtons ); + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDefines = foldout; + } + + public void CopyFrom( TemplateAdditionalParentHelper other ) + { + m_additionalItems.Clear(); + m_outsideItems.Clear(); + int otherAdditionalItemsCount = other.ItemsList.Count; + for( int i = 0; i < otherAdditionalItemsCount; i++ ) + { + m_additionalItems.Add( other.ItemsList[ i ] ); + } + + int otherOusideItemsCount = other.OutsideList.Count; + for( int i = 0; i < otherOusideItemsCount; i++ ) + { + m_outsideItems.Add( other.OutsideList[ i ] ); + } + } + + void DrawButtons() + { + EditorGUILayout.Separator(); + + // Add keyword + if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_additionalItems.Add( string.Empty ); + EditorGUI.FocusTextInControl( null ); + m_isDirty = true; + } + + //Remove keyword + if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + if( m_additionalItems.Count > 0 ) + { + m_additionalItems.RemoveAt( m_additionalItems.Count - 1 ); + EditorGUI.FocusTextInControl( null ); + } + m_isDirty = true; + } + } + void DrawNativeItems() + { + EditorGUILayout.Separator(); + EditorGUI.indentLevel++; + int count = m_nativeItems.Count; + for ( int i = 0; i < count; i++ ) + { + EditorGUILayout.LabelField( m_nativeItems[i] ); + } + EditorGUI.indentLevel--; + EditorGUILayout.Separator(); + } + void DrawMainBody() + { + EditorGUILayout.Separator(); + + if( m_nativeItems.Count > 0 ) + { + NodeUtils.DrawNestedPropertyGroup( ref m_nativeItemsFoldout, NativeFoldoutStr, DrawNativeItems ,4); + } + + int itemCount = m_additionalItems.Count; + int markedToDelete = -1; + for( int i = 0; i < itemCount; i++ ) + { + EditorGUILayout.BeginHorizontal(); + { + EditorGUI.BeginChangeCheck(); + m_additionalItems[ i ] = EditorGUILayout.TextField( m_additionalItems[ i ] ); + if( EditorGUI.EndChangeCheck() ) + { + m_additionalItems[ i ] = UIUtils.RemoveShaderInvalidCharacters( m_additionalItems[ i ] ); + m_isDirty = true; + } + + // Add new port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_additionalItems.Insert( i + 1, string.Empty ); + EditorGUI.FocusTextInControl( null ); + m_isDirty = true; + } + + //Remove port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + markedToDelete = i; + m_isDirty = true; + } + } + EditorGUILayout.EndHorizontal(); + } + + if( markedToDelete > -1 ) + { + if( m_additionalItems.Count > markedToDelete ) + { + m_additionalItems.RemoveAt( markedToDelete ); + EditorGUI.FocusTextInControl( null ); + } + } + EditorGUILayout.Separator(); + EditorGUILayout.HelpBox( m_helpBoxMessage, MessageType.Info ); + } + + public override void ReadFromString( ref uint index, ref string[] nodeParams ) + { + try + { + int count = Convert.ToInt32( nodeParams[ index++ ] ); + for( int i = 0; i < count; i++ ) + { + m_additionalItems.Add( nodeParams[ index++ ] ); + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + + public override void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalItems.Count ); + for( int i = 0; i < m_additionalItems.Count; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalItems[ i ] ); + } + } + + public virtual void AddToDataCollector( ref MasterNodeDataCollector dataCollector , TemplateIncludePragmaContainter nativesContainer ) { } + + public override void Destroy() + { + m_additionalItems.Clear(); + m_additionalItems = null; + m_currentOwner = null; + m_nativeItems.Clear(); + m_nativeItems = null; + } + + public List ItemsList { get { return m_additionalItems; } set { m_additionalItems = value; } } + public List OutsideList { get { return m_outsideItems; } set { m_outsideItems = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs.meta new file mode 100644 index 00000000..3227dd53 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5360ba11600eeb44786246ca70212e25 +timeCreated: 1520332262 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs new file mode 100644 index 00000000..3c08f1a0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs @@ -0,0 +1,31 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateAdditionalPragmasHelper : TemplateAdditionalParentHelper + { + public TemplateAdditionalPragmasHelper() : base( "Additional Pragmas" ) + { + m_helpBoxMessage = "Please add your pragmas without the #pragma keywords"; + } + + public override void AddToDataCollector( ref MasterNodeDataCollector dataCollector, TemplateIncludePragmaContainter nativesContainer ) + { + for( int i = 0; i < m_additionalItems.Count; i++ ) + { + if( !string.IsNullOrEmpty( m_additionalItems[ i ] ) && !nativesContainer.HasPragma( m_additionalItems[ i ] )) + dataCollector.AddToPragmas( -1, m_additionalItems[ i ] ); + } + + for( int i = 0; i < m_outsideItems.Count; i++ ) + { + if( !string.IsNullOrEmpty( m_outsideItems[ i ] ) && !nativesContainer.HasPragma( m_outsideItems[ i ] ) ) + dataCollector.AddToPragmas( -1, m_outsideItems[ i ] ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs.meta new file mode 100644 index 00000000..f5415cb1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: de89b62c2bd8eec4b915a0decba936fb +timeCreated: 1520275148 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAlphaToMaskModule.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAlphaToMaskModule.cs new file mode 100644 index 00000000..307a633c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAlphaToMaskModule.cs @@ -0,0 +1,128 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + public sealed class TemplateAlphaToMaskModule : TemplateModuleParent + { + private const string AlphaToMaskFormatStr = "AlphaToMask "; + private const string AlphaToMaskFormat = "AlphaToMask {0}"; + + public TemplateAlphaToMaskModule() : base( "Alpha To Coverage" ) { } + + private static readonly string AlphaToMaskStr = "Alpha To Coverage"; + + [SerializeField] + private bool m_alphaToMask = false; + + [SerializeField] + private InlineProperty m_inlineAlphaToMask = new InlineProperty(); + + public void CopyFrom( TemplateAlphaToMaskModule other , bool allData ) + { + if( allData ) + m_independentModule = other.IndependentModule; + + m_alphaToMask = other.AlphaToMask; + m_inlineAlphaToMask.CopyFrom( other.AlphaToMaskInlineProperty ); + } + + public void ConfigureFromTemplateData( TemplateAlphaToMaskData data ) + { + bool newValidData = ( data.DataCheck == TemplateDataCheck.Valid ); + + if( newValidData && m_validData != newValidData ) + { + m_independentModule = data.IndependentModule; + if( string.IsNullOrEmpty( data.InlineData ) ) + { + m_alphaToMask = data.AlphaToMaskData; + m_inlineAlphaToMask.IntValue = m_alphaToMask ? 1 : 0; + m_inlineAlphaToMask.ResetProperty(); + } + else + { + m_inlineAlphaToMask.SetInlineByName( data.InlineData ); + } + } + + m_validData = newValidData; + } + + public override void Draw( UndoParentNode owner, bool style = true ) + { + EditorGUI.BeginChangeCheck(); + m_inlineAlphaToMask.CustomDrawer( ref owner, ( x ) => { m_alphaToMask = owner.EditorGUILayoutToggle( AlphaToMaskStr, m_alphaToMask ); }, AlphaToMaskStr ); + if( EditorGUI.EndChangeCheck() ) + { + m_inlineAlphaToMask.IntValue = m_alphaToMask ? 1 : 0; + m_isDirty = true; + } + } + + public override void ReadFromString( ref uint index, ref string[] nodeParams ) + { + bool validDataOnMeta = m_validData; + if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) + { + validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( validDataOnMeta ) + { + if( UIUtils.CurrentShaderVersion() < 15304 ) + { + m_alphaToMask = Convert.ToBoolean( nodeParams[ index++ ] ); + m_inlineAlphaToMask.IntValue = m_alphaToMask ? 1 : 0; + } + else + { + m_inlineAlphaToMask.ReadFromString( ref index, ref nodeParams ); + m_alphaToMask = m_inlineAlphaToMask.IntValue == 1; + } + } + } + + public override void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_validData ); + if( m_validData ) + { + m_inlineAlphaToMask.WriteToString( ref nodeInfo ); + } + } + + public override string GenerateShaderData( bool isSubShader ) + { + return AlphaToMaskFormatStr + m_inlineAlphaToMask.GetValueOrProperty( m_alphaToMask ? "On" : "Off"); + } + + public override void Destroy() + { + base.Destroy(); + m_inlineAlphaToMask = null; + } + + //public string CurrentAlphaToMask + //{ + // get { return string.Format( AlphaToMaskFormat, m_alphaToMask ? "On" : "Off" ); } + //} + + public bool AlphaToMask + { + get { return m_alphaToMask; } + set + { + m_alphaToMask = value; + m_inlineAlphaToMask.IntValue = value ? 1 : 0; + m_inlineAlphaToMask.Active = false; + } + } + public InlineProperty AlphaToMaskInlineProperty { get { return m_inlineAlphaToMask; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAlphaToMaskModule.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAlphaToMaskModule.cs.meta new file mode 100644 index 00000000..3c9aa123 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAlphaToMaskModule.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 84e56f8cb109deb4da1945562567bf0c +timeCreated: 1593170303 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAlphaToMaskModule.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs new file mode 100644 index 00000000..ea717e62 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs @@ -0,0 +1,102 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + public enum TemplateCodeSnippetType + { + Toggle + }; + + + public enum TemplateCodeSnippetInfoIdx + { + Name = 0, + Type + }; + + [Serializable] + public class TemplateCodeSnippetElement + { + public string Id; + public string Snippet; + public TemplateCodeSnippetElement( string id, string snippet ) + { + Id = id; + Snippet = snippet; + } + } + + [Serializable] + public class TemplateCodeSnippetBase : ScriptableObject + { + [SerializeField] + private string m_nameId; + + [SerializeField] + private TemplateCodeSnippetType m_type; + + [SerializeField] + private List m_elements = new List(); + + public void Init( string nameId, TemplateCodeSnippetType type ) + { + m_nameId = nameId; + m_type = type; + } + + public void AddSnippet( TemplateCodeSnippetElement element ) + { + m_elements.Add( element ); + } + + public void Destroy() + { + for ( int i = 0; i < m_elements.Count; i++ ) + { + m_elements[ i ].Snippet = null; + } + m_elements.Clear(); + m_elements = null; + } + + public virtual void DrawProperties( ParentNode owner ) { } + public virtual bool CheckSnippet() { return true; } + + public void InsertSnippet( ref string shaderBody ) + { + bool insertSnippet = CheckSnippet(); + for ( int i = 0; i < m_elements.Count; i++ ) + { + shaderBody = shaderBody.Replace( m_elements[ i ].Id, ( insertSnippet ? m_elements[ i ].Snippet : string.Empty ) ); + } + } + public string NameId { get { return m_nameId; } } + public TemplateCodeSnippetType Type { get { return m_type; } } + public List Elements { get { return m_elements; } } + } + + [Serializable] + public class TemplateCodeSnippetToggle : TemplateCodeSnippetBase + { + private const string Label = "Activate"; + [SerializeField] + private bool m_value = false; + + + public override bool CheckSnippet() + { + return m_value; + } + + public override void DrawProperties( ParentNode owner ) + { + m_value = owner.EditorGUILayoutToggle( Label, m_value ); + } + } + +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs.meta new file mode 100644 index 00000000..88bc8fdb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5fc48fb872ce5e74aa913f987a025ea4 +timeCreated: 1495113330 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs new file mode 100644 index 00000000..34c867cd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs @@ -0,0 +1,200 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateColorMaskModule : TemplateModuleParent + { + private const string ColorMaskOp = "ColorMask "; + private const string ColorMaskOff = "ColorMask RGBA"; + private GUIContent ColorMaskContent = new GUIContent( "Color Mask", "Sets color channel writing mask, turning all off makes the object completely invisible\nDefault: RGBA" ); + private readonly char[] m_colorMaskChar = { 'R', 'G', 'B', 'A' }; + + private GUIStyle m_leftToggleColorMask; + private GUIStyle m_middleToggleColorMask; + private GUIStyle m_rightToggleColorMask; + + public TemplateColorMaskModule() : base( "Color Mask" ) { } + + [SerializeField] + private bool[] m_colorMask = { true, true, true, true }; + + [SerializeField] + private string m_target = string.Empty; + + [SerializeField] + private InlineProperty m_inlineColorMask = new InlineProperty(); + + public void CopyFrom( TemplateColorMaskModule other, bool allData ) + { + if( allData ) + m_independentModule = other.IndependentModule; + + for( int i = 0; i < m_colorMask.Length; i++ ) + { + m_colorMask[ i ] = other.ColorMask[ i ]; + } + + m_target = other.Target; + + m_inlineColorMask.CopyFrom( other.InlineColorMask ); + } + + public void ConfigureFromTemplateData( TemplateColorMaskData data ) + { + bool newValidData = ( data.DataCheck == TemplateDataCheck.Valid ); + if( newValidData && m_validData != newValidData ) + { + m_independentModule = data.IndependentModule; + m_target = data.Target; + if( string.IsNullOrEmpty( data.InlineData ) ) + { + for( int i = 0; i < 4; i++ ) + { + m_colorMask[ i ] = data.ColorMaskData[ i ]; + } + m_inlineColorMask.ResetProperty(); + } + else + { + m_inlineColorMask.SetInlineByName( data.InlineData ); + } + } + + m_validData = newValidData; + } + + public override void Draw( UndoParentNode owner, bool style = true ) + { + EditorGUI.BeginChangeCheck(); + { + m_inlineColorMask.CustomDrawer( ref owner, DrawColorMaskControls, ColorMaskContent.text + m_target ); + } + + if( EditorGUI.EndChangeCheck() ) + { + m_isDirty = true; + CustomEdited = true; + } + } + + private void DrawColorMaskControls( UndoParentNode owner ) + { + if( m_leftToggleColorMask == null || m_leftToggleColorMask.normal.background == null ) + { + m_leftToggleColorMask = GUI.skin.GetStyle( "ButtonLeft" ); + } + + if( m_middleToggleColorMask == null || m_middleToggleColorMask.normal.background == null ) + { + m_middleToggleColorMask = GUI.skin.GetStyle( "ButtonMid" ); + } + + if( m_rightToggleColorMask == null || m_rightToggleColorMask.normal.background == null ) + { + m_rightToggleColorMask = GUI.skin.GetStyle( "ButtonRight" ); + } + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField( "Color Mask"+ m_target, GUILayout.Width( EditorGUIUtility.labelWidth - 3 ) ); + + m_colorMask[ 0 ] = owner.GUILayoutToggle( m_colorMask[ 0 ], "R", m_leftToggleColorMask ); + m_colorMask[ 1 ] = owner.GUILayoutToggle( m_colorMask[ 1 ], "G", m_middleToggleColorMask ); + m_colorMask[ 2 ] = owner.GUILayoutToggle( m_colorMask[ 2 ], "B", m_middleToggleColorMask ); + m_colorMask[ 3 ] = owner.GUILayoutToggle( m_colorMask[ 3 ], "A", m_rightToggleColorMask ); + + EditorGUILayout.EndHorizontal(); + } + + public override string GenerateShaderData( bool isSubShader ) + { + if( m_inlineColorMask.IsValid ) + return ColorMaskOp + m_inlineColorMask.GetValueOrProperty() + Target; + + int count = 0; + string colorMask = string.Empty; + for( int i = 0; i < m_colorMask.Length; i++ ) + { + if( m_colorMask[ i ] ) + { + count++; + colorMask += m_colorMaskChar[ i ]; + } + } + + if( count != m_colorMask.Length ) + { + return ColorMaskOp + ( ( count == 0 ) ? "0" : colorMask ) + Target; + } + + return ColorMaskOff + Target; + } + + public override void ReadFromString( ref uint index, ref string[] nodeParams ) + { + base.ReadFromString( ref index, ref nodeParams ); + bool validDataOnMeta = m_validData; + if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) + { + validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( validDataOnMeta ) + { + for( int i = 0; i < m_colorMask.Length; i++ ) + { + m_colorMask[ i ] = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( UIUtils.CurrentShaderVersion() > 15303 ) + { + m_inlineColorMask.ReadFromString( ref index, ref nodeParams ); + } + } + } + + public override void WriteToString( ref string nodeInfo ) + { + base.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_validData ); + if( m_validData ) + { + for( int i = 0; i < m_colorMask.Length; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_colorMask[ i ] ); + } + m_inlineColorMask.WriteToString( ref nodeInfo ); + } + } + + public bool[] ColorMask + { + get { return m_colorMask; } + set + { + m_colorMask = value; + m_inlineColorMask.Active = false; + } + } + + public string Target + { + get { return m_target; } + set { m_target = value; } + } + + public override void Destroy() + { + m_leftToggleColorMask = null; + m_middleToggleColorMask = null; + m_rightToggleColorMask = null; + m_inlineColorMask = null; + } + + public InlineProperty InlineColorMask { get { return m_inlineColorMask; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs.meta new file mode 100644 index 00000000..2e0f2923 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e1d9e34bd7946e247aa6d28b2859c6b1 +timeCreated: 1511259305 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs new file mode 100644 index 00000000..f99b5c07 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs @@ -0,0 +1,128 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + public sealed class TemplateCullModeModule : TemplateModuleParent + { + private const string CullModeFormatStr = "Cull "; + + public TemplateCullModeModule() : base("Cull Mode"){ } + + private static readonly string CullModeStr = "Cull Mode"; + + [SerializeField] + private CullMode m_cullMode = CullMode.Back; + + [SerializeField] + private InlineProperty m_inlineCullMode = new InlineProperty(); + + public void CopyFrom( TemplateCullModeModule other , bool allData ) + { + if( allData ) + m_independentModule = other.IndependentModule; + + m_cullMode = other.CurrentCullMode; + m_inlineCullMode.CopyFrom( other.CullInlineProperty ); + } + + public void ConfigureFromTemplateData( TemplateCullModeData data ) + { + bool newValidData = ( data.DataCheck == TemplateDataCheck.Valid ); + + if( newValidData && m_validData != newValidData ) + { + m_independentModule = data.IndependentModule; + if( string.IsNullOrEmpty( data.InlineData ) ) + { + m_cullMode = data.CullModeData; + m_inlineCullMode.IntValue = (int)m_cullMode; + m_inlineCullMode.ResetProperty(); + } + else + { + m_inlineCullMode.SetInlineByName( data.InlineData ); + } + } + + m_validData = newValidData; + } + + public override void Draw( UndoParentNode owner, bool style = true ) + { + EditorGUI.BeginChangeCheck(); + //m_cullMode = (CullMode)owner.EditorGUILayoutEnumPopup( CullModeStr, m_cullMode ); + m_inlineCullMode.CustomDrawer( ref owner, ( x ) => { m_cullMode = (CullMode)owner.EditorGUILayoutEnumPopup( CullModeStr, m_cullMode ); }, CullModeStr ); + if( EditorGUI.EndChangeCheck() ) + { + m_inlineCullMode.IntValue = (int)m_cullMode; + m_isDirty = true; + CustomEdited = true; + } + } + + public override void ReadFromString( ref uint index, ref string[] nodeParams ) + { + base.ReadFromString( ref index, ref nodeParams ); + bool validDataOnMeta = m_validData; + if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) + { + validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( validDataOnMeta ) + { + if( UIUtils.CurrentShaderVersion() < 15304 ) + { + m_cullMode = (CullMode)Enum.Parse( typeof( CullMode ), nodeParams[ index++ ] ); + m_inlineCullMode.IntValue = (int)m_cullMode; + } + else + { + m_inlineCullMode.ReadFromString( ref index, ref nodeParams ); + m_cullMode = (CullMode)m_inlineCullMode.IntValue; + } + } + } + + public override void WriteToString( ref string nodeInfo ) + { + base.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_validData ); + if( m_validData ) + { + //IOUtils.AddFieldValueToString( ref nodeInfo, m_cullMode ); + m_inlineCullMode.WriteToString( ref nodeInfo ); + } + } + + public override string GenerateShaderData( bool isSubShader ) + { + //return CullModeFormatStr + m_cullMode.ToString(); + return CullModeFormatStr + m_inlineCullMode.GetValueOrProperty( m_cullMode.ToString()); + } + + public override void Destroy() + { + base.Destroy(); + m_inlineCullMode = null; + } + + public CullMode CurrentCullMode + { + get { return m_cullMode; } + set + { + m_cullMode = value; + m_inlineCullMode.IntValue = (int)value; + m_inlineCullMode.Active = false; + } + } + public InlineProperty CullInlineProperty { get { return m_inlineCullMode; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs.meta new file mode 100644 index 00000000..ee923ca0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: dcbce53ba2eeecd4a8f2c7f5f9a43b7a +timeCreated: 1511186525 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDBItem.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDBItem.cs new file mode 100644 index 00000000..602f2fb7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDBItem.cs @@ -0,0 +1,21 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateDBItem + { + public string GUID; + } + + [Serializable] + public class TemplateDB : ScriptableObject + { + public List Items = new List(); + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDBItem.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDBItem.cs.meta new file mode 100644 index 00000000..8a1d03d5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDBItem.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b12f2516af03f3443b1f2c08c72aa490 +timeCreated: 1610016988 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDBItem.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs new file mode 100644 index 00000000..c563d25b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs @@ -0,0 +1,1183 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +// THIS FILE IS DEPRECATED AND SHOULD NOT BE USED + +using System; +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; +using System.Text.RegularExpressions; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateDataContainer + { + public int UNITY_VERSION = -1; + public TemplateData TemplateDataRef; + } + + [Serializable] + public class VertexDataContainer + { + [SerializeField] + private List m_vertexData; + + [SerializeField] + private string m_vertexDataId = string.Empty; + + [SerializeField] + private int m_vertexDataStartIdx = -1; + + public void Reload() + { + if( m_vertexData != null ) + { + m_vertexData.Clear(); + } + } + + public void Destroy() + { + if( m_vertexData != null ) + { + m_vertexData.Clear(); + m_vertexData = null; + } + } + + + public List VertexData { get { return m_vertexData; } set { m_vertexData = value; } } + public string VertexDataId { get { return m_vertexDataId; } set { m_vertexDataId = value; } } + public int VertexDataStartIdx { get { return m_vertexDataStartIdx; } set { m_vertexDataStartIdx = value; } } + } + + [Serializable] + public sealed class TemplateData : TemplateDataParent + { + [SerializeField] + private string m_templateBody = string.Empty; + + [SerializeField] + private string m_shaderNameId = string.Empty; + + [SerializeField] + private List m_propertyList = new List(); + private Dictionary m_propertyDict = new Dictionary(); + + [SerializeField] + private List m_inputDataList = new List(); + private Dictionary m_inputDataDict = new Dictionary(); + + //[SerializeField] + //private List m_snippetElementsList = new List(); + //private Dictionary m_snippetElementsDict = new Dictionary(); + + [SerializeField] + private List m_localVarsList = new List(); + + [SerializeField] + private VertexDataContainer m_vertexDataContainer = new VertexDataContainer(); + + [SerializeField] + private TemplateInterpData m_interpolatorDataContainer; + + [SerializeField] + private List m_availableShaderProperties = new List(); + + [SerializeField] + private TemplateFunctionData m_vertexFunctionData; + + [SerializeField] + private TemplateFunctionData m_fragmentFunctionData; + + [SerializeField] + private TemplateBlendData m_blendData = new TemplateBlendData(); + + [SerializeField] + private TemplateAlphaToMaskData m_alphaToMaskData = new TemplateAlphaToMaskData(); + + [SerializeField] + private TemplateCullModeData m_cullModeData = new TemplateCullModeData(); + + [SerializeField] + private TemplateColorMaskData m_colorMaskData = new TemplateColorMaskData(); + + [SerializeField] + private TemplateStencilData m_stencilData = new TemplateStencilData(); + + [SerializeField] + private TemplateDepthData m_depthData = new TemplateDepthData(); + + [SerializeField] + private TemplateTagsModuleData m_tagData = new TemplateTagsModuleData(); + + public TemplateData() + { + m_templateType = TemplateDataType.LegacySinglePass; + } + + public TemplateData( string name ) + { + m_templateType = TemplateDataType.LegacySinglePass; + Name = name; + } + + public TemplateData( string name, string guid ) + { + m_templateType = TemplateDataType.LegacySinglePass; + m_communityTemplate = false; + if( !string.IsNullOrEmpty( guid ) ) + { + string datapath = AssetDatabase.GUIDToAssetPath( guid ); + if( string.IsNullOrEmpty( datapath ) ) + { + m_isValid = false; + return; + } + + string body = string.Empty; + try + { + body = IOUtils.LoadTextFileFromDisk( datapath ); + } + catch( Exception e ) + { + Debug.LogException( e ); + m_isValid = false; + return; + } + + if( !string.IsNullOrEmpty( body ) ) + { + LoadTemplateBody( body ); + Name = string.IsNullOrEmpty( name ) ? m_defaultShaderName : name; + m_guid = guid; + } + } + } + + public TemplateData( string name, string guid, string body ) + { + m_templateType = TemplateDataType.LegacySinglePass; + m_communityTemplate = true; + if( !string.IsNullOrEmpty( body ) ) + { + LoadTemplateBody( body ); + Name = string.IsNullOrEmpty( name ) ? m_defaultShaderName : name; + m_guid = guid; + } + } + + public override bool Reload() + { + if( m_vertexDataContainer != null ) + { + m_vertexDataContainer.Reload(); + } + + if( m_interpolatorDataContainer != null ) + { + m_interpolatorDataContainer.Destroy(); + } + + if( m_availableShaderProperties != null ) + { + m_availableShaderProperties.Clear(); + } + + if( m_propertyDict != null ) + { + m_propertyDict.Clear(); + } + + if( m_propertyList != null ) + { + m_propertyList.Clear(); + } + + if( m_inputDataDict != null ) + { + m_inputDataDict.Clear(); + } + + if( m_inputDataList != null ) + { + m_inputDataList.Clear(); + } + + if( m_localVarsList != null ) + { + m_localVarsList.Clear(); + } + + //if( m_snippetElementsDict != null ) + //{ + // m_snippetElementsDict.Clear(); + //} + + //if( m_snippetElementsList != null ) + //{ + // for( int i = 0; i < m_snippetElementsList.Count; i++ ) + // { + // GameObject.DestroyImmediate( m_snippetElementsList[ i ] ); + // m_snippetElementsList[ i ] = null; + // } + // m_snippetElementsList.Clear(); + //} + + string datapath = AssetDatabase.GUIDToAssetPath( m_guid ); + string body = string.Empty; + try + { + body = IOUtils.LoadTextFileFromDisk( datapath ); + body = UIUtils.ForceLFLineEnding( body ); + } + catch( Exception e ) + { + Debug.LogException( e ); + m_isValid = false; + } + LoadTemplateBody( body ); + if( m_communityTemplate ) + { + Name = m_defaultShaderName; + } + return true; + } + + void LoadTemplateBody( string body ) + { + + m_templateBody = UIUtils.ForceLFLineEnding( body ) ; + + if( m_templateBody.IndexOf( TemplatesManager.TemplateShaderNameBeginTag ) < 0 ) + { + m_isValid = false; + return; + } + + //Fetching common tags + FetchCommonTags(); + + //Fetch function code areas + FetchCodeAreas( TemplatesManager.TemplateVertexCodeBeginArea, MasterNodePortCategory.Vertex ); + FetchCodeAreas( TemplatesManager.TemplateFragmentCodeBeginArea, MasterNodePortCategory.Fragment ); + + //Fetching inputs + FetchInputs( MasterNodePortCategory.Fragment ); + FetchInputs( MasterNodePortCategory.Vertex ); + + + //Fetch local variables must be done after fetching code areas as it needs them to see is variable is on vertex or fragment + TemplateHelperFunctions.FetchLocalVars( m_templateBody, ref m_localVarsList, m_vertexFunctionData, m_fragmentFunctionData ); + + //Fetch snippets + } + + void FetchSubShaderProperties() + { + Match match = Regex.Match( m_templateBody, @"Pass\s*{" ); + if( match.Groups.Count == 0 ) + { + return; + } + + int beginSubShader = m_templateBody.IndexOf( "SubShader" ); + int endSubShader = match.Groups[ 0 ].Index; + if( beginSubShader > 0 && endSubShader > 0 && endSubShader > beginSubShader ) + { + // ADD A PLACE TO INSERT GRAB PASSES + int passIndex = m_templateBody.IndexOf( TemplatesManager.TemplatePassTag ); + if( passIndex < 0 ) + { + int currIdx = endSubShader - 1; + string identation = string.Empty; + for( ; currIdx > 0; currIdx-- ) + { + if( m_templateBody[ currIdx ] != '\n' ) + { + identation = m_templateBody[ currIdx ] + identation; + } + else + { + identation = m_templateBody[ currIdx ] + identation; + break; + } + } + if( currIdx > 0 ) + { + m_templateBody = m_templateBody.Insert( currIdx, identation + TemplatesManager.TemplatePassTag ); + } + } + + // GET ALL THE MODULES + string subBody = m_templateBody.Substring( beginSubShader, endSubShader - beginSubShader ); + //CULL MODE + { + int cullIdx = subBody.IndexOf( "Cull" ); + if( cullIdx > 0 ) + { + int end = subBody.IndexOf( TemplatesManager.TemplateNewLine, cullIdx ); + string cullParams = subBody.Substring( cullIdx, end - cullIdx ); + m_cullModeData.CullModeId = cullParams; + TemplateHelperFunctions.CreateCullMode( cullParams, ref m_cullModeData ); + if( m_cullModeData.DataCheck == TemplateDataCheck.Valid ) + AddId( cullParams, false, string.Empty ); + } + } + //COLOR MASK + { + int colorMaskIdx = subBody.IndexOf( "ColorMask" ); + if( colorMaskIdx > 0 ) + { + int end = subBody.IndexOf( TemplatesManager.TemplateNewLine, colorMaskIdx ); + string colorMaskParams = subBody.Substring( colorMaskIdx, end - colorMaskIdx ); + m_colorMaskData.ColorMaskId = colorMaskParams; + TemplateHelperFunctions.CreateColorMask( colorMaskParams, ref m_colorMaskData, TemplateHelperFunctions.ColorMaskPattern ); + if( m_colorMaskData.DataCheck == TemplateDataCheck.Valid ) + AddId( colorMaskParams, false ); + } + } + //BlEND MODE + { + int blendModeIdx = subBody.IndexOf( "Blend" ); + if( blendModeIdx > 0 ) + { + int end = subBody.IndexOf( TemplatesManager.TemplateNewLine, blendModeIdx ); + string blendParams = subBody.Substring( blendModeIdx, end - blendModeIdx ); + m_blendData.BlendModeId = blendParams; + TemplateHelperFunctions.CreateBlendMode( blendParams, ref m_blendData, TemplateHelperFunctions.BlendModePattern ); + if( m_blendData.ValidBlendMode ) + { + AddId( blendParams, false ); + } + } + } + //BLEND OP + { + int blendOpIdx = subBody.IndexOf( "BlendOp" ); + if( blendOpIdx > 0 ) + { + int end = subBody.IndexOf( TemplatesManager.TemplateNewLine, blendOpIdx ); + string blendOpParams = subBody.Substring( blendOpIdx, end - blendOpIdx ); + BlendData.BlendOpId = blendOpParams; + TemplateHelperFunctions.CreateBlendOp( blendOpParams, ref m_blendData, TemplateHelperFunctions.BlendOpPattern ); + if( m_blendData.ValidBlendOp ) + { + AddId( blendOpParams, false ); + } + } + + m_blendData.DataCheck = ( m_blendData.ValidBlendMode || m_blendData.ValidBlendOp ) ? TemplateDataCheck.Valid : TemplateDataCheck.Invalid; + } + + //STENCIL + { + int stencilIdx = subBody.IndexOf( "Stencil" ); + if( stencilIdx > -1 ) + { + int stencilEndIdx = subBody.IndexOf( "}", stencilIdx ); + if( stencilEndIdx > 0 ) + { + string stencilParams = subBody.Substring( stencilIdx, stencilEndIdx + 1 - stencilIdx ); + m_stencilData.StencilBufferId = stencilParams; + TemplateHelperFunctions.CreateStencilOps( stencilParams, ref m_stencilData ); + if( m_stencilData.DataCheck == TemplateDataCheck.Valid ) + { + AddId( stencilParams, true ); + } + } + } + } + + //ZWRITE + { + int zWriteOpIdx = subBody.IndexOf( "ZWrite" ); + if( zWriteOpIdx > -1 ) + { + int zWriteEndIdx = subBody.IndexOf( TemplatesManager.TemplateNewLine, zWriteOpIdx ); + if( zWriteEndIdx > 0 ) + { + m_depthData.ZWriteModeId = subBody.Substring( zWriteOpIdx, zWriteEndIdx + 1 - zWriteOpIdx ); + TemplateHelperFunctions.CreateZWriteMode( m_depthData.ZWriteModeId, ref m_depthData ); + if( m_depthData.DataCheck == TemplateDataCheck.Valid ) + { + AddId( m_depthData.ZWriteModeId, true ); + } + } + } + } + + //ZTEST + { + int zTestOpIdx = subBody.IndexOf( "ZTest" ); + if( zTestOpIdx > -1 ) + { + int zTestEndIdx = subBody.IndexOf( TemplatesManager.TemplateNewLine, zTestOpIdx ); + if( zTestEndIdx > 0 ) + { + m_depthData.ZTestModeId = subBody.Substring( zTestOpIdx, zTestEndIdx + 1 - zTestOpIdx ); + TemplateHelperFunctions.CreateZTestMode( m_depthData.ZTestModeId, ref m_depthData ); + if( m_depthData.DataCheck == TemplateDataCheck.Valid ) + { + AddId( m_depthData.ZTestModeId, true ); + } + } + } + } + + //ZOFFSET + { + int zOffsetIdx = subBody.IndexOf( "Offset" ); + if( zOffsetIdx > -1 ) + { + int zOffsetEndIdx = subBody.IndexOf( TemplatesManager.TemplateNewLine, zOffsetIdx ); + if( zOffsetEndIdx > 0 ) + { + m_depthData.OffsetId = subBody.Substring( zOffsetIdx, zOffsetEndIdx + 1 - zOffsetIdx ); + TemplateHelperFunctions.CreateZOffsetMode( m_depthData.OffsetId, ref m_depthData ); + if( m_depthData.DataCheck == TemplateDataCheck.Valid ) + { + AddId( m_depthData.OffsetId, true ); + } + } + } + + m_depthData.SetDataCheck(); + } + + //TAGS + { + int tagsIdx = subBody.IndexOf( "Tags" ); + if( tagsIdx > -1 ) + { + int tagsEndIdx = subBody.IndexOf( "}", tagsIdx ); + if( tagsEndIdx > -1 ) + { + m_tagData.Reset(); + m_tagData.TagsId = subBody.Substring( tagsIdx, tagsEndIdx + 1 - tagsIdx ); + TemplateHelperFunctions.CreateTags( ref m_tagData, true ); + m_tagData.DataCheck = TemplateDataCheck.Valid; + AddId( m_tagData.TagsId, false ); + } + else + { + m_tagData.DataCheck = TemplateDataCheck.Invalid; + } + } + else + { + m_tagData.DataCheck = TemplateDataCheck.Invalid; + } + } + } + } + + void FetchCommonTags() + { + // Name + try + { + int nameBegin = m_templateBody.IndexOf( TemplatesManager.TemplateShaderNameBeginTag ); + if( nameBegin < 0 ) + { + // Not a template + return; + } + + int nameEnd = m_templateBody.IndexOf( TemplatesManager.TemplateFullEndTag, nameBegin ); + int defaultBegin = nameBegin + TemplatesManager.TemplateShaderNameBeginTag.Length; + int defaultLength = nameEnd - defaultBegin; + m_defaultShaderName = m_templateBody.Substring( defaultBegin, defaultLength ); + int[] nameIdx = m_defaultShaderName.AllIndexesOf( "\"" ); + nameIdx[ 0 ] += 1; // Ignore the " character from the string + m_defaultShaderName = m_defaultShaderName.Substring( nameIdx[ 0 ], nameIdx[ 1 ] - nameIdx[ 0 ] ); + m_shaderNameId = m_templateBody.Substring( nameBegin, nameEnd + TemplatesManager.TemplateFullEndTag.Length - nameBegin ); + AddId( m_shaderNameId, false ); + + } + catch( Exception e ) + { + Debug.LogException( e ); + m_isValid = false; + } + + FetchSubShaderProperties(); + // Vertex Data + { + int vertexDataTagBegin = m_templateBody.IndexOf( TemplatesManager.TemplateVertexDataTag ); + if( vertexDataTagBegin > -1 ) + { + m_vertexDataContainer.VertexDataStartIdx = vertexDataTagBegin; + int vertexDataTagEnd = m_templateBody.IndexOf( TemplatesManager.TemplateEndOfLine, vertexDataTagBegin ); + m_vertexDataContainer.VertexDataId = m_templateBody.Substring( vertexDataTagBegin, vertexDataTagEnd + TemplatesManager.TemplateEndOfLine.Length - vertexDataTagBegin ); + int dataBeginIdx = m_templateBody.LastIndexOf( '{', vertexDataTagBegin, vertexDataTagBegin ); + string vertexData = m_templateBody.Substring( dataBeginIdx + 1, vertexDataTagBegin - dataBeginIdx ); + + int parametersBegin = vertexDataTagBegin + TemplatesManager.TemplateVertexDataTag.Length; + string parameters = m_templateBody.Substring( parametersBegin, vertexDataTagEnd - parametersBegin ); + m_vertexDataContainer.VertexData = TemplateHelperFunctions.CreateVertexDataList( vertexData, parameters ); + AddId( m_vertexDataContainer.VertexDataId ); + } + } + + // Available interpolators + try + { + int interpDataBegin = m_templateBody.IndexOf( TemplatesManager.TemplateInterpolatorBeginTag ); + if( interpDataBegin > -1 ) + { + int interpDataEnd = m_templateBody.IndexOf( TemplatesManager.TemplateEndOfLine, interpDataBegin ); + string interpDataId = m_templateBody.Substring( interpDataBegin, interpDataEnd + TemplatesManager.TemplateEndOfLine.Length - interpDataBegin ); + + int dataBeginIdx = m_templateBody.LastIndexOf( '{', interpDataBegin, interpDataBegin ); + string interpData = m_templateBody.Substring( dataBeginIdx + 1, interpDataBegin - dataBeginIdx ); + + m_interpolatorDataContainer = TemplateHelperFunctions.CreateInterpDataList( interpData, interpDataId, 8 ); + m_interpolatorDataContainer.InterpDataId = interpDataId; + m_interpolatorDataContainer.InterpDataStartIdx = interpDataBegin; + AddId( interpDataId ); + } + } + catch( Exception e ) + { + Debug.LogException( e ); + m_isValid = false; + } + + + try + { + Dictionary duplicatesHelper = new Dictionary(); + m_availableShaderProperties = new List(); + + // Common Tags + for( int i = 0; i < TemplatesManager.CommonTags.Length; i++ ) + { + int idx = m_templateBody.IndexOf( TemplatesManager.CommonTags[ i ].Id ); + if( idx > -1 ) + { + string currentId = TemplatesManager.CommonTags[ i ].Id; + + TemplateCommonTagId commonTagId = (TemplateCommonTagId)i; + switch( commonTagId ) + { + // Properties + case TemplateCommonTagId.Property: + { + TemplateHelperFunctions.CreateShaderPropertiesList( m_templateBody.Substring( 0, idx + TemplatesManager.CommonTags[ i ].Id.Length ), ref m_availableShaderProperties, ref duplicatesHelper,-1,-1 ); + } + break; + // Globals + case TemplateCommonTagId.Global: + { + TemplateHelperFunctions.CreateShaderGlobalsList( m_templateBody.Substring( 0, idx + TemplatesManager.CommonTags[ i ].Id.Length ), ref m_availableShaderProperties, ref duplicatesHelper,-1,-1 ); + } + break; + + //Tags + //case TemplateCommonTagId.Tag: + //{ + // m_propertyList[ m_propertyList.Count - 1 ].Indentation = " "; + //} + //break; + //case TemplateCommonTagId.CullMode: + //{ + // int newId = idx + TemplatesManager.CommonTags[ i ].Id.Length; + // int end = m_templateBody.IndexOf( TemplatesManager.TemplateNewLine, newId ); + // string cullParams = m_templateBody.Substring( newId, end - newId ); + // currentId = m_templateBody.Substring( idx, end - idx ); + // m_cullModeData.CullModeId = currentId; + // TemplateHelperFunctions.CreateCullMode( cullParams, ref m_cullModeData ); + //} + //break; + //Blend Mode + //case TemplateCommonTagId.BlendMode: + //{ + // int newId = idx + TemplatesManager.CommonTags[ i ].Id.Length; + // int end = m_templateBody.IndexOf( TemplatesManager.TemplateNewLine, newId ); + // string blendParams = m_templateBody.Substring( newId, end - newId ); + // currentId = m_templateBody.Substring( idx, end - idx ); + // m_blendData.BlendModeId = currentId; + // TemplateHelperFunctions.CreateBlendMode( blendParams, ref m_blendData ); + //}break; + //case TemplateCommonTagId.BlendOp: + //{ + // int newId = idx + TemplatesManager.CommonTags[ i ].Id.Length; + // int end = m_templateBody.IndexOf( TemplatesManager.TemplateNewLine, newId ); + // currentId = m_templateBody.Substring( idx, end - idx ); + // BlendData.BlendOpId = currentId; + // TemplateHelperFunctions.CreateBlendOp( m_templateBody.Substring( newId, end - newId ), ref m_blendData ); + //}break; + //case TemplateCommonTagId.ColorMask: + //{ + // int newId = idx + TemplatesManager.CommonTags[ i ].Id.Length; + // int end = m_templateBody.IndexOf( TemplatesManager.TemplateNewLine, newId ); + // string colorMaskParams = m_templateBody.Substring( newId, end - newId ); + // currentId = m_templateBody.Substring( idx, end - idx ); + // m_colorMaskData.ColorMaskId = currentId; + // TemplateHelperFunctions.CreateColorMask( colorMaskParams, ref m_colorMaskData ); + //} + //break; + //case TemplateCommonTagId.StencilOp: + //{ + // int id = m_templateBody.LastIndexOf( "Stencil" ); + // if( id > -1 ) + // { + // string stencilParams = m_templateBody.Substring( id, idx - id ); + // currentId = stencilParams + TemplatesManager.TemplateStencilOpTag; + // m_stencilData.StencilBufferId = currentId; + // TemplateHelperFunctions.CreateStencilOps( stencilParams, ref m_stencilData ); + // } + + //} + //break; + default: + break; + } + + //AddId( TemplatesManager.CommonTags[ i ] ); + AddId( currentId, TemplatesManager.CommonTags[ i ].SearchIndentation, TemplatesManager.CommonTags[ i ].CustomIndentation ); + } + } + + duplicatesHelper.Clear(); + duplicatesHelper = null; + } + catch( Exception e ) + { + Debug.LogException( e ); + m_isValid = false; + } + } + + void FetchCodeAreas( string begin, MasterNodePortCategory category ) + { + int areaBeginIndexes = m_templateBody.IndexOf( begin ); + + if( areaBeginIndexes > -1 ) + { + int beginIdx = areaBeginIndexes + begin.Length; + int endIdx = m_templateBody.IndexOf( TemplatesManager.TemplateEndOfLine, beginIdx ); + int length = endIdx - beginIdx; + + string parameters = m_templateBody.Substring( beginIdx, length ); + + string[] parametersArr = parameters.Split( IOUtils.FIELD_SEPARATOR ); + + string id = m_templateBody.Substring( areaBeginIndexes, endIdx + TemplatesManager.TemplateEndOfLine.Length - areaBeginIndexes ); + string inParameters = parametersArr[ 0 ]; + string outParameters = ( parametersArr.Length > 1 ) ? parametersArr[ 1 ] : string.Empty; + if( category == MasterNodePortCategory.Fragment ) + { + m_fragmentFunctionData = new TemplateFunctionData(-1, string.Empty, id, areaBeginIndexes, inParameters, outParameters, category ); + } + else + { + m_vertexFunctionData = new TemplateFunctionData( -1, string.Empty,id, areaBeginIndexes, inParameters, outParameters, category ); + } + AddId( id, true ); + } + } + + void FetchInputs( MasterNodePortCategory portCategory ) + { + string beginTag = ( portCategory == MasterNodePortCategory.Fragment ) ? TemplatesManager.TemplateInputsFragBeginTag : TemplatesManager.TemplateInputsVertBeginTag; + int[] inputBeginIndexes = m_templateBody.AllIndexesOf( beginTag ); + if( inputBeginIndexes != null && inputBeginIndexes.Length > 0 ) + { + for( int i = 0; i < inputBeginIndexes.Length; i++ ) + { + int inputEndIdx = m_templateBody.IndexOf( TemplatesManager.TemplateEndSectionTag, inputBeginIndexes[ i ] ); + int defaultValueBeginIdx = inputEndIdx + TemplatesManager.TemplateEndSectionTag.Length; + int endLineIdx = m_templateBody.IndexOf( TemplatesManager.TemplateFullEndTag, defaultValueBeginIdx ); + + string defaultValue = m_templateBody.Substring( defaultValueBeginIdx, endLineIdx - defaultValueBeginIdx ); + string tagId = m_templateBody.Substring( inputBeginIndexes[ i ], endLineIdx + TemplatesManager.TemplateFullEndTag.Length - inputBeginIndexes[ i ] ); + + int beginIndex = inputBeginIndexes[ i ] + beginTag.Length; + int length = inputEndIdx - beginIndex; + string inputData = m_templateBody.Substring( beginIndex, length ); + string[] inputDataArray = inputData.Split( IOUtils.FIELD_SEPARATOR ); + if( inputDataArray != null && inputDataArray.Length > 0 ) + { + try + { + string portName = inputDataArray[ (int)TemplatePortIds.Name ]; + WirePortDataType dataType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), inputDataArray[ (int)TemplatePortIds.DataType ].ToUpper() ); + + int portUniqueIDArrIdx = (int)TemplatePortIds.UniqueId; + int portUniqueId = ( portUniqueIDArrIdx < inputDataArray.Length ) ? Convert.ToInt32( inputDataArray[ portUniqueIDArrIdx ] ) : -1; + if( portUniqueId < 0 ) + portUniqueId = m_inputDataList.Count; + + int portOrderArrayIdx = (int)TemplatePortIds.OrderId; + int portOrderId = ( portOrderArrayIdx < inputDataArray.Length ) ? Convert.ToInt32( inputDataArray[ portOrderArrayIdx ] ) : -1; + if( portOrderId < 0 ) + portOrderId = m_inputDataList.Count; + + AddInput( inputBeginIndexes[ i ], tagId, portName, defaultValue, dataType, portCategory, portUniqueId, portOrderId ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + } + } + } + + //void FetchSnippets() + //{ + // int[] codeSnippetAttribBeginIndexes = m_templateBody.AllIndexesOf( TemplatesManager.TemplateCodeSnippetAttribBegin ); + // int[] codeSnippetAttribEndIndexes = m_templateBody.AllIndexesOf( TemplatesManager.TemplateCodeSnippetAttribEnd ); + // int[] codeSnippetEndIndexes = m_templateBody.AllIndexesOf( TemplatesManager.TemplateCodeSnippetEnd ); + + // if( codeSnippetAttribBeginIndexes != null && codeSnippetAttribBeginIndexes.Length > 0 && + // codeSnippetAttribEndIndexes != null && codeSnippetAttribEndIndexes.Length > 0 && + // codeSnippetEndIndexes != null && codeSnippetEndIndexes.Length > 0 && + // codeSnippetEndIndexes.Length == codeSnippetAttribBeginIndexes.Length && + // codeSnippetAttribBeginIndexes.Length == codeSnippetAttribEndIndexes.Length ) + // { + // for( int i = 0; i < codeSnippetAttribBeginIndexes.Length; i++ ) + // { + // // get attributes + // int startAttribIndex = codeSnippetAttribBeginIndexes[ i ] + TemplatesManager.TemplateCodeSnippetAttribBegin.Length; + // int lengthAttrib = codeSnippetAttribEndIndexes[ i ] - startAttribIndex; + // string snippetAttribs = m_templateBody.Substring( startAttribIndex, lengthAttrib ); + // string[] snippetAttribsArr = snippetAttribs.Split( IOUtils.FIELD_SEPARATOR ); + // if( snippetAttribsArr != null && snippetAttribsArr.Length > 0 ) + // { + // string attribName = snippetAttribsArr[ (int)TemplateCodeSnippetInfoIdx.Name ]; + // TemplateCodeSnippetType attribType = (TemplateCodeSnippetType)Enum.Parse( typeof( TemplateCodeSnippetType ), snippetAttribsArr[ (int)TemplateCodeSnippetInfoIdx.Type ] ); + // if( m_snippetElementsDict.ContainsKey( attribName ) ) + // { + // if( m_snippetElementsDict[ attribName ].Type != attribType ) + // { + // if( DebugConsoleWindow.DeveloperMode ) + // Debug.LogWarning( "Found incompatible types for snippet " + attribName ); + // } + // } + // else + // { + // switch( attribType ) + // { + // case TemplateCodeSnippetType.Toggle: + // { + // //Register must be done by first instantiang the correct type and register it on both containers + // //Overrides don't work if we use the container reference into the other + // TemplateCodeSnippetToggle newSnippet = ScriptableObject.CreateInstance(); + // newSnippet.Init( attribName, attribType ); + // m_snippetElementsDict.Add( attribName, newSnippet ); + // m_snippetElementsList.Add( newSnippet ); + // } + // break; + // } + + // } + // // Add initial tag indentation + // int indentationIndex = codeSnippetAttribBeginIndexes[ i ]; + // int lengthAdjust = 0; + // for( ; indentationIndex > 0; indentationIndex--, lengthAdjust++ ) + // { + // if( m_templateBody[ indentationIndex ] == TemplatesManager.TemplateNewLine ) + // { + // indentationIndex += 1; + // lengthAdjust -= 1; + // break; + // } + // } + + // if( indentationIndex > 0 ) + // { + // string snippetId = m_templateBody.Substring( indentationIndex, + // codeSnippetEndIndexes[ i ] + TemplatesManager.TemplateCodeSnippetEnd.Length - codeSnippetAttribBeginIndexes[ i ] + lengthAdjust ); + + // int snippetCodeStart = codeSnippetAttribEndIndexes[ i ] + TemplatesManager.TemplateCodeSnippetAttribEnd.Length; + // int snippetCodeLength = codeSnippetEndIndexes[ i ] - snippetCodeStart; + // //Remove possible identation characters present between tag and last instruction + // if( m_templateBody[ snippetCodeStart + snippetCodeLength - 1 ] != TemplatesManager.TemplateNewLine ) + // { + // for( ; snippetCodeLength > 0; snippetCodeLength-- ) + // { + // if( m_templateBody[ snippetCodeStart + snippetCodeLength - 1 ] == TemplatesManager.TemplateNewLine ) + // break; + // } + // } + + // if( snippetCodeLength > 0 ) + // { + // string snippetCode = m_templateBody.Substring( snippetCodeStart, snippetCodeLength ); + // TemplateCodeSnippetElement element = new TemplateCodeSnippetElement( snippetId, snippetCode ); + // m_snippetElementsDict[ attribName ].AddSnippet( element ); + // } + // } + // } + // } + // } + //} + + //void RefreshSnippetInfo() + //{ + // if( m_snippetElementsDict == null ) + // { + // m_snippetElementsDict = new Dictionary(); + // } + + // if( m_snippetElementsDict.Count != m_snippetElementsList.Count ) + // { + // m_snippetElementsDict.Clear(); + // for( int i = 0; i < m_snippetElementsList.Count; i++ ) + // { + // m_snippetElementsDict.Add( m_snippetElementsList[ i ].NameId, m_snippetElementsList[ i ] ); + // } + // } + //} + + //public void DrawSnippetProperties( ParentNode owner ) + //{ + // for( int i = 0; i < m_snippetElementsList.Count; i++ ) + // { + // m_snippetElementsList[ i ].DrawProperties( owner ); + // } + //} + + //public void InsertSnippets( ref string shaderBody ) + //{ + // for( int i = 0; i < m_snippetElementsList.Count; i++ ) + // { + // m_snippetElementsList[ i ].InsertSnippet( ref shaderBody ); + // } + //} + + public void AddId( string ID, bool searchIndentation = true ) + { + AddId( ID, searchIndentation, string.Empty ); + } + + public void AddId( string ID, bool searchIndentation, string customIndentation ) + { + int propertyIndex = m_templateBody.IndexOf( ID ); + if( propertyIndex > -1 ) + { + if( searchIndentation ) + { + int indentationIndex = -1; + for( int i = propertyIndex; i > 0; i-- ) + { + if( m_templateBody[ i ] == TemplatesManager.TemplateNewLine ) + { + indentationIndex = i + 1; + break; + } + } + if( indentationIndex > -1 ) + { + int length = propertyIndex - indentationIndex; + string indentation = ( length > 0 ) ? m_templateBody.Substring( indentationIndex, length ) : string.Empty; + m_propertyList.Add( new TemplateProperty( ID, indentation, false ) ); + } + } + else + { + m_propertyList.Add( new TemplateProperty( ID, customIndentation, true ) ); + } + } + } + + void BuildInfo() + { + if( m_propertyDict == null ) + { + m_propertyDict = new Dictionary(); + } + + if( m_propertyList.Count != m_propertyDict.Count ) + { + m_propertyDict.Clear(); + for( int i = 0; i < m_propertyList.Count; i++ ) + { + m_propertyDict.Add( m_propertyList[ i ].Id, m_propertyList[ i ] ); + } + } + } + + public void ResetTemplateUsageData() + { + BuildInfo(); + for( int i = 0; i < m_propertyList.Count; i++ ) + { + m_propertyList[ i ].Used = false; + } + } + + public void AddInput( int tagStartIdx, string tagId, string portName, string defaultValue, WirePortDataType dataType, MasterNodePortCategory portCategory, int portUniqueId, int portOrderId ) + { + TemplateInputData inputData = new TemplateInputData( tagStartIdx, tagStartIdx, tagId, portName, defaultValue, dataType, portCategory, portUniqueId, portOrderId, string.Empty ); + m_inputDataList.Add( inputData ); + m_inputDataDict.Add( inputData.PortUniqueId, inputData ); + AddId( tagId, false ); + } + + public override void Destroy() + { + if( m_vertexDataContainer != null ) + { + m_vertexDataContainer.Destroy(); + m_vertexDataContainer = null; + } + + if( m_interpolatorDataContainer != null ) + { + m_interpolatorDataContainer.Destroy(); + m_interpolatorDataContainer = null; + } + + if( m_availableShaderProperties != null ) + { + m_availableShaderProperties.Clear(); + m_availableShaderProperties = null; + } + + if( m_propertyDict != null ) + { + m_propertyDict.Clear(); + m_propertyDict = null; + } + + if( m_propertyList != null ) + { + m_propertyList.Clear(); + m_propertyList = null; + } + + if( m_inputDataDict != null ) + { + m_inputDataDict.Clear(); + m_inputDataDict = null; + } + + if( m_inputDataList != null ) + { + m_inputDataList.Clear(); + m_inputDataList = null; + } + + if( m_localVarsList != null ) + { + m_localVarsList.Clear(); + m_localVarsList = null; + } + //if( m_snippetElementsDict != null ) + //{ + // m_snippetElementsDict.Clear(); + // m_snippetElementsDict = null; + //} + + //if( m_snippetElementsList != null ) + //{ + // for( int i = 0; i < m_snippetElementsList.Count; i++ ) + // { + // GameObject.DestroyImmediate( m_snippetElementsList[ i ] ); + // m_snippetElementsList[ i ] = null; + // } + // m_snippetElementsList.Clear(); + // m_snippetElementsList = null; + //} + + m_alphaToMaskData = null; + m_cullModeData = null; + m_blendData = null; + m_colorMaskData = null; + m_stencilData = null; + if( m_tagData != null ) + { + m_tagData.Destroy(); + m_tagData = null; + } + } + + public void FillEmptyTags( ref string body ) + { + body = body.Replace( TemplatesManager.TemplateLocalVarTag, string.Empty ); + for( int i = 0; i < m_propertyList.Count; i++ ) + { + if( !m_propertyList[ i ].Used ) + { + if( m_propertyList[ i ].UseCustomIndentation ) + { + body = body.Replace( m_propertyList[ i ].Id, string.Empty ); + } + else + { + body = body.Replace( m_propertyList[ i ].Indentation + m_propertyList[ i ].Id, string.Empty ); + } + } + } + } + + public bool FillVertexInstructions( ref string body, params string[] values ) + { + if( m_vertexFunctionData != null && !string.IsNullOrEmpty( m_vertexFunctionData.Id ) ) + { + return FillTemplateBody( m_vertexFunctionData.Id, ref body, values ); + } + + if( values.Length > 0 ) + { + UIUtils.ShowMessage( "Attemping to add vertex instructions on a template with no assigned vertex code area", MessageSeverity.Error ); + return false; + } + return true; + } + + public bool FillFragmentInstructions( ref string body, params string[] values ) + { + if( m_fragmentFunctionData != null && !string.IsNullOrEmpty( m_fragmentFunctionData.Id ) ) + { + return FillTemplateBody( m_fragmentFunctionData.Id, ref body, values ); + } + + if( values.Length > 0 ) + { + UIUtils.ShowMessage( "Attemping to add fragment instructions on a template with no assigned vertex code area", MessageSeverity.Error ); + return false; + } + return true; + } + + // values must be unindented an without line feed + public bool FillTemplateBody( string id, ref string body, params string[] values ) + { + if( values.Length == 0 ) + { + return true; + } + + BuildInfo(); + + if( m_propertyDict.ContainsKey( id ) ) + { + string finalValue = string.Empty; + for( int i = 0; i < values.Length; i++ ) + { + + if( m_propertyDict[ id ].AutoLineFeed ) + { + string[] valuesArr = values[ i ].Split( '\n' ); + for( int j = 0; j < valuesArr.Length; j++ ) + { + //first value will be automatically indented by the string replace + finalValue += ( ( i == 0 && j == 0 ) ? string.Empty : m_propertyDict[ id ].Indentation ) + valuesArr[ j ]; + finalValue += TemplatesManager.TemplateNewLine; + } + + } + else + { + //first value will be automatically indented by the string replace + finalValue += ( i == 0 ? string.Empty : m_propertyDict[ id ].Indentation ) + values[ i ]; + } + } + + body = body.Replace( id, finalValue ); + m_propertyDict[ id ].Used = true; + return true; + } + + if( values.Length > 1 || !string.IsNullOrEmpty( values[ 0 ] ) ) + { + UIUtils.ShowMessage( string.Format( "Attempting to write data into inexistant tag {0}. Please review the template {1} body and consider adding the missing tag.", id, m_name ), MessageSeverity.Error ); + return false; + } + + return true; + + } + + public bool FillTemplateBody( string id, ref string body, List values ) + { + if( values.Count == 0 ) + { + return true; + } + + string[] array = new string[ values.Count ]; + for( int i = 0; i < values.Count; i++ ) + { + array[ i ] = values[ i ].PropertyName; + } + return FillTemplateBody( id, ref body, array ); + } + + public TemplateInputData InputDataFromId( int id ) + { + if( m_inputDataDict == null ) + m_inputDataDict = new Dictionary(); + + if( m_inputDataDict.Count != m_inputDataList.Count ) + { + m_inputDataDict.Clear(); + for( int i = 0; i < m_inputDataList.Count; i++ ) + { + m_inputDataDict.Add( m_inputDataList[ i ].PortUniqueId, m_inputDataList[ i ] ); + } + } + + if( m_inputDataDict.ContainsKey( id ) ) + return m_inputDataDict[ id ]; + + return null; + } + + public string GetVertexData( TemplateInfoOnSematics info ) + { + int count = m_vertexDataContainer.VertexData.Count; + for( int i = 0; i < count; i++ ) + { + if( m_vertexDataContainer.VertexData[ i ].DataInfo == info ) + { + return string.Format( TemplateHelperFunctions.TemplateVarFormat, m_vertexFunctionData.InVarName, m_vertexDataContainer.VertexData[ i ].VarName ); + } + } + return string.Empty; + } + + public string GetInterpolatedData( TemplateInfoOnSematics info ) + { + int count = m_interpolatorDataContainer.Interpolators.Count; + for( int i = 0; i < count; i++ ) + { + if( m_interpolatorDataContainer.Interpolators[ i ].DataInfo == info ) + { + return string.Format( TemplateHelperFunctions.TemplateVarFormat, m_fragmentFunctionData.InVarName, m_interpolatorDataContainer.Interpolators[ i ].VarName ); + } + } + return string.Empty; + } + + public string InterpDataId { get { return m_interpolatorDataContainer.InterpDataId; } } + public string VertexDataId { get { return m_vertexDataContainer.VertexDataId; } } + public string ShaderNameId { get { return m_shaderNameId; } set { m_shaderNameId = value; } } + public string TemplateBody { get { return m_templateBody; } set { m_templateBody = value; } } + public List InputDataList { get { return m_inputDataList; } set { m_inputDataList = value; } } + public List LocalVarsList { get { return m_localVarsList; } } + public List VertexDataList { get { return m_vertexDataContainer.VertexData; } } + public TemplateInterpData InterpolatorData { get { return m_interpolatorDataContainer; } } + public TemplateFunctionData VertexFunctionData { get { return m_vertexFunctionData; } set { m_vertexFunctionData = value; } } + public TemplateFunctionData FragmentFunctionData { get { return m_fragmentFunctionData; } set { m_fragmentFunctionData = value; } } + public List AvailableShaderProperties { get { return m_availableShaderProperties; } set { m_availableShaderProperties = value; } } + public TemplateBlendData BlendData { get { return m_blendData; } set { m_blendData = value; } } + public TemplateAlphaToMaskData AlphaToMaskData { get { return m_alphaToMaskData; } set { m_alphaToMaskData = value; } } + public TemplateCullModeData CullModeData { get { return m_cullModeData; } set { m_cullModeData = value; } } + public TemplateColorMaskData ColorMaskData { get { return m_colorMaskData; } set { m_colorMaskData = value; } } + public TemplateStencilData StencilData { get { return m_stencilData; } set { m_stencilData = value; } } + public TemplateDepthData DepthData { get { return m_depthData; } set { m_depthData = value; } } + public TemplateTagsModuleData TagData { get { return m_tagData; } set { m_tagData = value; } } + private List PropertyList { get { return m_propertyList; } set { m_propertyList = value; } } + public VertexDataContainer VertexDataContainer { get { return m_vertexDataContainer; } set { m_vertexDataContainer = value; } } + public TemplateInterpData InterpolatorDataContainer { get { return m_interpolatorDataContainer; } set { m_interpolatorDataContainer = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs.meta new file mode 100644 index 00000000..53860859 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b03340e569366ae4dbd502e14c62e225 +timeCreated: 1493904667 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs new file mode 100644 index 00000000..a5389170 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs @@ -0,0 +1,2399 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System.Collections.Generic; +using System.Text.RegularExpressions; +using System; + +namespace AmplifyShaderEditor +{ + public enum NormalizeType + { + Off, + Regular, + Safe + } + + public enum DepthMode + { + DepthLinearEye, + DepthLinear01, + DepthEye, + Depth01, + } + + public class InterpDataHelper + { + public string VarName; + public WirePortDataType VarType; + public bool IsSingleComponent; + public bool SetAtCompileTime; + public InterpDataHelper( WirePortDataType varType, string varName, bool isSingleComponent = true , bool setAtCompileTime = false ) + { + VarName = varName; + VarType = varType; + IsSingleComponent = isSingleComponent; + SetAtCompileTime = setAtCompileTime; + } + } + + public class TemplateCustomData + { + public WirePortDataType DataType; + public string Name; + public bool IsVertex; + public bool IsFragment; + public TemplateCustomData( string name, WirePortDataType dataType ) + { + name = Name; + DataType = dataType; + IsVertex = false; + IsFragment = false; + } + } + + public class TemplateInputParameters + { + public WirePortDataType Type; + public string Name; + public string Declaration; + public TemplateSemantics Semantic; + public TemplateInputParameters( WirePortDataType type, PrecisionType precision, string name, TemplateSemantics semantic, string custom = null ) + { + Type = type; + Name = name; + Semantic = semantic; + Declaration = string.Format( "{0} {1} : {2}", UIUtils.PrecisionWirePortToCgType( precision, type ), Name, Semantic ); + if( !string.IsNullOrEmpty( custom ) ) + Declaration = custom; + } + } + + public class TemplateDataCollector + { + private const int MaxUV = 8; + private int[] m_UVUsage = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + private int m_multipassSubshaderIdx = 0; + private int m_multipassPassIdx = 0; + private TemplateMultiPass m_currentTemplate; + private TemplateSRPType m_currentSRPType = TemplateSRPType.BiRP; + + private Dictionary m_customInterpolatedData; + private Dictionary m_registeredVertexData; + + private Dictionary m_availableFragData; + private Dictionary m_availableVertData; + private TemplateInterpData m_interpolatorData; + private Dictionary m_vertexDataDict; + private TemplateData m_currentTemplateData; + private MasterNodeDataCollector m_currentDataCollector; + public Dictionary m_vertexInputParams; + public Dictionary m_fragmentInputParams; + + private Dictionary m_specialVertexLocalVars; + private Dictionary m_specialFragmentLocalVars; + + private List m_lateDirectivesList = new List(); + private Dictionary m_lateDirectivesDict = new Dictionary(); + + private List m_srpBatcherPropertiesList = new List(); + private List m_fullSrpBatcherPropertiesList = new List(); + private Dictionary m_srpBatcherPropertiesDict = new Dictionary(); + + public void CopySRPPropertiesFromDataCollector( int nodeId, TemplateDataCollector dataCollector ) + { + for( int i = 0; i < dataCollector.SrpBatcherPropertiesList.Count; i++ ) + { + AddSRPBatcherProperty( nodeId, dataCollector.SrpBatcherPropertiesList[ i ].PropertyName ); + } + } + + public void AddSRPBatcherProperty( int nodeID, string property ) + { + if( !m_srpBatcherPropertiesDict.ContainsKey( property ) ) + { + PropertyDataCollector newValue = new PropertyDataCollector( nodeID, property ); + m_srpBatcherPropertiesDict.Add( property, newValue ); + m_srpBatcherPropertiesList.Add( newValue ); + } + } + + public void SetUVUsage( int uv, WirePortDataType type ) + { + if( uv >= 0 && uv < MaxUV ) + { + m_UVUsage[ uv ] = Mathf.Max( m_UVUsage[ uv ], TemplateHelperFunctions.DataTypeChannelUsage[ type ] ); + } + } + + public void SetUVUsage( int uv, int size ) + { + if( uv >= 0 && uv < MaxUV ) + { + m_UVUsage[ uv ] = Mathf.Max( m_UVUsage[ uv ], size ); + } + } + + public void CloseLateDirectives() + { + if( m_lateDirectivesList.Count > 0 ) + { + m_lateDirectivesList.Add( new PropertyDataCollector( -1, string.Empty ) ); + } + } + + public void AddHDLightInfo() + { + } + + public void AddLateDirective( AdditionalLineType type, string value ) + { + + if( !m_lateDirectivesDict.ContainsKey( value ) ) + { + string formattedValue = string.Empty; + switch( type ) + { + case AdditionalLineType.Include: formattedValue = string.Format( Constants.IncludeFormat, value ); break; + case AdditionalLineType.Define: formattedValue = string.Format( Constants.DefineFormat, value ); break; + case AdditionalLineType.Pragma: formattedValue = string.Format( Constants.PragmaFormat, value ); break; + case AdditionalLineType.Custom: formattedValue = value; break; + } + PropertyDataCollector property = new PropertyDataCollector( -1, formattedValue ); + m_lateDirectivesDict.Add( value, property ); + m_lateDirectivesList.Add( property ); + } + } + + public void SetMultipassInfo( TemplateMultiPass currentTemplate, int subShaderIdx, int passIdx, TemplateSRPType currentSRPType ) + { + m_currentTemplate = currentTemplate; + m_multipassSubshaderIdx = subShaderIdx; + m_multipassPassIdx = passIdx; + m_currentSRPType = currentSRPType; + } + + public bool HasDirective( AdditionalLineType type, string value ) + { + switch( type ) + { + case AdditionalLineType.Include: + { + return m_currentTemplate.SubShaders[ m_multipassSubshaderIdx ].Modules.IncludePragmaContainer.HasInclude( value ) || + m_currentTemplate.SubShaders[ m_multipassSubshaderIdx ].Passes[ m_multipassPassIdx ].Modules.IncludePragmaContainer.HasInclude( value ); + } + case AdditionalLineType.Define: + { + return m_currentTemplate.SubShaders[ m_multipassSubshaderIdx ].Modules.IncludePragmaContainer.HasDefine( value ) || + m_currentTemplate.SubShaders[ m_multipassSubshaderIdx ].Passes[ m_multipassPassIdx ].Modules.IncludePragmaContainer.HasDefine( value ); + } + case AdditionalLineType.Pragma: + { + return m_currentTemplate.SubShaders[ m_multipassSubshaderIdx ].Modules.IncludePragmaContainer.HasPragma( value ) || + m_currentTemplate.SubShaders[ m_multipassSubshaderIdx ].Passes[ m_multipassPassIdx ].Modules.IncludePragmaContainer.HasPragma( value ); + } + } + + return false; + } + + public void FillSpecialVariables( TemplatePass currentPass ) + { + m_specialVertexLocalVars = new Dictionary(); + m_specialFragmentLocalVars = new Dictionary(); + int localVarAmount = currentPass.LocalVarsList.Count; + for( int i = 0; i < localVarAmount; i++ ) + { + if( currentPass.LocalVarsList[ i ].IsSpecialVar ) + { + if( currentPass.LocalVarsList[ i ].Category == MasterNodePortCategory.Vertex ) + { + m_specialVertexLocalVars.Add( currentPass.LocalVarsList[ i ].SpecialVarType, currentPass.LocalVarsList[ i ] ); + } + else + { + m_specialFragmentLocalVars.Add( currentPass.LocalVarsList[ i ].SpecialVarType, currentPass.LocalVarsList[ i ] ); + } + } + } + } + + public void BuildFromTemplateData( MasterNodeDataCollector dataCollector, TemplateData templateData ) + { + m_registeredVertexData = new Dictionary(); + m_customInterpolatedData = new Dictionary(); + + + m_currentDataCollector = dataCollector; + m_currentTemplateData = templateData; + + m_vertexDataDict = new Dictionary(); + if( templateData.VertexDataList != null ) + { + for( int i = 0; i < templateData.VertexDataList.Count; i++ ) + { + m_vertexDataDict.Add( templateData.VertexDataList[ i ].Semantics, new TemplateVertexData( templateData.VertexDataList[ i ] ) ); + } + } + + m_availableFragData = new Dictionary(); + if( templateData.InterpolatorData != null && templateData.FragmentFunctionData != null ) + { + m_interpolatorData = new TemplateInterpData( templateData.InterpolatorData ); + int fragCount = templateData.InterpolatorData.Interpolators.Count; + for( int i = 0; i < fragCount; i++ ) + { + string varName = string.Empty; + if( templateData.InterpolatorData.Interpolators[ i ].ExcludeStructPrefix ) + { + varName = templateData.InterpolatorData.Interpolators[ i ].VarName; + } + else if( templateData.InterpolatorData.Interpolators[ i ].IsSingleComponent ) + { + varName = string.Format( TemplateHelperFunctions.TemplateVarFormat, + templateData.FragmentFunctionData.InVarName, + templateData.InterpolatorData.Interpolators[ i ].VarNameWithSwizzle ); + } + else + { + varName = string.Format( templateData.InterpolatorData.Interpolators[ i ].VarNameWithSwizzle, templateData.FragmentFunctionData.InVarName ); + } + + m_availableFragData.Add( templateData.InterpolatorData.Interpolators[ i ].DataInfo, + new InterpDataHelper( templateData.InterpolatorData.Interpolators[ i ].SwizzleType, + varName, + templateData.InterpolatorData.Interpolators[ i ].IsSingleComponent ) ); + } + } + + + m_availableVertData = new Dictionary(); + if( templateData.VertexFunctionData != null && templateData.VertexDataList != null ) + { + int vertCount = templateData.VertexDataList.Count; + for( int i = 0; i < vertCount; i++ ) + { + string varName = string.Empty; + if( templateData.VertexDataList[ i ].ExcludeStructPrefix ) + { + varName = templateData.VertexDataList[ i ].VarName; + } + else + { + varName = string.Format( TemplateHelperFunctions.TemplateVarFormat, templateData.VertexFunctionData.InVarName, templateData.VertexDataList[ i ].VarNameWithSwizzle ); + } + + m_availableVertData.Add( templateData.VertexDataList[ i ].DataInfo, + new InterpDataHelper( templateData.VertexDataList[ i ].SwizzleType, + varName, + templateData.VertexDataList[ i ].IsSingleComponent ) ); + } + } + } + + public void RegisterFragInputParams( WirePortDataType type, PrecisionType precision, string name, TemplateSemantics semantic, string custom ) + { + if( m_fragmentInputParams == null ) + m_fragmentInputParams = new Dictionary(); + + m_fragmentInputParams.Add( semantic, new TemplateInputParameters( type, precision, name, semantic, custom ) ); + } + + public void RegisterFragInputParams( WirePortDataType type, PrecisionType precision, string name, TemplateSemantics semantic ) + { + if( m_fragmentInputParams == null ) + m_fragmentInputParams = new Dictionary(); + + m_fragmentInputParams.Add( semantic, new TemplateInputParameters( type, precision, name, semantic ) ); + } + + public void RegisterVertexInputParams( WirePortDataType type , PrecisionType precision , string name , TemplateSemantics semantic, string custom ) + { + if( m_vertexInputParams == null ) + m_vertexInputParams = new Dictionary(); + + m_vertexInputParams.Add( semantic , new TemplateInputParameters( type , precision , name , semantic, custom ) ); + } + + public void RegisterVertexInputParams( WirePortDataType type, PrecisionType precision, string name, TemplateSemantics semantic ) + { + if( m_vertexInputParams == null ) + m_vertexInputParams = new Dictionary(); + + m_vertexInputParams.Add( semantic, new TemplateInputParameters( type, precision, name, semantic ) ); + } + + public string GetInstanceId() + { + var precision = PrecisionType.Float; + bool useMasterNodeCategory = true; + MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment; + + m_currentDataCollector.AddToDirectives( "#define INSTANCEID_SEMANTIC SV_InstanceID" ); + + if ( HasInfo( TemplateInfoOnSematics.INSTANCEID, useMasterNodeCategory, customCategory ) ) + { + InterpDataHelper info = GetInfo( TemplateInfoOnSematics.INSTANCEID, useMasterNodeCategory, customCategory ); + return info.VarName; + } + else + { + MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; + string name = TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.SV_InstanceID ]; + string varName = RegisterInfoOnSemantic( category, TemplateInfoOnSematics.INSTANCEID, TemplateSemantics.INSTANCEID_SEMANTIC, name, WirePortDataType.UINT, precision, true ); + return varName; + } + } + + public string GetVertexId() + { + var precision = PrecisionType.Float; + bool useMasterNodeCategory = true; + MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment; + + m_currentDataCollector.AddToDirectives( "#define VERTEXID_SEMANTIC SV_VertexID" ); + + WirePortDataType type = WirePortDataType.UINT; + if( HasInfo( TemplateInfoOnSematics.VERTEXID, useMasterNodeCategory, customCategory ) ) + { + InterpDataHelper info = GetInfo( TemplateInfoOnSematics.VERTEXID, useMasterNodeCategory, customCategory ); + return TemplateHelperFunctions.AutoSwizzleData( info.VarName, info.VarType, type, true ); + } + else + { + MasterNodePortCategory portCategory = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; + string name = TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.SV_VertexID ]; + return RegisterInfoOnSemantic( portCategory, TemplateInfoOnSematics.VERTEXID, TemplateSemantics.VERTEXID_SEMANTIC, name, WirePortDataType.UINT, precision, true ); + } + } + + public string GetPrimitiveId() + { + if ( m_fragmentInputParams != null && m_fragmentInputParams.ContainsKey( TemplateSemantics.SV_PrimitiveID ) ) + return m_fragmentInputParams[ TemplateSemantics.SV_PrimitiveID ].Name; + + string name = TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.SV_PrimitiveID ]; + RegisterFragInputParams( WirePortDataType.UINT, PrecisionType.Half, name, TemplateSemantics.SV_PrimitiveID ); + return m_fragmentInputParams[ TemplateSemantics.SV_PrimitiveID ].Name; + } + + public string GetURPMainLight( int uniqueId, string shadowCoords = null ) + { + if( string.IsNullOrEmpty( shadowCoords ) ) + { + shadowCoords = GetShadowCoords( uniqueId ); + } + m_currentDataCollector.AddLocalVariable( uniqueId , string.Format( "Light ase_mainLight = GetMainLight( {0} );",shadowCoords) ); + + return "ase_mainLight"; + } + + public string GetVFace( int uniqueId ) + { + if( IsSRP ) + { + string result = string.Empty; + if( GetCustomInterpolatedData( TemplateInfoOnSematics.VFACE, WirePortDataType.FLOAT, PrecisionType.Float, ref result, true, MasterNodePortCategory.Fragment ) ) + { + m_currentDataCollector.AddToDirectives( "#if !defined(ASE_NEED_CULLFACE)" ); + m_currentDataCollector.AddToDirectives( "#define ASE_NEED_CULLFACE 1" ); + m_currentDataCollector.AddToDirectives( "#endif //ASE_NEED_CULLFACE" ); + return result; + } + else + { + if( m_fragmentInputParams != null && m_fragmentInputParams.ContainsKey( TemplateSemantics.SV_IsFrontFacing ) ) + return m_fragmentInputParams[ TemplateSemantics.SV_IsFrontFacing ].Name; + + string custom = "bool "+ TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.SV_IsFrontFacing ] + " : SV_IsFrontFace"; + RegisterFragInputParams( WirePortDataType.FLOAT, PrecisionType.Half, TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.SV_IsFrontFacing ], TemplateSemantics.SV_IsFrontFacing, custom ); + return m_fragmentInputParams[ TemplateSemantics.SV_IsFrontFacing ].Name; + } + } + else + { + //if( m_fragmentInputParams != null && m_fragmentInputParams.ContainsKey( TemplateSemantics.VFACE ) ) + // return m_fragmentInputParams[ TemplateSemantics.VFACE ].Name; + + //RegisterFragInputParams( WirePortDataType.FLOAT, PrecisionType.Half, TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.VFACE ], TemplateSemantics.VFACE ); + //return m_fragmentInputParams[ TemplateSemantics.VFACE ].Name; + if( m_fragmentInputParams != null && m_fragmentInputParams.ContainsKey( TemplateSemantics.SV_IsFrontFacing ) ) + return m_fragmentInputParams[ TemplateSemantics.SV_IsFrontFacing ].Name; + + string custom = "bool " + TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.SV_IsFrontFacing ] + " : SV_IsFrontFace"; + RegisterFragInputParams( WirePortDataType.FLOAT , PrecisionType.Half , TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.SV_IsFrontFacing ] , TemplateSemantics.SV_IsFrontFacing , custom ); + return m_fragmentInputParams[ TemplateSemantics.SV_IsFrontFacing ].Name; + + } + } + + public string GetShadowCoords( int uniqueId, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + // overriding precision + var precision = PrecisionType.Float; + + string worldPos = GetWorldPos( false, m_currentDataCollector.PortCategory ); + + string result = string.Empty; + if( GetCustomInterpolatedData( TemplateInfoOnSematics.SHADOWCOORDS, WirePortDataType.FLOAT4, precision, ref result, useMasterNodeCategory, customCategory ) ) + { + return result; + } + + string varName = GeneratorUtils.ShadowCoordsStr; + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + + + string shadowCoordsValue = string.Format( "TransformWorldToShadowCoord( {0} )", worldPos ); + if( m_currentDataCollector.PortCategory == MasterNodePortCategory.Fragment ) + { + worldPos = GetWorldPos( false, MasterNodePortCategory.Vertex ); + m_currentDataCollector.AddLocalVariable( uniqueId, "#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) //la" ); + RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT4, precision, string.Format( "TransformWorldToShadowCoord( {0} )", worldPos ), false, MasterNodePortCategory.Fragment ); + m_currentDataCollector.AddLocalVariable( uniqueId, "#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) //la" ); + m_currentDataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, varName, shadowCoordsValue ); + m_currentDataCollector.AddLocalVariable( uniqueId, "#else //la" ); + m_currentDataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, varName, "0" ); + m_currentDataCollector.AddLocalVariable( uniqueId, "#endif //la" ); + } else + { + m_currentDataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, varName, shadowCoordsValue ); + } + return varName; + } + + public bool HasUV( int uvChannel ) + { + return ( m_currentDataCollector.PortCategory == MasterNodePortCategory.Fragment ) ? m_availableFragData.ContainsKey( TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ) : m_availableVertData.ContainsKey( TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ); + } + + public string GetUVName( int uvChannel, WirePortDataType dataType = WirePortDataType.FLOAT2 ) + { + InterpDataHelper info = ( m_currentDataCollector.PortCategory == MasterNodePortCategory.Fragment ) ? m_availableFragData[ TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ] : m_availableVertData[ TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ]; + if( dataType != info.VarType ) + return info.VarName + UIUtils.GetAutoSwizzle( dataType ); + else + return info.VarName; + } + + public string GetTextureCoord( int uvChannel, string propertyName, int uniqueId, PrecisionType precisionType ) + { + bool isVertex = ( m_currentDataCollector.PortCategory == MasterNodePortCategory.Vertex || m_currentDataCollector.PortCategory == MasterNodePortCategory.Tessellation ); + string uvChannelName = string.Empty; + string propertyHelperVar = propertyName + "_ST"; + m_currentDataCollector.AddToUniforms( uniqueId, "float4", propertyHelperVar, IsSRP ); + string uvName = string.Empty; + string result = string.Empty; + if( GetCustomInterpolatedData( TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ], WirePortDataType.FLOAT2, PrecisionType.Float, ref result, false, m_currentDataCollector.PortCategory ) ) + { + uvName = result; + } + else + if( m_currentDataCollector.TemplateDataCollectorInstance.HasUV( uvChannel ) ) + { + uvName = m_currentDataCollector.TemplateDataCollectorInstance.GetUVName( uvChannel ); + } + else + { + uvName = m_currentDataCollector.TemplateDataCollectorInstance.RegisterUV( uvChannel ); + } + + uvChannelName = "uv" + propertyName; + if( isVertex ) + { + string value = string.Format( Constants.TilingOffsetFormat, uvName, propertyHelperVar + ".xy", propertyHelperVar + ".zw" ); + string lodLevel = "0"; + + value = "float4( " + value + ", 0 , " + lodLevel + " )"; + m_currentDataCollector.AddLocalVariable( uniqueId, precisionType, WirePortDataType.FLOAT4, uvChannelName, value ); + } + else + { + m_currentDataCollector.AddLocalVariable( uniqueId, precisionType, WirePortDataType.FLOAT2, uvChannelName, string.Format( Constants.TilingOffsetFormat, uvName, propertyHelperVar + ".xy", propertyHelperVar + ".zw" ) ); + } + return uvChannelName; + } + + public string GenerateAutoUVs( int uvChannel, WirePortDataType size = WirePortDataType.FLOAT2 ) + { + string uvName = string.Empty; + string result = string.Empty; + if( GetCustomInterpolatedData( TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ], size, PrecisionType.Float, ref result, false, m_currentDataCollector.PortCategory ) ) + { + uvName = result; + } + else + if( HasUV( uvChannel ) ) + { + uvName = GetUVName( uvChannel, size ); + } + else + { + uvName = RegisterUV( uvChannel, size ); + } + return uvName; + } + + public string GetUV( int uvChannel, MasterNodePortCategory category = MasterNodePortCategory.Fragment, WirePortDataType size = WirePortDataType.FLOAT4 ) + { + if( !HasUV( uvChannel ) ) + { + RegisterUV( uvChannel, size ); + } + + InterpDataHelper info = ( category == MasterNodePortCategory.Fragment ) ? m_availableFragData[ TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ] : m_availableVertData[ TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ]; + return info.VarName; + } + + public InterpDataHelper GetUVInfo( int uvChannel ) + { + return ( m_currentDataCollector.PortCategory == MasterNodePortCategory.Fragment ) ? m_availableFragData[ TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ] : m_availableVertData[ TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ]; + } + + public string RegisterUV( int UVChannel, WirePortDataType size = WirePortDataType.FLOAT2 ) + { + int channelsSize = TemplateHelperFunctions.DataTypeChannelUsage[ size ]; + WirePortDataType originalSize = size; + if( m_UVUsage[ UVChannel ] > channelsSize ) + { + size = TemplateHelperFunctions.ChannelToDataType[ m_UVUsage[ UVChannel ] ]; + } + + if( m_currentDataCollector.PortCategory == MasterNodePortCategory.Vertex ) + { + TemplateSemantics semantic = TemplateHelperFunctions.IntToSemantic[ UVChannel ]; + + if( m_vertexDataDict.ContainsKey( semantic ) ) + { + return m_vertexDataDict[ semantic ].VarName; + } + + string varName = TemplateHelperFunctions.BaseInterpolatorName + ( ( UVChannel > 0 ) ? UVChannel.ToString() : string.Empty ); + m_availableVertData.Add( TemplateHelperFunctions.IntToUVChannelInfo[ UVChannel ], + new InterpDataHelper( WirePortDataType.FLOAT4, + string.Format( TemplateHelperFunctions.TemplateVarFormat, + m_currentTemplateData.VertexFunctionData.InVarName, + varName ) ) ); + + m_currentDataCollector.AddToVertexInput( + string.Format( TemplateHelperFunctions.TexFullSemantic, + varName, + semantic ) ); + RegisterOnVertexData( semantic, size, varName ); + string finalVarName = m_availableVertData[ TemplateHelperFunctions.IntToUVChannelInfo[ UVChannel ] ].VarName; + switch( size ) + { + case WirePortDataType.FLOAT: + case WirePortDataType.INT: + case WirePortDataType.UINT: + finalVarName += ".x"; + break; + case WirePortDataType.FLOAT2: + finalVarName += ".xy"; + break; + case WirePortDataType.FLOAT3: + finalVarName += ".xyz"; + break; + case WirePortDataType.UINT4: + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + case WirePortDataType.SAMPLER1D: + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.SAMPLER2DARRAY: + case WirePortDataType.SAMPLERSTATE: + case WirePortDataType.OBJECT: + default: + break; + } + return finalVarName; + } + else + { + //search if the correct vertex data is set ... + TemplateInfoOnSematics info = TemplateHelperFunctions.IntToInfo[ UVChannel ]; + TemplateSemantics vertexSemantics = TemplateSemantics.NONE; + foreach( KeyValuePair kvp in m_vertexDataDict ) + { + if( kvp.Value.DataInfo == info ) + { + vertexSemantics = kvp.Key; + break; + } + } + + // if not, add vertex data and create interpolator + if( vertexSemantics == TemplateSemantics.NONE ) + { + vertexSemantics = TemplateHelperFunctions.IntToSemantic[ UVChannel ]; + + if( !m_vertexDataDict.ContainsKey( vertexSemantics ) ) + { + string varName = TemplateHelperFunctions.BaseInterpolatorName + ( ( UVChannel > 0 ) ? UVChannel.ToString() : string.Empty ); + m_availableVertData.Add( TemplateHelperFunctions.IntToUVChannelInfo[ UVChannel ], + new InterpDataHelper( WirePortDataType.FLOAT4, + string.Format( TemplateHelperFunctions.TemplateVarFormat, + m_currentTemplateData.VertexFunctionData.InVarName, + varName ) ) ); + + m_currentDataCollector.AddToVertexInput( + string.Format( TemplateHelperFunctions.TexFullSemantic, + varName, + vertexSemantics ) ); + RegisterOnVertexData( vertexSemantics, size, varName ); + } + } + + // either way create interpolator + TemplateVertexData availableInterp = RequestNewInterpolator( size, false ); + if( availableInterp != null ) + { + bool isPosition = vertexSemantics == TemplateSemantics.POSITION || vertexSemantics == TemplateSemantics.POSITION; + + string interpVarName = m_currentTemplateData.VertexFunctionData.OutVarName + "." + availableInterp.VarNameWithSwizzle; + InterpDataHelper vertInfo = m_availableVertData[ TemplateHelperFunctions.IntToUVChannelInfo[ UVChannel ] ]; + string interpDecl = string.Format( TemplateHelperFunctions.TemplateVariableDecl, interpVarName, TemplateHelperFunctions.AutoSwizzleData( vertInfo.VarName, vertInfo.VarType, size , isPosition ) ); + m_currentDataCollector.AddToVertexInterpolatorsDecl( interpDecl ); + string finalVarName = m_currentTemplateData.FragmentFunctionData.InVarName + "." + availableInterp.VarNameWithSwizzle; + m_availableFragData.Add( TemplateHelperFunctions.IntToUVChannelInfo[ UVChannel ], new InterpDataHelper( size, finalVarName ) ); + if( size != originalSize ) + { + //finalVarName = m_currentTemplateData.FragmentFunctionData.InVarName + "." + availableInterp.VarName + UIUtils.GetAutoSwizzle( originalSize ); + finalVarName = m_availableFragData[ TemplateHelperFunctions.IntToUVChannelInfo[ UVChannel ] ].VarName + UIUtils.GetAutoSwizzle( originalSize ); + } + return finalVarName; + } + } + return string.Empty; + } + //////////////////////////////////////////////////////////////////////////////////////////////// + bool IsSemanticUsedOnInterpolator( TemplateSemantics semantics ) + { + for( int i = 0; i < m_interpolatorData.Interpolators.Count; i++ ) + { + if( m_interpolatorData.Interpolators[ i ].Semantics == semantics ) + { + return true; + } + } + return false; + } + + public bool HasInfo( TemplateInfoOnSematics info, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; + return ( category == MasterNodePortCategory.Fragment ) ? m_availableFragData.ContainsKey( info ) : m_availableVertData.ContainsKey( info ); + } + + public InterpDataHelper GetInfo( TemplateInfoOnSematics info, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; + if( category == MasterNodePortCategory.Fragment ) + { + if( !m_availableFragData[ info ].SetAtCompileTime ) + { + string defineValue = string.Empty; + if( TemplateHelperFunctions.InfoToDefineFrag.TryGetValue( info, out defineValue ) ) + m_currentDataCollector.AddToDefines( -1, defineValue ); + } + return m_availableFragData[ info ]; + } + else + { + if( !m_availableVertData[ info ].SetAtCompileTime ) + { + string defineValue = string.Empty; + if( TemplateHelperFunctions.InfoToDefineVertex.TryGetValue( info, out defineValue ) ) + m_currentDataCollector.AddToDefines( -1, defineValue ); + } + return m_availableVertData[ info ]; + } + } + + public string RegisterInfoOnSemantic( TemplateInfoOnSematics info, TemplateSemantics semantic, string name, WirePortDataType dataType, PrecisionType precisionType, bool requestNewInterpolator, string dataName = null ) + { + return RegisterInfoOnSemantic( m_currentDataCollector.PortCategory, info, semantic, name, dataType, precisionType, requestNewInterpolator, dataName ); + } + // This should only be used to semantics outside the text coord set + public string RegisterInfoOnSemantic( MasterNodePortCategory portCategory, TemplateInfoOnSematics info, TemplateSemantics semantic, string name, WirePortDataType dataType, PrecisionType precisionType, bool requestNewInterpolator, string dataName = null ) + { + if( portCategory == MasterNodePortCategory.Vertex ) + { + if( m_vertexDataDict.ContainsKey( semantic ) ) + { + return m_vertexDataDict[ semantic ].VarName; + } + + m_availableVertData.Add( info, + new InterpDataHelper( dataType, + string.Format( TemplateHelperFunctions.TemplateVarFormat, + m_currentTemplateData.VertexFunctionData.InVarName, + name ),true,true ) ); + + string vertInputVarType = UIUtils.PrecisionWirePortToCgType( precisionType, dataType ); + + m_currentDataCollector.AddToVertexInput( + string.Format( TemplateHelperFunctions.InterpFullSemantic, + vertInputVarType, + name, + semantic ) ); + + RegisterOnVertexData( semantic, dataType, name ); + return m_availableVertData[ info ].VarName; + } + else + { + //search if the correct vertex data is set ... + TemplateSemantics vertexSemantics = TemplateSemantics.NONE; + foreach( KeyValuePair kvp in m_vertexDataDict ) + { + if( kvp.Value.DataInfo == info ) + { + vertexSemantics = kvp.Key; + break; + } + } + + // if not, add vertex data and create interpolator + if( vertexSemantics == TemplateSemantics.NONE ) + { + vertexSemantics = semantic; + + if( !m_vertexDataDict.ContainsKey( vertexSemantics ) ) + { + m_availableVertData.Add( info, + new InterpDataHelper( dataType, + string.Format( TemplateHelperFunctions.TemplateVarFormat, + m_currentTemplateData.VertexFunctionData.InVarName, + name ),true,true ) ); + + string vertInputVarType = UIUtils.PrecisionWirePortToCgType( precisionType, dataType ); + m_currentDataCollector.AddToVertexInput( + string.Format( TemplateHelperFunctions.InterpFullSemantic, + vertInputVarType, + name, + vertexSemantics ) ); + RegisterOnVertexData( vertexSemantics, dataType, name ); + } + } + + // either way create interpolator + + TemplateVertexData availableInterp = null; + if( requestNewInterpolator || IsSemanticUsedOnInterpolator( semantic ) ) + { + availableInterp = RequestNewInterpolator( dataType, false, dataName ); + } + else + { + availableInterp = RegisterOnInterpolator( semantic, dataType, dataName ); + } + + if( availableInterp != null ) + { + bool isPosition = vertexSemantics == TemplateSemantics.POSITION || vertexSemantics == TemplateSemantics.POSITION; + + string interpVarName = m_currentTemplateData.VertexFunctionData.OutVarName + "." + availableInterp.VarNameWithSwizzle; + string interpDecl = string.Format( TemplateHelperFunctions.TemplateVariableDecl, interpVarName, TemplateHelperFunctions.AutoSwizzleData( m_availableVertData[ info ].VarName, m_availableVertData[ info ].VarType, dataType, isPosition ) ); + m_currentDataCollector.AddToVertexInterpolatorsDecl( interpDecl ); + string finalVarName = m_currentTemplateData.FragmentFunctionData.InVarName + "." + availableInterp.VarNameWithSwizzle; + m_availableFragData.Add( info, new InterpDataHelper( dataType, finalVarName ) ); + return finalVarName; + } + } + return string.Empty; + } + + TemplateVertexData RegisterOnInterpolator( TemplateSemantics semantics, WirePortDataType dataType, string vertexDataName = null ) + { + if( vertexDataName == null ) + { + if( TemplateHelperFunctions.SemanticsDefaultName.ContainsKey( semantics ) ) + { + vertexDataName = TemplateHelperFunctions.SemanticsDefaultName[ semantics ]; + } + else + { + vertexDataName = string.Empty; + Debug.LogError( "No valid name given to vertex data" ); + } + } + + TemplateVertexData data = new TemplateVertexData( semantics, dataType, vertexDataName ); + m_interpolatorData.Interpolators.Add( data ); + string interpolator = string.Format( TemplateHelperFunctions.InterpFullSemantic, UIUtils.WirePortToCgType( dataType ), data.VarName, data.Semantics ); + m_currentDataCollector.AddToInterpolators( interpolator ); + return data; + } + + public void RegisterOnVertexData( TemplateSemantics semantics, WirePortDataType dataType, string varName ) + { + m_vertexDataDict.Add( semantics, new TemplateVertexData( semantics, dataType, varName ) ); + } + + public TemplateVertexData RequestMacroInterpolator( string varName ) + { + if( varName != null && m_registeredVertexData.ContainsKey( varName ) ) + { + return m_registeredVertexData[ varName ]; + } + + for( int i = 0; i < m_interpolatorData.AvailableInterpolators.Count; i++ ) + { + if( !m_interpolatorData.AvailableInterpolators[ i ].IsFull ) + { + TemplateVertexData data = m_interpolatorData.AvailableInterpolators[ i ].RequestChannels( WirePortDataType.FLOAT4, false, varName ); + if( data != null ) + { + if( !m_registeredVertexData.ContainsKey( data.VarName ) ) + { + m_registeredVertexData.Add( data.VarName, data ); + } + if( m_interpolatorData.AvailableInterpolators[ i ].Usage == 1 ) + { + string interpolator = string.Format( TemplateHelperFunctions.InterpMacro, varName, TemplateHelperFunctions.SemanticToInt[ data.Semantics ] ); + m_currentDataCollector.AddToInterpolators( interpolator ); + } + return data; + } + } + } + return null; + } + + public bool HasRawInterpolatorOfName( string name ) + { + return m_interpolatorData.HasRawInterpolatorOfName( name ); + } + + public TemplateVertexData RequestNewInterpolator( WirePortDataType dataType, bool isColor, string varName = null , bool noInterpolationFlag = false, bool sampleFlag = false ) + { + if( varName != null && m_registeredVertexData.ContainsKey( varName ) ) + { + return m_registeredVertexData[ varName ]; + } + + for( int i = 0; i < m_interpolatorData.AvailableInterpolators.Count; i++ ) + { + if( !m_interpolatorData.AvailableInterpolators[ i ].IsFull ) + { + if( m_interpolatorData.AvailableInterpolators[ i ].Usage != 0 && + (m_interpolatorData.AvailableInterpolators[ i ].NoInterpolation != noInterpolationFlag || + m_interpolatorData.AvailableInterpolators[ i ].Sample != sampleFlag )) + continue; + + TemplateVertexData data = m_interpolatorData.AvailableInterpolators[ i ].RequestChannels( dataType, isColor, varName ); + if( data != null ) + { + if( !m_registeredVertexData.ContainsKey( data.VarName ) ) + { + m_registeredVertexData.Add( data.VarName, data ); + } + + if( m_interpolatorData.AvailableInterpolators[ i ].Usage == 1 ) + { + m_interpolatorData.AvailableInterpolators[ i ].NoInterpolation = noInterpolationFlag; + m_interpolatorData.AvailableInterpolators[ i ].Sample = sampleFlag; + // First time using this interpolator, so we need to register it + string interpolator = string.Format( TemplateHelperFunctions.TexFullSemantic, + data.VarName, data.Semantics ); + if( noInterpolationFlag ) + interpolator = "nointerpolation " + interpolator; + + if( sampleFlag) + interpolator = "sample " + interpolator; + + m_currentDataCollector.AddToInterpolators( interpolator ); + } + return data; + } + } + } + + // This area is reached if max available interpolators from shader model is reached + // Nevertheless, we register all new interpolators to that list so no imediate compilation errors are thrown + // A warning message is then thrown to warn the user about this + int newInterpId = 1 + TemplateHelperFunctions.SemanticToInt[ m_interpolatorData.AvailableInterpolators[ m_interpolatorData.AvailableInterpolators.Count - 1 ].Semantic ]; + if( TemplateHelperFunctions.IntToSemantic.ContainsKey( newInterpId ) ) + { + TemplateInterpElement item = new TemplateInterpElement( TemplateHelperFunctions.IntToSemantic[ newInterpId ] ); + m_interpolatorData.AvailableInterpolators.Add( item ); + TemplateVertexData data = item.RequestChannels( dataType, isColor, varName ); + if( data != null ) + { + if( !m_registeredVertexData.ContainsKey( data.VarName ) ) + { + m_registeredVertexData.Add( data.VarName, data ); + } + + if( item.Usage == 1 ) + { + string interpolator = string.Format( TemplateHelperFunctions.TexFullSemantic, data.VarName, data.Semantics ); + m_currentDataCollector.AddToInterpolators( interpolator ); + } + return data; + } + } + + UIUtils.ShowMessage( "Maximum amount of interpolators exceeded", MessageSeverity.Error ); + return null; + } + + // Unused channels in interpolators must be set to something so the compiler doesn't generate warnings + public List GetInterpUnusedChannels() + { + List resetInstrucctions = new List(); + + if( m_interpolatorData != null ) + { + for( int i = 0; i < m_interpolatorData.AvailableInterpolators.Count; i++ ) + { + if( m_interpolatorData.AvailableInterpolators[ i ].Usage > 0 && !m_interpolatorData.AvailableInterpolators[ i ].IsFull ) + { + string channels = string.Empty; + bool[] availableChannels = m_interpolatorData.AvailableInterpolators[ i ].AvailableChannels; + for( int j = 0; j < availableChannels.Length; j++ ) + { + if( availableChannels[ j ] ) + { + channels += TemplateHelperFunctions.VectorSwizzle[ j ]; + } + } + + resetInstrucctions.Add( string.Format( "{0}.{1}.{2} = 0;", m_currentTemplateData.VertexFunctionData.OutVarName, m_interpolatorData.AvailableInterpolators[ i ].Name, channels ) ); + } + } + } + + if( resetInstrucctions.Count > 0 ) + { + resetInstrucctions.Insert( 0, "\n//setting value to unused interpolator channels and avoid initialization warnings" ); + } + + return resetInstrucctions; + } + + public bool ContainsSpecialLocalFragVar( TemplateInfoOnSematics info, WirePortDataType type, ref string result ) + { + if( m_specialFragmentLocalVars.ContainsKey( info ) ) + { + result = m_specialFragmentLocalVars[ info ].LocalVarName; + if( m_specialFragmentLocalVars[ info ].DataType != type ) + { + result = TemplateHelperFunctions.AutoSwizzleData( result, m_specialFragmentLocalVars[ info ].DataType, type, false ); + } + return true; + } + return false; + } + + public bool GetCustomInterpolatedData( TemplateInfoOnSematics info, WirePortDataType type, PrecisionType precisionType, ref string result, bool useMasterNodeCategory, MasterNodePortCategory customCategory ) + { + bool isPosition = info == TemplateInfoOnSematics.POSITION || + info == TemplateInfoOnSematics.CLIP_POS || + info == TemplateInfoOnSematics.SCREEN_POSITION || + info == TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED || + info == TemplateInfoOnSematics.WORLD_POSITION || + info == TemplateInfoOnSematics.RELATIVE_WORLD_POS || + info == TemplateInfoOnSematics.OBJECT_POSITION || + info == TemplateInfoOnSematics.VIEW_POSITION; + + + MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; + if( category == MasterNodePortCategory.Vertex ) + { + if( m_specialVertexLocalVars.ContainsKey( info ) ) + { + result = m_specialVertexLocalVars[ info ].LocalVarName; + if( m_specialVertexLocalVars[ info ].DataType != type ) + { + result = TemplateHelperFunctions.AutoSwizzleData( result, m_specialVertexLocalVars[ info ].DataType, type , isPosition ); + } + + string defineValue = string.Empty; + if( TemplateHelperFunctions.InfoToDefineVertex.TryGetValue( info, out defineValue ) ) + m_currentDataCollector.AddToDefines( -1, defineValue ); + + return true; + } + } + + if( category == MasterNodePortCategory.Fragment ) + { + if( m_specialFragmentLocalVars.ContainsKey( info ) ) + { + result = m_specialFragmentLocalVars[ info ].LocalVarName; + if( m_specialFragmentLocalVars[ info ].DataType != type ) + { + result = TemplateHelperFunctions.AutoSwizzleData( result, m_specialFragmentLocalVars[ info ].DataType, type, isPosition ); + } + + string defineValue = string.Empty; + if( TemplateHelperFunctions.InfoToDefineFrag.TryGetValue( info, out defineValue )) + m_currentDataCollector.AddToDefines( -1, defineValue ); + return true; + } + + if( m_availableFragData.ContainsKey( info ) ) + { + if( m_availableFragData[ info ].IsSingleComponent ) + { + result = m_availableFragData[ info ].VarName; + if( m_availableFragData[ info ].VarType != type ) + { + result = TemplateHelperFunctions.AutoSwizzleData( result, m_availableFragData[ info ].VarType, type, isPosition ); + } + return true; + } + else if( TemplateHelperFunctions.InfoToLocalVar.ContainsKey( info ) && TemplateHelperFunctions.InfoToWirePortType.ContainsKey( info ) ) + { + result = TemplateHelperFunctions.InfoToLocalVar[ info ]; + m_currentDataCollector.AddLocalVariable( -1, precisionType, TemplateHelperFunctions.InfoToWirePortType[ info ], result, m_availableFragData[ info ].VarName ); + return true; + } + } + } + return false; + } + + public WirePortDataType GetVertexPositionDataType() + { + InterpDataHelper info = GetInfo( TemplateInfoOnSematics.POSITION , false, MasterNodePortCategory.Vertex); + return info.VarType; + } + + public string GetVertexPosition( WirePortDataType type, PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + PrecisionType precision = PrecisionType.Float; + + string result = string.Empty; + if ( GetCustomInterpolatedData( TemplateInfoOnSematics.OBJECT_POSITION, WirePortDataType.FLOAT3, precision, ref result, useMasterNodeCategory, customCategory ) ) + { + return result; + } + + if ( HasInfo( TemplateInfoOnSematics.POSITION, useMasterNodeCategory, customCategory ) ) + { + InterpDataHelper info = GetInfo( TemplateInfoOnSematics.POSITION, useMasterNodeCategory, customCategory ); + if( type != WirePortDataType.OBJECT && type != info.VarType ) + return TemplateHelperFunctions.AutoSwizzleData( info.VarName, info.VarType, type,true ); + else + return info.VarName; + } + else + { + MasterNodePortCategory portCategory = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; + string name = "ase_vertex_pos"; + string varName = RegisterInfoOnSemantic( portCategory, TemplateInfoOnSematics.POSITION, TemplateSemantics.POSITION, name, WirePortDataType.FLOAT4, precisionType, true ); + if( type != WirePortDataType.OBJECT && type != WirePortDataType.FLOAT4 ) + return TemplateHelperFunctions.AutoSwizzleData( varName, WirePortDataType.FLOAT4, type,true ); + else + return varName; + } + } + + private const string InstancingLibStandard = "UnityInstancing.cginc"; + private const string InstancingLibSRP = "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"; + + public void SetupInstancing() + { + if( !HasInfo( TemplateInfoOnSematics.INSTANCE_ID ) ) + { + m_currentDataCollector.AddToPragmas( -1, IOUtils.InstancedPropertiesHeader ); + m_currentDataCollector.AddToIncludes( -1, IsSRP ? InstancingLibSRP : InstancingLibStandard ); + m_currentDataCollector.AddToVertexInput( Constants.InstanceIdMacro ); + m_currentDataCollector.AddToInterpolators( Constants.InstanceIdMacro ); + m_currentDataCollector.AddToLocalVariables( MasterNodePortCategory.Vertex, -1, string.Format( "UNITY_SETUP_INSTANCE_ID( {0} );", m_currentTemplateData.VertexFunctionData.InVarName ) ); + m_currentDataCollector.AddToLocalVariables( MasterNodePortCategory.Vertex, -1, string.Format( "UNITY_TRANSFER_INSTANCE_ID( {0}, {1} );", m_currentTemplateData.VertexFunctionData.InVarName, m_currentTemplateData.VertexFunctionData.OutVarName ) ); + m_currentDataCollector.AddToLocalVariables( MasterNodePortCategory.Fragment, -1, string.Format( "UNITY_SETUP_INSTANCE_ID( {0} );", m_currentTemplateData.FragmentFunctionData.InVarName ) ); + } + } + + public string GetVertexColor( PrecisionType precisionType ) + { + if( HasInfo( TemplateInfoOnSematics.COLOR ) ) + { + return GetInfo( TemplateInfoOnSematics.COLOR ).VarName; + } + else + { + string name = "ase_color"; + return RegisterInfoOnSemantic( TemplateInfoOnSematics.COLOR, TemplateSemantics.COLOR, name, WirePortDataType.FLOAT4, precisionType, false ); + } + } + + public string GetVertexNormal( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + if( HasInfo( TemplateInfoOnSematics.NORMAL, useMasterNodeCategory, customCategory ) ) + { + InterpDataHelper info = GetInfo( TemplateInfoOnSematics.NORMAL, useMasterNodeCategory, customCategory ); + return TemplateHelperFunctions.AutoSwizzleData( info.VarName, info.VarType, WirePortDataType.FLOAT3 , false); + } + else + { + MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; + string name = "ase_normal"; + return RegisterInfoOnSemantic( category, TemplateInfoOnSematics.NORMAL, TemplateSemantics.NORMAL, name, WirePortDataType.FLOAT3, precisionType, false ); + } + } + + public string GetWorldNormal( PrecisionType precisionType = PrecisionType.Float, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment, bool normalize = false ) + { + string result = string.Empty; + if( GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_NORMAL, WirePortDataType.FLOAT3, precisionType, ref result, useMasterNodeCategory, customCategory ) ) + { + if( normalize ) + return string.Format( "normalize( {0} )", result ); + else + return result; + } + + string varName = normalize ? "normalizeWorldNormal" : GeneratorUtils.WorldNormalStr; + + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + + string worldNormalValue = string.Empty; + + if( !GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_NORMAL, WirePortDataType.FLOAT3, precisionType, ref worldNormalValue, false, MasterNodePortCategory.Vertex ) ) + { + string vertexNormal = GetVertexNormal( precisionType, false, MasterNodePortCategory.Vertex ); + string formatStr = string.Empty; + if( IsSRP ) + formatStr = "TransformObjectToWorldNormal( {0} )"; + else + formatStr = "UnityObjectToWorldNormal( {0} )"; + worldNormalValue = string.Format( formatStr, vertexNormal ); + } + + if( normalize ) + worldNormalValue = string.Format( "normalize( {0} )", worldNormalValue ); + + RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, precisionType, worldNormalValue, useMasterNodeCategory, customCategory ); + return varName; + } + + public string GetWorldNormal( int uniqueId, PrecisionType precisionType, string normal, string outputId ) + { + string tanToWorld0 = string.Empty; + string tanToWorld1 = string.Empty; + string tanToWorld2 = string.Empty; + + GetWorldTangentTf( precisionType, out tanToWorld0, out tanToWorld1, out tanToWorld2, true ); + + string tanNormal = "tanNormal" + outputId; + m_currentDataCollector.AddLocalVariable( uniqueId, "float3 " + tanNormal + " = " + normal + ";" ); + return string.Format( "float3( dot( {1}, {0} ), dot( {2}, {0} ), dot( {3}, {0} ) )", tanNormal, tanToWorld0, tanToWorld1, tanToWorld2 ); + } + + public string GetVertexTangent( WirePortDataType type, PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + if( HasInfo( TemplateInfoOnSematics.TANGENT, useMasterNodeCategory, customCategory ) ) + { + InterpDataHelper info = GetInfo( TemplateInfoOnSematics.TANGENT, useMasterNodeCategory, customCategory ); + if( type != WirePortDataType.OBJECT && type != info.VarType ) + return TemplateHelperFunctions.AutoSwizzleData( info.VarName, info.VarType, type , false); + else + return info.VarName; + } + else + { + MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; + string name = "ase_tangent"; + string varName = RegisterInfoOnSemantic( category, TemplateInfoOnSematics.TANGENT, TemplateSemantics.TANGENT, name, WirePortDataType.FLOAT4, precisionType, false ); + if( type != WirePortDataType.OBJECT && type != WirePortDataType.FLOAT4 ) + return TemplateHelperFunctions.AutoSwizzleData( varName, WirePortDataType.FLOAT4, type , false ); + else + return varName; + } + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + public string GetBlendWeights( bool useMasterNodeCategory = true , MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + if( HasInfo( TemplateInfoOnSematics.BLENDWEIGHTS , useMasterNodeCategory , customCategory ) ) + { + InterpDataHelper info = GetInfo( TemplateInfoOnSematics.BLENDWEIGHTS , useMasterNodeCategory , customCategory ); + return info.VarName; + } + else + { + MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; + string name = GeneratorUtils.VertexBlendWeightsStr; + string varName = RegisterInfoOnSemantic( category , TemplateInfoOnSematics.BLENDWEIGHTS , TemplateSemantics.BLENDWEIGHTS , name , WirePortDataType.FLOAT4 ,PrecisionType.Float , false , name ); + return varName; + } + } + + public string GetBlendIndices( bool useMasterNodeCategory = true , MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + if( HasInfo( TemplateInfoOnSematics.BLENDINDICES , useMasterNodeCategory , customCategory ) ) + { + InterpDataHelper info = GetInfo( TemplateInfoOnSematics.BLENDINDICES , useMasterNodeCategory , customCategory ); + return info.VarName; + } + else + { + MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; + string name = GeneratorUtils.VertexBlendIndicesStr; + string varName = RegisterInfoOnSemantic( category , TemplateInfoOnSematics.BLENDINDICES , TemplateSemantics.BLENDINDICES , name , WirePortDataType.UINT4 , PrecisionType.Float , false , name ); + return varName; + } + } + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + public string GetVertexBitangent( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string varName = GeneratorUtils.VertexBitangentStr; + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + + string tangentValue = GetVertexTangent( WirePortDataType.FLOAT4, precisionType, false, MasterNodePortCategory.Vertex ); + string normalValue = GetVertexNormal( precisionType, false, MasterNodePortCategory.Vertex ); + + string bitangentValue = string.Format( "cross( {0}, {1}.xyz ) * {1}.w * ( unity_WorldTransformParams.w >= 0.0 ? 1.0 : -1.0 )", normalValue, tangentValue ); + RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, precisionType, bitangentValue, useMasterNodeCategory, customCategory ); + return varName; + } + + public string GetWorldTangent( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string result = string.Empty; + if( GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_TANGENT, WirePortDataType.FLOAT3, precisionType, ref result, useMasterNodeCategory, customCategory ) ) + { + return result; + } + + string varName = GeneratorUtils.WorldTangentStr; + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + + string worldTangentValue = string.Empty; + if( !GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_TANGENT, WirePortDataType.FLOAT3, precisionType, ref worldTangentValue, false, MasterNodePortCategory.Vertex ) ) + { + string vertexTangent = GetVertexTangent( WirePortDataType.FLOAT4, precisionType, false, MasterNodePortCategory.Vertex ); + string formatStr = string.Empty; + + if( IsSRP ) + formatStr = "TransformObjectToWorldDir( {0}.xyz )"; + else + formatStr = "UnityObjectToWorldDir( {0} )"; + + worldTangentValue = string.Format( formatStr, vertexTangent ); + } + RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, precisionType, worldTangentValue, useMasterNodeCategory, customCategory ); + return varName; + } + + public string GetTangentSign( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string varName = GeneratorUtils.VertexTangentSignStr; + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + + string tangentValue = GetVertexTangent( WirePortDataType.FLOAT4, precisionType, false, MasterNodePortCategory.Vertex ); + string tangentSignValue = string.Format( "{0}.w * ( unity_WorldTransformParams.w >= 0.0 ? 1.0 : -1.0 )", tangentValue ); + RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT, precisionType, tangentSignValue, useMasterNodeCategory, customCategory ); + return varName; + } + + + public string GetWorldBinormal( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string result = string.Empty; + if( GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_BITANGENT, WirePortDataType.FLOAT3, precisionType, ref result, useMasterNodeCategory, customCategory ) ) + { + return result; + } + + string varName = GeneratorUtils.WorldBitangentStr; + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + + string worldBinormal = string.Empty; + if( !GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_BITANGENT, WirePortDataType.FLOAT3, precisionType, ref worldBinormal, false, MasterNodePortCategory.Vertex ) ) + { + string worldNormal = GetWorldNormal( precisionType, false, MasterNodePortCategory.Vertex ); + string worldtangent = GetWorldTangent( precisionType, false, MasterNodePortCategory.Vertex ); + string tangentSign = GetTangentSign( precisionType, false, MasterNodePortCategory.Vertex ); + worldBinormal = string.Format( "cross( {0}, {1} ) * {2}", worldNormal, worldtangent, tangentSign ); + } + + RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, PrecisionType.Float, worldBinormal, useMasterNodeCategory, customCategory ); + return varName; + } + + public string GetWorldReflection( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment, bool normalize = false ) + { + string varName = GeneratorUtils.WorldReflectionStr;//UIUtils.GetInputValueFromType( SurfaceInputs.WORLD_REFL ); + if( normalize ) + varName = "normalized" + varName; + + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + + string worldNormal = GetWorldNormal( precisionType ); + string worldViewDir = GetViewDir(); + string worldRefl = string.Format( "reflect( -{0}, {1} )", worldViewDir, worldNormal ); + + if( normalize ) + worldRefl = string.Format( "normalize( {0} )", worldRefl ); + + m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3, varName, worldRefl ); + return varName; + } + + public string GetWorldReflection( PrecisionType precisionType, string normal ) + { + string tanToWorld0 = string.Empty; + string tanToWorld1 = string.Empty; + string tanToWorld2 = string.Empty; + + GetWorldTangentTf( precisionType, out tanToWorld0, out tanToWorld1, out tanToWorld2 ); + string worldRefl = GetViewDir(); + + return string.Format( "reflect( -{0}, float3( dot( {2}, {1} ), dot( {3}, {1} ), dot( {4}, {1} ) ) )", worldRefl, normal, tanToWorld0, tanToWorld1, tanToWorld2 ); + } + + public string GetLightAtten( int uniqueId, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + //string result = string.Empty; + //if( GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_POSITION, PrecisionType.Float, ref result, useMasterNodeCategory, customCategory ) ) + //{ + // return result; + //} + + //string varName = GeneratorUtils.WorldPositionStr;//UIUtils.GetInputValueFromType( SurfaceInputs.WORLD_POS ); + //if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + // return varName; + + //if( !m_availableVertData.ContainsKey( TemplateInfoOnSematics.POSITION ) ) + //{ + // UIUtils.ShowMessage( "Attempting to access inexisting vertex position to calculate world pos" ); + // return "fixed3(0,0,0)"; + //} + + //string vertexPos = m_availableVertData[ TemplateInfoOnSematics.POSITION ].VarName; + //string worldPosConversion = string.Format( "mul(unity_ObjectToWorld, {0}).xyz", vertexPos ); + + //RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, PrecisionType.Float, worldPosConversion, useMasterNodeCategory, customCategory ); + //return varName; + + m_currentDataCollector.AddToIncludes( uniqueId, Constants.UnityAutoLightLib ); + m_currentDataCollector.AddToDefines( uniqueId, "ASE_SHADOWS 1" ); + RequestMacroInterpolator( "UNITY_SHADOW_COORDS" ); + + //string vOutName = CurrentTemplateData.VertexFunctionData.OutVarName; + string fInName = CurrentTemplateData.FragmentFunctionData.InVarName; + string worldPos = GetWorldPos(); + m_currentDataCollector.AddLocalVariable( uniqueId, "UNITY_LIGHT_ATTENUATION( ase_atten, " + fInName + ", " + worldPos + " )" ); + return "ase_atten"; + + } + + public string GenerateRotationIndependentObjectScale( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + string worldToObjectMatrix = ( m_currentSRPType == TemplateSRPType.BiRP ) ? "unity_WorldToObject" : "GetWorldToObjectMatrix()"; + string value = string.Format( "( 1.0 / float3( length( {0}[ 0 ].xyz ), length( {0}[ 1 ].xyz ), length( {0}[ 2 ].xyz ) ) )", worldToObjectMatrix ); + dataCollector.AddLocalVariable( uniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, GeneratorUtils.ParentObjectScaleStr, value ); + return GeneratorUtils.ParentObjectScaleStr; + } + + public string GenerateObjectScale( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + string worldToObjectMatrix = ( m_currentSRPType == TemplateSRPType.BiRP ) ? "unity_ObjectToWorld" : "GetObjectToWorldMatrix()"; + string value = string.Format( "float3( length( {0}[ 0 ].xyz ), length( {0}[ 1 ].xyz ), length( {0}[ 2 ].xyz ) )", worldToObjectMatrix ); + dataCollector.AddLocalVariable( uniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, GeneratorUtils.ObjectScaleStr, value ); + return GeneratorUtils.ObjectScaleStr; + } + + public string GenerateObjectPosition( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + string value = string.Empty; + if ( m_currentSRPType != TemplateSRPType.BiRP ) + { + value = "GetAbsolutePositionWS( UNITY_MATRIX_M._m03_m13_m23 )"; + } + else + { + value = "UNITY_MATRIX_M._m03_m13_m23"; + } + dataCollector.AddLocalVariable( uniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, GeneratorUtils.ObjectPositionStr, value ); + return GeneratorUtils.ObjectPositionStr; + } + + public string GenerateObjectBoundsMin( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + string value = string.Empty; + if ( m_currentSRPType != TemplateSRPType.BiRP && ( ASEPackageManagerHelper.CurrentHDRPBaseline >= ASESRPBaseline.ASE_SRP_14 || + ASEPackageManagerHelper.CurrentURPBaseline >= ASESRPBaseline.ASE_SRP_14 ) ) + { + value = "unity_RendererBounds_Min.xyz"; + } + else + { + value = "0"; // not supported + } + dataCollector.AddLocalVariable( uniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, GeneratorUtils.ObjectBoundsMinStr, value ); + return GeneratorUtils.ObjectBoundsMinStr; + } + + public string GenerateObjectBoundsMax( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + string value = string.Empty; + if ( m_currentSRPType != TemplateSRPType.BiRP && ( ASEPackageManagerHelper.CurrentHDRPBaseline >= ASESRPBaseline.ASE_SRP_14 || + ASEPackageManagerHelper.CurrentURPBaseline >= ASESRPBaseline.ASE_SRP_14 ) ) + { + value = "unity_RendererBounds_Max.xyz"; + } + else + { + value = "0"; // not supported + } + dataCollector.AddLocalVariable( uniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, GeneratorUtils.ObjectBoundsMaxStr, value ); + return GeneratorUtils.ObjectBoundsMaxStr; + } + + public string GenerateObjectBoundsSize( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + string value = string.Empty; + if ( m_currentSRPType != TemplateSRPType.BiRP && ( ASEPackageManagerHelper.CurrentHDRPBaseline >= ASESRPBaseline.ASE_SRP_14 || + ASEPackageManagerHelper.CurrentURPBaseline >= ASESRPBaseline.ASE_SRP_14 ) ) + { + value = "( unity_RendererBounds_Max.xyz - unity_RendererBounds_Min.xyz )"; + } + else + { + value = "0"; // not supported + } + dataCollector.AddLocalVariable( uniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, GeneratorUtils.ObjectBoundsSizeStr, value ); + return GeneratorUtils.ObjectBoundsSizeStr; + } + + public string GetPosition( PositionNode.Space space, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + // overriding precision + var precision = PrecisionType.Float; + + string result; + if ( space == PositionNode.Space.Object ) + { + result = GetVertexPosition( WirePortDataType.FLOAT3, precision, useMasterNodeCategory, customCategory ); + } + else if ( space == PositionNode.Space.RelativeWorld ) + { + + result = GetRelativeWorldPos( useMasterNodeCategory, customCategory ); + } + else if ( space == PositionNode.Space.View ) + { + result = GetViewPos( useMasterNodeCategory, customCategory ); + } + else // PositionNode.Space.World + { + result = GetWorldPos( useMasterNodeCategory, customCategory ); + } + return result; + } + + public string GetWorldPos( bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + // overriding precision + var precision = PrecisionType.Float; + + string result = string.Empty; + if( GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_POSITION, WirePortDataType.FLOAT3, precision, ref result, useMasterNodeCategory, customCategory ) ) + { + return result; + } + else if( m_currentSRPType == TemplateSRPType.HDRP ) + { + if( GetCustomInterpolatedData( TemplateInfoOnSematics.RELATIVE_WORLD_POS, WirePortDataType.FLOAT3, precision, ref result, useMasterNodeCategory, customCategory ) ) + { + string worldPosVarName = GeneratorUtils.WorldPositionStr; + string relWorldPosConversion = string.Format( "GetAbsolutePositionWS( {0} )", result ); + m_currentDataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT3, worldPosVarName, relWorldPosConversion ); + return worldPosVarName; + } + } + + string varName = GeneratorUtils.WorldPositionStr;//UIUtils.GetInputValueFromType( SurfaceInputs.WORLD_POS ); + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + + if( !m_availableVertData.ContainsKey( TemplateInfoOnSematics.POSITION ) ) + { + UIUtils.ShowMessage( "Attempting to access inexisting vertex position to calculate world pos" ); + return "half3(0,0,0)"; + } + + string vertexPos = m_availableVertData[ TemplateInfoOnSematics.POSITION ].VarName; + + string worldPosConversion = string.Empty; + + //Check if world pos already defined in the vertex body + if( !GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_POSITION, WirePortDataType.FLOAT3, precision, ref worldPosConversion, false, MasterNodePortCategory.Vertex ) ) + { + if( m_currentSRPType == TemplateSRPType.HDRP ) + { + worldPosConversion = string.Format( "GetAbsolutePositionWS( TransformObjectToWorld( ( {0} ).xyz ) )", vertexPos ); + } + else if( m_currentSRPType == TemplateSRPType.URP ) + { + worldPosConversion = string.Format( "TransformObjectToWorld( ( {0} ).xyz )", vertexPos ); + } + else + { + worldPosConversion = string.Format( "mul( unity_ObjectToWorld, float4( ( {0} ).xyz, 1 ) ).xyz", vertexPos ); + } + } + RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, precision, worldPosConversion, useMasterNodeCategory, customCategory ); + return varName; + } + + public string GetRelativeWorldPos( bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + PrecisionType precision = PrecisionType.Float; + + string result = string.Empty; + if ( GetCustomInterpolatedData( TemplateInfoOnSematics.RELATIVE_WORLD_POS, WirePortDataType.FLOAT3, precision, ref result, useMasterNodeCategory, customCategory ) ) + { + return result; + } + + if ( !m_currentDataCollector.HasLocalVariableByName( GeneratorUtils.RelativeWorldPositionStr ) ) + { + string positionOS = GetVertexPosition( WirePortDataType.FLOAT4, precision, false, MasterNodePortCategory.Vertex ); + string positionCS = GetClipPos( false, MasterNodePortCategory.Vertex ); + string invProjMatrix = GeneratorUtils.GenerateInverseProjection( ref m_currentDataCollector, -1, precision, false, MasterNodePortCategory.Vertex ); + + if ( !m_currentDataCollector.HasLocalVariableByName( GeneratorUtils.ViewHPositionStr ) ) + { + m_currentDataCollector.AddToVertexLocalVariables( -1, precision, WirePortDataType.FLOAT4, GeneratorUtils.ViewHPositionStr, + string.Format( "mul( {0}, {1} )", invProjMatrix, GeneratorUtils.ClipPositionStr ) ); + } + + m_currentDataCollector.AddToVertexLocalVariables( -1, precision, WirePortDataType.FLOAT3, GeneratorUtils.RelativeWorldPositionStr, + string.Format( "mul( ( float3x3 )UNITY_MATRIX_I_V, {0}.xyz / {0}.w )", GeneratorUtils.ViewHPositionStr ) ); + + RegisterCustomInterpolatedData( GeneratorUtils.RelativeWorldPositionStr, WirePortDataType.FLOAT3, precision, GeneratorUtils.RelativeWorldPositionStr, useMasterNodeCategory, customCategory ); + } + return GeneratorUtils.RelativeWorldPositionStr; + } + + public string GetViewPos( bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + PrecisionType precision = PrecisionType.Float; + + string result = string.Empty; + if ( GetCustomInterpolatedData( TemplateInfoOnSematics.VIEW_POSITION, WirePortDataType.FLOAT3, precision, ref result, useMasterNodeCategory, customCategory ) ) + { + return result; + } + + MasterNodePortCategory portCategory = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; + + if ( !m_currentDataCollector.HasLocalVariableByName( GeneratorUtils.ViewPositionStr ) ) + { + if ( portCategory == MasterNodePortCategory.Vertex || portCategory == MasterNodePortCategory.Tessellation ) + { + string positionOS = GetVertexPosition( WirePortDataType.FLOAT3, precision, useMasterNodeCategory, customCategory ); + result = string.Format( IsSRP ? "TransformWorldToView( TransformObjectToWorld( {0} ) )" : "UnityObjectToViewPos( {0} )", positionOS ); + } + else + { + string positionWS = GetWorldPos( useMasterNodeCategory, customCategory ); + result = string.Format( IsSRP ? "TransformWorldToView( {0} )" : "UnityWorldToViewPos( {0} )", positionWS ); + } + + m_currentDataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT3, GeneratorUtils.ViewPositionStr, result ); + } + return GeneratorUtils.ViewPositionStr; + } + + public string GetClipPosForValue( string customVertexPos, string outputId, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string varName = GeneratorUtils.ClipPositionStr + outputId; + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + + if( !m_availableVertData.ContainsKey( TemplateInfoOnSematics.POSITION ) ) + { + UIUtils.ShowMessage( "Attempting to access inexisting vertex position to calculate clip pos" ); + return "half4(0,0,0,0)"; + } + + string formatStr = string.Empty; + switch( m_currentSRPType ) + { + default: + case TemplateSRPType.BiRP: + formatStr = "UnityObjectToClipPos( {0} )"; + break; + case TemplateSRPType.HDRP: + formatStr = "TransformWorldToHClip( TransformObjectToWorld( ( {0} ).xyz ) )"; + break; + case TemplateSRPType.URP: + formatStr = "TransformObjectToHClip( ( {0} ).xyz )"; + break; + } + + string clipSpaceConversion = string.Format( formatStr, customVertexPos ); + RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT4, PrecisionType.Float, clipSpaceConversion, useMasterNodeCategory, customCategory ); + return varName; + } + + public string GetClipPos( bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string varName = GeneratorUtils.ClipPositionStr;// "clipPos"; + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + + if( !m_availableVertData.ContainsKey( TemplateInfoOnSematics.POSITION ) ) + { + UIUtils.ShowMessage( "Attempting to access inexisting vertex position to calculate clip pos" ); + return "half4(0,0,0,0)"; + } + + string vertexPos = m_availableVertData[ TemplateInfoOnSematics.POSITION ].VarName; + + string formatStr = string.Empty; + switch( m_currentSRPType ) + { + default: + case TemplateSRPType.BiRP: + formatStr = "UnityObjectToClipPos( {0} )"; + break; + case TemplateSRPType.HDRP: + formatStr = "TransformWorldToHClip( TransformObjectToWorld( ( {0} ).xyz ) )"; + break; + case TemplateSRPType.URP: + formatStr = "TransformObjectToHClip( ( {0} ).xyz )"; + break; + } + + string clipSpaceConversion = string.Format( formatStr, vertexPos ); + RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT4, PrecisionType.Float, clipSpaceConversion, useMasterNodeCategory, customCategory ); + return varName; + } + + public string GetScreenPosForValue( PrecisionType precision, string customVertexPos, string outputId, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + // overriding precision + precision = PrecisionType.Float; + + string varName = UIUtils.GetInputValueFromType( SurfaceInputs.SCREEN_POS ) + outputId; + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + + string clipSpacePos = GetClipPosForValue( customVertexPos, outputId, false, MasterNodePortCategory.Vertex ); + string screenPosConversion = string.Empty; + if( m_currentSRPType == TemplateSRPType.HDRP ) + { + screenPosConversion = string.Format( "ComputeScreenPos( {0}, _ProjectionParams.x )", clipSpacePos ); + } + else + { + screenPosConversion = string.Format( "ComputeScreenPos( {0} )", clipSpacePos ); + } + RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT4, precision, screenPosConversion, useMasterNodeCategory, customCategory ); + return varName; + } + + public string GetScreenPosRaw( PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + // overriding precision + precision = PrecisionType.Float; + + string result = string.Empty; + if ( GetCustomInterpolatedData( TemplateInfoOnSematics.SCREEN_POSITION, WirePortDataType.FLOAT4, precision, ref result, useMasterNodeCategory, customCategory ) ) + { + return result; + } + + string varName = UIUtils.GetInputValueFromType( SurfaceInputs.SCREEN_POS ); + if ( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + { + return varName; + } + + string clipSpacePos = GetClipPos( false, MasterNodePortCategory.Vertex ); + string screenPosConversion = string.Empty; + if ( m_currentSRPType == TemplateSRPType.HDRP ) + { + screenPosConversion = string.Format( "ComputeScreenPos( {0}, _ProjectionParams.x )", clipSpacePos ); + } + else + { + screenPosConversion = string.Format( "ComputeScreenPos( {0} )", clipSpacePos ); + } + RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT4, precision, screenPosConversion, useMasterNodeCategory, customCategory ); + return varName; + } + + public string GetScreenPosNormalized( PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string result = string.Empty; + if( GetCustomInterpolatedData( TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED, WirePortDataType.FLOAT4, precision, ref result, useMasterNodeCategory, customCategory ) ) + { + return result; + } + + if ( !m_currentDataCollector.HasLocalVariableByName( GeneratorUtils.ScreenPosNormStr ) ) + { + string screenPos = GetScreenPosRaw( precision, useMasterNodeCategory, customCategory ); + string clipPlaneTestOp = string.Format( "{0}.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? {0}.z : {0}.z * 0.5 + 0.5;", GeneratorUtils.ScreenPosNormStr ); + m_currentDataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT4, GeneratorUtils.ScreenPosNormStr, string.Format( GeneratorUtils.NormalizedScreenPosFormat, screenPos ) ); + m_currentDataCollector.AddLocalVariable( -1, clipPlaneTestOp ); + } + return GeneratorUtils.ScreenPosNormStr; + } + + public string GetScreenPosCenter( PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string screenPosNorm = GetScreenPosNormalized( precision, useMasterNodeCategory, customCategory ); + if ( !m_currentDataCollector.HasLocalVariableByName( GeneratorUtils.ScreenPosCenterStr ) ) + { + string value = string.Format( "float4( {0}.xy * 2 - 1, 0, 0 )", screenPosNorm ); + m_currentDataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT4, GeneratorUtils.ScreenPosCenterStr, value ); + } + return GeneratorUtils.ScreenPosCenterStr; + } + + public string GetScreenPosTiled( PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + if ( !m_currentDataCollector.HasLocalVariableByName( GeneratorUtils.ScreenPosTiledStr ) ) + { + string screenPosNorm = GetScreenPosNormalized( precision, useMasterNodeCategory, customCategory ); + string value = string.Format( "frac( float4( ( {0}.x * 2 - 1 ) * _ScreenParams.x / _ScreenParams.y, {0}.y * 2 - 1, 0, 0 ) )", screenPosNorm ); + m_currentDataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT4, GeneratorUtils.ScreenPosTiledStr, value ); + } + return GeneratorUtils.ScreenPosTiledStr; + } + + public string GetScreenPosPixel( PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + if ( !m_currentDataCollector.HasLocalVariableByName( GeneratorUtils.ScreenPosPixelStr ) ) + { + string screenPosNorm = GetScreenPosNormalized( precision, useMasterNodeCategory, customCategory ); + GeneratorUtils.GenerateScreenPosNormToPixelFunction( ref m_currentDataCollector ); + m_currentDataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT4, GeneratorUtils.ScreenPosPixelStr, GeneratorUtils.GenerateScreenPosNormToPixelFunctionCall( screenPosNorm ) ); + } + return GeneratorUtils.ScreenPosPixelStr; + } + + public string GetSurfaceDepth( DepthMode depthMode, PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string screenPos = GetScreenPosRaw( precision, useMasterNodeCategory, customCategory ); + string instruction = string.Format( "{0}.z / {0}.w", screenPos ); + string varName; + + switch ( depthMode ) + { + case DepthMode.DepthLinearEye: + { + instruction = GeneratorUtils.ApplyLinearDepthModifier( ref m_currentDataCollector, instruction, depthMode ); + varName = GeneratorUtils.DepthLinearEyeStr; + break; + } + case DepthMode.DepthLinear01: + { + instruction = GeneratorUtils.ApplyLinearDepthModifier( ref m_currentDataCollector, instruction, depthMode ); + varName = GeneratorUtils.DepthLinear01Str; + break; + } + case DepthMode.DepthEye: + { + instruction = string.Format( "( {0} ) * ( _ProjectionParams.z - _ProjectionParams.y )", instruction ); + varName = GeneratorUtils.DepthEyeStr; + break; + } + case DepthMode.Depth01: + default: + { + varName = GeneratorUtils.DepthRawStr; + break; + } + } + + m_currentDataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT, varName, instruction ); + return varName; + } + + public string GetViewVector( PrecisionType precisionType = PrecisionType.Float, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment, ViewSpace space = ViewSpace.World ) + { + string varName; + switch ( space ) + { + case ViewSpace.Tangent: varName = GeneratorUtils.TangentViewVectorStr; break; + case ViewSpace.Object: varName = GeneratorUtils.ObjectViewVectorStr; break; + case ViewSpace.View: varName = GeneratorUtils.ViewViewVectorStr; break; + case ViewSpace.World: + default: varName = GeneratorUtils.WorldViewVectorStr; break; + } + if ( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + { + return varName; + } + + string worldPos = GetWorldPos(); + string viewVectorWS = "( _WorldSpaceCameraPos.xyz - " + worldPos + " )"; + + string viewVector; + if ( space == ViewSpace.Tangent ) + { + string tanToWorld0, tanToWorld1, tanToWorld2; + GetWorldTangentTf( precisionType, out tanToWorld0, out tanToWorld1, out tanToWorld2 ); + + viewVector = string.Format( " {0} * {3}.x + {1} * {3}.y + {2} * {3}.z", tanToWorld0, tanToWorld1, tanToWorld2, viewVectorWS ); + } + else if ( space == ViewSpace.Object ) + { + string worldToObjectMatrix = ( m_currentSRPType == TemplateSRPType.BiRP ) ? "unity_WorldToObject" : "GetWorldToObjectMatrix()"; + viewVector = string.Format( "mul( ( float3x3 ){0}, {1} )", worldToObjectMatrix, viewVectorWS ); + + } + else if ( space == ViewSpace.View ) + { + viewVector = string.Format( "mul( ( float3x3 )UNITY_MATRIX_V, {0} )", viewVectorWS ); + } + else + { + viewVector = viewVectorWS; + } + + m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3, varName, viewVector ); + + return varName; + } + + public string GetViewDir( PrecisionType precisionType = PrecisionType.Float, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment, NormalizeType normalizeType = NormalizeType.Regular, ViewSpace space = ViewSpace.World ) + { + if ( space == ViewSpace.World ) + { + string result = string.Empty; + if ( GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_VIEW_DIR, WirePortDataType.FLOAT3, precisionType, ref result, useMasterNodeCategory, customCategory ) ) + { + return result; + } + } + + string varName; + switch ( space ) + { + case ViewSpace.Tangent: varName = ( normalizeType == NormalizeType.Regular ) ? GeneratorUtils.TangentViewDirectionStr : GeneratorUtils.TangentViewDirectionSafeStr; break; + case ViewSpace.Object: varName = ( normalizeType == NormalizeType.Regular ) ? GeneratorUtils.ObjectViewDirectionStr : GeneratorUtils.ObjectViewDirectionSafeStr; break; + case ViewSpace.View: varName = ( normalizeType == NormalizeType.Regular ) ? GeneratorUtils.ViewViewDirectionStr : GeneratorUtils.ViewViewDirectionSafeStr; break; + case ViewSpace.World: + default: varName = ( normalizeType == NormalizeType.Regular ) ? GeneratorUtils.WorldViewDirectionStr : GeneratorUtils.WorldViewDirectionSafeStr; break; + } + + if ( !m_currentDataCollector.HasLocalVariableByName( varName ) ) + { + string viewVector = GetViewVector( precisionType, useMasterNodeCategory, customCategory, space ); + + if ( normalizeType == NormalizeType.Regular ) + { + viewVector = "normalize( " + viewVector + " )"; + } + else if ( normalizeType == NormalizeType.Safe ) + { + viewVector = TemplateHelperFunctions.SafeNormalize( m_currentDataCollector, viewVector ); + } + + m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3, varName, viewVector ); + } + return varName; + } + + public void GetWorldTangentTf( PrecisionType precisionType, out string tanToWorld0, out string tanToWorld1, out string tanToWorld2, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + tanToWorld0 = "tanToWorld0"; + tanToWorld1 = "tanToWorld1"; + tanToWorld2 = "tanToWorld2"; + + if( HasCustomInterpolatedData( tanToWorld0, useMasterNodeCategory, customCategory ) || + HasCustomInterpolatedData( tanToWorld1, useMasterNodeCategory, customCategory ) || + HasCustomInterpolatedData( tanToWorld2, useMasterNodeCategory, customCategory ) ) + return; + + string worldTangent = GetWorldTangent( precisionType, useMasterNodeCategory, customCategory ); + string worldNormal = GetWorldNormal( precisionType, useMasterNodeCategory, customCategory ); + string worldBinormal = GetWorldBinormal( precisionType, useMasterNodeCategory, customCategory ); + + string tanToWorldVar0 = string.Format( "float3( {0}.x, {1}.x, {2}.x )", worldTangent, worldBinormal, worldNormal ); + string tanToWorldVar1 = string.Format( "float3( {0}.y, {1}.y, {2}.y )", worldTangent, worldBinormal, worldNormal ); + string tanToWorldVar2 = string.Format( "float3( {0}.z, {1}.z, {2}.z )", worldTangent, worldBinormal, worldNormal ); + + if( customCategory == MasterNodePortCategory.Vertex ) + { + RegisterCustomInterpolatedData( tanToWorld0, WirePortDataType.FLOAT3, precisionType, tanToWorldVar0, useMasterNodeCategory, customCategory ); + RegisterCustomInterpolatedData( tanToWorld1, WirePortDataType.FLOAT3, precisionType, tanToWorldVar1, useMasterNodeCategory, customCategory ); + RegisterCustomInterpolatedData( tanToWorld2, WirePortDataType.FLOAT3, precisionType, tanToWorldVar2, useMasterNodeCategory, customCategory ); + } + else + { + m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3, tanToWorld0, tanToWorldVar0 ); + m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3, tanToWorld1, tanToWorldVar1 ); + m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3, tanToWorld2, tanToWorldVar2 ); + } + } + + public string GetTangentToWorldMatrixFast( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string worldTangent = GetWorldTangent( precisionType ); + string worldNormal = GetWorldNormal( precisionType ); + string worldBinormal = GetWorldBinormal( precisionType ); + + string varName = GeneratorUtils.TangentToWorldFastStr; + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + + string result = string.Format( "float3x3( {0}.x, {1}.x, {2}.x, {0}.y, {1}.y, {2}.y, {0}.z, {1}.z, {2}.z )", worldTangent, worldBinormal, worldNormal ); + m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3x3, GeneratorUtils.TangentToWorldFastStr, result ); + return GeneratorUtils.TangentToWorldFastStr; + } + + public string GetTangentToWorldMatrixPrecise( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string worldToTangent = GetWorldToTangentMatrix( precisionType, useMasterNodeCategory, customCategory ); + GeneratorUtils.Add3x3InverseFunction( ref m_currentDataCollector, UIUtils.PrecisionWirePortToCgType( precisionType, WirePortDataType.FLOAT ) ); + m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3x3, GeneratorUtils.TangentToWorldPreciseStr, string.Format( GeneratorUtils.Inverse3x3Header, worldToTangent ) ); + return GeneratorUtils.TangentToWorldPreciseStr; + } + + public string GetWorldToTangentMatrix( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string worldTangent = GetWorldTangent( precisionType ); + string worldNormal = GetWorldNormal( precisionType ); + string worldBinormal = GetWorldBinormal( precisionType ); + + string varName = GeneratorUtils.WorldToTangentStr;// "worldToTanMat"; + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + string worldTanMat = string.Format( "float3x3( {0}, {1}, {2} )", worldTangent, worldBinormal, worldNormal ); + + m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3x3, varName, worldTanMat ); + return varName; + } + + public string GetObjectToViewPos( PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + // overriding precision + precision = PrecisionType.Float; + + string varName = "objectToViewPos"; + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + string vertexPos = GetVertexPosition( WirePortDataType.FLOAT3, precision, false, MasterNodePortCategory.Vertex ); + + string formatStr = string.Empty; + if( IsSRP ) + formatStr = "TransformWorldToView( TransformObjectToWorld( {0} ) )"; + else + formatStr = "UnityObjectToViewPos( {0} )"; + + string objectToViewPosValue = string.Format( formatStr, vertexPos ); + RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, precision, objectToViewPosValue, useMasterNodeCategory, customCategory ); + return varName; + } + + public string GetEyeDepth( PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment, bool linear01 = false ) + { + // overriding precision + precision = PrecisionType.Float; + + string varName = "eyeDepth"; + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + string objectToView = GetObjectToViewPos( precision, false, MasterNodePortCategory.Vertex ); + string eyeDepthValue = string.Format( "-{0}.z", objectToView ); + if( linear01 ) + { + eyeDepthValue += " * _ProjectionParams.w"; + } + + RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT, precision, eyeDepthValue, useMasterNodeCategory, customCategory ); + return varName; + } + + public string GetObjectSpaceLightDir( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + if( !IsSRP ) + { + m_currentDataCollector.AddToIncludes( -1, Constants.UnityLightingLib ); + m_currentDataCollector.AddToIncludes( -1, Constants.UnityAutoLightLib ); + } + + string varName = "objectSpaceLightDir"; + + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + + string vertexPos = GetVertexPosition( WirePortDataType.FLOAT4, precisionType, false, MasterNodePortCategory.Vertex ); + + string objectSpaceLightDir = string.Empty; + switch( m_currentSRPType ) + { + default: + case TemplateSRPType.BiRP: + objectSpaceLightDir = string.Format( "ObjSpaceLightDir( {0} )", vertexPos ); + break; + case TemplateSRPType.HDRP: + string worldSpaceLightDir = GetWorldSpaceLightDir( precisionType, useMasterNodeCategory, customCategory ); + objectSpaceLightDir = string.Format( "mul( GetWorldToObjectMatrix(), {0} ).xyz", worldSpaceLightDir ); + break; + case TemplateSRPType.URP: + objectSpaceLightDir = "mul( GetWorldToObjectMatrix(), _MainLightPosition ).xyz"; + break; + } + + RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, precisionType, objectSpaceLightDir, useMasterNodeCategory, customCategory ); + return varName; + } + + public string GetWorldSpaceLightDir( PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + if( !IsSRP ) + { + m_currentDataCollector.AddToIncludes( -1, Constants.UnityLightingLib ); + m_currentDataCollector.AddToIncludes( -1, Constants.UnityAutoLightLib ); + AddLateDirective( AdditionalLineType.Custom, "//This is a late directive" ); + } + else + { + + string lightVar; + if( m_currentSRPType == TemplateSRPType.HDRP ) + { + AddHDLightInfo(); + lightVar = "-" + string.Format( TemplateHelperFunctions.HDLightInfoFormat, "0", "forward" ); + } + else + { + lightVar = "_MainLightPosition.xyz"; + } + return m_currentDataCollector.SafeNormalizeLightDir ? string.Format( "SafeNormalize( {0} )", lightVar ) : lightVar; + } + + string varName = "worldSpaceLightDir"; + if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) + return varName; + + string worldPos = GetWorldPos( useMasterNodeCategory, customCategory ); + string worldSpaceLightDir = string.Format( "UnityWorldSpaceLightDir( {0} )", worldPos ); + if( m_currentDataCollector.SafeNormalizeLightDir ) + { + if( IsSRP ) + { + worldSpaceLightDir = string.Format( "SafeNormalize( {0} )", worldSpaceLightDir ); + } + else + { + m_currentDataCollector.AddToIncludes( -1, Constants.UnityBRDFLib ); + worldSpaceLightDir = string.Format( "Unity_SafeNormalize( {0} )", worldSpaceLightDir ); + } + } + + m_currentDataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT3, varName, worldSpaceLightDir ); + return varName; + } + + public void RegisterCustomInterpolatedData( string name, WirePortDataType dataType, PrecisionType precision, string vertexInstruction, bool useMasterNodeCategory = true, + MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment, bool noInterpolationFlag = false, bool sampleFlag = false ) + { + bool addLocalVariable = !name.Equals( vertexInstruction ); + + MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; + + if( !m_customInterpolatedData.ContainsKey( name ) ) + { + m_customInterpolatedData.Add( name, new TemplateCustomData( name, dataType ) ); + } + + if( !m_customInterpolatedData[ name ].IsVertex ) + { + m_customInterpolatedData[ name ].IsVertex = true; + if( addLocalVariable ) + m_currentDataCollector.AddToVertexLocalVariables( -1, precision, dataType, name, vertexInstruction ); + } + + if( category == MasterNodePortCategory.Fragment ) + { + if( !m_customInterpolatedData[ name ].IsFragment ) + { + m_customInterpolatedData[ name ].IsFragment = true; + TemplateVertexData interpData = RequestNewInterpolator( dataType, false,null, noInterpolationFlag,sampleFlag ); + if( interpData == null ) + { + Debug.LogErrorFormat( "Could not assign interpolator of type {0} to variable {1}", dataType, name ); + return; + } + + m_currentDataCollector.AddToVertexLocalVariables( -1, m_currentTemplateData.VertexFunctionData.OutVarName + "." + interpData.VarNameWithSwizzle, name ); + m_currentDataCollector.AddToLocalVariables( -1, precision, dataType, name, m_currentTemplateData.FragmentFunctionData.InVarName + "." + interpData.VarNameWithSwizzle ); + } + } + } + + public bool HasCustomInterpolatedData( string name, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + if( m_customInterpolatedData.ContainsKey( name ) ) + { + MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; + return ( category == MasterNodePortCategory.Fragment ) ? m_customInterpolatedData[ name ].IsFragment : m_customInterpolatedData[ name ].IsVertex; + } + return false; + } + + public bool HasFragmentInputParams + { + get + { + if( m_fragmentInputParams != null ) + return m_fragmentInputParams.Count > 0; + + return false; + } + } + + public string FragInputParamsStr + { + get + { + string value = string.Empty; + if( m_fragmentInputParams != null && m_fragmentInputParams.Count > 0 ) + { + int count = m_fragmentInputParams.Count; + if( count > 0 ) + { + value = ", "; + foreach( KeyValuePair kvp in m_fragmentInputParams ) + { + value += kvp.Value.Declaration; + + if( --count > 0 ) + { + value += " , "; + } + } + } + } + return value; + } + } + + public string VertexInputParamsStr + { + get + { + string value = string.Empty; + if( m_vertexInputParams != null && m_vertexInputParams.Count > 0 ) + { + int count = m_vertexInputParams.Count; + if( count > 0 ) + { + value = ", "; + foreach( KeyValuePair kvp in m_vertexInputParams ) + { + value += kvp.Value.Declaration; + + if( --count > 0 ) + { + value += " , "; + } + } + } + } + return value; + } + } + + public void Destroy() + { + m_currentTemplate = null; + + m_currentTemplateData = null; + + m_currentDataCollector = null; + + if( m_fullSrpBatcherPropertiesList != null ) + { + m_fullSrpBatcherPropertiesList.Clear(); + m_fullSrpBatcherPropertiesList = null; + } + + if( m_srpBatcherPropertiesList != null ) + { + m_srpBatcherPropertiesList.Clear(); + m_srpBatcherPropertiesList = null; + } + + if( m_srpBatcherPropertiesDict != null ) + { + m_srpBatcherPropertiesDict.Clear(); + m_srpBatcherPropertiesDict = null; + } + + if( m_lateDirectivesList != null ) + { + m_lateDirectivesList.Clear(); + m_lateDirectivesList = null; + } + + if( m_lateDirectivesDict != null ) + { + m_lateDirectivesDict.Clear(); + m_lateDirectivesDict = null; + } + + if( m_registeredVertexData != null ) + { + m_registeredVertexData.Clear(); + m_registeredVertexData = null; + } + + if( m_vertexInputParams != null ) + { + m_vertexInputParams.Clear(); + m_vertexInputParams = null; + } + + if( m_fragmentInputParams != null ) + { + m_fragmentInputParams.Clear(); + m_fragmentInputParams = null; + } + + if( m_vertexDataDict != null ) + { + m_vertexDataDict.Clear(); + m_vertexDataDict = null; + } + + if( m_interpolatorData != null ) + { + m_interpolatorData.Destroy(); + m_interpolatorData = null; + } + + if( m_availableFragData != null ) + { + m_availableFragData.Clear(); + m_availableFragData = null; + } + + if( m_availableVertData != null ) + { + m_availableVertData.Clear(); + m_availableVertData = null; + } + + if( m_customInterpolatedData != null ) + { + m_customInterpolatedData.Clear(); + m_customInterpolatedData = null; + } + + if( m_specialVertexLocalVars != null ) + { + m_specialVertexLocalVars.Clear(); + m_specialVertexLocalVars = null; + } + + if( m_specialFragmentLocalVars != null ) + { + m_specialFragmentLocalVars.Clear(); + m_specialFragmentLocalVars = null; + } + } + + public void BuildCBuffer( int nodeId ) + { + m_fullSrpBatcherPropertiesList.Clear(); + if( m_srpBatcherPropertiesList.Count > 0 ) + { + var regex = new Regex( @"(\d)\s+\b" ); + m_srpBatcherPropertiesList.Sort( ( a, b ) => + { + var matchA = regex.Match( a.PropertyName ); + int sizeA = 0; + if( matchA.Groups.Count > 1 && matchA.Groups[ 1 ].Value.Length > 0 ) + sizeA = Convert.ToInt32( matchA.Groups[ 1 ].Value, System.Globalization.CultureInfo.InvariantCulture ); + + var matchB = regex.Match( b.PropertyName ); + int sizeB = 0; + if( matchB.Groups.Count > 1 && matchB.Groups[ 1 ].Value.Length > 0 ) + sizeB = Convert.ToInt32( matchB.Groups[ 1 ].Value, System.Globalization.CultureInfo.InvariantCulture ); + + return sizeB.CompareTo( sizeA ); + } ); + + m_fullSrpBatcherPropertiesList.Insert(0, new PropertyDataCollector( nodeId, IOUtils.SRPCBufferPropertiesBegin )); + m_fullSrpBatcherPropertiesList.AddRange( m_srpBatcherPropertiesList ); + m_fullSrpBatcherPropertiesList.Add( new PropertyDataCollector( nodeId, IOUtils.SRPCBufferPropertiesEnd ) ); + } + } + + + public void DumpSRPBatcher() + { + for( int i = 0; i < m_srpBatcherPropertiesList.Count; i++ ) + { + Debug.Log( i + "::" + m_srpBatcherPropertiesList[ i ].PropertyName ); + } + } + + public const string GlobalMaxInterpolatorReachedMsg = "Maximum amount of interpolators reached!\nPlease consider optmizing your shader!"; + public const string MaxInterpolatorSMReachedMsg = "Maximum amount of interpolators reached for current shader model on pass {0}! Please consider increasing the shader model to {1}!"; + public void CheckInterpolatorOverflow( string currShaderModel, string passName ) + { + int maxInterpolatorAmount = TemplateHelperFunctions.AvailableInterpolators[ currShaderModel ]; + int currInterpolatorAmount = 1 + TemplateHelperFunctions.SemanticToInt[ InterpData.AvailableInterpolators[ InterpData.AvailableInterpolators.Count - 1 ].Semantic ]; + if( currInterpolatorAmount > maxInterpolatorAmount ) + { + string shaderModel = string.Empty; + if( TemplateHelperFunctions.GetShaderModelForInterpolatorAmount( currInterpolatorAmount, ref shaderModel ) ) + { + UIUtils.ShowMessage( string.Format( MaxInterpolatorSMReachedMsg, passName, shaderModel ), MessageSeverity.Error ); + } + else + { + UIUtils.ShowMessage( GlobalMaxInterpolatorReachedMsg, MessageSeverity.Error ); + } + } + } + + public Dictionary FragInputParameters { get { return m_fragmentInputParams; } } + + public bool HasVertexInputParams + { + get + { + if( m_vertexInputParams != null ) + return m_vertexInputParams.Count > 0; + + return false; + } + } + + public Dictionary VertexInputParameters { get { return m_vertexInputParams; } } + public TemplateData CurrentTemplateData { get { return m_currentTemplateData; } } + public int MultipassSubshaderIdx { get { return m_multipassSubshaderIdx; } } + public int MultipassPassIdx { get { return m_multipassPassIdx; } } + public TemplateSRPType CurrentSRPType { get { return m_currentSRPType; } set { m_currentSRPType = value; } } + public bool IsHDRP { get { return m_currentSRPType == TemplateSRPType.HDRP; } } + public bool IsLWRP { get { return m_currentSRPType == TemplateSRPType.URP; } } + public bool IsSRP { get { return ( m_currentSRPType == TemplateSRPType.URP || m_currentSRPType == TemplateSRPType.HDRP ); } } + public TemplateInterpData InterpData { get { return m_interpolatorData; } } + public List LateDirectivesList { get { return m_lateDirectivesList; } } + public List SrpBatcherPropertiesList { get { return m_srpBatcherPropertiesList; } } + public List FullSrpBatcherPropertiesList { get { return m_fullSrpBatcherPropertiesList; } } + public Dictionary VertexDataDict { get { return m_vertexDataDict; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs.meta new file mode 100644 index 00000000..0739a3ba --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c757602c408f7354b96c2a5eb21662a4 +timeCreated: 1495710491 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs new file mode 100644 index 00000000..47241447 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs @@ -0,0 +1,217 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public enum TemplateDataType + { + LegacySinglePass, + MultiPass + } + + [Serializable] + public class TemplateIncludePragmaContainter + { + [SerializeField] + private int m_nativeTopIndex = -1; + + [SerializeField] + private List m_nativeDirectivesList = new List(); + + [SerializeField] + private List m_includesList = new List(); + private Dictionary m_includesDict = new Dictionary(); + + [SerializeField] + private List m_pragmasList = new List(); + private Dictionary m_pragmasDict = new Dictionary(); + + [SerializeField] + private List m_definesList = new List(); + private Dictionary m_definesDict = new Dictionary(); + + public void RefreshIncludesList() + { + if ( m_includesDict.Count != m_includesList.Count ) + { + m_includesDict.Clear(); + int count = m_includesList.Count; + for ( int i = 0; i < count; i++ ) + { + m_includesDict.Add( m_includesList[ i ], m_includesList[ i ] ); + } + } + } + + public void RefreshPragmasList() + { + if ( m_pragmasDict.Count != m_pragmasList.Count ) + { + m_pragmasDict.Clear(); + int count = m_pragmasList.Count; + for ( int i = 0; i < count; i++ ) + { + m_pragmasDict.Add( m_pragmasList[ i ], m_pragmasList[ i ] ); + } + } + } + + + public void RefreshDefinesList() + { + if ( m_definesDict.Count != m_definesList.Count ) + { + m_definesDict.Clear(); + int count = m_definesList.Count; + for ( int i = 0; i < count; i++ ) + { + m_definesDict.Add( m_definesList[ i ], m_definesList[ i ] ); + } + } + } + + public bool HasInclude( string include ) + { + RefreshIncludesList(); + return m_includesDict.ContainsKey( include ); + } + + public bool HasPragma( string pragma ) + { + RefreshPragmasList(); + return m_pragmasDict.ContainsKey( pragma ); + } + + public bool HasDefine( string pragma ) + { + RefreshDefinesList(); + return m_definesDict.ContainsKey( pragma ); + } + + public void AddInclude( string include ) + { + RefreshIncludesList(); + if ( !m_includesDict.ContainsKey( include ) ) + { + m_includesList.Add( include ); + m_includesDict.Add( include, include ); + } + } + + public void AddPragma( string pragma ) + { + RefreshPragmasList(); + if ( !m_pragmasDict.ContainsKey( pragma ) ) + { + m_pragmasList.Add( pragma ); + m_pragmasDict.Add( pragma, pragma ); + } + } + + public void AddDefine( string define ) + { + RefreshDefinesList(); + if ( !m_definesDict.ContainsKey( define ) ) + { + m_definesList.Add( define ); + m_definesDict.Add( define, define ); + } + } + + public void AddNativeDirective( string native, int topIndex ) + { + m_nativeTopIndex = topIndex; + m_nativeDirectivesList.Add( native ); + } + + public void Destroy() + { + m_nativeDirectivesList.Clear(); + m_nativeDirectivesList = null; + + + m_includesList.Clear(); + m_includesDict.Clear(); + m_includesList = null; + m_includesDict = null; + + m_pragmasList.Clear(); + m_pragmasDict.Clear(); + m_pragmasList = null; + m_pragmasDict = null; + + m_definesList.Clear(); + m_definesDict.Clear(); + m_definesList = null; + m_definesDict = null; + } + + public List IncludesList { get { return m_includesList; } } + public List PragmasList { get { return m_pragmasList; } } + public List DefinesList { get { return m_definesList; } } + public List NativeDirectivesList { get { return m_nativeDirectivesList; } } + public int NativeTopIndex { get { return m_nativeTopIndex; } } + + } + + [Serializable] + public class TemplateInfoContainer + { + public string Id = string.Empty; + public string Data = string.Empty; + public int Index = -1; + public bool IsValid { get { return Index > -1; } } + public void Reset() + { + Id = string.Empty; + Data = string.Empty; + Index = -1; + } + } + + [Serializable] + public class TemplateDataParent : ScriptableObject + { + [SerializeField] + protected TemplateDataType m_templateType; + + [SerializeField] + protected string m_name; + + [SerializeField] + protected string m_guid; + + [SerializeField] + protected int m_orderId; + + [SerializeField] + protected string m_defaultShaderName = string.Empty; + + [SerializeField] + protected bool m_isValid = true; + + [SerializeField] + protected bool m_communityTemplate = false; + + public virtual void Destroy() { } + public virtual bool Reload() { return true; } + public string Name + { + get { return m_name; } + set + { + m_name = value.StartsWith( "Hidden/" ) ? value.Replace( "Hidden/", string.Empty ) : value; + } + } + public string GUID { get { return m_guid; } set { m_guid = value; } } + public int OrderId { get { return m_orderId; } set { m_orderId = value; } } + public string DefaultShaderName { get { return m_defaultShaderName; } set { m_defaultShaderName = value; } } + public bool IsValid { get { return m_isValid; } } + public TemplateDataType TemplateType { get { return m_templateType; } } + public virtual void Init( string name, string guid, string path, bool isCommunity ) { m_communityTemplate = isCommunity; } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs.meta new file mode 100644 index 00000000..c579562f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4e8f3788c7c239042b3cc3d086311227 +timeCreated: 1518720013 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs new file mode 100644 index 00000000..a3f6c7f4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs @@ -0,0 +1,397 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + public sealed class TemplateDepthModule : TemplateModuleParent + { + private const string ZWriteFormatter = "ZWrite {0}\n"; + private const string ZTestFormatter = "ZTest {0}\n"; + + [SerializeField] + private bool m_validZTest = false; + + [SerializeField] + private InlineProperty m_zTestMode = new InlineProperty( 0 ); + + [SerializeField] + private bool m_validZWrite = false; + + [SerializeField] + private InlineProperty m_zWriteMode = new InlineProperty( 0 ); + + [SerializeField] + private InlineProperty m_offsetFactor = new InlineProperty( 0 ); + + [SerializeField] + private InlineProperty m_offsetUnits = new InlineProperty( 0 ); + + [SerializeField] + private bool m_offsetEnabled = false; + + [SerializeField] + private bool m_validOffset = false; + + public TemplateDepthModule() : base( "Depth" ) { } + + public void CopyFrom( TemplateDepthModule other, bool allData ) + { + if( allData ) + { + m_independentModule = other.IndependentModule; + m_validZTest = other.ValidZTest; + m_validZWrite = other.ValidZWrite; + m_validOffset = other.ValidOffset; + } + + m_zTestMode.CopyFrom( other.ZTestMode ); + m_zWriteMode.CopyFrom( other.ZWriteMode ); + m_offsetFactor.CopyFrom( other.OffsetFactor ); + m_offsetUnits.CopyFrom( other.OffsetUnits ); + m_offsetEnabled = other.OffsetEnabled; + } + + public void ConfigureFromTemplateData( TemplateDepthData depthData ) + { + m_independentModule = depthData.IndependentModule; + if( depthData.ValidZTest && m_validZTest != depthData.ValidZTest ) + { + if( string.IsNullOrEmpty( depthData.ZTestInlineValue ) ) + { + m_zTestMode.IntValue = ZBufferOpHelper.ZTestModeDict[ depthData.ZTestModeValue ]; + m_zTestMode.ResetProperty(); + } + else + { + m_zTestMode.SetInlineByName( depthData.ZTestInlineValue ); + } + } + + + + if( depthData.ValidZWrite && m_validZWrite != depthData.ValidZWrite ) + { + if( string.IsNullOrEmpty( depthData.ZWriteInlineValue ) ) + { + m_zWriteMode.IntValue = ZBufferOpHelper.ZWriteModeDict[ depthData.ZWriteModeValue ]; + m_zWriteMode.ResetProperty(); + } + else + { + m_zWriteMode.SetInlineByName( depthData.ZWriteInlineValue ); + } + } + + if( depthData.ValidOffset && m_validOffset != depthData.ValidOffset ) + { + if( string.IsNullOrEmpty( depthData.OffsetFactorInlineValue ) ) + { + m_offsetFactor.FloatValue = depthData.OffsetFactor; + m_offsetFactor.ResetProperty(); + } + else + { + m_offsetFactor.SetInlineByName( depthData.OffsetFactorInlineValue ); + } + + if( string.IsNullOrEmpty( depthData.OffsetUnitsInlineValue ) ) + { + m_offsetUnits.FloatValue = depthData.OffsetUnits; + m_offsetUnits.ResetProperty(); + } + else + { + m_offsetUnits.SetInlineByName( depthData.OffsetUnitsInlineValue ); + } + m_offsetEnabled = depthData.ValidOffset; + } + + m_validZTest = depthData.ValidZTest; + m_validZWrite = depthData.ValidZWrite; + m_validOffset = depthData.ValidOffset; + m_validData = m_validZTest || m_validZWrite || m_validOffset; + } + + public override void ShowUnreadableDataMessage( ParentNode owner ) + { + bool foldoutValue = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth; + NodeUtils.DrawPropertyGroup( ref foldoutValue, ZBufferOpHelper.DepthParametersStr, base.ShowUnreadableDataMessage ); + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth = foldoutValue; + } + + public override void Draw( UndoParentNode owner, bool style = true ) + { + bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth; + if( style ) + { + NodeUtils.DrawPropertyGroup( ref foldout, ZBufferOpHelper.DepthParametersStr, () => + { + EditorGUI.indentLevel++; + DrawBlock( owner ); + EditorGUI.indentLevel--; + } ); + } + else + { + NodeUtils.DrawNestedPropertyGroup( ref foldout, ZBufferOpHelper.DepthParametersStr, () => + { + DrawBlock( owner ); + } ); + } + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth = foldout; + } + + void DrawBlock( UndoParentNode owner ) + { + EditorGUI.BeginChangeCheck(); + var cache = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = EditorGUIUtility.labelWidth - 20; + + Color cachedColor = GUI.color; + GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); + //EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); + GUI.color = cachedColor; + + EditorGUILayout.Separator(); + + if( m_validZWrite ) + m_zWriteMode.EnumTypePopup( ref owner, ZBufferOpHelper.ZWriteModeStr, ZBufferOpHelper.ZWriteModeValues ); + + if( m_validZTest ) + m_zTestMode.EnumTypePopup( ref owner, ZBufferOpHelper.ZTestModeStr, ZBufferOpHelper.ZTestModeLabels ); + + + if( m_validOffset ) + { + m_offsetEnabled = owner.EditorGUILayoutToggle( ZBufferOpHelper.OffsetStr, m_offsetEnabled ); + if( m_offsetEnabled ) + { + EditorGUI.indentLevel++; + m_offsetFactor.FloatField( ref owner, ZBufferOpHelper.OffsetFactorStr ); + m_offsetUnits.FloatField( ref owner, ZBufferOpHelper.OffsetUnitsStr ); + EditorGUI.indentLevel--; + } + } + EditorGUILayout.Separator(); + EditorGUIUtility.labelWidth = cache; + //EditorGUILayout.EndVertical(); + if( EditorGUI.EndChangeCheck() ) + { + m_isDirty = true; + CustomEdited = true; + } + } + + public void ReadZWriteFromString( ref uint index, ref string[] nodeParams ) + { + bool validDataOnMeta = m_validZWrite; + if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) + { + validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( validDataOnMeta ) + { + if( UIUtils.CurrentShaderVersion() < 15304 ) + { + m_zWriteMode.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + } + else + { + m_zWriteMode.ReadFromString( ref index, ref nodeParams ); + } + } + } + + public void ReadZTestFromString( ref uint index, ref string[] nodeParams ) + { + bool validDataOnMeta = m_validZTest; + if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) + { + validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( validDataOnMeta ) + { + if( UIUtils.CurrentShaderVersion() < 15304 ) + { + m_zTestMode.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + } + else + { + m_zTestMode.ReadFromString( ref index, ref nodeParams ); + } + } + } + + public void ReadOffsetFromString( ref uint index, ref string[] nodeParams ) + { + bool validDataOnMeta = m_validOffset; + if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) + { + validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( validDataOnMeta ) + { + m_offsetEnabled = Convert.ToBoolean( nodeParams[ index++ ] ); + if( UIUtils.CurrentShaderVersion() < 15304 ) + { + m_offsetFactor.FloatValue = Convert.ToSingle( nodeParams[ index++ ] ); + m_offsetUnits.FloatValue = Convert.ToSingle( nodeParams[ index++ ] ); + } + else + { + m_offsetFactor.ReadFromString( ref index, ref nodeParams, false ); + m_offsetUnits.ReadFromString( ref index, ref nodeParams, false ); + } + } + } + + public override void ReadFromString( ref uint index, ref string[] nodeParams ) + { + base.ReadFromString( ref index, ref nodeParams ); + ReadZWriteFromString( ref index, ref nodeParams ); + ReadZTestFromString( ref index, ref nodeParams ); + ReadOffsetFromString( ref index, ref nodeParams ); + } + + public void WriteZWriteToString( ref string nodeInfo ) + { + base.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_validZWrite ); + if( m_validZWrite ) + m_zWriteMode.WriteToString( ref nodeInfo ); + } + + public void WriteZTestToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_validZTest ); + if( m_validZTest ) + m_zTestMode.WriteToString( ref nodeInfo ); + } + + public void WriteOffsetToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_validOffset ); + if( m_validOffset ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_offsetEnabled ); + m_offsetFactor.WriteToString( ref nodeInfo ); + m_offsetUnits.WriteToString( ref nodeInfo ); + } + } + + public override void WriteToString( ref string nodeInfo ) + { + WriteZWriteToString( ref nodeInfo ); + WriteZTestToString( ref nodeInfo ); + WriteOffsetToString( ref nodeInfo ); + } + + public bool IsActive { get { return ( m_zTestMode.IsValid || m_zTestMode.IntValue != 0 ) || ( m_zWriteMode.IsValid || m_zWriteMode.IntValue != 0 ) || m_offsetEnabled; } } + public string CurrentZWriteMode + { + get + { + if( m_zWriteMode.IsValid ) + { + return string.Format( ZWriteFormatter, m_zWriteMode.GetValueOrProperty() ); ; + } + + int finalZWrite = ( m_zWriteMode.IntValue == 0 ) ? 1 : m_zWriteMode.IntValue; + return string.Format( ZWriteFormatter, ZBufferOpHelper.ZWriteModeValues[ finalZWrite ] ); ; + } + } + public string CurrentZTestMode + { + get + { + if( m_zTestMode.IsValid ) + return string.Format( ZTestFormatter, m_zTestMode.GetValueOrProperty() ); + + int finalZTestMode = ( m_zTestMode.IntValue == 0 ) ? 3 : m_zTestMode.IntValue; + return string.Format( ZTestFormatter, ZBufferOpHelper.ZTestModeValues[ finalZTestMode ] ); + } + } + + public string CurrentOffset + { + get + { + if( m_offsetEnabled ) + return "Offset " + m_offsetFactor.GetValueOrProperty() + " , " + m_offsetUnits.GetValueOrProperty() + "\n"; + else + return "Offset 0,0\n"; + } + } + + public bool ValidZTest { get { return m_validZTest; } } + public bool ValidZWrite { get { return m_validZWrite; } } + public bool ValidOffset { get { return m_validOffset; } } + public InlineProperty ZTestMode { get { return m_zTestMode; } } + public InlineProperty ZWriteMode { get { return m_zWriteMode; } } + public InlineProperty OffsetFactor { get { return m_offsetFactor; } } + public InlineProperty OffsetUnits { get { return m_offsetUnits; } } + public bool OffsetEnabled { get { return m_offsetEnabled; } } + + + public ZTestMode ZTestModeValue + { + set + { + m_zTestMode.IntValue = ZBufferOpHelper.ZTestModeDict[ value ]; + m_zTestMode.Active = false; + } + get + { + return (ZTestMode)( m_zTestMode.IntValue - 1 ); + } + } + public ZWriteMode ZWriteModeValue + { + set + { + m_zWriteMode.IntValue = ZBufferOpHelper.ZWriteModeDict[ value ]; + m_zWriteMode.Active = false; + } + get + { + return (ZWriteMode)( m_zWriteMode.IntValue - 1 ); + } + } + public float OffsetFactorValue + { + set + { + m_offsetEnabled = true; + m_offsetFactor.FloatValue = value; + m_offsetFactor.Active = false; + } + get + { + return m_offsetFactor.FloatValue; + } + } + + public float OffsetUnitsValue + { + set + { + m_offsetEnabled = true; + m_offsetUnits.FloatValue = value; + m_offsetUnits.Active = false; + } + get + { + return m_offsetUnits.FloatValue; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs.meta new file mode 100644 index 00000000..bf441b06 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 91bbf209a618780459e775d6816a4b06 +timeCreated: 1513873547 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs new file mode 100644 index 00000000..c8e52238 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs @@ -0,0 +1,285 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Template Fragment Data" , "Surface Data" , "Select and use available interpolated fragment data from the template" )] + public class TemplateFragmentDataNode : TemplateNodeParent + { + private List m_interpolatorData = null; + + [SerializeField] + private int m_currentDataIdx = -1; + + [SerializeField] + private string m_dataName = string.Empty; + [SerializeField] + private string m_inVarName = string.Empty; + + private string[] m_dataLabels = null; + + private bool m_fetchDataId = false; + private UpperLeftWidgetHelper m_upperLeftWidgetHelper = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_autoWrapProperties = true; + } + + void FetchDataId() + { + if( m_interpolatorData != null ) + { + m_currentDataIdx = 0; + int count = m_interpolatorData.Count; + m_dataLabels = new string[ count ]; + for( int i = 0 ; i < count ; i++ ) + { + m_dataLabels[ i ] = m_interpolatorData[ i ].VarName; + if( m_interpolatorData[ i ].VarName.Equals( m_dataName ) ) + { + m_currentDataIdx = i; + } + } + UpdateFromId(); + } + else + { + m_currentDataIdx = -1; + } + } + + void UpdateFromId() + { + if( m_interpolatorData != null ) + { + if( m_interpolatorData.Count == 0 ) + { + for( int i = 0 ; i < 4 ; i++ ) + m_containerGraph.DeleteConnection( false , UniqueId , i , false , true ); + + m_headerColor = UIUtils.GetColorFromCategory( "Default" ); + SetAdditonalTitleText( "" ); + m_additionalContent.text = string.Empty; + m_outputPorts[ 0 ].ChangeProperties( "None" , WirePortDataType.OBJECT , false ); + ConfigurePorts(); + return; + } + + bool areCompatible = TemplateHelperFunctions.CheckIfCompatibles( m_outputPorts[ 0 ].DataType , m_interpolatorData[ m_currentDataIdx ].DataType ); + switch( m_interpolatorData[ m_currentDataIdx ].DataType ) + { + default: + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue , m_interpolatorData[ m_currentDataIdx ].DataType , false ); + break; + case WirePortDataType.FLOAT2: + m_outputPorts[ 0 ].ChangeProperties( "XY" , m_interpolatorData[ m_currentDataIdx ].DataType , false ); + break; + case WirePortDataType.FLOAT3: + m_outputPorts[ 0 ].ChangeProperties( "XYZ" , m_interpolatorData[ m_currentDataIdx ].DataType , false ); + break; + case WirePortDataType.FLOAT4: + m_outputPorts[ 0 ].ChangeProperties( "XYZW" , m_interpolatorData[ m_currentDataIdx ].DataType , false ); + break; + case WirePortDataType.COLOR: + m_outputPorts[ 0 ].ChangeProperties( "RGBA" , m_interpolatorData[ m_currentDataIdx ].DataType , false ); + break; + } + + ConfigurePorts(); + + if( !areCompatible ) + { + m_containerGraph.DeleteConnection( false , UniqueId , 0 , false , true ); + } + + m_dataName = m_interpolatorData[ m_currentDataIdx ].VarName; + SetAdditonalTitleText( m_dataName ); + m_sizeIsDirty = true; + CheckWarningState(); + } + } + + + public override void DrawProperties() + { + base.DrawProperties(); + if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) + { + return; + } + + if( m_multiPassMode ) + { + DrawMultipassProperties(); + } + + if( m_currentDataIdx > -1 ) + { + EditorGUI.BeginChangeCheck(); + m_currentDataIdx = EditorGUILayoutPopup( DataLabelStr , m_currentDataIdx , m_dataLabels ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromId(); + } + } + } + + protected override void OnSubShaderChange() + { + base.OnSubShaderChange(); + FetchInterpolator(); + FetchDataId(); + } + + protected override void OnPassChange() + { + FetchInterpolator(); + FetchDataId(); + } + + void DrawMultipassProperties() + { + DrawSubShaderUI(); + DrawPassUI(); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) + return; + + if( m_interpolatorData == null || m_interpolatorData.Count == 0 ) + { + MasterNode masterNode = m_containerGraph.CurrentMasterNode; + FetchInterpolator( masterNode ); + } + + if( m_fetchDataId ) + { + m_fetchDataId = false; + FetchDataId(); + } + + if( m_currentDataIdx > -1 ) + { + EditorGUI.BeginChangeCheck(); + m_currentDataIdx = m_upperLeftWidgetHelper.DrawWidget( this , m_currentDataIdx , m_dataLabels ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromId(); + } + } + } + + public override string GenerateShaderForOutput( int outputId , ref MasterNodeDataCollector dataCollector , bool ignoreLocalvar ) + { + if( dataCollector.MasterNodeCategory != AvailableShaderTypes.Template ) + { + UIUtils.ShowMessage( UniqueId , "Template Fragmment Data node is only intended for templates use only" , MessageSeverity.Error ); + return m_outputPorts[ 0 ].ErrorValue; + } + + if( !dataCollector.IsFragmentCategory ) + { + UIUtils.ShowMessage( UniqueId , "Template Fragment Data node node is only intended for fragment use use only" , MessageSeverity.Error ); + return m_outputPorts[ 0 ].ErrorValue; + } + + if( m_multiPassMode ) + { + if( dataCollector.TemplateDataCollectorInstance.MultipassSubshaderIdx != SubShaderIdx || + dataCollector.TemplateDataCollectorInstance.MultipassPassIdx != PassIdx + ) + { + UIUtils.ShowMessage( UniqueId , string.Format( "{0} is only intended for subshader {1} and pass {2}" , m_dataLabels[ m_currentDataIdx ] , SubShaderIdx , PassIdx ) ); + return m_outputPorts[ outputId ].ErrorValue; + } + } + + return GetOutputVectorItem( 0 , outputId , m_inVarName + m_dataName ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_dataName = GetCurrentParam( ref nodeParams ); + m_fetchDataId = true; + } + + public override void WriteToString( ref string nodeInfo , ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo , ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_dataName ); + } + + public override void OnMasterNodeReplaced( MasterNode newMasterNode ) + { + base.OnMasterNodeReplaced( newMasterNode ); + if( newMasterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template ) + { + FetchInterpolator( newMasterNode ); + } + else + { + m_interpolatorData = null; + m_currentDataIdx = -1; + } + } + + protected override bool ValidatePass( int passIdx ) + { + return ( m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ passIdx ].FragmentFunctionData != null && + m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ passIdx ].InterpolatorDataContainer != null ); + } + + void FetchInterpolator( MasterNode masterNode = null ) + { + FetchMultiPassTemplate( masterNode ); + if( m_multiPassMode ) + { + if( m_templateMPData != null ) + { + m_inVarName = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].FragmentFunctionData.InVarName + "."; + m_interpolatorData = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].InterpolatorDataContainer.RawInterpolators; + m_fetchDataId = true; + } + } + else + { + if( masterNode == null ) + masterNode = m_containerGraph.CurrentMasterNode; + + TemplateData currentTemplate = ( masterNode as TemplateMasterNode ).CurrentTemplate; + if( currentTemplate != null ) + { + m_inVarName = currentTemplate.FragmentFunctionData.InVarName + "."; + m_interpolatorData = currentTemplate.InterpolatorData.RawInterpolators; + FetchDataId(); + } + else + { + m_interpolatorData = null; + m_currentDataIdx = -1; + } + } + } + + public override void Destroy() + { + base.Destroy(); + m_dataLabels = null; + m_interpolatorData = null; + m_upperLeftWidgetHelper = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs.meta new file mode 100644 index 00000000..83c6b178 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2b53cc116abb0df45b028f41b8f0305e +timeCreated: 1506595629 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs new file mode 100644 index 00000000..4ee7ad0f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs @@ -0,0 +1,2718 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.IO; +using System.Text.RegularExpressions; +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + public enum CustomTemplatePropertyUIEnum + { + None, + HDPBR + } + + public enum TemplateSemantics + { + NONE, + POSITION, + SV_POSITION, + COLOR, + COLOR0, + COLOR1, + TEXCOORD0, + TEXCOORD1, + TEXCOORD2, + TEXCOORD3, + TEXCOORD4, + TEXCOORD5, + TEXCOORD6, + TEXCOORD7, + TEXCOORD8, + TEXCOORD9, + TEXCOORD10, + TEXCOORD11, + TEXCOORD12, + TEXCOORD13, + TEXCOORD14, + TEXCOORD15, + NORMAL, + TANGENT, + SV_IsFrontFacing, + SV_VertexID, + SV_PrimitiveID, + SV_InstanceID, + INTERNALTESSPOS, + INSTANCEID_SEMANTIC, + VERTEXID_SEMANTIC, + PRIMITIVEID_SEMANTIC, + BLENDWEIGHTS, + BLENDINDICES + } + + public enum TemplateInfoOnSematics + { + NONE, + POSITION, + CLIP_POS, + SCREEN_POSITION, + SCREEN_POSITION_NORMALIZED, + COLOR, + TEXTURE_COORDINATES0, + TEXTURE_COORDINATES1, + TEXTURE_COORDINATES2, + TEXTURE_COORDINATES3, + TEXTURE_COORDINATES4, + TEXTURE_COORDINATES5, + TEXTURE_COORDINATES6, + TEXTURE_COORDINATES7, + NORMAL, + TANGENT, + WORLD_NORMAL, + WORLD_TANGENT, + WORLD_BITANGENT, + WORLD_VIEW_DIR, + WORLD_POSITION, + RELATIVE_WORLD_POS, + INSTANCE_ID, + OTHER, + VFACE, + SHADOWCOORDS, + INSTANCEID, + VERTEXID, + PRIMITIVEID, + BLENDWEIGHTS, + BLENDINDICES, + OBJECT_POSITION, + VIEW_POSITION + } + + public enum TemplateShaderPropertiesIdx + { + Identation = 1, + Name = 3, + InspectorName, + Type + } + + public enum TemplateShaderGlobalsIdx + { + Type = 1, + Name = 2 + } + public enum TemplateDataCheck + { + Valid, + Invalid + } + + public enum InvisibleOptionsEnum + { + SyncProperties = 1 << 0 + } + + public enum TemplateSpecialTags + { + RenderType, + Queue, + DisableBatching, + None + } + + public class TemplateReplaceHelper + { + public TemplateMultiPassMasterNode MasterNode = null; + public bool Used = false; + public TemplateReplaceHelper( TemplateMultiPassMasterNode masterNode ) { MasterNode = masterNode; } + } + + [Serializable] + public class TemplatesTagData + { + public string Name; + public string Value; + public TemplatesTagData( string name, string value ) + { + Name = name; + Value = value; + } + } + + [Serializable] + public class TemplateModuleData + { + public bool IndependentModule = true; + public TemplateDataCheck DataCheck = TemplateDataCheck.Invalid; + public string InlineData = string.Empty; + public int StartIdx; + public bool IsValid { get { return DataCheck == TemplateDataCheck.Valid; } } + public virtual void SetAllModulesDefault() { IndependentModule = false; DataCheck = TemplateDataCheck.Valid; } + } + + [Serializable] + public sealed class TemplateTagsModuleData : TemplateModuleData + { + public string TagsId; + public List Tags = new List(); + public void Destroy() + { + Tags.Clear(); + Tags = null; + } + + public void Reset() + { + Tags.Clear(); + } + + public void Dump() + { + string dump = string.Empty; + for( int i = 0; i < Tags.Count; i++ ) + { + dump += string.Format( "[{0}] Name: {1} Value: {2}\n", i, Tags[ i ].Name, Tags[ i ].Value ); + } + Debug.Log( dump ); + } + } + + [Serializable] + public class TemplateShaderModelData : TemplateModuleData + { + public string Id = string.Empty; + public string Value = "2.5"; + public int InterpolatorAmount = 8; + public bool Encapsulate = false; + public override void SetAllModulesDefault() + { + base.SetAllModulesDefault(); + Id = string.Empty; + Value = "3.0"; + InterpolatorAmount = 10; + Encapsulate = true; + } + } + + [Serializable] + public sealed class TemplateDepthData : TemplateModuleData + { + public bool ValidZWrite; + public string ZWriteModeId; + public ZWriteMode ZWriteModeValue; + public int ZWriteStartIndex; + public string ZWriteInlineValue; + + + public bool ValidZTest; + public string ZTestModeId; + public ZTestMode ZTestModeValue; + public int ZTestStartIndex; + public string ZTestInlineValue; + + public bool ValidOffset; + public string OffsetId; + public float OffsetFactor; + public float OffsetUnits; + public int OffsetStartIndex; + public string OffsetFactorInlineValue; + public string OffsetUnitsInlineValue; + + public override void SetAllModulesDefault() + { + base.SetAllModulesDefault(); + ValidZWrite = true; + ZWriteModeId = string.Empty; + ZWriteModeValue = ZWriteMode.On; + ZWriteStartIndex = -1; + ZWriteInlineValue = string.Empty; + + + ValidZTest = true; + ZTestModeId = string.Empty; + ZTestModeValue = ZTestMode.LEqual; + ZTestStartIndex = -1; + ZTestInlineValue = string.Empty; + + ValidOffset = true; + OffsetId = string.Empty; + OffsetFactor = 0; + OffsetUnits = 0; + OffsetStartIndex = -1; + OffsetFactorInlineValue = string.Empty; + OffsetUnitsInlineValue = string.Empty; + } + + public void SetDataCheck() + { + DataCheck = ( ValidZWrite || ValidZTest || ValidOffset )?TemplateDataCheck.Valid:TemplateDataCheck.Invalid; + } + } + + [Serializable] + public sealed class TemplateStencilData : TemplateModuleData + { + public string StencilBufferId; + public bool Active = true; + + public int Reference; + public string ReferenceInline; + + public int ReadMask = 255; + public string ReadMaskInline; + + public int WriteMask = 255; + public string WriteMaskInline; + + public string ComparisonFront; + public string ComparisonFrontInline; + + public string PassFront; + public string PassFrontInline; + + public string FailFront; + public string FailFrontInline; + + public string ZFailFront; + public string ZFailFrontInline; + + public string ComparisonBack; + public string ComparisonBackInline; + + public string PassBack; + public string PassBackInline; + + public string FailBack; + public string FailBackInline; + + public string ZFailBack; + public string ZFailBackInline; + + public void SetDefaultValues() + { + Active = false; + + StencilBufferId = string.Empty; + + Reference = 0; + ReferenceInline = string.Empty; + + ReadMask = 255; + ReadMaskInline = string.Empty; + + WriteMask = 255; + WriteMaskInline = string.Empty; + + ComparisonFront = string.Empty; + ComparisonFrontInline = string.Empty; + + PassFront = string.Empty; + PassFrontInline = string.Empty; + + FailFront = string.Empty; + FailFrontInline = string.Empty; + + ZFailFront = string.Empty; + ZFailFrontInline = string.Empty; + + + ComparisonBack = string.Empty; + ComparisonBackInline = string.Empty; + + PassBack = string.Empty; + PassBackInline = string.Empty; + + FailBack = string.Empty; + FailBackInline = string.Empty; + + ZFailBack = string.Empty; + ZFailBackInline = string.Empty; + } + + public void SetIndependentDefault() + { + IndependentModule = true; + DataCheck = TemplateDataCheck.Valid; + SetDefaultValues(); + } + + public override void SetAllModulesDefault() + { + base.SetAllModulesDefault(); + SetDefaultValues(); + } + } + + [Serializable] + public sealed class TemplateBlendData : TemplateModuleData + { + public bool ValidBlendMode = false; + public bool BlendModeOff = true; + + public string Target = string.Empty; + + public string BlendModeId; + public bool SeparateBlendFactors = false; + public AvailableBlendFactor SourceFactorRGB = AvailableBlendFactor.One; + public string SourceFactorRGBInline; + public AvailableBlendFactor DestFactorRGB = AvailableBlendFactor.Zero; + public string DestFactorRGBInline; + public int BlendModeStartIndex; + + public AvailableBlendFactor SourceFactorAlpha = AvailableBlendFactor.One; + public string SourceFactorAlphaInline; + public AvailableBlendFactor DestFactorAlpha = AvailableBlendFactor.Zero; + public string DestFactorAlphaInline; + + public bool ValidBlendOp = false; + public string BlendOpId; + public bool SeparateBlendOps = false; + public AvailableBlendOps BlendOpRGB = AvailableBlendOps.OFF; + public string BlendOpRGBInline; + public AvailableBlendOps BlendOpAlpha = AvailableBlendOps.OFF; + public string BlendOpAlphaInline; + public int BlendOpStartIndex; + + + public override void SetAllModulesDefault() + { + base.SetAllModulesDefault(); + + + if( !ValidBlendMode ) + { + ValidBlendMode = true; + BlendModeOff = true; + BlendModeId = string.Empty; + SeparateBlendFactors = false; + SourceFactorRGB = AvailableBlendFactor.One; + SourceFactorRGBInline = string.Empty; + DestFactorRGB = AvailableBlendFactor.Zero; + DestFactorRGBInline = string.Empty; + BlendModeStartIndex = -1; + SourceFactorAlpha = AvailableBlendFactor.One; + SourceFactorAlphaInline = string.Empty; + DestFactorAlpha = AvailableBlendFactor.Zero; + DestFactorAlphaInline = string.Empty; + } + + if( !ValidBlendOp ) + { + ValidBlendOp = true; + BlendOpId = string.Empty; + SeparateBlendOps = false; + BlendOpRGB = AvailableBlendOps.OFF; + BlendOpRGBInline = string.Empty; + BlendOpAlpha = AvailableBlendOps.OFF; + BlendOpAlphaInline = string.Empty; + BlendOpStartIndex = -1; + } + + DataCheck = TemplateDataCheck.Valid; + } + + } + + [Serializable] + public sealed class TemplateAlphaToMaskData : TemplateModuleData + { + public string AlphaToMaskId; + public bool AlphaToMaskData = false; + public override void SetAllModulesDefault() + { + base.SetAllModulesDefault(); + AlphaToMaskId = string.Empty; + AlphaToMaskData = false; + } + } + + [Serializable] + public sealed class TemplateCullModeData : TemplateModuleData + { + public string CullModeId; + public CullMode CullModeData = CullMode.Back; + public override void SetAllModulesDefault() + { + base.SetAllModulesDefault(); + CullModeId = string.Empty; + CullModeData = CullMode.Back; + } + } + + [Serializable] + public sealed class TemplateColorMaskData : TemplateModuleData + { + public string ColorMaskId; + public bool[] ColorMaskData = { true, true, true, true }; + public string Target = string.Empty; + public override void SetAllModulesDefault() + { + base.SetAllModulesDefault(); + ColorMaskId = string.Empty; + Target = string.Empty; + for( int i = 0; i < ColorMaskData.Length; i++ ) + { + ColorMaskData[ i ] = true; + } + } + } + + public static class TemplateHelperFunctions + { + /* + struct DirectionalLightData + { + uint lightLayers; + float3 positionRWS; + float3 color; + int cookieIndex; + float volumetricDimmer; + float3 right; + float3 up; + float3 forward; + int tileCookie; + int shadowIndex; + int contactShadowIndex; + float4 shadowMaskSelector; + int nonLightmappedOnly; + float diffuseScale; + float specularScale; + }; + */ + public static string HDLightInfoFormat = "_DirectionalLightDatas[{0}].{1}"; + + public static string[] VectorSwizzle = { "x", "y", "z", "w" }; + public static string[] ColorSwizzle = { "r", "g", "b", "a" }; + + public static readonly Dictionary CustomTemplatePropertyUI = new Dictionary + { + { "None", CustomTemplatePropertyUIEnum.None}, + { "HDPBR", CustomTemplatePropertyUIEnum.HDPBR} + }; + + public static readonly Dictionary InvisibleOptions = new Dictionary() + { + { "SyncP", InvisibleOptionsEnum.SyncProperties } + }; + + public static readonly Dictionary StringToReservedTags = new Dictionary() + { + { TemplateSpecialTags.RenderType.ToString(), TemplateSpecialTags.RenderType}, + { TemplateSpecialTags.Queue.ToString(), TemplateSpecialTags.Queue}, + { TemplateSpecialTags.DisableBatching.ToString(), TemplateSpecialTags.DisableBatching}, + }; + + public static readonly Dictionary StringToDisableBatching = new Dictionary + { + {"true",DisableBatching.True}, + {"True",DisableBatching.True}, + {"false",DisableBatching.False}, + {"False",DisableBatching.False}, + {"LOD Fading",DisableBatching.LODFading}, + {"LODFading",DisableBatching.LODFading} + }; + + public static readonly Dictionary StringToRenderType = new Dictionary + { + {"Opaque",RenderType.Opaque}, + {"Transparent",RenderType.Transparent}, + {"TransparentCutout",RenderType.TransparentCutout}, + {"Background",RenderType.Background}, + {"Overlay",RenderType.Overlay}, + {"TreeOpaque",RenderType.TreeOpaque}, + {"TreeTransparentCutout",RenderType.TreeTransparentCutout}, + {"TreeBillboard",RenderType.TreeBillboard}, + {"Grass",RenderType.Grass}, + {"GrassBillboard",RenderType.GrassBillboard} + }; + + public static readonly Dictionary StringToRenderQueue = new Dictionary + { + {"Background",RenderQueue.Background }, + {"Geometry",RenderQueue.Geometry }, + {"AlphaTest",RenderQueue.AlphaTest }, + {"Transparent",RenderQueue.Transparent }, + {"Overlay",RenderQueue.Overlay } + }; + + public static readonly Dictionary PropertyToWireType = new Dictionary + { + {"Float",WirePortDataType.FLOAT}, + {"Range",WirePortDataType.FLOAT}, + {"Int",WirePortDataType.INT}, + {"Color",WirePortDataType.COLOR}, + {"Vector",WirePortDataType.FLOAT4}, + {"2D",WirePortDataType.SAMPLER2D}, + {"3D",WirePortDataType.SAMPLER3D}, + {"Cube",WirePortDataType.SAMPLERCUBE}, + {"2DArray",WirePortDataType.SAMPLER2DARRAY}, + }; + + public static readonly Dictionary DataTypeChannelUsage = new Dictionary + { + {WirePortDataType.OBJECT,0 }, + {WirePortDataType.FLOAT,1 }, + {WirePortDataType.FLOAT2,2 }, + {WirePortDataType.FLOAT3,3 }, + {WirePortDataType.FLOAT4,4 }, + {WirePortDataType.FLOAT3x3,0 }, + {WirePortDataType.FLOAT4x4,0 }, + {WirePortDataType.COLOR,4 }, + {WirePortDataType.INT,1 }, + {WirePortDataType.UINT,1 }, + {WirePortDataType.UINT4,4 }, + {WirePortDataType.SAMPLER1D,0 }, + {WirePortDataType.SAMPLER2D,0 }, + {WirePortDataType.SAMPLER3D,0 }, + {WirePortDataType.SAMPLERCUBE,0 }, + {WirePortDataType.SAMPLER2DARRAY,0 }, + {WirePortDataType.SAMPLERSTATE,0 } + }; + + public static readonly Dictionary ChannelToDataType = new Dictionary + { + {1,WirePortDataType.FLOAT}, + {2,WirePortDataType.FLOAT2}, + {3,WirePortDataType.FLOAT3}, + {4,WirePortDataType.FLOAT4} + }; + + public static readonly Dictionary SemanticsDefaultName = new Dictionary + { + {TemplateSemantics.COLOR ,"ase_color"}, + {TemplateSemantics.NORMAL ,"ase_normal"}, + {TemplateSemantics.POSITION ,"ase_position"}, + {TemplateSemantics.SV_POSITION ,"ase_sv_position"}, + {TemplateSemantics.TANGENT ,"ase_tangent"}, + {TemplateSemantics.SV_IsFrontFacing ,"ase_vface"}, + {TemplateSemantics.SV_VertexID ,"ase_vertexId"}, + {TemplateSemantics.SV_InstanceID ,"ase_instanceId"}, + {TemplateSemantics.SV_PrimitiveID ,"ase_primitiveId"}, + {TemplateSemantics.INTERNALTESSPOS ,"ase_internalTessPos"}, + {TemplateSemantics.TEXCOORD0 ,"ase_tex_coord0"}, + {TemplateSemantics.TEXCOORD1 ,"ase_tex_coord1"}, + {TemplateSemantics.TEXCOORD2 ,"ase_tex_coord2"}, + {TemplateSemantics.TEXCOORD3 ,"ase_tex_coord3"}, + {TemplateSemantics.TEXCOORD4 ,"ase_tex_coord4"}, + {TemplateSemantics.TEXCOORD5 ,"ase_tex_coord5"}, + {TemplateSemantics.TEXCOORD6 ,"ase_tex_coord6"}, + {TemplateSemantics.TEXCOORD7 ,"ase_tex_coord7"}, + {TemplateSemantics.TEXCOORD8 ,"ase_tex_coord8"}, + {TemplateSemantics.TEXCOORD9 ,"ase_tex_coord9"}, + {TemplateSemantics.TEXCOORD10 ,"ase_tex_coord10"}, + {TemplateSemantics.TEXCOORD11 ,"ase_tex_coord11"}, + {TemplateSemantics.TEXCOORD12 ,"ase_tex_coord12"}, + {TemplateSemantics.TEXCOORD13 ,"ase_tex_coord13"}, + {TemplateSemantics.TEXCOORD14 ,"ase_tex_coord14"}, + {TemplateSemantics.TEXCOORD15 ,"ase_tex_coord15"}, + }; + + public static readonly Dictionary IntToInfo = new Dictionary + { + {0,TemplateInfoOnSematics.TEXTURE_COORDINATES0 }, + {1,TemplateInfoOnSematics.TEXTURE_COORDINATES1 }, + {2,TemplateInfoOnSematics.TEXTURE_COORDINATES2 }, + {3,TemplateInfoOnSematics.TEXTURE_COORDINATES3 }, + {4,TemplateInfoOnSematics.TEXTURE_COORDINATES4 }, + {5,TemplateInfoOnSematics.TEXTURE_COORDINATES5 }, + {6,TemplateInfoOnSematics.TEXTURE_COORDINATES6 }, + {7,TemplateInfoOnSematics.TEXTURE_COORDINATES7 }, + }; + + public static readonly Dictionary ShortcutToInfo = new Dictionary + { + {"p" ,TemplateInfoOnSematics.POSITION }, + {"sp" ,TemplateInfoOnSematics.CLIP_POS }, + {"spu" ,TemplateInfoOnSematics.SCREEN_POSITION }, + {"spn" ,TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED }, + {"c" ,TemplateInfoOnSematics.COLOR }, + {"uv0" ,TemplateInfoOnSematics.TEXTURE_COORDINATES0 }, + {"uv1" ,TemplateInfoOnSematics.TEXTURE_COORDINATES1 }, + {"uv2" ,TemplateInfoOnSematics.TEXTURE_COORDINATES2 }, + {"uv3" ,TemplateInfoOnSematics.TEXTURE_COORDINATES3 }, + {"uv4" ,TemplateInfoOnSematics.TEXTURE_COORDINATES4 }, + {"uv5" ,TemplateInfoOnSematics.TEXTURE_COORDINATES5 }, + {"uv6" ,TemplateInfoOnSematics.TEXTURE_COORDINATES6 }, + {"uv7" ,TemplateInfoOnSematics.TEXTURE_COORDINATES7 }, + {"n" ,TemplateInfoOnSematics.NORMAL }, + {"t" ,TemplateInfoOnSematics.TANGENT }, + {"wn" ,TemplateInfoOnSematics.WORLD_NORMAL}, + {"wt" ,TemplateInfoOnSematics.WORLD_TANGENT}, + {"wbt" ,TemplateInfoOnSematics.WORLD_BITANGENT}, + {"wvd" ,TemplateInfoOnSematics.WORLD_VIEW_DIR}, + {"wp" ,TemplateInfoOnSematics.WORLD_POSITION}, + {"rwp" ,TemplateInfoOnSematics.RELATIVE_WORLD_POS}, + {"op" ,TemplateInfoOnSematics.OBJECT_POSITION}, + {"vp" ,TemplateInfoOnSematics.VIEW_POSITION}, + {"vf" ,TemplateInfoOnSematics.VFACE}, + {"sc" ,TemplateInfoOnSematics.SHADOWCOORDS} + }; + + public static readonly Dictionary InfoToDefineFrag = new Dictionary + { + {TemplateInfoOnSematics.POSITION ,"ASE_NEEDS_FRAG_POSITION"}, + {TemplateInfoOnSematics.CLIP_POS ,"ASE_NEEDS_FRAG_CLIP_POS"}, + {TemplateInfoOnSematics.SCREEN_POSITION,"ASE_NEEDS_FRAG_SCREEN_POSITION" }, + {TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED,"ASE_NEEDS_FRAG_SCREEN_POSITION_NORMALIZED" }, + {TemplateInfoOnSematics.COLOR, "ASE_NEEDS_FRAG_COLOR"}, + {TemplateInfoOnSematics.TEXTURE_COORDINATES0,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES0" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES1,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES1" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES2,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES2" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES3,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES3" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES4,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES4" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES5,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES5" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES6,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES6" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES7,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES7" }, + {TemplateInfoOnSematics.NORMAL,"ASE_NEEDS_FRAG_NORMAL" }, + {TemplateInfoOnSematics.TANGENT ,"ASE_NEEDS_FRAG_TANGENT"}, + {TemplateInfoOnSematics.WORLD_NORMAL,"ASE_NEEDS_FRAG_WORLD_NORMAL"}, + {TemplateInfoOnSematics.WORLD_TANGENT,"ASE_NEEDS_FRAG_WORLD_TANGENT"}, + {TemplateInfoOnSematics.WORLD_BITANGENT,"ASE_NEEDS_FRAG_WORLD_BITANGENT"}, + {TemplateInfoOnSematics.WORLD_VIEW_DIR,"ASE_NEEDS_FRAG_WORLD_VIEW_DIR"}, + {TemplateInfoOnSematics.WORLD_POSITION,"ASE_NEEDS_FRAG_WORLD_POSITION"}, + {TemplateInfoOnSematics.RELATIVE_WORLD_POS,"ASE_NEEDS_FRAG_RELATIVE_WORLD_POS"}, + {TemplateInfoOnSematics.OBJECT_POSITION,"ASE_NEEDS_FRAG_OBJECT_POSITION"}, + {TemplateInfoOnSematics.VIEW_POSITION,"ASE_NEEDS_FRAG_VIEW_POSITION"}, + {TemplateInfoOnSematics.VFACE,"ASE_NEEDS_FRAG_VFACE"}, + {TemplateInfoOnSematics.SHADOWCOORDS,"ASE_NEEDS_FRAG_SHADOWCOORDS"}, + }; + + public static readonly Dictionary InfoToDefineVertex = new Dictionary + { + {TemplateInfoOnSematics.POSITION ,"ASE_NEEDS_VERT_POSITION"}, + {TemplateInfoOnSematics.CLIP_POS ,"ASE_NEEDS_VERT_CLIP_POS"}, + {TemplateInfoOnSematics.SCREEN_POSITION,"ASE_NEEDS_VERT_SCREEN_POSITION" }, + {TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED,"ASE_NEEDS_VERT_SCREEN_POSITION_NORMALIZED" }, + {TemplateInfoOnSematics.COLOR, "ASE_NEEDS_VERT_COLOR"}, + {TemplateInfoOnSematics.TEXTURE_COORDINATES0,"ASE_NEEDS_VERT_TEXTURE_COORDINATES0" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES1,"ASE_NEEDS_VERT_TEXTURE_COORDINATES1" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES2,"ASE_NEEDS_VERT_TEXTURE_COORDINATES2" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES3,"ASE_NEEDS_VERT_TEXTURE_COORDINATES3" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES4,"ASE_NEEDS_VERT_TEXTURE_COORDINATES4" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES5,"ASE_NEEDS_VERT_TEXTURE_COORDINATES5" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES6,"ASE_NEEDS_VERT_TEXTURE_COORDINATES6" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES7,"ASE_NEEDS_VERT_TEXTURE_COORDINATES7" }, + {TemplateInfoOnSematics.NORMAL,"ASE_NEEDS_VERT_NORMAL" }, + {TemplateInfoOnSematics.TANGENT ,"ASE_NEEDS_VERT_TANGENT"}, + {TemplateInfoOnSematics.WORLD_NORMAL,"ASE_NEEDS_VERT_WORLD_NORMAL"}, + {TemplateInfoOnSematics.WORLD_TANGENT,"ASE_NEEDS_VERT_WORLD_TANGENT"}, + {TemplateInfoOnSematics.WORLD_BITANGENT,"ASE_NEEDS_VERT_WORLD_BITANGENT"}, + {TemplateInfoOnSematics.WORLD_VIEW_DIR,"ASE_NEEDS_VERT_WORLD_VIEW_DIR"}, + {TemplateInfoOnSematics.WORLD_POSITION,"ASE_NEEDS_VERT_WORLD_POSITION"}, + {TemplateInfoOnSematics.RELATIVE_WORLD_POS,"ASE_NEEDS_VERT_RELATIVE_WORLD_POS"}, + {TemplateInfoOnSematics.OBJECT_POSITION,"ASE_NEEDS_VERT_OBJECT_POSITION"}, + {TemplateInfoOnSematics.VIEW_POSITION,"ASE_NEEDS_VERT_VIEW_POSITION"}, + {TemplateInfoOnSematics.VFACE,"ASE_NEEDS_VERT_VFACE"}, + {TemplateInfoOnSematics.SHADOWCOORDS,"ASE_NEEDS_VERT_SHADOWCOORDS"} + }; + + public static readonly Dictionary InfoToLocalVar = new Dictionary + { + {TemplateInfoOnSematics.POSITION,GeneratorUtils.VertexPosition4Str }, + {TemplateInfoOnSematics.CLIP_POS,GeneratorUtils.ClipPositionStr }, + {TemplateInfoOnSematics.SCREEN_POSITION,GeneratorUtils.ScreenPosRawStr }, + {TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED,GeneratorUtils.ScreenPosNormStr }, + {TemplateInfoOnSematics.COLOR, "ase_color" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES0, "ase_uv0" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES1, "ase_uv1" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES2, "ase_uv2" }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES3, "ase_uv3" }, + {TemplateInfoOnSematics.NORMAL, GeneratorUtils.VertexNormalStr }, + {TemplateInfoOnSematics.TANGENT, GeneratorUtils.VertexTangentStr }, + {TemplateInfoOnSematics.WORLD_NORMAL, GeneratorUtils.WorldNormalStr}, + {TemplateInfoOnSematics.WORLD_TANGENT, GeneratorUtils.WorldTangentStr}, + {TemplateInfoOnSematics.WORLD_BITANGENT, GeneratorUtils.WorldBitangentStr}, + {TemplateInfoOnSematics.WORLD_VIEW_DIR, GeneratorUtils.WorldViewDirectionStr}, + {TemplateInfoOnSematics.WORLD_POSITION, GeneratorUtils.WorldPositionStr}, + {TemplateInfoOnSematics.RELATIVE_WORLD_POS, GeneratorUtils.RelativeWorldPositionStr}, + {TemplateInfoOnSematics.OBJECT_POSITION, GeneratorUtils.VertexPosition3Str}, + {TemplateInfoOnSematics.VIEW_POSITION, GeneratorUtils.ViewPositionStr}, + {TemplateInfoOnSematics.VFACE, GeneratorUtils.VFaceStr}, + {TemplateInfoOnSematics.SHADOWCOORDS, GeneratorUtils.ShadowCoordsStr}, + }; + + + public static readonly Dictionary InfoToWirePortType = new Dictionary + { + {TemplateInfoOnSematics.POSITION,WirePortDataType.FLOAT4 }, + {TemplateInfoOnSematics.CLIP_POS,WirePortDataType.FLOAT4 }, + {TemplateInfoOnSematics.SCREEN_POSITION,WirePortDataType.FLOAT4 }, + {TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED,WirePortDataType.FLOAT4 }, + {TemplateInfoOnSematics.COLOR, WirePortDataType.COLOR }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES0, WirePortDataType.FLOAT4 }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES1, WirePortDataType.FLOAT4 }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES2, WirePortDataType.FLOAT4 }, + {TemplateInfoOnSematics.TEXTURE_COORDINATES3, WirePortDataType.FLOAT4 }, + {TemplateInfoOnSematics.NORMAL, WirePortDataType.FLOAT3 }, + {TemplateInfoOnSematics.TANGENT, WirePortDataType.FLOAT4 }, + {TemplateInfoOnSematics.WORLD_NORMAL, WirePortDataType.FLOAT3}, + {TemplateInfoOnSematics.WORLD_TANGENT, WirePortDataType.FLOAT3}, + {TemplateInfoOnSematics.WORLD_BITANGENT, WirePortDataType.FLOAT3}, + {TemplateInfoOnSematics.WORLD_VIEW_DIR, WirePortDataType.FLOAT3}, + {TemplateInfoOnSematics.WORLD_POSITION, WirePortDataType.FLOAT3}, + {TemplateInfoOnSematics.RELATIVE_WORLD_POS, WirePortDataType.FLOAT3}, + {TemplateInfoOnSematics.OBJECT_POSITION, WirePortDataType.FLOAT3}, + {TemplateInfoOnSematics.VIEW_POSITION, WirePortDataType.FLOAT3}, + {TemplateInfoOnSematics.VFACE, WirePortDataType.FLOAT}, + {TemplateInfoOnSematics.SHADOWCOORDS, WirePortDataType.FLOAT4}, + }; + public static readonly Dictionary IntToUVChannelInfo = new Dictionary + { + {0,TemplateInfoOnSematics.TEXTURE_COORDINATES0 }, + {1,TemplateInfoOnSematics.TEXTURE_COORDINATES1 }, + {2,TemplateInfoOnSematics.TEXTURE_COORDINATES2 }, + {3,TemplateInfoOnSematics.TEXTURE_COORDINATES3 }, + {4,TemplateInfoOnSematics.TEXTURE_COORDINATES4 }, + {5,TemplateInfoOnSematics.TEXTURE_COORDINATES5 }, + {6,TemplateInfoOnSematics.TEXTURE_COORDINATES6 }, + {7,TemplateInfoOnSematics.TEXTURE_COORDINATES7 } + }; + + public static readonly Dictionary IntToSemantic = new Dictionary + { + { 0,TemplateSemantics.TEXCOORD0 }, + { 1,TemplateSemantics.TEXCOORD1 }, + { 2,TemplateSemantics.TEXCOORD2 }, + { 3,TemplateSemantics.TEXCOORD3 }, + { 4,TemplateSemantics.TEXCOORD4 }, + { 5,TemplateSemantics.TEXCOORD5 }, + { 6,TemplateSemantics.TEXCOORD6 }, + { 7,TemplateSemantics.TEXCOORD7 }, + { 8,TemplateSemantics.TEXCOORD8 }, + { 9,TemplateSemantics.TEXCOORD9 }, + { 10,TemplateSemantics.TEXCOORD10 }, + { 11,TemplateSemantics.TEXCOORD11 }, + { 12,TemplateSemantics.TEXCOORD12 }, + { 13,TemplateSemantics.TEXCOORD13 }, + { 14,TemplateSemantics.TEXCOORD14 }, + { 15,TemplateSemantics.TEXCOORD15 } + }; + + public static readonly Dictionary SemanticToInt = new Dictionary + { + { TemplateSemantics.TEXCOORD0,0 }, + { TemplateSemantics.TEXCOORD1,1 }, + { TemplateSemantics.TEXCOORD2,2 }, + { TemplateSemantics.TEXCOORD3,3 }, + { TemplateSemantics.TEXCOORD4,4 }, + { TemplateSemantics.TEXCOORD5,5 }, + { TemplateSemantics.TEXCOORD6,6 }, + { TemplateSemantics.TEXCOORD7,7 }, + { TemplateSemantics.TEXCOORD8,8 }, + { TemplateSemantics.TEXCOORD9,9 }, + { TemplateSemantics.TEXCOORD10,10 }, + { TemplateSemantics.TEXCOORD11,11 }, + { TemplateSemantics.TEXCOORD12,12 }, + { TemplateSemantics.TEXCOORD13,13 }, + { TemplateSemantics.TEXCOORD14,14 }, + { TemplateSemantics.TEXCOORD15,15 }, + }; + + public static readonly Dictionary ShortcutToSemantic = new Dictionary + { + { "p" ,TemplateSemantics.POSITION }, + { "sp" ,TemplateSemantics.SV_POSITION }, + { "c" ,TemplateSemantics.COLOR }, + { "n" ,TemplateSemantics.NORMAL }, + { "t" ,TemplateSemantics.TANGENT }, + { "tc0" ,TemplateSemantics.TEXCOORD0 }, + { "tc1" ,TemplateSemantics.TEXCOORD1 }, + { "tc2" ,TemplateSemantics.TEXCOORD2 }, + { "tc3" ,TemplateSemantics.TEXCOORD3 }, + { "tc4" ,TemplateSemantics.TEXCOORD4 }, + { "tc5" ,TemplateSemantics.TEXCOORD5 }, + { "tc6" ,TemplateSemantics.TEXCOORD6 }, + { "tc7" ,TemplateSemantics.TEXCOORD7 }, + { "tc8" ,TemplateSemantics.TEXCOORD8 }, + { "tc9" ,TemplateSemantics.TEXCOORD9 }, + { "tc10" ,TemplateSemantics.TEXCOORD10 }, + { "tc11" ,TemplateSemantics.TEXCOORD11 }, + { "tc12" ,TemplateSemantics.TEXCOORD12 }, + { "tc13" ,TemplateSemantics.TEXCOORD13 }, + { "tc14" ,TemplateSemantics.TEXCOORD14 }, + { "tc15" ,TemplateSemantics.TEXCOORD15 } + }; + + public static readonly Dictionary CgToWirePortType = new Dictionary() + { + {"float" ,WirePortDataType.FLOAT}, + {"float2" ,WirePortDataType.FLOAT2}, + {"float3" ,WirePortDataType.FLOAT3}, + {"float4" ,WirePortDataType.FLOAT4}, + {"float3x3" ,WirePortDataType.FLOAT3x3}, + {"float4x4" ,WirePortDataType.FLOAT4x4}, + {"half" ,WirePortDataType.FLOAT}, + {"half2" ,WirePortDataType.FLOAT2}, + {"half3" ,WirePortDataType.FLOAT3}, + {"half4" ,WirePortDataType.FLOAT4}, + {"half3x3" ,WirePortDataType.FLOAT3x3}, + {"half4x4" ,WirePortDataType.FLOAT4x4}, + {"fixed" ,WirePortDataType.FLOAT}, + {"fixed2" ,WirePortDataType.FLOAT2}, + {"fixed3" ,WirePortDataType.FLOAT3}, + {"fixed4" ,WirePortDataType.FLOAT4}, + {"fixed3x3" ,WirePortDataType.FLOAT3x3}, + {"fixed4x4" ,WirePortDataType.FLOAT4x4}, + {"int" ,WirePortDataType.INT}, + {"uint" ,WirePortDataType.INT}, + {"sampler1D" ,WirePortDataType.SAMPLER1D}, + {"sampler2D" ,WirePortDataType.SAMPLER2D}, + {"sampler2D_float" ,WirePortDataType.SAMPLER2D}, + {"sampler3D" ,WirePortDataType.SAMPLER3D}, + {"samplerCUBE" ,WirePortDataType.SAMPLERCUBE}, + {"sampler2DArray" ,WirePortDataType.SAMPLER2DARRAY}, + {"SamplerState" ,WirePortDataType.SAMPLERSTATE} + }; + + public static readonly Dictionary AvailableInterpolators = new Dictionary() + { + {"2.0",8 }, + {"2.5",8 }, + {"3.0",10}, + {"3.5",10}, + {"4.0",16}, + {"4.5",16}, + {"4.6",16}, + {"5.0",16} + }; + + public static readonly string[] AvailableShaderModels = + { "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "4.6", "5.0" }; + + public static readonly Dictionary ShaderModelToArrayIdx = new Dictionary() + { + {"2.0",0}, + {"2.5",1}, + {"3.0",2}, + {"3.5",3}, + {"4.0",4}, + {"4.5",5}, + {"4.6",6}, + {"5.0",7} + }; + + public static readonly string HDPBRTag = "UNITY_MATERIAL_LIT"; + public static readonly Dictionary TagToRenderPipeline = new Dictionary() + { + { "UniversalPipeline",TemplateSRPType.URP }, + { "LightweightPipeline",TemplateSRPType.URP }, + { "HDRenderPipeline",TemplateSRPType.HDRP } + }; + public static string CoreColorLib = "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"; + public static string CoreCommonLib = "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"; + + public static string PragmaOnlyRendersPattern = @"#pragma\s+only_renderers\s+([\w .]*)"; + public static string PragmaExcludeRendersPattern = @"#pragma\s+exclude_renderers\s+([\w .]*)"; + public static string PragmaRendererElement = @"(\w+)"; + + public static string FetchSubShaderBody = @"(SubShader.*)\/\*ase_lod\*\/"; + public static string TemplateCustomUI = @"\/\*CustomNodeUI:(\w*)\*\/"; + public static string HidePassPattern = @"\/\*ase_hide_pass[:]*([a-zA-Z:]*)\*\/"; + public static string ASEPassPattern = @"\/\*ase_pass[:]*([a-zA-Z:]*)\*\/"; + public static string BlendWholeWordPattern = @"\bBlend\b"; + public static string BlendOpWholeWordPattern = @"\bBlendOp\b"; + public static string AlphaToMaskPattern = @"\bAlphaToMask\s+(\[*\w+\]*)"; + public static string CullWholeWordPattern = @"\bCull\b"; + public static string ColorMaskWholeWordPattern = @"\bColorMask\b"; + public static string StencilWholeWordPattern = @"\bStencil\b"; + public static string ZWriteWholeWordPattern = @"\bZWrite\b"; + public static string ZTestWholeWordPattern = @"\bZTest\b"; + public static string ZOffsetWholeWordPattern = @"\bOffset\b"; + public static string TagsWholeWordPattern = @"\bTags\b"; + + + public static string CustomInspectorPattern = "^\\s*CustomEditor\\s+\\\"([\\w\\.]*)\\\""; + public static string FallbackPattern = "^\\s*Fallback\\s+\\\"([\\w\\/\\\\]*)\\\""; + public static string DefinesPattern = @"^\s*#define\s+([\w .]*)"; + public static string PragmasPattern = @"^\s*#pragma\s+([\w .]*)"; + public static string IncludesPattern = "^\\s*#include\\s+\"([\\w.\\/]*)\""; + public static string GlobalDirectivesPattern = "[#]+(define|pragma|include)\\s+([\\w .\\/\\\"]*)"; + public static string BeforePragmaPattern = @"(?:CGPROGRAM|HLSLPROGRAM|GLSLPROGRAM).*?\n(\s*)(.)"; + public static string GlobalTOPDirectivesPattern = @"(CGPROGRAM|CGINCLUDE|HLSLPROGRAM|HLSLINCLUDE).*?\n\s*(.)"; + + public static string VertexPragmaPattern = @"#pragma vertex\s+(\w+)"; + public static string FragmentPragmaPattern = @"#pragma fragment\s+(\w+)"; + public static string FunctionBodyStartPattern = @"\s+{0}\s*\("; + + public static string ShaderModelPattern = @"#pragma\s+target\s+([0-9]*[.]*[0-9]*)"; + + public static readonly string LocalVarPattern = @"\/\*ase_local_var[:]*(\w*)\*\/\s*(\w*)\s+(\w*)"; + + public static readonly string InlinePattern = @"\/\*ase_inline_begin\*\/(.*?)\/\*ase_inline_end\*\/"; + + public static readonly string SRPConditionPattern = @"\/\*ase_srp_cond_begin:([==|!=|>=|<=|>|<]*)(\d*)\*\/(?s)(.*?)\s\/\*ase_srp_cond_end\*\/"; + public static readonly string UnityConditionPattern = @"\/\*ase_unity_cond_begin:([==|!=|>=|<=|>|<]*)(\d*)\*\/(?s)(.*?)\s\/\*ase_unity_cond_end\*\/"; + + public static readonly string SubShaderLODPattern = @"\sLOD\s+(\d+)"; + + public static readonly string PassNamePattern = "Name\\s+\\\"([\\w\\+\\-\\*\\/\\(\\) ]*)\\\""; + + public static readonly string TagsPattern = "\"(\\w+)\"\\s*=\\s*\"(\\w+\\+*\\w*)\""; + public static readonly string ZTestPattern = @"^\s*ZTest\s+(\[*\w+\]*)"; + public static readonly string ZWritePattern = @"^\s*ZWrite\s+(\[*\w+\]*)"; + //public static readonly string ZOffsetPattern = @"\s*Offset\s+([-+]?[0-9]*\.?[0-9]+)\s*,\s*([-+]?[0-9]*\.?[0-9]+)"; + public static readonly string ZOffsetPattern = @"^\s*Offset\s+([-+]?[0-9]*\.?[0-9]+|\[*\w+\]*)\s*,\s*([-+]?[0-9]*\.?[0-9]+|\[*\w+\]*)\s*"; + public static readonly string VertexDataPattern = @"([a-z0-9D_]+|samplerCUBE|sampler2DArray)\s+(\w+)\s*:\s*([A-Z0-9_]+);"; + public static readonly string InterpRangePattern = @"ase_interp\((\d\.{0,1}\w{0,4}),(\d*)\)"; + //public static readonly string PropertiesPatternB = "(\\w*)\\s*\\(\\s*\"([\\w ]*)\"\\s*\\,\\s*(\\w*)\\s*.*\\)"; + //public static readonly string PropertiesPatternC = "^\\s*(\\w*)\\s*\\(\\s*\"([\\w\\(\\)\\+\\-\\\\* ]*)\"\\s*\\,\\s*(\\w*)\\s*.*\\)"; + //public static readonly string PropertiesPatternD = "(\\/\\/\\s*)*(\\w*)\\s*\\(\\s*%\"([\\w\\(\\)\\+\\-\\\\* ]*)\"\\s*\\,\\s*(\\w*)\\s*.*\\)"; + //public static readonly string PropertiesPatternE = "(\\/\\/\\s*)*(\\w*)\\s*\\(\\s*\"([\\w\\(\\)\\+\\-\\\\* ]*)\"\\s*\\,\\s*(\\w*)\\s*.*\\)\\s*=\\s*[\\w,()\" {}]*"; + //public static readonly string PropertiesPatternF = "^(\\/\\/)*\\s*(\\[[\\[\\]\\w\\s\\(\\)\\_\\,]*\\])*\\s*(\\w*)\\s*\\(\\s*\"([\\w\\(\\)\\+\\-\\\\* ]*)\"\\s*\\,\\s*(\\w*)\\s*.*\\)\\s*=\\s*[\\w,()\" {}]*"; + //public static readonly string PropertiesPatternG = "^(\\s*)(\\[[\\[\\]\\w\\s\\(\\)\\_\\,]*\\])*\\s*(\\w*)\\s*\\(\\s*\"([\\w\\(\\)\\+\\-\\\\* ]*)\"\\s*\\,\\s*(\\w*)\\s*.*\\)\\s*=\\s*[\\w,()\" {}]*"; + //public static readonly string PropertiesPatternH = @"^(\s*)(\[[\[\]\w\s\(\)_,\.]*\])*[\s\/]*(\w*)\s*\(\s*""([\w\(\)\+\-\\* ]*)""\s*\,\s*(\w*)\s*.*\)\s*=\s*[\w,()"" {}\.]*"; + public static readonly string PropertiesPatternI = @"^(\s*)(\[[\[\]\w\s\(\)_,\.]*\])*[\s\/]*(\w*)\s*\(\s*""([\w\(\)\+\-\\* ]*)""\s*\,\s*(\w*)\s*.*\)\s*=\s*[\w,()"" {}\.]*"; + public static readonly string CullModePattern = @"^\s*Cull\s+(\[*\w+\]*)"; + + public static readonly string ColorMaskPatternFirst = @"\bColorMask\s+([\d\w\[\]]+)(\s+0)*"; + + public static readonly string ColorMaskPattern = @"\bColorMask\s+([\d\w\[\]]+)(\s+0)"; + public static readonly string ColorMask1Pattern = @"\bColorMask\s+([\d\w\[\]]+)(\s+1)"; + public static readonly string ColorMask2Pattern = @"\bColorMask\s+([\d\w\[\]]+)(\s+2)"; + public static readonly string ColorMask3Pattern = @"\bColorMask\s+([\d\w\[\]]+)(\s+3)"; + //public static readonly string BlendModePattern = @"\s*Blend\s+(\w+)\s+(\w+)(?:[\s,]+(\w+)\s+(\w+)|)"; + //public static readonly string BlendModePattern = @"\s*Blend\s+(\[*\w+\]*)\s+(\[*\w+\]*)(?:[\s,]+(\[*\w+\]*)\s+(\[*\w+\]*)|)"; + //public static readonly string BlendModePattern = @"^\s*Blend\s+(?:(?=\d)|(\[*\w+\]*)\s+(\[*\w+\]*)(?:[\s,]+(\[*\w+\]*)\s+(\[*\w+\]*)|))"; + public static readonly string BlendModePatternFirst = @"\bBlend([ \t]+0)*[ \t]+(?:Off|(\[*\w+\]*)[ \t]+(\[*\w+\]*)(?:(?=[ \t]+Blend)|(?:[ \t,]+(\[*\w+\]*)[ \t]+(\[*\w+\]*)|)))"; + public static readonly string BlendModePattern = @"\bBlend([ \t]+0)[ \t]+(?:Off|(\[*\w+\]*)[ \t]+(\[*\w+\]*)(?:(?=[ \t]+Blend)|(?:[ \t,]+(\[*\w+\]*)[ \t]+(\[*\w+\]*)|)))"; + public static readonly string BlendModePattern1 = @"\bBlend([ \t]+1)[ \t]+(?:Off|(\[*\w+\]*)[ \t]+(\[*\w+\]*)(?:(?=[ \t]+Blend)|(?:[ \t,]+(\[*\w+\]*)[ \t]+(\[*\w+\]*)|)))"; + public static readonly string BlendModePattern2 = @"\bBlend([ \t]+2)[ \t]+(?:Off|(\[*\w+\]*)[ \t]+(\[*\w+\]*)(?:(?=[ \t]+Blend)|(?:[ \t,]+(\[*\w+\]*)[ \t]+(\[*\w+\]*)|)))"; + public static readonly string BlendModePattern3 = @"\bBlend([ \t]+3)[ \t]+(?:Off|(\[*\w+\]*)[ \t]+(\[*\w+\]*)(?:(?=[ \t]+Blend)|(?:[ \t,]+(\[*\w+\]*)[ \t]+(\[*\w+\]*)|)))"; + //public static readonly string BlendOpPattern = @"\s*BlendOp\s+(\w+)[\s,]*(?:(\w+)|)"; + //public static readonly string BlendOpPattern = @"\s*BlendOp\s+(\[*\w+\]*)[\s,]*(?:(\[*\w+\]*)|)"; + //public static readonly string BlendOpPattern = @"^\s*BlendOp\s+(?:(?=\d)|(\[*\w+\]*)[\s,]*(?:(\[*\w+\]*)|))"; + public static readonly string BlendOpPatternFirst = @"\bBlendOp([ \t]+0)*[ \t]+(\[*\w+\]*)(?:(?=[ \t]+Blend)|[ \t,]*(?:(\[*\w+\]*)|))"; + public static readonly string BlendOpPattern = @"\bBlendOp([ \t]+0)[ \t]+(\[*\w+\]*)(?:(?=[ \t]+Blend)|[ \t,]*(?:(\[*\w+\]*)|))"; + public static readonly string BlendOpPattern1 = @"\bBlendOp([ \t]+1)[ \t]+(\[*\w+\]*)(?:(?=[ \t]+Blend)|[ \t,]*(?:(\[*\w+\]*)|))"; + public static readonly string BlendOpPattern2 = @"\bBlendOp([ \t]+2)[ \t]+(\[*\w+\]*)(?:(?=[ \t]+Blend)|[ \t,]*(?:(\[*\w+\]*)|))"; + public static readonly string BlendOpPattern3 = @"\bBlendOp([ \t]+3)[ \t]+(\[*\w+\]*)(?:(?=[ \t]+Blend)|[ \t,]*(?:(\[*\w+\]*)|))"; + public static readonly string StencilOpGlobalPattern = @"Stencil\s*{([\w\W\s]*)}"; + public static readonly string StencilOpLinePattern = @"(\w+)\s*(\[*\w+\]*)"; + + public static readonly string ShaderGlobalsOverallPattern = @"(?:\/\*ase_pragma\*\/|[\}\#])[\#\&\|\!\<\>\(\)\=\w\s\;\/\*\.\\""]*\/\*ase_globals\*\/"; + public static readonly string ShaderGlobalsMultilinePattern = @"^\s*(?:uniform\s*)*(\w*)\s*(\w*);$"; + + public static readonly string TexSemantic = "float4 {0} : TEXCOORD{1};"; + public static readonly string TexFullSemantic = "float4 {0} : {1};"; + public static readonly string InterpFullSemantic = "{0} {1} : {2};"; + public static readonly string BaseInterpolatorName = "ase_texcoord"; + public static readonly string TexUVFullSemantic = "float4 ase_texcoord{0} : TEXCOORD{0};"; + public static readonly string InterpMacro = "{0}({1})"; + + public static readonly string InterpolatorDecl = Constants.VertexShaderOutputStr + ".{0} = " + Constants.VertexShaderInputStr + ".{0};"; + public static readonly string TemplateVariableDecl = "{0} = {1};"; + public static readonly string TemplateVarFormat = "{0}.{1}"; + + //public static readonly string StructsRemoval = @"struct\s+\w+\s+{[\s\w;\/\*]+};"; + public static readonly string StructsRemoval = @"struct\s+\w+\s+{[\#\&\|\!\<\>\s\w\(\).;:=,\/\*]+};"; + + public static readonly string SRPBatcherFindTag = @"CBUFFER_START\s*\(\s*UnityPerMaterial\s*\)\s*\n(\s*)"; + + public static string ReplaceAt( this string body, string oldStr, string newStr, int startIndex ) + { + return body.Remove( startIndex, oldStr.Length ).Insert( startIndex, newStr ); + } + + public static bool GetPassUniqueId( TemplateTagData tagData, TemplatePropertyContainer propertyContainer, TemplateIdManager idManager, string uniquePrefix, int offsetIdx, string subBody, ref string passUniqueID ) + { + Match match = Regex.Match( subBody, ASEPassPattern ); + if( match.Success && match.Groups.Count > 1 && match.Groups[1].Length > 0 ) + { + passUniqueID = match.Groups[ 1 ].Value; + + tagData.StartIdx = offsetIdx + match.Index; + tagData.Id = match.Value; + + idManager.RegisterId( tagData.StartIdx, uniquePrefix + tagData.Id, tagData.Id ); + propertyContainer.AddId( subBody, tagData.Id, tagData.SearchIndentation ); + return true; + } + return false; + } + + public static CustomTemplatePropertyUIEnum FetchCustomUI( string data ) + { + Match match = Regex.Match( data, TemplateCustomUI ); + if( match.Success && CustomTemplatePropertyUI.ContainsKey( match.Groups[ 1 ].Value ) ) + { + return CustomTemplatePropertyUI[ match.Groups[ 1 ].Value ]; + } + return CustomTemplatePropertyUIEnum.None; + } + + public static bool FetchInvisibleInfo( string input, ref int optionsArr, ref string id, ref int idIndex ) + { + Match match = Regex.Match( input, HidePassPattern ); + if( match.Success ) + { + id = match.Value; + idIndex = match.Index; + if( match.Groups.Count > 1 ) + { + string[] properties = match.Groups[ 1 ].Value.Split( ':' ); + for( int i = 0; i < properties.Length; i++ ) + { + if( InvisibleOptions.ContainsKey( properties[ i ] ) ) + { + optionsArr |= (int)InvisibleOptions[ properties[ i ] ]; + } + } + } + } + return match.Success; + } + + static public string GenerateTextureSemantic( ref MasterNodeDataCollector dataCollector, int uv ) + { + string texCoordName = BaseInterpolatorName; + if( uv > 0 ) + { + texCoordName += uv.ToString(); + } + + string texCoordData = string.Format( TexSemantic, texCoordName, uv ); + dataCollector.AddToVertexInput( texCoordData ); + dataCollector.AddToInterpolators( texCoordData ); + dataCollector.AddToVertexInterpolatorsDecl( string.Format( InterpolatorDecl, texCoordName ) ); + return texCoordName; + } + + public static void CreatePragmaIncludeList( string data, TemplateIncludePragmaContainter includePragmaContainer ) + { + // this finds the topmost position for including directives + int topIndex = -1; + foreach( Match match in Regex.Matches( data, GlobalTOPDirectivesPattern, RegexOptions.Singleline ) ) + { + if( match.Groups.Count == 3 ) + { + topIndex = match.Groups[ 2 ].Index; + } + } + + foreach( Match match in Regex.Matches( data, GlobalDirectivesPattern, RegexOptions.Multiline ) ) + { + if( match.Success ) + { + includePragmaContainer.AddNativeDirective( match.Groups[ 0 ].Value, topIndex ); + } + } + + foreach( Match match in Regex.Matches( data, PragmasPattern, RegexOptions.Multiline ) ) + { + if( match.Groups.Count == 2 ) + { + includePragmaContainer.AddPragma( match.Groups[ 1 ].Value ); + } + } + + foreach( Match match in Regex.Matches( data, DefinesPattern, RegexOptions.Multiline ) ) + { + if( match.Groups.Count == 2 ) + { + includePragmaContainer.AddDefine( match.Groups[ 1 ].Value ); + } + } + + foreach( Match match in Regex.Matches( data, IncludesPattern, RegexOptions.Multiline ) ) + { + if( match.Groups.Count == 2 ) + { + includePragmaContainer.AddInclude( match.Groups[ 1 ].Value ); + } + } + } + + public static void CreateShaderPropertiesList( string propertyData, ref List propertiesList, ref Dictionary duplicatesHelper, int subShaderId, int passId) + { + int identationIdx = (int)TemplateShaderPropertiesIdx.Identation; + int nameIdx = (int)TemplateShaderPropertiesIdx.Name; + int typeIdx = (int)TemplateShaderPropertiesIdx.Type; + int inspectorNameIdx = (int)TemplateShaderPropertiesIdx.InspectorName; + + foreach( Match match in Regex.Matches( propertyData, PropertiesPatternI, RegexOptions.Multiline ) ) + { + if( match.Groups.Count > 1 ) + { + if( !duplicatesHelper.ContainsKey( match.Groups[ nameIdx ].Value ) && PropertyToWireType.ContainsKey( match.Groups[ typeIdx ].Value ) ) + { + TemplateShaderPropertyData newData = new TemplateShaderPropertyData( match.Index, + match.Value, + match.Groups[ identationIdx ].Value, + match.Groups[ inspectorNameIdx ].Value, + match.Groups[ nameIdx ].Value, + PropertyToWireType[ match.Groups[ typeIdx ].Value ], + PropertyType.Property, + subShaderId, + passId); + propertiesList.Add( newData ); + duplicatesHelper.Add( newData.PropertyName, newData ); + } + } + } + } + public const string DepthMacroDeclRegex = @"UNITY_DECLARE_DEPTH_TEXTURE\(\s*_CameraDepthTexture"; + public static void CheckUnityBuiltinGlobalMacros( string propertyData, ref List propertiesList, ref Dictionary duplicatesHelper, int subShaderId, int passId ) + { + Match match = Regex.Match( propertyData, DepthMacroDeclRegex ); + if( match.Success ) + { + TemplateShaderPropertyData newData = new TemplateShaderPropertyData( -1, + string.Empty, + string.Empty, + string.Empty, + Constants.CameraDepthTextureValue, + WirePortDataType.SAMPLER2D, + PropertyType.Global, + subShaderId, + passId, + true ); + duplicatesHelper.Add( newData.PropertyName, newData ); + propertiesList.Add( newData ); + } + } + + public static void CreateShaderGlobalsList( string propertyData, ref List propertiesList, ref Dictionary duplicatesHelper,int subShaderId, int passId ) + { + int typeIdx = (int)TemplateShaderGlobalsIdx.Type; + int nameIdx = (int)TemplateShaderGlobalsIdx.Name; + + // removes structs + propertyData = Regex.Replace( propertyData, StructsRemoval, "" ); + MatchCollection matchCollection = Regex.Matches( propertyData, ShaderGlobalsOverallPattern ); + string value = ( matchCollection.Count > 0 ) ? matchCollection[ 0 ].Groups[ 0 ].Value : propertyData; + foreach( Match lineMatch in Regex.Matches( value, ShaderGlobalsMultilinePattern, RegexOptions.Multiline ) ) + { + if( lineMatch.Groups.Count > 1 ) + { + if( !duplicatesHelper.ContainsKey( lineMatch.Groups[ nameIdx ].Value ) && CgToWirePortType.ContainsKey( lineMatch.Groups[ typeIdx ].Value ) ) + { + TemplateShaderPropertyData newData = new TemplateShaderPropertyData( -1, + string.Empty, + string.Empty, + string.Empty, + lineMatch.Groups[ nameIdx ].Value, + CgToWirePortType[ lineMatch.Groups[ typeIdx ].Value ], + PropertyType.Global, + subShaderId, + passId); + duplicatesHelper.Add( newData.PropertyName, newData ); + propertiesList.Add( newData ); + } + } + } + } + + public static void CreateStencilOps( string stencilData, ref TemplateStencilData stencilDataObj ) + { + stencilDataObj.DataCheck = TemplateDataCheck.Invalid; + MatchCollection overallGlobalMatch = Regex.Matches( stencilData, StencilOpGlobalPattern ); + if( overallGlobalMatch.Count == 1 && overallGlobalMatch[ 0 ].Groups.Count == 2 ) + { + string property = string.Empty; + string value = overallGlobalMatch[ 0 ].Groups[ 1 ].Value; + foreach( Match match in Regex.Matches( value, StencilOpLinePattern ) ) + { + stencilDataObj.DataCheck = TemplateDataCheck.Valid; + if( match.Groups.Count == 3 ) + { + switch( match.Groups[ 1 ].Value ) + { + default: + { + stencilDataObj.DataCheck = TemplateDataCheck.Invalid; + return; + } + case "Ref": + { + if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + stencilDataObj.ReferenceInline = property; + } + else + { + try + { + stencilDataObj.Reference = Convert.ToInt32( match.Groups[ 2 ].Value ); + } + catch( Exception e ) + { + Debug.LogException( e ); + stencilDataObj.DataCheck = TemplateDataCheck.Invalid; + return; + } + } + } + break; + case "ReadMask": + { + if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + stencilDataObj.ReadMaskInline = property; + } + else + { + try + { + stencilDataObj.ReadMask = Convert.ToInt32( match.Groups[ 2 ].Value ); + } + catch( Exception e ) + { + Debug.LogException( e ); + stencilDataObj.DataCheck = TemplateDataCheck.Invalid; + return; + } + } + } + break; + case "WriteMask": + { + if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + stencilDataObj.WriteMaskInline = property; + } + else + { + try + { + stencilDataObj.WriteMask = Convert.ToInt32( match.Groups[ 2 ].Value ); + } + catch( Exception e ) + { + Debug.LogException( e ); + stencilDataObj.DataCheck = TemplateDataCheck.Invalid; + return; + } + } + } + break; + case "CompFront": + case "Comp": + { + if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + stencilDataObj.ComparisonFrontInline = property; + } + else + { + stencilDataObj.ComparisonFront = match.Groups[ 2 ].Value; + } + } + break; + case "PassFront": + case "Pass": + { + if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + stencilDataObj.PassFrontInline = property; + } + else + { + stencilDataObj.PassFront = match.Groups[ 2 ].Value; + } + } + break; + case "FailFront": + case "Fail": + { + if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + stencilDataObj.FailFrontInline = property; + } + else + { + stencilDataObj.FailFront = match.Groups[ 2 ].Value; + } + } + break; + case "ZFail": + case "ZFailFront": + { + if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + stencilDataObj.ZFailFrontInline = property; + } + else + { + stencilDataObj.ZFailFront = match.Groups[ 2 ].Value; + } + } + break; + case "CompBack": + { + if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + stencilDataObj.ComparisonBackInline = property; + } + else + { + stencilDataObj.ComparisonBack = match.Groups[ 2 ].Value; + } + } + break; + case "PassBack": + { + if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + stencilDataObj.PassBackInline = property; + } + else + { + stencilDataObj.PassBack = match.Groups[ 2 ].Value; + } + } + break; + case "FailBack": + { + if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + stencilDataObj.FailBackInline = property; + } + else + { + stencilDataObj.FailBack = match.Groups[ 2 ].Value; + } + } + break; + case "ZFailBack": + { + if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + stencilDataObj.ZFailBackInline = property; + } + else + { + stencilDataObj.ZFailBack = match.Groups[ 2 ].Value; + } + } + break; + } + } + } + } + } + + public static void CreateColorMask( string colorMaskData, ref TemplateColorMaskData colorMaskObj, string pattern ) + { + colorMaskObj.DataCheck = TemplateDataCheck.Invalid; + Match match = Regex.Match( colorMaskData, pattern ); + //if( match.Groups.Count == 3 /*&& !match.Groups[ 2 ].Success*/ ) // second group is the colormask MRT which isn't implemented yet + { + string property = string.Empty; + if( match.Groups[ 1 ].Success && IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) + { + colorMaskObj.InlineData = property; + colorMaskObj.DataCheck = TemplateDataCheck.Valid; + colorMaskObj.Target = match.Groups[ 2 ].Value; + } + else + { + for( int i = 0; i < 4; i++ ) + { + colorMaskObj.ColorMaskData[ i ] = false; + } + + colorMaskObj.Target = match.Groups[ 2 ].Value; + colorMaskObj.DataCheck = TemplateDataCheck.Valid; + try + { + for( int i = 0; i < match.Groups[ 1 ].Value.Length; i++ ) + { + switch( Char.ToLower( match.Groups[ 1 ].Value[ i ] ) ) + { + case 'r': colorMaskObj.ColorMaskData[ 0 ] = true; break; + case 'g': colorMaskObj.ColorMaskData[ 1 ] = true; break; + case 'b': colorMaskObj.ColorMaskData[ 2 ] = true; break; + case 'a': colorMaskObj.ColorMaskData[ 3 ] = true; break; + case '0': + { + for( int j = 0; j < 4; j++ ) + { + colorMaskObj.ColorMaskData[ j ] = false; + } + return; + } + default: + { + colorMaskObj.DataCheck = TemplateDataCheck.Invalid; + return; + } + } + } + } + catch( Exception e ) + { + Debug.LogException( e ); + colorMaskObj.DataCheck = TemplateDataCheck.Invalid; + return; + } + } + } + } + + public static void CreateAlphaToMask( string alphaToMaskData, ref TemplateAlphaToMaskData alphaToMaskObj ) + { + alphaToMaskObj.DataCheck = TemplateDataCheck.Invalid; + Match match = Regex.Match( alphaToMaskData, AlphaToMaskPattern ); + if( match.Groups.Count == 2 ) + { + string property = string.Empty; + if( match.Groups[ 1 ].Success && IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) + { + alphaToMaskObj.InlineData = property; + alphaToMaskObj.DataCheck = TemplateDataCheck.Valid; + } + else + { + try + { + alphaToMaskObj.AlphaToMaskData = match.Groups[ 1 ].Value == "On" ? true : false; + alphaToMaskObj.DataCheck = TemplateDataCheck.Valid; + } + catch( Exception e ) + { + alphaToMaskObj.DataCheck = TemplateDataCheck.Invalid; + Debug.LogException( e ); + return; + } + } + } + } + + public static void CreateCullMode( string cullModeData, ref TemplateCullModeData cullDataObj ) + { + cullDataObj.DataCheck = TemplateDataCheck.Invalid; + Match match = Regex.Match( cullModeData, CullModePattern ); + if( match.Groups.Count == 2 ) + { + string property = string.Empty; + if( match.Groups[ 1 ].Success && IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) + { + cullDataObj.InlineData = property; + cullDataObj.DataCheck = TemplateDataCheck.Valid; + } + else + { + try + { + cullDataObj.CullModeData = (CullMode)Enum.Parse( typeof( CullMode ), match.Groups[ 1 ].Value ); + cullDataObj.DataCheck = TemplateDataCheck.Valid; + } + catch( Exception e ) + { + cullDataObj.DataCheck = TemplateDataCheck.Invalid; + Debug.LogException( e ); + return; + } + } + } + } + + public static void CreateBlendMode( string blendModeData, ref TemplateBlendData blendDataObj, string pattern ) + { + blendDataObj.ValidBlendMode = true; + string property = string.Empty; + bool noMatches = true; + // TODO: OPTIMIZE REGEX EXPRESSIONS TO NOT CATCH EMPTY GROUPS + Match match = Regex.Match( blendModeData, pattern ); + //Debug.Log( blendModeData + " | " + match.Groups.Count + "|" + match.Groups[ 0 ].Value + " " + match.Groups[ 0 ].Success + " " + match.Groups[ 1 ].Success + " " + match.Groups[ 2 ].Success + " " + match.Groups[ 3 ].Success + " " + match.Groups[ 4 ].Success + " " + match.Groups[ 5 ].Success ); + { + if( match.Groups.Count <= 4 && match.Groups.Count >= 3 ) + { + if( match.Groups[ 0 ].Success && match.Groups[ 2 ].Success ) + { + try + { + if( IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + blendDataObj.SourceFactorRGBInline = property; + } + else + { + AvailableBlendFactor sourceAll = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), match.Groups[ 2 ].Value ); + blendDataObj.SourceFactorRGB = sourceAll; + } + if( match.Groups[ 3 ].Success && IsInlineProperty( match.Groups[ 3 ].Value, ref property ) ) + { + blendDataObj.DestFactorRGBInline = property; + } + else + { + AvailableBlendFactor destAll = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), match.Groups[ 3 ].Value ); + blendDataObj.DestFactorRGB = destAll; + } + blendDataObj.Target = match.Groups[ 1 ].Value; + blendDataObj.SeparateBlendFactors = false; + blendDataObj.BlendModeOff = false; + noMatches = false; + } + catch( Exception e ) + { + Debug.LogException( e ); + blendDataObj.DataCheck = TemplateDataCheck.Invalid; + blendDataObj.ValidBlendMode = false; + return; + } + } + } + else if( match.Groups.Count >= 5 ) + { + if( match.Groups[ 1 ].Success ) + blendDataObj.Target = match.Groups[ 1 ].Value; + + if( !match.Groups[ 2 ].Success && !match.Groups[ 3 ].Success ) + { + if( match.Groups[ 0 ].Value.IndexOf("Off") > -1 ) + { + blendDataObj.BlendModeOff = true; + noMatches = false; + } + } + + if( match.Groups[ 0 ].Success && match.Groups[ 2 ].Success ) + { + try + { + if( IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + blendDataObj.SourceFactorRGBInline = property; + } + else + { + AvailableBlendFactor sourceRGB = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), match.Groups[ 2 ].Value ); + blendDataObj.SourceFactorRGB = sourceRGB; + } + + if( match.Groups[ 3 ].Success && IsInlineProperty( match.Groups[ 3 ].Value, ref property ) ) + { + blendDataObj.DestFactorRGBInline = property; + } + else + { + AvailableBlendFactor destRGB = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), match.Groups[ 3 ].Value ); + blendDataObj.DestFactorRGB = destRGB; + } + + if( match.Groups[ 4 ].Success && match.Groups[ 5 ].Success ) + { + if( IsInlineProperty( match.Groups[ 4 ].Value, ref property ) ) + { + blendDataObj.SourceFactorAlphaInline = property; + } + else + { + AvailableBlendFactor sourceA = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), match.Groups[ 4 ].Value ); + blendDataObj.SourceFactorAlpha = sourceA; + } + + if( IsInlineProperty( match.Groups[ 5 ].Value, ref property ) ) + { + blendDataObj.DestFactorAlphaInline = property; + } + else + { + AvailableBlendFactor destA = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), match.Groups[ 5 ].Value ); + blendDataObj.DestFactorAlpha = destA; + } + + blendDataObj.SeparateBlendFactors = true; + } + else + { + blendDataObj.SeparateBlendFactors = false; + } + blendDataObj.Target = match.Groups[ 1 ].Value; + blendDataObj.BlendModeOff = false; + noMatches = false; + } + catch( Exception e ) + { + Debug.LogException( e ); + blendDataObj.DataCheck = TemplateDataCheck.Invalid; + blendDataObj.ValidBlendMode = false; + return; + } + } + } + } + + if( noMatches ) + blendDataObj.ValidBlendMode = false; + } + + public static void CreateBlendOp( string blendOpData, ref TemplateBlendData blendDataObj, string pattern ) + { + bool noMatches = true; + blendDataObj.ValidBlendOp = true; + string property = string.Empty; + // TODO: OPTIMIZE REGEX EXPRESSIONS TO NOT CATCH EMPTY GROUPS + Match match = Regex.Match( blendOpData, pattern ); + { + if( match.Groups.Count == 3 ) + { + if( match.Groups[ 0 ].Success && match.Groups[ 2 ].Success ) + { + + try + { + if( IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + blendDataObj.BlendOpRGBInline = property; + } + else + { + AvailableBlendOps blendOpsAll = (AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), match.Groups[ 2 ].Value ); + blendDataObj.BlendOpRGB = blendOpsAll; + } + blendDataObj.SeparateBlendOps = false; + blendDataObj.Target = match.Groups[ 1 ].Value; + noMatches = false; + } + catch( Exception e ) + { + Debug.LogException( e ); + blendDataObj.DataCheck = TemplateDataCheck.Invalid; + blendDataObj.ValidBlendOp = false; + return; + } + } + } + else if( match.Groups.Count == 4 ) + { + if( match.Groups[ 0 ].Success && match.Groups[ 2 ].Success ) + { + try + { + if( IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + blendDataObj.BlendOpRGBInline = property; + } + else + { + AvailableBlendOps blendOpsRGB = (AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), match.Groups[ 2 ].Value ); + blendDataObj.BlendOpRGB = blendOpsRGB; + } + + if( match.Groups[ 3 ].Success ) + { + if( IsInlineProperty( match.Groups[ 3 ].Value, ref property ) ) + { + blendDataObj.BlendOpAlphaInline = property; + } + else + { + AvailableBlendOps blendOpsA = (AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), match.Groups[ 3 ].Value ); + blendDataObj.BlendOpAlpha = blendOpsA; + } + blendDataObj.SeparateBlendOps = true; + } + else + { + blendDataObj.SeparateBlendOps = false; + } + blendDataObj.Target = match.Groups[ 1 ].Value; + noMatches = false; + } + catch( Exception e ) + { + Debug.LogException( e ); + blendDataObj.DataCheck = TemplateDataCheck.Invalid; + blendDataObj.ValidBlendOp = false; + return; + } + } + } + } + + if( noMatches ) + blendDataObj.ValidBlendOp = false; + } + + public static string ProcessSRPConditionals( string body ) + { + int srpVersion = ASEPackageManagerHelper.PackageSRPVersion; + var processedSignatures = new HashSet(); + + foreach ( Match match in Regex.Matches( body, SRPConditionPattern ) ) + { + string signature; + if ( match.Success && match.Groups.Count == 4 && !processedSignatures.Contains( signature = match.Groups[ 0 ].Value ) ) + { + string comparisonOp = match.Groups[ 1 ].Value; + bool validVersion = int.TryParse( match.Groups[ 2 ].Value, out int version ); + string content = match.Groups[ 3 ].Value; + + if ( validVersion && !string.IsNullOrEmpty( comparisonOp ) && version >= 100000 ) + { + bool passed = false; + switch ( comparisonOp ) + { + case "==": passed = ( srpVersion == version ); break; + case "!=": passed = ( srpVersion != version ); break; + case ">=": passed = ( srpVersion >= version ); break; + case "<=": passed = ( srpVersion <= version ); break; + case ">" : passed = ( srpVersion > version ); break; + case "<" : passed = ( srpVersion < version ); break; + } + + if ( passed ) + { + // @diogo: test passed? include conditional text + body = body.Replace( signature, content ); + } + else + { + // @diogo: test failed? exclude conditional text + body = body.Replace( signature, string.Empty ); + } + } + else + { + // @diogo: fell here? ignore conditional + body = body.Replace( signature, string.Empty ); + } + + // @diogo: mark as processed to prevent duplicates + processedSignatures.Add( signature ); + } + } + return body; + } + + public static int GetUnityVersion() + { + var versionParts = Application.unityVersion.Split( '.', 'f' ); + if ( versionParts.Length != 4 || versionParts[ 0 ].Length < 4 ) + { + // @diogo: invalid Unity version format; ignore these conditionals + return 0; + } + + bool testMajor = int.TryParse( versionParts[ 0 ], out int major ); + bool testMinor = int.TryParse( versionParts[ 1 ], out int minor ); + bool testPatch = int.TryParse( versionParts[ 2 ], out int patch ); + if ( !testMajor || !testMinor || !testPatch ) + { + // @diogo: invalid Unity version format; ignore these conditionals + return 0; + } + + return major * 10000 + minor * 100 + patch; + } + + public static bool GetUnityBetaVersion( out int betaVersion ) + { + string version = Application.unityVersion; + if ( !version.Contains( "b" ) ) + { + betaVersion = 0; + return false; + } + + var versionParts = version.Split( 'b' ); + if ( versionParts.Length != 2 || versionParts[ 0 ].Length < 4 ) + { + // @diogo: invalid Unity version format; ignore these conditionals + betaVersion = 0; + return false; + } + + bool testBeta = int.TryParse( versionParts[ 1 ], out int beta ); + if ( !testBeta ) + { + // @diogo: invalid Unity version format; ignore these conditionals + betaVersion = 0; + return false; + } + + betaVersion = beta; + return true; + } + + public static string ProcessUnityConditionals( string body ) + { + int unityVersion = GetUnityVersion(); + if ( unityVersion <= 0 ) + { + return body; + } + var processedSignatures = new HashSet(); + + foreach ( Match match in Regex.Matches( body, UnityConditionPattern ) ) + { + string signature; + if ( match.Success && match.Groups.Count == 4 && !processedSignatures.Contains( signature = match.Groups[ 0 ].Value ) ) + { + string comparisonOp = match.Groups[ 1 ].Value; + bool validVersion = int.TryParse( match.Groups[ 2 ].Value, out int version ); + string content = match.Groups[ 3 ].Value; + + if ( validVersion && !string.IsNullOrEmpty( comparisonOp ) && version >= 20190000 ) + { + bool passed = false; + switch ( comparisonOp ) + { + case "==": passed = ( unityVersion == version ); break; + case "!=": passed = ( unityVersion != version ); break; + case ">=": passed = ( unityVersion >= version ); break; + case "<=": passed = ( unityVersion <= version ); break; + case ">" : passed = ( unityVersion > version ); break; + case "<" : passed = ( unityVersion < version ); break; + } + + if ( passed ) + { + // @diogo: test passed? include conditional text + body = body.Replace( signature, content ); + } + else + { + // @diogo: test failed? exclude conditional text + body = body.Replace( signature, string.Empty ); + } + } + else + { + // @diogo: fell here? ignore conditional + body = body.Replace( signature, string.Empty ); + } + + // @diogo: mark as processed to prevent duplicates + processedSignatures.Add( signature ); + } + } + return body; + } + + public static void FetchLocalVars( string body, ref List localVarList, TemplateFunctionData vertexFunction, TemplateFunctionData fragFunction ) + { + foreach( Match match in Regex.Matches( body, LocalVarPattern ) ) + { + if( match.Groups.Count == 4 ) + { + if( CgToWirePortType.ContainsKey( match.Groups[ 2 ].Value ) ) + { + MasterNodePortCategory category; + if( fragFunction.MainBodyLocalIdx > vertexFunction.MainBodyLocalIdx ) + { + if( match.Index < fragFunction.MainBodyLocalIdx ) + { + category = MasterNodePortCategory.Vertex; + } + else + { + category = MasterNodePortCategory.Fragment; + } + } + else + { + if( match.Index < vertexFunction.MainBodyLocalIdx ) + { + category = MasterNodePortCategory.Fragment; + } + else + { + category = MasterNodePortCategory.Vertex; + } + } + + if( !string.IsNullOrEmpty( match.Groups[ 1 ].Value ) && ShortcutToInfo.ContainsKey( match.Groups[ 1 ].Value ) ) + { + string id = match.Groups[ 0 ].Value.Substring( 0, match.Groups[ 0 ].Value.IndexOf( "*/" ) + 2 ); + TemplateLocalVarData data = new TemplateLocalVarData( ShortcutToInfo[ match.Groups[ 1 ].Value ], id, CgToWirePortType[ match.Groups[ 2 ].Value ], category, match.Groups[ 3 ].Value, match.Index ); + localVarList.Add( data ); + } + else + { + TemplateLocalVarData data = new TemplateLocalVarData( CgToWirePortType[ match.Groups[ 2 ].Value ], category, match.Groups[ 3 ].Value, match.Index ); + localVarList.Add( data ); + } + + } + } + } + } + + public static void FetchInlineVars( string body, ref TemplateIdManager idManager ) + { + foreach( Match match in Regex.Matches( body, InlinePattern ) ) + { + if( match.Success && match.Groups.Count == 2 ) + { + string id = match.Groups[ 0 ].Value; + string prop = match.Groups[ 1 ].Value; + idManager.RegisterTag( id, prop ); + } + } + } + + public static TemplateSRPType CreateTags( ref TemplateTagsModuleData tagsObj, bool isSubShader ) + { + TemplateSRPType srpType = TemplateSRPType.BiRP; + MatchCollection matchColl = Regex.Matches( tagsObj.TagsId, TagsPattern, RegexOptions.IgnorePatternWhitespace ); + int count = matchColl.Count; + if( count > 0 ) + { + for( int i = 0; i < count; i++ ) + { + if( matchColl[ i ].Groups.Count == 3 ) + { + if( isSubShader && matchColl[ i ].Groups[ 1 ].Value.Equals( "RenderPipeline" ) ) + { + if( TagToRenderPipeline.ContainsKey( matchColl[ i ].Groups[ 2 ].Value ) ) + srpType = TagToRenderPipeline[ matchColl[ i ].Groups[ 2 ].Value ]; + } + tagsObj.Tags.Add( new TemplatesTagData( matchColl[ i ].Groups[ 1 ].Value, matchColl[ i ].Groups[ 2 ].Value ) ); + } + } + } + return srpType; + } + + public static void CreateZWriteMode( string zWriteData, ref TemplateDepthData depthDataObj ) + { + depthDataObj.DataCheck = TemplateDataCheck.Invalid; + Match match = Regex.Match( zWriteData, ZWritePattern ); + if( match.Groups.Count == 2 ) + { + string property = string.Empty; + if( match.Groups[ 1 ].Success && IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) + { + depthDataObj.ZWriteInlineValue = property; + depthDataObj.DataCheck = TemplateDataCheck.Valid; + depthDataObj.ValidZWrite = true; + } + else + { + try + { + depthDataObj.ZWriteModeValue = (ZWriteMode)Enum.Parse( typeof( ZWriteMode ), match.Groups[ 1 ].Value ); + depthDataObj.DataCheck = TemplateDataCheck.Valid; + depthDataObj.ValidZWrite = true; + } + catch + { + depthDataObj.DataCheck = TemplateDataCheck.Invalid; + } + } + } + } + + public static void CreateZTestMode( string zTestData, ref TemplateDepthData depthDataObj ) + { + depthDataObj.DataCheck = TemplateDataCheck.Invalid; + Match match = Regex.Match( zTestData, ZTestPattern ); + if( match.Groups.Count == 2 ) + { + string property = string.Empty; + if( match.Groups[ 1 ].Success && IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) + { + depthDataObj.ZTestInlineValue = property; + depthDataObj.DataCheck = TemplateDataCheck.Valid; + depthDataObj.ValidZTest = true; + } + else + { + try + { + depthDataObj.ZTestModeValue = (ZTestMode)Enum.Parse( typeof( ZTestMode ), match.Groups[ 1 ].Value ); + depthDataObj.DataCheck = TemplateDataCheck.Valid; + depthDataObj.ValidZTest = true; + } + catch + { + depthDataObj.DataCheck = TemplateDataCheck.Invalid; + } + } + } + } + + public static void CreateZOffsetMode( string zOffsetData, ref TemplateDepthData depthDataObj ) + { + depthDataObj.DataCheck = TemplateDataCheck.Invalid; + Match match = Regex.Match( zOffsetData, ZOffsetPattern ); + if( match.Groups.Count == 3 ) + { + try + { + string property = string.Empty; + + if( match.Groups[ 1 ].Success && IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) + { + depthDataObj.OffsetFactorInlineValue = property; + } + else + { + depthDataObj.OffsetFactor = Convert.ToSingle( match.Groups[ 1 ].Value ); + } + + if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) + { + depthDataObj.OffsetUnitsInlineValue = property; + } + else + { + depthDataObj.OffsetUnits = Convert.ToSingle( match.Groups[ 2 ].Value ); + } + + depthDataObj.ValidOffset = true; + depthDataObj.DataCheck = TemplateDataCheck.Valid; + } + catch + { + depthDataObj.DataCheck = TemplateDataCheck.Invalid; + } + } + } + + public static List CreateVertexDataList( string vertexData, string parametersBody ) + { + List vertexDataList = null; + Dictionary vertexDataDict = null; + + foreach( Match match in Regex.Matches( vertexData, VertexDataPattern ) ) + { + if( match.Groups.Count > 1 ) + { + if( vertexDataList == null ) + { + vertexDataList = new List(); + vertexDataDict = new Dictionary(); + } + + WirePortDataType dataType = CgToWirePortType[ match.Groups[ 1 ].Value ]; + string varName = match.Groups[ 2 ].Value; + TemplateSemantics semantics = TemplateSemantics.NONE; + try + { + semantics = (TemplateSemantics)Enum.Parse( typeof( TemplateSemantics ), match.Groups[ 3 ].Value ); + } + catch(Exception e) + { + Debug.LogException( e ); + } + TemplateVertexData templateVertexData = new TemplateVertexData( semantics, dataType, varName ); + vertexDataList.Add( templateVertexData ); + vertexDataDict.Add( semantics, templateVertexData ); + } + } + + if( vertexData.Contains( Constants.InstanceIdMacro ) ) + { + if( vertexDataList == null ) + { + vertexDataList = new List(); + vertexDataDict = new Dictionary(); + } + TemplateVertexData templateVertexData = new TemplateVertexData( TemplateSemantics.SV_InstanceID, WirePortDataType.UINT, Constants.InstanceIdVariable ); + templateVertexData.DataInfo = TemplateInfoOnSematics.INSTANCE_ID; + templateVertexData.Available = true; + templateVertexData.ExcludeStructPrefix = true; + + vertexDataList.Add( templateVertexData ); + vertexDataDict.Add( TemplateSemantics.SV_InstanceID, templateVertexData ); + } + + if( !string.IsNullOrEmpty( parametersBody ) ) + { + string[] paramsArray = parametersBody.Split( IOUtils.FIELD_SEPARATOR ); + if( paramsArray.Length > 0 ) + { + for( int i = 0; i < paramsArray.Length; i++ ) + { + string[] paramDataArr = paramsArray[ i ].Split( IOUtils.VALUE_SEPARATOR ); + if( paramDataArr.Length == 2 ) + { + string[] swizzleInfoArr = paramDataArr[ 1 ].Split( IOUtils.FLOAT_SEPARATOR ); + TemplateSemantics semantic = ShortcutToSemantic[ swizzleInfoArr[ 0 ] ]; + if( vertexDataDict.ContainsKey( semantic ) ) + { + TemplateVertexData templateVertexData = vertexDataDict[ semantic ]; + if( templateVertexData != null ) + { + if( swizzleInfoArr.Length > 1 ) + { + templateVertexData.DataSwizzle = "." + swizzleInfoArr[ 1 ]; + } + templateVertexData.DataInfo = ShortcutToInfo[ paramDataArr[ 0 ] ]; + templateVertexData.Available = true; + } + } + } + } + } + } + + if( vertexDataDict != null ) + { + vertexDataDict.Clear(); + vertexDataDict = null; + } + + return vertexDataList; + } + + public static TemplateInterpData CreateInterpDataList( string interpData, string fullLine, int maxInterpolators ) + { + TemplateInterpData interpDataObj = null; + List interpDataList = null; + Dictionary interpDataDict = null; + Match rangeMatch = Regex.Match( fullLine, InterpRangePattern ); + if( rangeMatch.Groups.Count > 0 ) + { + interpDataObj = new TemplateInterpData(); + // Get range of available interpolators + int minVal = 0; + int maxVal = 0; + try + { + string[] minValArgs = rangeMatch.Groups[ 1 ].Value.Split( IOUtils.FLOAT_SEPARATOR ); + minVal = Convert.ToInt32( minValArgs[ 0 ] ); + if( string.IsNullOrEmpty( rangeMatch.Groups[ 2 ].Value ) ) + { + maxVal = maxInterpolators - 1; + interpDataObj.DynamicMax = true; + } + else + { + maxVal = Convert.ToInt32( rangeMatch.Groups[ 2 ].Value ); + } + if( minVal > maxVal ) + { + //int aux = minVal; + //minVal = maxVal; + //maxVal = aux; + maxVal = minVal; + } + + for( int i = minVal; i <= maxVal; i++ ) + { + interpDataObj.AvailableInterpolators.Add( new TemplateInterpElement( IntToSemantic[ i ] ) ); + } + if( minValArgs.Length > 1 ) + { + interpDataObj.AvailableInterpolators[ 0 ].SetAvailableChannelsFromString( minValArgs[ 1 ] ); + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + interpDataList = new List(); + interpDataDict = new Dictionary(); + + //Get Current interpolators + int parametersBeginIdx = fullLine.IndexOf( ":" ) + 1; + int parametersEnd = fullLine.IndexOf( TemplatesManager.TemplateEndOfLine ); + string parametersBody = fullLine.Substring( parametersBeginIdx, parametersEnd - parametersBeginIdx ); + + foreach( Match match in Regex.Matches( interpData, VertexDataPattern ) ) + { + if( match.Groups.Count > 1 ) + { + WirePortDataType dataType = CgToWirePortType[ match.Groups[ 1 ].Value ]; + string varName = match.Groups[ 2 ].Value; + TemplateSemantics semantics = TemplateSemantics.NONE; + try + { + semantics = (TemplateSemantics)Enum.Parse( typeof( TemplateSemantics ), match.Groups[ 3 ].Value ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + TemplateVertexData templateVertexData = new TemplateVertexData( semantics, dataType, varName ); + //interpDataList.Add( templateVertexData ); + interpDataDict.Add( semantics, templateVertexData ); + interpDataObj.RawInterpolators.Add( templateVertexData ); + //Check if they are also on the free channels list and update their names + interpDataObj.ReplaceNameOnInterpolator( semantics, varName ); + } + } + + if( interpData.Contains( Constants.InstanceIdMacro ) ) + { + TemplateVertexData templateInterpData = new TemplateVertexData( TemplateSemantics.SV_InstanceID, WirePortDataType.UINT, Constants.InstanceIdVariable ); + templateInterpData.DataInfo = TemplateInfoOnSematics.INSTANCE_ID; + templateInterpData.Available = true; + templateInterpData.ExcludeStructPrefix = true; + interpDataList.Add( templateInterpData ); + interpDataDict.Add( TemplateSemantics.SV_InstanceID, templateInterpData ); + } + + Dictionary auxDict = new Dictionary(); + // Get info for available interpolators + string[] paramsArray = parametersBody.Split( IOUtils.FIELD_SEPARATOR ); + if( paramsArray.Length > 0 ) + { + for( int i = 0; i < paramsArray.Length; i++ ) + { + string[] paramDataArr = paramsArray[ i ].Split( IOUtils.VALUE_SEPARATOR ); + if( paramDataArr.Length == 2 ) + { + string[] swizzleInfoArr = paramDataArr[ 1 ].Split( IOUtils.FLOAT_SEPARATOR ); + TemplateSemantics semantic = ShortcutToSemantic[ swizzleInfoArr[ 0 ] ]; + if( interpDataDict.ContainsKey( semantic ) ) + { + if( interpDataDict[ semantic ] != null ) + { + string[] multiComponent = paramDataArr[ 0 ].Split( IOUtils.FLOAT_SEPARATOR ); + + if( multiComponent.Length > 1 ) + { + TemplateVertexData templateInterpData = null; + if( auxDict.ContainsKey( multiComponent[ 0 ] ) ) + { + templateInterpData = auxDict[ multiComponent[ 0 ] ]; + } + else + { + templateInterpData = new TemplateVertexData( interpDataDict[ semantic ] ); + //if( swizzleInfoArr.Length > 1 ) + //{ + // templateInterpData.DataSwizzle = "." + swizzleInfoArr[ 1 ]; + //} + templateInterpData.DataInfo = ShortcutToInfo[ multiComponent[ 0 ] ]; + templateInterpData.Available = true; + interpDataList.Add( templateInterpData ); + auxDict.Add( multiComponent[ 0 ], templateInterpData ); + } + + if( swizzleInfoArr[ 1 ].Length == multiComponent[ 1 ].Length ) + { + for( int channelIdx = 0; channelIdx < swizzleInfoArr[ 1 ].Length; channelIdx++ ) + { + templateInterpData.RegisterComponent( multiComponent[ 1 ][ channelIdx ], interpDataDict[ semantic ].VarName + "." + swizzleInfoArr[ 1 ][ channelIdx ] ); + } + } + } + else + { + TemplateVertexData templateInterpData = new TemplateVertexData( interpDataDict[ semantic ] ); + if( swizzleInfoArr.Length > 1 ) + { + templateInterpData.DataSwizzle = "." + swizzleInfoArr[ 1 ]; + } + templateInterpData.DataInfo = ShortcutToInfo[ paramDataArr[ 0 ] ]; + templateInterpData.Available = true; + interpDataList.Add( templateInterpData ); + } + } + } + } + } + } + + /*TODO: + 1) Remove interpDataList.Add( templateVertexData ); from initial foreach + 2) When looping though each foreach array element, create a new TemplateVertexData + from the one containted on the interpDataDict and add it to interpDataList + */ + for( int i = 0; i < interpDataList.Count; i++ ) + { + interpDataList[ i ].BuildVar(); + } + + auxDict.Clear(); + auxDict = null; + + interpDataObj.Interpolators = interpDataList; + interpDataDict.Clear(); + interpDataDict = null; + } + return interpDataObj; + } + + public static void FetchDependencies( TemplateInfoContainer dependencies, ref string body ) + { + int index = body.IndexOf( TemplatesManager.TemplateDependenciesListTag ); + if( index > 0 ) + { + dependencies.Index = index; + dependencies.Id = TemplatesManager.TemplateDependenciesListTag; + dependencies.Data = TemplatesManager.TemplateDependenciesListTag; + } + else + { + int lastIndex = body.LastIndexOf( '}' ); + if( lastIndex > 0 ) + { + body = body.Insert( lastIndex, "\t" + TemplatesManager.TemplateDependenciesListTag + "\n" ); + FetchDependencies( dependencies, ref body ); + } + } + } + + public static void FetchCustomInspector( TemplateInfoContainer inspectorContainer, ref string body ) + { + Match match = Regex.Match( body, CustomInspectorPattern, RegexOptions.Multiline ); + if( match != null && match.Groups.Count > 1 ) + { + inspectorContainer.Index = match.Index; + inspectorContainer.Id = match.Groups[ 0 ].Value; + inspectorContainer.Data = match.Groups[ 1 ].Value; + + if( inspectorContainer.Data.Equals( "UnityEditor.Experimental.Rendering.HDPipeline.HDLitGUI" ) ) + inspectorContainer.Data = "UnityEditor.Rendering.HighDefinition.HDLitGUI"; + } + else + { + int index = body.LastIndexOf( '}' ); + if( index > 0 ) + { + body = body.Insert( index, string.Format( "\tCustomEditor \"{0}\"\n", Constants.DefaultCustomInspector ) ); + FetchCustomInspector( inspectorContainer, ref body ); + } + } + } + + public static void FetchFallback( TemplateInfoContainer fallbackContainer, ref string body ) + { + Match match = Regex.Match( body, FallbackPattern, RegexOptions.Multiline | RegexOptions.IgnoreCase ); + if( match != null && match.Groups.Count > 1 ) + { + fallbackContainer.Index = match.Index; + fallbackContainer.Id = match.Groups[ 0 ].Value; + fallbackContainer.Data = match.Groups[ 1 ].Value; + } + else + { + int index = body.LastIndexOf( '}' ); + if( index > 0 ) + { + body = body.Insert( index, "\tFallback \"\"\n" ); + FetchFallback( fallbackContainer, ref body ); + } + } + } + + public static string AutoSwizzleData( string dataVar, WirePortDataType from, WirePortDataType to, bool isPosition ) + { + switch( from ) + { + case WirePortDataType.COLOR: + case WirePortDataType.FLOAT4: + { + switch( to ) + { + case WirePortDataType.FLOAT3: dataVar += ".xyz"; break; + case WirePortDataType.FLOAT2: dataVar += ".xy"; break; + case WirePortDataType.INT: + case WirePortDataType.FLOAT: dataVar += ".x"; break; + } + } + break; + case WirePortDataType.FLOAT3: + { + switch( to ) + { + case WirePortDataType.FLOAT4: dataVar = string.Format( "float4({0},{1})", dataVar,(isPosition?1:0) ); break; + case WirePortDataType.FLOAT2: dataVar += ".xy"; break; + case WirePortDataType.INT: + case WirePortDataType.FLOAT: dataVar += ".x"; break; + } + } + break; + case WirePortDataType.FLOAT2: + { + switch( to ) + { + case WirePortDataType.FLOAT4: dataVar = string.Format( "float4({0},0,{1})", dataVar , (isPosition ? 1 : 0) ); break; + case WirePortDataType.FLOAT3: dataVar = string.Format( "float3({0},0)", dataVar ); break; + case WirePortDataType.INT: + case WirePortDataType.FLOAT: dataVar += ".x"; break; + } + } + break; + case WirePortDataType.FLOAT: + { + switch( to ) + { + case WirePortDataType.FLOAT4: dataVar = string.Format( "float4({0},0,0,{1})", dataVar, ( isPosition ? 1 : 0 ) ); break; + case WirePortDataType.FLOAT3: dataVar = string.Format( "float3({0},0,0)", dataVar ); break; + case WirePortDataType.FLOAT2: dataVar = string.Format( "float2({0},0)", dataVar ); break; + } + } + break; + } + return dataVar; + } + + public static bool CheckIfTemplate( string assetPath ) + { + if( assetPath.EndsWith( ".shader" ) ) + { + if( File.Exists( assetPath ) ) + { + string body = IOUtils.LoadTextFileFromDisk( assetPath ); + return ( body.IndexOf( TemplatesManager.TemplateShaderNameBeginTag ) > -1 ); + } + } + return false; + } + + public static bool CheckIfCompatibles( WirePortDataType first, WirePortDataType second ) + { + switch( first ) + { + case WirePortDataType.OBJECT: + return true; + case WirePortDataType.FLOAT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + case WirePortDataType.INT: + { + switch( second ) + { + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + case WirePortDataType.SAMPLER1D: + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.SAMPLER2DARRAY: + case WirePortDataType.SAMPLERSTATE: + return false; + } + } + break; + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + switch( second ) + { + case WirePortDataType.FLOAT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + case WirePortDataType.INT: + case WirePortDataType.SAMPLER1D: + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.SAMPLER2DARRAY: + case WirePortDataType.SAMPLERSTATE: + return false; + } + } + break; + case WirePortDataType.SAMPLER1D: + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.SAMPLER2DARRAY: + { + switch( second ) + { + case WirePortDataType.FLOAT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + case WirePortDataType.COLOR: + case WirePortDataType.INT: + case WirePortDataType.SAMPLERSTATE: + return false; + } + } + break; + case WirePortDataType.SAMPLERSTATE: + { + switch( second ) + { + default: + return false; + case WirePortDataType.SAMPLERSTATE: + case WirePortDataType.OBJECT: + break; + } + } + break; + } + return true; + } + // Lightweight <-> Default functions + public static string WorldSpaceViewDir( MasterNodeDataCollector dataCollector, string worldPosVec3, bool normalize ) + { + string value = string.Empty; + if( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + value = string.Format( "_WorldSpaceCameraPos.xyz - {0}", worldPosVec3 ); + } + else + { + value = string.Format( "UnityWorldSpaceViewDir( {0} )", worldPosVec3 ); + } + + if( normalize ) + { + value = SafeNormalize( dataCollector, value ); + } + + return value; + } + + public static string SafeNormalize( MasterNodeDataCollector dataCollector, string value ) + { + if( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + value = string.Format( "SafeNormalize( {0} )", value ); + } + else + { + dataCollector.AddToIncludes( -1, Constants.UnityBRDFLib ); + value = string.Format( "Unity_SafeNormalize( {0} )", value ); + } + return value; + } + + public static bool IsInlineProperty( string data, ref string property ) + { + if( data.Length > 0 && data[ 0 ] == '[' && data[ data.Length - 1 ] == ']' ) + { + property = data.Substring( 1, data.Length - 2 ); + return true; + } + return false; + } + + // public static readonly string FetchDefaultDepthFormat = "UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture,UNITY_PROJ_COORD( {0} )))"; + public static readonly string FetchDefaultDepthFormat = "SAMPLE_DEPTH_TEXTURE( _CameraDepthTexture, {0}.xy )"; + public static readonly string FetchDefaultDepthFormatVertex = "SAMPLE_DEPTH_TEXTURE_LOD( _CameraDepthTexture, float4( {0}.xy, 0, 0 ) )"; + + public static readonly string FetchLWDepthFormat = "SHADERGRAPH_SAMPLE_SCENE_DEPTH( {0}.xy )"; + public static readonly string FetchLWDepthFormatVertex = "SHADERGRAPH_SAMPLE_SCENE_DEPTH_LOD( {0}.xy )"; + public static readonly string FetchHDDepthFormat = "SampleCameraDepth( {0}.xy )"; + + public static string CreateDepthFetch( MasterNodeDataCollector dataCollector, string screenPos ) + { + string screenDepthInstruction = string.Empty; + if( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.URP ) + { + if( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) + { + string m_functionBody = string.Empty; + GenerateLW( ref m_functionBody ); + dataCollector.AddFunctions( FetchLWDepthFormatVertex, m_functionBody, "0" ); + screenDepthInstruction = string.Format( FetchLWDepthFormatVertex, screenPos ); + } + else + screenDepthInstruction = string.Format( FetchLWDepthFormat, screenPos ); + } + else if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP ) + screenDepthInstruction = string.Format( FetchHDDepthFormat, screenPos ); + } + else + { + if( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) + screenDepthInstruction = string.Format( FetchDefaultDepthFormatVertex, screenPos ); + else + screenDepthInstruction = string.Format( FetchDefaultDepthFormat, screenPos ); + } + return screenDepthInstruction; + } + + public static void GenerateLW( ref string body ) + { + body = string.Empty; + IOUtils.AddFunctionHeader( ref body, "float SHADERGRAPH_SAMPLE_SCENE_DEPTH_LOD(float2 uv)" ); + IOUtils.AddFunctionLine( ref body, "#if defined(REQUIRE_DEPTH_TEXTURE)" ); + IOUtils.AddFunctionLine( ref body, "#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)" ); + IOUtils.AddFunctionLine( ref body, " \tfloat rawDepth = SAMPLE_TEXTURE2D_ARRAY_LOD(_CameraDepthTexture, sampler_CameraDepthTexture, uv, unity_StereoEyeIndex, 0).r;" ); + IOUtils.AddFunctionLine( ref body, "#else" ); + IOUtils.AddFunctionLine( ref body, " \tfloat rawDepth = SAMPLE_DEPTH_TEXTURE_LOD(_CameraDepthTexture, sampler_CameraDepthTexture, uv, 0);" ); + IOUtils.AddFunctionLine( ref body, "#endif" ); + IOUtils.AddFunctionLine( ref body, "return rawDepth;" ); + IOUtils.AddFunctionLine( ref body, "#endif // REQUIRE_DEPTH_TEXTURE" ); + IOUtils.AddFunctionLine( ref body, "return 0;" ); + IOUtils.CloseFunctionBody( ref body ); + } + + public static bool GetShaderModelForInterpolatorAmount( int interpAmount, ref string shaderModel ) + { + for( int i = 0; i < AvailableShaderModels.Length; i++ ) + { + if( AvailableInterpolators[ AvailableShaderModels[ i ] ] >= interpAmount ) + { + shaderModel = AvailableShaderModels[ i ]; + return true; + } + } + return false; + } + + public static string GetSubShaderFrom( string shaderBody ) + { + Match match = Regex.Match( shaderBody, FetchSubShaderBody, RegexOptions.Singleline ); + if( match.Success && match.Groups.Count > 1 ) + { + return match.Groups[ 1 ].Value; + } + + return string.Empty; + } + + public static void FillRenderingPlatform( TemplateRenderPlatformHelper renderPlatforms , string shaderBody ) + { + int tagIndex = shaderBody.IndexOf( TemplatesManager.TemplateRenderPlatformsTag ); + if( tagIndex > -1 ) + { + renderPlatforms.InitByTag( tagIndex ); + } + else + { + //Excluded + Match excludePlatformsMatch = Regex.Match( shaderBody , PragmaExcludeRendersPattern ); + if( excludePlatformsMatch.Success ) + { + renderPlatforms.InitByExcludeRenders( excludePlatformsMatch.Index, excludePlatformsMatch.Value ); + MatchCollection platformElements = Regex.Matches( excludePlatformsMatch.Groups[ 1 ].Value , PragmaRendererElement ); + try + { + for( int i = 0 ; i < platformElements.Count ; i++ ) + { + if( platformElements[ i ].Success ) + renderPlatforms.SetupPlatform( platformElements[ i ].Groups[ 1 ].Value , false ); + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + else //Only Renders + { + Match onlyRendersPlatformsMatch = Regex.Match( shaderBody , PragmaOnlyRendersPattern ); + if( onlyRendersPlatformsMatch.Success ) + { + renderPlatforms.InitByOnlyRenders( onlyRendersPlatformsMatch.Index, onlyRendersPlatformsMatch.Value ); + MatchCollection platformElements = Regex.Matches( onlyRendersPlatformsMatch.Groups[ 1 ].Value , PragmaRendererElement ); + try + { + for( int i = 0 ; i < platformElements.Count ; i++ ) + { + if( platformElements[ i ].Success ) + renderPlatforms.SetupPlatform( platformElements[ i ].Groups[ 1 ].Value, true ); + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + } + + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs.meta new file mode 100644 index 00000000..30e5b267 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 517aad6764d713946bc566f0a83cd44d +timeCreated: 1495548641 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs new file mode 100644 index 00000000..b21f3a6a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs @@ -0,0 +1,237 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplatePassId + { + public string PassId; + public bool RemoveFromShader; + } + + + [Serializable] + public class TemplateTag + { + public string Tag = string.Empty; + public string Replacement = string.Empty; + public string Output = string.Empty; + public TemplateTag( string tag, string replacement = null ) + { + Tag = tag; + if( replacement != null ) + { + Replacement = replacement; + Output = replacement; + } + } + } + + [Serializable] + public class TemplateId + { + public int StartIdx = -1; + public string UniqueID; + public string Tag; + public string ReplacementText; + public bool IsReplaced = false; + public bool EmptyReplacer = false; + public TemplateId( int bodyIdx, string uniqueID, string tag, bool emptyReplacer = false ) + { + StartIdx = bodyIdx; + UniqueID = uniqueID; + Tag = tag; + EmptyReplacer = emptyReplacer; + ReplacementText = emptyReplacer ? string.Empty : tag; + } + + public void SetReplacementText( string replacementText ) + { + ReplacementText = replacementText; + IsReplaced = true; + } + + public void Reset() + { + ReplacementText = EmptyReplacer?string.Empty:Tag; + IsReplaced = false; + } + } + + [Serializable] + public class TemplateIdManager + { + [SerializeField] + private bool m_isSorted = false; + [SerializeField] + private string m_shaderBody; + [SerializeField] + private List m_registeredIds = new List(); + + [SerializeField] + private List m_registeredTags = new List(); + + [SerializeField] + private List m_registeredPassIds = new List(); + + private Dictionary m_registeredIdsDict = new Dictionary(); + + public TemplateIdManager( string shaderBody ) + { + m_shaderBody = shaderBody; + } + + public void Destroy() + { + m_registeredPassIds.Clear(); + m_registeredPassIds = null; + + m_registeredTags.Clear(); + m_registeredTags = null; + + m_registeredIds.Clear(); + m_registeredIds = null; + if( m_registeredIdsDict != null ) + { + m_registeredIdsDict.Clear(); + m_registeredIdsDict = null; + } + } + + void RefreshIds() + { + if( m_registeredIdsDict == null ) + { + m_registeredIdsDict = new Dictionary(); + } + + if( m_registeredIdsDict.Count != m_registeredIds.Count ) + { + m_registeredIdsDict.Clear(); + int count = m_registeredIds.Count; + for( int i = 0; i < count; i++ ) + { + m_registeredIdsDict.Add( m_registeredIds[ i ].UniqueID, m_registeredIds[ i ] ); + } + } + } + + public void RegisterId( int bodyIdx, string uniqueID, string tag, bool emptyReplacer = false ) + { + if( bodyIdx < 0 ) + return; + + RefreshIds(); + + TemplateId templateId = new TemplateId( bodyIdx, uniqueID, tag, emptyReplacer ); + m_registeredIds.Add( templateId ); + m_registeredIdsDict.Add( uniqueID, templateId ); + } + + public void RegisterTag( string tag, string replacement = null ) + { + m_registeredTags.Add( new TemplateTag( tag, replacement ) ); + } + + public void RegisterPassId( string passId ) + { + m_registeredPassIds.Add( new TemplatePassId() { PassId = passId, RemoveFromShader = false } ); + } + + public void SetPassIdUsage( int idx , bool removeFromShader ) + { + m_registeredPassIds[ idx ].RemoveFromShader = removeFromShader; + } + + public void SetReplacementText( string uniqueId, string replacementText ) + { + RefreshIds(); + + if( m_registeredIdsDict.ContainsKey( uniqueId ) && m_registeredIdsDict[ uniqueId ].StartIdx >= 0 ) + m_registeredIdsDict[ uniqueId ].SetReplacementText( replacementText ); + } + + + public string BuildShader() + { + if( !m_isSorted ) + { + m_registeredIds.Sort( ( x, y ) => { return x.StartIdx.CompareTo( y.StartIdx ); } ); + } + + int idCount = m_registeredIds.Count; + int offset = 0; + string finalShaderBody = m_shaderBody; + for( int i = 0; i < idCount; i++ ) + { + if( m_registeredIds[ i ].StartIdx >= 0 && m_registeredIds[ i ].IsReplaced ) + { + finalShaderBody = finalShaderBody.ReplaceAt( m_registeredIds[ i ].Tag, m_registeredIds[ i ].ReplacementText, offset + m_registeredIds[ i ].StartIdx ); + offset += ( m_registeredIds[ i ].ReplacementText.Length - m_registeredIds[ i ].Tag.Length ); + } + } + + int count = m_registeredPassIds.Count; + for( int i = 0; i < count; i++ ) + { + if( m_registeredPassIds[ i ].RemoveFromShader ) + finalShaderBody = finalShaderBody.Replace( m_registeredPassIds[ i ].PassId, string.Empty ); + } + + for( int i = 0; i < idCount; i++ ) + { + if( !m_registeredIds[ i ].IsReplaced && !m_registeredIds[ i ].Tag.Equals( m_registeredIds[ i ].ReplacementText ) ) + { + finalShaderBody = finalShaderBody.Replace( m_registeredIds[ i ].Tag, m_registeredIds[ i ].ReplacementText ); + } + } + + count = m_registeredTags.Count; + for( int i = 0; i < count; i++ ) + { + TemplateTag tag = m_registeredTags[ i ]; + finalShaderBody = finalShaderBody.Replace( tag.Tag, tag.Replacement ); + tag.Replacement = tag.Output; + } + + //finalShaderBody = finalShaderBody.Replace( TemplatesManager.TemplateExcludeFromGraphTag, string.Empty ); + //finalShaderBody = finalShaderBody.Replace( TemplatesManager.TemplateMainPassTag, string.Empty ); + + return finalShaderBody; + } + + public void ResetRegistersState() + { + int count = m_registeredIds.Count; + for( int i = 0; i < count; i++ ) + { + m_registeredIds[ i ].Reset(); + } + } + + public void Reset() + { + m_registeredIds.Clear(); + if( m_registeredIdsDict == null ) + { + m_registeredIdsDict = new Dictionary(); + } + else + { + m_registeredIdsDict.Clear(); + } + } + + public string ShaderBody + { + get { return m_shaderBody; } + set { m_shaderBody = value; } + } + + public List RegisteredTags { get { return m_registeredTags; } set { m_registeredTags = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs.meta new file mode 100644 index 00000000..8997b609 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b0d2e93061ffcbd45b085a61e5000daa +timeCreated: 1517315635 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs new file mode 100644 index 00000000..d71b0576 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs @@ -0,0 +1,239 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateInterpElement + { + public TemplateSemantics Semantic; + public bool[] AvailableChannels = { true, true, true, true }; + public bool IsFull = false; + public int Usage = 0; + public string Name; + //https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-struct + public bool NoInterpolation; + public bool Sample; + + public TemplateInterpElement( TemplateInterpElement other ) + { + Semantic = other.Semantic; + for ( int i = 0; i < AvailableChannels.Length; i++ ) + { + AvailableChannels[ i ] = other.AvailableChannels[ i ]; + } + IsFull = other.IsFull; + Usage = other.Usage; + Name = other.Name; + NoInterpolation = other.NoInterpolation; + Sample = other.Sample; + } + + public TemplateInterpElement( TemplateSemantics semantic ) + { + Semantic = semantic; + int semanticId = TemplateHelperFunctions.SemanticToInt[ Semantic ]; + Name = ( semanticId == 0 ) ? TemplateHelperFunctions.BaseInterpolatorName : TemplateHelperFunctions.BaseInterpolatorName + semanticId.ToString(); + } + + public void SetAvailableChannelsFromString( string channels ) + { + for ( int i = 0; i < AvailableChannels.Length; i++ ) + { + AvailableChannels[ i ] = false; + } + Usage = AvailableChannels.Length; + + for ( int i = 0; i < channels.Length; i++ ) + { + switch ( channels[ i ] ) + { + case 'x': if ( !AvailableChannels[ 0 ] ) { AvailableChannels[ 0 ] = true; Usage--; } break; + case 'y': if ( !AvailableChannels[ 1 ] ) { AvailableChannels[ 1 ] = true; Usage--; } break; + case 'z': if ( !AvailableChannels[ 2 ] ) { AvailableChannels[ 2 ] = true; Usage--; } break; + case 'w': if ( !AvailableChannels[ 3 ] ) { AvailableChannels[ 3 ] = true; Usage--; } break; + } + } + } + + public TemplateVertexData RequestChannels( WirePortDataType type, bool isColor, string customName = null ) + { + if ( IsFull ) + return null; + + int channelsRequired = TemplateHelperFunctions.DataTypeChannelUsage[ type ]; + if ( channelsRequired == 0 ) + return null; + + int firstChannel = -1; + for ( int i = 0; i < AvailableChannels.Length; i++ ) + { + if ( AvailableChannels[ i ] ) + { + if ( firstChannel < 0 ) + { + firstChannel = i; + } + channelsRequired -= 1; + if ( channelsRequired == 0 ) + break; + } + } + + //did not found enough channels to fill request + if ( channelsRequired > 0 ) + return null; + + if( Usage == 0 && customName != null ) + { + Name = customName; + } + + Usage += 1; + TemplateVertexData data = null; + + if ( type == WirePortDataType.COLOR || type == WirePortDataType.FLOAT4 ) + { + // Automatically lock all channels + for ( int i = firstChannel; i < ( firstChannel + channelsRequired ); i++ ) + { + AvailableChannels[ i ] = false; + } + IsFull = true; + data = new TemplateVertexData( Semantic, type, Name ); + } + else + { + string[] swizzleArray = ( isColor ) ? TemplateHelperFunctions.ColorSwizzle : TemplateHelperFunctions.VectorSwizzle; + string channels = "."; + int count = firstChannel + TemplateHelperFunctions.DataTypeChannelUsage[ type ]; + for ( int i = firstChannel; i < count; i++ ) + { + AvailableChannels[ i ] = false; + channels += swizzleArray[ i ]; + if ( i == ( AvailableChannels.Length - 1 ) ) + { + IsFull = true; + } + } + + data = new TemplateVertexData( Semantic, type, Name, channels ); + } + return data; + } + } + + [Serializable] + public class TemplateInterpData + { + [SerializeField] + private string m_interpDataId = string.Empty; + + [SerializeField] + private int m_interpDataStartIdx = -1; + + [SerializeField] + private bool m_dynamicMax = false; + + public List AvailableInterpolators = new List(); + public List Interpolators = new List(); + public List RawInterpolators = new List(); + + public TemplateInterpData() { } + + public bool HasRawInterpolatorOfName( string name ) + { + return RawInterpolators.Exists( ( x ) => x.VarName.Equals( name )); + } + + public TemplateInterpData( TemplateInterpData other ) + { + m_dynamicMax = other.DynamicMax; + + foreach ( TemplateInterpElement data in other.AvailableInterpolators ) + { + AvailableInterpolators.Add( new TemplateInterpElement( data ) ); + } + + for ( int i = 0; i < other.Interpolators.Count; i++ ) + { + Interpolators.Add( new TemplateVertexData( other.Interpolators[ i ] ) ); + } + + for( int i = 0; i < other.RawInterpolators.Count; i++ ) + { + RawInterpolators.Add( new TemplateVertexData( other.RawInterpolators[ i ] ) ); + } + } + + + public void RecalculateAvailableInterpolators( int newMax ) + { + if( m_dynamicMax ) + { + if( !TemplateHelperFunctions.IntToSemantic.ContainsKey( ( newMax - 1 ) ) ) + { + Debug.LogWarning( "Attempting to add inexisting available interpolators" ); + return; + } + + if( AvailableInterpolators.Count > 0 ) + { + int currMax = 1 + TemplateHelperFunctions.SemanticToInt[ AvailableInterpolators[ AvailableInterpolators.Count - 1 ].Semantic ]; + if( newMax > currMax ) + { + int count = newMax - currMax; + for( int i = 0; i < count; i++ ) + { + AvailableInterpolators.Add( new TemplateInterpElement( TemplateHelperFunctions.IntToSemantic[ currMax + i ] )); + } + } + else if( newMax < currMax ) + { + int min = TemplateHelperFunctions.SemanticToInt[ AvailableInterpolators[ 0 ].Semantic ]; + if( newMax > min ) + { + int count = currMax - newMax; + for( int i = 0; i < count; i++ ) + { + AvailableInterpolators.RemoveAt( AvailableInterpolators.Count - 1 ); + } + } + } + } + } + } + + public void ReplaceNameOnInterpolator( TemplateSemantics semantic, string newName ) + { + for ( int i = 0; i < AvailableInterpolators.Count; i++ ) + { + if ( AvailableInterpolators[ i ].Semantic == semantic ) + { + AvailableInterpolators[ i ].Name = newName; + break; + } + } + } + + public void Destroy() + { + AvailableInterpolators.Clear(); + AvailableInterpolators = null; + + Interpolators.Clear(); + Interpolators = null; + + RawInterpolators.Clear(); + RawInterpolators = null; + } + + public string InterpDataId { get { return m_interpDataId; } set { m_interpDataId = value; } } + public int InterpDataStartIdx { get { return m_interpDataStartIdx; } set { m_interpDataStartIdx = value; } } + public bool DynamicMax { get { return m_dynamicMax; } set { m_dynamicMax = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs.meta new file mode 100644 index 00000000..81448f4f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 8f700ba5366bcda45beea5c0e2db9f3e +timeCreated: 1496053368 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs new file mode 100644 index 00000000..3cde2f03 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs @@ -0,0 +1,59 @@ +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateLocalVarData + { + [SerializeField] + private WirePortDataType m_dataType = WirePortDataType.OBJECT; + + [SerializeField] + private string m_localVarName = string.Empty; + + [SerializeField] + private int m_position = -1; + + [SerializeField] + private bool m_isSpecialVar = false; + + [SerializeField] + private TemplateInfoOnSematics m_specialVarType; + + [SerializeField] + private MasterNodePortCategory m_category; + + [SerializeField] + private string m_id; + + public TemplateLocalVarData( WirePortDataType dataType, MasterNodePortCategory category, string localVarName, int position ) + { + m_dataType = dataType; + m_localVarName = localVarName; + m_position = position; + m_category = category; + //Debug.Log( m_localVarName + " " + m_inputData.PortCategory + " " + m_inputData.PortName ); + } + + public TemplateLocalVarData( TemplateInfoOnSematics specialVarType,string id, WirePortDataType dataType, MasterNodePortCategory category, string localVarName, int position ) + { + m_id = id; + m_dataType = dataType; + m_localVarName = localVarName; + m_position = position; + m_specialVarType = specialVarType; + m_isSpecialVar = true; + m_category = category; + //Debug.Log( m_localVarName + " " + m_inputData.PortCategory + " " + m_inputData.PortName ); + } + + public WirePortDataType DataType { get { return m_dataType; } } + public string LocalVarName { get { return m_localVarName; } } + public int Position { get { return m_position; } } + public bool IsSpecialVar { get { return m_isSpecialVar; } } + public TemplateInfoOnSematics SpecialVarType{ get { return m_specialVarType; } } + public MasterNodePortCategory Category { get { return m_category; } } + public string Id { get { return m_id; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs.meta new file mode 100644 index 00000000..026cf2d1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4c6ad22d8633c7142ae0237479df76ed +timeCreated: 1518017743 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs new file mode 100644 index 00000000..2110a063 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs @@ -0,0 +1,275 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Template Local Var Data" , "Surface Data" , "Select and use available local variable data from the template" )] + public sealed class TemplateLocalVarsNode : TemplateNodeParent + { + private List m_localVarsData = null; + + [SerializeField] + private int m_currentDataIdx = -1; + + [SerializeField] + private string m_dataName = string.Empty; + + private string[] m_dataLabels = null; + + private bool m_fetchDataId = false; + private UpperLeftWidgetHelper m_upperLeftWidgetHelper = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_autoWrapProperties = true; + } + + void FetchDataId() + { + if( m_localVarsData != null && m_localVarsData.Count > 0 ) + { + m_currentDataIdx = 0; + int count = m_localVarsData.Count; + m_dataLabels = new string[ count ]; + for( int i = 0 ; i < count ; i++ ) + { + m_dataLabels[ i ] = m_localVarsData[ i ].LocalVarName; + if( m_localVarsData[ i ].LocalVarName.Equals( m_dataName ) ) + { + m_currentDataIdx = i; + } + } + UpdateFromId(); + } + else + { + m_currentDataIdx = -1; + } + } + + void UpdateFromId() + { + if( m_localVarsData != null ) + { + if( m_localVarsData.Count == 0 ) + { + for( int i = 0 ; i < 4 ; i++ ) + m_containerGraph.DeleteConnection( false , UniqueId , i , false , true ); + + m_headerColor = UIUtils.GetColorFromCategory( "Default" ); + SetAdditonalTitleText( "" ); + m_additionalContent.text = string.Empty; + m_outputPorts[ 0 ].ChangeProperties( "None" , WirePortDataType.OBJECT , false ); + ConfigurePorts(); + return; + } + + bool areCompatible = TemplateHelperFunctions.CheckIfCompatibles( m_outputPorts[ 0 ].DataType , m_localVarsData[ m_currentDataIdx ].DataType ); + string category = m_localVarsData[ m_currentDataIdx ].Category == MasterNodePortCategory.Fragment ? "Surface Data" : "Vertex Data"; + m_headerColor = UIUtils.GetColorFromCategory( category ); + switch( m_localVarsData[ m_currentDataIdx ].DataType ) + { + default: + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue , m_localVarsData[ m_currentDataIdx ].DataType , false ); + break; + case WirePortDataType.FLOAT2: + m_outputPorts[ 0 ].ChangeProperties( "XY" , m_localVarsData[ m_currentDataIdx ].DataType , false ); + break; + case WirePortDataType.FLOAT3: + m_outputPorts[ 0 ].ChangeProperties( "XYZ" , m_localVarsData[ m_currentDataIdx ].DataType , false ); + break; + case WirePortDataType.FLOAT4: + m_outputPorts[ 0 ].ChangeProperties( "XYZW" , m_localVarsData[ m_currentDataIdx ].DataType , false ); + break; + case WirePortDataType.COLOR: + m_outputPorts[ 0 ].ChangeProperties( "RGBA" , m_localVarsData[ m_currentDataIdx ].DataType , false ); + break; + } + + ConfigurePorts(); + + if( !areCompatible ) + { + m_containerGraph.DeleteConnection( false , UniqueId , 0 , false , true ); + } + + m_dataName = m_localVarsData[ m_currentDataIdx ].LocalVarName; + SetAdditonalTitleText( m_dataName ); + m_sizeIsDirty = true; + CheckWarningState(); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) + { + return; + } + + if( m_multiPassMode ) + { + DrawMultipassProperties(); + } + + if( m_currentDataIdx > -1 ) + { + EditorGUI.BeginChangeCheck(); + m_currentDataIdx = EditorGUILayoutPopup( DataLabelStr , m_currentDataIdx , m_dataLabels ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromId(); + } + } + } + protected override void OnSubShaderChange() + { + FetchLocalVarData(); + FetchDataId(); + } + + protected override void OnPassChange() + { + base.OnPassChange(); + FetchLocalVarData(); + FetchDataId(); + } + + void DrawMultipassProperties() + { + DrawSubShaderUI(); + DrawPassUI(); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) + return; + + if( m_localVarsData == null || m_localVarsData.Count == 0 ) + { + MasterNode masterNode = m_containerGraph.CurrentMasterNode; + if( masterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template ) + { + FetchLocalVarData( masterNode ); + } + } + + if( m_fetchDataId ) + { + m_fetchDataId = false; + FetchDataId(); + } + + if( m_currentDataIdx > -1 ) + { + EditorGUI.BeginChangeCheck(); + m_currentDataIdx = m_upperLeftWidgetHelper.DrawWidget( this , m_currentDataIdx , m_dataLabels ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromId(); + } + } + } + + public override string GenerateShaderForOutput( int outputId , ref MasterNodeDataCollector dataCollector , bool ignoreLocalvar ) + { + if( dataCollector.MasterNodeCategory != AvailableShaderTypes.Template ) + { + UIUtils.ShowMessage( "Template Local Vars node is only intended for templates use only" , MessageSeverity.Error ); + return m_outputPorts[ 0 ].ErrorValue; + } + + if( m_localVarsData[ m_currentDataIdx ].Category != dataCollector.PortCategory ) + { + UIUtils.ShowMessage( UniqueId , string.Format( "Local Var {0} can only work on ports of type {1}" , m_localVarsData[ m_currentDataIdx ].LocalVarName , m_localVarsData[ m_currentDataIdx ].Category ) ); + return m_outputPorts[ 0 ].ErrorValue; + } + + if( m_multiPassMode ) + { + if( dataCollector.TemplateDataCollectorInstance.MultipassSubshaderIdx != SubShaderIdx || + dataCollector.TemplateDataCollectorInstance.MultipassPassIdx != PassIdx + ) + { + UIUtils.ShowMessage( UniqueId , string.Format( "{0} is only intended for subshader {1} and pass {2}" , m_dataLabels[ m_currentDataIdx ] , SubShaderIdx , PassIdx ) ); + return m_outputPorts[ outputId ].ErrorValue; + } + } + + return GetOutputVectorItem( 0 , outputId , m_dataName ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_dataName = GetCurrentParam( ref nodeParams ); + m_fetchDataId = true; + } + + public override void WriteToString( ref string nodeInfo , ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo , ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_dataName ); + } + + public override void OnMasterNodeReplaced( MasterNode newMasterNode ) + { + base.OnMasterNodeReplaced( newMasterNode ); + if( newMasterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template ) + { + FetchLocalVarData( newMasterNode ); + } + else + { + m_localVarsData = null; + m_currentDataIdx = -1; + } + } + + void FetchLocalVarData( MasterNode masterNode = null ) + { + FetchMultiPassTemplate( masterNode ); + if( m_multiPassMode ) + { + if( m_templateMPData != null ) + { + m_localVarsData = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].LocalVarsList; + m_fetchDataId = true; + } + } + else + { + TemplateData currentTemplate = ( masterNode as TemplateMasterNode ).CurrentTemplate; + if( currentTemplate != null ) + { + m_localVarsData = currentTemplate.LocalVarsList; + m_fetchDataId = true; + } + else + { + m_localVarsData = null; + m_currentDataIdx = -1; + } + } + } + + public override void Destroy() + { + base.Destroy(); + m_dataLabels = null; + m_localVarsData = null; + m_upperLeftWidgetHelper = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs.meta new file mode 100644 index 00000000..c5ba3ec3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f708a5bf672ab004a9363a4a71f48f28 +timeCreated: 1518104790 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs new file mode 100644 index 00000000..883368b0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs @@ -0,0 +1,770 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +// THIS FILE IS DEPRECATED AND SHOULD NOT BE USED + +#define SHOW_TEMPLATE_HELP_BOX + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Template Master Node", "Master", "Shader Generated according to template rules", null, KeyCode.None, false, true, "Template MultiPass Master Node", typeof( TemplateMultiPassMasterNode ) )] + public sealed class TemplateMasterNode : MasterNode + { + private const string WarningMessage = "Templates is a feature that is still heavily under development and users may experience some problems.\nPlease email support@amplify.pt if any issue occurs."; + private const string CurrentTemplateLabel = "Current Template"; + private const string OpenTemplateStr = "Edit Template"; + + //protected const string SnippetsFoldoutStr = " Snippets"; + //[SerializeField] + //private bool m_snippetsFoldout = true; + + [NonSerialized] + private TemplateData m_currentTemplate = null; + + private bool m_fireTemplateChange = false; + private bool m_fetchMasterNodeCategory = false; + private bool m_reRegisterTemplateData = false; + + [SerializeField] + private string m_templateGUID = string.Empty; + + [SerializeField] + private string m_templateName = string.Empty; + + [SerializeField] + private TemplatesBlendModule m_blendOpHelper = new TemplatesBlendModule(); + + [SerializeField] + private TemplateAlphaToMaskModule m_alphaToMaskHelper = new TemplateAlphaToMaskModule(); + + [SerializeField] + private TemplateCullModeModule m_cullModeHelper = new TemplateCullModeModule(); + + [SerializeField] + private TemplateColorMaskModule m_colorMaskHelper = new TemplateColorMaskModule(); + + [SerializeField] + private TemplatesStencilBufferModule m_stencilBufferHelper = new TemplatesStencilBufferModule(); + + [SerializeField] + private TemplateDepthModule m_depthOphelper = new TemplateDepthModule(); + + [SerializeField] + private TemplateTagsModule m_tagsHelper = new TemplateTagsModule(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_masterNodeCategory = 1;// First Template + m_marginPreviewLeft = 20; + m_insideSize.y = 60; + m_customPrecision = true; + } + + public override void ReleaseResources() + { + if( m_currentTemplate != null && m_currentTemplate.AvailableShaderProperties != null ) + { + // Unregister old template properties + int oldPropertyCount = m_currentTemplate.AvailableShaderProperties.Count; + for( int i = 0; i < oldPropertyCount; i++ ) + { + UIUtils.ReleaseUniformName( UniqueId, m_currentTemplate.AvailableShaderProperties[ i ].PropertyName ); + } + } + } + + public override void OnEnable() + { + base.OnEnable(); + m_reRegisterTemplateData = true; + } + + void FetchInfoFromTemplate() + { + if( m_currentTemplate.BlendData.DataCheck == TemplateDataCheck.Valid ) + m_blendOpHelper.ConfigureFromTemplateData( m_currentTemplate.BlendData ); + + if( m_currentTemplate.AlphaToMaskData.DataCheck == TemplateDataCheck.Valid ) + m_alphaToMaskHelper.ConfigureFromTemplateData( m_currentTemplate.AlphaToMaskData ); + + if( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) + m_cullModeHelper.ConfigureFromTemplateData( m_currentTemplate.CullModeData ); + + if( m_currentTemplate.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) + m_colorMaskHelper.ConfigureFromTemplateData( m_currentTemplate.ColorMaskData ); + + if( m_currentTemplate.StencilData.DataCheck == TemplateDataCheck.Valid ) + m_stencilBufferHelper.ConfigureFromTemplateData( m_currentTemplate.StencilData ); + + if( m_currentTemplate.DepthData.DataCheck == TemplateDataCheck.Valid ) + m_depthOphelper.ConfigureFromTemplateData( m_currentTemplate.DepthData ); + + if( m_currentTemplate.TagData.DataCheck == TemplateDataCheck.Valid ) + m_tagsHelper.ConfigureFromTemplateData( m_currentTemplate.TagData ); + } + + void FetchCurrentTemplate() + { + m_currentTemplate = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( m_templateGUID ) as TemplateData; + if( m_currentTemplate == null ) + { + m_currentTemplate = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( m_templateName ) as TemplateData; + } + + if( m_currentTemplate != null ) + { + if( m_inputPorts.Count != m_currentTemplate.InputDataList.Count ) + { + DeleteAllInputConnections( true ); + + List inputDataList = m_currentTemplate.InputDataList; + int count = inputDataList.Count; + for( int i = 0; i < count; i++ ) + { + AddInputPort( inputDataList[ i ].DataType, false, inputDataList[ i ].PortName, inputDataList[ i ].OrderId, inputDataList[ i ].PortCategory, inputDataList[ i ].PortUniqueId ); + } + FetchInfoFromTemplate(); + } + else + { + List inputDataList = m_currentTemplate.InputDataList; + int count = inputDataList.Count; + for( int i = 0; i < count; i++ ) + { + m_inputPorts[ i ].ChangeProperties( inputDataList[ i ].PortName, inputDataList[ i ].DataType, false ); + } + } + } + } + + public override void RefreshAvailableCategories() + { + FetchCurrentTemplate(); + + int templateCount = m_containerGraph.ParentWindow.TemplatesManagerInstance.TemplateCount; + m_availableCategories = new MasterNodeCategoriesData[ templateCount + 1 ]; + m_availableCategoryLabels = new GUIContent[ templateCount + 1 ]; + + m_availableCategories[ 0 ] = new MasterNodeCategoriesData( AvailableShaderTypes.SurfaceShader, string.Empty ); + m_availableCategoryLabels[ 0 ] = new GUIContent( "Surface" ); + if( m_currentTemplate == null ) + { + m_masterNodeCategory = -1; + } + + for( int i = 0; i < templateCount; i++ ) + { + int idx = i + 1; + TemplateData templateData = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( i ) as TemplateData; + + if( m_currentTemplate != null && m_currentTemplate.GUID.Equals( templateData.GUID ) ) + m_masterNodeCategory = idx; + + m_availableCategories[ idx ] = new MasterNodeCategoriesData( AvailableShaderTypes.Template, templateData.GUID ); + m_availableCategoryLabels[ idx ] = new GUIContent( templateData.Name ); + } + } + + void SetCategoryIdxFromTemplate() + { + int templateCount = m_containerGraph.ParentWindow.TemplatesManagerInstance.TemplateCount; + for( int i = 0; i < templateCount; i++ ) + { + int idx = i + 1; + TemplateData templateData = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( i ) as TemplateData; + if( templateData != null && m_currentTemplate != null && m_currentTemplate.GUID.Equals( templateData.GUID ) ) + m_masterNodeCategory = idx; + } + } + + public void SetTemplate( TemplateData newTemplate, bool writeDefaultData, bool fetchMasterNodeCategory ) + { + ReleaseResources(); + + if( newTemplate == null || newTemplate.InputDataList == null ) + return; + + m_fetchMasterNodeCategory = fetchMasterNodeCategory; + + DeleteAllInputConnections( true ); + m_currentTemplate = newTemplate; + m_currentShaderData = newTemplate.Name; + + List inputDataList = newTemplate.InputDataList; + int count = inputDataList.Count; + for( int i = 0; i < count; i++ ) + { + AddInputPort( inputDataList[ i ].DataType, false, inputDataList[ i ].PortName, inputDataList[ i ].OrderId, inputDataList[ i ].PortCategory, inputDataList[ i ].PortUniqueId ); + } + + if( writeDefaultData ) + { + ShaderName = newTemplate.DefaultShaderName; + } + + RegisterProperties(); + m_fireTemplateChange = true; + m_templateGUID = newTemplate.GUID; + m_templateName = newTemplate.DefaultShaderName; + FetchInfoFromTemplate(); + } + + void RegisterProperties() + { + if( m_currentTemplate != null ) + { + m_reRegisterTemplateData = false; + // Register old template properties + int newPropertyCount = m_currentTemplate.AvailableShaderProperties.Count; + for( int i = 0; i < newPropertyCount; i++ ) + { + int nodeId = UIUtils.CheckUniformNameOwner( m_currentTemplate.AvailableShaderProperties[ i ].PropertyName ); + if( nodeId > -1 ) + { + ParentNode node = m_containerGraph.GetNode( nodeId ); + if( node != null ) + { + UIUtils.ShowMessage( string.Format( "Template requires property name {0} which is currently being used by {1}. Please rename it and reload template.", m_currentTemplate.AvailableShaderProperties[ i ].PropertyName, node.Attributes.Name ) ); + } + else + { + UIUtils.ShowMessage( string.Format( "Template requires property name {0} which is currently being on your graph. Please rename it and reload template.", m_currentTemplate.AvailableShaderProperties[ i ].PropertyName ) ); + } + } + else + { + UIUtils.RegisterUniformName( UniqueId, m_currentTemplate.AvailableShaderProperties[ i ].PropertyName ); + } + } + } + } + + public override void DrawProperties() + { + if( m_currentTemplate == null ) + return; + + base.DrawProperties(); + + bool generalIsVisible = ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions; + NodeUtils.DrawPropertyGroup( ref generalIsVisible, GeneralFoldoutStr, DrawGeneralOptions ); + ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions = generalIsVisible; + + if( m_currentTemplate.AlphaToMaskData.DataCheck == TemplateDataCheck.Valid ) + m_alphaToMaskHelper.Draw( this ); + + if( m_currentTemplate.BlendData.DataCheck == TemplateDataCheck.Valid ) + m_blendOpHelper.Draw( this ); + + + if( m_currentTemplate.StencilData.DataCheck == TemplateDataCheck.Valid ) + { + CullMode cullMode = ( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) ? m_cullModeHelper.CurrentCullMode : CullMode.Back; + m_stencilBufferHelper.Draw( this, cullMode ); + } + + if( m_currentTemplate.DepthData.DataCheck == TemplateDataCheck.Valid ) + m_depthOphelper.Draw( this ); + + if( m_currentTemplate.TagData.DataCheck == TemplateDataCheck.Valid ) + m_tagsHelper.Draw( this ); + + DrawMaterialInputs( UIUtils.MenuItemToolbarStyle ); + + // NodeUtils.DrawPropertyGroup( ref m_snippetsFoldout, SnippetsFoldoutStr, DrawSnippetOptions ); + if( GUILayout.Button( OpenTemplateStr ) && m_currentTemplate != null ) + { + try + { + string pathname = AssetDatabase.GUIDToAssetPath( m_currentTemplate.GUID ); + if( !string.IsNullOrEmpty( pathname ) ) + { + Shader selectedTemplate = AssetDatabase.LoadAssetAtPath( pathname ); + if( selectedTemplate != null ) + { + AssetDatabase.OpenAsset( selectedTemplate, 1 ); + } + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + +#if SHOW_TEMPLATE_HELP_BOX + EditorGUILayout.HelpBox( WarningMessage, MessageType.Warning ); +#endif + + } + + public void DrawGeneralOptions() + { + DrawShaderName(); + DrawCurrentShaderType(); + EditorGUI.BeginChangeCheck(); + DrawPrecisionProperty( false ); + if( EditorGUI.EndChangeCheck() ) + ContainerGraph.CurrentPrecision = m_currentPrecisionType; + + DrawSamplingMacros(); + + if( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) + m_cullModeHelper.Draw( this ); + + if( m_currentTemplate.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) + m_colorMaskHelper.Draw( this ); + } + + //public void DrawSnippetOptions() + //{ + // m_currentTemplate.DrawSnippetProperties( this ); + //} + + bool CreateInstructionsForList( ref List ports, ref string shaderBody, ref List vertexInstructions, ref List fragmentInstructions ) + { + if( ports.Count == 0 ) + return true; + + bool isValid = true; + UIUtils.CurrentWindow.CurrentGraph.ResetNodesLocalVariables(); + for( int i = 0; i < ports.Count; i++ ) + { + TemplateInputData inputData = m_currentTemplate.InputDataFromId( ports[ i ].PortId ); + if( ports[ i ].IsConnected ) + { + m_currentDataCollector.ResetInstructions(); + m_currentDataCollector.ResetVertexInstructions(); + + m_currentDataCollector.PortCategory = ports[ i ].Category; + string newPortInstruction = ports[ i ].GeneratePortInstructions( ref m_currentDataCollector ); + + + if( m_currentDataCollector.DirtySpecialLocalVariables ) + { + string cleanVariables = m_currentDataCollector.SpecialLocalVariables.Replace( "\t", string.Empty ); + m_currentDataCollector.AddInstructions( cleanVariables, false ); + m_currentDataCollector.ClearSpecialLocalVariables(); + } + + if( m_currentDataCollector.DirtyVertexVariables ) + { + string cleanVariables = m_currentDataCollector.VertexLocalVariables.Replace( "\t", string.Empty ); + m_currentDataCollector.AddVertexInstruction( cleanVariables, UniqueId, false ); + m_currentDataCollector.ClearVertexLocalVariables(); + } + + // fill functions + for( int j = 0; j < m_currentDataCollector.InstructionsList.Count; j++ ) + { + fragmentInstructions.Add( m_currentDataCollector.InstructionsList[ j ].PropertyName ); + } + + for( int j = 0; j < m_currentDataCollector.VertexDataList.Count; j++ ) + { + vertexInstructions.Add( m_currentDataCollector.VertexDataList[ j ].PropertyName ); + } + + isValid = m_currentTemplate.FillTemplateBody( inputData.TagId, ref shaderBody, newPortInstruction ) && isValid; + } + else + { + isValid = m_currentTemplate.FillTemplateBody( inputData.TagId, ref shaderBody, inputData.DefaultValue ) && isValid; + } + } + return isValid; + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( m_currentTemplate == null ) + { + FetchCurrentTemplate(); + } + + if( m_reRegisterTemplateData ) + { + RegisterProperties(); + } + + if( m_containerGraph.IsInstancedShader ) + { + DrawInstancedIcon( drawInfo ); + } + + if( m_fetchMasterNodeCategory ) + { + if( m_availableCategories != null ) + { + m_fetchMasterNodeCategory = false; + SetCategoryIdxFromTemplate(); + } + } + + if( m_fireTemplateChange ) + { + m_fireTemplateChange = false; + m_containerGraph.FireMasterNodeReplacedEvent(); + } + } + + public override void UpdateFromShader( Shader newShader ) + { + if( m_currentMaterial != null ) + { + m_currentMaterial.shader = newShader; + } + CurrentShader = newShader; + } + + public override void UpdateMasterNodeMaterial( Material material ) + { + m_currentMaterial = material; + FireMaterialChangedEvt(); + } + + public override Shader Execute( string pathname, bool isFullPath ) + { + if( m_currentTemplate == null ) + return m_currentShader; + + //Create data collector + ForceReordering(); + base.Execute( pathname, isFullPath ); + + SetupNodeCategories(); + + m_currentDataCollector.TemplateDataCollectorInstance.BuildFromTemplateData( m_currentDataCollector, m_currentTemplate ); + int shaderPropertiesAmount = m_currentTemplate.AvailableShaderProperties.Count; + for( int i = 0; i < shaderPropertiesAmount; i++ ) + { + m_currentDataCollector.SoftRegisterUniform( m_currentTemplate.AvailableShaderProperties[ i ] ); + } + m_containerGraph.CheckPropertiesAutoRegister( ref m_currentDataCollector ); + + //Sort ports by both + List fragmentPorts = new List(); + List vertexPorts = new List(); + SortInputPorts( ref vertexPorts, ref fragmentPorts ); + + string shaderBody = m_currentTemplate.TemplateBody; + + List vertexInstructions = new List(); + List fragmentInstructions = new List(); + + bool validBody = true; + + validBody = CreateInstructionsForList( ref fragmentPorts, ref shaderBody, ref vertexInstructions, ref fragmentInstructions ) && validBody; + ContainerGraph.ResetNodesLocalVariablesIfNot( MasterNodePortCategory.Vertex ); + validBody = CreateInstructionsForList( ref vertexPorts, ref shaderBody, ref vertexInstructions, ref fragmentInstructions ) && validBody; + + m_currentTemplate.ResetTemplateUsageData(); + + // Fill vertex interpolators assignment + for( int i = 0; i < m_currentDataCollector.VertexInterpDeclList.Count; i++ ) + { + vertexInstructions.Add( m_currentDataCollector.VertexInterpDeclList[ i ] ); + } + + vertexInstructions.AddRange( m_currentDataCollector.TemplateDataCollectorInstance.GetInterpUnusedChannels() ); + //Fill common local variables and operations + + validBody = m_currentTemplate.FillVertexInstructions( ref shaderBody, vertexInstructions.ToArray() ) && validBody; + validBody = m_currentTemplate.FillFragmentInstructions( ref shaderBody, fragmentInstructions.ToArray() ) && validBody; + + // Add Instanced Properties + if( m_containerGraph.IsInstancedShader ) + { + m_currentDataCollector.TabifyInstancedVars(); + m_currentDataCollector.InstancedPropertiesList.Insert( 0, new PropertyDataCollector( -1, string.Format( IOUtils.InstancedPropertiesBegin, UIUtils.RemoveInvalidCharacters( m_shaderName ) ) ) ); + m_currentDataCollector.InstancedPropertiesList.Add( new PropertyDataCollector( -1, IOUtils.InstancedPropertiesEnd ) ); + m_currentDataCollector.UniformsList.AddRange( m_currentDataCollector.InstancedPropertiesList ); + } + + //Add Functions + m_currentDataCollector.UniformsList.AddRange( m_currentDataCollector.FunctionsList ); + + // Fill common tags + m_currentDataCollector.IncludesList.AddRange( m_currentDataCollector.PragmasList ); + + validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.ShaderNameId, ref shaderBody, string.Format( TemplatesManager.NameFormatter, m_shaderName ) ) && validBody; + validBody = m_currentTemplate.FillTemplateBody( TemplatesManager.TemplatePassTag, ref shaderBody, m_currentDataCollector.GrabPassList ) && validBody; + validBody = m_currentTemplate.FillTemplateBody( TemplatesManager.TemplatePragmaTag, ref shaderBody, m_currentDataCollector.IncludesList ) && validBody; + //validBody = m_currentTemplate.FillTemplateBody( TemplatesManager.TemplateTagsTag, ref shaderBody, m_currentDataCollector.TagsList ) && validBody; + validBody = m_currentTemplate.FillTemplateBody( TemplatesManager.TemplatePropertyTag, ref shaderBody, m_currentDataCollector.BuildUnformatedPropertiesStringArr() ) && validBody; + validBody = m_currentTemplate.FillTemplateBody( TemplatesManager.TemplateGlobalsTag, ref shaderBody, m_currentDataCollector.UniformsList ) && validBody; + validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.VertexDataId, ref shaderBody, m_currentDataCollector.VertexInputList.ToArray() ) && validBody; + validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.InterpDataId, ref shaderBody, m_currentDataCollector.InterpolatorList.ToArray() ) && validBody; + + if( m_currentTemplate.BlendData.ValidBlendMode ) + { + validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.BlendData.BlendModeId, ref shaderBody, m_blendOpHelper.CurrentBlendFactor ) && validBody; + } + + if( m_currentTemplate.BlendData.ValidBlendOp ) + { + validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.BlendData.BlendOpId, ref shaderBody, m_blendOpHelper.CurrentBlendOp ) && validBody; + } + + if( m_currentTemplate.AlphaToMaskData.DataCheck == TemplateDataCheck.Valid ) + { + validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.AlphaToMaskData.AlphaToMaskId, ref shaderBody, m_alphaToMaskHelper.GenerateShaderData( false ) ) && validBody; + } + + if( m_currentTemplate.DepthData.ValidZWrite ) + { + validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.DepthData.ZWriteModeId, ref shaderBody, m_depthOphelper.CurrentZWriteMode ) && validBody; + } + + if( m_currentTemplate.DepthData.ValidZTest ) + { + validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.DepthData.ZTestModeId, ref shaderBody, m_depthOphelper.CurrentZTestMode ) && validBody; + } + + if( m_currentTemplate.DepthData.ValidOffset ) + { + validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.DepthData.OffsetId, ref shaderBody, m_depthOphelper.CurrentOffset ) && validBody; + } + + if( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) + { + validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.CullModeData.CullModeId, ref shaderBody, m_cullModeHelper.GenerateShaderData(false) ) && validBody; + } + + if( m_currentTemplate.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) + { + validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.ColorMaskData.ColorMaskId, ref shaderBody, m_colorMaskHelper.GenerateShaderData( false ) ) && validBody; + } + + if( m_currentTemplate.StencilData.DataCheck == TemplateDataCheck.Valid ) + { + CullMode cullMode = ( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) ? m_cullModeHelper.CurrentCullMode : CullMode.Back; + validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.StencilData.StencilBufferId, ref shaderBody, m_stencilBufferHelper.CreateStencilOp( cullMode ) ) && validBody; + } + + if( m_currentTemplate.TagData.DataCheck == TemplateDataCheck.Valid ) + { + validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.TagData.TagsId, ref shaderBody, m_tagsHelper.GenerateTags() ) && validBody; + } + + if( m_currentDataCollector.TemplateDataCollectorInstance.HasVertexInputParams ) + { + validBody = m_currentTemplate.FillTemplateBody( TemplatesManager.TemplateInputsVertParamsTag, ref shaderBody, m_currentDataCollector.TemplateDataCollectorInstance.VertexInputParamsStr ) && validBody; + } + + if( m_currentDataCollector.TemplateDataCollectorInstance.HasFragmentInputParams ) + { + validBody = m_currentTemplate.FillTemplateBody( TemplatesManager.TemplateInputsFragParamsTag, ref shaderBody, m_currentDataCollector.TemplateDataCollectorInstance.FragInputParamsStr ) && validBody; + } + + m_currentTemplate.FillEmptyTags( ref shaderBody ); + + //m_currentTemplate.InsertSnippets( ref shaderBody ); + + vertexInstructions.Clear(); + vertexInstructions = null; + + fragmentInstructions.Clear(); + fragmentInstructions = null; + if( validBody ) + { + UpdateShaderAsset( ref pathname, ref shaderBody, isFullPath ); + } + + return m_currentShader; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + try + { + ShaderName = GetCurrentParam( ref nodeParams ); + if( m_shaderName.Length > 0 ) + ShaderName = UIUtils.RemoveShaderInvalidCharacters( ShaderName ); + + string templateGUID = GetCurrentParam( ref nodeParams ); + string templateShaderName = string.Empty; + if( UIUtils.CurrentShaderVersion() > 13601 ) + { + templateShaderName = GetCurrentParam( ref nodeParams ); + } + + TemplateData template = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( templateGUID ) as TemplateData; + if( template != null ) + { + SetTemplate( template, false, true ); + } + else + { + template = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplateByName( templateShaderName ) as TemplateData; + if( template != null ) + { + SetTemplate( template, false, true ); + } + else + { + m_masterNodeCategory = -1; + } + } + + if( UIUtils.CurrentShaderVersion() > 13902 ) + { + //BLEND MODULE + if( m_currentTemplate.BlendData.ValidBlendMode ) + { + m_blendOpHelper.ReadBlendModeFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( m_currentTemplate.BlendData.ValidBlendOp ) + { + m_blendOpHelper.ReadBlendOpFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + //CULL MODE + if( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) + { + m_cullModeHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + //COLOR MASK + if( m_currentTemplate.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) + { + m_colorMaskHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + //STENCIL BUFFER + if( m_currentTemplate.StencilData.DataCheck == TemplateDataCheck.Valid ) + { + m_stencilBufferHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + } + + if( UIUtils.CurrentShaderVersion() > 14202 ) + { + //DEPTH OPTIONS + if( m_currentTemplate.DepthData.ValidZWrite ) + { + m_depthOphelper.ReadZWriteFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( m_currentTemplate.DepthData.ValidZTest ) + { + m_depthOphelper.ReadZTestFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( m_currentTemplate.DepthData.ValidOffset ) + { + m_depthOphelper.ReadOffsetFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + } + + //TAGS + if( UIUtils.CurrentShaderVersion() > 14301 ) + { + if( m_currentTemplate.TagData.DataCheck == TemplateDataCheck.Valid ) + m_tagsHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 18302 ) + SamplingMacros = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + else + SamplingMacros = false; + } + catch( Exception e ) + { + Debug.LogException( e, this ); + } + m_containerGraph.CurrentCanvasMode = NodeAvailability.TemplateShader; + m_containerGraph.CurrentPrecision = m_currentPrecisionType; + } + + public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo, ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_shaderName ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_currentTemplate != null ) ? m_currentTemplate.GUID : string.Empty ); + IOUtils.AddFieldValueToString( ref nodeInfo, ( m_currentTemplate != null ) ? m_currentTemplate.DefaultShaderName : string.Empty ); + + //BLEND MODULE + if( m_currentTemplate.BlendData.ValidBlendMode ) + { + m_blendOpHelper.WriteBlendModeToString( ref nodeInfo ); + } + + if( m_currentTemplate.BlendData.ValidBlendOp ) + { + m_blendOpHelper.WriteBlendOpToString( ref nodeInfo ); + } + + //CULL MODULE + if( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) + { + m_cullModeHelper.WriteToString( ref nodeInfo ); + } + + //COLOR MASK MODULE + if( m_currentTemplate.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) + { + m_colorMaskHelper.WriteToString( ref nodeInfo ); + } + + //STENCIL BUFFER MODULE + if( m_currentTemplate.StencilData.DataCheck == TemplateDataCheck.Valid ) + { + m_stencilBufferHelper.WriteToString( ref nodeInfo ); + } + + //DEPTH MODULE + if( m_currentTemplate.DepthData.ValidZWrite ) + { + m_depthOphelper.WriteZWriteToString( ref nodeInfo ); + } + + if( m_currentTemplate.DepthData.ValidZTest ) + { + m_depthOphelper.WriteZTestToString( ref nodeInfo ); + } + + if( m_currentTemplate.DepthData.ValidOffset ) + { + m_depthOphelper.WriteOffsetToString( ref nodeInfo ); + } + + //TAGS + if( m_currentTemplate.TagData.DataCheck == TemplateDataCheck.Valid ) + { + m_tagsHelper.WriteToString( ref nodeInfo ); + } + + IOUtils.AddFieldValueToString( ref nodeInfo, m_samplingMacros ); + } + + public override void Destroy() + { + base.Destroy(); + m_currentTemplate = null; + m_blendOpHelper = null; + m_alphaToMaskHelper = null; + m_cullModeHelper = null; + m_colorMaskHelper.Destroy(); + m_colorMaskHelper = null; + m_stencilBufferHelper.Destroy(); + m_stencilBufferHelper = null; + m_tagsHelper.Destroy(); + m_tagsHelper = null; + + } + + public TemplateData CurrentTemplate { get { return m_currentTemplate; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs.meta new file mode 100644 index 00000000..a3d98308 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 8bbd856408a816448a2686501df37397 +timeCreated: 1493905112 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs new file mode 100644 index 00000000..ab152ae5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs @@ -0,0 +1,95 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public class TemplateMenuItems + { + [MenuItem( "Assets/Create/Amplify Shader/Custom Render Texture/Initialize", false, 85 )] + public static void ApplyTemplateCustomRenderTextureInitialize() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "6ce779933eb99f049b78d6163735e06f" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Custom Render Texture/Update", false, 85 )] + public static void ApplyTemplateCustomRenderTextureUpdate() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "32120270d1b3a8746af2aca8bc749736" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Legacy/Default Sprites", false, 85 )] + public static void ApplyTemplateLegacyDefaultSprites() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "0f8ba0101102bb14ebf021ddadce9b49" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Legacy/Image Effect", false, 85 )] + public static void ApplyTemplateLegacyImageEffect() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "c71b220b631b6344493ea3cf87110c93" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Legacy/Lit", false, 85 )] + public static void ApplyTemplateLegacyLit() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "ed95fe726fd7b4644bb42f4d1ddd2bcd" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Legacy/Multi Pass Unlit", false, 85 )] + public static void ApplyTemplateLegacyMultiPassUnlit() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "e1de45c0d41f68c41b2cc20c8b9c05ef" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Legacy/Particles Alpha Blended", false, 85 )] + public static void ApplyTemplateLegacyParticlesAlphaBlended() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "0b6a9f8b4f707c74ca64c0be8e590de0" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Legacy/Post-Processing Stack", false, 85 )] + public static void ApplyTemplateLegacyPostProcessingStack() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "32139be9c1eb75640a847f011acf3bcf" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Legacy/Unlit", false, 85 )] + public static void ApplyTemplateLegacyUnlit() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "0770190933193b94aaa3065e307002fa" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Legacy/Unlit Lightmap", false, 85 )] + public static void ApplyTemplateLegacyUnlitLightmap() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "899e609c083c74c4ca567477c39edef0" ); + } + [MenuItem( "Assets/Create/Amplify Shader/UI/Default", false, 85 )] + public static void ApplyTemplateUIDefault() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "5056123faa0c79b47ab6ad7e8bf059a4" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Universal/2D Custom Lit", false, 85 )] + public static void ApplyTemplateUniversal2DCustomLit() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "ece0159bad6633944bf6b818f4dd296c" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Universal/2D Lit", false, 85 )] + public static void ApplyTemplateUniversal2DLit() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "199187dac283dbe4a8cb1ea611d70c58" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Universal/2D Unlit", false, 85 )] + public static void ApplyTemplateUniversal2DUnlit() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "cf964e524c8e69742b1d21fbe2ebcc4a" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Universal/Decal", false, 85 )] + public static void ApplyTemplateUniversalDecal() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "c2a467ab6d5391a4ea692226d82ffefd" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Universal/Lit", false, 85 )] + public static void ApplyTemplateUniversalLit() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "94348b07e5e8bab40bd6c8a1e3df54cd" ); + } + [MenuItem( "Assets/Create/Amplify Shader/Universal/Unlit", false, 85 )] + public static void ApplyTemplateUniversalUnlit() + { + AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "2992e84f91cbeb14eab234972e07ea9d" ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs.meta new file mode 100644 index 00000000..84b19801 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: da0b931bd234a1e43b65f684d4b59bfb +timeCreated: 1496736284 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs new file mode 100644 index 00000000..fb064463 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs @@ -0,0 +1,788 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + + [Serializable] + public class TemplateModulesHelper + { + [SerializeField] + internal bool Foldout = false; + + private bool m_isDirty = false; + + [SerializeField] + private TemplatesBlendModule m_blendOpHelper = new TemplatesBlendModule(); + + [SerializeField] + private TemplatesBlendModule m_blendOpHelper1 = new TemplatesBlendModule(); + + [SerializeField] + private TemplatesBlendModule m_blendOpHelper2 = new TemplatesBlendModule(); + + [SerializeField] + private TemplatesBlendModule m_blendOpHelper3 = new TemplatesBlendModule(); + + [SerializeField] + private TemplateAlphaToMaskModule m_alphaToMaskHelper = new TemplateAlphaToMaskModule(); + + [SerializeField] + private TemplateCullModeModule m_cullModeHelper = new TemplateCullModeModule(); + + [SerializeField] + private TemplateColorMaskModule m_colorMaskHelper = new TemplateColorMaskModule(); + + [SerializeField] + private TemplateColorMaskModule m_colorMaskHelper1 = new TemplateColorMaskModule(); + + [SerializeField] + private TemplateColorMaskModule m_colorMaskHelper2 = new TemplateColorMaskModule(); + + [SerializeField] + private TemplateColorMaskModule m_colorMaskHelper3 = new TemplateColorMaskModule(); + + [SerializeField] + private TemplatesStencilBufferModule m_stencilBufferHelper = new TemplatesStencilBufferModule(); + + [SerializeField] + private TemplateDepthModule m_depthOphelper = new TemplateDepthModule(); + + [SerializeField] + private TemplateTagsModule m_tagsHelper = new TemplateTagsModule(); + + [SerializeField] + private TemplateShaderModelModule m_shaderModelHelper = new TemplateShaderModelModule(); + + [SerializeField] + private TemplateAdditionalIncludesHelper m_additionalIncludes = new TemplateAdditionalIncludesHelper(); + + [SerializeField] + private TemplateAdditionalDefinesHelper m_additionalDefines = new TemplateAdditionalDefinesHelper(); + + [SerializeField] + private TemplateAdditionalPragmasHelper m_additionalPragmas = new TemplateAdditionalPragmasHelper(); + + [SerializeField] + private TemplateAdditionalDirectivesHelper m_additionalDirectives = new TemplateAdditionalDirectivesHelper(" Additional Directives"); + + [SerializeField] + private RenderingPlatformOpHelper m_renderingPlatforms = new RenderingPlatformOpHelper(); + + [SerializeField] + private bool m_hasValidData = false; + + [SerializeField] + private bool m_allModulesMode = false; + + public void CopyFrom( TemplateModulesHelper other ) + { + m_allModulesMode = other.AllModulesMode; + + if( other.BlendOpHelper.IsDirty ) + { + m_blendOpHelper.CopyFrom( other.BlendOpHelper, true ); + } + + if( other.BlendOpHelper1.IsDirty ) + { + m_blendOpHelper1.CopyFrom( other.BlendOpHelper1, true ); + } + + if( other.BlendOpHelper2.IsDirty ) + { + m_blendOpHelper2.CopyFrom( other.BlendOpHelper2, true ); + } + + if( other.BlendOpHelper3.IsDirty ) + { + m_blendOpHelper3.CopyFrom( other.BlendOpHelper3, true ); + } + + if( other.AlphaToMaskHelper.IsDirty ) + { + m_alphaToMaskHelper.CopyFrom( other.AlphaToMaskHelper, true ); + } + + if( other.CullModeHelper.IsDirty ) + { + m_cullModeHelper.CopyFrom( other.CullModeHelper , true ); + } + + if( other.ColorMaskHelper.IsDirty ) + { + m_colorMaskHelper.CopyFrom( other.ColorMaskHelper , true); + } + + if( other.ColorMaskHelper1.IsDirty ) + { + m_colorMaskHelper1.CopyFrom( other.ColorMaskHelper1, true ); + } + + if( other.ColorMaskHelper2.IsDirty ) + { + m_colorMaskHelper2.CopyFrom( other.ColorMaskHelper2, true ); + } + + if( other.ColorMaskHelper3.IsDirty ) + { + m_colorMaskHelper3.CopyFrom( other.ColorMaskHelper3, true ); + } + + if( other.StencilBufferHelper.IsDirty ) + { + m_stencilBufferHelper.CopyFrom( other.StencilBufferHelper,true ); + } + + if( other.DepthOphelper.IsDirty ) + { + m_depthOphelper.CopyFrom( other.DepthOphelper,true ); + } + + if( other.TagsHelper.IsDirty ) + { + m_tagsHelper.CopyFrom( other.TagsHelper ); + } + + if( other.ShaderModelHelper.IsDirty ) + { + m_shaderModelHelper.CopyFrom( other.ShaderModelHelper, true ); + } + } + + public void SyncWith( TemplateModulesHelper other ) + { + + if( m_blendOpHelper.ValidData && other.BlendOpHelper.ValidData ) + { + m_blendOpHelper.CopyFrom( other.BlendOpHelper, false ); + } + + if( m_blendOpHelper1.ValidData && other.BlendOpHelper1.ValidData ) + { + m_blendOpHelper1.CopyFrom( other.BlendOpHelper1, false ); + } + + if( m_blendOpHelper2.ValidData && other.BlendOpHelper2.ValidData ) + { + m_blendOpHelper2.CopyFrom( other.BlendOpHelper2, false ); + } + + if( m_blendOpHelper3.ValidData && other.BlendOpHelper3.ValidData ) + { + m_blendOpHelper3.CopyFrom( other.BlendOpHelper3, false ); + } + + if( m_alphaToMaskHelper.ValidData && other.AlphaToMaskHelper.ValidData ) + { + m_alphaToMaskHelper.CopyFrom( other.AlphaToMaskHelper, false ); + } + + if( m_cullModeHelper.ValidData && other.CullModeHelper.ValidData ) + { + m_cullModeHelper.CopyFrom( other.CullModeHelper, false ); + } + + if( m_colorMaskHelper.ValidData && other.ColorMaskHelper.ValidData ) + { + m_colorMaskHelper.CopyFrom( other.ColorMaskHelper , false ); + } + + if( m_colorMaskHelper1.ValidData && other.ColorMaskHelper1.ValidData ) + { + m_colorMaskHelper1.CopyFrom( other.ColorMaskHelper1, false ); + } + + if( m_colorMaskHelper2.ValidData && other.ColorMaskHelper2.ValidData ) + { + m_colorMaskHelper2.CopyFrom( other.ColorMaskHelper2, false ); + } + + if( m_colorMaskHelper3.ValidData && other.ColorMaskHelper3.ValidData ) + { + m_colorMaskHelper3.CopyFrom( other.ColorMaskHelper3, false ); + } + + if( m_stencilBufferHelper.ValidData && other.StencilBufferHelper.ValidData ) + { + m_stencilBufferHelper.CopyFrom( other.StencilBufferHelper, false ); + } + + if( m_depthOphelper.ValidData && other.DepthOphelper.ValidData ) + { + m_depthOphelper.CopyFrom( other.DepthOphelper, false ); + } + + if( m_shaderModelHelper.ValidData && other.ShaderModelHelper.ValidData ) + { + m_shaderModelHelper.CopyFrom( other.ShaderModelHelper , false); + } + } + + public void FetchDataFromTemplate( TemplateModulesData module ) + { + m_allModulesMode = module.AllModulesMode; + + if( module.PragmaTag.IsValid ) + { + m_hasValidData = true; + //m_additionalPragmas.IsValid = true; + //m_additionalPragmas.FillNativeItems( module.IncludePragmaContainer.PragmasList ); + + //m_additionalIncludes.IsValid = true; + //m_additionalIncludes.FillNativeItems( module.IncludePragmaContainer.IncludesList ); + + //m_additionalDefines.IsValid = true; + //m_additionalDefines.FillNativeItems( module.IncludePragmaContainer.DefinesList ); + + m_additionalDirectives.FillNativeItems( module.IncludePragmaContainer.NativeDirectivesList ); + m_additionalDirectives.IsValid = true; + } + else + { + //m_additionalPragmas.IsValid = false; + //m_additionalIncludes.IsValid = false; + //m_additionalDefines.IsValid = false; + m_additionalDirectives.IsValid = false; + } + + m_blendOpHelper.ConfigureFromTemplateData( module.BlendData ); + if( module.BlendData.DataCheck == TemplateDataCheck.Valid ) + { + m_hasValidData = true; + } + + m_blendOpHelper1.ConfigureFromTemplateData( module.BlendData1 ); + if( module.BlendData1.DataCheck == TemplateDataCheck.Valid ) + { + m_hasValidData = true; + } + + m_blendOpHelper2.ConfigureFromTemplateData( module.BlendData2 ); + if( module.BlendData2.DataCheck == TemplateDataCheck.Valid ) + { + m_hasValidData = true; + } + + m_blendOpHelper3.ConfigureFromTemplateData( module.BlendData3 ); + if( module.BlendData3.DataCheck == TemplateDataCheck.Valid ) + { + m_hasValidData = true; + } + + m_alphaToMaskHelper.ConfigureFromTemplateData( module.AlphaToMaskData ); + if( module.AlphaToMaskData.DataCheck == TemplateDataCheck.Valid ) + { + m_hasValidData = true; + } + + m_cullModeHelper.ConfigureFromTemplateData( module.CullModeData ); + if( module.CullModeData.DataCheck == TemplateDataCheck.Valid ) + { + m_hasValidData = true; + } + + m_colorMaskHelper.ConfigureFromTemplateData( module.ColorMaskData ); + if( module.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) + { + m_hasValidData = true; + } + + m_colorMaskHelper1.ConfigureFromTemplateData( module.ColorMaskData1 ); + if( module.ColorMaskData1.DataCheck == TemplateDataCheck.Valid ) + { + m_hasValidData = true; + } + + m_colorMaskHelper2.ConfigureFromTemplateData( module.ColorMaskData2 ); + if( module.ColorMaskData2.DataCheck == TemplateDataCheck.Valid ) + { + m_hasValidData = true; + } + + m_colorMaskHelper3.ConfigureFromTemplateData( module.ColorMaskData3 ); + if( module.ColorMaskData3.DataCheck == TemplateDataCheck.Valid ) + { + m_hasValidData = true; + } + + m_stencilBufferHelper.ConfigureFromTemplateData( module.StencilData ); + if( module.StencilData.DataCheck == TemplateDataCheck.Valid ) + { + m_hasValidData = true; + } + + m_depthOphelper.ConfigureFromTemplateData( module.DepthData ); + if( module.DepthData.DataCheck == TemplateDataCheck.Valid ) + { + m_hasValidData = true; + } + + m_tagsHelper.ConfigureFromTemplateData( module.TagData ); + if( module.TagData.DataCheck == TemplateDataCheck.Valid ) + { + m_hasValidData = true; + } + + m_shaderModelHelper.ConfigureFromTemplateData( module.ShaderModel ); + if( module.ShaderModel.DataCheck == TemplateDataCheck.Valid ) + { + m_hasValidData = true; + } + + + if( module.RenderPlatformHelper.IsValid ) + { + m_renderingPlatforms.SetupFromTemplate( module.RenderPlatformHelper ); + m_hasValidData = true; + } + + } + + public void OnLogicUpdate( TemplateModulesData currentModule ) + { + if( currentModule.TagData.DataCheck == TemplateDataCheck.Valid ) + m_tagsHelper.OnLogicUpdate(); + } + + public void Draw( ParentNode owner, TemplateModulesData currentModule , TemplateModulesHelper parent = null ) + { + if( currentModule.ShaderModel.DataCheck == TemplateDataCheck.Valid ) + m_shaderModelHelper.Draw( owner ); + + m_isDirty = m_shaderModelHelper.IsDirty; + + if( currentModule.CullModeData.DataCheck == TemplateDataCheck.Valid ) + m_cullModeHelper.Draw( owner ); + + m_isDirty = m_isDirty || m_cullModeHelper.IsDirty; + + if( currentModule.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) + m_colorMaskHelper.Draw( owner ); + + m_isDirty = m_isDirty || m_colorMaskHelper.IsDirty; + + if( currentModule.ColorMaskData1.DataCheck == TemplateDataCheck.Valid ) + m_colorMaskHelper1.Draw( owner ); + + m_isDirty = m_isDirty || m_colorMaskHelper1.IsDirty; + + if( currentModule.ColorMaskData2.DataCheck == TemplateDataCheck.Valid ) + m_colorMaskHelper2.Draw( owner ); + + m_isDirty = m_isDirty || m_colorMaskHelper2.IsDirty; + + if( currentModule.ColorMaskData3.DataCheck == TemplateDataCheck.Valid ) + m_colorMaskHelper3.Draw( owner ); + + m_isDirty = m_isDirty || m_colorMaskHelper3.IsDirty; + + if( currentModule.AlphaToMaskData.DataCheck == TemplateDataCheck.Valid ) + m_alphaToMaskHelper.Draw( owner ); + + m_isDirty = m_isDirty || m_alphaToMaskHelper.IsDirty; + + if( currentModule.DepthData.DataCheck == TemplateDataCheck.Valid ) + m_depthOphelper.Draw( owner, false ); + + m_isDirty = m_isDirty || m_depthOphelper.IsDirty; + + if( currentModule.BlendData.DataCheck == TemplateDataCheck.Valid ) + m_blendOpHelper.Draw( owner, false ); + + m_isDirty = m_isDirty || m_blendOpHelper.IsDirty; + + if( currentModule.BlendData1.DataCheck == TemplateDataCheck.Valid ) + m_blendOpHelper1.Draw( owner, false ); + + m_isDirty = m_isDirty || m_blendOpHelper1.IsDirty; + + if( currentModule.BlendData2.DataCheck == TemplateDataCheck.Valid ) + m_blendOpHelper2.Draw( owner, false ); + + m_isDirty = m_isDirty || m_blendOpHelper2.IsDirty; + + if( currentModule.BlendData3.DataCheck == TemplateDataCheck.Valid ) + m_blendOpHelper3.Draw( owner, false ); + + m_isDirty = m_isDirty || m_blendOpHelper3.IsDirty; + + + if( currentModule.StencilData.DataCheck == TemplateDataCheck.Valid ) + { + CullMode cullMode = CullMode.Back; + if( currentModule.CullModeData.DataCheck == TemplateDataCheck.Valid ) + { + cullMode = m_cullModeHelper.CurrentCullMode; + } + else if( parent != null && parent.CullModeHelper.ValidData ) + { + cullMode = parent.CullModeHelper.CurrentCullMode; + } + m_stencilBufferHelper.Draw( owner, cullMode, false ); + } + + m_isDirty = m_isDirty || m_stencilBufferHelper.IsDirty; + + if( currentModule.TagData.DataCheck == TemplateDataCheck.Valid ) + m_tagsHelper.Draw( owner, false ); + + m_isDirty = m_isDirty || m_tagsHelper.IsDirty; + + if( currentModule.PragmaTag.IsValid ) + { + //m_additionalDefines.Draw( owner ); + //m_additionalIncludes.Draw( owner ); + //m_additionalPragmas.Draw( owner ); + m_additionalDirectives.Draw( owner , false); + } + + if( currentModule.RenderPlatformHelper.IsValid ) + { + m_renderingPlatforms.DrawNested( owner ); + } + + m_isDirty = m_isDirty || + //m_additionalDefines.IsDirty || + //m_additionalIncludes.IsDirty || + //m_additionalPragmas.IsDirty || + m_additionalDirectives.IsDirty; + } + + public void Destroy() + { + m_shaderModelHelper = null; + m_blendOpHelper = null; + m_blendOpHelper1 = null; + m_blendOpHelper2 = null; + m_blendOpHelper3 = null; + m_cullModeHelper = null; + m_alphaToMaskHelper = null; + m_colorMaskHelper.Destroy(); + m_colorMaskHelper = null; + m_colorMaskHelper1.Destroy(); + m_colorMaskHelper1 = null; + m_colorMaskHelper2.Destroy(); + m_colorMaskHelper2 = null; + m_colorMaskHelper3.Destroy(); + m_colorMaskHelper3 = null; + m_stencilBufferHelper.Destroy(); + m_stencilBufferHelper = null; + m_tagsHelper.Destroy(); + m_tagsHelper = null; + m_additionalDefines.Destroy(); + m_additionalDefines = null; + m_additionalIncludes.Destroy(); + m_additionalIncludes = null; + m_additionalPragmas.Destroy(); + m_additionalPragmas = null; + m_additionalDirectives.Destroy(); + m_additionalDirectives = null; + m_renderingPlatforms.Destroy(); + m_renderingPlatforms = null; + } + + public string GenerateAllModulesString( bool isSubShader ) + { + string moduleBody = string.Empty; + if( !ShaderModelHelper.IndependentModule ) + { + moduleBody += ShaderModelHelper.GenerateShaderData( isSubShader ) + "\n"; + } + + if( !BlendOpHelper.IndependentModule ) + { + if( BlendOpHelper.BlendModeEnabled ) + moduleBody += BlendOpHelper.CurrentBlendFactor + "\n"; + + if( BlendOpHelper.BlendOpActive ) + moduleBody += BlendOpHelper.CurrentBlendOp + "\n"; + } + + if( !AlphaToMaskHelper.IndependentModule ) + moduleBody += AlphaToMaskHelper.GenerateShaderData( isSubShader ) + "\n"; + + if( !CullModeHelper.IndependentModule ) + moduleBody += CullModeHelper.GenerateShaderData( isSubShader ) + "\n"; + + if( !ColorMaskHelper.IndependentModule ) + moduleBody += ColorMaskHelper.GenerateShaderData( isSubShader ) + "\n"; + + if( !DepthOphelper.IndependentModule ) + { + moduleBody += DepthOphelper.CurrentZWriteMode; + moduleBody += DepthOphelper.CurrentZTestMode; + if( DepthOphelper.OffsetEnabled ) + moduleBody += DepthOphelper.CurrentOffset; + } + + if( !StencilBufferHelper.IndependentModule && StencilBufferHelper.Active ) + { + CullMode cullMode = ( CullModeHelper.ValidData ) ? CullModeHelper.CurrentCullMode : CullMode.Back; + moduleBody += StencilBufferHelper.CreateStencilOp( cullMode ); + } + + return moduleBody; + } + + public void ReadFromString( TemplateModulesData modulesData, ref uint index, ref string[] nodeParams ) + { + try + { + m_blendOpHelper.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + if( UIUtils.CurrentShaderVersion() > 18103 ) + { + try + { + m_blendOpHelper1.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + try + { + m_blendOpHelper2.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + try + { + m_blendOpHelper3.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + try + { + m_alphaToMaskHelper.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + try + { + m_cullModeHelper.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + try + { + m_colorMaskHelper.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + if( UIUtils.CurrentShaderVersion() > 18103 ) + { + try + { + m_colorMaskHelper1.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + try + { + m_colorMaskHelper2.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + try + { + m_colorMaskHelper3.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + try + { + m_stencilBufferHelper.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + try + { + m_depthOphelper.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + try + { + m_tagsHelper.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + try + { + m_shaderModelHelper.ReadFromString( modulesData, ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + if( UIUtils.CurrentShaderVersion() > 18910 ) + { + try + { + m_renderingPlatforms.ReadFromStringTemplate( ref index , ref nodeParams ); + } + catch(Exception e) + { + Debug.Log( e ); + } + } + + if( UIUtils.CurrentShaderVersion() < 15312 ) + { + try + { + m_additionalDefines.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + try + { + m_additionalPragmas.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + try + { + m_additionalIncludes.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + m_additionalDirectives.AddItems( AdditionalLineType.Include, m_additionalIncludes.ItemsList ); + m_additionalDirectives.AddItems( AdditionalLineType.Define, m_additionalDefines.ItemsList ); + m_additionalDirectives.AddItems( AdditionalLineType.Pragma, m_additionalPragmas.ItemsList ); + + } + else + { + try + { + m_additionalDirectives.ReadFromString( ref index, ref nodeParams ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + + } + + public void WriteToString( ref string nodeInfo ) + { + m_blendOpHelper.WriteToString( ref nodeInfo ); + m_blendOpHelper1.WriteToString( ref nodeInfo ); + m_blendOpHelper2.WriteToString( ref nodeInfo ); + m_blendOpHelper3.WriteToString( ref nodeInfo ); + m_alphaToMaskHelper.WriteToString( ref nodeInfo ); + m_cullModeHelper.WriteToString( ref nodeInfo ); + m_colorMaskHelper.WriteToString( ref nodeInfo ); + m_colorMaskHelper1.WriteToString( ref nodeInfo ); + m_colorMaskHelper2.WriteToString( ref nodeInfo ); + m_colorMaskHelper3.WriteToString( ref nodeInfo ); + m_stencilBufferHelper.WriteToString( ref nodeInfo ); + m_depthOphelper.WriteToString( ref nodeInfo ); + m_tagsHelper.WriteToString( ref nodeInfo ); + m_shaderModelHelper.WriteToString( ref nodeInfo ); + m_renderingPlatforms.WriteToStringTemplate( ref nodeInfo ); + + //m_additionalDefines.WriteToString( ref nodeInfo ); + //m_additionalPragmas.WriteToString( ref nodeInfo ); + //m_additionalIncludes.WriteToString( ref nodeInfo ); + + m_additionalDirectives.WriteToString( ref nodeInfo ); + } + + public TemplatesBlendModule BlendOpHelper { get { return m_blendOpHelper; } } + public TemplatesBlendModule BlendOpHelper1 { get { return m_blendOpHelper1; } } + public TemplatesBlendModule BlendOpHelper2 { get { return m_blendOpHelper2; } } + public TemplatesBlendModule BlendOpHelper3 { get { return m_blendOpHelper3; } } + public TemplateAlphaToMaskModule AlphaToMaskHelper { get { return m_alphaToMaskHelper; } } + public TemplateCullModeModule CullModeHelper { get { return m_cullModeHelper; } } + public TemplateColorMaskModule ColorMaskHelper { get { return m_colorMaskHelper; } } + public TemplateColorMaskModule ColorMaskHelper1 { get { return m_colorMaskHelper1; } } + public TemplateColorMaskModule ColorMaskHelper2 { get { return m_colorMaskHelper2; } } + public TemplateColorMaskModule ColorMaskHelper3 { get { return m_colorMaskHelper3; } } + public TemplatesStencilBufferModule StencilBufferHelper { get { return m_stencilBufferHelper; } } + public TemplateDepthModule DepthOphelper { get { return m_depthOphelper; } } + public TemplateTagsModule TagsHelper { get { return m_tagsHelper; } } + public TemplateShaderModelModule ShaderModelHelper { get { return m_shaderModelHelper; } } + //public TemplateAdditionalIncludesHelper AdditionalIncludes { get { return m_additionalIncludes; } } + //public TemplateAdditionalDefinesHelper AdditionalDefines { get { return m_additionalDefines; } } + //public TemplateAdditionalPragmasHelper AdditionalPragmas { get { return m_additionalPragmas; } } + public TemplateAdditionalDirectivesHelper AdditionalDirectives { get { return m_additionalDirectives; } } + public RenderingPlatformOpHelper RenderingPlatforms { get { return m_renderingPlatforms; } } + public bool AllModulesMode { get { return m_allModulesMode; } } + public bool HasValidData { get { return m_hasValidData; } } + public bool IsDirty + { + get { return m_isDirty; } + set + { + m_isDirty = value; + if( !value ) + { + m_blendOpHelper.IsDirty = false; + m_blendOpHelper1.IsDirty = false; + m_blendOpHelper2.IsDirty = false; + m_blendOpHelper3.IsDirty = false; + m_cullModeHelper.IsDirty = false; + m_alphaToMaskHelper.IsDirty = false; + m_colorMaskHelper.IsDirty = false; + m_colorMaskHelper1.IsDirty = false; + m_colorMaskHelper2.IsDirty = false; + m_colorMaskHelper3.IsDirty = false; + m_stencilBufferHelper.IsDirty = false; + m_tagsHelper.IsDirty = false; + m_shaderModelHelper.IsDirty = false; + //m_additionalDefines.IsDirty = false; + //m_additionalPragmas.IsDirty = false; + //m_additionalIncludes.IsDirty = false; + m_additionalDirectives.IsDirty = false; + } + } + } + // public bool Foldout { get { return m_foldout; } set { m_foldout = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs.meta new file mode 100644 index 00000000..fa3b093e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 144af5a201bd97542bf3a483976759db +timeCreated: 1518705839 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs new file mode 100644 index 00000000..a8d4e231 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs @@ -0,0 +1,82 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateModuleParent + { + private const string UnreadableDataMessagePrefix = "Unreadable data on Module "; + protected string m_unreadableMessage; + + [SerializeField] + protected bool m_validData = false; + + [SerializeField] + protected bool m_isDirty = false; + + [SerializeField] + protected string m_moduleName = string.Empty; + + //[SerializeField] + //protected bool m_foldoutValue = false; + + [SerializeField] + protected bool m_independentModule = true; + + [SerializeField] + private bool m_customEdited = false; + + public TemplateModuleParent( string moduleName ) { m_moduleName = moduleName; m_unreadableMessage = UnreadableDataMessagePrefix + moduleName; } + public virtual void Draw( UndoParentNode owner , bool style = true) { } + public virtual void ReadFromString( ref uint index, ref string[] nodeParams ) + { + if( UIUtils.CurrentShaderVersion() > 18805 ) + { + CustomEdited = Convert.ToBoolean( nodeParams[ index++ ] ); + } + } + + public virtual void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_customEdited ); + } + + public virtual string GenerateShaderData( bool isSubShader ) { return string.Empty; } + public virtual void Destroy() { } + public bool ValidData { get { return m_validData; } } + public bool ValidAndIndependent { get { return m_validData && m_independentModule; } } + + public virtual void ShowUnreadableDataMessage( ParentNode owner ) + { + ShowUnreadableDataMessage(); + } + + public virtual void ShowUnreadableDataMessage() + { + EditorGUILayout.HelpBox( m_unreadableMessage, MessageType.Info ); + } + + public bool IsDirty + { + get { return m_isDirty; } + set { m_isDirty = value; } + } + + public bool IndependentModule + { + get { return m_independentModule; } + set { m_independentModule = value; } + } + + public bool CustomEdited + { + get { return m_customEdited; } + set { m_customEdited = value; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs.meta new file mode 100644 index 00000000..04f92bed --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3aaabf1f5cb06414a8be17a89487e10f +timeCreated: 1511185965 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs new file mode 100644 index 00000000..38f70c04 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs @@ -0,0 +1,819 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Text.RegularExpressions; +using System.Collections.Generic; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public enum TemplateModuleDataType + { + ModuleShaderModel, + ModuleBlendMode, + ModuleBlendMode1, + ModuleBlendMode2, + ModuleBlendMode3, + ModuleBlendOp, + ModuleBlendOp1, + ModuleBlendOp2, + ModuleBlendOp3, + ModuleAlphaToMask, + ModuleCullMode, + ModuleColorMask, + ModuleColorMask1, + ModuleColorMask2, + ModuleColorMask3, + ModuleStencil, + ModuleZwrite, + ModuleZTest, + ModuleZOffset, + ModuleTag, + ModuleGlobals, + ModuleSRPBatcher, + ModuleFunctions, + ModulePragma, + ModulePragmaBefore, + ModulePass, + ModuleInputVert, + ModuleInputFrag, + PassVertexFunction, + PassFragmentFunction, + PassVertexData, + PassInterpolatorData, + PassNameData, + AllModules, + VControl, + ControlData, + DomainData, + ModuleRenderPlatforms + //EndPass + } + + public enum TemplateSRPType + { + BiRP, + HDRP, + URP + } + + [Serializable] + public class TemplateModulesData + { + [SerializeField] + TemplateRenderPlatformHelper m_renderPlatformHelper; + + [SerializeField] + private TemplateBlendData m_blendData = new TemplateBlendData(); + + [SerializeField] + private TemplateBlendData m_blendData1 = new TemplateBlendData(); + + [SerializeField] + private TemplateBlendData m_blendData2 = new TemplateBlendData(); + + [SerializeField] + private TemplateBlendData m_blendData3 = new TemplateBlendData(); + + [SerializeField] + private TemplateAlphaToMaskData m_alphaToMaskData = new TemplateAlphaToMaskData(); + + [SerializeField] + private TemplateCullModeData m_cullModeData = new TemplateCullModeData(); + + [SerializeField] + private TemplateColorMaskData m_colorMaskData = new TemplateColorMaskData(); + + [SerializeField] + private TemplateColorMaskData m_colorMaskData1 = new TemplateColorMaskData(); + + [SerializeField] + private TemplateColorMaskData m_colorMaskData2 = new TemplateColorMaskData(); + + [SerializeField] + private TemplateColorMaskData m_colorMaskData3 = new TemplateColorMaskData(); + + [SerializeField] + private TemplateStencilData m_stencilData = new TemplateStencilData(); + + [SerializeField] + private TemplateDepthData m_depthData = new TemplateDepthData(); + + [SerializeField] + private TemplateTagsModuleData m_tagData = new TemplateTagsModuleData(); + + [SerializeField] + private TemplateTagData m_globalsTag = new TemplateTagData( TemplatesManager.TemplateGlobalsTag, true ); + + [SerializeField] + private TemplateTagData m_srpBatcherTag = new TemplateTagData( TemplatesManager.TemplateSRPBatcherTag, true ); + + [SerializeField] + private TemplateTagData m_allModulesTag = new TemplateTagData( TemplatesManager.TemplateAllModulesTag, true ); + + [SerializeField] + private TemplateTagData m_functionsTag = new TemplateTagData( TemplatesManager.TemplateFunctionsTag, true ); + + [SerializeField] + private TemplateTagData m_pragmaTag = new TemplateTagData( TemplatesManager.TemplatePragmaTag, true ); + + [SerializeField] + private TemplateTagData m_pragmaBeforeTag = new TemplateTagData( TemplatesManager.TemplatePragmaBeforeTag, true ); + + [SerializeField] + private TemplateTagData m_passTag = new TemplateTagData( TemplatesManager.TemplatePassTag, true ); + + [SerializeField] + private TemplateTagData m_inputsVertTag = new TemplateTagData( TemplatesManager.TemplateInputsVertParamsTag, false ); + + [SerializeField] + private TemplateTagData m_inputsFragTag = new TemplateTagData( TemplatesManager.TemplateInputsFragParamsTag, false ); + + [SerializeField] + private TemplateShaderModelData m_shaderModel = new TemplateShaderModelData(); + + [SerializeField] + private TemplateSRPType m_srpType = TemplateSRPType.BiRP; + + [SerializeField] + private bool m_srpIsPBR = false; + + [SerializeField] + private string m_uniquePrefix; + + [SerializeField] + private TemplateIncludePragmaContainter m_includePragmaContainer = new TemplateIncludePragmaContainter(); + + [SerializeField] + private bool m_allModulesMode = false; + + [SerializeField] + private string m_passUniqueName = string.Empty; + + public void Destroy() + { + m_renderPlatformHelper.Destroy(); + m_renderPlatformHelper = null; + + m_blendData = null; + m_blendData1 = null; + m_blendData2 = null; + m_blendData3 = null; + m_alphaToMaskData = null; + m_cullModeData = null; + m_colorMaskData = null; + m_colorMaskData1 = null; + m_colorMaskData2 = null; + m_colorMaskData3 = null; + m_stencilData = null; + m_depthData = null; + m_tagData.Destroy(); + m_tagData = null; + m_globalsTag = null; + m_srpBatcherTag = null; + m_allModulesTag = null; + m_functionsTag = null; + m_pragmaTag = null; + m_pragmaBeforeTag = null; + m_passTag = null; + m_inputsVertTag = null; + m_inputsFragTag = null; + m_includePragmaContainer.Destroy(); + m_includePragmaContainer = null; + } + + public void ConfigureCommonTag( TemplateTagData tagData, TemplatePropertyContainer propertyContainer, TemplateIdManager idManager, string uniquePrefix, int offsetIdx, string subBody ) + { + int id = subBody.IndexOf( tagData.Id ); + if ( id >= 0 ) + { + tagData.StartIdx = offsetIdx + id; + idManager.RegisterId( tagData.StartIdx, uniquePrefix + tagData.Id, tagData.Id ); + propertyContainer.AddId( subBody, tagData.Id, tagData.SearchIndentation ); + } + } + + public TemplateModulesData( TemplateOptionsContainer optionsContainer, TemplateIdManager idManager, TemplatePropertyContainer propertyContainer, string uniquePrefix, int offsetIdx, string subBody, bool isSubShader ) + { + if ( string.IsNullOrEmpty( subBody ) ) + return; + + m_uniquePrefix = uniquePrefix; + + //RENDERING PLATFORMS + m_renderPlatformHelper = new TemplateRenderPlatformHelper(); + TemplateHelperFunctions.FillRenderingPlatform( m_renderPlatformHelper , subBody ); + if( m_renderPlatformHelper.IsValid ) + { + m_renderPlatformHelper.Index = offsetIdx + m_renderPlatformHelper.Index; + idManager.RegisterId( m_renderPlatformHelper.Index , uniquePrefix + m_renderPlatformHelper.ID , m_renderPlatformHelper.ID ); + } + + //PRAGMAS AND INCLUDES + TemplateHelperFunctions.CreatePragmaIncludeList( subBody, m_includePragmaContainer ); + + //COMMON TAGS + ConfigureCommonTag( m_globalsTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); + ConfigureCommonTag( m_srpBatcherTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); + ConfigureCommonTag( m_functionsTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); + ConfigureCommonTag( m_pragmaTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); + ConfigureCommonTag( m_pragmaBeforeTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); + if( !TemplateHelperFunctions.GetPassUniqueId( m_passTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody, ref m_passUniqueName ) ) + { + ConfigureCommonTag( m_passTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); + } + ConfigureCommonTag( m_inputsVertTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); + ConfigureCommonTag( m_inputsFragTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); + + // If Options are enabled then remove them so they won't influence Regex matches + if( optionsContainer.Enabled && optionsContainer.EndIndex > 0 ) + { + offsetIdx += optionsContainer.EndIndex; + subBody = subBody.Substring( optionsContainer.EndIndex ); + } + //BlEND MODE + { + Match blendModeMatch = Regex.Match( subBody, TemplateHelperFunctions.BlendModePattern1 ); + if( blendModeMatch.Success ) + { + int blendModeIdx = blendModeMatch.Index; + int end = blendModeMatch.Length + blendModeIdx; + string blendParams = subBody.Substring( blendModeIdx, end - blendModeIdx ); + m_blendData1.BlendModeId = blendParams; + m_blendData1.BlendModeStartIndex = offsetIdx + blendModeIdx; + idManager.RegisterId( m_blendData1.BlendModeStartIndex, uniquePrefix + m_blendData1.BlendModeId, m_blendData1.BlendModeId ); + + TemplateHelperFunctions.CreateBlendMode( blendParams, ref m_blendData1, TemplateHelperFunctions.BlendModePattern1 ); + if( m_blendData1.ValidBlendMode ) + { + propertyContainer.AddId( subBody, blendParams, false ); + } + } + } + { + Match blendModeMatch = Regex.Match( subBody, TemplateHelperFunctions.BlendModePattern2 ); + if( blendModeMatch.Success ) + { + int blendModeIdx = blendModeMatch.Index; + int end = blendModeMatch.Length + blendModeIdx; + string blendParams = subBody.Substring( blendModeIdx, end - blendModeIdx ); + m_blendData2.BlendModeId = blendParams; + m_blendData2.BlendModeStartIndex = offsetIdx + blendModeIdx; + idManager.RegisterId( m_blendData2.BlendModeStartIndex, uniquePrefix + m_blendData2.BlendModeId, m_blendData2.BlendModeId ); + + TemplateHelperFunctions.CreateBlendMode( blendParams, ref m_blendData2, TemplateHelperFunctions.BlendModePattern2 ); + if( m_blendData2.ValidBlendMode ) + { + propertyContainer.AddId( subBody, blendParams, false ); + } + } + } + { + Match blendModeMatch = Regex.Match( subBody, TemplateHelperFunctions.BlendModePattern3 ); + if( blendModeMatch.Success ) + { + int blendModeIdx = blendModeMatch.Index; + int end = blendModeMatch.Length + blendModeIdx; + string blendParams = subBody.Substring( blendModeIdx, end - blendModeIdx ); + m_blendData3.BlendModeId = blendParams; + m_blendData3.BlendModeStartIndex = offsetIdx + blendModeIdx; + idManager.RegisterId( m_blendData3.BlendModeStartIndex, uniquePrefix + m_blendData3.BlendModeId, m_blendData3.BlendModeId ); + + TemplateHelperFunctions.CreateBlendMode( blendParams, ref m_blendData3, TemplateHelperFunctions.BlendModePattern3 ); + if( m_blendData3.ValidBlendMode ) + { + propertyContainer.AddId( subBody, blendParams, false ); + } + } + } + { + string pattern = TemplateHelperFunctions.BlendModePattern; + Match blendModeMatch = Regex.Match( subBody, pattern ); + if( !blendModeMatch.Success && !m_blendData1.ValidBlendMode && !m_blendData2.ValidBlendMode && !m_blendData3.ValidBlendMode ) + { + pattern = TemplateHelperFunctions.BlendModePatternFirst; + blendModeMatch = Regex.Match( subBody, pattern ); + } + if( blendModeMatch.Success ) + { + int blendModeIdx = blendModeMatch.Index; + int end = blendModeMatch.Length + blendModeIdx; + string blendParams = subBody.Substring( blendModeIdx, end - blendModeIdx ); + m_blendData.BlendModeId = blendParams; + m_blendData.BlendModeStartIndex = offsetIdx + blendModeIdx; + idManager.RegisterId( m_blendData.BlendModeStartIndex, uniquePrefix + m_blendData.BlendModeId, m_blendData.BlendModeId ); + + TemplateHelperFunctions.CreateBlendMode( blendParams, ref m_blendData, pattern ); + if( m_blendData.ValidBlendMode ) + { + propertyContainer.AddId( subBody, blendParams, false ); + } + + } + } + //BLEND OP + { + Match blendOpMatch = Regex.Match( subBody, TemplateHelperFunctions.BlendOpPattern1 ); + if( blendOpMatch.Success ) + { + int blendOpIdx = blendOpMatch.Index; + int end = blendOpMatch.Length + blendOpIdx; + string blendOpParams = subBody.Substring( blendOpIdx, end - blendOpIdx ); + m_blendData1.BlendOpId = blendOpParams; + m_blendData1.BlendOpStartIndex = offsetIdx + blendOpIdx; + idManager.RegisterId( m_blendData1.BlendOpStartIndex, uniquePrefix + m_blendData1.BlendOpId, m_blendData1.BlendOpId ); + TemplateHelperFunctions.CreateBlendOp( blendOpParams, ref m_blendData1, TemplateHelperFunctions.BlendOpPattern1 ); + if( m_blendData1.ValidBlendOp ) + { + propertyContainer.AddId( subBody, blendOpParams, false ); + } + } + + m_blendData1.DataCheck = ( m_blendData1.ValidBlendMode || m_blendData1.ValidBlendOp ) ? TemplateDataCheck.Valid : TemplateDataCheck.Invalid; + } + { + Match blendOpMatch = Regex.Match( subBody, TemplateHelperFunctions.BlendOpPattern2 ); + if( blendOpMatch.Success ) + { + int blendOpIdx = blendOpMatch.Index; + int end = blendOpMatch.Length + blendOpIdx; + string blendOpParams = subBody.Substring( blendOpIdx, end - blendOpIdx ); + m_blendData2.BlendOpId = blendOpParams; + m_blendData2.BlendOpStartIndex = offsetIdx + blendOpIdx; + idManager.RegisterId( m_blendData2.BlendOpStartIndex, uniquePrefix + m_blendData2.BlendOpId, m_blendData2.BlendOpId ); + TemplateHelperFunctions.CreateBlendOp( blendOpParams, ref m_blendData2, TemplateHelperFunctions.BlendOpPattern2 ); + if( m_blendData2.ValidBlendOp ) + { + propertyContainer.AddId( subBody, blendOpParams, false ); + } + } + + m_blendData2.DataCheck = ( m_blendData2.ValidBlendMode || m_blendData2.ValidBlendOp ) ? TemplateDataCheck.Valid : TemplateDataCheck.Invalid; + } + { + Match blendOpMatch = Regex.Match( subBody, TemplateHelperFunctions.BlendOpPattern3 ); + if( blendOpMatch.Success ) + { + int blendOpIdx = blendOpMatch.Index; + int end = blendOpMatch.Length + blendOpIdx; + string blendOpParams = subBody.Substring( blendOpIdx, end - blendOpIdx ); + m_blendData3.BlendOpId = blendOpParams; + m_blendData3.BlendOpStartIndex = offsetIdx + blendOpIdx; + idManager.RegisterId( m_blendData3.BlendOpStartIndex, uniquePrefix + m_blendData3.BlendOpId, m_blendData3.BlendOpId ); + TemplateHelperFunctions.CreateBlendOp( blendOpParams, ref m_blendData3, TemplateHelperFunctions.BlendOpPattern3 ); + if( m_blendData3.ValidBlendOp ) + { + propertyContainer.AddId( subBody, blendOpParams, false ); + } + } + + m_blendData3.DataCheck = ( m_blendData3.ValidBlendMode || m_blendData3.ValidBlendOp ) ? TemplateDataCheck.Valid : TemplateDataCheck.Invalid; + } + { + string pattern = TemplateHelperFunctions.BlendOpPattern; + Match blendOpMatch = Regex.Match( subBody, pattern ); + if( !blendOpMatch.Success && !m_blendData1.ValidBlendOp && !m_blendData2.ValidBlendOp && !m_blendData3.ValidBlendOp ) + { + pattern = TemplateHelperFunctions.BlendOpPatternFirst; + blendOpMatch = Regex.Match( subBody, pattern ); + } + + if( blendOpMatch.Success ) + { + int blendOpIdx = blendOpMatch.Index; + int end = blendOpMatch.Length + blendOpIdx; + string blendOpParams = subBody.Substring( blendOpIdx, end - blendOpIdx ); + m_blendData.BlendOpId = blendOpParams; + m_blendData.BlendOpStartIndex = offsetIdx + blendOpIdx; + idManager.RegisterId( m_blendData.BlendOpStartIndex, uniquePrefix + m_blendData.BlendOpId, m_blendData.BlendOpId ); + TemplateHelperFunctions.CreateBlendOp( blendOpParams, ref m_blendData, pattern ); + if( m_blendData.ValidBlendOp ) + { + propertyContainer.AddId( subBody, blendOpParams, false ); + } + } + + m_blendData.DataCheck = ( m_blendData.ValidBlendMode || m_blendData.ValidBlendOp ) ? TemplateDataCheck.Valid : TemplateDataCheck.Invalid; + } + + //ALPHA TO MASK + { + Match alphaToMaskMatch = Regex.Match( subBody, TemplateHelperFunctions.AlphaToMaskPattern ); + if( alphaToMaskMatch.Success ) + { + int alphaIdx = alphaToMaskMatch.Index; + int end = subBody.IndexOf( TemplatesManager.TemplateNewLine, alphaIdx ); + string alphaParams = subBody.Substring( alphaIdx, end - alphaIdx ); + m_alphaToMaskData.AlphaToMaskId = alphaParams; + m_alphaToMaskData.StartIdx = offsetIdx + alphaIdx; + idManager.RegisterId( m_alphaToMaskData.StartIdx, uniquePrefix + m_alphaToMaskData.AlphaToMaskId, m_alphaToMaskData.AlphaToMaskId ); + TemplateHelperFunctions.CreateAlphaToMask( alphaParams, ref m_alphaToMaskData ); + if( m_alphaToMaskData.DataCheck == TemplateDataCheck.Valid ) + propertyContainer.AddId( subBody, alphaParams, false, string.Empty ); + } + } + + //CULL MODE + { + Match cullMatch = Regex.Match( subBody, TemplateHelperFunctions.CullWholeWordPattern ); + if( cullMatch.Success ) + { + int cullIdx = cullMatch.Index; + int end = subBody.IndexOf( TemplatesManager.TemplateNewLine, cullIdx ); + string cullParams = subBody.Substring( cullIdx, end - cullIdx ); + m_cullModeData.CullModeId = cullParams; + m_cullModeData.StartIdx = offsetIdx + cullIdx; + idManager.RegisterId( m_cullModeData.StartIdx, uniquePrefix + m_cullModeData.CullModeId, m_cullModeData.CullModeId ); + TemplateHelperFunctions.CreateCullMode( cullParams, ref m_cullModeData ); + if( m_cullModeData.DataCheck == TemplateDataCheck.Valid ) + propertyContainer.AddId( subBody, cullParams, false, string.Empty ); + + } + } + //COLOR MASK + { + Match colorMaskMatch = Regex.Match( subBody, TemplateHelperFunctions.ColorMask1Pattern ); + if( colorMaskMatch.Success ) + { + int colorMaskIdx = colorMaskMatch.Index; + int end = colorMaskMatch.Length + colorMaskIdx;// subBody.IndexOf( TemplatesManager.TemplateNewLine, colorMaskIdx ); + string colorMaskParams = subBody.Substring( colorMaskIdx, end - colorMaskIdx ); + m_colorMaskData1.ColorMaskId = colorMaskParams; + m_colorMaskData1.StartIdx = offsetIdx + colorMaskIdx; + idManager.RegisterId( m_colorMaskData1.StartIdx, uniquePrefix + m_colorMaskData1.ColorMaskId, m_colorMaskData1.ColorMaskId ); + TemplateHelperFunctions.CreateColorMask( colorMaskParams, ref m_colorMaskData1, TemplateHelperFunctions.ColorMask1Pattern ); + if( m_colorMaskData1.DataCheck == TemplateDataCheck.Valid ) + propertyContainer.AddId( subBody, colorMaskParams, false ); + + } + } + { + Match colorMaskMatch = Regex.Match( subBody, TemplateHelperFunctions.ColorMask2Pattern ); + if( colorMaskMatch.Success ) + { + int colorMaskIdx = colorMaskMatch.Index; + int end = colorMaskMatch.Length + colorMaskIdx;// subBody.IndexOf( TemplatesManager.TemplateNewLine, colorMaskIdx ); + string colorMaskParams = subBody.Substring( colorMaskIdx, end - colorMaskIdx ); + m_colorMaskData2.ColorMaskId = colorMaskParams; + m_colorMaskData2.StartIdx = offsetIdx + colorMaskIdx; + idManager.RegisterId( m_colorMaskData2.StartIdx, uniquePrefix + m_colorMaskData2.ColorMaskId, m_colorMaskData2.ColorMaskId ); + TemplateHelperFunctions.CreateColorMask( colorMaskParams, ref m_colorMaskData2, TemplateHelperFunctions.ColorMask2Pattern ); + if( m_colorMaskData2.DataCheck == TemplateDataCheck.Valid ) + propertyContainer.AddId( subBody, colorMaskParams, false ); + + } + } + { + Match colorMaskMatch = Regex.Match( subBody, TemplateHelperFunctions.ColorMask3Pattern ); + if( colorMaskMatch.Success ) + { + int colorMaskIdx = colorMaskMatch.Index; + int end = colorMaskMatch.Length + colorMaskIdx;// subBody.IndexOf( TemplatesManager.TemplateNewLine, colorMaskIdx ); + string colorMaskParams = subBody.Substring( colorMaskIdx, end - colorMaskIdx ); + m_colorMaskData3.ColorMaskId = colorMaskParams; + m_colorMaskData3.StartIdx = offsetIdx + colorMaskIdx; + idManager.RegisterId( m_colorMaskData3.StartIdx, uniquePrefix + m_colorMaskData3.ColorMaskId, m_colorMaskData3.ColorMaskId ); + TemplateHelperFunctions.CreateColorMask( colorMaskParams, ref m_colorMaskData3, TemplateHelperFunctions.ColorMask3Pattern ); + if( m_colorMaskData3.DataCheck == TemplateDataCheck.Valid ) + propertyContainer.AddId( subBody, colorMaskParams, false ); + + } + } + { + string pattern = TemplateHelperFunctions.ColorMaskPattern; + Match colorMaskMatch = Regex.Match( subBody, pattern ); + if( !colorMaskMatch.Success && m_colorMaskData1.DataCheck == TemplateDataCheck.Invalid && m_colorMaskData2.DataCheck == TemplateDataCheck.Invalid && m_colorMaskData3.DataCheck == TemplateDataCheck.Invalid ) + { + pattern = TemplateHelperFunctions.ColorMaskPatternFirst; + colorMaskMatch = Regex.Match( subBody, pattern ); + } + + if( colorMaskMatch.Success ) + { + int colorMaskIdx = colorMaskMatch.Index; + int end = colorMaskMatch.Length + colorMaskIdx; //subBody.IndexOf( TemplatesManager.TemplateNewLine, colorMaskIdx ); + string colorMaskParams = subBody.Substring( colorMaskIdx, end - colorMaskIdx ); + m_colorMaskData.ColorMaskId = colorMaskParams; + m_colorMaskData.StartIdx = offsetIdx + colorMaskIdx; + idManager.RegisterId( m_colorMaskData.StartIdx, uniquePrefix + m_colorMaskData.ColorMaskId, m_colorMaskData.ColorMaskId ); + TemplateHelperFunctions.CreateColorMask( colorMaskParams, ref m_colorMaskData, pattern ); + if( m_colorMaskData.DataCheck == TemplateDataCheck.Valid ) + propertyContainer.AddId( subBody, colorMaskParams, false ); + + } + } + //STENCIL + { + Match stencilMatch = Regex.Match( subBody, TemplateHelperFunctions.StencilWholeWordPattern ); + if( stencilMatch.Success ) + { + int stencilIdx = stencilMatch.Index; + int stencilEndIdx = subBody.IndexOf( "}", stencilIdx ); + if( stencilEndIdx > 0 ) + { + string stencilParams = subBody.Substring( stencilIdx, stencilEndIdx + 1 - stencilIdx ); + m_stencilData.StencilBufferId = stencilParams; + m_stencilData.StartIdx = offsetIdx + stencilIdx; + idManager.RegisterId( m_stencilData.StartIdx, uniquePrefix + m_stencilData.StencilBufferId, m_stencilData.StencilBufferId ); + TemplateHelperFunctions.CreateStencilOps( stencilParams, ref m_stencilData ); + if( m_stencilData.DataCheck == TemplateDataCheck.Valid ) + { + propertyContainer.AddId( subBody, stencilParams, true ); + } + } + } + else + { + int stencilTagIdx = subBody.IndexOf( TemplatesManager.TemplateStencilTag ); + if( stencilTagIdx > -1 ) + { + m_stencilData.SetIndependentDefault(); + m_stencilData.StencilBufferId = TemplatesManager.TemplateStencilTag; + m_stencilData.StartIdx = offsetIdx + stencilTagIdx; + idManager.RegisterId( m_stencilData.StartIdx, uniquePrefix + m_stencilData.StencilBufferId, m_stencilData.StencilBufferId ); + propertyContainer.AddId( subBody, m_stencilData.StencilBufferId, true ); + } + } + } + //ZWRITE + { + Match zWriteMatch = Regex.Match( subBody, TemplateHelperFunctions.ZWriteWholeWordPattern ); + if( zWriteMatch.Success ) + { + int zWriteOpIdx = zWriteMatch.Index; + int zWriteEndIdx = subBody.IndexOf( TemplatesManager.TemplateNewLine, zWriteOpIdx ); + if( zWriteEndIdx > 0 ) + { + m_depthData.ZWriteModeId = subBody.Substring( zWriteOpIdx, zWriteEndIdx + 1 - zWriteOpIdx ); + m_depthData.ZWriteStartIndex = offsetIdx + zWriteOpIdx; + idManager.RegisterId( m_depthData.ZWriteStartIndex, uniquePrefix + m_depthData.ZWriteModeId, m_depthData.ZWriteModeId ); + TemplateHelperFunctions.CreateZWriteMode( m_depthData.ZWriteModeId, ref m_depthData ); + if( m_depthData.DataCheck == TemplateDataCheck.Valid ) + { + propertyContainer.AddId( subBody, m_depthData.ZWriteModeId, true ); + } + } + } + } + + //ZTEST + { + Match zTestMatch = Regex.Match( subBody, TemplateHelperFunctions.ZTestWholeWordPattern ); + if( zTestMatch.Success ) + { + int zTestOpIdx = zTestMatch.Index; + int zTestEndIdx = subBody.IndexOf( TemplatesManager.TemplateNewLine, zTestOpIdx ); + if( zTestEndIdx > 0 ) + { + m_depthData.ZTestModeId = subBody.Substring( zTestOpIdx, zTestEndIdx + 1 - zTestOpIdx ); + m_depthData.ZTestStartIndex = offsetIdx + zTestOpIdx; + idManager.RegisterId( m_depthData.ZTestStartIndex, uniquePrefix + m_depthData.ZTestModeId, m_depthData.ZTestModeId ); + TemplateHelperFunctions.CreateZTestMode( m_depthData.ZTestModeId, ref m_depthData ); + if( m_depthData.DataCheck == TemplateDataCheck.Valid ) + { + propertyContainer.AddId( subBody, m_depthData.ZTestModeId, true ); + } + } + } + } + + //ZOFFSET + { + Match zOffsetMatch = Regex.Match( subBody, TemplateHelperFunctions.ZOffsetWholeWordPattern ); + if( zOffsetMatch.Success ) + { + int zOffsetIdx = zOffsetMatch.Index; + int zOffsetEndIdx = subBody.IndexOf( TemplatesManager.TemplateNewLine, zOffsetIdx ); + if( zOffsetEndIdx > 0 ) + { + m_depthData.OffsetId = subBody.Substring( zOffsetIdx, zOffsetEndIdx + 1 - zOffsetIdx ); + m_depthData.OffsetStartIndex = offsetIdx + zOffsetIdx; + idManager.RegisterId( m_depthData.OffsetStartIndex, uniquePrefix + m_depthData.OffsetId, m_depthData.OffsetId ); + TemplateHelperFunctions.CreateZOffsetMode( m_depthData.OffsetId, ref m_depthData ); + if( m_depthData.DataCheck == TemplateDataCheck.Valid ) + { + propertyContainer.AddId( subBody, m_depthData.OffsetId, true ); + } + } + } + m_depthData.SetDataCheck(); + } + //TAGS + { + Match tagsMatch = Regex.Match( subBody, TemplateHelperFunctions.TagsWholeWordPattern ); + if ( tagsMatch.Success ) + { + int tagsIdx = tagsMatch.Index; + int tagsEndIdx = subBody.IndexOf( "}", tagsIdx ); + if ( tagsEndIdx > -1 ) + { + m_tagData.Reset(); + m_tagData.TagsId = subBody.Substring( tagsIdx, tagsEndIdx + 1 - tagsIdx ); + m_tagData.StartIdx = offsetIdx + tagsIdx; + idManager.RegisterId( m_tagData.StartIdx, uniquePrefix + m_tagData.TagsId, m_tagData.TagsId ); + m_srpType = TemplateHelperFunctions.CreateTags( ref m_tagData, isSubShader ); + + propertyContainer.AddId( subBody, m_tagData.TagsId, false ); + m_tagData.DataCheck = TemplateDataCheck.Valid; + } + else + { + m_tagData.DataCheck = TemplateDataCheck.Invalid; + } + } + else + { + m_tagData.DataCheck = TemplateDataCheck.Invalid; + } + } + + //SHADER MODEL + { + Match match = Regex.Match( subBody, TemplateHelperFunctions.ShaderModelPattern ); + if ( match != null && match.Groups.Count > 1 ) + { + if ( TemplateHelperFunctions.AvailableInterpolators.ContainsKey( match.Groups[ 1 ].Value ) ) + { + m_shaderModel.Id = match.Groups[ 0 ].Value; + m_shaderModel.StartIdx = offsetIdx + match.Index; + m_shaderModel.Value = match.Groups[ 1 ].Value; + m_shaderModel.InterpolatorAmount = TemplateHelperFunctions.AvailableInterpolators[ match.Groups[ 1 ].Value ]; + m_shaderModel.DataCheck = TemplateDataCheck.Valid; + idManager.RegisterId( m_shaderModel.StartIdx, uniquePrefix + m_shaderModel.Id, m_shaderModel.Id ); + } + else + { + m_shaderModel.DataCheck = TemplateDataCheck.Invalid; + } + } + } + + // ALL MODULES + int allModulesIndex = subBody.IndexOf( TemplatesManager.TemplateAllModulesTag ); + if( allModulesIndex > 0 ) + { + //ONLY REGISTER MISSING TAGS + ConfigureCommonTag( m_allModulesTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); + m_allModulesMode = true; + + m_blendData.SetAllModulesDefault(); + + if( !m_alphaToMaskData.IsValid ) + m_alphaToMaskData.SetAllModulesDefault(); + + if( !m_cullModeData.IsValid ) + m_cullModeData.SetAllModulesDefault(); + + if( !m_colorMaskData.IsValid ) + m_colorMaskData.SetAllModulesDefault(); + + if( !m_stencilData.IsValid ) + m_stencilData.SetAllModulesDefault(); + + if( !m_depthData.IsValid ) + m_depthData.SetAllModulesDefault(); + + if( !m_shaderModel.IsValid ) + m_shaderModel.SetAllModulesDefault(); + } + } + + public void TestPropertyInternalName( string name, ref List availableShaderProperties, ref Dictionary duplicatesHelper ) + { + if( !string.IsNullOrEmpty( name ) && !duplicatesHelper.ContainsKey( name )) + { + TemplateShaderPropertyData newData = new TemplateShaderPropertyData( -1, string.Empty, string.Empty, name, name, WirePortDataType.INT, PropertyType.Property,-1,-1 ); + availableShaderProperties.Add( newData ); + duplicatesHelper.Add( newData.PropertyName , newData ); + } + } + + public void RegisterInternalUnityInlines( ref List availableShaderProperties, ref Dictionary duplicatesHelper ) + { + TestPropertyInternalName( m_depthData.ZWriteInlineValue, ref availableShaderProperties , ref duplicatesHelper); + TestPropertyInternalName( m_depthData.ZTestInlineValue, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_depthData.OffsetFactorInlineValue, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_depthData.OffsetUnitsInlineValue, ref availableShaderProperties, ref duplicatesHelper ); + + TestPropertyInternalName( m_blendData.SourceFactorRGBInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData.DestFactorRGBInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData.SourceFactorAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData.DestFactorAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData.BlendOpRGBInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData.BlendOpAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); + + TestPropertyInternalName( m_blendData1.SourceFactorRGBInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData1.DestFactorRGBInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData1.SourceFactorAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData1.DestFactorAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData1.BlendOpRGBInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData1.BlendOpAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); + + TestPropertyInternalName( m_blendData2.SourceFactorRGBInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData2.DestFactorRGBInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData2.SourceFactorAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData2.DestFactorAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData2.BlendOpRGBInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData2.BlendOpAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); + + TestPropertyInternalName( m_blendData3.SourceFactorRGBInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData3.DestFactorRGBInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData3.SourceFactorAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData3.DestFactorAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData3.BlendOpRGBInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_blendData3.BlendOpAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); + + TestPropertyInternalName( m_alphaToMaskData.InlineData, ref availableShaderProperties, ref duplicatesHelper ); + + TestPropertyInternalName( m_stencilData.ReferenceInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_stencilData.ReadMaskInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_stencilData.WriteMaskInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_stencilData.ComparisonFrontInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_stencilData.PassFrontInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_stencilData.FailFrontInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_stencilData.ZFailFrontInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_stencilData.ComparisonBackInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_stencilData.PassBackInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_stencilData.FailBackInline, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_stencilData.ZFailBackInline, ref availableShaderProperties, ref duplicatesHelper ); + + TestPropertyInternalName( m_cullModeData.InlineData, ref availableShaderProperties, ref duplicatesHelper ); + + TestPropertyInternalName( m_colorMaskData.InlineData, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_colorMaskData1.InlineData, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_colorMaskData2.InlineData, ref availableShaderProperties, ref duplicatesHelper ); + TestPropertyInternalName( m_colorMaskData3.InlineData, ref availableShaderProperties, ref duplicatesHelper ); + } + + public void SetPassUniqueNameIfUndefined( string value ) + { + if( string.IsNullOrEmpty( m_passUniqueName ) ) + m_passUniqueName = value; + } + + public bool HasValidData + { + get + { + return m_blendData.DataCheck == TemplateDataCheck.Valid || + m_blendData1.DataCheck == TemplateDataCheck.Valid || + m_blendData2.DataCheck == TemplateDataCheck.Valid || + m_blendData3.DataCheck == TemplateDataCheck.Valid || + m_alphaToMaskData.DataCheck == TemplateDataCheck.Valid || + m_cullModeData.DataCheck == TemplateDataCheck.Valid || + m_colorMaskData.DataCheck == TemplateDataCheck.Valid || + m_colorMaskData1.DataCheck == TemplateDataCheck.Valid || + m_colorMaskData2.DataCheck == TemplateDataCheck.Valid || + m_colorMaskData3.DataCheck == TemplateDataCheck.Valid || + m_stencilData.DataCheck == TemplateDataCheck.Valid || + m_depthData.DataCheck == TemplateDataCheck.Valid || + m_tagData.DataCheck == TemplateDataCheck.Valid || + m_shaderModel.DataCheck == TemplateDataCheck.Valid || + m_globalsTag.IsValid || + m_srpBatcherTag.IsValid || + m_allModulesTag.IsValid || + m_functionsTag.IsValid || + m_pragmaTag.IsValid || + m_pragmaBeforeTag.IsValid || + m_passTag.IsValid || + m_inputsVertTag.IsValid || + m_inputsFragTag.IsValid || + m_renderPlatformHelper.IsValid; + } + } + + public TemplateBlendData BlendData { get { return m_blendData; } } + public TemplateBlendData BlendData1 { get { return m_blendData1; } } + public TemplateBlendData BlendData2 { get { return m_blendData2; } } + public TemplateBlendData BlendData3 { get { return m_blendData3; } } + public TemplateAlphaToMaskData AlphaToMaskData { get { return m_alphaToMaskData; } } + public TemplateCullModeData CullModeData { get { return m_cullModeData; } } + public TemplateColorMaskData ColorMaskData { get { return m_colorMaskData; } } + public TemplateColorMaskData ColorMaskData1 { get { return m_colorMaskData1; } } + public TemplateColorMaskData ColorMaskData2 { get { return m_colorMaskData2; } } + public TemplateColorMaskData ColorMaskData3 { get { return m_colorMaskData3; } } + public TemplateStencilData StencilData { get { return m_stencilData; } } + public TemplateDepthData DepthData { get { return m_depthData; } } + public TemplateTagsModuleData TagData { get { return m_tagData; } } + public TemplateTagData GlobalsTag { get { return m_globalsTag; } } + public TemplateTagData SRPBatcherTag { get { return m_srpBatcherTag; } } + public TemplateTagData AllModulesTag { get { return m_allModulesTag; } } + public TemplateTagData FunctionsTag { get { return m_functionsTag; } } + public TemplateTagData PragmaTag { get { return m_pragmaTag; } } + public TemplateTagData PragmaBeforeTag { get { return m_pragmaBeforeTag; } } + public TemplateTagData PassTag { get { return m_passTag; } } + public TemplateTagData InputsVertTag { get { return m_inputsVertTag; } } + public TemplateTagData InputsFragTag { get { return m_inputsFragTag; } } + public TemplateShaderModelData ShaderModel { get { return m_shaderModel; } } + public TemplateSRPType SRPType { get { return m_srpType; } set { m_srpType = value; } } + public bool SRPIsPBR { get { return m_srpIsPBR; } set { m_srpIsPBR = value; } } + public bool SRPIsPBRHD { get { return m_srpIsPBR && m_srpType == TemplateSRPType.HDRP; } } + public string UniquePrefix { get { return m_uniquePrefix; } } + public string PassUniqueName { get { return m_passUniqueName; } } + public bool HasPassUniqueName { get { return !string.IsNullOrEmpty( m_passUniqueName ); } } + public TemplateIncludePragmaContainter IncludePragmaContainer { get { return m_includePragmaContainer; } } + public TemplateRenderPlatformHelper RenderPlatformHelper { get { return m_renderPlatformHelper; } } + public bool AllModulesMode { get { return m_allModulesMode; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs.meta new file mode 100644 index 00000000..f2101758 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 122447ac2bc376a448a42a0f5373e63b +timeCreated: 1521718529 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs new file mode 100644 index 00000000..5ef0d4cf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs @@ -0,0 +1,1499 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; +using System.Text.RegularExpressions; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateUniquePassData + { + public int SubShaderIdx; + public int PassIdx; + } + + [Serializable] + public sealed class TemplateMultiPass : TemplateDataParent + { + [SerializeField] + private List m_availableShaderProperties = new List(); + + [SerializeField] + private List m_subShaders = new List(); + + [SerializeField] + private TemplateTagData m_propertyTag; + + [SerializeField] + private TemplateIdManager m_templateIdManager; + + [SerializeField] + private string m_shaderNameId = string.Empty; + + [SerializeField] + private string m_shaderBody; + + [SerializeField] + private TemplatePropertyContainer m_templateProperties = new TemplatePropertyContainer(); + + [SerializeField] + private TemplateShaderInfo m_shaderData; + + [SerializeField] + private bool m_isSinglePass = false; + + [SerializeField] + private int m_masterNodesRequired = 0; + + [SerializeField] + TemplateInfoContainer m_customInspectorContainer = new TemplateInfoContainer(); + + [SerializeField] + TemplateInfoContainer m_dependenciesContainer = new TemplateInfoContainer(); + + [SerializeField] + TemplateInfoContainer m_fallbackContainer = new TemplateInfoContainer(); + + [SerializeField] + TemplateInfoContainer m_beforePragmaContainer = new TemplateInfoContainer(); + + [SerializeField] + private CustomTemplatePropertyUIEnum m_customTemplatePropertyUI = CustomTemplatePropertyUIEnum.None; + + [SerializeField] + private int m_lodInjectorId = -1; + + [SerializeField] + TemplateShaderModelData m_globalShaderModel = new TemplateShaderModelData(); + + private Dictionary m_passUniqueIdData = new Dictionary(); + + [NonSerialized] + private List m_allShaderProperties; + + public TemplateMultiPass() + { + m_templateType = TemplateDataType.MultiPass; + } + + public TemplateMultiPass( string name, string guid, string path, bool isCommunity ) + { + m_templateType = TemplateDataType.MultiPass; + Init( name, guid, path, isCommunity ); + } + + public override void Init( string name, string guid, string path, bool isCommunity ) + { + base.Init( name, guid, path, isCommunity ); + TemplatesManager.CurrTemplateGUIDLoaded = guid; + LoadTemplateBody( guid, path ); + Name = string.IsNullOrEmpty( name ) ? m_defaultShaderName : name; + } + + ///////////////////////////////////////////////////////////////////////////////////// + // SRP Conditionals + ///////////////////////////////////////////////////////////////////////////////////// + + void LoadTemplateBody( string guid, string path ) + { + m_passUniqueIdData.Clear(); + m_guid = guid; + + string shaderBody = IOUtils.LoadTextFileFromDisk( path ); + if ( string.IsNullOrEmpty( shaderBody ) ) + { + m_isValid = false; + return; + } + + shaderBody = UIUtils.ForceLFLineEnding( shaderBody ); + + // @diogo: Process SRP Conditionals => high priority + shaderBody = TemplateHelperFunctions.ProcessUnityConditionals( shaderBody ); + shaderBody = TemplateHelperFunctions.ProcessSRPConditionals( shaderBody ); + + // Insert Before Tag + MatchCollection col = Regex.Matches( shaderBody, TemplateHelperFunctions.BeforePragmaPattern, RegexOptions.Singleline ); + for( int i = col.Count - 1; i >= 0; i-- ) + { + if( col[ i ].Groups.Count == 3 ) + { + shaderBody = shaderBody.Insert( col[ i ].Groups[ 2 ].Index, TemplatesManager.TemplatePragmaBeforeTag + "\n" + col[ i ].Groups[ 1 ].Value ); + } + } + //Detect SRP Batcher + MatchCollection srpMatch = Regex.Matches( shaderBody, TemplateHelperFunctions.SRPBatcherFindTag ); + for( int i = srpMatch.Count - 1; i >= 0; i-- ) + { + if( srpMatch[ i ].Groups.Count == 2 ) + { + shaderBody = shaderBody.Insert( srpMatch[ i ].Groups[ 0 ].Index + srpMatch[ i ].Groups[ 0 ].Length, TemplatesManager.TemplateSRPBatcherTag + srpMatch[ i ].Groups[ 1 ].Value ); + } + } + + + // Detect if template has LOD tag, if not, insert one + // It will be read and processed over the TemplateSubShader constructor + { + Match match = Regex.Match( shaderBody, TemplateHelperFunctions.SubShaderLODPattern ); + if( match == null || ( match != null && !match.Success ) ) + { + MatchCollection subShaderMatch = Regex.Matches( shaderBody, TemplatesManager.TemplateMPSubShaderTag ); + + int subShaderAmount = subShaderMatch.Count; + + for( int i = subShaderAmount - 1; i > -1; i-- ) + { + if( subShaderMatch[ i ].Success ) + { + shaderBody = shaderBody.Insert( subShaderMatch[ i ].Index + subShaderMatch[ i ].Length, "\n\t\t\tLOD 0\n" ); + } + } + } + } + m_shaderData = TemplateShaderInfoUtil.CreateShaderData( shaderBody ); + if( m_shaderData == null ) + { + m_isValid = false; + return; + } + + m_templateIdManager = new TemplateIdManager( shaderBody ); + + try + { + int nameBegin = shaderBody.IndexOf( TemplatesManager.TemplateShaderNameBeginTag ); + if( nameBegin < 0 ) + { + // Not a template + return; + } + + int nameEnd = shaderBody.IndexOf( TemplatesManager.TemplateFullEndTag, nameBegin ); + if( nameEnd < 0 ) + return; + + + m_shaderBody = shaderBody; + int defaultBegin = nameBegin + TemplatesManager.TemplateShaderNameBeginTag.Length; + int defaultLength = nameEnd - defaultBegin; + m_defaultShaderName = shaderBody.Substring( defaultBegin, defaultLength ); + int[] nameIdx = m_defaultShaderName.AllIndexesOf( "\"" ); + nameIdx[ 0 ] += 1; // Ignore the " character from the string + m_defaultShaderName = m_defaultShaderName.Substring( nameIdx[ 0 ], nameIdx[ 1 ] - nameIdx[ 0 ] ); + m_shaderNameId = shaderBody.Substring( nameBegin, nameEnd + TemplatesManager.TemplateFullEndTag.Length - nameBegin ); + m_templateProperties.AddId( shaderBody, m_shaderNameId, false ); + m_templateIdManager.RegisterId( nameBegin, m_shaderNameId, m_shaderNameId ); + shaderBody = shaderBody.Substring( nameEnd + TemplatesManager.TemplateFullEndTag.Length ); + } + catch( Exception e ) + { + Debug.LogException( e ); + m_isValid = false; + } + + m_customTemplatePropertyUI = TemplateHelperFunctions.FetchCustomUI( shaderBody ); + TemplateHelperFunctions.FetchDependencies( m_dependenciesContainer, ref m_shaderBody ); + if( m_dependenciesContainer.IsValid ) + { + int index = m_dependenciesContainer.Id.IndexOf( TemplatesManager.TemplateDependenciesListTag ); + m_templateProperties.AddId( new TemplateProperty( m_dependenciesContainer.Id, m_dependenciesContainer.Id.Substring( 0, index ), true ) ); + m_templateIdManager.RegisterId( m_dependenciesContainer.Index, m_dependenciesContainer.Id, m_dependenciesContainer.Id ); + } + + TemplateHelperFunctions.FetchCustomInspector( m_customInspectorContainer, ref m_shaderBody ); + if( m_customInspectorContainer.IsValid ) + { + int index = m_customInspectorContainer.Id.IndexOf( "CustomEditor" ); + m_templateProperties.AddId( new TemplateProperty( m_customInspectorContainer.Id, m_customInspectorContainer.Id.Substring( 0, index ), true ) ); + m_templateIdManager.RegisterId( m_customInspectorContainer.Index, m_customInspectorContainer.Id, m_customInspectorContainer.Id ); + } + + TemplateHelperFunctions.FetchFallback( m_fallbackContainer, ref m_shaderBody ); + if( m_fallbackContainer.IsValid ) + { + int index = m_fallbackContainer.Id.IndexOf( "Fallback", StringComparison.InvariantCultureIgnoreCase ); + m_templateProperties.AddId( new TemplateProperty( m_fallbackContainer.Id, m_fallbackContainer.Id.Substring( 0, index ), true ) ); + m_templateIdManager.RegisterId( m_fallbackContainer.Index, m_fallbackContainer.Id, m_fallbackContainer.Id ); + } + + m_lodInjectorId = m_shaderBody.IndexOf( TemplatesManager.TemplateLODsTag ); + + // Shader body may have been changed to inject inexisting tags like fallback + m_templateIdManager.ShaderBody = m_shaderBody; + + m_propertyTag = new TemplateTagData( m_shaderData.PropertyStartIdx, TemplatesManager.TemplatePropertyTag, true ); + m_templateIdManager.RegisterId( m_shaderData.PropertyStartIdx, TemplatesManager.TemplatePropertyTag, TemplatesManager.TemplatePropertyTag ); + m_templateProperties.AddId( shaderBody, TemplatesManager.TemplatePropertyTag, true ); + Dictionary duplicatesHelper = new Dictionary(); + TemplateHelperFunctions.CreateShaderPropertiesList( m_shaderData.Properties, ref m_availableShaderProperties, ref duplicatesHelper,-1,-1 ); + for( int i = 0; i < m_availableShaderProperties.Count; i++ ) + { + m_templateIdManager.RegisterId( m_availableShaderProperties[ i ].Index, m_availableShaderProperties[ i ].FullValue, m_availableShaderProperties[ i ].FullValue ); + } + + int subShaderCount = m_shaderData.SubShaders.Count; + + int mainSubShaderIdx = -1; + int mainPassIdx = -1; + + int firstVisibleSubShaderId = -1; + int firstVisiblePassId = -1; + bool foundMainPass = false; + bool foundFirstVisible = false; + + m_templateIdManager.RegisterTag( TemplatesManager.TemplatePassesEndTag ); + m_templateIdManager.RegisterTag( TemplatesManager.TemplateMainPassTag ); + + //SHADER MODEL + { + Match shaderModelMatch = Regex.Match( m_shaderData.Properties, TemplateHelperFunctions.ShaderModelPattern ); + if( shaderModelMatch != null && shaderModelMatch.Success ) + { + if( TemplateHelperFunctions.AvailableInterpolators.ContainsKey( shaderModelMatch.Groups[ 1 ].Value ) ) + { + m_globalShaderModel.Id = shaderModelMatch.Groups[ 0 ].Value; + m_globalShaderModel.StartIdx = shaderModelMatch.Index; + m_globalShaderModel.Value = shaderModelMatch.Groups[ 1 ].Value; + m_globalShaderModel.InterpolatorAmount = TemplateHelperFunctions.AvailableInterpolators[ shaderModelMatch.Groups[ 1 ].Value ]; + m_globalShaderModel.DataCheck = TemplateDataCheck.Valid; + } + else + { + m_globalShaderModel.DataCheck = TemplateDataCheck.Invalid; + } + } + } + // + + + for( int i = 0; i < subShaderCount; i++ ) + { + TemplateSubShader subShader = new TemplateSubShader(this, i, m_templateIdManager, "SubShader" + i, m_shaderData.SubShaders[ i ], ref duplicatesHelper ); + + if( subShader.FoundMainPass ) + { + if( !foundMainPass ) + { + foundMainPass = true; + mainSubShaderIdx = i; + mainPassIdx = subShader.MainPass; + } + } + else if( subShader.MainPass > -1 ) + { + if( !foundFirstVisible ) + { + foundFirstVisible = true; + firstVisibleSubShaderId = i; + firstVisiblePassId = subShader.MainPass; + } + } + + m_subShaders.Add( subShader ); + m_masterNodesRequired += subShader.Passes.Count; + } + + + if( !foundMainPass && foundFirstVisible ) + { + mainSubShaderIdx = firstVisibleSubShaderId; + mainPassIdx = firstVisiblePassId; + } + + for( int subShaderIdx = 0; subShaderIdx < subShaderCount; subShaderIdx++ ) + { + m_subShaders[ subShaderIdx ].Modules.RegisterInternalUnityInlines( ref m_availableShaderProperties , ref duplicatesHelper ); + int passCount = m_subShaders[ subShaderIdx ].Passes.Count; + for( int passIdx = 0; passIdx < passCount; passIdx++ ) + { + m_subShaders[ subShaderIdx ].Passes[ passIdx ].Modules.RegisterInternalUnityInlines( ref m_availableShaderProperties, ref duplicatesHelper ); + m_subShaders[ subShaderIdx ].Passes[ passIdx ].IsMainPass = ( mainSubShaderIdx == subShaderIdx && mainPassIdx == passIdx ); + } + } + + duplicatesHelper.Clear(); + duplicatesHelper = null; + m_isSinglePass = ( m_subShaders.Count == 1 && m_subShaders[ 0 ].PassAmount == 1 ); + + } + + public void ResetState() + { + m_templateIdManager.ResetRegistersState(); + int subshaderCount = m_subShaders.Count; + for( int subShaderIdx = 0; subShaderIdx < subshaderCount; subShaderIdx++ ) + { + m_subShaders[ subShaderIdx ].TemplateProperties.ResetTemplateUsageData(); + int passCount = m_subShaders[ subShaderIdx ].Passes.Count; + for( int passIdx = 0; passIdx < passCount; passIdx++ ) + { + m_subShaders[ subShaderIdx ].Passes[ passIdx ].TemplateProperties.ResetTemplateUsageData(); + } + } + } + + public override void Destroy() + { + m_templateProperties.Destroy(); + m_templateProperties = null; + + m_availableShaderProperties.Clear(); + m_availableShaderProperties = null; + if( m_allShaderProperties != null ) + { + m_allShaderProperties.Clear(); + m_allShaderProperties = null; + } + + int subShaderCount = m_subShaders.Count; + for( int i = 0; i < subShaderCount; i++ ) + { + m_subShaders[ i ].Destroy(); + } + + m_subShaders.Clear(); + m_subShaders = null; + + m_templateIdManager.Destroy(); + m_templateIdManager = null; + } + + public void SetSubShaderData( TemplateModuleDataType type, int subShaderId, string[] list ) + { + string id = GetSubShaderDataId( type, subShaderId, false ); + string body = string.Empty; + FillTemplateBody( subShaderId, -1, id, ref body, list ); + SetSubShaderData( type, subShaderId, body ); + } + + public void SetSubShaderData( TemplateModuleDataType type, int subShaderId, List list ) + { + string id = GetSubShaderDataId( type, subShaderId, false ); + string body = string.Empty; + FillTemplateBody( subShaderId, -1, id, ref body, list ); + SetSubShaderData( type, subShaderId, body ); + } + + public void SetSubShaderData( TemplateModuleDataType type, int subShaderId, string text ) + { + if( subShaderId >= m_subShaders.Count ) + return; + + string prefix = m_subShaders[ subShaderId ].Modules.UniquePrefix; + switch( type ) + { + case TemplateModuleDataType.AllModules: + { + m_templateIdManager.SetReplacementText( prefix + TemplatesManager.TemplateAllModulesTag, text ); + } + break; + case TemplateModuleDataType.ModuleShaderModel: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.ShaderModel.Id, text ); + } + break; + case TemplateModuleDataType.ModuleBlendMode: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendModeId, text ); + } + break; + case TemplateModuleDataType.ModuleBlendMode1: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData1.BlendModeId, text ); + } + break; + case TemplateModuleDataType.ModuleBlendMode2: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData2.BlendModeId, text ); + } + break; + case TemplateModuleDataType.ModuleBlendMode3: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData3.BlendModeId, text ); + } + break; + case TemplateModuleDataType.ModuleBlendOp: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendOpId, text ); + } + break; + case TemplateModuleDataType.ModuleBlendOp1: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData1.BlendOpId, text ); + } + break; + case TemplateModuleDataType.ModuleBlendOp2: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData2.BlendOpId, text ); + } + break; + case TemplateModuleDataType.ModuleBlendOp3: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData3.BlendOpId, text ); + } + break; + case TemplateModuleDataType.ModuleAlphaToMask: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.AlphaToMaskData.AlphaToMaskId, text ); + } + break; + case TemplateModuleDataType.ModuleCullMode: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.CullModeData.CullModeId, text ); + } + break; + case TemplateModuleDataType.ModuleColorMask: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData.ColorMaskId, text ); + } + break; + case TemplateModuleDataType.ModuleColorMask1: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData1.ColorMaskId, text ); + } + break; + case TemplateModuleDataType.ModuleColorMask2: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData2.ColorMaskId, text ); + } + break; + case TemplateModuleDataType.ModuleColorMask3: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData3.ColorMaskId, text ); + } + break; + case TemplateModuleDataType.ModuleStencil: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.StencilData.StencilBufferId, text ); + } + break; + case TemplateModuleDataType.ModuleZwrite: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZWriteModeId, text ); + } + break; + case TemplateModuleDataType.ModuleZTest: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZTestModeId, text ); + } + break; + case TemplateModuleDataType.ModuleZOffset: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.DepthData.OffsetId, text ); + } + break; + case TemplateModuleDataType.ModuleTag: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.TagData.TagsId, text ); + } + break; + case TemplateModuleDataType.ModuleGlobals: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.GlobalsTag.Id, text ); + } + break; + case TemplateModuleDataType.ModuleSRPBatcher: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.SRPBatcherTag.Id, text ); + } + break; + case TemplateModuleDataType.ModuleFunctions: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.FunctionsTag.Id, text ); + } + break; + case TemplateModuleDataType.ModulePragma: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.PragmaTag.Id, text ); + } + break; + case TemplateModuleDataType.ModulePragmaBefore: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.PragmaBeforeTag.Id, text ); + } + break; + case TemplateModuleDataType.ModulePass: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.PassTag.Id, text ); + } + break; + case TemplateModuleDataType.ModuleInputVert: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.InputsVertTag.Id, text ); + } + break; + case TemplateModuleDataType.ModuleInputFrag: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.InputsFragTag.Id, text ); + }break; + case TemplateModuleDataType.ModuleRenderPlatforms: + { + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.RenderPlatformHelper.ID , text ); + }break; + } + } + + public void SetPropertyData( string[] properties ) + { + string body = string.Empty; + FillTemplateBody( -1, -1, TemplatesManager.TemplatePropertyTag, ref body, properties ); + SetPropertyData( body ); + } + + + public void SetPropertyData( string text ) + { + m_templateIdManager.SetReplacementText( m_propertyTag.Id, text ); + } + + public string GetSubShaderDataId( TemplateModuleDataType type, int subShaderId, bool addPrefix ) + { + if( subShaderId >= m_subShaders.Count ) + return string.Empty; + + string prefix = string.Empty; + switch( type ) + { + case TemplateModuleDataType.AllModules: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + TemplatesManager.TemplateAllModulesTag; + } + case TemplateModuleDataType.ModuleBlendMode: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendModeId; + } + case TemplateModuleDataType.ModuleBlendMode1: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.BlendData1.BlendModeId; + } + case TemplateModuleDataType.ModuleBlendMode2: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.BlendData2.BlendModeId; + } + case TemplateModuleDataType.ModuleBlendMode3: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.BlendData3.BlendModeId; + } + case TemplateModuleDataType.ModuleBlendOp: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendOpId; + } + case TemplateModuleDataType.ModuleBlendOp1: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.BlendData1.BlendOpId; + } + case TemplateModuleDataType.ModuleBlendOp2: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.BlendData2.BlendOpId; + } + case TemplateModuleDataType.ModuleBlendOp3: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.BlendData3.BlendOpId; + } + case TemplateModuleDataType.ModuleAlphaToMask: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.AlphaToMaskData.AlphaToMaskId; + } + case TemplateModuleDataType.ModuleCullMode: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.CullModeData.CullModeId; + } + case TemplateModuleDataType.ModuleColorMask: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData.ColorMaskId; + } + case TemplateModuleDataType.ModuleColorMask1: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData1.ColorMaskId; + } + case TemplateModuleDataType.ModuleColorMask2: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData2.ColorMaskId; + } + case TemplateModuleDataType.ModuleColorMask3: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData3.ColorMaskId; + } + case TemplateModuleDataType.ModuleStencil: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.StencilData.StencilBufferId; + } + case TemplateModuleDataType.ModuleZwrite: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZWriteModeId; + } + case TemplateModuleDataType.ModuleZTest: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZTestModeId; + } + case TemplateModuleDataType.ModuleZOffset: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.DepthData.OffsetId; + } + case TemplateModuleDataType.ModuleTag: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.TagData.TagsId; + } + case TemplateModuleDataType.ModuleGlobals: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.GlobalsTag.Id; + } + case TemplateModuleDataType.ModuleSRPBatcher: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.SRPBatcherTag.Id; + } + case TemplateModuleDataType.ModuleFunctions: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.FunctionsTag.Id; + } + case TemplateModuleDataType.ModulePragma: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.PragmaTag.Id; + } + case TemplateModuleDataType.ModulePragmaBefore: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.PragmaBeforeTag.Id; + } + case TemplateModuleDataType.ModulePass: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.PassTag.Id; + } + case TemplateModuleDataType.ModuleInputVert: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.InputsVertTag.Id; + } + case TemplateModuleDataType.ModuleInputFrag: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Modules.InputsFragTag.Id; + } + } + return string.Empty; + + } + public string GetPassDataId( TemplateModuleDataType type, int subShaderId, int passId, bool addPrefix ) + { + if( subShaderId >= m_subShaders.Count || passId >= m_subShaders[ subShaderId ].Passes.Count ) + return string.Empty; + + string prefix = string.Empty; + switch( type ) + { + case TemplateModuleDataType.AllModules: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + TemplatesManager.TemplateAllModulesTag; + } + case TemplateModuleDataType.ModuleBlendMode: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendModeId; + } + case TemplateModuleDataType.ModuleBlendMode1: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData1.BlendModeId; + } + case TemplateModuleDataType.ModuleBlendMode2: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData2.BlendModeId; + } + case TemplateModuleDataType.ModuleBlendMode3: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData3.BlendModeId; + } + case TemplateModuleDataType.ModuleBlendOp: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendOpId; + } + case TemplateModuleDataType.ModuleBlendOp1: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData1.BlendOpId; + } + case TemplateModuleDataType.ModuleBlendOp2: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData2.BlendOpId; + } + case TemplateModuleDataType.ModuleBlendOp3: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData3.BlendOpId; + } + case TemplateModuleDataType.ModuleAlphaToMask: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.AlphaToMaskData.AlphaToMaskId; + } + case TemplateModuleDataType.ModuleCullMode: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.CullModeData.CullModeId; + } + case TemplateModuleDataType.ModuleColorMask: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData.ColorMaskId; + } + case TemplateModuleDataType.ModuleColorMask1: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData1.ColorMaskId; + } + case TemplateModuleDataType.ModuleColorMask2: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData2.ColorMaskId; + } + case TemplateModuleDataType.ModuleColorMask3: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData3.ColorMaskId; + } + case TemplateModuleDataType.ModuleStencil: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.StencilData.StencilBufferId; + } + case TemplateModuleDataType.ModuleZwrite: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZWriteModeId; + } + case TemplateModuleDataType.ModuleZTest: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZTestModeId; + } + case TemplateModuleDataType.ModuleZOffset: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.OffsetId; + } + case TemplateModuleDataType.ModuleTag: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.TagData.TagsId; + } + case TemplateModuleDataType.ModuleGlobals: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.GlobalsTag.Id; + } + case TemplateModuleDataType.ModuleSRPBatcher: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.SRPBatcherTag.Id; + } + case TemplateModuleDataType.ModuleFunctions: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.FunctionsTag.Id; + } + case TemplateModuleDataType.ModulePragma: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PragmaTag.Id; + } + case TemplateModuleDataType.ModulePragmaBefore: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PragmaBeforeTag.Id; + } + case TemplateModuleDataType.ModulePass: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PassTag.Id; + } + case TemplateModuleDataType.ModuleInputVert: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsVertTag.Id; + } + case TemplateModuleDataType.ModuleInputFrag: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsFragTag.Id; + } + case TemplateModuleDataType.PassVertexFunction: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexFunctionData.Id; + } + case TemplateModuleDataType.PassFragmentFunction: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData.Id; + } + case TemplateModuleDataType.PassVertexData: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexDataContainer.VertexDataId; + } + case TemplateModuleDataType.PassInterpolatorData: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].InterpolatorDataContainer.InterpDataId; + } + case TemplateModuleDataType.VControl: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessVControlTag.Id; + } + case TemplateModuleDataType.ControlData: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessControlData.Id; + } + case TemplateModuleDataType.DomainData: + { + prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty; + return prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessDomainData.Id; + } + } + return string.Empty; + } + + public void SetPassData( TemplateModuleDataType type, int subShaderId, int passId, string[] list ) + { + //if( list == null || list.Length == 0 ) + // return; + + string id = GetPassDataId( type, subShaderId, passId, false ); + string body = string.Empty; + FillTemplateBody( subShaderId, passId, id, ref body, list ); + SetPassData( type, subShaderId, passId, body ); + } + + public void SetPassData( TemplateModuleDataType type, int subShaderId, int passId, List list ) + { + //if( list == null || list.Count == 0 ) + // return; + + string id = GetPassDataId( type, subShaderId, passId, false ); + string body = string.Empty; + FillTemplateBody( subShaderId, passId, id, ref body, list ); + SetPassData( type, subShaderId, passId, body ); + } + + public void SetPassData( TemplateModuleDataType type, int subShaderId, int passId, string text ) + { + if( subShaderId >= m_subShaders.Count || passId >= m_subShaders[ subShaderId ].Passes.Count ) + return; + + string prefix = string.Empty; + switch( type ) + { + //case TemplateModuleDataType.EndPass: + //{ + // prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; + // m_templateIdManager.SetReplacementText( prefix + TemplatesManager.TemplateEndPassTag, text ); + //} + //break; + case TemplateModuleDataType.AllModules: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + TemplatesManager.TemplateAllModulesTag, text ); + } + break; + case TemplateModuleDataType.ModuleRenderPlatforms: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.RenderPlatformHelper.ID , text ); + } + break; + case TemplateModuleDataType.ModuleShaderModel: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ShaderModel.Id, text ); + } + break; + case TemplateModuleDataType.ModuleBlendMode: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendModeId, text ); + } + break; + case TemplateModuleDataType.ModuleBlendMode1: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData1.BlendModeId, text ); + } + break; + case TemplateModuleDataType.ModuleBlendMode2: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData2.BlendModeId, text ); + } + break; + case TemplateModuleDataType.ModuleBlendMode3: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData3.BlendModeId, text ); + } + break; + case TemplateModuleDataType.ModuleBlendOp: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendOpId, text ); + } + break; + case TemplateModuleDataType.ModuleBlendOp1: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData1.BlendOpId, text ); + } + break; + case TemplateModuleDataType.ModuleBlendOp2: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData2.BlendOpId, text ); + } + break; + case TemplateModuleDataType.ModuleBlendOp3: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData3.BlendOpId, text ); + } + break; + case TemplateModuleDataType.ModuleAlphaToMask: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.AlphaToMaskData.AlphaToMaskId, text ); + } + break; + case TemplateModuleDataType.ModuleCullMode: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.CullModeData.CullModeId, text ); + } + break; + case TemplateModuleDataType.ModuleColorMask: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData.ColorMaskId, text ); + } + break; + case TemplateModuleDataType.ModuleColorMask1: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData1.ColorMaskId, text ); + } + break; + case TemplateModuleDataType.ModuleColorMask2: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData2.ColorMaskId, text ); + } + break; + case TemplateModuleDataType.ModuleColorMask3: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData3.ColorMaskId, text ); + } + break; + case TemplateModuleDataType.ModuleStencil: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.StencilData.StencilBufferId, text ); + } + break; + case TemplateModuleDataType.ModuleZwrite: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZWriteModeId, text ); + } + break; + case TemplateModuleDataType.ModuleZTest: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZTestModeId, text ); + } + break; + case TemplateModuleDataType.ModuleZOffset: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.OffsetId, text ); + } + break; + case TemplateModuleDataType.ModuleTag: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.TagData.TagsId, text ); + } + break; + case TemplateModuleDataType.ModuleGlobals: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.GlobalsTag.Id, text ); + } + break; + case TemplateModuleDataType.ModuleSRPBatcher: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.SRPBatcherTag.Id, text ); + } + break; + case TemplateModuleDataType.ModuleFunctions: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.FunctionsTag.Id, text ); + } + break; + case TemplateModuleDataType.ModulePragma: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PragmaTag.Id, text ); + } + break; + case TemplateModuleDataType.ModulePragmaBefore: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PragmaBeforeTag.Id, text ); + } + break; + case TemplateModuleDataType.ModulePass: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PassTag.Id, text ); + } + break; + case TemplateModuleDataType.ModuleInputVert: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsVertTag.Id, text ); + } + break; + case TemplateModuleDataType.ModuleInputFrag: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsFragTag.Id, text ); + } + break; + case TemplateModuleDataType.PassVertexFunction: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexFunctionData.Id, text ); + } + break; + case TemplateModuleDataType.PassFragmentFunction: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData.Id, text ); + } + break; + case TemplateModuleDataType.PassVertexData: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexDataContainer.VertexDataId, text ); + } + break; + case TemplateModuleDataType.PassInterpolatorData: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].InterpolatorDataContainer.InterpDataId, text ); + } + break; + case TemplateModuleDataType.PassNameData: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].PassNameContainer.Id, text ); + } + break; + case TemplateModuleDataType.VControl: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessVControlTag.Id, text ); + } + break; + case TemplateModuleDataType.ControlData: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessControlData.Id, text ); + } + break; + case TemplateModuleDataType.DomainData: + { + prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessDomainData.Id, text ); + }break; + } + } + + public void SetPassInputData( int subShaderId, int passId, int inputId, string text ) + { + if( subShaderId >= m_subShaders.Count || + passId >= m_subShaders[ subShaderId ].Passes.Count ) + return; + + string prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; + TemplateInputData inputData = m_subShaders[ subShaderId ].Passes[ passId ].InputDataFromId( inputId ); + if( inputData != null ) + { + m_templateIdManager.SetReplacementText( prefix + inputData.TagId, text ); + } + else + { + Debug.LogErrorFormat( "Unable to find input data for port with id {0} on subshader {1} pass {2}", inputId, subShaderId, passId ); + } + } + + public void SetPassInputDataByArrayIdx( int subShaderId, int passId, int inputId, string text ) + { + if( subShaderId >= m_subShaders.Count || + passId >= m_subShaders[ subShaderId ].Passes.Count || + inputId >= m_subShaders[ subShaderId ].Passes[ passId ].InputDataList.Count ) + return; + + string prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; + m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].InputDataList[ inputId ].TagId, text ); + } + + public TemplateData CreateTemplateData( string name, string guid, int subShaderId, int passId ) + { + if( subShaderId >= m_subShaders.Count || + passId >= m_subShaders[ subShaderId ].Passes.Count ) + return null; + + if( string.IsNullOrEmpty( name ) ) + name = m_defaultShaderName; + + TemplateData templateData = ScriptableObject.CreateInstance(); + templateData.Name = name; + templateData.GUID = guid; + templateData.TemplateBody = m_shaderBody; + templateData.DefaultShaderName = m_defaultShaderName; + templateData.ShaderNameId = m_shaderNameId; + templateData.OrderId = m_orderId; + + templateData.InputDataList = SubShaders[ subShaderId ].Passes[ passId ].InputDataList; + templateData.VertexDataContainer = SubShaders[ subShaderId ].Passes[ passId ].VertexDataContainer; + templateData.InterpolatorDataContainer = SubShaders[ subShaderId ].Passes[ passId ].InterpolatorDataContainer; + templateData.AvailableShaderProperties = m_availableShaderProperties; + templateData.VertexFunctionData = SubShaders[ subShaderId ].Passes[ passId ].VertexFunctionData; + templateData.FragmentFunctionData = SubShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData; + templateData.BlendData = SubShaders[ subShaderId ].Passes[ passId ].Modules.BlendData; + templateData.CullModeData = SubShaders[ subShaderId ].Passes[ passId ].Modules.CullModeData; + templateData.ColorMaskData = SubShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData; + templateData.StencilData = SubShaders[ subShaderId ].Passes[ passId ].Modules.StencilData; + templateData.DepthData = SubShaders[ subShaderId ].Passes[ passId ].Modules.DepthData; + templateData.TagData = SubShaders[ subShaderId ].Passes[ passId ].Modules.TagData; + + //templateData.PropertyList = m_pr; + //private Dictionary m_propertyDict = new Dictionary(); + + return templateData; + } + + public bool FillTemplateBody( int subShaderId, int passId, string id, ref string body, List values ) + { + if( values.Count == 0 ) + { + return true; + } + + string[] array = new string[ values.Count ]; + for( int i = 0; i < values.Count; i++ ) + { + array[ i ] = values[ i ].PropertyName; + } + return FillTemplateBody( subShaderId, passId, id, ref body, array ); + } + + public bool FillTemplateBody( int subShaderId, int passId, string id, ref string body, params string[] values ) + { + if( values.Length == 0 ) + { + if( id[ id.Length - 1 ] == '\n' ) + body = "\n"; + + return true; + } + + TemplatePropertyContainer propertyContainer = null; + if( subShaderId >= 0 ) + { + if( passId >= 0 ) + { + propertyContainer = SubShaders[ subShaderId ].Passes[ passId ].TemplateProperties; + } + else + { + propertyContainer = SubShaders[ subShaderId ].TemplateProperties; + } + } + else + { + propertyContainer = m_templateProperties; + } + + propertyContainer.BuildInfo(); + + if( propertyContainer.PropertyDict.ContainsKey( id ) ) + { + string finalValue = propertyContainer.PropertyDict[ id ].UseIndentationAtStart ? propertyContainer.PropertyDict[ id ].Indentation : string.Empty; + for( int i = 0; i < values.Length; i++ ) + { + + if( propertyContainer.PropertyDict[ id ].AutoLineFeed ) + { + string[] valuesArr = values[ i ].Split( '\n' ); + for( int j = 0; j < valuesArr.Length; j++ ) + { + //first value will be automatically indented by the string replace + finalValue += ( ( i == 0 && j == 0 ) ? string.Empty : propertyContainer.PropertyDict[ id ].Indentation ) + valuesArr[ j ]; + finalValue += TemplatesManager.TemplateNewLine; + } + } + else + { + //first value will be automatically indented by the string replace + finalValue += ( i == 0 ? string.Empty : propertyContainer.PropertyDict[ id ].Indentation ) + values[ i ]; + } + } + + body = finalValue; + propertyContainer.PropertyDict[ id ].Used = true; + return true; + } + + if( values.Length > 1 || !string.IsNullOrEmpty( values[ 0 ] ) ) + { + UIUtils.ShowMessage( string.Format( "Attempting to write data into inexistant tag {0}. Please review the template {1} body and consider adding the missing tag.", id, m_defaultShaderName ), MessageSeverity.Error ); + return false; + } + return true; + } + + public bool FillVertexInstructions( int subShaderId, int passId, params string[] values ) + { + TemplateFunctionData vertexFunctionData = SubShaders[ subShaderId ].Passes[ passId ].VertexFunctionData; + if( vertexFunctionData != null && !string.IsNullOrEmpty( vertexFunctionData.Id ) ) + { + string body = string.Empty; + bool isValid = FillTemplateBody( subShaderId, passId, vertexFunctionData.Id, ref body, values ); + SetPassData( TemplateModuleDataType.PassVertexFunction, subShaderId, passId, body ); + return isValid; + } + + if( values.Length > 0 ) + { + UIUtils.ShowMessage( "Attemping to add vertex instructions on a template with no assigned vertex code area", MessageSeverity.Error ); + return false; + } + return true; + } + + public bool FillFragmentInstructions( int subShaderId, int passId, params string[] values ) + { + TemplateFunctionData fragmentFunctionData = SubShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData; + if( fragmentFunctionData != null && !string.IsNullOrEmpty( fragmentFunctionData.Id ) ) + { + string body = string.Empty; + bool isValid = FillTemplateBody( subShaderId, passId, fragmentFunctionData.Id, ref body, values ); + SetPassData( TemplateModuleDataType.PassFragmentFunction, subShaderId, passId, body ); + return isValid; + } + + if( values.Length > 0 ) + { + UIUtils.ShowMessage( "Attemping to add fragment instructions on a template with no assigned vertex code area", MessageSeverity.Error ); + return false; + } + return true; + } + + public void SetShaderName( string name ) + { + m_templateIdManager.SetReplacementText( m_shaderNameId, name ); + } + + public void SetCustomInspector( string customInspector ) + { + if( m_customInspectorContainer.Index > -1 ) + { + m_templateIdManager.SetReplacementText( m_customInspectorContainer.Id, m_templateProperties.PropertyDict[ m_customInspectorContainer.Id ].Indentation + customInspector ); + } + } + + public void SetFallback( string fallback ) + { + if( m_fallbackContainer.Index > -1 ) + { + m_templateIdManager.SetReplacementText( m_fallbackContainer.Id, m_templateProperties.PropertyDict[ m_fallbackContainer.Id ].Indentation + fallback ); + } + } + + public void SetDependencies( string dependencies ) + { + if( m_dependenciesContainer.Index > -1 ) + { + m_templateIdManager.SetReplacementText( m_dependenciesContainer.Id, dependencies ); + } + } + + private void OnEnable() + { + hideFlags = HideFlags.HideAndDontSave; + } + + public override bool Reload() + { + m_propertyTag = null; + m_shaderNameId = string.Empty; + m_shaderBody = string.Empty; + m_isSinglePass = false; + m_masterNodesRequired = 0; + m_beforePragmaContainer.Reset(); + m_customInspectorContainer.Reset(); + m_fallbackContainer.Reset(); + m_dependenciesContainer.Reset(); + m_availableShaderProperties.Clear(); + int count = m_subShaders.Count; + for( int i = 0; i < count; i++ ) + { + m_subShaders[ i ].Destroy(); + } + m_subShaders.Clear(); + + m_templateIdManager.Reset(); + if( m_shaderData != null ) + m_shaderData.Destroy(); + + m_templateProperties.Reset(); + + string oldName = m_defaultShaderName; + LoadTemplateBody( m_guid, AssetDatabase.GUIDToAssetPath( m_guid ) ); + + if( m_communityTemplate ) + Name = m_defaultShaderName; + + return !oldName.Equals( m_defaultShaderName ); + } + + public bool GetSubShaderandPassFor( string passUniqueId, ref int subShaderId, ref int passId ) + { + if( string.IsNullOrEmpty( passUniqueId ) ) + return false; + + if( m_passUniqueIdData.Count == 0 ) + { + for( int subShaderIdx = 0; subShaderIdx < m_subShaders.Count; subShaderIdx++ ) + { + for( int passIdx = 0; passIdx < m_subShaders[ subShaderIdx ].Passes.Count; passIdx++ ) + { + if( m_subShaders[ subShaderIdx ].Passes[ passIdx ].Modules.HasPassUniqueName ) + { + if( m_passUniqueIdData.ContainsKey( m_subShaders[ subShaderIdx ].Passes[ passIdx ].Modules.PassUniqueName ) ) + { + Debug.LogErrorFormat( "Found duplicate pass name '{0}' over template. Please fix template as it will result in multiple errors.", m_subShaders[ subShaderIdx ].Passes[ passIdx ].Modules.PassUniqueName ); + return false; + } + m_passUniqueIdData.Add( m_subShaders[ subShaderIdx ].Passes[ passIdx ].Modules.PassUniqueName, new TemplateUniquePassData() { PassIdx = passIdx, SubShaderIdx = subShaderIdx } ); + } + } + } + } + + if( m_passUniqueIdData.ContainsKey( passUniqueId ) ) + { + subShaderId = m_passUniqueIdData[ passUniqueId ].SubShaderIdx; + passId = m_passUniqueIdData[ passUniqueId ].PassIdx; + return true; + } + subShaderId = -1; + passId = -1; + return false; + } + + public TemplateShaderPropertyData GetShaderPropertyData( string propertyName ) + { + return m_availableShaderProperties.Find( ( x ) => ( x.PropertyName.Equals( propertyName ) ) ); + } + + public TemplateSRPType SRPtype { get { return m_subShaders[ 0 ].Modules.SRPType; } } + //public bool SRPIsPBRHD { get { return m_subShaders[0].Modules.SRPIsPBRHD ; } } + public List SubShaders { get { return m_subShaders; } } + public List AvailableShaderProperties { get { return m_availableShaderProperties; } } + public List AllShaderProperties + { + get + { + if( m_allShaderProperties == null ) + { + m_allShaderProperties = new List(); + if( AvailableShaderProperties.Count > 0 ) + { + m_allShaderProperties.AddRange( AvailableShaderProperties ); + } + + for( int subShaderIdx = 0; subShaderIdx < SubShaders.Count; subShaderIdx++ ) + { + if( SubShaders[ subShaderIdx ].AvailableShaderGlobals.Count > 0 ) + { + m_allShaderProperties.AddRange( SubShaders[ subShaderIdx ].AvailableShaderGlobals ); + } + + for( int passIdx = 0; passIdx < SubShaders[ subShaderIdx ].Passes.Count; passIdx++ ) + { + if( SubShaders[ subShaderIdx ].Passes[ passIdx ].AvailableShaderGlobals.Count > 0 ) + { + m_allShaderProperties.AddRange( SubShaders[ subShaderIdx ].Passes[ passIdx ].AvailableShaderGlobals ); + } + } + } + } + + + return m_allShaderProperties; + } + } + + public TemplateTagData PropertyTag { get { return m_propertyTag; } } + public TemplateIdManager IdManager { get { return m_templateIdManager; } } + public TemplatePropertyContainer TemplateProperties { get { return m_templateProperties; } } + public TemplateInfoContainer CustomInspectorContainer { get { return m_customInspectorContainer; } } + public TemplateInfoContainer FallbackContainer { get { return m_fallbackContainer; } } + public TemplateInfoContainer BeforePragmaContainer { get { return m_beforePragmaContainer; } } + public bool IsSinglePass { get { return m_isSinglePass; } } + public int MasterNodesRequired { get { return m_masterNodesRequired; } } + public CustomTemplatePropertyUIEnum CustomTemplatePropertyUI { get { return m_customTemplatePropertyUI; } } + public bool CanAddLODs { get { return m_lodInjectorId > -1; } } + public TemplateShaderModelData GlobalShaderModel { get { return m_globalShaderModel; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs.meta new file mode 100644 index 00000000..927e42f3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4214390aa7f66364bbab454dc15a04ac +timeCreated: 1516981847 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs new file mode 100644 index 00000000..497b5309 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs @@ -0,0 +1,3633 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +//#define SHOW_TEMPLATE_HELP_BOX + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using System.Linq; + +namespace AmplifyShaderEditor +{ + public enum HDSRPMaterialType + { + SubsurfaceScattering, + Standard, + Specular, + Anisotropy, + Iridescence, + Translucent + } + + public enum InvisibilityStatus + { + LockedInvisible, + Invisible, + Visible + } + + public enum SetTemplateSource + { + NewShader, + ShaderLoad, + HotCodeReload + }; + + [Serializable] + [NodeAttributes( "Template Master Node" , "Master" , "Shader Generated according to template rules" , null , KeyCode.None , false )] + public sealed class TemplateMultiPassMasterNode : MasterNode + { + private const double MaxLODEditTimestamp = 1; + + private static int PASS_SELECTOR_VERSION = 16200; + private static int PASS_UNIQUE_ID_VERSION = 16204; + + private const string LodNameId = "LODName"; + private const string LodValueId = "LODValue"; + + private const string LodSubtitle = "LOD( {0} )"; + private const string AdditionalLODsStr = "LODs"; + + private const string SubTitleFormatterStr = "(SubShader {0} Pass {1})"; + private const string NoSubShaderPropertyStr = "No Sub-Shader properties available"; + private const string NoPassPropertyStr = "No Pass properties available"; + + private const string WarningMessage = "Templates is a feature that is still heavily under development and users may experience some problems.\nPlease email support@amplify.pt if any issue occurs."; + private const string OpenTemplateStr = "Edit Template"; + private const string ReloadTemplateStr = "Reload Template"; + private const string CommonPropertiesStr = "Common Properties "; + private const string SubShaderModuleStr = "SubShader "; + private const string PassModuleStr = "Pass "; + + private const string PassNameStr = "Name"; + private const string PassNameFormateStr = "Name \"{0}\""; + private const string SubShaderLODValueLabel = "LOD Value"; + private const string SubShaderLODNameLabel = "LOD Name"; + + + + private bool m_reRegisterTemplateData = false; + private bool m_fireTemplateChange = false; + private bool m_fetchMasterNodeCategory = false; + + [SerializeField] + private string m_templateGUID = "4e1801f860093ba4f9eb58a4b556825b"; + + [SerializeField] + private int m_passIdx = 0; + + //[SerializeField] + //private string m_passIdxStr = string.Empty; + + [SerializeField] + private bool m_passFoldout = false; + + [SerializeField] + private int m_subShaderIdx = 0; + + //[SerializeField] + //private string m_subShaderIdxStr = string.Empty; + + [SerializeField] + private bool m_subStringFoldout = false; + + [SerializeField] + private bool m_lodFoldout = false; + + + [SerializeField] + private string m_mainLODName = string.Empty; + + //[SerializeField] + //private string m_subShaderLODStr; + + //[SerializeField] + //private bool m_mainMPMasterNode = false; + + [NonSerialized] + private TemplateMultiPass m_templateMultiPass = null; + + [NonSerialized] + private TemplateMultiPassMasterNode m_mainMasterNodeRef = null; + + [SerializeField] + private TemplateModulesHelper m_subShaderModule = new TemplateModulesHelper(); + + [SerializeField] + private TemplateModulesHelper m_passModule = new TemplateModulesHelper(); + + [SerializeField] + private UsePassHelper m_usePass; + + [SerializeField] + private string m_passName = string.Empty; + + [SerializeField] + private string m_passUniqueId = string.Empty; + + [SerializeField] + private string m_originalPassName = string.Empty; + + [SerializeField] + private bool m_hasLinkPorts = false; + + [SerializeField] + private InvisibilityStatus m_isInvisible = InvisibilityStatus.Visible; + + [SerializeField] + private int m_invisibleOptions = 0; + + [SerializeField] + private bool m_invalidNode = false; + + [SerializeField] + private FallbackPickerHelper m_fallbackHelper = null; + + [SerializeField] + private DependenciesHelper m_dependenciesHelper = new DependenciesHelper(); + + [SerializeField] + private TemplateOptionsUIHelper m_subShaderOptions = new TemplateOptionsUIHelper( true ); + + [SerializeField] + private TemplateOptionsUIHelper m_passOptions = new TemplateOptionsUIHelper( false ); + + [SerializeField] + private TemplatePassSelectorHelper m_passSelector = new TemplatePassSelectorHelper(); + + [SerializeField] + private TemplateOptionsDefinesContainer m_optionsDefineContainer = new TemplateOptionsDefinesContainer(); + + [SerializeField] + private TerrainDrawInstancedHelper m_drawInstancedHelper = new TerrainDrawInstancedHelper(); + + // HATE THIS BELOW, MUST REMOVE HD SPECIFIC CODE FROM GENERIC MASTER NODE + private const string HDSRPMaterialTypeStr = "Material Type"; + private const string SRPMaterialSubsurfaceScatteringKeyword = "_MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1"; + private const string SRPMaterialTransmissionKeyword = "_MATERIAL_FEATURE_TRANSMISSION 1"; + private const string SRPHDMaterialSpecularKeyword = "_MATERIAL_FEATURE_SPECULAR_COLOR 1"; + //private const string SRPLWMaterialSpecularKeyword = "_SPECULAR_SETUP 1"; + private const string SRPMaterialAnisotropyKeyword = "_MATERIAL_FEATURE_ANISOTROPY 1"; + private const string SRPMaterialIridiscenceKeyword = "_MATERIAL_FEATURE_IRIDESCENCE 1"; + //private const string SRPMaterialNormalMapKeyword = "_NORMALMAP 1"; + //private const string SRPMaterialAlphaTestKeyword = "_ALPHATEST_ON 1"; + //private const string SRPMaterialBlendModeAlphaClipThresholdKeyword = "_AlphaClip 1"; + private const string SRPMaterialTransparentKeyword = "_SURFACE_TYPE_TRANSPARENT 1"; + private const string SRPMaterialBlendModeAddKeyword = "_BLENDMODE_ADD 1"; + private const string SRPMaterialBlendModeAlphaKeyword = "_BLENDMODE_ALPHA 1"; + private const string SRPMaterialClearCoatKeyword = "_MATERIAL_FEATURE_CLEAR_COAT"; + + [NonSerialized] + private bool m_fetchPorts = true; + [NonSerialized] + private InputPort m_specularPort; + [NonSerialized] + private InputPort m_metallicPort; + [NonSerialized] + private InputPort m_coatMaskPort; + [NonSerialized] + private InputPort m_diffusionProfilePort; + [NonSerialized] + private InputPort m_subsurfaceMaskPort; + [NonSerialized] + private InputPort m_thicknessPort; + [NonSerialized] + private InputPort m_anisotropyPort; + [NonSerialized] + private InputPort m_iridescenceThicknessPort; + [NonSerialized] + private InputPort m_iridescenceMaskPort; + [NonSerialized] + private InputPort m_indexOfRefractionPort; + [NonSerialized] + private InputPort m_transmittanceColorPort; + [NonSerialized] + private InputPort m_transmittanceAbsorptionDistancePort; + [NonSerialized] + private InputPort m_transmittanceMaskPort; + + [SerializeField] + private HDSRPMaterialType m_hdSrpMaterialType = HDSRPMaterialType.Standard; + + [NonSerialized] + private bool m_refreshLODValueMasterNodes = false; + [NonSerialized] + private bool m_refocusLODValueMasterNodes = false; + [NonSerialized] + private double m_refreshLODValueMasterNodesTimestamp; + + ////////////////////////////////////////////////////////////////////////// + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_masterNodeCategory = 1;// First Template + m_marginPreviewLeft = 20; + m_shaderNameIsTitle = true; + m_customInspectorName = string.Empty; + m_customPrecision = true; + } + + public override void ReleaseResources() + { + // Internal template resources ( for inline properties) are released by first node on the list + // As it's also registered that way + if( IsLODMainFirstPass ) + m_containerGraph.ClearInternalTemplateNodes(); + + if( !IsLODMainMasterNode ) + return; + TemplateMultiPass template = ( m_templateMultiPass == null ) ? m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( m_templateGUID ) as TemplateMultiPass : m_templateMultiPass; + //Maintained the logic of being the main master node to unregister since this method is being called + //over the main master node in multiple places + //but it will unregister with unique of the first master node (pass 0) since it was the one + //to register it + int passUniqueId = ( m_passIdx == 0 ) ? UniqueId : ContainerGraph.MultiPassMasterNodes.NodesList[ 0 ].UniqueId; + + if( template != null && template.AvailableShaderProperties != null ) + { + // Unregister old template properties + int oldPropertyCount = template.AvailableShaderProperties.Count; + for( int i = 0 ; i < oldPropertyCount ; i++ ) + { + ContainerGraph.ParentWindow.DuplicatePrevBufferInstance.ReleaseUniformName( passUniqueId , template.AvailableShaderProperties[ i ].PropertyName ); + } + } + } + + public void CopyOptionsFrom( TemplateMultiPassMasterNode origin ) + { + //Copy options + SubShaderOptions.CopyOptionsValuesFrom( origin.SubShaderOptions ); + PassOptions.CopyOptionsValuesFrom( origin.PassOptions ); + + //Copy selected passes + if( IsMainOutputNode ) + m_passSelector.CopyFrom( origin.PassSelector ); + } + + void RegisterProperties() + { + //First pass must be the one to always register properties so all modules + //can extract a valid negative Id when reading inline properties + if( /*!IsLODMainMasterNode*/!IsLODMainFirstPass ) + { + m_reRegisterTemplateData = false; + return; + } + + if( m_templateMultiPass != null ) + { + m_reRegisterTemplateData = false; + // Register old template properties + int newPropertyCount = m_templateMultiPass.AvailableShaderProperties.Count; + for( int i = 0 ; i < newPropertyCount ; i++ ) + { + m_containerGraph.AddInternalTemplateNode( m_templateMultiPass.AvailableShaderProperties[ i ] ); + int nodeId = ContainerGraph.ParentWindow.DuplicatePrevBufferInstance.CheckUniformNameOwner( m_templateMultiPass.AvailableShaderProperties[ i ].PropertyName ); + if( nodeId > -1 ) + { + if( UniqueId != nodeId ) + { + ParentNode node = m_containerGraph.GetNode( nodeId ); + if( node != null ) + { + UIUtils.ShowMessage( string.Format( "Template requires property name {0} which is currently being used by {1}. Please rename it and reload template." , m_templateMultiPass.AvailableShaderProperties[ i ].PropertyName , node.Attributes.Name ) ); + } + else + { + UIUtils.ShowMessage( string.Format( "Template requires property name {0} which is currently being on your graph. Please rename it and reload template." , m_templateMultiPass.AvailableShaderProperties[ i ].PropertyName ) ); + } + } + } + else + { + UIUtils.RegisterUniformName( UniqueId , m_templateMultiPass.AvailableShaderProperties[ i ].PropertyName ); + } + } + } + } + + public override void OnEnable() + { + base.OnEnable(); + m_reRegisterTemplateData = true; + + if( m_usePass == null ) + { + m_usePass = ScriptableObject.CreateInstance(); + m_usePass.Init( " Additional Use Passes" ); + } + + if( m_fallbackHelper == null ) + { + m_fallbackHelper = ScriptableObject.CreateInstance(); + m_fallbackHelper.Init(); + } + } + + protected override void OnUniqueIDAssigned() + { + base.OnUniqueIDAssigned(); + if( UniqueId >= 0 ) + { + if( m_lodIndex == -1 ) + { + m_containerGraph.MultiPassMasterNodes.AddNode( this ); + } + else + { + m_containerGraph.LodMultiPassMasternodes[ m_lodIndex ].AddNode( this ); + } + } + } + + public override void OnInputPortConnected( int portId , int otherNodeId , int otherPortId , bool activateNode = true ) + { + base.OnInputPortConnected( portId , otherNodeId , otherPortId , activateNode ); + m_passOptions.CheckImediateActionsForPort( this , portId ); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + m_passOptions.CheckImediateActionsForPort( this , portId ); + } + + public void ForceTemplateRefresh() + { + SetTemplate( null , false , true , m_subShaderIdx , m_passIdx , SetTemplateSource.HotCodeReload ); + } + + public void SetTemplate( TemplateMultiPass template , bool writeDefaultData , bool fetchMasterNodeCategory , int subShaderIdx , int passIdx , SetTemplateSource source ) + { + if( subShaderIdx > -1 ) + m_subShaderIdx = subShaderIdx; + + if( passIdx > -1 ) + m_passIdx = passIdx; + + ReleaseResources(); + bool hotCodeOrRead = ( template == null ); + m_templateMultiPass = ( hotCodeOrRead ) ? m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( m_templateGUID ) as TemplateMultiPass : template; + if( m_templateMultiPass != null ) + { + + string passName = string.IsNullOrEmpty( m_passUniqueId ) ? ( m_isInvisible == InvisibilityStatus.LockedInvisible ? m_passName : m_originalPassName ) : m_passUniqueId; + int newPassIdx = m_passIdx; + int newSubShaderIdx = m_subShaderIdx; + m_templateMultiPass.GetSubShaderandPassFor( passName , ref newSubShaderIdx , ref newPassIdx ); + if( newPassIdx == -1 || newSubShaderIdx == -1 ) + { + //m_containerGraph.MarkToDelete( this ); + ContainerGraph.ParentWindow.SetOutdatedShaderFromTemplate(); + m_invalidNode = true; + UIUtils.ShowMessage( "Template changed drastically. Removing invalid passes." ); + return; + } + else + { + if( m_passIdx != newPassIdx ) + m_passIdx = newPassIdx; + + if( m_subShaderIdx != newSubShaderIdx ) + m_subShaderIdx = newSubShaderIdx; + } + + m_containerGraph.CurrentSRPType = m_templateMultiPass.SRPtype; + if( m_templateMultiPass.IsSinglePass ) + { + SetAdditonalTitleText( string.Empty ); + } + else if( m_templateMultiPass.SubShaders[ 0 ].MainPass != m_passIdx ) + { + SetAdditonalTitleText( string.Format( SubTitleFormatterStr , m_subShaderIdx , m_passIdx ) ); + } + m_invalidNode = false; + if( m_subShaderIdx >= m_templateMultiPass.SubShaders.Count || + m_passIdx >= m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes.Count ) + { + if( DebugConsoleWindow.DeveloperMode ) + Debug.LogFormat( "Inexisting pass {0}. Cancelling template fetch" , m_originalPassName ); + + return; + } + + m_isMainOutputNode = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].IsMainPass; + if( m_isMainOutputNode ) + { + // We cannot use UIUtils.MasterNodeOnTexture.height since this method can be + // called before UIUtils is initialized + m_insideSize.y = 55; + } + else + { + m_insideSize.y = 0; + } + + //IsMainOutputNode = m_mainMPMasterNode; + if( source != SetTemplateSource.HotCodeReload ) + { + //Only set this if no hotcode reload happens ( via new shader or load ) + m_isInvisible = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].IsInvisible ? InvisibilityStatus.LockedInvisible : InvisibilityStatus.Visible; + } + else + { + // On hot code reload we only need to verify if template pass visibility data changes + // and change accordingly + if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].IsInvisible ) + { + if( m_isInvisible != InvisibilityStatus.LockedInvisible ) + m_isInvisible = InvisibilityStatus.LockedInvisible; + } + else + { + if( m_isInvisible == InvisibilityStatus.LockedInvisible ) + { + m_isInvisible = InvisibilityStatus.Visible; + } + } + } + + m_invisibleOptions = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].InvisibleOptions; + + m_originalPassName = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].PassNameContainer.Data; + + if( !hotCodeOrRead ) + { + if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].LODContainer.Index > -1 ) + { + //m_subShaderLODStr = m_templateMultiPass.SubShaders[ m_subShaderIdx ].LODContainer.Id; + ShaderLOD = Convert.ToInt32( m_templateMultiPass.SubShaders[ m_subShaderIdx ].LODContainer.Data ); + } + else + { + ShaderLOD = 0; + } + } + + m_shaderNameIsTitle = IsMainOutputNode; + m_fetchMasterNodeCategory = fetchMasterNodeCategory; + m_templateGUID = m_templateMultiPass.GUID; + UpdatePortInfo(); + + RegisterProperties(); + + // template is null when hot code reloading or loading from file so inspector name shouldn't be changed + if( !hotCodeOrRead ) + { + m_customInspectorName = m_templateMultiPass.CustomInspectorContainer.Data; + CheckLegacyCustomInspectors(); + if( m_isMainOutputNode ) + { + m_passSelector.Clear(); + m_passSelector.Setup( m_templateMultiPass.SubShaders[ m_subShaderIdx ] ); + } + } + else + { + //Hotcode reload or ReadFromString + // Setup is only made if internal pass array is null + if( m_isMainOutputNode ) + { + m_passSelector.Setup( m_templateMultiPass.SubShaders[ m_subShaderIdx ] ); + } + } + + SetupCustomOptionsFromTemplate( template != null ); + + if( string.IsNullOrEmpty( m_fallbackHelper.RawFallbackShader ) ) + m_fallbackHelper.RawFallbackShader = m_templateMultiPass.FallbackContainer.Data; + + //bool updateInfofromTemplate = UpdatePortInfo(); + //if( updateInfofromTemplate ) + //{ + m_subShaderModule.FetchDataFromTemplate( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules ); + m_passModule.FetchDataFromTemplate( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules ); + //} + + //RegisterProperties(); + if( writeDefaultData ) + { + //ShaderName = m_templateMultiPass.DefaultShaderName; + ShaderName = m_shaderName; + m_passName = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].PassNameContainer.Data; + if( !m_templateMultiPass.IsSinglePass /*&& !m_shaderNameIsTitle*/ ) + { + if( m_templateMultiPass.SubShaders[ 0 ].MainPass != m_passIdx ) + SetClippedTitle( m_passName ); + } + } + + UpdateSubShaderPassStr(); + + if( m_isMainOutputNode ) + m_fireTemplateChange = true; + } + else + { + m_invalidNode = true; + } + } + + public override void OnRefreshLinkedPortsComplete() + { + if( m_invalidNode ) + return; + + if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.SRPIsPBRHD ) + ConfigHDPorts(); + + SetReadOptions(); + } + + public void SetReadOptions() + { + m_passOptions.SetReadOptions(); + if( m_isMainOutputNode ) + m_subShaderOptions.SetReadOptions(); + } + + bool UpdatePortInfo() + { + List inputDataList = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].InputDataList; + int count = inputDataList.Count; + if( count != m_inputPorts.Count ) + { + DeleteAllInputConnections( true ); + + for( int i = 0 ; i < count ; i++ ) + { + InputPort port = AddInputPort( inputDataList[ i ].DataType , false , inputDataList[ i ].PortName , inputDataList[ i ].OrderId , inputDataList[ i ].PortCategory , inputDataList[ i ].PortUniqueId ); + port.ExternalLinkId = inputDataList[ i ].LinkId; + m_hasLinkPorts = m_hasLinkPorts || !string.IsNullOrEmpty( inputDataList[ i ].LinkId ); + } + return true; + } + else + { + for( int i = 0 ; i < count ; i++ ) + { + m_inputPorts[ i ].ChangeProperties( inputDataList[ i ].PortName , inputDataList[ i ].DataType , false ); + m_inputPorts[ i ].ExternalLinkId = inputDataList[ i ].LinkId; + } + return false; + } + } + + public void SetPropertyActionFromItem( bool actionFromUser , TemplateModulesHelper module , TemplateActionItem item ) + { + // this was added because when switching templates the m_mainMasterNodeRef was not properly set yet and was causing issues, there's probably a better place for this + if( !m_isMainOutputNode && m_mainMasterNodeRef == null ) + { + m_mainMasterNodeRef = m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode; + } + + TemplateModulesHelper subShaderModule = m_isMainOutputNode ? m_subShaderModule : m_mainMasterNodeRef.SubShaderModule; + switch( item.PropertyAction ) + { + case PropertyActionsEnum.CullMode: + { + if( item.CopyFromSubShader ) + { + module.CullModeHelper.CurrentCullMode = subShaderModule.CullModeHelper.CurrentCullMode; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.CullModeHelper.CustomEdited; + if( performAction ) + { + module.CullModeHelper.CustomEdited = false; + module.CullModeHelper.CurrentCullMode = item.ActionCullMode; + } + } + + } + break; + case PropertyActionsEnum.ColorMask: + { + if( item.CopyFromSubShader ) + module.ColorMaskHelper.ColorMask = subShaderModule.ColorMaskHelper.ColorMask; + else + { + bool performAction = !ContainerGraph.IsLoading || !module.ColorMaskHelper.CustomEdited; + if( performAction ) + { + module.ColorMaskHelper.CustomEdited = false; + module.ColorMaskHelper.ColorMask = item.ColorMask.GetColorMask( module.ColorMaskHelper.ColorMask ); + } + } + } + break; + case PropertyActionsEnum.ColorMask1: + { + if( item.CopyFromSubShader ) + module.ColorMaskHelper1.ColorMask = subShaderModule.ColorMaskHelper1.ColorMask; + else + { + bool performAction = !ContainerGraph.IsLoading || !module.ColorMaskHelper1.CustomEdited; + if( performAction ) + { + module.ColorMaskHelper1.CustomEdited = false; + module.ColorMaskHelper1.ColorMask = item.ColorMask1.GetColorMask( module.ColorMaskHelper1.ColorMask ); + } + } + } + break; + case PropertyActionsEnum.ColorMask2: + { + if( item.CopyFromSubShader ) + module.ColorMaskHelper2.ColorMask = subShaderModule.ColorMaskHelper2.ColorMask; + else + { + bool performAction = !ContainerGraph.IsLoading || !module.ColorMaskHelper2.CustomEdited; + if( performAction ) + { + module.ColorMaskHelper2.CustomEdited = false; + module.ColorMaskHelper2.ColorMask = item.ColorMask2.GetColorMask( module.ColorMaskHelper2.ColorMask ); + } + } + } + break; + case PropertyActionsEnum.ColorMask3: + { + if( item.CopyFromSubShader ) + module.ColorMaskHelper3.ColorMask = subShaderModule.ColorMaskHelper3.ColorMask; + else + { + bool performAction = !ContainerGraph.IsLoading || !module.ColorMaskHelper3.CustomEdited; + if( performAction ) + { + module.ColorMaskHelper3.CustomEdited = false; + module.ColorMaskHelper3.ColorMask = item.ColorMask3.GetColorMask( module.ColorMaskHelper3.ColorMask ); + } + } + } + break; + case PropertyActionsEnum.ZWrite: + { + if( item.CopyFromSubShader ) + { + module.DepthOphelper.ZWriteModeValue = subShaderModule.DepthOphelper.ZWriteModeValue; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.DepthOphelper.CustomEdited; + if( performAction ) + { + module.DepthOphelper.CustomEdited = false; + module.DepthOphelper.ZWriteModeValue = item.ActionZWrite; + } + } + } + break; + case PropertyActionsEnum.ZTest: + { + if( item.CopyFromSubShader ) + { + module.DepthOphelper.ZTestModeValue = subShaderModule.DepthOphelper.ZTestModeValue; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.DepthOphelper.CustomEdited; + if( performAction ) + { + module.DepthOphelper.CustomEdited = false; + module.DepthOphelper.ZTestModeValue = item.ActionZTest; + } + } + } + break; + case PropertyActionsEnum.ZOffsetFactor: + { + if( item.CopyFromSubShader ) + { + module.DepthOphelper.OffsetFactorValue = subShaderModule.DepthOphelper.OffsetFactorValue; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.DepthOphelper.CustomEdited; + if( performAction ) + { + module.DepthOphelper.CustomEdited = false; + module.DepthOphelper.OffsetFactorValue = item.ActionZOffsetFactor; + } + } + } + break; + case PropertyActionsEnum.ZOffsetUnits: + { + if( item.CopyFromSubShader ) + { + module.DepthOphelper.OffsetUnitsValue = subShaderModule.DepthOphelper.OffsetUnitsValue; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.DepthOphelper.CustomEdited; + if( performAction ) + { + module.DepthOphelper.CustomEdited = false; + module.DepthOphelper.OffsetUnitsValue = item.ActionZOffsetUnits; + } + } + } + break; + case PropertyActionsEnum.BlendRGB: + { + if( item.CopyFromSubShader ) + { + module.BlendOpHelper.SourceFactorRGB = subShaderModule.BlendOpHelper.SourceFactorRGB; + module.BlendOpHelper.DestFactorRGB = subShaderModule.BlendOpHelper.DestFactorRGB; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.BlendOpHelper.CustomEdited; + if( performAction ) + { + module.BlendOpHelper.CustomEdited = false; + module.BlendOpHelper.SourceFactorRGB = item.ActionBlendRGBSource; + module.BlendOpHelper.DestFactorRGB = item.ActionBlendRGBDest; + } + } + } + break; + case PropertyActionsEnum.BlendRGB1: + { + if( item.CopyFromSubShader ) + { + module.BlendOpHelper1.SourceFactorRGB = subShaderModule.BlendOpHelper1.SourceFactorRGB; + module.BlendOpHelper1.DestFactorRGB = subShaderModule.BlendOpHelper1.DestFactorRGB; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.BlendOpHelper1.CustomEdited; + if( performAction ) + { + module.BlendOpHelper1.CustomEdited = false; + module.BlendOpHelper1.SourceFactorRGB = item.ActionBlendRGBSource1; + module.BlendOpHelper1.DestFactorRGB = item.ActionBlendRGBDest1; + } + } + } + break; + case PropertyActionsEnum.BlendRGB2: + { + if( item.CopyFromSubShader ) + { + module.BlendOpHelper2.SourceFactorRGB = subShaderModule.BlendOpHelper2.SourceFactorRGB; + module.BlendOpHelper2.DestFactorRGB = subShaderModule.BlendOpHelper2.DestFactorRGB; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.BlendOpHelper2.CustomEdited; + if( performAction ) + { + module.BlendOpHelper2.CustomEdited = false; + module.BlendOpHelper2.SourceFactorRGB = item.ActionBlendRGBSource2; + module.BlendOpHelper2.DestFactorRGB = item.ActionBlendRGBDest2; + } + } + } + break; + case PropertyActionsEnum.BlendRGB3: + { + if( item.CopyFromSubShader ) + { + module.BlendOpHelper3.SourceFactorRGB = subShaderModule.BlendOpHelper3.SourceFactorRGB; + module.BlendOpHelper3.DestFactorRGB = subShaderModule.BlendOpHelper3.DestFactorRGB; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.BlendOpHelper3.CustomEdited; + if( performAction ) + { + module.BlendOpHelper3.CustomEdited = false; + module.BlendOpHelper3.SourceFactorRGB = item.ActionBlendRGBSource3; + module.BlendOpHelper3.DestFactorRGB = item.ActionBlendRGBDest3; + } + } + } + break; + case PropertyActionsEnum.BlendAlpha: + { + if( item.CopyFromSubShader ) + { + module.BlendOpHelper.SourceFactorAlpha = subShaderModule.BlendOpHelper.SourceFactorAlpha; + module.BlendOpHelper.DestFactorAlpha = subShaderModule.BlendOpHelper.DestFactorAlpha; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.BlendOpHelper.CustomEdited; + if( performAction ) + { + module.BlendOpHelper.CustomEdited = false; + module.BlendOpHelper.CurrentAlphaIndex = 1; + module.BlendOpHelper.SourceFactorAlpha = item.ActionBlendAlphaSource; + module.BlendOpHelper.DestFactorAlpha = item.ActionBlendAlphaDest; + } + } + } + break; + case PropertyActionsEnum.BlendAlpha1: + { + if( item.CopyFromSubShader ) + { + module.BlendOpHelper1.SourceFactorAlpha = subShaderModule.BlendOpHelper1.SourceFactorAlpha; + module.BlendOpHelper1.DestFactorAlpha = subShaderModule.BlendOpHelper1.DestFactorAlpha; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.BlendOpHelper1.CustomEdited; + if( performAction ) + { + module.BlendOpHelper1.CustomEdited = false; + module.BlendOpHelper1.CurrentAlphaIndex = 1; + module.BlendOpHelper1.SourceFactorAlpha = item.ActionBlendAlphaSource1; + module.BlendOpHelper1.DestFactorAlpha = item.ActionBlendAlphaDest1; + } + } + } + break; + case PropertyActionsEnum.BlendAlpha2: + { + if( item.CopyFromSubShader ) + { + module.BlendOpHelper2.SourceFactorAlpha = subShaderModule.BlendOpHelper2.SourceFactorAlpha; + module.BlendOpHelper2.DestFactorAlpha = subShaderModule.BlendOpHelper2.DestFactorAlpha; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.BlendOpHelper2.CustomEdited; + if( performAction ) + { + module.BlendOpHelper2.CustomEdited = false; + module.BlendOpHelper2.CurrentAlphaIndex = 1; + module.BlendOpHelper2.SourceFactorAlpha = item.ActionBlendAlphaSource2; + module.BlendOpHelper2.DestFactorAlpha = item.ActionBlendAlphaDest2; + } + } + } + break; + case PropertyActionsEnum.BlendAlpha3: + { + if( item.CopyFromSubShader ) + { + module.BlendOpHelper3.SourceFactorAlpha = subShaderModule.BlendOpHelper3.SourceFactorAlpha; + module.BlendOpHelper3.DestFactorAlpha = subShaderModule.BlendOpHelper3.DestFactorAlpha; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.BlendOpHelper3.CustomEdited; + if( performAction ) + { + module.BlendOpHelper3.CustomEdited = false; + module.BlendOpHelper3.CurrentAlphaIndex = 1; + module.BlendOpHelper3.SourceFactorAlpha = item.ActionBlendAlphaSource3; + module.BlendOpHelper3.DestFactorAlpha = item.ActionBlendAlphaDest3; + } + } + } + break; + case PropertyActionsEnum.BlendOpRGB: + { + if( item.CopyFromSubShader ) + { + module.BlendOpHelper.BlendOpRGB = subShaderModule.BlendOpHelper.BlendOpRGB; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.BlendOpHelper.CustomEdited; + if( performAction ) + { + module.BlendOpHelper.CustomEdited = false; + module.BlendOpHelper.BlendOpRGB = item.ActionBlendOpRGB; + } + } + } + break; + case PropertyActionsEnum.BlendOpAlpha: + { + if( item.CopyFromSubShader ) + { + module.BlendOpHelper.BlendOpAlpha = subShaderModule.BlendOpHelper.BlendOpAlpha; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.BlendOpHelper.CustomEdited; + if( performAction ) + { + module.BlendOpHelper.CustomEdited = false; + module.BlendOpHelper.BlendOpAlpha = item.ActionBlendOpAlpha; + } + } + } + break; + case PropertyActionsEnum.StencilReference: + { + if( item.CopyFromSubShader ) + { + module.StencilBufferHelper.ReferenceValue = subShaderModule.StencilBufferHelper.ReferenceValue; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.StencilBufferHelper.CustomEdited; + if( performAction ) + { + module.StencilBufferHelper.CustomEdited = false; + module.StencilBufferHelper.ReferenceValue = item.ActionStencilReference; + } + } + } + break; + case PropertyActionsEnum.StencilReadMask: + { + if( item.CopyFromSubShader ) + { + module.StencilBufferHelper.ReadMaskValue = subShaderModule.StencilBufferHelper.ReadMaskValue; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.StencilBufferHelper.CustomEdited; + if( performAction ) + { + module.StencilBufferHelper.CustomEdited = false; + module.StencilBufferHelper.ReadMaskValue = item.ActionStencilReadMask; + } + } + } + break; + case PropertyActionsEnum.StencilWriteMask: + { + if( item.CopyFromSubShader ) + { + module.StencilBufferHelper.WriteMaskValue = subShaderModule.StencilBufferHelper.WriteMaskValue; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.StencilBufferHelper.CustomEdited; + if( performAction ) + { + module.StencilBufferHelper.CustomEdited = false; + module.StencilBufferHelper.WriteMaskValue = item.ActionStencilWriteMask; + } + } + } + break; + case PropertyActionsEnum.StencilComparison: + { + if( item.CopyFromSubShader ) + { + module.StencilBufferHelper.ComparisonFunctionIdxValue = subShaderModule.StencilBufferHelper.ComparisonFunctionIdxValue; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.StencilBufferHelper.CustomEdited; + if( performAction ) + { + module.StencilBufferHelper.CustomEdited = false; + module.StencilBufferHelper.ComparisonFunctionIdxValue = item.ActionStencilComparison; + } + } + } + break; + case PropertyActionsEnum.StencilPass: + { + if( item.CopyFromSubShader ) + { + module.StencilBufferHelper.PassStencilOpIdxValue = subShaderModule.StencilBufferHelper.PassStencilOpIdxValue; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.StencilBufferHelper.CustomEdited; + if( performAction ) + { + module.StencilBufferHelper.CustomEdited = false; + module.StencilBufferHelper.PassStencilOpIdxValue = item.ActionStencilPass; + } + } + } + break; + case PropertyActionsEnum.StencilFail: + { + if( item.CopyFromSubShader ) + { + module.StencilBufferHelper.FailStencilOpIdxValue = subShaderModule.StencilBufferHelper.FailStencilOpIdxValue; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.StencilBufferHelper.CustomEdited; + if( performAction ) + { + module.StencilBufferHelper.CustomEdited = false; + module.StencilBufferHelper.FailStencilOpIdxValue = item.ActionStencilFail; + } + } + } + break; + case PropertyActionsEnum.StencilZFail: + { + if( item.CopyFromSubShader ) + { + module.StencilBufferHelper.ZFailStencilOpIdxValue = subShaderModule.StencilBufferHelper.ZFailStencilOpIdxValue; + } + else + { + bool performAction = !ContainerGraph.IsLoading || !module.StencilBufferHelper.CustomEdited; + if( performAction ) + { + module.StencilBufferHelper.CustomEdited = false; + module.StencilBufferHelper.ZFailStencilOpIdxValue = item.ActionStencilZFail; + } + } + } + break; + case PropertyActionsEnum.RenderType: + { + module.TagsHelper.AddSpecialTag( TemplateSpecialTags.RenderType , item ); + } + break; + case PropertyActionsEnum.RenderQueue: + { + module.TagsHelper.AddSpecialTag( TemplateSpecialTags.Queue , item ); + } + break; + case PropertyActionsEnum.DisableBatching: + { + module.TagsHelper.AddSpecialTag( TemplateSpecialTags.DisableBatching , item ); + } + break; + case PropertyActionsEnum.ChangeTagValue: + { + module.TagsHelper.ChangeTagValue( item.ActionData , item.ActionBuffer ); + } + break; + } + } + + public void OnCustomPassOptionSelected( bool actionFromUser , bool isRefreshing , bool invertAction , TemplateOptionUIItem uiItem , int recursionLevel, params TemplateActionItem[] validActions ) + { + m_passOptions.OnCustomOptionSelected( actionFromUser , isRefreshing , invertAction , this , uiItem , recursionLevel, validActions ); + } + + public void OnCustomSubShaderOptionSelected( bool actionFromUser , bool isRefreshing , bool invertAction , TemplateOptionUIItem uiItem , int recursionLevel, params TemplateActionItem[] validActions ) + { + if( m_isMainOutputNode ) + m_subShaderOptions.OnCustomOptionSelected( actionFromUser , isRefreshing , invertAction , this , uiItem , recursionLevel, validActions ); + } + + void SetupCustomOptionsFromTemplate( bool newTemplate ) + { + m_passOptions.SetupCustomOptionsFromTemplate( this , newTemplate ); + if( m_isMainOutputNode ) + m_subShaderOptions.SetupCustomOptionsFromTemplate( this , newTemplate ); + } + + void SetPassCustomOptionsInfo( TemplateMultiPassMasterNode masterNode ) + { + TemplateMultiPassMasterNode mainMasterNode = masterNode.IsMainOutputNode ? masterNode : ( m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode ); + mainMasterNode.SubShaderOptions.SetSubShaderCustomOptionsPortsInfo( masterNode , ref m_currentDataCollector ); + masterNode.PassOptions.SetCustomOptionsInfo( masterNode , ref m_currentDataCollector ); + } + + void RefreshCustomOptionsDict() + { + m_passOptions.RefreshCustomOptionsDict(); + if( m_isMainOutputNode ) + m_subShaderOptions.RefreshCustomOptionsDict(); + } + + void SetCategoryIdxFromTemplate() + { + int templateCount = m_containerGraph.ParentWindow.TemplatesManagerInstance.TemplateCount; + for( int i = 0 ; i < templateCount ; i++ ) + { + int idx = i + 1; + TemplateMultiPass templateData = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( i ) as TemplateMultiPass; + if( templateData != null && m_templateMultiPass != null && m_templateMultiPass.GUID.Equals( templateData.GUID ) ) + m_masterNodeCategory = idx; + } + } + + public void CheckTemplateChanges() + { + if( m_invalidNode ) + return; + + if( IsLODMainMasterNode ) + { + if( m_containerGraph.MultiPassMasterNodes.Count != m_templateMultiPass.MasterNodesRequired ) + { + if( m_availableCategories == null ) + RefreshAvailableCategories(); + + if( DebugConsoleWindow.DeveloperMode ) + Debug.Log( "Template Pass amount was changed. Rebuiling master nodes" ); + + m_containerGraph.ParentWindow.ReplaceMasterNode( m_availableCategories[ m_masterNodeCategory ] , true ); + } + } + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + if( m_invalidNode ) + { + return; + } + base.OnNodeLogicUpdate( drawInfo ); + + if( m_templateMultiPass == null ) + { + // Hotcode reload has happened + SetTemplate( null , false , true , m_subShaderIdx , m_passIdx , SetTemplateSource.HotCodeReload ); + CheckTemplateChanges(); + } + + if( m_reRegisterTemplateData ) + { + RegisterProperties(); + } + + if( m_fetchMasterNodeCategory ) + { + if( m_availableCategories != null ) + { + m_fetchMasterNodeCategory = false; + SetCategoryIdxFromTemplate(); + } + } + + if( m_fireTemplateChange ) + { + m_fireTemplateChange = false; + m_containerGraph.FireMasterNodeReplacedEvent(); + } + + if( m_subShaderModule.HasValidData ) + { + m_subShaderModule.OnLogicUpdate( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules ); + } + + if( m_passModule.HasValidData ) + { + m_passModule.OnLogicUpdate( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules ); + } + + if( !m_isMainOutputNode && m_mainMasterNodeRef == null ) + { + m_mainMasterNodeRef = m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode; + } + + if( m_refreshLODValueMasterNodes && ( EditorApplication.timeSinceStartup - m_refreshLODValueMasterNodesTimestamp ) > MaxLODEditTimestamp ) + { + m_refreshLODValueMasterNodes = false; + m_refocusLODValueMasterNodes = true; + m_containerGraph.SortLODMasterNodes(); + } + } + + public override void Draw( DrawInfo drawInfo ) + { + if( m_isInvisible == InvisibilityStatus.Visible ) + { + base.Draw( drawInfo ); + } + } + + public override void OnNodeLayout( DrawInfo drawInfo ) + { + if( m_invalidNode ) + { + if( m_isMainOutputNode ) + { + string newGUID = string.Empty; + if( m_containerGraph.ParentWindow.TemplatesManagerInstance.CheckIfDeprecated( m_templateGUID , out newGUID ) ) + { + m_shaderModelIdx = 0; + SetMasterNodeCategoryFromGUID( newGUID ); + m_containerGraph.ParentWindow.ReplaceMasterNode( m_availableCategories[ m_masterNodeCategory ] , false ); + } + else + { + UIUtils.ShowMessage( "Invalid current template. Switching to Standard Surface" , MessageSeverity.Error ); + m_shaderModelIdx = 0; + m_masterNodeCategory = 0; + m_containerGraph.ParentWindow.ReplaceMasterNode( new MasterNodeCategoriesData( AvailableShaderTypes.SurfaceShader , m_shaderName ) , false ); + } + } + return; + } + + if( m_isInvisible != InvisibilityStatus.Visible ) + { + return; + } + + if( !IsMainOutputNode ) + { + if( !IsInvisible && Docking ) + { + m_useSquareNodeTitle = true; + TemplateMultiPassMasterNode master = ContainerGraph.CurrentMasterNode as TemplateMultiPassMasterNode; + m_position = master.TruePosition; + m_position.height = 32; + int masterIndex = ContainerGraph.MultiPassMasterNodes.NodesList.IndexOf( master ); + int index = ContainerGraph.MultiPassMasterNodes.GetNodeRegisterIdx( UniqueId ); + if( index > masterIndex ) + { + int backTracking = 0; + for( int i = index - 1 ; i > masterIndex ; i-- ) + { + if( !ContainerGraph.MultiPassMasterNodes.NodesList[ i ].IsInvisible && ContainerGraph.MultiPassMasterNodes.NodesList[ i ].Docking ) + backTracking++; + } + m_position.y = master.TruePosition.yMax + 1 + 33 * ( backTracking );// ContainerGraph.MultiPassMasterNodes.NodesList[ index - 1 ].TruePosition.yMax; + base.OnNodeLayout( drawInfo ); + } + else + { + int forwardTracking = 1; + for( int i = index + 1 ; i < masterIndex ; i++ ) + { + if( !ContainerGraph.MultiPassMasterNodes.NodesList[ i ].IsInvisible && ContainerGraph.MultiPassMasterNodes.NodesList[ i ].Docking ) + forwardTracking++; + } + m_position.y = master.TruePosition.y - 33 * ( forwardTracking );// ContainerGraph.MultiPassMasterNodes.NodesList[ index - 1 ].TruePosition.yMax; + base.OnNodeLayout( drawInfo ); + } + } + else + { + m_useSquareNodeTitle = false; + base.OnNodeLayout( drawInfo ); + } + } + else + { + base.OnNodeLayout( drawInfo ); + } + } + + public override void OnNodeRepaint( DrawInfo drawInfo ) + { + base.OnNodeRepaint( drawInfo ); + if( m_invalidNode ) + return; + + if( m_isInvisible == InvisibilityStatus.Visible ) + { + if( m_containerGraph.IsInstancedShader ) + { + DrawInstancedIcon( drawInfo ); + } + } + } + + public override void UpdateFromShader( Shader newShader ) + { + if( m_currentMaterial != null && m_currentMaterial.shader != newShader ) + { + m_currentMaterial.shader = newShader; + } + CurrentShader = newShader; + } + + public override void UpdateMasterNodeMaterial( Material material ) + { + m_currentMaterial = material; + FireMaterialChangedEvt(); + } + + void DrawReloadButton() + { + if( GUILayout.Button( ReloadTemplateStr ) && m_templateMultiPass != null ) + { + m_templateMultiPass.Reload(); + } + } + + void DrawOpenTemplateButton() + { + GUILayout.BeginHorizontal(); + { + if( GUILayout.Button( OpenTemplateStr ) && m_templateMultiPass != null ) + { + try + { + string pathname = AssetDatabase.GUIDToAssetPath( m_templateMultiPass.GUID ); + if( !string.IsNullOrEmpty( pathname ) ) + { + Shader selectedTemplate = AssetDatabase.LoadAssetAtPath( pathname ); + if( selectedTemplate != null ) + { + AssetDatabase.OpenAsset( selectedTemplate , 1 ); + } + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + + if( GUILayout.Button( "\u25C4" , GUILayout.Width( 18 ) , GUILayout.Height( 18 ) ) && m_templateMultiPass != null ) + { + try + { + string pathname = AssetDatabase.GUIDToAssetPath( m_templateMultiPass.GUID ); + if( !string.IsNullOrEmpty( pathname ) ) + { + Shader selectedTemplate = AssetDatabase.LoadAssetAtPath( pathname ); + if( selectedTemplate != null ) + { + Event.current.Use(); + Selection.activeObject = selectedTemplate; + EditorGUIUtility.PingObject( Selection.activeObject ); + } + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + } + GUILayout.EndHorizontal(); + } + + public override void DrawProperties() + { + base.DrawProperties(); + if( m_invalidNode ) + return; + + NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout , CommonPropertiesStr , DrawCommonProperties ); + NodeUtils.DrawPropertyGroup( ref m_subStringFoldout , SubShaderModuleStr , DrawSubShaderProperties ); + NodeUtils.DrawPropertyGroup( ref m_passFoldout , PassModuleStr , DrawPassProperties ); + + DrawMaterialInputs( UIUtils.MenuItemToolbarStyle , false ); + + if( m_propertyOrderChanged ) + { + List mpNodes = ContainerGraph.MultiPassMasterNodes.NodesList; + int count = mpNodes.Count; + for( int i = 0 ; i < count ; i++ ) + { + if( mpNodes[ i ].UniqueId != UniqueId ) + { + mpNodes[ i ].CopyPropertyListFrom( this ); + } + } + } + +#if SHOW_TEMPLATE_HELP_BOX + EditorGUILayout.HelpBox( WarningMessage, MessageType.Warning ); +#endif + } + + // this will be removed later when PBR options are created + void SetExtraDefine( string define ) + { + List nodes = this.ContainerGraph.MultiPassMasterNodes.NodesList; + int count = nodes.Count; + for( int nodeIdx = 0 ; nodeIdx < count ; nodeIdx++ ) + { + nodes[ nodeIdx ].OptionsDefineContainer.AddDirective( "#define " + define , false ); + } + } + + void AddHDKeywords() + { + if( m_templateMultiPass.CustomTemplatePropertyUI == CustomTemplatePropertyUIEnum.None ) + return; + + if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.SRPType != TemplateSRPType.HDRP || + !m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.SRPIsPBR ) + return; + + switch( m_hdSrpMaterialType ) + { + case HDSRPMaterialType.SubsurfaceScattering: + { + SetExtraDefine( SRPMaterialSubsurfaceScatteringKeyword ); + //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialSubsurfaceScatteringKeyword ); + if( m_thicknessPort != null && m_thicknessPort.HasOwnOrLinkConnection ) + { + SetExtraDefine( SRPMaterialTransmissionKeyword ); + //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialTransmissionKeyword ); + } + } + break; + case HDSRPMaterialType.Standard: + break; + case HDSRPMaterialType.Specular: + { + SetExtraDefine( SRPHDMaterialSpecularKeyword ); + //m_currentDataCollector.AddToDefines( UniqueId, SRPHDMaterialSpecularKeyword ); + } + break; + case HDSRPMaterialType.Anisotropy: + { + SetExtraDefine( SRPMaterialAnisotropyKeyword ); + //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialAnisotropyKeyword ); + } + break; + case HDSRPMaterialType.Iridescence: + { + SetExtraDefine( SRPMaterialIridiscenceKeyword ); + //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialIridiscenceKeyword ); + } + break; + case HDSRPMaterialType.Translucent: + { + SetExtraDefine( SRPMaterialTransmissionKeyword ); + //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialTransmissionKeyword ); + } + break; + } + + if( m_coatMaskPort != null && m_coatMaskPort.HasOwnOrLinkConnection ) + { + SetExtraDefine( SRPMaterialClearCoatKeyword ); + //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialClearCoatKeyword ); + } + } + + void FetchHDPorts() + { + if( m_fetchPorts ) + { + m_fetchPorts = false; + if( m_inputPorts.Count > 4 ) + { + m_specularPort = GetInputPortByUniqueId( 3 ); + m_metallicPort = GetInputPortByUniqueId( 4 ); + m_coatMaskPort = GetInputPortByUniqueId( 11 ); + m_diffusionProfilePort = GetInputPortByUniqueId( 12 ); + m_subsurfaceMaskPort = GetInputPortByUniqueId( 13 ); + m_thicknessPort = GetInputPortByUniqueId( 14 ); + m_anisotropyPort = GetInputPortByUniqueId( 15 ); + m_iridescenceThicknessPort = GetInputPortByUniqueId( 16 ); + m_iridescenceMaskPort = GetInputPortByUniqueId( 17 ); + m_indexOfRefractionPort = GetInputPortByUniqueId( 18 ); + m_transmittanceColorPort = GetInputPortByUniqueId( 19 ); + m_transmittanceAbsorptionDistancePort = GetInputPortByUniqueId( 20 ); + m_transmittanceMaskPort = GetInputPortByUniqueId( 21 ); + } + } + } + + void ConfigHDPorts() + { + if( m_templateMultiPass.CustomTemplatePropertyUI == CustomTemplatePropertyUIEnum.None ) + return; + + if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.SRPType != TemplateSRPType.HDRP || + !m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.SRPIsPBR ) + return; + + FetchHDPorts(); + if( m_inputPorts.Count > 4 ) + { + switch( m_hdSrpMaterialType ) + { + case HDSRPMaterialType.SubsurfaceScattering: + { + m_specularPort.Visible = false; + m_metallicPort.Visible = false; + m_coatMaskPort.Visible = true; + m_diffusionProfilePort.Visible = true; + m_subsurfaceMaskPort.Visible = true; + m_thicknessPort.Visible = true; + m_anisotropyPort.Visible = false; + m_iridescenceThicknessPort.Visible = false; + m_iridescenceMaskPort.Visible = false; + m_indexOfRefractionPort.Visible = false; + m_transmittanceColorPort.Visible = false; + m_transmittanceAbsorptionDistancePort.Visible = false; + m_transmittanceMaskPort.Visible = false; + } + break; + case HDSRPMaterialType.Standard: + { + m_specularPort.Visible = false; + m_metallicPort.Visible = true; + m_coatMaskPort.Visible = true; + m_diffusionProfilePort.Visible = false; + m_subsurfaceMaskPort.Visible = false; + m_thicknessPort.Visible = false; + m_anisotropyPort.Visible = false; + m_iridescenceThicknessPort.Visible = false; + m_iridescenceMaskPort.Visible = false; + m_indexOfRefractionPort.Visible = false; + m_transmittanceColorPort.Visible = false; + m_transmittanceAbsorptionDistancePort.Visible = false; + m_transmittanceMaskPort.Visible = false; + } + break; + case HDSRPMaterialType.Specular: + { + m_specularPort.Visible = true; + m_metallicPort.Visible = false; + m_coatMaskPort.Visible = true; + m_diffusionProfilePort.Visible = false; + m_subsurfaceMaskPort.Visible = false; + m_thicknessPort.Visible = false; + m_anisotropyPort.Visible = false; + m_iridescenceThicknessPort.Visible = false; + m_iridescenceMaskPort.Visible = false; + m_indexOfRefractionPort.Visible = false; + m_transmittanceColorPort.Visible = false; + m_transmittanceAbsorptionDistancePort.Visible = false; + m_transmittanceMaskPort.Visible = false; + } + break; + case HDSRPMaterialType.Anisotropy: + { + m_specularPort.Visible = false; + m_metallicPort.Visible = true; + m_coatMaskPort.Visible = true; + m_diffusionProfilePort.Visible = false; + m_subsurfaceMaskPort.Visible = false; + m_thicknessPort.Visible = false; + m_anisotropyPort.Visible = true; + m_iridescenceThicknessPort.Visible = false; + m_iridescenceMaskPort.Visible = false; + m_indexOfRefractionPort.Visible = false; + m_transmittanceColorPort.Visible = false; + m_transmittanceAbsorptionDistancePort.Visible = false; + m_transmittanceMaskPort.Visible = false; + } + break; + case HDSRPMaterialType.Iridescence: + { + m_specularPort.Visible = false; + m_metallicPort.Visible = true; + m_coatMaskPort.Visible = true; + m_diffusionProfilePort.Visible = false; + m_subsurfaceMaskPort.Visible = false; + m_thicknessPort.Visible = false; + m_anisotropyPort.Visible = false; + m_iridescenceThicknessPort.Visible = true; + m_iridescenceMaskPort.Visible = true; + m_indexOfRefractionPort.Visible = false; + m_transmittanceColorPort.Visible = false; + m_transmittanceAbsorptionDistancePort.Visible = false; + m_transmittanceMaskPort.Visible = false; + } + break; + case HDSRPMaterialType.Translucent: + { + m_specularPort.Visible = false; + m_metallicPort.Visible = false; + m_coatMaskPort.Visible = false; + m_diffusionProfilePort.Visible = true; + m_subsurfaceMaskPort.Visible = false; + m_thicknessPort.Visible = true; + m_anisotropyPort.Visible = false; + m_iridescenceThicknessPort.Visible = false; + m_iridescenceMaskPort.Visible = false; + m_indexOfRefractionPort.Visible = false; + m_transmittanceColorPort.Visible = false; + m_transmittanceAbsorptionDistancePort.Visible = false; + m_transmittanceMaskPort.Visible = false; + } + break; + } + } + m_sizeIsDirty = ( m_isInvisible == InvisibilityStatus.Visible ); + } + + + public void SetShaderLODValueAndLabel( int value ) + { + if( ShaderLOD != value ) + ShaderLOD = value; + + if( ContainerGraph.HasLODs ) + { + SetClippedAdditionalTitle( string.Format( LodSubtitle , ShaderLOD ) ); + } + else + { + SetAdditonalTitleText( string.Empty ); + } + } + + void DrawLODAddRemoveButtons() + { + DrawLODAddRemoveButtons( -2 , true ); + } + + void DrawLODAddRemoveButtons( int index , bool showRemove ) + { + if( GUILayoutButton( string.Empty , UIUtils.PlusStyle , GUILayout.Width( 15 ) ) ) + { + Vector2 minPos = Vec2Position; + //bool newNodePositionMode = false; + //if( newNodePositionMode ) + //{ + // for( int lod = 0; lod < ContainerGraph.LodMultiPassMasternodes.Count; lod++ ) + // { + // if( ContainerGraph.LodMultiPassMasternodes[ lod ].Count != 0 ) + // { + // Vector2 currPos = ContainerGraph.LodMultiPassMasternodes[ lod ].NodesList[ m_passIdx ].Vec2Position; + // if( currPos.y > minPos.y ) + // { + // minPos = currPos; + // } + // } + // else + // { + // if( index < 0 ) + // { + // index = lod; + // } + // break; + // } + // } + //} + //else + //{ + for( int lod = ContainerGraph.LodMultiPassMasternodes.Count - 1 ; lod >= 0 ; lod-- ) + { + if( ContainerGraph.LodMultiPassMasternodes[ lod ].Count != 0 ) + { + minPos = ContainerGraph.LodMultiPassMasternodes[ lod ].NodesList[ m_passIdx ].Vec2Position; + break; + } + } + //} + + minPos.y += HeightEstimate + 10; + ContainerGraph.CreateLodMasterNodes( m_templateMultiPass , index , minPos ); + } + + if( showRemove && GUILayoutButton( string.Empty , UIUtils.MinusStyle , GUILayout.Width( 15 ) ) ) + { + ContainerGraph.DestroyLodMasterNodes( index ); + } + } + + void SetupLODNodeName() + { + if( IsMainOutputNode ) + { + if( string.IsNullOrEmpty( m_mainLODName ) ) + { + m_shaderNameIsTitle = true; + m_content.text = GenerateClippedTitle( m_croppedShaderName ); + } + else + { + m_shaderNameIsTitle = false; + m_content.text = GenerateClippedTitle( m_mainLODName ); + } + } + else + { + m_shaderNameIsTitle = false; + m_content.text = GenerateClippedTitle( m_passName ); + } + } + + public void DrawLodRowItem( bool listMode ) + { + float labelWidthBuffer = EditorGUIUtility.labelWidth; + EditorGUILayout.BeginHorizontal(); + if( listMode ) + { + if( GUILayout.Button( "\u25b6" , GUILayout.Width( 18 ) , GUILayout.Height( 18 ) ) ) + { + m_containerGraph.ParentWindow.FocusOnNode( this , 1 , false , true ); + } + EditorGUI.BeginChangeCheck(); + GUI.SetNextControlName( LodValueId + m_lodIndex ); + m_shaderLOD = EditorGUILayoutIntField( string.Empty , m_shaderLOD , GUILayout.Width( 50 ) ); + } + else + { + EditorGUI.BeginChangeCheck(); + EditorGUIUtility.labelWidth = 45; + GUI.SetNextControlName( LodValueId + m_lodIndex ); + m_shaderLOD = EditorGUILayoutIntField( "LOD" , ShaderLOD , GUILayout.Width( 100 ) ); + EditorGUIUtility.labelWidth = labelWidthBuffer; + } + + if( EditorGUI.EndChangeCheck() ) + { + m_refreshLODValueMasterNodes = true; + m_refreshLODValueMasterNodesTimestamp = EditorApplication.timeSinceStartup; + + if( ContainerGraph.HasLODs ) + SetClippedAdditionalTitle( string.Format( LodSubtitle , ShaderLOD ) ); + } + + EditorGUI.BeginChangeCheck(); + GUI.SetNextControlName( LodNameId + ShaderLOD ); + if( listMode ) + { + m_mainLODName = EditorGUILayoutTextField( string.Empty , m_mainLODName , GUILayout.Width( 100 ) ); + } + else + { + GUILayout.Space( -15 ); + EditorGUIUtility.labelWidth = 45; + m_mainLODName = EditorGUILayoutTextField( string.Empty , m_mainLODName ); + EditorGUIUtility.labelWidth = labelWidthBuffer; + } + if( EditorGUI.EndChangeCheck() ) + { + // If reorder is scheduled make sure it doesn't happen when editing LOD name + if( m_refreshLODValueMasterNodes ) + m_refreshLODValueMasterNodesTimestamp = EditorApplication.timeSinceStartup; + + SetupLODNodeName(); + } + + if( listMode ) + DrawLODAddRemoveButtons( m_lodIndex , ( m_lodIndex >= 0 ) ); + + EditorGUILayout.EndHorizontal(); + + if( m_refocusLODValueMasterNodes ) + { + m_refocusLODValueMasterNodes = false; + string focusedControl = GUI.GetNameOfFocusedControl(); + if( focusedControl.Contains( LodValueId ) ) + { + GUI.FocusControl( LodValueId + m_lodIndex ); + TextEditor te = (TextEditor)GUIUtility.GetStateObject( typeof( TextEditor ) , GUIUtility.keyboardControl ); + if( te != null ) + { + te.SelectTextEnd(); + } + } + else if( focusedControl.Contains( LodNameId ) ) + { + GUI.FocusControl( LodNameId + m_lodIndex ); + TextEditor te = (TextEditor)GUIUtility.GetStateObject( typeof( TextEditor ) , GUIUtility.keyboardControl ); + if( te != null ) + { + te.SelectTextEnd(); + } + } + } + } + + void DrawLOD() + { + if( m_templateMultiPass.CanAddLODs && m_lodIndex == -1 ) + { + EditorGUILayout.Space(); + + DrawLodRowItem( true ); + EditorGUILayout.Space(); + + for( int i = 0 ; i < ContainerGraph.LodMultiPassMasternodes.Count ; i++ ) + { + if( ContainerGraph.LodMultiPassMasternodes[ i ].NodesList.Count > 0 ) + { + TemplateMultiPassMasterNode masterNode = m_containerGraph.LodMultiPassMasternodes[ i ].NodesList[ m_passIdx ]; + masterNode.DrawLodRowItem( true ); + EditorGUILayout.Space(); + } + } + EditorGUILayout.Space(); + } + } + + void DrawCommonProperties() + { + if( m_isMainOutputNode ) + { + //if( m_templateMultiPass.CanAddLODs && m_lodIndex == -1 ) + //{ + // if( GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( 15 ) ) ) + // { + // ContainerGraph.CreateLodMasterNodes( m_templateMultiPass, Vec2Position ); + // } + + + // if( GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( 15 ) ) ) + // { + // ContainerGraph.DestroyLodMasterNodes(); + // } + + //} + + //EditorGUILayout.LabelField( "LOD: " + m_lodIndex ); + DrawShaderName(); + DrawCurrentShaderType(); + + if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.SRPIsPBRHD ) + { + if( m_templateMultiPass.CustomTemplatePropertyUI == CustomTemplatePropertyUIEnum.HDPBR ) + { + EditorGUI.BeginChangeCheck(); + CurrentHDMaterialType = (HDSRPMaterialType)EditorGUILayoutEnumPopup( HDSRPMaterialTypeStr , m_hdSrpMaterialType ); + if( EditorGUI.EndChangeCheck() ) + ConfigHDPorts(); + } + } + + EditorGUI.BeginChangeCheck(); + DrawPrecisionProperty( false ); + if( EditorGUI.EndChangeCheck() ) + ContainerGraph.CurrentPrecision = m_currentPrecisionType; + + DrawSamplingMacros(); + + m_drawInstancedHelper.Draw( this ); + m_fallbackHelper.Draw( this ); + DrawCustomInspector( m_templateMultiPass.SRPtype != TemplateSRPType.BiRP ); + m_subShaderOptions.DrawCustomOptions( this ); + m_dependenciesHelper.Draw( this , true ); + } + //EditorGUILayout.LabelField( m_subShaderIdxStr ); + //EditorGUILayout.LabelField( m_passIdxStr ); + + if( IsLODMainMasterNode && m_templateMultiPass.CanAddLODs ) + { + NodeUtils.DrawNestedPropertyGroup( ref m_lodFoldout , AdditionalLODsStr , DrawLOD , DrawLODAddRemoveButtons ); + } + + DrawOpenTemplateButton(); + if( DebugConsoleWindow.DeveloperMode ) + DrawReloadButton(); + + } + + public void DrawSubShaderProperties() + { + if( !m_isMainOutputNode ) + { + m_mainMasterNodeRef.DrawSubShaderProperties(); + return; + } + + bool noValidData = true; + if( ShaderLOD > 0 ) + { + noValidData = false; + if( m_templateMultiPass.CanAddLODs && m_containerGraph.LodMultiPassMasternodes[ 0 ].Count > 0 ) + { + DrawLodRowItem( false ); + } + else + { + ShaderLOD = EditorGUILayoutIntField( SubShaderLODValueLabel , ShaderLOD ); + } + } + + if( m_subShaderModule.HasValidData ) + { + noValidData = false; + m_subShaderModule.Draw( this , m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules ); + //if( m_subShaderModule.IsDirty ) + //{ + // List mpNodes = UIUtils.CurrentWindow.CurrentGraph.MultiPassMasterNodes.NodesList; + // int count = mpNodes.Count; + // for( int i = 0; i < count; i++ ) + // { + // if( mpNodes[ i ].SubShaderIdx == m_subShaderIdx && mpNodes[ i ].UniqueId != UniqueId ) + // { + // mpNodes[ i ].SubShaderModule.CopyFrom( m_subShaderModule ); + // } + // } + // m_subShaderModule.IsDirty = false; + //} + } + + m_passSelector.Draw( this ); + + if( noValidData ) + { + EditorGUILayout.HelpBox( NoSubShaderPropertyStr , MessageType.Info ); + } + } + + void DrawPassProperties() + { + EditorGUI.BeginChangeCheck(); + m_passName = EditorGUILayoutTextField( PassNameStr , m_passName ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_passName.Length > 0 ) + { + m_passName = UIUtils.RemoveShaderInvalidCharacters( m_passName ); + } + else + { + m_passName = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].PassNameContainer.Data; + } + //if( !m_templateMultiPass.IsSinglePass ) + // SetClippedTitle( m_passName ); + } + EditorGUILayout.LabelField( Pass.Modules.PassUniqueName ); + if( m_passModule.HasValidData ) + { + m_passModule.Draw( this , m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules , m_subShaderModule ); + } + + m_usePass.Draw( this , false ); + m_passOptions.DrawCustomOptions( this ); + } + + bool CreateInstructionsForList( TemplateData templateData , ref List ports , ref string shaderBody , ref List vertexInstructions , ref List fragmentInstructions ) + { + if( ports.Count == 0 ) + return true; + AddHDKeywords(); + bool isValid = true; + //UIUtils.CurrentWindow.CurrentGraph.ResetNodesLocalVariables(); + for( int i = 0 ; i < ports.Count ; i++ ) + { + TemplateInputData inputData = templateData.InputDataFromId( ports[ i ].PortId ); + if( ports[ i ].HasOwnOrLinkConnection ) + { + //if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.SRPType == TemplateSRPType.URP ) + //{ + // if( ports[ i ].Name.Contains( "Normal" ) ) + // { + // m_currentDataCollector.AddToDirectives( SRPMaterialNormalMapKeyword, -1, AdditionalLineType.Define ); + // } + + // if( ports[ i ].Name.Contains( "Alpha Clip Threshold" ) ) + // { + // m_currentDataCollector.AddToDirectives( SRPMaterialBlendModeAlphaClipThresholdKeyword, -1, AdditionalLineType.Define ); + // } + + // if( ports[ i ].Name.Contains( "Specular" ) ) + // { + // m_currentDataCollector.AddToDirectives( SRPLWMaterialSpecularKeyword, -1, AdditionalLineType.Define ); + // } + //} + //else if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.SRPType == TemplateSRPType.HDRP ) + //{ + // if( ports[ i ].Name.Contains( "Normal" ) ) + // { + // //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialNormalMapKeyword ); + // } + + // if( ports[ i ].Name.Contains( "Alpha Clip Threshold" ) ) + // { + // //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialAlphaTestKeyword ); + // } + + //} + + m_currentDataCollector.ResetInstructions(); + m_currentDataCollector.ResetVertexInstructions(); + + m_currentDataCollector.PortCategory = ports[ i ].Category; + string newPortInstruction = ports[ i ].GeneratePortInstructions( ref m_currentDataCollector ); + + if( m_currentDataCollector.DirtySpecialLocalVariables ) + { + string cleanVariables = m_currentDataCollector.SpecialLocalVariables.Replace( "\t" , string.Empty ); + m_currentDataCollector.AddInstructions( cleanVariables , false ); + m_currentDataCollector.ClearSpecialLocalVariables(); + } + + if( m_currentDataCollector.DirtyVertexVariables ) + { + string cleanVariables = m_currentDataCollector.VertexLocalVariables.Replace( "\t" , string.Empty ); + m_currentDataCollector.AddVertexInstruction( cleanVariables , UniqueId , false ); + m_currentDataCollector.ClearVertexLocalVariables(); + } + + // fill functions + for( int j = 0 ; j < m_currentDataCollector.InstructionsList.Count ; j++ ) + { + fragmentInstructions.Add( m_currentDataCollector.InstructionsList[ j ].PropertyName ); + } + + for( int j = 0 ; j < m_currentDataCollector.VertexDataList.Count ; j++ ) + { + vertexInstructions.Add( m_currentDataCollector.VertexDataList[ j ].PropertyName ); + } + + m_templateMultiPass.SetPassInputData( m_subShaderIdx , m_passIdx , ports[ i ].PortId , newPortInstruction ); + isValid = m_templateMultiPass.FillTemplateBody( m_subShaderIdx , m_passIdx , inputData.TagId , ref shaderBody , newPortInstruction ) && isValid; + } + else + { + m_templateMultiPass.SetPassInputData( m_subShaderIdx , m_passIdx , ports[ i ].PortId , inputData.DefaultValue ); + isValid = m_templateMultiPass.FillTemplateBody( m_subShaderIdx , m_passIdx , inputData.TagId , ref shaderBody , inputData.DefaultValue ) && isValid; + } + } + return isValid; + } + + public string BuildShaderBody( MasterNodeDataCollector inDataCollector , ref MasterNodeDataCollector outDataCollector ) + { + List list = ContainerGraph.MultiPassMasterNodes.NodesList; + int currentSubshader = list[ 0 ].SubShaderIdx; + m_templateMultiPass.SetShaderName( string.Format( TemplatesManager.NameFormatter , m_shaderName ) ); + if( string.IsNullOrEmpty( m_customInspectorName ) ) + { + m_templateMultiPass.SetCustomInspector( string.Empty ); + } + else + { + m_templateMultiPass.SetCustomInspector( CustomInspectorFormatted ); + } + + m_templateMultiPass.SetFallback( m_fallbackHelper.FallbackShader ); + m_templateMultiPass.SetDependencies( m_dependenciesHelper.GenerateDependencies() ); + + if( inDataCollector != null ) + outDataCollector.CopyPropertiesFromDataCollector( inDataCollector ); + + outDataCollector.TemplateDataCollectorInstance.CurrentSRPType = m_templateMultiPass.SRPtype; + + int lastActivePass = m_passSelector.LastActivePass; + int count = list.Count; + bool filledSubshaderData = false; + + bool foundExcludePassName = false; + string excludePassName = string.Empty; + + foundExcludePassName = CheckExcludeAllPassOptions( m_subShaderOptions , out excludePassName ); + for( int i = 0 ; i < count ; i++ ) + { + bool removePass = !m_passSelector.IsVisible( i ) || ( foundExcludePassName && !list[ i ].OriginalPassName.Equals( excludePassName ) ); + + list[ 0 ].CurrentTemplate.IdManager.SetPassIdUsage( i , removePass ); + if( removePass ) + { + if( m_isMainOutputNode ) + { + //Make sure that property change options are set even if the main master node is invisible + CheckPropertyChangesOnOptions( m_subShaderOptions ); + } + continue; + } + + list[ i ].CollectData(); + list[ i ].FillPassData( this , outDataCollector.TemplateDataCollectorInstance ); + + if( list[ i ].SubShaderIdx == currentSubshader ) + { + outDataCollector.CopyPropertiesFromDataCollector( list[ i ].CurrentDataCollector ); + } + else + { + list[ i - 1 ].FillPropertyData( outDataCollector ); + list[ i - 1 ].FillSubShaderData(); + outDataCollector.Destroy(); + outDataCollector = new MasterNodeDataCollector(); + outDataCollector.CopyPropertiesFromDataCollector( list[ i ].CurrentDataCollector ); + + currentSubshader = list[ i ].SubShaderIdx; + } + + // Last element must the one filling subshader data + // as only there all properties are caught + //if( i == ( count - 1 ) ) + if( i == lastActivePass ) + { + list[ i ].FillPropertyData( outDataCollector ); + } + + if( list[ i ].IsMainOutputNode ) + { + filledSubshaderData = true; + list[ i ].FillSubShaderData(); + } + } + + if( !filledSubshaderData ) + { + FillSubShaderData(); + } + outDataCollector.TemplateDataCollectorInstance.BuildCBuffer( -1 ); + + //Fill uniforms is set on last since we need to collect all srp batcher data ( if needed ) + //To set it into each pass + for( int i = 0 ; i < count ; i++ ) + { + bool removePass = !m_passSelector.IsVisible( i ) || ( foundExcludePassName && !list[ i ].OriginalPassName.Equals( excludePassName ) ); + if( removePass ) + continue; + + list[ i ].FillUniforms( outDataCollector.TemplateDataCollectorInstance ); + } + + return list[ 0 ].CurrentTemplate.IdManager.BuildShader(); + } + + public string BuildLOD( MasterNodeDataCollector inDataCollector , ref MasterNodeDataCollector outDataCollector ) + { + UsageListTemplateMultiPassMasterNodes bufferNodesList = ContainerGraph.MultiPassMasterNodes; + int bufferMasterNodeId = ContainerGraph.CurrentMasterNodeId; + + ContainerGraph.MultiPassMasterNodes = ContainerGraph.LodMultiPassMasternodes[ m_lodIndex ]; + ContainerGraph.CurrentMasterNodeId = UniqueId; + + m_templateMultiPass.ResetState(); + base.Execute( string.Empty , false ); + string shaderBody = BuildShaderBody( inDataCollector , ref outDataCollector ); + + + ContainerGraph.MultiPassMasterNodes = bufferNodesList; + ContainerGraph.CurrentMasterNodeId = bufferMasterNodeId; + return shaderBody; + } + + public override Shader Execute( string pathname , bool isFullPath ) + { + ForceReordering(); + MasterNodeDataCollector overallDataCollector = new MasterNodeDataCollector(); + + //BUILD LOD + string allLodSubShaders = string.Empty; + if( m_templateMultiPass.CanAddLODs && ContainerGraph.HasLODs ) + { + for( int lod = 0 ; lod < ContainerGraph.LodMultiPassMasternodes.Count ; lod++ ) + { + if( ContainerGraph.LodMultiPassMasternodes[ lod ].Count == 0 ) + break; + + TemplateMultiPassMasterNode newMasterNode = ContainerGraph.LodMultiPassMasternodes[ lod ].NodesList.Find( ( x ) => x.IsMainOutputNode ); + string lodSubShaders = newMasterNode.BuildLOD( null , ref overallDataCollector ); + lodSubShaders = TemplateHelperFunctions.GetSubShaderFrom( lodSubShaders ) + "\n"; + allLodSubShaders += lodSubShaders; + } + } + + //BUILD MAIN + m_templateMultiPass.ResetState(); + base.Execute( pathname , isFullPath ); + MasterNodeDataCollector dummy = new MasterNodeDataCollector(); + string shaderBody = BuildShaderBody( overallDataCollector , ref dummy ); + + if( m_templateMultiPass.CanAddLODs ) + { + //COMBINE LOD WITH MAIN + // Commented the if out since we always want to replace the tag with something, even string.empty to clean the tag out of the final shader + //if( !string.IsNullOrEmpty( allLodSubShaders ) ) + shaderBody = shaderBody.Replace( TemplatesManager.TemplateLODsTag , allLodSubShaders ); + } + + UpdateShaderAsset( ref pathname , ref shaderBody , isFullPath ); + return m_currentShader; + } + + public void CollectData() + { + if( m_inputPorts.Count == 0 ) + return; + + ContainerGraph.ResetNodesLocalVariables(); + m_optionsDefineContainer.RemoveTemporaries(); + m_currentDataCollector = new MasterNodeDataCollector( this ); + m_currentDataCollector.TemplateDataCollectorInstance.SetMultipassInfo( m_templateMultiPass , m_subShaderIdx , m_passIdx , m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.SRPType ); + m_currentDataCollector.TemplateDataCollectorInstance.FillSpecialVariables( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ] ); + SetupNodeCategories(); + if( m_containerGraph.IsInstancedShader ) + { + string blockName = UIUtils.RemoveInvalidCharacters( ContainerGraph.GetMainMasterNodeOfLOD( -1 ).ShaderName ); + m_currentDataCollector.SetupInstancePropertiesBlock( blockName ); + } + TemplateData templateData = m_templateMultiPass.CreateTemplateData( m_shaderName , string.Empty , m_subShaderIdx , m_passIdx ); + m_currentDataCollector.TemplateDataCollectorInstance.BuildFromTemplateData( m_currentDataCollector , templateData ); + + if( m_currentDataCollector.TemplateDataCollectorInstance.InterpData.DynamicMax ) + { + int interpolatorAmount = -1; + if( m_passModule.ShaderModelHelper.ValidData ) + { + interpolatorAmount = m_passModule.ShaderModelHelper.InterpolatorAmount; + } + else + { + TemplateModulesHelper subShaderModule = IsMainOutputNode ? m_subShaderModule : ( m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode ).SubShaderModule; + if( subShaderModule.ShaderModelHelper.ValidData ) + { + interpolatorAmount = subShaderModule.ShaderModelHelper.InterpolatorAmount; + } + } + + if( interpolatorAmount > -1 ) + { + m_currentDataCollector.TemplateDataCollectorInstance.InterpData.RecalculateAvailableInterpolators( interpolatorAmount ); + } + } + + //Copy Properties + { + int shaderPropertiesAmount = m_templateMultiPass.AvailableShaderProperties.Count; + for( int i = 0 ; i < shaderPropertiesAmount ; i++ ) + { + m_currentDataCollector.SoftRegisterUniform( m_templateMultiPass.AvailableShaderProperties[ i ] ); + } + } + //Copy Globals from SubShader level + { + int subShaderGlobalAmount = m_templateMultiPass.SubShaders[ m_subShaderIdx ].AvailableShaderGlobals.Count; + for( int i = 0 ; i < subShaderGlobalAmount ; i++ ) + { + m_currentDataCollector.SoftRegisterUniform( m_templateMultiPass.SubShaders[ m_subShaderIdx ].AvailableShaderGlobals[ i ] ); + } + } + //Copy Globals from Pass Level + { + int passGlobalAmount = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].AvailableShaderGlobals.Count; + for( int i = 0 ; i < passGlobalAmount ; i++ ) + { + m_currentDataCollector.SoftRegisterUniform( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].AvailableShaderGlobals[ i ] ); + } + } + // Check Current Options for property changes on subshader + if( m_isMainOutputNode ) + { + CheckPropertyChangesOnOptions( m_subShaderOptions ); + } + + // Check Current Options for property changes on pass + CheckPropertyChangesOnOptions( m_passOptions ); + + // @diogo: Set ASE info + ASEPackageManagerHelper.SetASEVersionInfoOnDataCollector( ref m_currentDataCollector ); + + //Set SRP info + if( m_templateMultiPass.SRPtype != TemplateSRPType.BiRP ) + ASEPackageManagerHelper.SetSRPInfoOnDataCollector( ref m_currentDataCollector ); + + RegisterStandaloneFuntions(); + m_containerGraph.CheckPropertiesAutoRegister( ref m_currentDataCollector ); + + //Sort ports by both + List fragmentPorts = new List(); + List vertexPorts = new List(); + + SortInputPorts( ref vertexPorts , ref fragmentPorts ); + + + string shaderBody = templateData.TemplateBody; + + List vertexInstructions = new List(); + List fragmentInstructions = new List(); + + bool validBody = true; + + //validBody = CreateInstructionsForList( templateData, ref fragmentPorts, ref shaderBody, ref vertexInstructions, ref fragmentInstructions ) && validBody; + //ContainerGraph.ResetNodesLocalVariablesIfNot( MasterNodePortCategory.Vertex ); + //validBody = CreateInstructionsForList( templateData, ref vertexPorts, ref shaderBody, ref vertexInstructions, ref fragmentInstructions ) && validBody; + validBody = CreateInstructionsForList( templateData , ref vertexPorts , ref shaderBody , ref vertexInstructions , ref fragmentInstructions ) && validBody; + validBody = CreateInstructionsForList( templateData , ref fragmentPorts , ref shaderBody , ref vertexInstructions , ref fragmentInstructions ) && validBody; + + if( !m_isMainOutputNode && m_mainMasterNodeRef == null ) + { + m_mainMasterNodeRef = m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode; + } + + TerrainDrawInstancedHelper drawInstanced = m_isMainOutputNode ? m_drawInstancedHelper : m_mainMasterNodeRef.DrawInstancedHelperInstance; + drawInstanced.UpdateDataCollectorForTemplates( ref m_currentDataCollector , ref vertexInstructions ); + + templateData.ResetTemplateUsageData(); + + // Fill vertex interpolators assignment + for( int i = 0 ; i < m_currentDataCollector.VertexInterpDeclList.Count ; i++ ) + { + vertexInstructions.Add( m_currentDataCollector.VertexInterpDeclList[ i ] ); + } + + vertexInstructions.AddRange( m_currentDataCollector.TemplateDataCollectorInstance.GetInterpUnusedChannels() ); + + //Fill common local variables and operations + validBody = m_templateMultiPass.FillVertexInstructions( m_subShaderIdx , m_passIdx , vertexInstructions.ToArray() ) && validBody; + validBody = m_templateMultiPass.FillFragmentInstructions( m_subShaderIdx , m_passIdx , fragmentInstructions.ToArray() ) && validBody; + + vertexInstructions.Clear(); + vertexInstructions = null; + + fragmentInstructions.Clear(); + fragmentInstructions = null; + + // Add Instanced Properties + if( m_containerGraph.IsInstancedShader ) + { + m_currentDataCollector.OptimizeInstancedProperties(); + m_currentDataCollector.TabifyInstancedVars(); + + //string cbufferBegin = m_currentDataCollector.IsSRP ? + // string.Format( IOUtils.SRPInstancedPropertiesBegin, "UnityPerMaterial" ) : + // string.Format( IOUtils.InstancedPropertiesBegin, m_currentDataCollector.InstanceBlockName ); + //string cBufferEnd = m_currentDataCollector.IsSRP ? ( string.Format( IOUtils.SRPInstancedPropertiesEnd, m_currentDataCollector.InstanceBlockName ) ) : IOUtils.InstancedPropertiesEnd; + string cbufferBegin = m_currentDataCollector.IsSRP ? + string.Format( IOUtils.LWSRPInstancedPropertiesBegin , m_currentDataCollector.InstanceBlockName ) : + string.Format( IOUtils.InstancedPropertiesBegin , m_currentDataCollector.InstanceBlockName ); + string cBufferEnd = m_currentDataCollector.IsSRP ? ( string.Format( IOUtils.LWSRPInstancedPropertiesEnd , m_currentDataCollector.InstanceBlockName ) ) : IOUtils.InstancedPropertiesEnd; + + m_currentDataCollector.InstancedPropertiesList.Insert( 0 , new PropertyDataCollector( -1 , cbufferBegin ) ); + m_currentDataCollector.InstancedPropertiesList.Add( new PropertyDataCollector( -1 , cBufferEnd ) ); + m_currentDataCollector.UniformsList.AddRange( m_currentDataCollector.InstancedPropertiesList ); + } + + if( m_currentDataCollector.DotsPropertiesList.Count > 0 ) + { + m_currentDataCollector.DotsPropertiesList.Insert( 0 , new PropertyDataCollector( -1 , "UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata)" ) ); + m_currentDataCollector.DotsPropertiesList.Insert( 0 , new PropertyDataCollector( -1 , "#ifdef UNITY_DOTS_INSTANCING_ENABLED" ) ); + m_currentDataCollector.DotsPropertiesList.Insert( 0 , new PropertyDataCollector( -1 , "" ) ); + m_currentDataCollector.DotsPropertiesList.Add( new PropertyDataCollector( -1 , "UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata)" ) ); + m_currentDataCollector.DotsDefinesList.Add( new PropertyDataCollector( -1 , "#endif" ) ); + m_currentDataCollector.UniformsList.AddRange( m_currentDataCollector.DotsPropertiesList ); + m_currentDataCollector.UniformsList.AddRange( m_currentDataCollector.DotsDefinesList ); + } + + TemplateShaderModelModule shaderModelModule = m_isMainOutputNode ? m_subShaderModule.ShaderModelHelper : m_mainMasterNodeRef.SubShaderModule.ShaderModelHelper; + string shaderModel = string.Empty; + if( m_passModule.ShaderModelHelper.ValidData ) + { + shaderModel = m_passModule.ShaderModelHelper.CurrentShaderModel; + } + else if( shaderModelModule.ValidData ) + { + shaderModel = shaderModelModule.CurrentShaderModel; + } + else if( m_templateMultiPass.GlobalShaderModel.IsValid ) + { + shaderModel = m_templateMultiPass.GlobalShaderModel.Value; + } + else + { + shaderModel = ( m_templateMultiPass.SRPtype == TemplateSRPType.HDRP ) ? "4.5" : "3.0"; + } + + m_currentDataCollector.TemplateDataCollectorInstance.CheckInterpolatorOverflow( shaderModel , m_passName ); + } + + public bool CheckExcludeAllPassOptions( TemplateOptionsUIHelper optionsUI , out string passName ) + { + List options = optionsUI.PassCustomOptionsUI; + for( int optionIdx = 0 ; optionIdx < options.Count ; optionIdx++ ) + { + if( options[ optionIdx ].IsVisible ) + { + TemplateActionItem[] actionItems = options[ optionIdx ].CurrentOptionActions.Columns; + for( int actionIdx = 0 ; actionIdx < actionItems.Length ; actionIdx++ ) + { + if( actionItems[ actionIdx ].ActionType == AseOptionsActionType.ExcludeAllPassesBut ) + { + passName = actionItems[ actionIdx ].ActionData; + return true; + } + } + } + } + + passName = string.Empty; + return false; + } + + public void CheckPropertyChangesOnOptions( TemplateOptionsUIHelper optionsUI ) + { + //Only Main LOD master node can change shader properties + if( !IsLODMainMasterNode ) + return; + + List options = optionsUI.PassCustomOptionsUI; + for( int optionIdx = 0 ; optionIdx < options.Count ; optionIdx++ ) + { + if( options[ optionIdx ].IsVisible ) + { + TemplateActionItem[] actionItems = options[ optionIdx ].CurrentOptionActions.Columns; + for( int actionIdx = 0 ; actionIdx < actionItems.Length ; actionIdx++ ) + { + if( actionItems[ actionIdx ].ActionType == AseOptionsActionType.SetShaderProperty && !string.IsNullOrEmpty( actionItems[ actionIdx ].ActionBuffer ) ) + { + TemplateShaderPropertyData data = m_templateMultiPass.GetShaderPropertyData( actionItems[ actionIdx ].ActionData ); + if( data != null ) + { + string newPropertyValue = data.CreatePropertyForValue( actionItems[ actionIdx ].ActionBuffer ); + CurrentTemplate.IdManager.SetReplacementText( data.FullValue , newPropertyValue ); + if( CurrentMaterial != null ) + { + switch( data.PropertyDataType ) + { + case WirePortDataType.FLOAT: + { + float value = 0; + if( actionItems[ actionIdx ].GetFloatValueFromActionBuffer( out value ) ) + { + CurrentMaterial.SetFloat( data.PropertyName , value ); + } + } + break; + case WirePortDataType.INT: + { + int value = 0; + if( actionItems[ actionIdx ].GetIntValueFromActionBuffer( out value ) ) + { + CurrentMaterial.SetInt( data.PropertyName , value ); + } + } + break; + case WirePortDataType.UINT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + break; + } + + } + } + } + } + + if( options[ optionIdx ].Options.Type == AseOptionsType.Field ) + { + foreach( var item in CurrentTemplate.IdManager.RegisteredTags ) + { + if( item.Output.Equals( options[ optionIdx ].Options.FieldInlineName ) ) + { + var node = options[ optionIdx ].Options.FieldValue.GetPropertyNode(); + if( node != null && ( node.IsConnected || node.AutoRegister || node.UniqueId < -1 ) && options[ optionIdx ].Options.FieldValue.Active ) + { + item.Replacement = node.PropertyName; + } + } + } + } + } + } + } + + public void FillPropertyData( MasterNodeDataCollector dataCollector = null ) + { + MasterNodeDataCollector currDataCollector = ( dataCollector == null ) ? m_currentDataCollector : dataCollector; + + // Temporary hack + if( m_templateMultiPass.SRPtype != TemplateSRPType.BiRP ) + { + if( m_templateMultiPass.AvailableShaderProperties.Find( x => x.PropertyName.Equals( "_AlphaCutoff" ) ) == null ) + { + if( !currDataCollector.ContainsProperty("_AlphaCutoff") ) + { + currDataCollector.AddToProperties( UniqueId, "[HideInInspector] _AlphaCutoff(\"Alpha Cutoff \", Range(0, 1)) = 0.5", -1 ); + } + } + + if( m_templateMultiPass.AvailableShaderProperties.Find( x => x.PropertyName.Equals( "_EmissionColor" ) ) == null ) + { + if( !currDataCollector.ContainsProperty( "_EmissionColor" ) ) + { + currDataCollector.AddToProperties( UniqueId, "[HideInInspector] _EmissionColor(\"Emission Color\", Color) = (1,1,1,1)", -1 ); + } + } + } + + m_templateMultiPass.SetPropertyData( currDataCollector.BuildUnformatedPropertiesStringArr() ); + } + + public void FillSubShaderData( /*MasterNodeDataCollector dataCollector = null */) + { + //MasterNodeDataCollector currDataCollector = ( dataCollector == null ) ? m_currentDataCollector : dataCollector; + //// SubShader Data + + //m_templateMultiPass.SetPropertyData( currDataCollector.BuildUnformatedPropertiesStringArr() ); + //templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModulePass, m_subShaderIdx, currDataCollector.GrabPassList ); + if( ShaderLOD > -1 ) + { + string lodUniqueId = m_templateMultiPass.SubShaders[ m_subShaderIdx ].UniquePrefix + "Module" + m_templateMultiPass.SubShaders[ m_subShaderIdx ].LODContainer.Id; + m_templateMultiPass.IdManager.SetReplacementText( lodUniqueId , "LOD " + ShaderLOD ); + } + + SetModuleData( m_subShaderModule , true ); + } + + public bool CheckDefineListItem( PropertyDataCollector item ) + { + //The IsDirective flag in this context is used to determine if its #pragma + if( item.IsDirective ) + { + return !m_currentDataCollector.ContainsPragma( item.PropertyName ); + } + else + { + return !m_currentDataCollector.ContainsDefine( item.PropertyName ); + } + + } + + public void FillPassData( TemplateMultiPassMasterNode masterNode , TemplateDataCollector mainTemplateDataCollector ) + { + if( m_isInvisible != InvisibilityStatus.Visible ) + { + if( masterNode.UniqueId != UniqueId ) + { + if( ( m_invisibleOptions & (int)InvisibleOptionsEnum.SyncProperties ) > 0 ) + { + PassModule.SyncWith( masterNode.PassModule ); + } + } + + int inputCount = m_inputPorts.Count; + for( int i = 0 ; i < inputCount ; i++ ) + { + if( m_inputPorts[ i ].HasExternalLink ) + { + TemplateMultiPassMasterNode linkedNode = m_inputPorts[ i ].ExternalLinkNode as TemplateMultiPassMasterNode; + if( linkedNode != null ) + { + SetLinkedModuleData( linkedNode.PassModule ); + } + } + } + } + + SetModuleData( m_passModule , false ); + if( m_currentDataCollector != null ) + { + if( Pass.CustomOptionsContainer.CopyOptionsFromMainPass ) + { + SetPassCustomOptionsInfo( m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode ); + } + else + { + SetPassCustomOptionsInfo( this ); + } + + var inputArray = m_currentDataCollector.VertexInputList.ToArray(); + + m_templateMultiPass.SetPassData( TemplateModuleDataType.PassVertexData , m_subShaderIdx , m_passIdx , inputArray ); + m_templateMultiPass.SetPassData( TemplateModuleDataType.PassInterpolatorData , m_subShaderIdx , m_passIdx , m_currentDataCollector.InterpolatorList.ToArray() ); + + List afterNativesIncludePragmaDefineList = new List(); + afterNativesIncludePragmaDefineList.AddRange( m_currentDataCollector.IncludesList ); + afterNativesIncludePragmaDefineList.AddRange( m_currentDataCollector.DefinesList ); + //includePragmaDefineList.AddRange( m_optionsDefineContainer.DefinesList ); + afterNativesIncludePragmaDefineList.AddRange( m_currentDataCollector.PragmasList ); + CheckSamplingMacrosFlag(); + m_currentDataCollector.AddASEMacros(); + afterNativesIncludePragmaDefineList.AddRange( m_currentDataCollector.AfterNativeDirectivesList ); + + //includePragmaDefineList.AddRange( m_currentDataCollector.MiscList ); + + List beforeNatives = new List(); + int defineListCount = m_optionsDefineContainer.DefinesList.Count; + for( int i = 0 ; i < defineListCount ; i++ ) + { + if( CheckDefineListItem( m_optionsDefineContainer.DefinesList[ i ] ) ) + { + beforeNatives.Add( m_optionsDefineContainer.DefinesList[ i ] ); + } + } + + beforeNatives.AddRange( m_currentDataCollector.BeforeNativeDirectivesList ); + + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModulePragmaBefore , m_subShaderIdx , m_passIdx , beforeNatives ); + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModulePragma , m_subShaderIdx , m_passIdx , afterNativesIncludePragmaDefineList ); + + m_currentDataCollector.TemplateDataCollectorInstance.CloseLateDirectives(); + + //Add Functions + if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.FunctionsTag.IsValid ) + { + m_currentDataCollector.FunctionsList.InsertRange( 0 , m_currentDataCollector.TemplateDataCollectorInstance.LateDirectivesList ); + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleFunctions , m_subShaderIdx , m_passIdx , m_currentDataCollector.FunctionsList ); + } + else + { + m_currentDataCollector.UniformsList.InsertRange( 0 , m_currentDataCollector.TemplateDataCollectorInstance.LateDirectivesList ); + m_currentDataCollector.UniformsList.AddRange( m_currentDataCollector.FunctionsList ); + } + + //copy srp batch if present + //if( m_currentDataCollector.IsSRP ) + //{ + // m_currentDataCollector.UniformsList.AddRange( mainTemplateDataCollector.SrpBatcherPropertiesList ); + //} + //m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleGlobals, m_subShaderIdx, m_passIdx, m_currentDataCollector.UniformsList ); + + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleInputVert , m_subShaderIdx , m_passIdx , m_currentDataCollector.TemplateDataCollectorInstance.VertexInputParamsStr ); + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleInputFrag , m_subShaderIdx , m_passIdx , m_currentDataCollector.TemplateDataCollectorInstance.FragInputParamsStr ); + + if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessVControlTag != null && m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessVControlTag.IsValid ) + m_templateMultiPass.SetPassData( TemplateModuleDataType.VControl , m_subShaderIdx , m_passIdx , inputArray ); + + if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessControlData != null && m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessControlData.IsValid ) + m_templateMultiPass.SetPassData( TemplateModuleDataType.ControlData , m_subShaderIdx , m_passIdx , m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessControlData.GenerateControl( m_currentDataCollector.TemplateDataCollectorInstance.VertexDataDict , m_currentDataCollector.VertexInputList ) ); + + if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessDomainData != null && m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessDomainData.IsValid ) + m_templateMultiPass.SetPassData( TemplateModuleDataType.DomainData , m_subShaderIdx , m_passIdx , m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessDomainData.GenerateDomain( m_currentDataCollector.TemplateDataCollectorInstance.VertexDataDict , m_currentDataCollector.VertexInputList ) ); + + afterNativesIncludePragmaDefineList.Clear(); + afterNativesIncludePragmaDefineList = null; + + beforeNatives.Clear(); + beforeNatives = null; + } + + m_templateMultiPass.SetPassData( TemplateModuleDataType.PassNameData , m_subShaderIdx , m_passIdx , string.Format( PassNameFormateStr , m_passName ) ); + } + + public List CrossCheckSoftRegisteredUniformList( List uniformList ) + { + List newItems = new List(); + for( int i = 0 ; i < uniformList.Count ; i++ ) + { + if( !m_currentDataCollector.CheckIfSoftRegistered( uniformList[ i ].PropertyName ) ) + { + newItems.Add( uniformList[ i ] ); + } + } + return newItems; + } + + public void FillUniforms( TemplateDataCollector mainTemplateDataCollector ) + { + if( m_currentDataCollector.IsSRP ) + { + + if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.SRPBatcherTag.IsValid ) + { + List finalList = CrossCheckSoftRegisteredUniformList( mainTemplateDataCollector.SrpBatcherPropertiesList ); + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleSRPBatcher , m_subShaderIdx , m_passIdx , finalList ); + finalList.Clear(); + finalList = null; + } + else + { + List finalList = CrossCheckSoftRegisteredUniformList( mainTemplateDataCollector.FullSrpBatcherPropertiesList ); + m_currentDataCollector.UniformsList.AddRange( finalList ); + finalList.Clear(); + finalList = null; + } + } + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleGlobals , m_subShaderIdx , m_passIdx , m_currentDataCollector.UniformsList ); + } + + void SetLinkedModuleData( TemplateModulesHelper linkedModule ) + { + //if( linkedModule.AdditionalPragmas.ValidData ) + //{ + // linkedModule.AdditionalPragmas.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.IncludePragmaContainer ); + //} + + //if( linkedModule.AdditionalIncludes.ValidData ) + //{ + // linkedModule.AdditionalIncludes.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.IncludePragmaContainer ); + //} + + //if( linkedModule.AdditionalDefines.ValidData ) + //{ + // linkedModule.AdditionalDefines.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.IncludePragmaContainer ); + //} + + if( linkedModule.AdditionalDirectives.ValidData ) + { + var pass = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ]; + linkedModule.AdditionalDirectives.AddAllToDataCollector( ref m_currentDataCollector , pass, pass.Modules.IncludePragmaContainer ); + } + } + + void SetModuleData( TemplateModulesHelper module , bool isSubShader ) + { + if( isSubShader ) + { + + //if ( module.AdditionalPragmas.ValidData ) + //{ + // module.AdditionalPragmas.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.IncludePragmaContainer ); + //} + + //if ( module.AdditionalIncludes.ValidData ) + //{ + // module.AdditionalIncludes.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.IncludePragmaContainer ); + //} + + //if ( module.AdditionalDefines.ValidData ) + //{ + // module.AdditionalDefines.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.IncludePragmaContainer ); + //} + + if( module.AdditionalDirectives.ValidData ) + { + module.AdditionalDirectives.AddAllToDataCollector( ref m_currentDataCollector , null, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.IncludePragmaContainer ); + } + + if( module.TagsHelper.ValidData ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleTag , m_subShaderIdx , module.TagsHelper.GenerateTags() ); + } + + if( module.AllModulesMode ) + { + string body = module.GenerateAllModulesString( isSubShader ); + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.AllModules , m_subShaderIdx , body.Split( '\n' ) ); + } + + if( module.ShaderModelHelper.ValidAndIndependent ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleShaderModel , m_subShaderIdx , module.ShaderModelHelper.GenerateShaderData( isSubShader ) ); + } + + if( module.BlendOpHelper.IndependentModule && module.BlendOpHelper.ValidBlendMode ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleBlendMode , m_subShaderIdx , module.BlendOpHelper.CurrentBlendFactor ); + } + + if( module.BlendOpHelper1.IndependentModule && module.BlendOpHelper1.ValidBlendMode ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleBlendMode1 , m_subShaderIdx , module.BlendOpHelper1.CurrentBlendFactor ); + } + + if( module.BlendOpHelper2.IndependentModule && module.BlendOpHelper2.ValidBlendMode ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleBlendMode2 , m_subShaderIdx , module.BlendOpHelper2.CurrentBlendFactor ); + } + + if( module.BlendOpHelper3.IndependentModule && module.BlendOpHelper3.ValidBlendMode ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleBlendMode3 , m_subShaderIdx , module.BlendOpHelper3.CurrentBlendFactor ); + } + + if( module.BlendOpHelper.IndependentModule && module.BlendOpHelper.ValidBlendOp ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleBlendOp , m_subShaderIdx , module.BlendOpHelper.CurrentBlendOp ); + } + + if( module.BlendOpHelper1.IndependentModule && module.BlendOpHelper1.ValidBlendOp ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleBlendOp1 , m_subShaderIdx , module.BlendOpHelper1.CurrentBlendOp ); + } + + if( module.BlendOpHelper2.IndependentModule && module.BlendOpHelper2.ValidBlendOp ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleBlendOp2 , m_subShaderIdx , module.BlendOpHelper2.CurrentBlendOp ); + } + + if( module.BlendOpHelper3.IndependentModule && module.BlendOpHelper3.ValidBlendOp ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleBlendOp3 , m_subShaderIdx , module.BlendOpHelper3.CurrentBlendOp ); + } + + if( module.AlphaToMaskHelper.ValidAndIndependent ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleAlphaToMask , m_subShaderIdx , module.AlphaToMaskHelper.GenerateShaderData( isSubShader ) ); + } + + if( module.CullModeHelper.ValidAndIndependent ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleCullMode , m_subShaderIdx , module.CullModeHelper.GenerateShaderData( isSubShader ) ); + } + + if( module.ColorMaskHelper.ValidAndIndependent ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleColorMask , m_subShaderIdx , module.ColorMaskHelper.GenerateShaderData( isSubShader ) ); + } + + if( module.ColorMaskHelper1.ValidAndIndependent ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleColorMask1 , m_subShaderIdx , module.ColorMaskHelper1.GenerateShaderData( isSubShader ) ); + } + + if( module.ColorMaskHelper2.ValidAndIndependent ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleColorMask2 , m_subShaderIdx , module.ColorMaskHelper2.GenerateShaderData( isSubShader ) ); + } + + if( module.ColorMaskHelper3.ValidAndIndependent ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleColorMask3 , m_subShaderIdx , module.ColorMaskHelper3.GenerateShaderData( isSubShader ) ); + } + + if( module.DepthOphelper.IndependentModule && module.DepthOphelper.ValidZTest ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleZTest , m_subShaderIdx , module.DepthOphelper.CurrentZTestMode ); + } + + if( module.DepthOphelper.IndependentModule && module.DepthOphelper.ValidZWrite ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleZwrite , m_subShaderIdx , module.DepthOphelper.CurrentZWriteMode ); + } + + if( module.DepthOphelper.IndependentModule && module.DepthOphelper.ValidOffset ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleZOffset , m_subShaderIdx , module.DepthOphelper.CurrentOffset ); + } + + if( module.StencilBufferHelper.ValidAndIndependent ) + { + CullMode cullMode = ( module.CullModeHelper.ValidData ) ? module.CullModeHelper.CurrentCullMode : CullMode.Back; + string value = module.StencilBufferHelper.CreateStencilOp( cullMode ); + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleStencil , m_subShaderIdx , value.Split( '\n' ) ); + } + + if( module.RenderingPlatforms.LoadedFromTemplate ) + { + m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleRenderPlatforms , m_subShaderIdx , module.RenderingPlatforms.CreateResult(true) ); + } + + } + else + { + //if ( module.AdditionalPragmas.ValidData ) + //{ + // module.AdditionalPragmas.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.IncludePragmaContainer ); + //} + + //if ( module.AdditionalIncludes.ValidData ) + //{ + // module.AdditionalIncludes.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.IncludePragmaContainer ); + //} + + //if ( module.AdditionalDefines.ValidData ) + //{ + // module.AdditionalDefines.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.IncludePragmaContainer ); + //} + List aboveUsePass = new List(); + List belowUsePass = new List(); + m_usePass.BuildUsePassInfo( m_currentDataCollector , ref aboveUsePass , ref belowUsePass ); + //TODO Must place this on the correct place + aboveUsePass.AddRange( belowUsePass ); + + //adding grab pass after use pass on purpose, so it wont be caught by them + aboveUsePass.AddRange( m_currentDataCollector.GrabPassList ); + + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModulePass , m_subShaderIdx , m_passIdx , aboveUsePass ); + //m_templateMultiPass.SetPassData( TemplateModuleDataType.EndPass, m_subShaderIdx, m_passIdx, bellowUsePass); + + if( module.AdditionalDirectives.ValidData ) + { + var pass = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ]; + module.AdditionalDirectives.AddAllToDataCollector( ref m_currentDataCollector , pass, pass.Modules.IncludePragmaContainer ); + } + + if( module.TagsHelper.ValidData ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleTag , m_subShaderIdx , m_passIdx , module.TagsHelper.GenerateTags() ); + } + + if( module.AllModulesMode ) + { + string body = module.GenerateAllModulesString( isSubShader ); + m_templateMultiPass.SetPassData( TemplateModuleDataType.AllModules , m_subShaderIdx , m_passIdx , body.Split( '\n' ) ); + } + + if( module.ShaderModelHelper.ValidAndIndependent ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleShaderModel , m_subShaderIdx , m_passIdx , module.ShaderModelHelper.GenerateShaderData( isSubShader ) ); + } + + if( module.BlendOpHelper.IndependentModule && module.BlendOpHelper.ValidBlendMode ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleBlendMode , m_subShaderIdx , m_passIdx , module.BlendOpHelper.CurrentBlendFactor ); + } + + if( module.BlendOpHelper1.IndependentModule && module.BlendOpHelper1.ValidBlendMode ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleBlendMode1 , m_subShaderIdx , m_passIdx , module.BlendOpHelper1.CurrentBlendFactor ); + } + + if( module.BlendOpHelper2.IndependentModule && module.BlendOpHelper2.ValidBlendMode ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleBlendMode2 , m_subShaderIdx , m_passIdx , module.BlendOpHelper2.CurrentBlendFactor ); + } + + if( module.BlendOpHelper3.IndependentModule && module.BlendOpHelper3.ValidBlendMode ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleBlendMode3 , m_subShaderIdx , m_passIdx , module.BlendOpHelper3.CurrentBlendFactor ); + } + + if( module.BlendOpHelper.IndependentModule && module.BlendOpHelper.ValidBlendOp ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleBlendOp , m_subShaderIdx , m_passIdx , module.BlendOpHelper.CurrentBlendOp ); + } + + if( module.BlendOpHelper1.IndependentModule && module.BlendOpHelper1.ValidBlendOp ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleBlendOp1 , m_subShaderIdx , m_passIdx , module.BlendOpHelper1.CurrentBlendOp ); + } + + if( module.BlendOpHelper2.IndependentModule && module.BlendOpHelper2.ValidBlendOp ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleBlendOp2 , m_subShaderIdx , m_passIdx , module.BlendOpHelper2.CurrentBlendOp ); + } + + if( module.BlendOpHelper3.IndependentModule && module.BlendOpHelper3.ValidBlendOp ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleBlendOp3 , m_subShaderIdx , m_passIdx , module.BlendOpHelper3.CurrentBlendOp ); + } + + if( module.AlphaToMaskHelper.ValidAndIndependent ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleAlphaToMask , m_subShaderIdx , m_passIdx , module.AlphaToMaskHelper.GenerateShaderData( isSubShader ) ); + } + + if( module.CullModeHelper.ValidAndIndependent ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleCullMode , m_subShaderIdx , m_passIdx , module.CullModeHelper.GenerateShaderData( isSubShader ) ); + } + + if( module.ColorMaskHelper.ValidAndIndependent ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleColorMask , m_subShaderIdx , m_passIdx , module.ColorMaskHelper.GenerateShaderData( isSubShader ) ); + } + + if( module.ColorMaskHelper1.ValidAndIndependent ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleColorMask1 , m_subShaderIdx , m_passIdx , module.ColorMaskHelper1.GenerateShaderData( isSubShader ) ); + } + + if( module.ColorMaskHelper2.ValidAndIndependent ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleColorMask2 , m_subShaderIdx , m_passIdx , module.ColorMaskHelper2.GenerateShaderData( isSubShader ) ); + } + + if( module.ColorMaskHelper3.ValidAndIndependent ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleColorMask3 , m_subShaderIdx , m_passIdx , module.ColorMaskHelper3.GenerateShaderData( isSubShader ) ); + } + + if( module.DepthOphelper.IndependentModule && module.DepthOphelper.ValidZTest ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleZTest , m_subShaderIdx , m_passIdx , module.DepthOphelper.CurrentZTestMode ); + } + + if( module.DepthOphelper.IndependentModule && module.DepthOphelper.ValidZWrite ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleZwrite , m_subShaderIdx , m_passIdx , module.DepthOphelper.CurrentZWriteMode ); + } + + if( module.DepthOphelper.IndependentModule && module.DepthOphelper.ValidOffset ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleZOffset , m_subShaderIdx , m_passIdx , module.DepthOphelper.CurrentOffset ); + } + + if( module.StencilBufferHelper.ValidAndIndependent ) + { + CullMode cullMode = ( module.CullModeHelper.ValidData ) ? module.CullModeHelper.CurrentCullMode : CullMode.Back; + string value = module.StencilBufferHelper.CreateStencilOp( cullMode ); + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleStencil , m_subShaderIdx , m_passIdx , value.Split( '\n' ) ); + } + + if( module.RenderingPlatforms.LoadedFromTemplate ) + { + m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleRenderPlatforms , m_subShaderIdx , m_passIdx , module.RenderingPlatforms.CreateResult( true ) ); + } + } + } + + public override string GenerateShaderForOutput( int outputId , ref MasterNodeDataCollector dataCollector , bool ignoreLocalvar ) + { + return "0"; + } + + public override void Destroy() + { + base.Destroy(); + + m_drawInstancedHelper = null; + + m_optionsDefineContainer.Destroy(); + m_optionsDefineContainer = null; + + m_passSelector.Destroy(); + m_passSelector = null; + + m_subShaderOptions.Destroy(); + m_passOptions.Destroy(); + + m_fallbackHelper.Destroy(); + GameObject.DestroyImmediate( m_fallbackHelper ); + m_fallbackHelper = null; + + m_usePass.Destroy(); + GameObject.DestroyImmediate( m_usePass ); + m_usePass = null; + + m_dependenciesHelper.Destroy(); + m_dependenciesHelper = null; + + m_subShaderModule.Destroy(); + m_subShaderModule = null; + m_passModule.Destroy(); + m_passModule = null; + if( m_lodIndex == -1 ) + { + ContainerGraph.MultiPassMasterNodes.RemoveNode( this ); + } + else + { + ContainerGraph.LodMultiPassMasternodes[ m_lodIndex ].RemoveNode( this ); + } + } + + void UpdateSubShaderPassStr() + { + //m_subShaderIdxStr = SubShaderModuleStr + m_templateMultiPass.SubShaders[ m_subShaderIdx ].Idx; + //m_passIdxStr = PassModuleStr + m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Idx; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + + base.ReadFromString( ref nodeParams ); + + string currShaderName = string.Empty; + try + { + currShaderName = GetCurrentParam( ref nodeParams ); + if ( currShaderName.Length > 0 ) + currShaderName = UIUtils.RemoveShaderInvalidCharacters( currShaderName ); + + m_templateGUID = GetCurrentParam( ref nodeParams ); + + bool hasUniqueName = false; + if( UIUtils.CurrentShaderVersion() > PASS_UNIQUE_ID_VERSION ) + { + hasUniqueName = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + + if( hasUniqueName ) + m_passUniqueId = GetCurrentParam( ref nodeParams ); + + m_subShaderIdx = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_passIdx = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + if( UIUtils.CurrentShaderVersion() > LOD_SUBSHADER_VERSION ) + { + + if( m_lodIndex != -1 ) + { + m_containerGraph.MultiPassMasterNodes.RemoveNode( this ); + m_containerGraph.LodMultiPassMasternodes[ m_lodIndex ].AddNode( this ); + } + } + + m_passName = GetCurrentParam( ref nodeParams ); + SetTemplate( null, false, true, m_subShaderIdx, m_passIdx, SetTemplateSource.ShaderLoad ); + } + catch ( Exception e ) + { + Debug.LogException( e, this ); + } + + if ( !m_invalidNode ) try + { + ////If value gotten from template is > -1 then it contains the LOD field + ////and we can properly write the value + //if( m_subShaderLOD > -1 ) + //{ + // m_subShaderLOD = subShaderLOD; + //} + + // only in here, after SetTemplate, we know if shader name is to be used as title or not + ShaderName = currShaderName; + m_visiblePorts = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + + m_subShaderModule.ReadFromString( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules, ref m_currentReadParamIdx, ref nodeParams ); + m_passModule.ReadFromString( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules, ref m_currentReadParamIdx, ref nodeParams ); + + if( UIUtils.CurrentShaderVersion() > 15308 ) + { + m_fallbackHelper.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + m_dependenciesHelper.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 15402 ) + { + m_usePass.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + + if( UIUtils.CurrentShaderVersion() > 15409 ) + { + m_hdSrpMaterialType = (HDSRPMaterialType)Enum.Parse( typeof( HDSRPMaterialType ) , GetCurrentParam( ref nodeParams ) ); + } + + if( UIUtils.CurrentShaderVersion() > 15501 ) + { + if( m_isMainOutputNode && UIUtils.CurrentShaderVersion() > PASS_SELECTOR_VERSION ) + m_subShaderOptions.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + + m_passOptions.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + + if( m_isMainOutputNode && UIUtils.CurrentShaderVersion() > PASS_SELECTOR_VERSION ) + { + m_passSelector.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); + + // @diogo: reset pass selector for any shader below version 19000 (when pass number was changed) + if ( UIUtils.CurrentShaderVersion() < 19000 ) + { + m_passSelector.Reset(); + } + } + + if( m_isMainOutputNode && UIUtils.CurrentShaderVersion() > 16203 ) + { + m_drawInstancedHelper.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + + if( m_isMainOutputNode && UIUtils.CurrentShaderVersion() > LOD_SUBSHADER_VERSION ) + { + m_mainLODName = GetCurrentParam( ref nodeParams ); + SetupLODNodeName(); + } + else + { + m_content.text = GenerateClippedTitle( m_passName ); + } + + if( UIUtils.CurrentShaderVersion() > 18302 ) + SamplingMacros = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + else + SamplingMacros = false; + + //if( m_templateMultiPass != null && !m_templateMultiPass.IsSinglePass ) + //{ + // SetClippedTitle( m_passName ); + //} + + CheckLegacyCustomInspectors(); + } + catch( Exception e ) + { + Debug.LogException( e , this ); + } + + m_containerGraph.CurrentCanvasMode = NodeAvailability.TemplateShader; + if ( m_isMainOutputNode ) + { + m_containerGraph.CurrentPrecision = m_currentPrecisionType; + } + } + + void CheckLegacyCustomInspectors() + { +#if UNITY_2021_2_OR_NEWER + if( m_templateMultiPass.SubShaders[ 0 ].Modules.SRPType == TemplateSRPType.HDRP && ASEPackageManagerHelper.CurrentHDRPBaseline >= ASESRPBaseline.ASE_SRP_11 ) + { + if( Constants.CustomInspectorHDLegacyTo11.ContainsKey( m_customInspectorName ) ) + { + UIUtils.ShowMessage( string.Format( "Detected obsolete custom inspector '{0}' in shader meta. Converting to new one '{1}'" , m_customInspectorName , Constants.CustomInspectorHDLegacyTo11[ m_customInspectorName ] ) , MessageSeverity.Warning ); + m_customInspectorName = Constants.CustomInspectorHDLegacyTo11[ m_customInspectorName ]; + } + } + + if( m_templateMultiPass.SubShaders[ 0 ].Modules.SRPType == TemplateSRPType.URP && ASEPackageManagerHelper.CurrentURPBaseline>= ASESRPBaseline.ASE_SRP_12 ) + { + if( Constants.CustomInspectorURP10To12.ContainsKey( m_customInspectorName ) ) + { + string newCustomInspector = string.Empty; + if( TemplatesManager.URPLitGUID.Equals( m_templateMultiPass.GUID )) + { + newCustomInspector = "UnityEditor.ShaderGraphLitGUI"; + } + else if( TemplatesManager.URPUnlitGUID.Equals( m_templateMultiPass.GUID ) ) + { + newCustomInspector = "UnityEditor.ShaderGraphUnlitGUI"; + } + + if( !string.IsNullOrEmpty( newCustomInspector ) ) + { + UIUtils.ShowMessage( string.Format( "Detected obsolete custom inspector '{0}' in shader meta. Converting to new one '{1}'" , m_customInspectorName , newCustomInspector ) , MessageSeverity.Warning ); + m_customInspectorName = newCustomInspector; + } + } + + } + +#elif UNITY_2021_1_OR_NEWER + if( m_templateMultiPass.SubShaders[ 0 ].Modules.SRPType == TemplateSRPType.HDRP && ASEPackageManagerHelper.CurrentHDRPBaseline >= ASESRPBaseline.ASE_SRP_11 ) + { + if( Constants.CustomInspectorHDLegacyTo11.ContainsKey( m_customInspectorName ) ) + { + UIUtils.ShowMessage( string.Format( "Detected obsolete custom inspector '{0}' in shader meta. Converting to new one '{1}'" , m_customInspectorName , Constants.CustomInspectorHDLegacyTo11[ m_customInspectorName ] ) , MessageSeverity.Warning ); + m_customInspectorName = Constants.CustomInspectorHDLegacyTo11[ m_customInspectorName ]; + } + } +#elif UNITY_2020_2_OR_NEWER + if( m_templateMultiPass.SubShaders[0].Modules.SRPType == TemplateSRPType.HDRP && ASEPackageManagerHelper.CurrentHDRPBaseline >= ASESRPBaseline.ASE_SRP_10 ) + { + if( Constants.CustomInspectorHD7To10.ContainsKey( m_customInspectorName ) ) + { + UIUtils.ShowMessage( string.Format("Detected obsolete custom inspector '{0}' in shader meta. Converting to new one '{1}'", m_customInspectorName , Constants.CustomInspectorHD7To10[ m_customInspectorName ] ), MessageSeverity.Warning ); + m_customInspectorName = Constants.CustomInspectorHD7To10[ m_customInspectorName ]; + } + } +#endif + } + + public override void WriteToString( ref string nodeInfo , ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo , ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo , ShaderName ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_templateGUID ); + + bool hasUniquePassName = Pass.Modules.HasPassUniqueName; + IOUtils.AddFieldValueToString( ref nodeInfo , hasUniquePassName ); + if( hasUniquePassName ) + { + IOUtils.AddFieldValueToString( ref nodeInfo , Pass.Modules.PassUniqueName ); + } + + IOUtils.AddFieldValueToString( ref nodeInfo , m_subShaderIdx ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_passIdx ); + + IOUtils.AddFieldValueToString( ref nodeInfo , m_passName ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_visiblePorts ); + m_subShaderModule.WriteToString( ref nodeInfo ); + m_passModule.WriteToString( ref nodeInfo ); + m_fallbackHelper.WriteToString( ref nodeInfo ); + m_dependenciesHelper.WriteToString( ref nodeInfo ); + m_usePass.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_hdSrpMaterialType ); + if( m_isMainOutputNode ) + m_subShaderOptions.WriteToString( ref nodeInfo ); + + m_passOptions.WriteToString( ref nodeInfo ); + + if( m_isMainOutputNode ) + { + m_passSelector.WriteToString( ref nodeInfo ); + m_drawInstancedHelper.WriteToString( ref nodeInfo ); + } + + if( m_isMainOutputNode ) + IOUtils.AddFieldValueToString( ref nodeInfo , m_mainLODName ); + + IOUtils.AddFieldValueToString( ref nodeInfo , m_samplingMacros ); + } + + public override void ReadFromDeprecated( ref string[] nodeParams , Type oldType = null ) + { + base.ReadFromString( ref nodeParams ); + try + { + string currShaderName = GetCurrentParam( ref nodeParams ); + if( currShaderName.Length > 0 ) + currShaderName = UIUtils.RemoveShaderInvalidCharacters( currShaderName ); + + string templateGUID = GetCurrentParam( ref nodeParams ); + string templateShaderName = string.Empty; + if( UIUtils.CurrentShaderVersion() > 13601 ) + { + templateShaderName = GetCurrentParam( ref nodeParams ); + } + + TemplateMultiPass template = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( templateGUID ) as TemplateMultiPass; + if( template != null ) + { + m_templateGUID = templateGUID; + SetTemplate( null , false , true , 0 , 0 , SetTemplateSource.ShaderLoad ); + } + else + { + template = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplateByName( templateShaderName ) as TemplateMultiPass; + if( template != null ) + { + m_templateGUID = template.GUID; + SetTemplate( null , false , true , 0 , 0 , SetTemplateSource.ShaderLoad ); + } + else + { + m_masterNodeCategory = -1; + } + } + + if( m_invalidNode ) + return; + + // only in here, after SetTemplate, we know if shader name is to be used as title or not + ShaderName = currShaderName; + if( UIUtils.CurrentShaderVersion() > 13902 ) + { + + //BLEND MODULE + if( m_templateMultiPass.SubShaders[ 0 ].Modules.BlendData.ValidBlendMode ) + { + m_subShaderModule.BlendOpHelper.ReadBlendModeFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.BlendData.ValidBlendMode ) + { + m_passModule.BlendOpHelper.ReadBlendModeFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + + if( m_templateMultiPass.SubShaders[ 0 ].Modules.BlendData.ValidBlendOp ) + { + m_subShaderModule.BlendOpHelper.ReadBlendOpFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.BlendData.ValidBlendOp ) + { + m_passModule.BlendOpHelper.ReadBlendOpFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + + + //CULL MODE + if( m_templateMultiPass.SubShaders[ 0 ].Modules.CullModeData.DataCheck == TemplateDataCheck.Valid ) + { + m_subShaderModule.CullModeHelper.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.CullModeData.DataCheck == TemplateDataCheck.Valid ) + { + m_passModule.CullModeHelper.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + + //COLOR MASK + if( m_templateMultiPass.SubShaders[ 0 ].Modules.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) + { + m_subShaderModule.ColorMaskHelper.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) + { + m_passModule.ColorMaskHelper.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + + //STENCIL BUFFER + if( m_templateMultiPass.SubShaders[ 0 ].Modules.StencilData.DataCheck == TemplateDataCheck.Valid ) + { + m_subShaderModule.StencilBufferHelper.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.StencilData.DataCheck == TemplateDataCheck.Valid ) + { + m_passModule.StencilBufferHelper.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + + } + + if( UIUtils.CurrentShaderVersion() > 14202 ) + { + //DEPTH OPTIONS + if( m_templateMultiPass.SubShaders[ 0 ].Modules.DepthData.ValidZWrite ) + { + m_subShaderModule.DepthOphelper.ReadZWriteFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.DepthData.ValidZWrite ) + { + m_passModule.DepthOphelper.ReadZWriteFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + + if( m_templateMultiPass.SubShaders[ 0 ].Modules.DepthData.ValidZTest ) + { + m_subShaderModule.DepthOphelper.ReadZTestFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.DepthData.ValidZTest ) + { + m_subShaderModule.DepthOphelper.ReadZTestFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + + if( m_templateMultiPass.SubShaders[ 0 ].Modules.DepthData.ValidOffset ) + { + m_subShaderModule.DepthOphelper.ReadOffsetFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.DepthData.ValidOffset ) + { + m_passModule.DepthOphelper.ReadOffsetFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + + } + + //TAGS + if( UIUtils.CurrentShaderVersion() > 14301 ) + { + if( m_templateMultiPass.SubShaders[ 0 ].Modules.TagData.DataCheck == TemplateDataCheck.Valid ) + { + m_subShaderModule.TagsHelper.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.TagData.DataCheck == TemplateDataCheck.Valid ) + { + m_passModule.TagsHelper.ReadFromString( ref m_currentReadParamIdx , ref nodeParams ); + } + } + + SamplingMacros = false; + } + catch( Exception e ) + { + Debug.LogException( e , this ); + } + m_containerGraph.CurrentCanvasMode = NodeAvailability.TemplateShader; + } + + public void ForceOptionsRefresh() + { + m_passOptions.Refresh(); + if( m_isMainOutputNode ) + m_subShaderOptions.Refresh(); + } + + public void SetPassVisible( string passName , bool visible ) + { + TemplateMultiPassMasterNode node = m_containerGraph.GetMasterNodeOfPass( passName , m_lodIndex ); + if( node != null ) + { + m_passSelector.SetPassVisible( passName , visible ); + node.IsInvisible = !visible; + } + + } + + public override void RefreshExternalReferences() + { + if( m_invalidNode ) + return; + + base.RefreshExternalReferences(); + if( IsLODMainMasterNode ) + { + SetMasterNodeCategoryFromGUID( m_templateGUID ); + } + + CheckTemplateChanges(); + if( m_templateMultiPass != null && m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.SRPIsPBRHD && UIUtils.CurrentShaderVersion() < 15410 ) + { + FetchHDPorts(); + m_hdSrpMaterialType = ( m_specularPort != null && m_specularPort.HasOwnOrLinkConnection ) ? HDSRPMaterialType.Specular : HDSRPMaterialType.Standard; + ConfigHDPorts(); + } + + if( ContainerGraph.HasLODs ) + { + SetClippedAdditionalTitle( string.Format( LodSubtitle , ShaderLOD ) ); + } + + if( m_isMainOutputNode ) + { + List masterNodes = ( m_lodIndex == -1 ) ? m_containerGraph.MultiPassMasterNodes.NodesList : m_containerGraph.LodMultiPassMasternodes[ m_lodIndex ].NodesList; + masterNodes.Sort( ( x , y ) => ( x.PassIdx.CompareTo( y.PassIdx ) ) ); + int passAmount = m_templateMultiPass.SubShaders[ m_subShaderIdx ].PassAmount; + if( passAmount != masterNodes.Count ) + { + UIUtils.ShowMessage( "Template master nodes amount was modified. Could not set correctly its visibility options." ); + } + else + { + for( int i = 0 ; i < passAmount ; i++ ) + { + if( i != m_passIdx ) + { + masterNodes[ i ].IsInvisible = !m_passSelector.IsVisible( i ); + } + } + } + } + } + + public override void ReadInputDataFromString( ref string[] nodeParams ) + { + if ( m_invalidNode ) + return; + + //For a Template Master Node an input port data must be set by its template and not meta data + if( UIUtils.CurrentShaderVersion() > 17007 ) + return; + + int count = 0; + if( UIUtils.CurrentShaderVersion() > 7003 ) + { + try + { + count = Convert.ToInt32( nodeParams[ m_currentReadParamIdx++ ] ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + else + { + count = ( m_oldInputCount < 0 ) ? m_inputPorts.Count : m_oldInputCount; + } + + for( int i = 0 ; i < count && i < nodeParams.Length && m_currentReadParamIdx < nodeParams.Length ; i++ ) + { + if( UIUtils.CurrentShaderVersion() < 5003 ) + { + int newId = VersionConvertInputPortId( i ); + if( UIUtils.CurrentShaderVersion() > 23 ) + { + m_currentReadParamIdx++; + } + + m_currentReadParamIdx++; + if( m_inputPorts[ newId ].IsEditable && UIUtils.CurrentShaderVersion() >= 3100 && m_currentReadParamIdx < nodeParams.Length ) + { + m_currentReadParamIdx++; + } + } + else + { + m_currentReadParamIdx++; + m_currentReadParamIdx++; + m_currentReadParamIdx++; + bool isEditable = Convert.ToBoolean( nodeParams[ m_currentReadParamIdx++ ] ); + if( isEditable && m_currentReadParamIdx < nodeParams.Length ) + { + m_currentReadParamIdx++; + } + } + } + } + + public override void ReadOutputDataFromString( ref string[] nodeParams ) + { + if ( m_invalidNode ) + return; + + base.ReadOutputDataFromString( ref nodeParams ); + } + + //For a Template Master Node an input port data must be set by its template and not meta data + public override void WriteInputDataToString( ref string nodeInfo ) { } + + public override float HeightEstimate + { + get + { + float heightEstimate = 0; + heightEstimate = 32 + Constants.INPUT_PORT_DELTA_Y; + if( m_templateMultiPass != null && !m_templateMultiPass.IsSinglePass ) + { + heightEstimate += 22; + } + float internalPortSize = 0; + for( int i = 0 ; i < InputPorts.Count ; i++ ) + { + if( InputPorts[ i ].Visible ) + internalPortSize += 18 + Constants.INPUT_PORT_DELTA_Y; + } + + return heightEstimate + Mathf.Max( internalPortSize , m_insideSize.y ); + } + } + + public HDSRPMaterialType CurrentHDMaterialType + { + get { return m_hdSrpMaterialType; } + set + { + m_hdSrpMaterialType = value; + if( m_isMainOutputNode ) + { + List mpNodes = ContainerGraph.MultiPassMasterNodes.NodesList; + int count = mpNodes.Count; + for( int i = 0 ; i < count ; i++ ) + { + if( mpNodes[ i ].UniqueId != UniqueId ) + { + mpNodes[ i ].CurrentHDMaterialType = value; + } + } + } + } + } + public TemplateSubShader SubShader { get { return m_templateMultiPass.SubShaders[ m_subShaderIdx ]; } } + public TemplatePass Pass { get { return m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ]; } } + public int SubShaderIdx { get { return m_subShaderIdx; } } + public int PassIdx { get { return m_passIdx; } } + public TemplateMultiPass CurrentTemplate { get { return m_templateMultiPass; } } + public TemplateModulesHelper SubShaderModule { get { return m_subShaderModule; } } + public TemplateModulesHelper PassModule { get { return m_passModule; } } + public string PassName { get { return m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].PassNameContainer.Data; } } + public string PassUniqueName + { + get + { + return string.IsNullOrEmpty( m_passUniqueId ) ? m_originalPassName : m_passUniqueId; + } + } + + public string OriginalPassName { get { return m_originalPassName; } } + public bool HasLinkPorts { get { return m_hasLinkPorts; } } + public bool IsInvisible + { + get + { + return m_isInvisible != InvisibilityStatus.Visible; + } + set + { + if( m_isInvisible != InvisibilityStatus.LockedInvisible && !m_isMainOutputNode ) + { + m_isInvisible = value ? InvisibilityStatus.Invisible : InvisibilityStatus.Visible; + if( value ) + { + for( int i = 0 ; i < m_inputPorts.Count ; i++ ) + { + m_inputPorts[ i ].FullDeleteConnections(); + } + } + } + } + } + + public TemplatePassSelectorHelper PassSelector { get { return m_passSelector; } } + public TemplateOptionsUIHelper PassOptions { get { return m_passOptions; } } + public TemplateOptionsUIHelper SubShaderOptions { get { return m_subShaderOptions; } } + public TemplateOptionsDefinesContainer OptionsDefineContainer { get { return m_optionsDefineContainer; } } + public TerrainDrawInstancedHelper DrawInstancedHelperInstance { get { return m_drawInstancedHelper; } } + public bool InvalidNode { get { return m_invalidNode; } } + public override void SetName( string name ) + { + ShaderName = name; + } + public bool IsLODMainFirstPass { get { return m_passIdx == 0 && m_lodIndex == -1; } } + public override AvailableShaderTypes CurrentMasterNodeCategory { get { return AvailableShaderTypes.Template; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs.meta new file mode 100644 index 00000000..264bab3a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: fce684c26c654d14e927860863cd99dd +timeCreated: 1517406883 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs new file mode 100644 index 00000000..e691573c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs @@ -0,0 +1,329 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + + [Serializable] + public class InputSwitchMPHelper + { + public int SubShaderIdx; + public int PassIdx; + public InputSwitchMPHelper( int subShaderIdx , int passIdx ) + { + SubShaderIdx = subShaderIdx; + PassIdx = passIdx; + } + } + + [Serializable] + [NodeAttributes( "Template Multi-Pass Switch" , "Logical Operators" , "Relays, in compile time, the correct input port according to current analyzed sub-shader/pass." )] + public sealed class TemplateMultiPassSwitchNode : TemplateNodeParent + { + private const string InputLabelStr = "SubShader {0} Pass {1}"; + + [SerializeField] + private List m_inputHelper = new List(); + + [SerializeField] + private int m_inputCountHelper = -1; + + protected override void CommonInit( int uniqueId ) + { + m_createAllOutputs = false; + base.CommonInit( uniqueId ); + } + + public override void OnInputPortConnected( int portId , int otherNodeId , int otherPortId , bool activateNode = true ) + { + base.OnInputPortConnected( portId , otherNodeId , otherPortId , activateNode ); + UpdateConnections(); + } + + public override void OnConnectedOutputNodeChanges( int inputPortId , int otherNodeId , int otherPortId , string name , WirePortDataType type ) + { + base.OnConnectedOutputNodeChanges( inputPortId , otherNodeId , otherPortId , name , type ); + UpdateConnections(); + } + + public override void OnInputPortDisconnected( int portId ) + { + base.OnInputPortDisconnected( portId ); + UpdateConnections(); + } + + private void UpdateConnections() + { + WirePortDataType mainType = WirePortDataType.FLOAT; + + int highest = UIUtils.GetPriority( mainType ); + for( int i = 0 ; i < m_inputPorts.Count ; i++ ) + { + if( m_inputPorts[ i ].IsConnected ) + { + WirePortDataType portType = m_inputPorts[ i ].GetOutputConnection().DataType; + if( UIUtils.GetPriority( portType ) > highest ) + { + mainType = portType; + highest = UIUtils.GetPriority( portType ); + } + } + } + + for( int i = 0 ; i < m_inputPorts.Count ; i++ ) + { + m_inputPorts[ i ].ChangeType( mainType , false ); + } + + m_outputPorts[ 0 ].ChangeType( mainType , false ); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + + if( m_templateMPData == null ) + { + FetchMultiPassTemplate(); + if( m_inputPorts.Count != m_inputCountHelper ) + { + CreateInputPorts(); + } + else + { + RefreshInputPorts(); + } + } + } + + + public void RefreshInputPorts() + { + if( m_multiPassMode ) + { + m_inputHelper.Clear(); + if( m_templateMPData != null ) + { + int index = 0; + int subShaderCount = m_templateMPData.SubShaders.Count; + for( int subShaderIdx = 0 ; subShaderIdx < subShaderCount ; subShaderIdx++ ) + { + int passCount = m_templateMPData.SubShaders[ subShaderIdx ].Passes.Count; + for( int passIdx = 0 ; passIdx < passCount ; passIdx++ ) + { + if( m_templateMPData.SubShaders[ subShaderIdx ].Passes[ passIdx ].HasValidFunctionBody ) + { + m_inputPorts[ index ].Name = string.Format( InputLabelStr , subShaderIdx , passIdx ); + m_inputHelper.Add( new InputSwitchMPHelper( subShaderIdx , passIdx ) ); + index += 1; + } + } + } + } + } + else + { + m_inputPorts[ 0 ].Name = "In"; + } + } + + public int RefreshInputCountHelper() + { + int inputCountHelper = 0; + if( m_multiPassMode ) + { + if( m_templateMPData != null ) + { + int subShaderCount = m_templateMPData.SubShaders.Count; + for( int subShaderIdx = 0 ; subShaderIdx < subShaderCount ; subShaderIdx++ ) + { + int passCount = m_templateMPData.SubShaders[ subShaderIdx ].Passes.Count; + for( int passIdx = 0 ; passIdx < passCount ; passIdx++ ) + { + if( m_templateMPData.SubShaders[ subShaderIdx ].Passes[ passIdx ].HasValidFunctionBody ) + inputCountHelper += 1; + } + } + } + } + else + { + inputCountHelper += 1; + } + return inputCountHelper; + } + + public void CreateInputPorts() + { + m_inputCountHelper = 0; + DeleteAllInputConnections( true ); + if( m_multiPassMode ) + { + m_inputHelper.Clear(); + if( m_templateMPData != null ) + { + int subShaderCount = m_templateMPData.SubShaders.Count; + for( int subShaderIdx = 0 ; subShaderIdx < subShaderCount ; subShaderIdx++ ) + { + int passCount = m_templateMPData.SubShaders[ subShaderIdx ].Passes.Count; + for( int passIdx = 0 ; passIdx < passCount ; passIdx++ ) + { + if( m_templateMPData.SubShaders[ subShaderIdx ].Passes[ passIdx ].HasValidFunctionBody ) + { + AddInputPort( WirePortDataType.FLOAT , false , string.Format( InputLabelStr , subShaderIdx , passIdx ) ); + m_inputHelper.Add( new InputSwitchMPHelper( subShaderIdx , passIdx ) ); + m_inputCountHelper += 1; + } + } + } + } + } + else + { + AddInputPort( WirePortDataType.FLOAT , false , "In" ); + m_inputCountHelper += 1; + } + } + + public override string GenerateShaderForOutput( int outputId , ref MasterNodeDataCollector dataCollector , bool ignoreLocalvar ) + { + if( dataCollector.MasterNodeCategory != AvailableShaderTypes.Template ) + { + UIUtils.ShowMessage( "Template Multi-Pass Switch Data node is only intended for templates use only" , MessageSeverity.Error ); + return m_outputPorts[ 0 ].ErrorValue; + } + + int currSubShaderIdx = dataCollector.TemplateDataCollectorInstance.MultipassSubshaderIdx; + int currPassIdx = dataCollector.TemplateDataCollectorInstance.MultipassPassIdx; + + int inputHelperCount = m_inputHelper.Count; + for( int i = 0 ; i < inputHelperCount ; i++ ) + { + if( m_inputHelper[ i ].SubShaderIdx == currSubShaderIdx && m_inputHelper[ i ].PassIdx == currPassIdx ) + return m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); + } + + UIUtils.ShowMessage( "Invalid subshader or pass on Template Multi-Pass Switch Data" ); + return m_outputPorts[ 0 ].ErrorValue; + } + + public override void OnMasterNodeReplaced( MasterNode newMasterNode ) + { + base.OnMasterNodeReplaced( newMasterNode ); + m_autoWrapProperties = false; + if( newMasterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template ) + { + FetchMultiPassTemplate( newMasterNode ); + m_inputCountHelper = RefreshInputCountHelper(); + if( m_inputPorts.Count != m_inputCountHelper ) + { + CreateInputPorts(); + } + else + { + RefreshInputPorts(); + } + } + else + { + DeleteAllInputConnections( true ); + } + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_inputCountHelper = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + // Need to add ports here so read internal data is correct + for( int i = 0 ; i < m_inputCountHelper ; i++ ) + { + AddInputPort( WirePortDataType.FLOAT , false , Constants.EmptyPortValue ); + } + } + + public override void WriteToString( ref string nodeInfo , ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo , ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_inputCountHelper ); + } + + public override void Destroy() + { + base.Destroy(); + m_inputHelper.Clear(); + m_inputHelper = null; + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + FetchMultiPassTemplate(); + + bool create = false; + if( m_inputCountHelper == -1 ) + { + create = true; + } + else + { + int newInputCount = RefreshInputCountHelper(); + if( newInputCount != m_inputCountHelper ) + { + create = true; + } + } + + + if( m_multiPassMode ) + { + if( m_templateMPData != null ) + { + if( create ) + { + CreateInputPorts(); + } + else + { + m_inputHelper.Clear(); + int index = 0; + int subShaderCount = m_templateMPData.SubShaders.Count; + for( int subShaderIdx = 0 ; subShaderIdx < subShaderCount ; subShaderIdx++ ) + { + int passCount = m_templateMPData.SubShaders[ subShaderIdx ].Passes.Count; + for( int passIdx = 0 ; passIdx < passCount ; passIdx++ ) + { + if( m_templateMPData.SubShaders[ subShaderIdx ].Passes[ passIdx ].HasValidFunctionBody ) + { + m_inputPorts[ index ].Name = string.Format( InputLabelStr , subShaderIdx , passIdx ); + m_inputHelper.Add( new InputSwitchMPHelper( subShaderIdx , passIdx ) ); + index += 1; + } + } + } + + if( index != m_inputCountHelper ) + { + Debug.LogWarning( "Something wrong occured in reading MultiPass Switch node" ); + } + } + } + } + else + { + if( create ) + { + AddInputPort( WirePortDataType.FLOAT , false , "In" ); + } + else + { + m_inputPorts[ 0 ].Name = "In"; + } + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs.meta new file mode 100644 index 00000000..c42de305 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 58e4eb5fc3fed124384eef956c6c3ee1 +timeCreated: 1519319737 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs new file mode 100644 index 00000000..8f7da4a5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs @@ -0,0 +1,303 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateNodeParent : ParentNode + { + protected const string ErrorMessageStr = "This node cannot be used with Surface Shaders or Shader Functions.\n\nPlease change your Shader Type to a compatible template, such as Legacy, URP, HDRP or other."; + protected const string DataLabelStr = "Data"; + protected const string SubShaderStr = "SubShader"; + protected const string PassStr = "Pass"; + + [SerializeField] + private int m_subShaderIdx = 0; + + [SerializeField] + private int m_passIdx = 0; + + [SerializeField] + private int m_passLocalArrayIdx = 0; + + [SerializeField] + protected bool m_multiPassMode = false; + + [SerializeField] + protected string[] m_availableSubshaders; + + [SerializeField] + protected string[] m_availablePassesLabels; + + [SerializeField] + protected int[] m_availablePassesValues; + + [NonSerialized] + protected TemplateMultiPass m_templateMPData = null; + protected bool m_createAllOutputs = true; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + AddOutputPort( WirePortDataType.FLOAT , "Out" ); + if( m_createAllOutputs ) + { + AddOutputPort( WirePortDataType.FLOAT , "X" ); + AddOutputPort( WirePortDataType.FLOAT , "Y" ); + AddOutputPort( WirePortDataType.FLOAT , "Z" ); + AddOutputPort( WirePortDataType.FLOAT , "W" ); + } + m_textLabelWidth = 67; + m_hasLeftDropdown = true; + m_errorMessageTooltip = ErrorMessageStr; + } + + public override void AfterCommonInit() + { + base.AfterCommonInit(); + + if( PaddingTitleLeft == 0 ) + { + PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + if( PaddingTitleRight == 0 ) + PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + } + } + + protected void ConfigurePorts() + { + switch( m_outputPorts[ 0 ].DataType ) + { + default: + { + for( int i = 1 ; i < 5 ; i++ ) + { + m_outputPorts[ i ].Visible = false; + } + } + break; + case WirePortDataType.FLOAT2: + { + for( int i = 1 ; i < 5 ; i++ ) + { + m_outputPorts[ i ].Visible = ( i < 3 ); + if( m_outputPorts[ i ].Visible ) + { + m_outputPorts[ i ].Name = Constants.ChannelNamesVector[ i - 1 ]; + } + } + } + break; + case WirePortDataType.FLOAT3: + { + for( int i = 1 ; i < 5 ; i++ ) + { + m_outputPorts[ i ].Visible = ( i < 4 ); + if( m_outputPorts[ i ].Visible ) + { + m_outputPorts[ i ].Name = Constants.ChannelNamesVector[ i - 1 ]; + } + } + } + break; + case WirePortDataType.FLOAT4: + { + for( int i = 1 ; i < 5 ; i++ ) + { + m_outputPorts[ i ].Visible = true; + m_outputPorts[ i ].Name = Constants.ChannelNamesVector[ i - 1 ]; + } + } + break; + case WirePortDataType.COLOR: + { + for( int i = 1 ; i < 5 ; i++ ) + { + m_outputPorts[ i ].Visible = true; + m_outputPorts[ i ].Name = Constants.ChannelNamesColor[ i - 1 ]; + } + } + break; + } + m_sizeIsDirty = true; + } + + protected virtual void OnSubShaderChange() { } + protected virtual void OnPassChange() { } + + protected void DrawSubShaderUI() + { + EditorGUI.BeginChangeCheck(); + m_subShaderIdx = EditorGUILayoutPopup( SubShaderStr , m_subShaderIdx , m_availableSubshaders ); + if( EditorGUI.EndChangeCheck() ) + { + //UpdateSubShaderAmount(); + UpdatePassAmount(); + OnSubShaderChange(); + } + } + + protected void DrawPassUI() + { + EditorGUI.BeginChangeCheck(); + m_passLocalArrayIdx = EditorGUILayoutPopup( PassStr , m_passLocalArrayIdx , m_availablePassesLabels ); + if( EditorGUI.EndChangeCheck() ) + { + m_passIdx = m_availablePassesValues[ m_passLocalArrayIdx ]; + //UpdatePassAmount(); + OnPassChange(); + } + } + + virtual protected void CheckWarningState() + { + if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) + { + ShowTab( NodeMessageType.Error , ErrorMessageStr ); + } + else + { + m_showErrorMessage = false; + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + if ( m_showErrorMessage ) + { + EditorGUILayout.HelpBox( ErrorMessageStr, MessageType.Error ); + return; + } + } + + public override void OnNodeLogicUpdate( DrawInfo drawInfo ) + { + base.OnNodeLogicUpdate( drawInfo ); + m_showErrorMessage = ( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ); + } + + protected void FetchMultiPassTemplate( MasterNode masterNode = null ) + { + m_multiPassMode = m_containerGraph.MultiPassMasterNodes.NodesList.Count > 0; + if( m_multiPassMode ) + { + m_templateMPData = ( ( ( masterNode == null ) ? m_containerGraph.CurrentMasterNode : masterNode ) as TemplateMultiPassMasterNode ).CurrentTemplate; + if( m_templateMPData != null ) + { + UpdateSubShaderAmount(); + } + } + } + + protected void UpdateSubShaderAmount() + { + if( m_templateMPData == null ) + m_templateMPData = ( m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode ).CurrentTemplate; + + if( m_templateMPData != null ) + { + int subShaderCount = m_templateMPData.SubShaders.Count; + if( m_availableSubshaders == null || subShaderCount != m_availableSubshaders.Length ) + { + m_availableSubshaders = new string[ subShaderCount ]; + for( int i = 0 ; i < subShaderCount ; i++ ) + { + m_availableSubshaders[ i ] = i.ToString(); + } + } + m_subShaderIdx = Mathf.Min( m_subShaderIdx , subShaderCount - 1 ); + UpdatePassAmount(); + } + } + protected virtual bool ValidatePass( int passIdx ) { return true; } + protected void UpdatePassAmount() + { + if( !m_multiPassMode ) + return; + + if( m_templateMPData == null ) + m_templateMPData = ( m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode ).CurrentTemplate; + + List passLabels = new List(); + List passValues = new List(); + int minPassIdx = int.MaxValue; + int passCount = m_templateMPData.SubShaders[ m_subShaderIdx ].Passes.Count; + bool resetPassIdx = true; + for( int i = 0 ; i < passCount ; i++ ) + { + if( ValidatePass( i ) ) + { + passLabels.Add( i.ToString() ); + passValues.Add( i ); + minPassIdx = Mathf.Min( minPassIdx , i ); + if( m_passIdx == i ) + resetPassIdx = false; + } + } + m_availablePassesLabels = passLabels.ToArray(); + m_availablePassesValues = passValues.ToArray(); + if( resetPassIdx ) + m_passIdx = minPassIdx; + + RefreshPassLocalArrayIdx(); + } + + void RefreshPassLocalArrayIdx() + { + for( int i = 0 ; i < m_availablePassesValues.Length ; i++ ) + { + if( m_availablePassesValues[ i ] == m_passIdx ) + { + m_passLocalArrayIdx = i; + } + } + } + + public override void Destroy() + { + base.Destroy(); + m_templateMPData = null; + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) + { + m_subShaderIdx = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + m_passIdx = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo , ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo , ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_subShaderIdx ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_passIdx ); + } + + public override void OnMasterNodeReplaced( MasterNode newMasterNode ) + { + base.OnMasterNodeReplaced( newMasterNode ); + if( newMasterNode.CurrentMasterNodeCategory == AvailableShaderTypes.SurfaceShader ) + { + m_content.text = m_nodeAttribs.Name; + m_autoWrapProperties = false; + } + else + { + m_autoWrapProperties = true; + } + CheckWarningState(); + + } + public int SubShaderIdx { get { return m_subShaderIdx; } set { m_subShaderIdx = value; } } + public int PassIdx { get { return m_passIdx; } set { m_passIdx = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs.meta new file mode 100644 index 00000000..db007130 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b21cb297a12ef0a4281213619e3e76bf +timeCreated: 1519235586 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs new file mode 100644 index 00000000..763d824a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs @@ -0,0 +1,1233 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Text.RegularExpressions; +using System.Collections.Generic; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + /*ase_pass_options OLDEST + DefineOnConnected:portId:definevalue + DefineOnUnconnected:portId:definevalue + Options:name:defaultOption:opt0:opt1:opt2 + SetVisible:PortId:OptionName:OptionValue + */ + + /*ase_pass_options OLD + Option:Option Name:UI Type:Default:Item0,Item1,Item3...ItemN + Action:Action Type:Action Data:ConditionA && ConditionB || ConditionC: + */ + + /*ase_pass_options:UniqueId:PropagateDataToHiddenPasses + Option:Color Offset:A,B,C:A + A:ShowPort:My Port Name + B,C:HidePort:My Port Name + B:SetDefine:MY_DEFINE + C:SetDefine:MY_COLOR_DEFINE + Option:My Other Option:True,False + True:ShowOption:Color Offset + False:HideOption:Color Offset + Port:My Port Name + On:SetDefine:MY_COLOR_DEFINE + Off:UnsetDefine:MY_COLOR_DEFINE + */ + public enum AseOptionsUIWidget + { + Dropdown, + Toggle, + Float, + FloatRange, + Int, + IntRange + } + + public enum AseOptionsType + { + Option, + Port, + Field + } + + + public enum AseOptionItemSetup + { + None, + InvertActionOnDeselection + } + + public enum AseOptionsActionType + { + RefreshOption, + ShowOption, + HideOption, + SetOption, + HidePort, + ShowPort, + SetPortName, + SetDefine, + RemoveDefine, + SetUndefine, + RemoveUndefine, + ExcludePass, + IncludePass, + SetPropertyOnPass, + SetPropertyOnSubShader, + SetShaderProperty, + SetMaterialProperty, + ExcludeAllPassesBut + } + + public enum PropertyActionsEnum + { + CullMode, + ColorMask, + ColorMask1, + ColorMask2, + ColorMask3, + ZWrite, + ZTest, + ZOffsetFactor, + ZOffsetUnits, + BlendRGB, + BlendAlpha, + BlendOpRGB, + BlendOpAlpha, + BlendRGB1, + BlendAlpha1, + BlendOpRGB1, + BlendOpAlpha1, + BlendRGB2, + BlendAlpha2, + BlendOpRGB2, + BlendOpAlpha2, + BlendRGB3, + BlendAlpha3, + BlendOpRGB3, + BlendOpAlpha3, + StencilReference, + StencilReadMask, + StencilWriteMask, + StencilComparison, + StencilPass, + StencilFail, + StencilZFail, + RenderType, + RenderQueue, + DisableBatching, + ChangeTagValue + } + + public enum AseOptionsSetup + { + CopyOptionsFromMainPass, + Id, + Name + } + + [Serializable] + public class ItemColorMask + { + public bool ValueR = true; + public bool ValueG = true; + public bool ValueB = true; + public bool ValueA = true; + + public bool MaskR = false; + public bool MaskG = false; + public bool MaskB = false; + public bool MaskA = false; + + public bool[] GetColorMask( bool[] input ) + { + bool[] result = { ValueR, ValueG, ValueB, ValueA }; + result[ 0 ] = MaskR ? ValueR : input[ 0 ]; + result[ 1 ] = MaskG ? ValueG : input[ 1 ]; + result[ 2 ] = MaskB ? ValueB : input[ 2 ]; + result[ 3 ] = MaskA ? ValueA : input[ 3 ]; + return result; + } + + public void SetColorMask( int index, string value ) + { + switch( index ) + { + default: + case 0: + { + MaskR = !string.IsNullOrEmpty( value ); + if(MaskR) + ValueR = Convert.ToBoolean( value ); + } + break; + case 1: + { + MaskG = !string.IsNullOrEmpty( value ); + if( MaskG ) + ValueG = Convert.ToBoolean( value ); + } + break; + case 2: + { + MaskB = !string.IsNullOrEmpty( value ); + if( MaskB ) + ValueB = Convert.ToBoolean( value ); + } + break; + case 3: + { + MaskA = !string.IsNullOrEmpty( value ); + if( MaskA ) + ValueA = Convert.ToBoolean( value ); + } + break; + } + } + } + + [Serializable] + public class TemplateActionItemConditional + { + public enum Conditional + { + None, + Equal, + NotEqual + } + + public Conditional Condition = Conditional.None; + public string Option = null; + public string Value = null; + + public bool IsValid => ( Condition != Conditional.None ); + + public TemplateActionItemConditional( string condition, string option, string value ) + { + Condition = condition.Equals( "=" ) ? Conditional.Equal : Conditional.NotEqual; + Option = option; + Value = value; + } + } + + [Serializable] + public class TemplateActionItem + { + public TemplateActionItemConditional ActionConditional = null; + + public AseOptionsActionType ActionType; + public string ActionData = string.Empty; + public string ActionData2 = string.Empty; + public int ActionDataIdx = -1; + + public string PassName; + public bool AllPasses = false; + + public PropertyActionsEnum PropertyAction; + //CULL + public CullMode ActionCullMode; + //COLOR MASK + public ItemColorMask ColorMask = new ItemColorMask(); + public ItemColorMask ColorMask1 = new ItemColorMask(); + public ItemColorMask ColorMask2 = new ItemColorMask(); + public ItemColorMask ColorMask3 = new ItemColorMask(); + + //DEPTH + public ZWriteMode ActionZWrite; + public ZTestMode ActionZTest; + public float ActionZOffsetFactor; + public float ActionZOffsetUnits; + + //BLEND OPS + public AvailableBlendFactor ActionBlendRGBSource; + public AvailableBlendFactor ActionBlendRGBDest; + public AvailableBlendFactor ActionBlendAlphaSource; + public AvailableBlendFactor ActionBlendAlphaDest; + public AvailableBlendOps ActionBlendOpRGB; + public AvailableBlendOps ActionBlendOpAlpha; + + public AvailableBlendFactor ActionBlendRGBSource1; + public AvailableBlendFactor ActionBlendRGBDest1; + public AvailableBlendFactor ActionBlendAlphaSource1; + public AvailableBlendFactor ActionBlendAlphaDest1; + public AvailableBlendOps ActionBlendOpRGB1; + public AvailableBlendOps ActionBlendOpAlpha1; + + public AvailableBlendFactor ActionBlendRGBSource2; + public AvailableBlendFactor ActionBlendRGBDest2; + public AvailableBlendFactor ActionBlendAlphaSource2; + public AvailableBlendFactor ActionBlendAlphaDest2; + public AvailableBlendOps ActionBlendOpRGB2; + public AvailableBlendOps ActionBlendOpAlpha2; + + public AvailableBlendFactor ActionBlendRGBSource3; + public AvailableBlendFactor ActionBlendRGBDest3; + public AvailableBlendFactor ActionBlendAlphaSource3; + public AvailableBlendFactor ActionBlendAlphaDest3; + public AvailableBlendOps ActionBlendOpRGB3; + public AvailableBlendOps ActionBlendOpAlpha3; + + //STENCIL + public int ActionStencilReference; + public int ActionStencilReadMask; + public int ActionStencilWriteMask; + public int ActionStencilComparison; + public int ActionStencilPass; + public int ActionStencilFail; + public int ActionStencilZFail; + + public bool CopyFromSubShader = false; + + public string ActionBuffer; + public override string ToString() + { + return ActionType + " " + ActionData + " " + ActionDataIdx; + } + + public bool GetIntValueFromActionBuffer( out int result ) + { + return int.TryParse( ActionBuffer, out result ); + } + + public bool GetFloatValueFromActionBuffer( out float result ) + { + return float.TryParse( ActionBuffer, out result ); + } + } + + [Serializable] + public class TemplateActionItemGrid + { + [Serializable] + public class TemplateActionItemRow + { + public TemplateActionItem[] Columns; + } + + public TemplateActionItemRow[] Rows; + + public TemplateActionItemGrid( int rowsCount ) + { + Rows = new TemplateActionItemRow[ rowsCount ]; + } + + public TemplateActionItem this[ int row, int column ] + { + get { return Rows[ row ].Columns[ column ]; } + set { Rows[ row ].Columns[ column ] = value; } + } + + public TemplateActionItem[] this[ int row ] + { + get { return Rows[ row ].Columns; } + + set + { + if( Rows[ row ] == null ) + Rows[ row ] = new TemplateActionItemRow(); + + Rows[ row ].Columns = value; + } + } + } + + [Serializable] + public class TemplateOptionsItem + { + public AseOptionsType Type; + public AseOptionsUIWidget UIWidget; + public AseOptionItemSetup Setup = AseOptionItemSetup.None; + + public string Id = string.Empty; + public string Name = string.Empty; + public string DefaultOption = string.Empty; + public string[] Options = null; + public string[] DisplayOptions = null; + public int DisableIdx = -1; + + [SerializeField] + private float m_defaultFieldValue; + + public float FieldMin; + public float FieldMax; + + public bool FieldInline; + public string FieldInlineName; + public string FieldInlineOutput = string.Empty; + + [SerializeField] + public InlineProperty FieldValue = new InlineProperty(); + + public TemplateActionItemGrid ActionsPerOption = null; + + public int Count = 0; + + [SerializeField] + private int m_defaultOptionIndex = -1; + + ~TemplateOptionsItem() + { + Options = null; + } + + public int OptionIndexFor( string option ) + { + for( int i = 0; i < Options.Length; i++ ) + { + if( Options[ i ].Equals( option ) ) + { + return i; + } + } + Debug.LogWarning( "Couldn't find index for option: " + option ); + return 0; + } + + public int DefaultOptionIndex + { + get + { + if( m_defaultOptionIndex > -1 ) + return m_defaultOptionIndex; + + for( int i = 0; i < Options.Length; i++ ) + { + if( Options[ i ].Equals( DefaultOption ) ) + { + m_defaultOptionIndex = i; + return i; + } + } + Debug.LogWarning( "Couldn't find index for default option: " + DefaultOption ); + return 0; + } + } + + public float DefaultFieldValue + { + get + { + return m_defaultFieldValue; + } + set + { + m_defaultFieldValue = value; + } + } + } + + [Serializable] + public class TemplateOptionsContainer + { + public bool Enabled = false; + public string Body = string.Empty; + public int Index = -1; + public int Id = -1; + public string Name = string.Empty; + public bool CopyOptionsFromMainPass = false; + public TemplateOptionsItem[] Options = null; + ~TemplateOptionsContainer() + { + Options = null; + } + + public void CopyPortOptionsFrom( TemplateOptionsContainer container, string passName ) + { + if( container == null || container.Options == null ) + return; + + List newItems = new List(); + for( int i = 0; i < container.Options.Length; i++ ) + { + if( container.Options[ i ].Type == AseOptionsType.Port && + container.Options[ i ].Id.Equals( passName ) ) + { + newItems.Add( container.Options[ i ] ); + } + } + + if( newItems.Count > 0 ) + { + Enabled = true; + if( Options == null ) + { + Options = newItems.ToArray(); + } + else + { + Array.Resize( ref Options, Options.Length + newItems.Count ); + Array.Copy( newItems.ToArray(), Options, newItems.Count ); + } + } + newItems.Clear(); + newItems = null; + } + + public int EndIndex { get { return Index + Body.Length; } } + } + + public class TemplateOptionsToolsHelper + { + //public const string PassOptionsMainPattern = @"\/\*ase_pass_options:([\w:= ]*)[\n]([\w: \t;\n&|,_\+-]*)\*\/"; + //public const string SubShaderOptionsMainPattern = @"\/\*ase_subshader_options:([\w:= ]*)[\n]([\w: \t;\n&|,_\+-]*)\*\/"; + public const string PassOptionsMainPattern = "\\/\\*ase_pass_options:([\\w:= ]*)[\n]([\\w: \t;\n&|,_\\+\\-\\(\\)\\[\\]\\\"\\=\\/\\.]*)\\*\\/"; + public const string SubShaderOptionsMainPattern = "\\/\\*ase_subshader_options:([\\w:= ]*)[\n]([\\w: \t?!;\n&|,_\\+\\-\\(\\)\\[\\]\\\"\\=\\/\\.]*)\\*\\/"; + public static readonly char OptionsDataSeparator = ','; + public static Dictionary AseOptionsSetupDict = new Dictionary() + { + { "CopyOptionsFromMainPass",AseOptionsSetup.CopyOptionsFromMainPass}, + { "Id",AseOptionsSetup.Id}, + { "Name",AseOptionsSetup.Name}, + }; + + public static Dictionary AseOptionsUITypeDict = new Dictionary() + { + { "Dropdown",AseOptionsUIWidget.Dropdown }, + { "Toggle", AseOptionsUIWidget.Toggle } + }; + + public static Dictionary AseOptionsActionTypeDict = new Dictionary() + { + {"RefreshOption", AseOptionsActionType.RefreshOption }, + {"ShowOption", AseOptionsActionType.ShowOption }, + {"HideOption", AseOptionsActionType.HideOption }, + {"SetOption", AseOptionsActionType.SetOption }, + {"HidePort", AseOptionsActionType.HidePort }, + {"ShowPort", AseOptionsActionType.ShowPort }, + {"SetPortName", AseOptionsActionType.SetPortName }, + {"SetDefine", AseOptionsActionType.SetDefine }, + {"RemoveDefine", AseOptionsActionType.RemoveDefine }, + {"SetUndefine", AseOptionsActionType.SetUndefine }, + {"RemoveUndefine", AseOptionsActionType.RemoveUndefine }, + {"ExcludePass", AseOptionsActionType.ExcludePass }, + {"IncludePass", AseOptionsActionType.IncludePass }, + {"SetPropertyOnPass", AseOptionsActionType.SetPropertyOnPass }, + {"SetPropertyOnSubShader", AseOptionsActionType.SetPropertyOnSubShader }, + {"SetShaderProperty", AseOptionsActionType.SetShaderProperty }, + {"SetMaterialProperty", AseOptionsActionType.SetMaterialProperty }, + {"ExcludeAllPassesBut",AseOptionsActionType.ExcludeAllPassesBut} + }; + + public static Dictionary AseOptionItemSetupDict = new Dictionary + { + {"None", AseOptionItemSetup.None }, + { "InvertActionOnDeselection", AseOptionItemSetup.InvertActionOnDeselection} + }; + + public static bool InvertAction( AseOptionsActionType original, ref AseOptionsActionType inverted ) + { + bool success = true; + switch( original ) + { + case AseOptionsActionType.RefreshOption: + inverted = AseOptionsActionType.RefreshOption; + break; + case AseOptionsActionType.ShowOption: + inverted = AseOptionsActionType.HideOption; + break; + case AseOptionsActionType.HideOption: + inverted = AseOptionsActionType.ShowOption; + break; + case AseOptionsActionType.HidePort: + inverted = AseOptionsActionType.ShowPort; + break; + case AseOptionsActionType.ShowPort: + inverted = AseOptionsActionType.HidePort; + break; + case AseOptionsActionType.SetDefine: + inverted = AseOptionsActionType.RemoveDefine; + break; + case AseOptionsActionType.RemoveDefine: + inverted = AseOptionsActionType.SetDefine; + break; + case AseOptionsActionType.SetUndefine: + inverted = AseOptionsActionType.RemoveUndefine; + break; + case AseOptionsActionType.RemoveUndefine: + inverted = AseOptionsActionType.SetUndefine; + break; + case AseOptionsActionType.ExcludePass: + inverted = AseOptionsActionType.IncludePass; + break; + case AseOptionsActionType.IncludePass: + inverted = AseOptionsActionType.ExcludePass; + break; + case AseOptionsActionType.SetPortName: + case AseOptionsActionType.SetOption: + case AseOptionsActionType.SetPropertyOnPass: + case AseOptionsActionType.SetPropertyOnSubShader: + success = false; + break; + } + return success; + } + + + public static TemplateOptionsContainer GenerateOptionsContainer( bool isSubShader, string data ) + { + TemplateOptionsContainer optionsContainer = new TemplateOptionsContainer(); + + Match match = Regex.Match( data, isSubShader ? SubShaderOptionsMainPattern : PassOptionsMainPattern ); + optionsContainer.Enabled = match.Success; + if( match.Success ) + { + try + { + optionsContainer.Body = match.Value; + optionsContainer.Index = match.Index; + + List optionItemsList = new List(); + List> actionItemsList = new List>(); + Dictionary optionItemToIndex = new Dictionary(); + TemplateOptionsItem currentOption = null; + + //OPTIONS OVERALL SETUP + string[] setupLines = match.Groups[ 1 ].Value.Split( ':' ); + for( int i = 0; i < setupLines.Length; i++ ) + { + if( AseOptionsSetupDict.ContainsKey( setupLines[ i ] ) ) + { + AseOptionsSetup setup = AseOptionsSetupDict[ setupLines[ i ] ]; + switch( setup ) + { + case AseOptionsSetup.CopyOptionsFromMainPass: optionsContainer.CopyOptionsFromMainPass = true; break; + } + } + else + { + string[] args = setupLines[ i ].Split( '=' ); + if( args.Length > 1 && AseOptionsSetupDict.ContainsKey( args[ 0 ] ) ) + { + AseOptionsSetup setup = AseOptionsSetupDict[ args[ 0 ] ]; + switch( setup ) + { + case AseOptionsSetup.Id: if( !int.TryParse( args[ 1 ], out optionsContainer.Id ) ) optionsContainer.Id = -1; break; + case AseOptionsSetup.Name: optionsContainer.Name = args[ 1 ]; break; + } + } + } + } + + //AVAILABLE OPTIONS + string body = match.Groups[ 2 ].Value.Replace( "\t", string.Empty ); + string[] optionLines = body.Split( '\n' ); + for( int oL = 0; oL < optionLines.Length; oL++ ) + { + string[] optionItems = optionLines[ oL ].Split( ':' ); + if( optionItems.Length > 0 ) + { + string[] itemIds = optionItems[ 0 ].Split( OptionsDataSeparator ); + switch( itemIds[ 0 ] ) + { + case "Option": + { + //Fills previous option with its actions + //actionItemsList is cleared over here + FillOptionAction( currentOption, ref actionItemsList ); + + optionItemToIndex.Clear(); + currentOption = new TemplateOptionsItem(); + currentOption.Type = AseOptionsType.Option; + string[] optionItemSetup = optionItems[ 1 ].Split( OptionsDataSeparator ); + currentOption.Name = optionItemSetup[ 0 ]; + if( optionItemSetup.Length > 1 ) + { + if( AseOptionItemSetupDict.ContainsKey( optionItemSetup[ 1 ] ) ) + currentOption.Setup = AseOptionItemSetupDict[ optionItemSetup[ 1 ] ]; + } + + currentOption.Id = itemIds.Length > 1 ? itemIds[ 1 ] : optionItems[ 1 ]; + currentOption.DisplayOptions = optionItems[ 2 ].Split( OptionsDataSeparator ); + currentOption.DisableIdx = currentOption.DisplayOptions.Length; + optionItems[ 2 ] += ",disable"; + currentOption.Options = optionItems[ 2 ].Split( OptionsDataSeparator ); + currentOption.Count = currentOption.Options.Length; + + for( int opIdx = 0; opIdx < currentOption.Options.Length; opIdx++ ) + { + optionItemToIndex.Add( currentOption.Options[ opIdx ], opIdx ); + actionItemsList.Add( new List() ); + } + + if( optionItems.Length > 3 ) + { + currentOption.DefaultOption = optionItems[ 3 ]; + } + else + { + currentOption.DefaultOption = currentOption.Options[ 0 ]; + } + + if( currentOption.Options.Length == 2 || ( currentOption.Options.Length == 3 && currentOption.Options[ 2 ].Equals( "disable" ) ) ) + { + if( ( currentOption.Options[ 0 ].Equals( "true" ) && currentOption.Options[ 1 ].Equals( "false" ) ) || + ( currentOption.Options[ 0 ].Equals( "false" ) && currentOption.Options[ 1 ].Equals( "true" ) ) ) + { + // Toggle 0 is false and 1 is true + currentOption.Options[ 0 ] = "false"; + currentOption.Options[ 1 ] = "true"; + currentOption.UIWidget = AseOptionsUIWidget.Toggle; + } + } + else if( currentOption.Options.Length > 2 ) + { + currentOption.UIWidget = AseOptionsUIWidget.Dropdown; + } + else + { + Debug.LogWarning( "Detected an option with less than two items:" + optionItems[ 1 ] ); + } + optionItemsList.Add( currentOption ); + } + break; + case "Port": + { + //Fills previous option with its actions + //actionItemsList is cleared over here + FillOptionAction( currentOption, ref actionItemsList ); + + optionItemToIndex.Clear(); + + currentOption = new TemplateOptionsItem(); + currentOption.Type = AseOptionsType.Port; + if( isSubShader && optionItems.Length > 2 ) + { + currentOption.Id = optionItems[ 1 ]; + currentOption.Name = optionItems[ 2 ]; + } + else + { + currentOption.Name = optionItems[ 1 ]; + } + + currentOption.Options = new string[] { "On", "Off" }; + optionItemToIndex.Add( currentOption.Options[ 0 ], 0 ); + optionItemToIndex.Add( currentOption.Options[ 1 ], 1 ); + + actionItemsList.Add( new List() ); + actionItemsList.Add( new List() ); + + optionItemsList.Add( currentOption ); + } + break; + case "Field": + { + //Fills previous option with its actions + //actionItemsList is cleared over here + FillOptionAction( currentOption, ref actionItemsList ); + + optionItemToIndex.Clear(); + currentOption = new TemplateOptionsItem(); + currentOption.Type = AseOptionsType.Field; + + currentOption.Id = optionItems[ 1 ]; + currentOption.Name = optionItems[ 1 ]; + + currentOption.UIWidget = AseOptionsUIWidget.Float; + if( optionItems[ 2 ].Equals( "Int" ) ) + currentOption.UIWidget = AseOptionsUIWidget.Int; + + if( optionItems.Length >= 3 ) + { + currentOption.DefaultFieldValue = Convert.ToSingle( optionItems[ 3 ], System.Globalization.CultureInfo.InvariantCulture ); + } + + if( optionItems.Length >= 6 ) + { + if( currentOption.UIWidget == AseOptionsUIWidget.Int ) + currentOption.UIWidget = AseOptionsUIWidget.Int; + else + currentOption.UIWidget = AseOptionsUIWidget.FloatRange; + + currentOption.FieldMin = Convert.ToSingle( optionItems[ 4 ], System.Globalization.CultureInfo.InvariantCulture ); + currentOption.FieldMax = Convert.ToSingle( optionItems[ 5 ], System.Globalization.CultureInfo.InvariantCulture ); + } + + if( optionItems.Length == 5 || optionItems.Length == 7 ) + { + currentOption.FieldInline = true; + currentOption.FieldInlineName = optionItems[ optionItems.Length - 1 ]; + } + + currentOption.Options = new string[] { "Change", "Inline", "disable" }; + + optionItemToIndex.Add( currentOption.Options[ 0 ], 0 ); + optionItemToIndex.Add( currentOption.Options[ 1 ], 1 ); + optionItemToIndex.Add( currentOption.Options[ 2 ], 2 ); + currentOption.DisableIdx = 2; + + actionItemsList.Add( new List() ); + actionItemsList.Add( new List() ); + actionItemsList.Add( new List() ); + + optionItemsList.Add( currentOption ); + } + break; + default: + { + // @diogo: handle conditional action first + const string IsConditionalPattern = @"^\s*(.+?)\s*\?\s*(.+?)\s*(=|!=)\s*(.+?)\s*$"; + TemplateActionItemConditional condition = null; + Match isConditionalMatch = Regex.Match( optionItems[ 0 ], IsConditionalPattern ); + if ( isConditionalMatch.Success ) + { + optionItems[ 0 ] = isConditionalMatch.Groups[ 1 ].Value; + condition = new TemplateActionItemConditional( + isConditionalMatch.Groups[ 3 ].Value, + isConditionalMatch.Groups[ 2 ].Value, + isConditionalMatch.Groups[ 4 ].Value ); + } + + if ( optionItemToIndex.ContainsKey( optionItems[ 0 ] ) ) + { + int idx = 0; + if( currentOption != null && currentOption.UIWidget == AseOptionsUIWidget.Toggle ) + { + idx = ( optionItems[ 0 ].Equals( "true" ) ) ? 1 : 0; + if( optionItems[ 0 ].Equals( "disable" ) ) + idx = 2; + } + else + { + idx = optionItemToIndex[ optionItems[ 0 ] ]; + } + actionItemsList[ idx ].Add( CreateActionItem( isSubShader, optionItems, condition ) ); + } + else + { + //string[] ids = optionItems[ 0 ].Split( ',' ); + if( itemIds.Length > 1 ) + { + for( int i = 0; i < itemIds.Length; i++ ) + { + if( optionItemToIndex.ContainsKey( itemIds[ i ] ) ) + { + int idx = optionItemToIndex[ itemIds[ i ] ]; + actionItemsList[ idx ].Add( CreateActionItem( isSubShader, optionItems ) ); + } + } + } + } + + } + break; + } + } + } + + //Fills last option with its actions + FillOptionAction( currentOption, ref actionItemsList ); + + actionItemsList.Clear(); + actionItemsList = null; + + optionsContainer.Options = optionItemsList.ToArray(); + optionItemsList.Clear(); + optionItemsList = null; + + optionItemToIndex.Clear(); + optionItemToIndex = null; + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + return optionsContainer; + } + + static void FillOptionAction( TemplateOptionsItem currentOption, ref List> actionItemsList ) + { + if( currentOption != null ) + { + int count = actionItemsList.Count; + currentOption.ActionsPerOption = new TemplateActionItemGrid( count ); + for( int i = 0; i < count; i++ ) + { + currentOption.ActionsPerOption[ i ] = actionItemsList[ i ].ToArray(); + actionItemsList[ i ].Clear(); + } + actionItemsList.Clear(); + } + } + + static TemplateActionItem CreateActionItem( bool isSubshader, string[] optionItems, TemplateActionItemConditional condition = null ) + { + TemplateActionItem actionItem = new TemplateActionItem(); + try + { + actionItem.ActionConditional = condition; + actionItem.ActionType = AseOptionsActionTypeDict[ optionItems[ 1 ] ]; + int optionsIdx = 2; + if( optionItems.Length > 3 ) + { + optionsIdx = 3; + actionItem.PassName = optionItems[ 2 ]; + } + else + { + actionItem.AllPasses = isSubshader; + } + + actionItem.ActionData = optionItems[ optionsIdx ]; + + switch( actionItem.ActionType ) + { + case AseOptionsActionType.RefreshOption: + { + string[] arr = optionItems[ optionsIdx ].Split( OptionsDataSeparator ); + if ( arr.Length > 1 ) + { + Debug.LogWarning( "RefreshOption should not have additional parameters other than Option name." ); + } + actionItem.ActionData = arr[ 0 ]; + } + break; + case AseOptionsActionType.ShowOption: + case AseOptionsActionType.HideOption: + { + string[] arr = optionItems[ optionsIdx ].Split( OptionsDataSeparator ); + if( arr.Length > 1 ) + { + actionItem.ActionData = arr[ 0 ]; + if( !int.TryParse( arr[ 1 ], out actionItem.ActionDataIdx ) ) + { + actionItem.ActionDataIdx = -1; + } + } + } + break; + case AseOptionsActionType.SetOption: + { + string[] arr = optionItems[ optionsIdx ].Split( OptionsDataSeparator ); + if( arr.Length > 1 ) + { + actionItem.ActionData = arr[ 0 ]; + if( !int.TryParse( arr[ 1 ], out actionItem.ActionDataIdx ) ) + { + Debug.LogWarning( "SetOption value must be a the selection index" ); + } + } + } + break; + case AseOptionsActionType.HidePort: + case AseOptionsActionType.ShowPort: + { + if( !int.TryParse( actionItem.ActionData, out actionItem.ActionDataIdx ) ) + actionItem.ActionDataIdx = -1; + } + break; + case AseOptionsActionType.SetPortName: + { + string[] arr = optionItems[ optionsIdx ].Split( OptionsDataSeparator ); + if( arr.Length > 1 ) + { + if ( !int.TryParse( arr[ 0 ], out actionItem.ActionDataIdx ) ) + actionItem.ActionDataIdx = -1; + + actionItem.ActionData = arr[ 0 ]; + actionItem.ActionData2 = arr[ 1 ]; + } + } + break; + case AseOptionsActionType.SetDefine: + case AseOptionsActionType.RemoveDefine: + case AseOptionsActionType.SetUndefine: + case AseOptionsActionType.RemoveUndefine: + case AseOptionsActionType.ExcludePass: + case AseOptionsActionType.IncludePass: + case AseOptionsActionType.ExcludeAllPassesBut: + break; + case AseOptionsActionType.SetShaderProperty: + { + int optIndex = optionItems[ optionsIdx ].IndexOf( OptionsDataSeparator ); + if( optIndex > -1 ) + { + actionItem.ActionData = optionItems[ optionsIdx ].Substring( 0, optIndex ); + actionItem.ActionBuffer = optionItems[ optionsIdx ].Substring( optIndex + 1, optionItems[ optionsIdx ].Length - optIndex - 1); + } + }break; + case AseOptionsActionType.SetMaterialProperty: + { + int optIndex = optionItems[ optionsIdx ].IndexOf( OptionsDataSeparator ); + if( optIndex > -1 ) + { + actionItem.ActionData = optionItems[ optionsIdx ].Substring( 0, optIndex ); + } + } + break; + case AseOptionsActionType.SetPropertyOnPass: + case AseOptionsActionType.SetPropertyOnSubShader: + { + string[] arr = optionItems[ optionsIdx ].Split( OptionsDataSeparator ); + actionItem.PropertyAction = (PropertyActionsEnum)Enum.Parse( typeof( PropertyActionsEnum ), arr[ 0 ] ); + if( arr.Length == 1 && actionItem.ActionType == AseOptionsActionType.SetPropertyOnPass ) + { + actionItem.CopyFromSubShader = true; + } + else + { + switch( actionItem.PropertyAction ) + { + case PropertyActionsEnum.CullMode: + { + if( arr.Length > 1 ) + actionItem.ActionCullMode = (CullMode)Enum.Parse( typeof( CullMode ), arr[ 1 ] ); + } + break; + case PropertyActionsEnum.ColorMask: + { + if( arr.Length > 4 ) + { + actionItem.ColorMask.SetColorMask( 0, arr[ 1 ] ); + actionItem.ColorMask.SetColorMask( 1, arr[ 2 ] ); + actionItem.ColorMask.SetColorMask( 2, arr[ 3 ] ); + actionItem.ColorMask.SetColorMask( 3, arr[ 4 ] ); + } + } + break; + case PropertyActionsEnum.ColorMask1: + { + if( arr.Length > 4 ) + { + actionItem.ColorMask1.SetColorMask( 0, arr[ 1 ] ); + actionItem.ColorMask1.SetColorMask( 1, arr[ 2 ] ); + actionItem.ColorMask1.SetColorMask( 2, arr[ 3 ] ); + actionItem.ColorMask1.SetColorMask( 3, arr[ 4 ] ); + } + } + break; + case PropertyActionsEnum.ColorMask2: + { + if( arr.Length > 4 ) + { + actionItem.ColorMask2.SetColorMask( 0, arr[ 1 ] ); + actionItem.ColorMask2.SetColorMask( 1, arr[ 2 ] ); + actionItem.ColorMask2.SetColorMask( 2, arr[ 3 ] ); + actionItem.ColorMask2.SetColorMask( 3, arr[ 4 ] ); + } + } + break; + case PropertyActionsEnum.ColorMask3: + { + if( arr.Length > 4 ) + { + actionItem.ColorMask3.SetColorMask( 0, arr[ 1 ] ); + actionItem.ColorMask3.SetColorMask( 1, arr[ 2 ] ); + actionItem.ColorMask3.SetColorMask( 2, arr[ 3 ] ); + actionItem.ColorMask3.SetColorMask( 3, arr[ 4 ] ); + } + } + break; + case PropertyActionsEnum.ZWrite: + { + if( arr.Length > 1 ) + actionItem.ActionZWrite = (ZWriteMode)Enum.Parse( typeof( ZWriteMode ), arr[ 1 ] ); + } + break; + case PropertyActionsEnum.ZTest: + { + if( arr.Length > 1 ) + actionItem.ActionZTest = (ZTestMode)Enum.Parse( typeof( ZTestMode ), arr[ 1 ] ); + } + break; + case PropertyActionsEnum.ZOffsetFactor: + { + if( arr.Length > 1 ) + actionItem.ActionZOffsetFactor = Convert.ToSingle( arr[ 1 ] ); + } + break; + case PropertyActionsEnum.ZOffsetUnits: + { + if( arr.Length > 1 ) + actionItem.ActionZOffsetUnits = Convert.ToSingle( arr[ 1 ] ); + } + break; + case PropertyActionsEnum.BlendRGB: + { + if( arr.Length > 2 ) + { + actionItem.ActionBlendRGBSource = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 1 ] ); + actionItem.ActionBlendRGBDest = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 2 ] ); + } + } + break; + case PropertyActionsEnum.BlendRGB1: + { + if( arr.Length > 2 ) + { + actionItem.ActionBlendRGBSource1 = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 1 ] ); + actionItem.ActionBlendRGBDest1 = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 2 ] ); + } + } + break; + case PropertyActionsEnum.BlendRGB2: + { + if( arr.Length > 2 ) + { + actionItem.ActionBlendRGBSource2 = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 1 ] ); + actionItem.ActionBlendRGBDest2 = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 2 ] ); + } + } + break; + case PropertyActionsEnum.BlendRGB3: + { + if( arr.Length > 2 ) + { + actionItem.ActionBlendRGBSource3 = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 1 ] ); + actionItem.ActionBlendRGBDest3 = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 2 ] ); + } + } + break; + case PropertyActionsEnum.BlendAlpha: + { + if( arr.Length > 2 ) + { + actionItem.ActionBlendAlphaSource = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 1 ] ); + actionItem.ActionBlendAlphaDest = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 2 ] ); + } + } + break; + case PropertyActionsEnum.BlendAlpha1: + { + if( arr.Length > 2 ) + { + actionItem.ActionBlendAlphaSource1 = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 1 ] ); + actionItem.ActionBlendAlphaDest1 = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 2 ] ); + } + } + break; + case PropertyActionsEnum.BlendAlpha2: + { + if( arr.Length > 2 ) + { + actionItem.ActionBlendAlphaSource2 = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 1 ] ); + actionItem.ActionBlendAlphaDest2 = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 2 ] ); + } + } + break; + case PropertyActionsEnum.BlendAlpha3: + { + if( arr.Length > 2 ) + { + actionItem.ActionBlendAlphaSource3 = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 1 ] ); + actionItem.ActionBlendAlphaDest3 = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 2 ] ); + } + } + break; + case PropertyActionsEnum.BlendOpRGB: + { + if( arr.Length > 1 ) + { + actionItem.ActionBlendOpRGB = (AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), arr[ 1 ] ); + + } + } + break; + case PropertyActionsEnum.BlendOpAlpha: + { + if( arr.Length > 1 ) + { + actionItem.ActionBlendOpAlpha = (AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), arr[ 1 ] ); + } + } + break; + case PropertyActionsEnum.StencilReference: + { + if( arr.Length > 1 ) + { + int.TryParse( arr[ 1 ], out actionItem.ActionStencilReference ); + } + } + break; + case PropertyActionsEnum.StencilReadMask: + { + if( arr.Length > 1 ) + { + int.TryParse( arr[ 1 ], out actionItem.ActionStencilReadMask ); + } + } + break; + case PropertyActionsEnum.StencilWriteMask: + { + if( arr.Length > 1 ) + { + int.TryParse( arr[ 1 ], out actionItem.ActionStencilWriteMask ); + } + } + break; + case PropertyActionsEnum.StencilComparison: + { + if( arr.Length > 1 ) + actionItem.ActionStencilComparison = StencilBufferOpHelper.StencilComparisonValuesDict[ arr[ 1 ] ]; + } + break; + case PropertyActionsEnum.StencilPass: + { + if( arr.Length > 1 ) + actionItem.ActionStencilPass = StencilBufferOpHelper.StencilOpsValuesDict[ arr[ 1 ] ]; + } + break; + case PropertyActionsEnum.StencilFail: + { + if( arr.Length > 1 ) + actionItem.ActionStencilFail = StencilBufferOpHelper.StencilOpsValuesDict[ arr[ 1 ] ]; + } + break; + case PropertyActionsEnum.StencilZFail: + { + if( arr.Length > 1 ) + actionItem.ActionStencilZFail = StencilBufferOpHelper.StencilOpsValuesDict[ arr[ 1 ] ]; + } + break; + case PropertyActionsEnum.RenderType: + { + if( arr.Length > 1 ) + actionItem.ActionData = arr[ 1 ]; + } + break; + case PropertyActionsEnum.RenderQueue: + { + if( arr.Length > 1 ) + actionItem.ActionData = arr[ 1 ]; + if( arr.Length > 2 ) + { + int.TryParse( arr[ 2 ], out actionItem.ActionDataIdx ); + } + else + { + actionItem.ActionDataIdx = 0; + } + } + break; + case PropertyActionsEnum.DisableBatching: + { + if( arr.Length > 1 ) + actionItem.ActionData = arr[ 1 ]; + } + break; + case PropertyActionsEnum.ChangeTagValue: + { + if( arr.Length > 2 ) + { + //Tag Name + actionItem.ActionData = arr[ 1 ]; + //Tag Value + actionItem.ActionBuffer = arr[ 2 ]; + } + } + break; + } + } + } + break; + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + return actionItem; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs.meta new file mode 100644 index 00000000..9328efd3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 019dfacde4ed75a41851c7f15f69963f +timeCreated: 1533143812 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs new file mode 100644 index 00000000..d8c7b666 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs @@ -0,0 +1,69 @@ +using UnityEngine; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateOptionsDefinesContainer + { + [SerializeField] + private List m_directivesList = new List(); + + [NonSerialized] + private Dictionary m_directivesDict = new Dictionary(); + + void Refresh() + { + if( m_directivesDict.Count != m_directivesList.Count ) + { + m_directivesDict.Clear(); + for( int i = 0; i < m_directivesList.Count; i++ ) + { + m_directivesDict.Add( m_directivesList[ i ].PropertyName, m_directivesList[ i ] ); + } + } + } + + public void RemoveTemporaries() + { + List temporaries = m_directivesList.FindAll( ( x ) => ( x.NodeId == 1 ) ); + for( int i = 0; i < temporaries.Count; i++ ) + { + m_directivesList.Remove( temporaries[ i ] ); + m_directivesDict.Remove( temporaries[ i ].PropertyName ); + } + } + + public void AddDirective( string directive , bool temporary , bool isPragma = false ) + { + Refresh(); + if( !m_directivesDict.ContainsKey( directive ) ) + { + int nodeId = temporary ? 1 : 0; + PropertyDataCollector data = new PropertyDataCollector( nodeId, directive,-1, isPragma ); + m_directivesDict.Add( directive, data ); + m_directivesList.Add( data ); + } + } + + public void RemoveDirective( string directive ) + { + Refresh(); + if( m_directivesDict.ContainsKey( directive ) ) + { + m_directivesList.Remove( m_directivesDict[directive] ); + m_directivesDict.Remove( directive ); + } + } + + public void Destroy() + { + m_directivesDict.Clear(); + m_directivesDict = null; + m_directivesList.Clear(); + m_directivesList = null; + } + public List DefinesList { get { return m_directivesList; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs.meta new file mode 100644 index 00000000..0bf3c6c9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 0f32755ee64bb1542ad9598810d9faf9 +timeCreated: 1543339825 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs new file mode 100644 index 00000000..759924b0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs @@ -0,0 +1,198 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + // PORT CONTROLLERS + [Serializable] + public class TemplateOptionPortItem + { + [SerializeField] + private int m_portId = -1; + + [SerializeField] + private TemplateOptionsItem m_options; + + public TemplateOptionPortItem( TemplateMultiPassMasterNode owner, TemplateOptionsItem options ) + { + m_options = options; + InputPort port = owner.InputPorts.Find( x => x.Name.Equals( options.Name ) ); + if( port != null ) + { + m_portId = port.PortId; + } + } + + public void FillDataCollector( TemplateMultiPassMasterNode owner, ref MasterNodeDataCollector dataCollector ) + { + InputPort port = null; + if( m_portId > -1 ) + { + port = owner.GetInputPortByUniqueId( m_portId ); + } + else + { + port = owner.InputPorts.Find( x => x.Name.Equals( m_options.Name ) ); + } + + if( port != null ) + { + int optionId = port.HasOwnOrLinkConnection ? 0 : 1; + for( int i = 0; i < m_options.ActionsPerOption[ optionId ].Length; i++ ) + { + switch( m_options.ActionsPerOption[ optionId ][ i ].ActionType ) + { + case AseOptionsActionType.SetDefine: + { + List nodes = owner.ContainerGraph.GetMultiPassMasterNodes( owner.LODIndex ); + int count = nodes.Count; + for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) + { + string defineValue = string.Empty; + bool isPragma = false; + if( m_options.ActionsPerOption[ optionId ][ i ].ActionData.StartsWith( "pragma" ) ) + { + defineValue = "#" + m_options.ActionsPerOption[ optionId ][ i ].ActionData; + isPragma = true; + } + else + { + defineValue = "#define " + m_options.ActionsPerOption[ optionId ][ i ].ActionData; + } + + nodes[ nodeIdx ].OptionsDefineContainer.AddDirective( defineValue ,false, isPragma ); + } + //dataCollector.AddToDefines( -1, m_options.ActionsPerOption[ optionId ][ i ].ActionData ); + } + break; + case AseOptionsActionType.SetUndefine: + { + List nodes = owner.ContainerGraph.GetMultiPassMasterNodes( owner.LODIndex ); + int count = nodes.Count; + for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) + { + nodes[ nodeIdx ].OptionsDefineContainer.AddDirective( "#undef " + m_options.ActionsPerOption[ optionId ][ i ].ActionData, false ); + } + //dataCollector.AddToDefines( -1, m_options.ActionsPerOption[ optionId ][ i ].ActionData, false ); + } + break; + case AseOptionsActionType.SetShaderProperty: + { + TemplateShaderPropertyData data = owner.CurrentTemplate.GetShaderPropertyData( m_options.ActionsPerOption[ optionId ][ i ].ActionData ); + if( data != null ) + { + string newPropertyValue = data.CreatePropertyForValue( m_options.ActionsPerOption[ optionId ][ i ].ActionBuffer ); + owner.CurrentTemplate.IdManager.SetReplacementText( data.FullValue, newPropertyValue ); + } + } + break; + } + } + } + } + + public void SubShaderFillDataCollector( TemplateMultiPassMasterNode owner, ref MasterNodeDataCollector dataCollector ) + { + + //TemplateMultiPassMasterNode targetNode = string.IsNullOrEmpty(m_options.Id) ? owner:owner.ContainerGraph.GetMasterNodeOfPass( m_options.Id , owner.LODIndex ); + TemplateMultiPassMasterNode targetNode = string.IsNullOrEmpty( m_options.Id ) ? + owner.ContainerGraph.GetMainMasterNodeOfLOD( owner.LODIndex ) : + owner.ContainerGraph.GetMasterNodeOfPass( m_options.Id , owner.LODIndex ); + + InputPort port = null; + if( m_portId > -1 ) + { + port = targetNode.GetInputPortByUniqueId( m_portId ); + } + else + { + port = targetNode.InputPorts.Find( x => x.Name.Equals( m_options.Name ) ); + } + + if( port != null ) + { + int optionId = port.HasOwnOrLinkConnection ? 0 : 1; + for( int i = 0; i < m_options.ActionsPerOption[ optionId ].Length; i++ ) + { + if( string.IsNullOrEmpty( m_options.ActionsPerOption[ optionId ][ i ].PassName ) || + m_options.ActionsPerOption[ optionId ][ i ].PassName.Equals( owner.PassName ) ) + { + switch( m_options.ActionsPerOption[ optionId ][ i ].ActionType ) + { + case AseOptionsActionType.SetDefine: + { + string defineValue = string.Empty; + bool isPragma = false; + if( m_options.ActionsPerOption[ optionId ][ i ].ActionData.StartsWith( "pragma" ) ) + { + defineValue = "#" + m_options.ActionsPerOption[ optionId ][ i ].ActionData; + isPragma = true; + } + else + { + defineValue = "#define " + m_options.ActionsPerOption[ optionId ][ i ].ActionData; + } + + owner.OptionsDefineContainer.AddDirective( defineValue ,true, isPragma ); + } + break; + case AseOptionsActionType.SetUndefine: + { + owner.OptionsDefineContainer.AddDirective( "#undef " + m_options.ActionsPerOption[ optionId ][ i ].ActionData, true ); + } + break; + case AseOptionsActionType.SetShaderProperty: + { + TemplateShaderPropertyData data = owner.CurrentTemplate.GetShaderPropertyData( m_options.ActionsPerOption[ optionId ][ i ].ActionData ); + if( data != null ) + { + string newPropertyValue = data.CreatePropertyForValue( m_options.ActionsPerOption[ optionId ][ i ].ActionBuffer ); + owner.CurrentTemplate.IdManager.SetReplacementText( data.FullValue, newPropertyValue ); + } + } + break; + } + } + } + } + } + + public void CheckImediateActionsForPort( TemplateMultiPassMasterNode owner, int portId ) + { + if( portId != m_portId ) + return; + + InputPort port = null; + if( m_portId > -1 ) + { + port = owner.GetInputPortByUniqueId( m_portId ); + } + else + { + port = owner.InputPorts.Find( x => x.Name.Equals( m_options.Name ) ); + } + + if( port != null ) + { + int optionId = port.HasOwnOrLinkConnection ? 0 : 1; + for( int i = 0; i < m_options.ActionsPerOption[ optionId ].Length; i++ ) + { + switch( m_options.ActionsPerOption[ optionId ][ i ].ActionType ) + { + case AseOptionsActionType.SetPortName: + { + port.Name = m_options.ActionsPerOption[ optionId ][ i ].ActionData; + owner.SizeIsDirty = true; + } + break; + } + } + } + } + public TemplateOptionsItem Options { get { return m_options; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs.meta new file mode 100644 index 00000000..74c9a3b1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: fa2d25bd070cde046876bd1fa77bf116 +timeCreated: 1535044953 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs new file mode 100644 index 00000000..7e517ef9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs @@ -0,0 +1,329 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + // UI STRUCTURES + [Serializable] + public class TemplateOptionUIItem + { + public delegate void OnActionPerformed( bool actionFromUser, bool isRefreshing, bool invertAction, TemplateOptionUIItem uiItem, int recursionLevel = 0, params TemplateActionItem[] validActions ); + public event OnActionPerformed OnActionPerformedEvt; + + [SerializeField] + private bool m_isVisible = true; + + [SerializeField] + private bool m_wasVisible = true; + + [SerializeField] + private int m_currentOption = 0; + + [SerializeField] + private TemplateOptionsItem m_options; + + [SerializeField] + private bool m_checkOnExecute = false; + + [SerializeField] + private bool m_invertActionOnDeselection = false; + + [SerializeField] + private Int64 m_lastClickedTimestamp = 0; + + public TemplateOptionUIItem( TemplateOptionsItem options ) + { + m_options = options; + if( m_options.Type == AseOptionsType.Field ) + { + m_options.FieldValue.FloatValue = m_options.DefaultFieldValue; + } + else + { + m_currentOption = m_options.DefaultOptionIndex; + } + m_invertActionOnDeselection = options.Setup == AseOptionItemSetup.InvertActionOnDeselection; + } + + public void CopyValuesFrom( TemplateOptionUIItem origin ) + { + m_isVisible = origin.IsVisible; + m_wasVisible = origin.WasVisible; + m_currentOption = origin.CurrentOption; + m_options.FieldValue.FloatValue = origin.CurrentFieldValue; + m_checkOnExecute = origin.CheckOnExecute; + m_invertActionOnDeselection = origin.InvertActionOnDeselection; + } + + + public void Draw( UndoParentNode owner ) + { + if( m_isVisible ) + { + int lastOption = m_currentOption; + EditorGUI.BeginChangeCheck(); + switch( m_options.UIWidget ) + { + case AseOptionsUIWidget.Dropdown: + { + m_currentOption = owner.EditorGUILayoutPopup( m_options.Name, m_currentOption, m_options.DisplayOptions ); + } + break; + case AseOptionsUIWidget.Toggle: + { + m_currentOption = owner.EditorGUILayoutToggle( m_options.Name, m_currentOption == 1 ) ? 1 : 0; + } + break; + case AseOptionsUIWidget.Float: + { + if( m_options.FieldInline ) + { + m_options.FieldValue.FloatField( ref owner, m_options.Name ); + if( m_options.FieldValue.Active ) + m_currentOption = 1; + else + m_currentOption = 0; + } + else + { + m_options.FieldValue.FloatValue = owner.EditorGUILayoutFloatField( m_options.Name, m_options.FieldValue.FloatValue ); + } + } + break; + case AseOptionsUIWidget.Int: + { + if( m_options.FieldInline ) + { + m_options.FieldValue.IntField( ref owner, m_options.Name ); + if( m_options.FieldValue.Active ) + m_currentOption = 1; + else + m_currentOption = 0; + } + else + m_options.FieldValue.FloatValue = owner.EditorGUILayoutIntField( m_options.Name, (int)m_options.FieldValue.FloatValue ); + } + break; + case AseOptionsUIWidget.FloatRange: + { + if( m_options.FieldInline ) + { + m_options.FieldValue.SliderField( ref owner, m_options.Name, m_options.FieldMin, m_options.FieldMax ); + if( m_options.FieldValue.Active ) + m_currentOption = 1; + else + m_currentOption = 0; + } + else + m_options.FieldValue.FloatValue = owner.EditorGUILayoutSlider( m_options.Name, m_options.FieldValue.FloatValue, m_options.FieldMin, m_options.FieldMax ); + } + break; + case AseOptionsUIWidget.IntRange: + { + if( m_options.FieldInline ) + { + m_options.FieldValue.IntSlider( ref owner, m_options.Name, (int)m_options.FieldMin, (int)m_options.FieldMax ); + if( m_options.FieldValue.Active ) + m_currentOption = 1; + else + m_currentOption = 0; + } + else + m_options.FieldValue.FloatValue = owner.EditorGUILayoutIntSlider( m_options.Name, (int)m_options.FieldValue.FloatValue, (int)m_options.FieldMin, (int)m_options.FieldMax ); + } + break; + } + if( EditorGUI.EndChangeCheck() ) + { + m_lastClickedTimestamp = DateTime.UtcNow.Ticks; + if( OnActionPerformedEvt != null ) + { + if( m_invertActionOnDeselection ) + OnActionPerformedEvt( true, false, lastOption != m_options.DisableIdx, this, 0, m_options.ActionsPerOption[ lastOption ] ); + + OnActionPerformedEvt( true, false, false, this, 0, m_options.ActionsPerOption[ m_currentOption ] ); + } + } + } + } + + public void CheckEnDisable( bool actionFromUser ) + { + //string deb = string.Empty;// "-- Checked --" + m_options.Name+" "+ m_isVisible + " "+ m_wasVisible; + if( m_isVisible ) + { + if( !m_wasVisible ) + { + //deb = "-- Enable --" + m_options.Name; + //Debug.Log( deb ); + if( OnActionPerformedEvt != null ) + { + if( m_invertActionOnDeselection ) + { + for( int i = 0; i < m_options.Count; i++ ) + { + if( i != m_currentOption && i != m_options.DisableIdx ) + { + OnActionPerformedEvt( actionFromUser, false, true, this, 0, m_options.ActionsPerOption[ i ] ); + } + } + } + + OnActionPerformedEvt( actionFromUser, false, false, this, 0, m_options.ActionsPerOption[ m_currentOption ] ); + //if( !m_isVisible ) + //OnActionPerformedEvt( isRefreshing, false, this, 0, m_options.ActionsPerOption[ m_options.DisableIdx ] ); + } + } + + m_wasVisible = true; + } + else if( m_wasVisible ) + { + //deb = "-- Disable --" + m_options.Name; + //Debug.Log( deb ); + m_wasVisible = false; + + if( OnActionPerformedEvt != null ) + { + OnActionPerformedEvt( actionFromUser, false, false, this, 0, m_options.ActionsPerOption[ m_options.DisableIdx ] ); + } + } + } + + public void FillDataCollector( ref MasterNodeDataCollector dataCollector ) + { + if( m_isVisible && m_checkOnExecute ) + { + for( int i = 0; i < m_options.ActionsPerOption[ m_currentOption ].Length; i++ ) + { + switch( m_options.ActionsPerOption[ m_currentOption ][ i ].ActionType ) + { + case AseOptionsActionType.SetDefine: + { + dataCollector.AddToDefines( -1, m_options.ActionsPerOption[ m_currentOption ][ i ].ActionData ); + } + break; + case AseOptionsActionType.SetUndefine: + { + dataCollector.AddToDefines( -1, m_options.ActionsPerOption[ m_currentOption ][ i ].ActionData, false ); + } + break; + } + } + } + } + + public void Update( int recursionLevel = 0, bool isRefreshing = true ) + { + if( OnActionPerformedEvt != null ) + { + if( m_invertActionOnDeselection ) + { + for( int i = 0; i < m_options.Count; i++ ) + { + if( i != m_currentOption && i != m_options.DisableIdx ) + { + OnActionPerformedEvt( false, isRefreshing, true, this, recursionLevel, m_options.ActionsPerOption[ i ] ); + } + } + } + + OnActionPerformedEvt( false, isRefreshing, false, this, recursionLevel, m_options.ActionsPerOption[ m_currentOption ] ); + } + } + + public TemplateOptionsItem Options { get { return m_options; } } + + public void Destroy() + { + OnActionPerformedEvt = null; + } + + public bool IsVisible + { + get { return m_isVisible; } + set { m_isVisible = value; } + } + + public bool WasVisible + { + get { return m_wasVisible; } + set { m_wasVisible = value; } + } + + public bool CheckOnExecute + { + get { return m_checkOnExecute; } + set { m_checkOnExecute = value; } + } + + public InlineProperty FieldValue + { + get { return m_options.FieldValue; } + set { m_options.FieldValue = value; } + } + + public float CurrentFieldValue + { + get { return m_options.FieldValue.FloatValue; } + set { m_options.FieldValue.FloatValue = value; } + } + + public int CurrentOption + { + get { return m_currentOption; } + set + { + m_currentOption = Mathf.Clamp( value, 0, m_options.Options.Length - 1 ); + // why refreshing here? + //Refresh(); + } + } + + public int CurrentOptionIdx + { + set + { + m_currentOption = Mathf.Clamp( value, 0, m_options.Options.Length - 1 ); + } + } + public bool EmptyEvent { get { return OnActionPerformedEvt == null; } } + public TemplateActionItemGrid.TemplateActionItemRow CurrentOptionActions + { + get + { + if( m_options.Type == AseOptionsType.Field && + m_currentOption == 1 ) + { + if( m_options.FieldValue.NodeId < -1 ) + { + //This is quite the hack. The bug is related to if a user chooses an inline property on the field option, then the behavior is to comment the original property set on the template + // The problem is that, if the user sets an inline property and select its own internal property from there, then the behavior that will prevail without this hack is to call the actions associated with setting a new inline property + // Which is on all templates to comment the original template internal property leaving the property commented on the final code (This was detected on URP PBR) + PropertyNode node = UIUtils.CurrentWindow.OutsideGraph.GetInternalTemplateNode( m_options.FieldValue.NodeId ) as PropertyNode; + if( node != null ) + { + if( node.PropertyName.Equals( m_options.FieldInlineName ) ) + { + return m_options.ActionsPerOption.Rows[ 0 ]; + } + } + } + else if( m_options.FieldValue.NodeId == -1 ) + { + // If node id is -1 then no node is selected on the inline dropdown then we should also fallback to using its internal property + return m_options.ActionsPerOption.Rows[ 0 ]; + } + } + return m_options.ActionsPerOption.Rows[m_currentOption]; + } + } + public bool InvertActionOnDeselection { get { return m_invertActionOnDeselection; } } + public Int64 LastClickedTimestamp { get { return m_lastClickedTimestamp; } set { m_lastClickedTimestamp = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs.meta new file mode 100644 index 00000000..bfddefa5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 081c72eb35d61c84e9a5c34522c3ff33 +timeCreated: 1534775306 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs new file mode 100644 index 00000000..eb31647d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs @@ -0,0 +1,945 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using System.Linq; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateOptionsUIHelper + { + public struct ReadOptions + { + public string Name; + public string Selection; + public Int64 Timestamp; + } + private const string CustomOptionsLabel = " Custom Options"; + + private bool m_isSubShader = false; + + [SerializeField] + private bool m_passCustomOptionsFoldout = true; + + [SerializeField] + private string m_passCustomOptionsLabel = CustomOptionsLabel; + + [SerializeField] + private int m_passCustomOptionsSizeCheck = 0; + + [SerializeField] + private List m_passCustomOptionsUI = new List(); + + [NonSerialized] + private Dictionary m_passCustomOptionsUIDict = new Dictionary(); + + [NonSerialized] + private TemplateMultiPassMasterNode m_owner; + + [NonSerialized] + private List m_readOptions = null; + + [SerializeField] + private List m_passCustomOptionsPorts = new List(); + + public TemplateOptionsUIHelper( bool isSubShader ) + { + m_isSubShader = isSubShader; + } + + public void CopyOptionsValuesFrom( TemplateOptionsUIHelper origin ) + { + for( int i = 0; i < origin.PassCustomOptionsUI.Count; i++ ) + { + m_passCustomOptionsUI[ i ].CopyValuesFrom( origin.PassCustomOptionsUI[ i ] ); + } + } + + public void Destroy() + { + for( int i = 0; i < m_passCustomOptionsUI.Count; i++ ) + { + m_passCustomOptionsUI[ i ].Destroy(); + } + + m_passCustomOptionsUI.Clear(); + m_passCustomOptionsUI = null; + + m_passCustomOptionsUIDict.Clear(); + m_passCustomOptionsUIDict = null; + + m_passCustomOptionsPorts.Clear(); + m_passCustomOptionsPorts = null; + } + + public void DrawCustomOptions( TemplateMultiPassMasterNode owner ) + { + m_owner = owner; + + if( m_passCustomOptionsUI.Count > 0 ) + { + NodeUtils.DrawNestedPropertyGroup( ref m_passCustomOptionsFoldout, m_passCustomOptionsLabel, DrawCustomOptionsBlock ); + } + } + + public void DrawCustomOptionsBlock() + { + float currWidth = EditorGUIUtility.labelWidth; + float size = Mathf.Max( UIUtils.CurrentWindow.ParametersWindow.TransformedArea.width * 0.385f, 0 ); + EditorGUIUtility.labelWidth = size; + for( int i = 0; i < m_passCustomOptionsUI.Count; i++ ) + { + m_passCustomOptionsUI[ i ].Draw( m_owner ); + } + EditorGUILayout.Space(); + EditorGUIUtility.labelWidth = currWidth; + } + + private InputPort MatchInputPortForTemplateAction( TemplateMultiPassMasterNode passMasterNode, TemplateActionItem action ) + { + InputPort port; + if ( action.ActionDataIdx > -1 ) + { + port = passMasterNode.GetInputPortByUniqueId( action.ActionDataIdx ); + } + else + { + // @diogo: hacky.. but it'll have to do, for crude backwards compatibility + if ( action.ActionData.StartsWith( "_" ) ) + { + port = passMasterNode.GetInputPortByExternalLinkId( action.ActionData ); + } + else + { + port = passMasterNode.GetInputPortByName( action.ActionData ); + } + } + return port; + } + + private bool TestActionItemConditional( TemplateActionItem actionItem ) + { + bool succeeded = true; + TemplateActionItemConditional conditional = actionItem.ActionConditional; + if ( conditional != null && conditional.IsValid ) + { + TemplateOptionUIItem referenceItem = m_passCustomOptionsUI.Find( x => ( x.Options.Name.Equals( conditional.Option ) ) ); + if ( referenceItem != null ) + { + bool equal = conditional.Value.Equals( referenceItem.Options.Options[ referenceItem.CurrentOption ] ); + if ( conditional.Condition == TemplateActionItemConditional.Conditional.Equal ) + { + succeeded = equal; + } + else if ( conditional.Condition == TemplateActionItemConditional.Conditional.NotEqual ) + { + succeeded = !equal; + } + } + } + return succeeded; + } + + public void OnCustomOptionSelected( bool actionFromUser, bool isRefreshing, bool invertAction, TemplateMultiPassMasterNode owner, TemplateOptionUIItem uiItem, int recursionLevel, params TemplateActionItem[] validActions ) + { + uiItem.CheckOnExecute = false; + for( int i = 0; i < validActions.Length; i++ ) + { + // @diogo: test conditional before running + if ( !TestActionItemConditional( validActions[ i ] ) ) + { + continue; + } + + AseOptionsActionType actionType = validActions[ i ].ActionType; + if( invertAction ) + { + if( !TemplateOptionsToolsHelper.InvertAction( validActions[ i ].ActionType, ref actionType ) ) + { + continue; + } + } + + switch( actionType ) + { + case AseOptionsActionType.RefreshOption: + { + if ( !uiItem.IsVisible || recursionLevel > 0 ) + break; + + TemplateOptionUIItem item = m_passCustomOptionsUI.Find( x => ( x.Options.Name.Equals( validActions[ i ].ActionData ) ) ); + if ( item != null ) + { + item.Update( recursionLevel + 1, isRefreshing ); + } + else + { + Debug.LogFormat( "Could not find Option {0} for action '{1}' on template {2}", validActions[ i ].ActionData, validActions[ i ].ActionType, owner.CurrentTemplate.DefaultShaderName ); + } + } + break; + case AseOptionsActionType.ShowOption: + { + TemplateOptionUIItem item = m_passCustomOptionsUI.Find( x => ( x.Options.Name.Equals( validActions[ i ].ActionData ) ) ); + if( item != null ) + { + if( isRefreshing ) + { + string optionId = validActions[ i ].PassName + validActions[ i ].ActionData + "Option"; + owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, true ); + } + + // this prevents options from showing up when loading by checking if they were hidden by another option + // it works on the assumption that an option that may possible hide this one is checked first + if( !isRefreshing ) + item.IsVisible = true; + else if( item.WasVisible ) + item.IsVisible = true; + + if( !invertAction && validActions[ i ].ActionDataIdx > -1 ) + item.CurrentOption = validActions[ i ].ActionDataIdx; + + item.CheckEnDisable( actionFromUser ); + } + else + { + Debug.LogFormat( "Could not find Option {0} for action '{1}' on template {2}", validActions[ i ].ActionData, validActions[ i ].ActionType, owner.CurrentTemplate.DefaultShaderName ); + } + } + break; + case AseOptionsActionType.HideOption: + { + TemplateOptionUIItem item = m_passCustomOptionsUI.Find( x => ( x.Options.Name.Equals( validActions[ i ].ActionData ) ) ); + if( item != null ) + { + bool flag = false; + if( isRefreshing ) + { + string optionId = validActions[ i ].PassName + validActions[ i ].ActionData + "Option"; + flag = owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, false ); + } + + item.IsVisible = false || flag; + if( !invertAction && validActions[ i ].ActionDataIdx > -1 ) + item.CurrentOption = validActions[ i ].ActionDataIdx; + + item.CheckEnDisable( actionFromUser ); + } + else + { + Debug.LogFormat( "Could not find Option {0} for action '{1}' on template {2}", validActions[ i ].ActionData, validActions[ i ].ActionType, owner.CurrentTemplate.DefaultShaderName ); + } + } + break; + case AseOptionsActionType.SetOption: + { + if( !uiItem.IsVisible ) + break; + + TemplateOptionUIItem item = m_passCustomOptionsUI.Find( x => ( x.Options.Name.Equals( validActions[ i ].ActionData ) ) ); + if( item != null ) + { + item.CurrentOption = validActions[ i ].ActionDataIdx; + item.Update( recursionLevel, isRefreshing ); + } + else + { + Debug.LogFormat( "Could not find Option {0} for action '{1}' on template {2}", validActions[ i ].ActionData, validActions[ i ].ActionType, owner.CurrentTemplate.DefaultShaderName ); + } + } + break; + case AseOptionsActionType.HidePort: + { + TemplateMultiPassMasterNode passMasterNode = owner; + if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) + { + passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName,owner.LODIndex ); + } + + if( passMasterNode != null ) + { + InputPort port = MatchInputPortForTemplateAction( passMasterNode, validActions[ i ] ); + if( port != null ) + { + if( isRefreshing ) + { + string optionId = validActions[ i ].PassName + port.Name; + owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, port.IsConnected ); + port.Visible = port.IsConnected; + } + else + { + port.Visible = false; + } + passMasterNode.SizeIsDirty = true; + } + else + { + Debug.LogFormat( "Could not find port {0},{1} for action '{2}' on template {3}", validActions[ i ].ActionDataIdx, validActions[ i ].ActionData, validActions[ i ].ActionType, owner.CurrentTemplate.DefaultShaderName ); + } + } + else + { + Debug.LogFormat( "Could not find pass {0} for action {1} '{2}' on template {3}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData, owner.CurrentTemplate.DefaultShaderName ); + } + } + break; + case AseOptionsActionType.ShowPort: + { + if( !uiItem.IsVisible ) + break; + + TemplateMultiPassMasterNode passMasterNode = owner; + if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) + { + passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName, owner.LODIndex ); + } + + if( passMasterNode != null ) + { + InputPort port = MatchInputPortForTemplateAction( passMasterNode, validActions[ i ] ); + if( port != null ) + { + if( isRefreshing ) + { + string optionId = validActions[ i ].PassName + port.Name; + owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, true ); + } + + port.Visible = true; + passMasterNode.SizeIsDirty = true; + } + else + { + Debug.LogFormat( "Could not find port {0},{1} for action '{2}' on template {3}", validActions[ i ].ActionDataIdx, validActions[ i ].ActionData, validActions[ i ].ActionType, owner.CurrentTemplate.DefaultShaderName ); + } + } + else + { + Debug.LogFormat( "Could not find pass {0} for action {1} '{2}' on template {3}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData, owner.CurrentTemplate.DefaultShaderName ); + } + } + break; + case AseOptionsActionType.SetPortName: + { + if( !uiItem.IsVisible ) + break; + + TemplateMultiPassMasterNode passMasterNode = owner; + if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) + { + passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName, owner.LODIndex ); + } + + if( passMasterNode != null ) + { + InputPort port = MatchInputPortForTemplateAction( passMasterNode, validActions[ i ] ); + if( port != null ) + { + port.Name = validActions[ i ].ActionData2; + passMasterNode.SizeIsDirty = true; + } + else + { + Debug.LogFormat( "Could not find port {0},{1} for action '{2}' on template {3}", validActions[ i ].ActionData, validActions[ i ].ActionType, validActions[ i ].ActionData, owner.CurrentTemplate.DefaultShaderName ); + } + } + else + { + Debug.LogFormat( "Could not find pass {0}, {1} for action '{2}' on template {3}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData, owner.CurrentTemplate.DefaultShaderName ); + } + } + break; + case AseOptionsActionType.SetDefine: + { + if( !uiItem.IsVisible ) + { + uiItem.CheckOnExecute = true; + break; + } + + //Debug.Log( "DEFINE " + validActions[ i ].ActionData ); + if( validActions[ i ].AllPasses ) + { + string actionData = validActions[ i ].ActionData; + string defineValue = string.Empty; + bool isPragma = false; + if( actionData.StartsWith( "pragma" ) ) + { + defineValue = "#" + actionData; + isPragma = true; + } + else + { + defineValue = "#define " + validActions[ i ].ActionData; + } + if( isRefreshing ) + { + owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( defineValue, true ); + } + List nodes = owner.ContainerGraph.GetMultiPassMasterNodes( owner.LODIndex ); + int count = nodes.Count; + for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) + { + nodes[ nodeIdx ].OptionsDefineContainer.AddDirective( defineValue, false, isPragma ); + } + } + else if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) + { + TemplateMultiPassMasterNode passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName, owner.LODIndex ); + if( passMasterNode != null ) + { + string actionData = validActions[ i ].ActionData; + string defineValue = string.Empty; + bool isPragma = false; + if( actionData.StartsWith( "pragma" ) ) + { + defineValue = "#" + actionData; + isPragma = true; + } + else + { + defineValue = "#define " + validActions[ i ].ActionData; + } + if( isRefreshing ) + { + string optionsId = validActions[ i ].PassName + defineValue; + owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionsId, true ); + } + passMasterNode.OptionsDefineContainer.AddDirective( defineValue, false, isPragma ); + } + else + { + Debug.LogFormat( "Could not find pass {0} for action {1} '{2}' on template {3}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData, owner.CurrentTemplate.DefaultShaderName ); + } + } + else + { + uiItem.CheckOnExecute = true; + } + } + break; + case AseOptionsActionType.RemoveDefine: + { + //Debug.Log( "UNDEFINE " + validActions[ i ].ActionData ); + if( validActions[ i ].AllPasses ) + { + string actionData = validActions[ i ].ActionData; + string defineValue = string.Empty; + if( actionData.StartsWith( "pragma" ) ) + { + defineValue = "#" + actionData; + } + else + { + defineValue = "#define " + validActions[ i ].ActionData; + } + + bool flag = false; + if( isRefreshing ) + { + flag = owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( defineValue, false ); + } + + if( !flag ) + { + List nodes = owner.ContainerGraph.GetMultiPassMasterNodes( owner.LODIndex ); + int count = nodes.Count; + for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) + { + nodes[ nodeIdx ].OptionsDefineContainer.RemoveDirective( defineValue ); + } + } + } + else if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) + { + TemplateMultiPassMasterNode passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName, owner.LODIndex ); + if( passMasterNode != null ) + { + string actionData = validActions[ i ].ActionData; + string defineValue = string.Empty; + if( actionData.StartsWith( "pragma" ) ) + { + defineValue = "#" + actionData; + } + else + { + defineValue = "#define " + validActions[ i ].ActionData; + } + bool flag = false; + if( isRefreshing ) + { + string optionId = validActions[ i ].PassName + defineValue; + flag = owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, false ); + } + if( !flag ) + { + passMasterNode.OptionsDefineContainer.RemoveDirective( defineValue ); + } + } + else + { + Debug.LogFormat( "Could not find pass {0} for action {1} '{2}' on template {3}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData, owner.CurrentTemplate.DefaultShaderName ); + } + } + else + { + uiItem.CheckOnExecute = false; + } + } + break; + case AseOptionsActionType.SetUndefine: + { + if( !uiItem.IsVisible ) + { + uiItem.CheckOnExecute = true; + break; + } + + if( validActions[ i ].AllPasses ) + { + string defineValue = "#undef " + validActions[ i ].ActionData; + if( isRefreshing ) + { + owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( defineValue, true ); + } + List nodes = owner.ContainerGraph.GetMultiPassMasterNodes(owner.LODIndex); + int count = nodes.Count; + for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) + { + nodes[ nodeIdx ].OptionsDefineContainer.AddDirective( defineValue, false ); + } + } + else if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) + { + TemplateMultiPassMasterNode passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName, owner.LODIndex ); + if( passMasterNode != null ) + { + string defineValue = "#undef " + validActions[ i ].ActionData; + if( isRefreshing ) + { + string optionsId = validActions[ i ].PassName + defineValue; + owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionsId, true ); + } + passMasterNode.OptionsDefineContainer.AddDirective( defineValue, false ); + } + else + { + Debug.LogFormat( "Could not find pass {0} for action {1} '{2}' on template {3}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData, owner.CurrentTemplate.DefaultShaderName ); + } + } + else + { + uiItem.CheckOnExecute = true; + } + } + break; + case AseOptionsActionType.RemoveUndefine: + { + if( validActions[ i ].AllPasses ) + { + string defineValue = "#undef " + validActions[ i ].ActionData; + bool flag = false; + if( isRefreshing ) + { + flag = owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( defineValue, false ); + } + + if( !flag ) + { + List nodes = owner.ContainerGraph.GetMultiPassMasterNodes( owner.LODIndex ); + int count = nodes.Count; + for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) + { + nodes[ nodeIdx ].OptionsDefineContainer.RemoveDirective( defineValue ); + } + } + } + else if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) + { + TemplateMultiPassMasterNode passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName, owner.LODIndex ); + if( passMasterNode != null ) + { + bool flag = false; + string defineValue = "#undef " + validActions[ i ].ActionData; + if( isRefreshing ) + { + string optionId = validActions[ i ].PassName + defineValue; + flag = owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, false ); + } + + if( !flag ) + { + passMasterNode.OptionsDefineContainer.RemoveDirective( defineValue ); + } + } + else + { + Debug.LogFormat( "Could not find pass {0} for action {1} '{2}' on template {3}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData, owner.CurrentTemplate.DefaultShaderName ); + } + } + else + { + uiItem.CheckOnExecute = false; + } + } + break; + case AseOptionsActionType.ExcludePass: + { + string optionId = validActions[ i ].ActionData + "Pass"; + //bool flag = isRefreshing ? owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, false ) : false; + //if( !flag ) + // owner.SetPassVisible( validActions[ i ].ActionData, false ); + owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId , false ) ; + owner.SetPassVisible( validActions[ i ].ActionData , false ); + } + break; + + + case AseOptionsActionType.IncludePass: + { + if( !uiItem.IsVisible ) + break; + + string optionId = validActions[ i ].ActionData + "Pass"; + owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, true ); + owner.SetPassVisible( validActions[ i ].ActionData, true ); + } + break; + case AseOptionsActionType.SetPropertyOnPass: + { + //Debug.Log( "PASSPROP " + validActions[ i ].ActionData ); + //Refresh happens on hotcode reload and shader load and in those situation + // The property own serialization handles its setup + if( isRefreshing ) + continue; + + if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) + { + TemplateMultiPassMasterNode passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName, owner.LODIndex ); + if( passMasterNode != null ) + { + passMasterNode.SetPropertyActionFromItem( actionFromUser, passMasterNode.PassModule, validActions[ i ] ); + } + else + { + Debug.LogFormat( "Could not find pass {0} for action {1} '{2}' on template {3}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData, owner.CurrentTemplate.DefaultShaderName ); + } + } + else + { + owner.SetPropertyActionFromItem( actionFromUser, owner.PassModule, validActions[ i ] ); + } + } + break; + case AseOptionsActionType.SetPropertyOnSubShader: + { + //Refresh happens on hotcode reload and shader load and in those situation + // The property own serialization handles its setup + if( isRefreshing ) + continue; + + owner.SetPropertyActionFromItem( actionFromUser, owner.SubShaderModule, validActions[ i ] ); + } + break; + case AseOptionsActionType.SetShaderProperty: + { + //This action is only check when shader is compiled over + //the TemplateMultiPassMasterNode via the on CheckPropertyChangesOnOptions() method + } + break; + case AseOptionsActionType.ExcludeAllPassesBut: + { + //This action is only check when shader is compiled over + //the TemplateMultiPassMasterNode via the on CheckExcludeAllPassOptions() method + } + break; + case AseOptionsActionType.SetMaterialProperty: + { + if( isRefreshing ) + continue; + + if( !uiItem.IsVisible ) + break; + + if( owner.ContainerGraph.CurrentMaterial != null ) + { + string prop = validActions[ i ].ActionData; + if( owner.ContainerGraph.CurrentMaterial.HasProperty( prop ) ) + { + if( uiItem.Options.UIWidget == AseOptionsUIWidget.Float || uiItem.Options.UIWidget == AseOptionsUIWidget.FloatRange ) + owner.ContainerGraph.CurrentMaterial.SetFloat( prop, uiItem.CurrentFieldValue ); + else + owner.ContainerGraph.CurrentMaterial.SetInt( prop, (int)uiItem.CurrentFieldValue ); + + if( MaterialInspector.Instance != null ) + MaterialInspector.Instance.Repaint(); + } + } + } + break; + } + } + } + + public void SetupCustomOptionsFromTemplate( TemplateMultiPassMasterNode owner, bool newTemplate ) + { + TemplateOptionsContainer customOptionsContainer = m_isSubShader ? owner.SubShader.CustomOptionsContainer : owner.Pass.CustomOptionsContainer; + + if( !newTemplate && customOptionsContainer.Body.Length == m_passCustomOptionsSizeCheck ) + { + for( int i = 0; i < m_passCustomOptionsUI.Count; i++ ) + { + if( m_passCustomOptionsUI[ i ].EmptyEvent ) + { + if( m_isSubShader ) + { + m_passCustomOptionsUI[ i ].OnActionPerformedEvt += owner.OnCustomSubShaderOptionSelected; + } + else + { + m_passCustomOptionsUI[ i ].OnActionPerformedEvt += owner.OnCustomPassOptionSelected; + } + } + } + return; + } + + m_passCustomOptionsLabel = string.IsNullOrEmpty( customOptionsContainer.Name ) ? CustomOptionsLabel : " " + customOptionsContainer.Name; + + for( int i = 0; i < m_passCustomOptionsUI.Count; i++ ) + { + m_passCustomOptionsUI[ i ].Destroy(); + } + + m_passCustomOptionsUI.Clear(); + m_passCustomOptionsUIDict.Clear(); + m_passCustomOptionsPorts.Clear(); + + if( customOptionsContainer.Enabled ) + { + m_passCustomOptionsSizeCheck = customOptionsContainer.Body.Length; + for( int i = 0; i < customOptionsContainer.Options.Length; i++ ) + { + switch( customOptionsContainer.Options[ i ].Type ) + { + case AseOptionsType.Option: + { + TemplateOptionUIItem item = new TemplateOptionUIItem( customOptionsContainer.Options[ i ] ); + if( m_isSubShader ) + { + item.OnActionPerformedEvt += owner.OnCustomSubShaderOptionSelected; + } + else + { + item.OnActionPerformedEvt += owner.OnCustomPassOptionSelected; + } + + m_passCustomOptionsUI.Add( item ); + m_passCustomOptionsUIDict.Add( customOptionsContainer.Options[ i ].Id, item ); + } + break; + case AseOptionsType.Port: + { + TemplateOptionPortItem item = new TemplateOptionPortItem( owner, customOptionsContainer.Options[ i ] ); + m_passCustomOptionsPorts.Add( item ); + //if( m_isSubShader ) + //{ + // if( string.IsNullOrEmpty( customOptionsContainer.Options[ i ].Id ) ) + // { + // //No pass name selected. inject on all passes + // TemplateOptionPortItem item = new TemplateOptionPortItem( owner, customOptionsContainer.Options[ i ] ); + // m_passCustomOptionsPorts.Add( item ); + // } + // else if( customOptionsContainer.Options[ i ].Id.Equals( owner.PassName ) ) + // { + // TemplateOptionPortItem item = new TemplateOptionPortItem( owner, customOptionsContainer.Options[ i ] ); + // m_passCustomOptionsPorts.Add( item ); + // } + //} + //else + //{ + // TemplateOptionPortItem item = new TemplateOptionPortItem( owner, customOptionsContainer.Options[ i ] ); + // m_passCustomOptionsPorts.Add( item ); + //} + } + break; + case AseOptionsType.Field: + { + TemplateOptionUIItem item = new TemplateOptionUIItem( customOptionsContainer.Options[ i ] ); + if( m_isSubShader ) + { + item.OnActionPerformedEvt += owner.OnCustomSubShaderOptionSelected; + } + else + { + item.OnActionPerformedEvt += owner.OnCustomPassOptionSelected; + } + + m_passCustomOptionsUI.Add( item ); + m_passCustomOptionsUIDict.Add( customOptionsContainer.Options[ i ].Id, item ); + } + break; + } + } + } + else + { + m_passCustomOptionsSizeCheck = 0; + } + } + + public void SetCustomOptionsInfo( TemplateMultiPassMasterNode masterNode, ref MasterNodeDataCollector dataCollector ) + { + if( masterNode == null ) + return; + + for( int i = 0; i < m_passCustomOptionsUI.Count; i++ ) + { + m_passCustomOptionsUI[ i ].FillDataCollector( ref dataCollector ); + } + + for( int i = 0; i < m_passCustomOptionsPorts.Count; i++ ) + { + m_passCustomOptionsPorts[ i ].FillDataCollector( masterNode, ref dataCollector ); + } + } + + public void CheckImediateActionsForPort( TemplateMultiPassMasterNode masterNode , int portId ) + { + for( int i = 0; i < m_passCustomOptionsPorts.Count; i++ ) + { + m_passCustomOptionsPorts[ i ].CheckImediateActionsForPort( masterNode, portId ); + } + } + + public void SetSubShaderCustomOptionsPortsInfo( TemplateMultiPassMasterNode masterNode, ref MasterNodeDataCollector dataCollector ) + { + if( masterNode == null ) + return; + + + //for( int i = 0; i < m_passCustomOptionsPorts.Count; i++ ) + //{ + // if( string.IsNullOrEmpty( m_passCustomOptionsPorts[ i ].Options.Id ) || + // masterNode.PassUniqueName.Equals( m_passCustomOptionsPorts[ i ].Options.Id ) ) + // { + // m_passCustomOptionsPorts[ i ].FillDataCollector( masterNode, ref dataCollector ); + // } + //} + + for( int i = 0; i < m_passCustomOptionsPorts.Count; i++ ) + { + m_passCustomOptionsPorts[ i ].SubShaderFillDataCollector( masterNode, ref dataCollector ); + } + } + + public void RefreshCustomOptionsDict() + { + if( m_passCustomOptionsUIDict.Count != m_passCustomOptionsUI.Count ) + { + m_passCustomOptionsUIDict.Clear(); + int count = m_passCustomOptionsUI.Count; + for( int i = 0; i < count; i++ ) + { + m_passCustomOptionsUIDict.Add( m_passCustomOptionsUI[ i ].Options.Id, m_passCustomOptionsUI[ i ] ); + } + } + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + RefreshCustomOptionsDict(); + int savedOptions = Convert.ToInt32( nodeParams[ index++ ] ); + m_readOptions = new List(); + for( int i = 0; i < savedOptions; i++ ) + { + string optionName = nodeParams[ index++ ]; + string optionSelection = nodeParams[ index++ ]; + Int64 optionTimestamp = ( UIUtils.CurrentShaderVersion() > 18929 ) ? Convert.ToInt64( nodeParams[ index++ ] ):0; + m_readOptions.Add( new ReadOptions() { Name = optionName , Selection = optionSelection , Timestamp = optionTimestamp }); + + } + } + + public void WriteToString( ref string nodeInfo ) + { + int optionsCount = m_passCustomOptionsUI.Count; + IOUtils.AddFieldValueToString( ref nodeInfo , optionsCount ); + for( int i = 0 ; i < optionsCount ; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo , m_passCustomOptionsUI[ i ].Options.Id ); + if( m_passCustomOptionsUI[ i ].Options.Type == AseOptionsType.Field ) + IOUtils.AddFieldValueToString( ref nodeInfo , m_passCustomOptionsUI[ i ].FieldValue.WriteToSingle() ); + else + IOUtils.AddFieldValueToString( ref nodeInfo , m_passCustomOptionsUI[ i ].CurrentOption ); + + IOUtils.AddFieldValueToString( ref nodeInfo , m_passCustomOptionsUI[ i ].LastClickedTimestamp ); + } + + } + + public void SetReadOptions() + { + if( m_readOptions != null ) + { + for( int i = 0 ; i < m_readOptions.Count ; i++ ) + { + if( m_passCustomOptionsUIDict.ContainsKey( m_readOptions[ i ].Name ) ) + { + m_passCustomOptionsUIDict[ m_readOptions[ i ].Name ].LastClickedTimestamp = m_readOptions[ i ].Timestamp; + if( m_passCustomOptionsUIDict[ m_readOptions[ i ].Name ].Options.Type == AseOptionsType.Field ) + { + m_passCustomOptionsUIDict[ m_readOptions[ i ].Name ].FieldValue.ReadFromSingle( m_readOptions[ i ].Selection ); + foreach( var item in m_passCustomOptionsUIDict[ m_readOptions[ i ].Name ].Options.ActionsPerOption.Rows ) + { + if( item.Columns.Length > 0 && item.Columns[ 0 ].ActionType == AseOptionsActionType.SetMaterialProperty ) + { + if( UIUtils.CurrentWindow.CurrentGraph.CurrentMaterial != null ) + { + if( UIUtils.CurrentWindow.CurrentGraph.CurrentMaterial.HasProperty( item.Columns[ 0 ].ActionData ) ) + { + m_passCustomOptionsUIDict[ m_readOptions[ i ].Name ].CurrentFieldValue = UIUtils.CurrentWindow.CurrentGraph.CurrentMaterial.GetFloat( item.Columns[ 0 ].ActionData ); + } + } + } + } + } + else + m_passCustomOptionsUIDict[ m_readOptions[ i ].Name ].CurrentOptionIdx = Convert.ToInt32( m_readOptions[ i ].Selection ); + } + } + } + } + + public void Refresh() + { + //int count = m_passCustomOptionsUI.Count; + //for( int i = 0; i < count; i++ ) + //{ + // m_passCustomOptionsUI[ i ].Refresh(); + //} + List sortedList = m_passCustomOptionsUI.OrderBy( item => item.LastClickedTimestamp ).ToList(); + int count = sortedList.Count; + for( int i = 0 ; i < count ; i++ ) + { + sortedList[ i ].Update(); + } + } + + public void CheckDisable() + { + int count = m_passCustomOptionsUI.Count; + for( int i = 0; i < count; i++ ) + { + m_passCustomOptionsUI[ i ].CheckEnDisable(false); + } + } + + public List PassCustomOptionsUI { get { return m_passCustomOptionsUI; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs.meta new file mode 100644 index 00000000..3b12d5af --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 389dcf32e61ce9d47b9a92ab691365d3 +timeCreated: 1544089703 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs new file mode 100644 index 00000000..926882a2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs @@ -0,0 +1,637 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +#define CUSTOM_OPTIONS_AVAILABLE +using UnityEngine; +using System; +using System.Collections.Generic; +using System.Text.RegularExpressions; + +namespace AmplifyShaderEditor +{ + + [Serializable] + public class TemplatePass + { + private const string DefaultPassNameStr = "SubShader {0} Pass {1}"; + + [SerializeField] + private int m_idx = -1; + + [SerializeField] + private bool m_isInvisible = false; + + [SerializeField] + private int m_invisibleOptions = 0; + + [SerializeField] + private bool m_isMainPass = false; + + [SerializeField] + private TemplateModulesData m_modules; + + [SerializeField] + private List m_inputDataList = new List(); + private Dictionary m_inputDataDict = new Dictionary(); + + [SerializeField] + private TemplateFunctionData m_vertexFunctionData; + + [SerializeField] + private TemplateFunctionData m_fragmentFunctionData; + + [SerializeField] + private VertexDataContainer m_vertexDataContainer; + + [SerializeField] + private TemplateInterpData m_interpolatorDataContainer; + + [SerializeField] + private TemplateTessVControlTag m_tessVControlTag; + + [SerializeField] + private TemplateTessControlData m_tessControlData; + + [SerializeField] + private TemplateTessDomainData m_tessDomainData; + + [SerializeField] + private List m_localVarsList = new List(); + + [SerializeField] + private string m_uniquePrefix; + + [SerializeField] + private TemplatePropertyContainer m_templateProperties = new TemplatePropertyContainer(); + + [SerializeField] + private List m_availableShaderGlobals = new List(); + + [SerializeField] + TemplateInfoContainer m_passNameContainer = new TemplateInfoContainer(); +#if CUSTOM_OPTIONS_AVAILABLE + [SerializeField] + TemplateOptionsContainer m_customOptionsContainer = new TemplateOptionsContainer(); +#endif + public TemplatePass( TemplateMultiPass template, TemplateSubShader subShader, int subshaderIdx, int passIdx, TemplateIdManager idManager, string uniquePrefix, int offsetIdx, TemplatePassInfo passInfo, ref Dictionary duplicatesHelper ) + { + m_idx = passIdx; + + m_uniquePrefix = uniquePrefix; + idManager.RegisterPassId( passInfo.Data ); + m_isMainPass = passInfo.Data.Contains( TemplatesManager.TemplateMainPassTag ); + if( !m_isMainPass ) + { + string id = string.Empty; + int idIndex = 0; + m_isInvisible = TemplateHelperFunctions.FetchInvisibleInfo( passInfo.Data, ref m_invisibleOptions, ref id, ref idIndex ); + if( m_isInvisible ) + { + idManager.RegisterId( idIndex, uniquePrefix + id, id, true ); + } + } + + FetchPassName( offsetIdx, passInfo.Data ); + if( m_passNameContainer.Index > -1 ) + { + idManager.RegisterId( m_passNameContainer.Index, uniquePrefix + m_passNameContainer.Id, m_passNameContainer.Id ); + } + else + { + m_passNameContainer.Data = string.Format( DefaultPassNameStr, subshaderIdx, passIdx ); + } + +#if CUSTOM_OPTIONS_AVAILABLE + m_customOptionsContainer = TemplateOptionsToolsHelper.GenerateOptionsContainer( false, passInfo.Data ); + if( m_customOptionsContainer.Enabled ) + { + idManager.RegisterId( m_customOptionsContainer.Index, uniquePrefix + m_customOptionsContainer.Body, m_customOptionsContainer.Body, true ); + } + //m_customOptionsContainer.CopyPortOptionsFrom( subShader.CustomOptionsContainer, m_passNameContainer.Data ); +#endif + m_modules = new TemplateModulesData( m_customOptionsContainer,idManager, m_templateProperties, uniquePrefix + "Module", offsetIdx, passInfo.Data, false ); + + if( !m_modules.PassTag.IsValid ) + { + m_modules.PassTag.StartIdx = passInfo.GlobalStartIdx; + m_templateProperties.AddId( passInfo.Data, m_modules.PassTag.Id, passInfo.LocalStartIdx, false ); + //m_modules.PassTag.StartIdx -= m_templateProperties.PropertyDict[ m_modules.PassTag.Id ].Indentation.Length; + //m_templateProperties.PropertyDict[ m_modules.PassTag.Id ].UseIndentationAtStart = false; + idManager.RegisterId( m_modules.PassTag.StartIdx, m_modules.UniquePrefix + m_modules.PassTag.Id, string.Empty ); + } + m_modules.SetPassUniqueNameIfUndefined( m_passNameContainer.Data ); + + m_modules.SRPType = subShader.Modules.SRPType; + if( m_modules.SRPType == TemplateSRPType.HDRP ) + { + m_modules.SRPIsPBR = passInfo.Data.Contains( TemplateHelperFunctions.HDPBRTag ); + + } + + Dictionary ownDuplicatesDict = new Dictionary( duplicatesHelper ); + TemplateHelperFunctions.CreateShaderGlobalsList( passInfo.Data, ref m_availableShaderGlobals, ref ownDuplicatesDict,subshaderIdx,passIdx ); + if( m_modules.SRPType == TemplateSRPType.BiRP ) + { + TemplateHelperFunctions.CheckUnityBuiltinGlobalMacros( passInfo.Data, ref m_availableShaderGlobals, ref ownDuplicatesDict, subshaderIdx, passIdx ); + } + + // Vertex and Interpolator data + FetchVertexAndInterpData( template, subShader.Modules, offsetIdx, passInfo.Data ); + if( m_vertexDataContainer != null ) + idManager.RegisterId( m_vertexDataContainer.VertexDataStartIdx, uniquePrefix + m_vertexDataContainer.VertexDataId, m_vertexDataContainer.VertexDataId ); + + if( m_interpolatorDataContainer != null ) + idManager.RegisterId( m_interpolatorDataContainer.InterpDataStartIdx, uniquePrefix + m_interpolatorDataContainer.InterpDataId, m_interpolatorDataContainer.InterpDataId ); + + //Fetch function code areas + FetchCodeAreas( offsetIdx, TemplatesManager.TemplateVertexCodeBeginArea, MasterNodePortCategory.Vertex, passInfo.Data ); + if( m_vertexFunctionData != null ) + idManager.RegisterId( m_vertexFunctionData.Position, uniquePrefix + m_vertexFunctionData.Id, m_vertexFunctionData.Id ); + + FetchCodeAreas( offsetIdx, TemplatesManager.TemplateFragmentCodeBeginArea, MasterNodePortCategory.Fragment, passInfo.Data ); + if( m_fragmentFunctionData != null ) + idManager.RegisterId( m_fragmentFunctionData.Position, uniquePrefix + m_fragmentFunctionData.Id, m_fragmentFunctionData.Id ); + + //Fetching inputs, must be do + if( m_fragmentFunctionData != null ) + FetchInputs( offsetIdx, MasterNodePortCategory.Fragment, passInfo.Data ); + + if( m_vertexFunctionData != null ) + FetchInputs( offsetIdx, MasterNodePortCategory.Vertex, passInfo.Data ); + + FetchTessellationData( template, subShader.Modules, offsetIdx, passInfo.Data ); + if( m_tessVControlTag != null ) + idManager.RegisterId( m_tessVControlTag.StartIdx, uniquePrefix + m_tessVControlTag.Id, m_tessVControlTag.Id ); + + if( m_tessControlData != null ) + idManager.RegisterId( m_tessControlData.StartIdx, uniquePrefix + m_tessControlData.Id, m_tessControlData.Id ); + + if( m_tessDomainData != null ) + idManager.RegisterId( m_tessDomainData.StartIdx, uniquePrefix + m_tessDomainData.Id, m_tessDomainData.Id ); + + TemplateHelperFunctions.FetchInlineVars( passInfo.Data, ref idManager ); + + //Fetch local variables must be done after fetching code areas as it needs them to see is variable is on vertex or fragment + TemplateHelperFunctions.FetchLocalVars( passInfo.Data, ref m_localVarsList, m_vertexFunctionData, m_fragmentFunctionData ); + + int localVarCount = m_localVarsList.Count; + if( localVarCount > 0 ) + { + idManager.RegisterTag( TemplatesManager.TemplateLocalVarTag ); + for( int i = 0; i < localVarCount; i++ ) + { + if( m_localVarsList[ i ].IsSpecialVar ) + { + idManager.RegisterTag( m_localVarsList[ i ].Id ); + } + } + } + + int inputsCount = m_inputDataList.Count; + for( int i = 0; i < inputsCount; i++ ) + { + if( m_inputDataList[ i ] != null ) + idManager.RegisterId( m_inputDataList[ i ].TagGlobalStartIdx, uniquePrefix + m_inputDataList[ i ].TagId, m_inputDataList[ i ].TagId ); + } + + //int passEndIndex = passInfo.Data.LastIndexOf( "}" ); + //if( passEndIndex > 0 ) + //{ + // int identationIndex = -1; + // for( int i = passEndIndex; i >= 0; i-- ) + // { + // if( passInfo.Data[ i ] == TemplatesManager.TemplateNewLine ) + // { + // identationIndex = i + 1; + // break; + // } + + // if( i == 0 ) + // { + // identationIndex = 0; + // } + // } + + // if( identationIndex > -1 ) + // { + // int length = passEndIndex - identationIndex; + // string indentation = ( length > 0 ) ? passInfo.Data.Substring( identationIndex, length ) : string.Empty; + // TemplateProperty templateProperty = new TemplateProperty( TemplatesManager.TemplateEndPassTag, indentation, false ); + // m_templateProperties.AddId( templateProperty ); + // idManager.RegisterId( offsetIdx + passEndIndex, uniquePrefix + TemplatesManager.TemplateEndPassTag, string.Empty ); + // } + //} + + ownDuplicatesDict.Clear(); + ownDuplicatesDict = null; + } + + public void Destroy() + { + m_passNameContainer = null; +#if CUSTOM_OPTIONS_AVAILABLE + m_customOptionsContainer = null; +#endif + if( m_templateProperties != null ) + m_templateProperties.Destroy(); + + m_templateProperties = null; + + if( m_modules != null ) + m_modules.Destroy(); + + m_modules = null; + + if( m_inputDataList != null ) + m_inputDataList.Clear(); + + m_inputDataList = null; + + if( m_inputDataDict != null ) + m_inputDataDict.Clear(); + + m_inputDataDict = null; + + m_vertexFunctionData = null; + m_fragmentFunctionData = null; + + if( m_vertexDataContainer != null ) + m_vertexDataContainer.Destroy(); + + m_vertexDataContainer = null; + + m_tessVControlTag = null; + + m_tessControlData = null; + + m_tessDomainData = null; + + if( m_interpolatorDataContainer != null ) + m_interpolatorDataContainer.Destroy(); + + if( m_localVarsList != null ) + { + m_localVarsList.Clear(); + m_localVarsList = null; + } + + m_interpolatorDataContainer = null; + + if( m_availableShaderGlobals != null ) + m_availableShaderGlobals.Clear(); + + m_availableShaderGlobals = null; + } + + public TemplateInputData InputDataFromId( int id ) + { + if( m_inputDataDict == null ) + m_inputDataDict = new Dictionary(); + + if( m_inputDataDict.Count != m_inputDataList.Count ) + { + m_inputDataDict.Clear(); + for( int i = 0; i < m_inputDataList.Count; i++ ) + { + m_inputDataDict.Add( m_inputDataList[ i ].PortUniqueId, m_inputDataList[ i ] ); + } + } + + if( m_inputDataDict.ContainsKey( id ) ) + return m_inputDataDict[ id ]; + + return null; + } + + void FetchPassName( int offsetIdx, string body ) + { + Match match = Regex.Match( body, TemplateHelperFunctions.PassNamePattern ); + if( match != null && match.Groups.Count > 1 ) + { + m_passNameContainer.Id = match.Groups[ 0 ].Value; + m_passNameContainer.Data = match.Groups[ 1 ].Value; + m_passNameContainer.Index = offsetIdx + match.Index; + } + } + + void FetchTessellationData( TemplateMultiPass template, TemplateModulesData subShaderModule, int offsetIdx, string body ) + { + // Tessellation VControl Tag + try + { + int vcontrolcodeBegin = body.IndexOf( TemplatesManager.TemplateTessVControlTag ); + if( vcontrolcodeBegin > -1 ) + { + m_tessVControlTag = new TemplateTessVControlTag(); + m_tessVControlTag.Id = TemplatesManager.TemplateTessVControlTag; + m_tessVControlTag.StartIdx = offsetIdx + vcontrolcodeBegin; + + m_templateProperties.AddId( body, m_tessVControlTag.Id ); + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + // Tessellation Control Data + try + { + int controlCodeBegin = body.IndexOf( TemplatesManager.TemplateTessControlCodeArea ); + if( controlCodeBegin > -1 ) + { + int beginIdx = controlCodeBegin + TemplatesManager.TemplateTessControlCodeArea.Length; + int endIdx = body.IndexOf( TemplatesManager.TemplateEndOfLine, beginIdx ); + int length = endIdx - beginIdx; + + string parameters = body.Substring( beginIdx, length ); + + string[] parametersArr = parameters.Split( IOUtils.FIELD_SEPARATOR ); + + string id = body.Substring( controlCodeBegin, endIdx + TemplatesManager.TemplateEndOfLine.Length - controlCodeBegin ); + string inParameters = parametersArr[ 0 ]; + string outParameters = ( parametersArr.Length > 1 ) ? parametersArr[ 1 ] : string.Empty; + + m_tessControlData = new TemplateTessControlData( offsetIdx + controlCodeBegin, id, inParameters, outParameters ); + + m_templateProperties.AddId( body, id ); + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + // Tessellation Domain Data + try + { + int domainCodeBegin = body.IndexOf( TemplatesManager.TemplateTessDomainCodeArea ); + if( domainCodeBegin > -1 ) + { + int beginIdx = domainCodeBegin + TemplatesManager.TemplateTessDomainCodeArea.Length; + int endIdx = body.IndexOf( TemplatesManager.TemplateEndOfLine, beginIdx ); + int length = endIdx - beginIdx; + + string parameters = body.Substring( beginIdx, length ); + + string[] parametersArr = parameters.Split( IOUtils.FIELD_SEPARATOR ); + + string id = body.Substring( domainCodeBegin, endIdx + TemplatesManager.TemplateEndOfLine.Length - domainCodeBegin ); + string inParameters = ( parametersArr.Length > 0 ) ? parametersArr[ 0 ] : string.Empty; + string outParameters = ( parametersArr.Length > 1 ) ? parametersArr[ 1 ] : string.Empty; + string baryParameters = ( parametersArr.Length > 2 ) ? parametersArr[ 2 ] : string.Empty; + + m_tessDomainData = new TemplateTessDomainData( offsetIdx + domainCodeBegin, id, inParameters, outParameters, baryParameters ); + + m_templateProperties.AddId( body, id ); + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + + void FetchVertexAndInterpData(TemplateMultiPass template, TemplateModulesData subShaderModule, int offsetIdx, string body ) + { + // Vertex Data + try + { + int vertexDataTagBegin = body.IndexOf( TemplatesManager.TemplateVertexDataTag ); + if( vertexDataTagBegin > -1 ) + { + m_vertexDataContainer = new VertexDataContainer(); + m_vertexDataContainer.VertexDataStartIdx = offsetIdx + vertexDataTagBegin; + int vertexDataTagEnd = body.IndexOf( TemplatesManager.TemplateEndOfLine, vertexDataTagBegin ); + m_vertexDataContainer.VertexDataId = body.Substring( vertexDataTagBegin, vertexDataTagEnd + TemplatesManager.TemplateEndOfLine.Length - vertexDataTagBegin ); + int dataBeginIdx = body.LastIndexOf( '{', vertexDataTagBegin, vertexDataTagBegin ); + int dataEndIdx = body.IndexOf( '}', vertexDataTagEnd ); + string vertexData = body.Substring( dataBeginIdx + 1, dataEndIdx - dataBeginIdx ); + + int parametersBegin = vertexDataTagBegin + TemplatesManager.TemplateVertexDataTag.Length; + string parameters = body.Substring( parametersBegin, vertexDataTagEnd - parametersBegin ); + m_vertexDataContainer.VertexData = TemplateHelperFunctions.CreateVertexDataList( vertexData, parameters ); + m_templateProperties.AddId( body, m_vertexDataContainer.VertexDataId ); + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + + // Available interpolators + try + { + int interpDataBegin = body.IndexOf( TemplatesManager.TemplateInterpolatorBeginTag ); + if( interpDataBegin > -1 ) + { + int interpDataEnd = body.IndexOf( TemplatesManager.TemplateEndOfLine, interpDataBegin ); + string interpDataId = body.Substring( interpDataBegin, interpDataEnd + TemplatesManager.TemplateEndOfLine.Length - interpDataBegin ); + + int dataBeginIdx = body.LastIndexOf( '{', interpDataBegin, interpDataBegin ); + int dataEndIdx = body.IndexOf( '}', interpDataEnd ); + string interpData = body.Substring( dataBeginIdx + 1, dataEndIdx - dataBeginIdx ); + + int interpolatorAmount = TemplateHelperFunctions.AvailableInterpolators[ "2.5" ]; + + if( m_modules.ShaderModel.IsValid ) + { + interpolatorAmount = m_modules.ShaderModel.InterpolatorAmount; + } + else if( subShaderModule.ShaderModel.IsValid ) + { + interpolatorAmount = subShaderModule.ShaderModel.InterpolatorAmount; + } + else if( template.GlobalShaderModel.IsValid ) + { + interpolatorAmount = template.GlobalShaderModel.InterpolatorAmount; + } + + m_interpolatorDataContainer = TemplateHelperFunctions.CreateInterpDataList( interpData, interpDataId, interpolatorAmount ); + m_interpolatorDataContainer.InterpDataId = interpDataId; + m_interpolatorDataContainer.InterpDataStartIdx = offsetIdx + interpDataBegin; + m_templateProperties.AddId( body, interpDataId ); + + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + + void FetchCodeAreas( int offsetIdx, string begin, MasterNodePortCategory category, string body ) + { + int areaBeginIndexes = body.IndexOf( begin ); + if( areaBeginIndexes > -1 ) + { + int beginIdx = areaBeginIndexes + begin.Length; + int endIdx = body.IndexOf( TemplatesManager.TemplateEndOfLine, beginIdx ); + int length = endIdx - beginIdx; + + string parameters = body.Substring( beginIdx, length ); + + string[] parametersArr = parameters.Split( IOUtils.FIELD_SEPARATOR ); + + string id = body.Substring( areaBeginIndexes, endIdx + TemplatesManager.TemplateEndOfLine.Length - areaBeginIndexes ); + string inParameters = parametersArr[ 0 ]; + string outParameters = ( parametersArr.Length > 1 ) ? parametersArr[ 1 ] : string.Empty; + if( category == MasterNodePortCategory.Fragment ) + { + string mainBodyName = string.Empty; + int mainBodyLocalIndex = -1; + + Match mainBodyNameMatch = Regex.Match( body, TemplateHelperFunctions.FragmentPragmaPattern ); + if( mainBodyNameMatch != null && mainBodyNameMatch.Groups.Count == 2 ) + { + mainBodyName = mainBodyNameMatch.Groups[ 1 ].Value; + string pattern = string.Format( TemplateHelperFunctions.FunctionBodyStartPattern, mainBodyName ); + Match mainBodyIdMatch = Regex.Match( body, pattern ); + if( mainBodyIdMatch != null && mainBodyIdMatch.Groups.Count > 0 ) + { + mainBodyLocalIndex = mainBodyIdMatch.Index; + } + + } + + m_fragmentFunctionData = new TemplateFunctionData( mainBodyLocalIndex, mainBodyName, id, offsetIdx + areaBeginIndexes, inParameters, outParameters, category ); + } + else + { + string mainBodyName = string.Empty; + int mainBodyLocalIndex = -1; + + Match mainBodyNameMatch = Regex.Match( body, TemplateHelperFunctions.VertexPragmaPattern ); + if( mainBodyNameMatch != null && mainBodyNameMatch.Groups.Count == 2 ) + { + mainBodyName = mainBodyNameMatch.Groups[ 1 ].Value; + string pattern = string.Format( TemplateHelperFunctions.FunctionBodyStartPattern, mainBodyName ); + Match mainBodyIdMatch = Regex.Match( body, pattern ); + if( mainBodyIdMatch != null && mainBodyIdMatch.Groups.Count > 0 ) + { + mainBodyLocalIndex = mainBodyIdMatch.Index; + } + } + + m_vertexFunctionData = new TemplateFunctionData( mainBodyLocalIndex, mainBodyName, id, offsetIdx + areaBeginIndexes, inParameters, outParameters, category ); + } + m_templateProperties.AddId( body, id, true ); + } + } + + void FetchInputs( int offset, MasterNodePortCategory portCategory, string body ) + { + string beginTag = ( portCategory == MasterNodePortCategory.Fragment ) ? TemplatesManager.TemplateInputsFragBeginTag : TemplatesManager.TemplateInputsVertBeginTag; + int[] inputBeginIndexes = body.AllIndexesOf( beginTag ); + if( inputBeginIndexes != null && inputBeginIndexes.Length > 0 ) + { + for( int i = 0; i < inputBeginIndexes.Length; i++ ) + { + int inputEndIdx = body.IndexOf( TemplatesManager.TemplateEndSectionTag, inputBeginIndexes[ i ] ); + int defaultValueBeginIdx = inputEndIdx + TemplatesManager.TemplateEndSectionTag.Length; + int endLineIdx = body.IndexOf( TemplatesManager.TemplateFullEndTag, defaultValueBeginIdx ); + + string defaultValue = body.Substring( defaultValueBeginIdx, endLineIdx - defaultValueBeginIdx ); + string tagId = body.Substring( inputBeginIndexes[ i ], endLineIdx + TemplatesManager.TemplateFullEndTag.Length - inputBeginIndexes[ i ] ); + + int beginIndex = inputBeginIndexes[ i ] + beginTag.Length; + int length = inputEndIdx - beginIndex; + string inputData = body.Substring( beginIndex, length ); + string[] inputDataArray = inputData.Split( IOUtils.FIELD_SEPARATOR ); + + if( inputDataArray != null && inputDataArray.Length > 0 ) + { + try + { + string portName = inputDataArray[ (int)TemplatePortIds.Name ]; + WirePortDataType dataType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), inputDataArray[ (int)TemplatePortIds.DataType ].ToUpper() ); + if( inputDataArray.Length == 3 ) + { + int portOrderId = m_inputDataList.Count; + int portUniqueId = -1; + bool isInt = int.TryParse( inputDataArray[ 2 ], out portUniqueId ); + if( isInt ) + { + if( portUniqueId < 0 ) + portUniqueId = m_inputDataList.Count; + + m_inputDataList.Add( new TemplateInputData( inputBeginIndexes[ i ], offset + inputBeginIndexes[ i ], tagId, portName, defaultValue, dataType, portCategory, portUniqueId, portOrderId, string.Empty ) ); + m_templateProperties.AddId( body, tagId, false ); + } + else + { + portUniqueId = m_inputDataList.Count; + m_inputDataList.Add( new TemplateInputData( inputBeginIndexes[ i ], offset + inputBeginIndexes[ i ], tagId, portName, defaultValue, dataType, portCategory, portUniqueId, portOrderId, inputDataArray[ 2 ] ) ); + m_templateProperties.AddId( body, tagId, false ); + } + } + else + { + int portUniqueIDArrIdx = (int)TemplatePortIds.UniqueId; + int portUniqueId = ( portUniqueIDArrIdx < inputDataArray.Length ) ? Convert.ToInt32( inputDataArray[ portUniqueIDArrIdx ] ) : -1; + if( portUniqueId < 0 ) + portUniqueId = m_inputDataList.Count; + + int portOrderArrayIdx = (int)TemplatePortIds.OrderId; + int portOrderId = ( portOrderArrayIdx < inputDataArray.Length ) ? Convert.ToInt32( inputDataArray[ portOrderArrayIdx ] ) : -1; + if( portOrderId < 0 ) + portOrderId = m_inputDataList.Count; + + int portLinkIdx = (int)TemplatePortIds.Link; + string linkId = ( portLinkIdx < inputDataArray.Length ) ? inputDataArray[ portLinkIdx ] : string.Empty; + m_inputDataList.Add( new TemplateInputData( inputBeginIndexes[ i ], offset + inputBeginIndexes[ i ], tagId, portName, defaultValue, dataType, portCategory, portUniqueId, portOrderId, linkId ) ); + m_templateProperties.AddId( body, tagId, false ); + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + } + } + } + +#if CUSTOM_OPTIONS_AVAILABLE + public TemplateOptionsContainer CustomOptionsContainer { get { return m_customOptionsContainer; } } +#endif + public TemplateModulesData Modules { get { return m_modules; } } + public List InputDataList { get { return m_inputDataList; } } + public TemplateFunctionData VertexFunctionData { get { return m_vertexFunctionData; } } + public TemplateFunctionData FragmentFunctionData { get { return m_fragmentFunctionData; } } + public VertexDataContainer VertexDataContainer { get { return m_vertexDataContainer; } } + public TemplateInterpData InterpolatorDataContainer { get { return m_interpolatorDataContainer; } } + public TemplateTessVControlTag TessVControlTag { get { return m_tessVControlTag; } } + public TemplateTessControlData TessControlData { get { return m_tessControlData; } } + public TemplateTessDomainData TessDomainData { get { return m_tessDomainData; } } + public string UniquePrefix { get { return m_uniquePrefix; } } + public TemplatePropertyContainer TemplateProperties { get { return m_templateProperties; } } + public List AvailableShaderGlobals { get { return m_availableShaderGlobals; } } + public List LocalVarsList { get { return m_localVarsList; } } + public TemplateInfoContainer PassNameContainer { get { return m_passNameContainer; } } + public bool IsMainPass { get { return m_isMainPass; } set { m_isMainPass = value; } } + public bool IsInvisible { get { return m_isInvisible; } } + public int InvisibleOptions { get { return m_invisibleOptions; } } + public int Idx { get { return m_idx; } } + public bool AddToList + { + get + { + if( m_isInvisible ) + { + return ( m_inputDataList.Count > 0 ); + } + + return true; + } + } + public bool HasValidFunctionBody + { + get + { + if( m_fragmentFunctionData != null || m_vertexFunctionData != null ) + return true; + return false; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs.meta new file mode 100644 index 00000000..65df9ed6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1e6749bf88e2d0f4ab5812f084973f4c +timeCreated: 1517831575 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs new file mode 100644 index 00000000..333e1ff6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs @@ -0,0 +1,175 @@ +using UnityEditor; +using UnityEngine; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class PassVisibleOptionsItems + { + public bool Visible; + public string Name; + public int Idx = -1; + } + + [Serializable] + public class TemplatePassSelectorHelper + { + private const string Label = " Available Passes"; + + [SerializeField] + private bool m_foldout; + + [SerializeField] + private PassVisibleOptionsItems[] m_currentPasses; + + [NonSerialized] + private Dictionary m_currentPassesDict; + + [SerializeField] + private int m_mainPassId; + + public void CopyFrom( TemplatePassSelectorHelper from ) + { + for( int i = 0; i < from.AvailablePasses.Length; i++ ) + { + SetPassVisible( from.AvailablePasses[ i ].Name, from.AvailablePasses[ i ].Visible ); + } + } + + public void Setup( TemplateSubShader subShader ) + { + if( m_currentPasses == null ) + { + m_currentPassesDict = new Dictionary(); + m_currentPasses = new PassVisibleOptionsItems[ subShader.Passes.Count ]; + for( int i = 0; i < m_currentPasses.Length; i++ ) + { + if( subShader.Passes[ i ].IsMainPass ) + m_mainPassId = i; + + m_currentPasses[ i ] = new PassVisibleOptionsItems() { Name = subShader.Passes[ i ].PassNameContainer.Data, Visible = true, Idx = i }; + m_currentPassesDict.Add( m_currentPasses[ i ].Name, m_currentPasses[ i ] ); + } + } + } + + public void Clear() + { + m_currentPasses = null; + + if( m_currentPassesDict != null ) + m_currentPassesDict.Clear(); + + m_currentPassesDict = null; + } + + public void Reset() + { + for ( int i = 0; i < m_currentPasses.Length; i++ ) + { + m_currentPasses[ i ].Visible = true; + } + } + + public void Destroy() + { + m_currentPasses = null; + + if( m_currentPassesDict != null ) + m_currentPassesDict.Clear(); + + m_currentPassesDict = null; + } + + public void Draw( TemplateMultiPassMasterNode owner ) + { + if( m_currentPasses.Length < 2 ) + return; + + NodeUtils.DrawNestedPropertyGroup( ref m_foldout, Label, () => + { + for( int i = 0; i < m_currentPasses.Length; i++ ) + { + EditorGUI.BeginChangeCheck(); + m_currentPasses[ i ].Visible = owner.EditorGUILayoutToggleLeft( m_currentPasses[ i ].Name, m_currentPasses[ i ].Visible ); + if( EditorGUI.EndChangeCheck() ) + { + owner.ContainerGraph.GetMultiPassMasterNodes( owner.LODIndex)[ m_currentPasses[ i ].Idx ].IsInvisible = !m_currentPasses[ i ].Visible; + } + + } + EditorGUILayout.Space(); + } ); + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + int passAmount = Convert.ToInt32( nodeParams[ index++ ] ); + for( int i = 0; i < passAmount; i++ ) + { + bool value = Convert.ToBoolean( nodeParams[ index++ ] ); + if( i < m_currentPasses.Length ) + { + m_currentPasses[ i ].Visible = value; + } + } + } + + public void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentPasses.Length ); + for( int i = 0; i < m_currentPasses.Length; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentPasses[ i ].Visible ); + } + } + + public void SetPassVisible( string passName, bool visible ) + { + bool refresh = false; + if( m_currentPassesDict == null ) + { + m_currentPassesDict = new Dictionary(); + refresh = true; + } + else if( m_currentPassesDict.Count != m_currentPasses.Length ) + { + refresh = true; + } + + if( refresh ) + { + for( int i = 0; i < m_currentPasses.Length; i++ ) + { + m_currentPassesDict.Add( m_currentPasses[ i ].Name, m_currentPasses[ i ] ); + } + } + + if( m_currentPassesDict.ContainsKey( passName ) ) + { + m_currentPassesDict[ passName ].Visible = visible; + } + } + + public int LastActivePass + { + get + { + if( m_currentPasses != null ) + { + for( int i = m_currentPasses.Length - 1; i > -1; i-- ) + { + if( m_currentPasses[ i ].Visible ) + return i; + } + } + m_currentPasses[ m_mainPassId ].Visible = true; + return m_mainPassId; + } + } + public bool IsVisible( int passId ) { return m_currentPasses[ passId ].Visible; } + private PassVisibleOptionsItems[] AvailablePasses { get { return m_currentPasses; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs.meta new file mode 100644 index 00000000..1dfe2403 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1340693b71fe44846bb72eb1035f138d +timeCreated: 1542731803 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs new file mode 100644 index 00000000..d79e0b3e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs @@ -0,0 +1,180 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEditor; +using UnityEngine; +using System.IO; +using System.Security.AccessControl; +using System.Security.Principal; +using System.Text.RegularExpressions; +using Debug = UnityEngine.Debug; + +namespace AmplifyShaderEditor +{ + public sealed class TemplatePostProcessor : AssetPostprocessor + { + public static TemplatesManager DummyManager; + public static void Destroy() + { + if( DummyManager != null ) + { + DummyManager.Destroy(); + ScriptableObject.DestroyImmediate( DummyManager ); + DummyManager = null; + } + } + + static void OnPostprocessAllAssets( string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths ) + { + ASEPackageManagerHelper.RequestInfo(); + ASEPackageManagerHelper.Update(); + + bool containsShaders = false; + for( int i = 0; i < importedAssets.Length; i++ ) + { + if( importedAssets[ i ].EndsWith( ".shader" ) ) + { + containsShaders = true; + break; + } + } + + // leave early if there's no shaders among the imports + if( !containsShaders ) + return; + + TemplatesManager templatesManager; + bool firstTimeDummyFlag = false; + if( UIUtils.CurrentWindow == null ) + { + if( DummyManager == null ) + { + DummyManager = ScriptableObject.CreateInstance(); + DummyManager.hideFlags = HideFlags.HideAndDontSave; + firstTimeDummyFlag = true; + } + templatesManager = DummyManager; + } + else + { + Destroy(); + templatesManager = UIUtils.CurrentWindow.TemplatesManagerInstance; + } + + if( templatesManager == null ) + { + return; + } + + if( !templatesManager.Initialized ) + { + templatesManager.Init(); + } + + bool refreshMenuItems = false; + for( int i = 0; i < importedAssets.Length; i++ ) + { + if( TemplateHelperFunctions.CheckIfTemplate( importedAssets[ i ] ) ) + { + string guid = AssetDatabase.AssetPathToGUID( importedAssets[ i ] ); + TemplateDataParent templateData = templatesManager.GetTemplate( guid ); + if( templateData != null ) + { + refreshMenuItems = templateData.Reload() || refreshMenuItems || firstTimeDummyFlag; + int windowCount = IOUtils.AllOpenedWindows.Count; + AmplifyShaderEditorWindow currWindow = UIUtils.CurrentWindow; + for( int windowIdx = 0; windowIdx < windowCount; windowIdx++ ) + { + if( IOUtils.AllOpenedWindows[ windowIdx ].OutsideGraph.CurrentCanvasMode == NodeAvailability.TemplateShader ) + { + if( IOUtils.AllOpenedWindows[ windowIdx ].OutsideGraph.MultiPassMasterNodes.NodesList[ 0 ].CurrentTemplate == templateData ) + { + UIUtils.CurrentWindow = IOUtils.AllOpenedWindows[ windowIdx ]; + IOUtils.AllOpenedWindows[ windowIdx ].OutsideGraph.ForceMultiPassMasterNodesRefresh(); + } + } + } + UIUtils.CurrentWindow = currWindow; + } + else + { + refreshMenuItems = true; + string name = TemplatesManager.OfficialTemplates.ContainsKey( guid ) ? TemplatesManager.OfficialTemplates[ guid ] : string.Empty; + TemplateMultiPass mp = TemplateMultiPass.CreateInstance(); + mp.Init( name, guid, AssetDatabase.GUIDToAssetPath( guid ), true ); + templatesManager.AddTemplate( mp ); + } + } + } + + if( deletedAssets.Length > 0 ) + { + if( deletedAssets[ 0 ].IndexOf( Constants.InvalidPostProcessDatapath ) < 0 ) + { + for( int i = 0; i < deletedAssets.Length; i++ ) + { + string guid = AssetDatabase.AssetPathToGUID( deletedAssets[ i ] ); + TemplateDataParent templateData = templatesManager.GetTemplate( guid ); + if( templateData != null ) + { + // Close any window using that template + int windowCount = IOUtils.AllOpenedWindows.Count; + for( int windowIdx = 0; windowIdx < windowCount; windowIdx++ ) + { + TemplateMasterNode masterNode = IOUtils.AllOpenedWindows[ windowIdx ].CurrentGraph.CurrentMasterNode as TemplateMasterNode; + if( masterNode != null && masterNode.CurrentTemplate.GUID.Equals( templateData.GUID ) ) + { + IOUtils.AllOpenedWindows[ windowIdx ].Close(); + } + } + + templatesManager.RemoveTemplate( templateData ); + refreshMenuItems = true; + } + } + } + } + + //for ( int i = 0; i < movedAssets.Length; i++ ) + //{ + // if ( TemplateHelperFunctions.CheckIfTemplate( movedAssets[ i ] ) ) + // { + // refreshMenuItems = true; + // break; + // } + //} + + //for ( int i = 0; i < movedFromAssetPaths.Length; i++ ) + //{ + // if ( TemplateHelperFunctions.CheckIfTemplate( movedFromAssetPaths[ i ] ) ) + // { + // refreshMenuItems = true; + // break; + // } + //} + + if( refreshMenuItems ) + { + //UnityEngine.Debug.Log( "Refresh Menu Items" ); + refreshMenuItems = false; + templatesManager.CreateTemplateMenuItems(); + + AmplifyShaderEditorWindow currWindow = UIUtils.CurrentWindow; + + int windowCount = IOUtils.AllOpenedWindows.Count; + for( int windowIdx = 0; windowIdx < windowCount; windowIdx++ ) + { + UIUtils.CurrentWindow = IOUtils.AllOpenedWindows[ windowIdx ]; + IOUtils.AllOpenedWindows[ windowIdx ].CurrentGraph.ForceCategoryRefresh(); + } + UIUtils.CurrentWindow = currWindow; + } + + // reimport menu items at the end of everything, hopefully preventing import loops + templatesManager.ReimportMenuItems(); + + // destroying the DummyManager, not doing so will create leaks over time + Destroy(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs.meta new file mode 100644 index 00000000..2bbd8f92 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d5f63490d6402e9488add7cbdfdd6872 +timeCreated: 1496739732 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateRenderPlatformHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateRenderPlatformHelper.cs new file mode 100644 index 00000000..063366a4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateRenderPlatformHelper.cs @@ -0,0 +1,80 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateRenderPlatformHelper : TemplateModuleData + { + [SerializeField] + private string m_id; + + [SerializeField] + private int m_index; + + [SerializeField] + private bool[] m_renderingPlatforms = null; + + private void CommonInit( bool initialValue ) + { + DataCheck = TemplateDataCheck.Valid; + int renderPlatformLength = RenderingPlatformOpHelper.RenderingPlatformsInfo.Length; + m_renderingPlatforms = new bool[ renderPlatformLength ]; + for( int i = 0 ; i < m_renderingPlatforms.Length ; i++ ) + { + m_renderingPlatforms[ i ] = initialValue; + } + } + + public void InitByTag(int index) + { + m_id = TemplatesManager.TemplateRenderPlatformsTag; + m_index = index; + CommonInit( true ); + + } + + public void InitByExcludeRenders( int index, string id ) + { + m_id = id; + m_index = index; + CommonInit( true ); + } + + public void InitByOnlyRenders( int index , string id ) + { + m_id = id; + m_index = index; + CommonInit( false ); + } + + public void SetupPlatform( string platformStr , bool value ) + { + try + { + RenderPlatforms platform = (RenderPlatforms)Enum.Parse( typeof( RenderPlatforms ) , platformStr ); + int index = -1; + if( RenderingPlatformOpHelper.PlatformToIndex.TryGetValue( platform , out index ) ) + { + m_renderingPlatforms[ index ] = value; + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + + public void Destroy() + { + m_renderingPlatforms = null; + } + + public bool[] RenderingPlatforms { get { return m_renderingPlatforms; } } + public string ID { get { return m_id; } } + public int Index { get { return m_index; } set{ m_index = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateRenderPlatformHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateRenderPlatformHelper.cs.meta new file mode 100644 index 00000000..15136d12 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateRenderPlatformHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3324f7aa07eb04d42bea8791af66cc15 +timeCreated: 1625564235 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateRenderPlatformHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs new file mode 100644 index 00000000..6f42c6f9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs @@ -0,0 +1,121 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; +using System.Collections.Generic; +using System.Text.RegularExpressions; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplatePassInfo + { + public string Modules; + public string Data; + public int GlobalStartIdx = -1; + public int LocalStartIdx = -1; + } + + [Serializable] + public class TemplateSubShaderInfo + { + public string Data; + public string Modules; + public int StartIdx = -1; + public List Passes = new List(); + public void Destroy() + { + Passes.Clear(); + Passes = null; + } + } + + [Serializable] + public class TemplateShaderInfo + { + public string Body; + public string Properties; + public int PropertyStartIdx = -1; + public List SubShaders = new List(); + public void Destroy() + { + int count = SubShaders.Count; + for( int i = 0; i < count; i++ ) + { + SubShaders[ i ].Destroy(); + } + SubShaders.Clear(); + SubShaders = null; + } + } + + public class TemplateShaderInfoUtil + { + public static TemplateShaderInfo CreateShaderData( string body ) + { + int nameBegin = body.IndexOf( TemplatesManager.TemplateShaderNameBeginTag ); + if( nameBegin < 0 ) + { + // Not a template + return null; + } + + TemplateShaderInfo shaderData = null; + //SHADER + MatchCollection shaderMatch = Regex.Matches( body, "\\bShader\\b" ); + if( shaderMatch.Count > 0 ) + { + //SUBSHADER + MatchCollection subShaderMatch = Regex.Matches( body, TemplatesManager.TemplateMPSubShaderTag ); + int subShaderAmount = subShaderMatch.Count; + if( subShaderAmount > 0 ) + { + shaderData = new TemplateShaderInfo(); + shaderData.Body = body; + int length = subShaderMatch[ 0 ].Index - shaderMatch[ 0 ].Groups[ 0 ].Index; + shaderData.Properties = body.Substring( shaderMatch[ 0 ].Index, length ); + shaderData.PropertyStartIdx = body.IndexOf( TemplatesManager.TemplatePropertyTag ); + + for( int subShaderIdx = 0; subShaderIdx < subShaderAmount; subShaderIdx++ ) + { + TemplateSubShaderInfo subShaderData = new TemplateSubShaderInfo(); + int subshaderBeginIndex = subShaderMatch[ subShaderIdx ].Index; + int subShaderEndIndex = ( subShaderIdx == ( subShaderAmount - 1 ) ) ? body.Length - 1 : subShaderMatch[ subShaderIdx + 1 ].Index; + subShaderData.Data = body.Substring( subshaderBeginIndex, subShaderEndIndex - subshaderBeginIndex ); + subShaderData.StartIdx = subshaderBeginIndex; + + //PASS + MatchCollection passMatch = Regex.Matches( subShaderData.Data, TemplatesManager.TemplatePassTagPattern ); + if( passMatch.Count == 0 ) + { + passMatch = Regex.Matches( subShaderData.Data, TemplatesManager.TemplateMPPassTag ); + } + + int passCount = passMatch.Count; + if( passCount > 0 ) + { + int lastPassIndex = subShaderData.Data.LastIndexOf( TemplatesManager.TemplatePassesEndTag ); + if( lastPassIndex < 0 ) + { + lastPassIndex = subShaderData.Data.Length - 1; + } + + subShaderData.Modules = subShaderData.Data.Substring( 0, passMatch[ 0 ].Index ); + for( int passIdx = 0; passIdx < passCount; passIdx++ ) + { + int passBeginIndex = passMatch[ passIdx ].Index; + int passEndIdx = ( passIdx == ( passCount - 1 ) ) ? lastPassIndex : passMatch[ passIdx + 1 ].Index; + TemplatePassInfo passData = new TemplatePassInfo(); + passData.Data = subShaderData.Data.Substring( passBeginIndex, passEndIdx - passBeginIndex ); + passData.GlobalStartIdx = subshaderBeginIndex + passBeginIndex; + passData.LocalStartIdx = passBeginIndex; + subShaderData.Passes.Add( passData ); + } + shaderData.SubShaders.Add( subShaderData ); + } + } + } + } + return shaderData; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs.meta new file mode 100644 index 00000000..5b2fb09d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 33fdd6a5fbc437a489acf58f5d82885c +timeCreated: 1516879445 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs new file mode 100644 index 00000000..4e00b763 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs @@ -0,0 +1,122 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + public sealed class TemplateShaderModelModule : TemplateModuleParent + { + private const string ShaderModelStr = "Shader Model"; + private const string ShaderModelFormatStr = "#pragma target "; + private const string ShaderModelEncapsulateFormatStr = "CGINCLUDE\n#pragma target {0}\nENDCG"; + + [SerializeField] + private int m_shaderModelIdx = 2; + + [SerializeField] + private bool m_encapsulateOnCGInlude = false; + + public TemplateShaderModelModule() : base("Shader Model"){ } + + public override void Draw( UndoParentNode owner, bool style = true ) + { + EditorGUI.BeginChangeCheck(); + m_shaderModelIdx = owner.EditorGUILayoutPopup( ShaderModelStr, m_shaderModelIdx, TemplateHelperFunctions.AvailableShaderModels ); + if( EditorGUI.EndChangeCheck() ) + { + m_isDirty = true; + } + } + + public void CopyFrom( TemplateShaderModelModule other , bool allData ) + { + if( allData ) + { + m_independentModule = other.IndependentModule; + m_encapsulateOnCGInlude = other.EncapsulateOnCGInlude; + } + + m_shaderModelIdx = other.CurrentShaderModelIdx; + } + + public void ReadFromString( TemplateModulesData modulesData , ref uint index, ref string[] nodeParams ) + { + bool validDataOnMeta = m_validData; + if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) + { + validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( validDataOnMeta ) + { + m_shaderModelIdx = Convert.ToInt32( nodeParams[ index++ ] ); + int templateModule = TemplateHelperFunctions.ShaderModelToArrayIdx[ modulesData.ShaderModel.Value ]; + if( templateModule > m_shaderModelIdx ) + { + if( Preferences.User.ForceTemplateMinShaderModel ) + { + m_shaderModelIdx = templateModule; + UIUtils.ShowMessage("Changing shader model to minimum set by template: " + modulesData.ShaderModel.Value+"\n"+ + "To disable this behavior please toggle off\n" + + "Preferences > Amplify Shader Editor > Force Template Min. Shader Model" , MessageSeverity.Warning ); + + } + } + + } + } + + public override void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_validData ); + if( m_validData ) + IOUtils.AddFieldValueToString( ref nodeInfo, m_shaderModelIdx ); + } + + public override string GenerateShaderData( bool isSubShader ) + { + if( m_encapsulateOnCGInlude ) + { + return string.Format( ShaderModelEncapsulateFormatStr, TemplateHelperFunctions.AvailableShaderModels[ m_shaderModelIdx ] ); + } + else + { + return ShaderModelFormatStr + TemplateHelperFunctions.AvailableShaderModels[ m_shaderModelIdx ]; + } + } + + public void ConfigureFromTemplateData( TemplateShaderModelData data ) + { + bool newValidData = ( data.DataCheck == TemplateDataCheck.Valid ); + + if( newValidData && m_validData != newValidData ) + { + m_independentModule = data.IndependentModule; + + if( TemplateHelperFunctions.ShaderModelToArrayIdx.ContainsKey( data.Value ) ) + { + m_shaderModelIdx = TemplateHelperFunctions.ShaderModelToArrayIdx[ data.Value ]; + } + m_encapsulateOnCGInlude = data.Encapsulate; + } + + m_validData = newValidData; + } + + public int CurrentShaderModelIdx { get { return m_shaderModelIdx; } } + public string CurrentShaderModel { get { return TemplateHelperFunctions.AvailableShaderModels[ m_shaderModelIdx ]; } } + public bool EncapsulateOnCGInlude { get { return m_encapsulateOnCGInlude; } } + public int InterpolatorAmount + { + get + { + return TemplateHelperFunctions.AvailableInterpolators[ TemplateHelperFunctions.AvailableShaderModels[ m_shaderModelIdx ] ]; + } + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs.meta new file mode 100644 index 00000000..991f5e52 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 33c15b597b8db18499c1b4a76035a552 +timeCreated: 1519899350 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs new file mode 100644 index 00000000..bb382832 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs @@ -0,0 +1,52 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateShaderPropertyData + { + public string PropertyInspectorName; + public string PropertyName; + public WirePortDataType PropertyDataType; + public PropertyType PropertyType; + + public int Index; + public string FullValue; + public string ReplacementValueHelper; + public string Identation; + + public bool IsMacro; + + public int SubShaderId; + public int PassId; + + public TemplateShaderPropertyData( int index, string fullValue, string identation, string propertyInspectorName, string propertyName, WirePortDataType propertyDataType, PropertyType propertyType,int subShaderId, int passId, bool isMacro = false ) + { + Index = index; + FullValue = fullValue; + Identation = identation; + PropertyInspectorName = string.IsNullOrEmpty( propertyInspectorName )?propertyName: propertyInspectorName; + PropertyName = propertyName; + PropertyDataType = propertyDataType; + PropertyType = propertyType; + int idx = FullValue.LastIndexOf( "=" ); + ReplacementValueHelper = ( idx >= 0 ) ? FullValue.Substring( 0, idx + 1 ) +" ": FullValue + " = "; + IsMacro = isMacro; + SubShaderId = subShaderId; + PassId = passId; + } + + public string CreatePropertyForValue( string value ) + { + return value.Contains( PropertyName ) ? Identation + value : ReplacementValueHelper + value; + } + + public override string ToString() + { + return string.Format( "{0}(\"{1}\", {2})", PropertyName, PropertyInspectorName,UIUtils.WirePortToCgType( PropertyDataType ) ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs.meta new file mode 100644 index 00000000..e34b1d81 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7d16f1d82f69ac945ac524dd877ce7fe +timeCreated: 1496341538 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs new file mode 100644 index 00000000..633bfcc4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs @@ -0,0 +1,723 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public enum ShaderPropertyScope + { + Shader, + SubShader, + Pass + } + + [Serializable] + [NodeAttributes( "Template Parameter" , "Constants And Properties" , "Select and use one of the pre-existing properties given by the template" )] + public sealed class TemplateShaderPropertyNode : TemplateNodeParent + { + private const string CurrentScopeStr = "Scope"; + private const string WarningStr = "Preview doesn't work with global variables"; + private const string PropertyLabelStr = "Parameter"; + private const string TypeLabelStr = "Type: "; + private const string PropertyNameStr = "Property Name: "; + + private int IntPropertyId; + private int FloatPropertyId; + private int VectorPropertyId; + private int Sampler2DPropertyId; + private int Sampler3DPropertyId; + private int SamplerCubePropertyId; + + [SerializeField] + private int m_currentPropertyIdx = -1; + + [SerializeField] + private string m_propertyName = string.Empty; + + [SerializeField] + private int m_propertyNameId = 0; + + [SerializeField] + private string m_typeName = string.Empty; + + [SerializeField] + private string m_propertyNameLabel = string.Empty; + + private bool m_fetchPropertyId = false; + private bool m_fetchScopeFromProperty = false; + + private List m_shaderProperties = null; + private string[] m_propertyLabels = null; + + private UpperLeftWidgetHelper m_upperLeftWidgetHelper = new UpperLeftWidgetHelper(); + + //Multi-Pass only properties + [SerializeField] + private ShaderPropertyScope m_currentScope = ShaderPropertyScope.Shader; + + [SerializeField] + private bool m_advancedView = false; + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_previewShaderGUID = "4feb2016be0ece148b8bf234508f6aa4"; + m_autoWrapProperties = true; + } + + void FetchScope() + { + int shaderScopeCount = m_templateMPData.AvailableShaderProperties.Count; + for( int i = 0 ; i < shaderScopeCount ; i++ ) + { + if( m_templateMPData.AvailableShaderProperties[ i ].PropertyName.Equals( m_propertyName ) ) + { + m_currentScope = ShaderPropertyScope.Shader; + } + } + + int subShaderScopeCount = m_templateMPData.SubShaders[ SubShaderIdx ].AvailableShaderGlobals.Count; + for( int i = 0 ; i < subShaderScopeCount ; i++ ) + { + if( m_templateMPData.SubShaders[ SubShaderIdx ].AvailableShaderGlobals[ i ].PropertyName.Equals( m_propertyName ) ) + { + m_currentScope = ShaderPropertyScope.SubShader; + } + } + + int passScopeCount = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].AvailableShaderGlobals.Count; + for( int i = 0 ; i < passScopeCount ; i++ ) + { + if( m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].AvailableShaderGlobals[ i ].PropertyName.Equals( m_propertyName ) ) + { + m_currentScope = ShaderPropertyScope.Pass; + } + } + } + + void FetchShaderProperties() + { + if( m_templateMPData == null ) + m_templateMPData = ( m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode ).CurrentTemplate; + + if( m_templateMPData != null ) + { + if( m_advancedView ) + { + switch( m_currentScope ) + { + case ShaderPropertyScope.Shader: + m_shaderProperties = m_templateMPData.AvailableShaderProperties; + break; + case ShaderPropertyScope.SubShader: + m_shaderProperties = m_templateMPData.SubShaders[ SubShaderIdx ].AvailableShaderGlobals; + break; + case ShaderPropertyScope.Pass: + m_shaderProperties = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].AvailableShaderGlobals; + break; + } + } + else + { + m_shaderProperties = m_templateMPData.AllShaderProperties; + + if( m_currentPropertyIdx < 0 && m_shaderProperties.Count > 0 ) + { + m_currentPropertyIdx = 0; + } + } + } + } + + public override void OnEnable() + { + base.OnEnable(); + IntPropertyId = Shader.PropertyToID( "_IntData" ); + FloatPropertyId = Shader.PropertyToID( "_FloatData" ); + VectorPropertyId = Shader.PropertyToID( "_VectorData" ); + Sampler2DPropertyId = Shader.PropertyToID( "_Sampler2DData" ); + Sampler3DPropertyId = Shader.PropertyToID( "_Sampler3DData" ); + SamplerCubePropertyId = Shader.PropertyToID( "_SamplerCubeData" ); + } + + public override void DrawProperties() + { + base.DrawProperties(); + if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) + { + return; + } + + EditorGUI.BeginChangeCheck(); + m_advancedView = EditorGUILayoutToggle( "Advanced View" , m_advancedView ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_advancedView ) + { + if( m_shaderProperties[ m_currentPropertyIdx ].PassId >= 0 ) + { + m_currentScope = ShaderPropertyScope.Pass; + PassIdx = m_shaderProperties[ m_currentPropertyIdx ].PassId; + SubShaderIdx = m_shaderProperties[ m_currentPropertyIdx ].SubShaderId; + } + else if( m_shaderProperties[ m_currentPropertyIdx ].SubShaderId >= 0 ) + { + m_currentScope = ShaderPropertyScope.SubShader; + SubShaderIdx = m_shaderProperties[ m_currentPropertyIdx ].SubShaderId; + PassIdx = 0; + } + else + { + m_currentScope = ShaderPropertyScope.Shader; + SubShaderIdx = 0; + PassIdx = 0; + } + } + + FetchShaderProperties(); + FetchPropertyId(); + } + + if( m_advancedView && m_multiPassMode ) + { + DrawMultipassProperties(); + } + + if( m_currentPropertyIdx > -1 ) + { + + bool hasProperties = ( m_shaderProperties != null && m_shaderProperties.Count > 0 ); + if( hasProperties ) + { + EditorGUI.BeginChangeCheck(); + m_currentPropertyIdx = EditorGUILayoutPopup( PropertyLabelStr , m_currentPropertyIdx , m_propertyLabels ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromId(); + } + EditorGUILayout.LabelField( m_typeName ); + if( m_shaderProperties[ m_currentPropertyIdx ].PropertyType != PropertyType.Global ) + { + EditorGUILayout.LabelField( m_propertyNameLabel ); + } + } + } + + } + + void DrawMultipassProperties() + { + EditorGUI.BeginChangeCheck(); + m_currentScope = (ShaderPropertyScope)EditorGUILayoutEnumPopup( CurrentScopeStr , m_currentScope ); + if( EditorGUI.EndChangeCheck() ) + { + FetchShaderProperties(); + FetchPropertyId(); + } + + bool showSubShader = false; + bool showPass = false; + switch( m_currentScope ) + { + case ShaderPropertyScope.SubShader: + { + showSubShader = true; + } + break; + case ShaderPropertyScope.Pass: + { + showSubShader = true; + showPass = true; + } + break; + } + + if( showSubShader ) + { + DrawSubShaderUI(); + } + + if( showPass ) + { + DrawPassUI(); + } + } + + protected override void OnSubShaderChange() + { + FetchShaderProperties(); + FetchPropertyId(); + } + + protected override void OnPassChange() + { + FetchShaderProperties(); + FetchPropertyId(); + } + + override protected void CheckWarningState() + { + if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) + { + ShowTab( NodeMessageType.Error , ErrorMessageStr ); + } + else + { + if( m_shaderProperties != null && + m_shaderProperties.Count > 0 && + m_shaderProperties.Count > m_currentPropertyIdx && + m_shaderProperties[ m_currentPropertyIdx ].PropertyType == PropertyType.Global && + m_showPreview ) + { + ShowTab( NodeMessageType.Info , WarningStr ); + } + else + { + m_showErrorMessage = false; + } + } + } + + public override void SetPreviewInputs() + { + if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) + return; + + if( m_shaderProperties == null || m_currentPropertyIdx >= m_shaderProperties.Count || m_currentPropertyIdx < 0 ) + return; + + if( m_shaderProperties[ m_currentPropertyIdx ].PropertyType == PropertyType.Global ) + { + m_additionalContent.text = string.Empty; + PreviewMaterial.SetInt( IntPropertyId , 0 ); + return; + } + + // @diogo: sacrificed material value display in order to have the node name in the title and property in subtitle + //Material currMat = m_containerGraph.CurrentMaterial; + //if( currMat != null && currMat.HasProperty( m_propertyNameId ) ) + //{ + // switch( m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType ) + // { + // case WirePortDataType.INT: + // { + // int value = currMat.GetInt( m_propertyNameId ); + // SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr , GenerateTitle( value ) ) ); + // PreviewMaterial.SetInt( IntPropertyId , value ); + // } + // break; + // case WirePortDataType.FLOAT: + // { + // float value = currMat.GetFloat( m_propertyNameId ); + // SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr , GenerateTitle( value ) ) ); + // PreviewMaterial.SetFloat( FloatPropertyId , value ); + // } + // break; + // case WirePortDataType.FLOAT4: + // { + // Vector4 value = currMat.GetVector( m_propertyNameId ); + // SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr , GenerateTitle( value.x , value.y , value.z , value.w ) ) ); + // PreviewMaterial.SetVector( VectorPropertyId , value ); + // } + // break; + // case WirePortDataType.COLOR: + // { + // Color value = currMat.GetColor( m_propertyNameId ); + // SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr , GenerateTitle( value.r , value.g , value.b , value.a ) ) ); + // PreviewMaterial.SetColor( VectorPropertyId , value ); + // } + // break; + // case WirePortDataType.SAMPLER2D: + // { + // Texture value = currMat.GetTexture( m_propertyNameId ); + // if( value ) + // SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr , value.name ) ); + // else + // SetAdditonalTitleText( string.Empty ); + // PreviewMaterial.SetTexture( Sampler2DPropertyId , value ); + // } + // break; + // case WirePortDataType.SAMPLER3D: + // { + // Texture value = currMat.GetTexture( m_propertyNameId ); + // if( value ) + // SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr , value.name ) ); + // else + // SetAdditonalTitleText( string.Empty ); + // PreviewMaterial.SetTexture( Sampler3DPropertyId , value ); + // } + // break; + // case WirePortDataType.SAMPLERCUBE: + // { + // Texture value = currMat.GetTexture( m_propertyNameId ); + // if( value ) + // SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr , value.name ) ); + // else + // SetAdditonalTitleText( string.Empty ); + // PreviewMaterial.SetTexture( SamplerCubePropertyId , value ); + // } + // break; + // case WirePortDataType.SAMPLER2DARRAY: + // { + // Texture value = currMat.GetTexture( m_propertyNameId ); + // if( value ) + // SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr , value.name ) ); + // else + // SetAdditonalTitleText( string.Empty ); + // PreviewMaterial.SetTexture( SamplerCubePropertyId , value ); + // } + // break; + // } + //} + //else + //{ + // SetAdditonalTitleText( string.Empty ); + //} + + SetAdditonalTitleText( m_propertyName ); + } + + public override void Draw( DrawInfo drawInfo ) + { + if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) + { + if( !m_showErrorMessage || m_errorMessageTypeIsError == NodeMessageType.Info ) + { + ShowTab( NodeMessageType.Error , ErrorMessageStr ); + } + } + else if( m_showErrorMessage ) + { + if( m_errorMessageTypeIsError == NodeMessageType.Error ) + HideTab(); + } + + base.Draw( drawInfo ); + if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) + return; + + if( m_shaderProperties == null ) + { + MasterNode masterNode = m_containerGraph.CurrentMasterNode; + if( masterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template ) + { + if( SetTemplate( masterNode ) ) + { + m_fetchPropertyId = true; + } + } + } + + if( m_fetchScopeFromProperty ) + { + m_fetchScopeFromProperty = false; + FetchScope(); + FetchShaderProperties(); + } + + if( m_fetchPropertyId ) + { + m_fetchPropertyId = false; + FetchPropertyId(); + } + + if( m_currentPropertyIdx > -1 ) + { + EditorGUI.BeginChangeCheck(); + m_currentPropertyIdx = m_upperLeftWidgetHelper.DrawWidget( this , m_currentPropertyIdx , m_propertyLabels ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromId(); + } + } + } + + void FetchPropertyId() + { + if( m_shaderProperties != null ) + { + m_currentPropertyIdx = 0; + m_propertyLabels = new string[ m_shaderProperties.Count ]; + for( int i = 0 ; i < m_shaderProperties.Count ; i++ ) + { + if( m_shaderProperties[ i ].PropertyName.Equals( m_propertyName ) ) + { + m_currentPropertyIdx = i; + } + m_propertyLabels[ i ] = m_shaderProperties[ i ].PropertyInspectorName; + } + UpdateFromId(); + } + else + { + m_currentPropertyIdx = -1; + } + } + + void UpdateFromId() + { + + if( m_shaderProperties != null ) + { + if( m_shaderProperties.Count == 0 ) + { + for( int i = 0 ; i < 4 ; i++ ) + m_containerGraph.DeleteConnection( false , UniqueId , i , false , true ); + + m_headerColor = UIUtils.GetColorFromCategory( "Default" ); + SetAdditonalTitleText( "" ); + m_additionalContent.text = string.Empty; + m_previewMaterialPassId = 1; + PreviewMaterial.SetFloat( FloatPropertyId , 0 ); + m_showPreview = false; + m_drawPreviewExpander = false; + m_outputPorts[ 0 ].ChangeProperties( "None" , WirePortDataType.FLOAT , false ); + ConfigurePorts(); + return; + } + + m_drawPreviewExpander = true; + bool areCompatible = TemplateHelperFunctions.CheckIfCompatibles( m_outputPorts[ 0 ].DataType , m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType ); + switch( m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType ) + { + case WirePortDataType.SAMPLER1D: + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.SAMPLER2DARRAY: + m_outputPorts[ 0 ].ChangeProperties( "Tex" , m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType , false ); + m_headerColor = UIUtils.GetColorFromCategory( "Textures" ); + break; + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue , m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType , false ); + m_headerColor = UIUtils.GetColorFromCategory( "Constants And Properties" ); + break; + case WirePortDataType.FLOAT4: + m_outputPorts[ 0 ].ChangeProperties( "XYZW" , m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType , false ); + m_headerColor = UIUtils.GetColorFromCategory( "Constants And Properties" ); + break; + case WirePortDataType.COLOR: + m_outputPorts[ 0 ].ChangeProperties( "RGBA" , m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType , false ); + m_headerColor = UIUtils.GetColorFromCategory( "Constants And Properties" ); + break; + default: + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + m_outputPorts[ 0 ].ChangeProperties( "Out" , m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType , false ); + m_headerColor = UIUtils.GetColorFromCategory( "Constants And Properties" ); + break; + } + + if( !areCompatible ) + { + for( int i = 0 ; i < 4 ; i++ ) + m_containerGraph.DeleteConnection( false , UniqueId , i , false , true ); + } + + ConfigurePorts(); + + m_propertyName = m_shaderProperties[ m_currentPropertyIdx ].PropertyName; + SetAdditonalTitleText( m_propertyName ); + m_propertyNameId = Shader.PropertyToID( m_propertyName ); + m_typeName = TypeLabelStr + m_shaderProperties[ m_currentPropertyIdx ].PropertyType.ToString(); + if( m_shaderProperties[ m_currentPropertyIdx ].PropertyType != PropertyType.Global ) + { + m_propertyNameLabel = PropertyNameStr + m_shaderProperties[ m_currentPropertyIdx ].PropertyName; + } + + m_sizeIsDirty = true; + Material currMat = m_containerGraph.CurrentMaterial; + if( currMat != null ) + { + if( m_shaderProperties[ m_currentPropertyIdx ].PropertyType == PropertyType.Global ) + { + m_previewMaterialPassId = 0; + if( !m_showErrorMessage && m_showPreview ) + { + ShowTab( NodeMessageType.Info , WarningStr ); + } + } + else + { + if( m_showErrorMessage && m_errorMessageTypeIsError != NodeMessageType.Error ) + { + HideTab(); + } + switch( m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType ) + { + case WirePortDataType.INT: m_previewMaterialPassId = 0; break; + case WirePortDataType.FLOAT: m_previewMaterialPassId = 1; break; + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: m_previewMaterialPassId = 2; break; + case WirePortDataType.SAMPLER2D: m_previewMaterialPassId = 3; break; + case WirePortDataType.SAMPLER3D: m_previewMaterialPassId = 4; break; + case WirePortDataType.SAMPLERCUBE: m_previewMaterialPassId = 5; break; + default: PreviewMaterial.SetPass( 0 ); break; + } + } + } + + CheckWarningState(); + } + } + + string GenerateTitle( params float[] values ) + { + //string finalResult = "( "; + string finalResult = string.Empty; + if( values.Length == 1 ) + { + finalResult += values[ 0 ].ToString( Mathf.Abs( values[ 0 ] ) > 1000 ? Constants.PropertyBigFloatFormatLabel : Constants.PropertyFloatFormatLabel ); + } + else + { + for( int i = 0 ; i < values.Length ; i++ ) + { + finalResult += values[ i ].ToString( Mathf.Abs( values[ i ] ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ); + if( i < ( values.Length - 1 ) ) + finalResult += ","; + } + } + //finalResult += " )"; + return finalResult; + } + + public override string GenerateShaderForOutput( int outputId , ref MasterNodeDataCollector dataCollector , bool ignoreLocalvar ) + { + if( dataCollector.MasterNodeCategory != AvailableShaderTypes.Template ) + { + UIUtils.ShowMessage( UniqueId , "Template Parameter node is only intended for templates use only" , MessageSeverity.Error ); + return m_outputPorts[ outputId ].ErrorValue; + } + + if( m_shaderProperties == null || m_shaderProperties.Count == 0 ) + { + UIUtils.ShowMessage( UniqueId , "Attempting to fetch inexistant parameter on " + m_nodeAttribs.Name + " node" , MessageSeverity.Error ); + return m_outputPorts[ outputId ].ErrorValue; + } + + if( m_multiPassMode ) + { + switch( m_currentScope ) + { + case ShaderPropertyScope.SubShader: + { + if( dataCollector.TemplateDataCollectorInstance.MultipassSubshaderIdx != SubShaderIdx ) + { + UIUtils.ShowMessage( UniqueId , string.Format( "{0} is only intended for subshader {1}" , m_propertyLabels[ m_currentPropertyIdx ] , SubShaderIdx ) ); + return m_outputPorts[ outputId ].ErrorValue; + } + } + break; + case ShaderPropertyScope.Pass: + { + if( dataCollector.TemplateDataCollectorInstance.MultipassSubshaderIdx != SubShaderIdx || + dataCollector.TemplateDataCollectorInstance.MultipassPassIdx != PassIdx + ) + { + UIUtils.ShowMessage( UniqueId , string.Format( "{0} is only intended for subshader {1} and pass {2}" , m_propertyLabels[ m_currentPropertyIdx ] , SubShaderIdx , PassIdx ) ); + return m_outputPorts[ outputId ].ErrorValue; + } + } + break; + } + } + + return GetOutputVectorItem( 0 , outputId , m_propertyName ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_propertyName = GetCurrentParam( ref nodeParams ); + m_propertyNameId = Shader.PropertyToID( m_propertyName ); + if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) + { + m_currentScope = (ShaderPropertyScope)Enum.Parse( typeof( ShaderPropertyScope ) , GetCurrentParam( ref nodeParams ) ); + } + else + { + m_fetchScopeFromProperty = true; + } + m_fetchPropertyId = true; + + if( UIUtils.CurrentShaderVersion() > 18502 ) + { + m_advancedView = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); + } + } + + public override void WriteToString( ref string nodeInfo , ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo , ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_propertyName ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_currentScope ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_advancedView ); + + } + + public override void OnMasterNodeReplaced( MasterNode newMasterNode ) + { + base.OnMasterNodeReplaced( newMasterNode ); + if( newMasterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template ) + { + SetTemplate( newMasterNode ); + if( m_fetchScopeFromProperty ) + { + m_fetchScopeFromProperty = false; + FetchScope(); + } + FetchShaderProperties(); + FetchPropertyId(); + //m_containerGraph.DeleteConnection( false, UniqueId, 0, false, true ); + } + } + + bool SetTemplate( MasterNode newMasterNode ) + { + if( m_containerGraph.MultiPassMasterNodes.NodesList.Count > 0 ) + { + m_multiPassMode = true; + TemplateMultiPassMasterNode templateMasterNode = ( newMasterNode as TemplateMultiPassMasterNode ); + if( templateMasterNode != null ) + { + m_templateMPData = templateMasterNode.CurrentTemplate; + UpdateSubShaderAmount(); + FetchShaderProperties(); + return true; + } + } + else + { + m_multiPassMode = false; + TemplateMasterNode templateMasterNode = ( newMasterNode as TemplateMasterNode ); + if( templateMasterNode != null ) + { + m_shaderProperties = templateMasterNode.CurrentTemplate.AvailableShaderProperties; + return true; + } + } + return false; + } + + public override void RefreshExternalReferences() + { + base.RefreshExternalReferences(); + CheckWarningState(); + } + + public override void Destroy() + { + base.Destroy(); + m_propertyLabels = null; + m_shaderProperties = null; + m_upperLeftWidgetHelper = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs.meta new file mode 100644 index 00000000..bca6181f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1579d32d6529f33418f210a5bd730436 +timeCreated: 1496398185 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs new file mode 100644 index 00000000..844e7411 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs @@ -0,0 +1,173 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using System.Text.RegularExpressions; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateSubShader + { + [SerializeField] + private int m_idx = -1; + + [SerializeField] + private List m_passes = new List(); + + [SerializeField] + private TemplateModulesData m_modules; + + [SerializeField] + private string m_uniquePrefix; + + [SerializeField] + private TemplatePropertyContainer m_templateProperties = new TemplatePropertyContainer(); + + [SerializeField] + private List m_availableShaderGlobals = new List(); + + [SerializeField] + private TemplateInfoContainer m_LODContainer = new TemplateInfoContainer(); + + [SerializeField] + private int m_passAmount = 0; + + [SerializeField] + private int m_mainPass = -1; + + [SerializeField] + private bool m_foundMainPassTag = false; + + [SerializeField] + TemplateOptionsContainer m_customOptionsContainer = new TemplateOptionsContainer(); + + public TemplateSubShader( TemplateMultiPass template , int subShaderIx , TemplateIdManager idManager , string uniquePrefix , TemplateSubShaderInfo subShaderInfo , ref Dictionary duplicatesHelper ) + { + m_idx = subShaderIx; + + m_uniquePrefix = uniquePrefix; + + FetchLOD( subShaderInfo.StartIdx , subShaderInfo.Modules ); + if( m_LODContainer.Index > -1 ) + { + idManager.RegisterId( m_LODContainer.Index , uniquePrefix + "Module" + m_LODContainer.Id , m_LODContainer.Id ); + } + + m_customOptionsContainer = TemplateOptionsToolsHelper.GenerateOptionsContainer( true , subShaderInfo.Data ); + if( m_customOptionsContainer.Enabled ) + { + idManager.RegisterId( m_customOptionsContainer.Index , uniquePrefix + m_customOptionsContainer.Body , m_customOptionsContainer.Body , true ); + } + + m_modules = new TemplateModulesData( m_customOptionsContainer , idManager , m_templateProperties , uniquePrefix + "Module" , subShaderInfo.StartIdx , subShaderInfo.Modules , true ); + if( m_modules.SRPType == TemplateSRPType.HDRP ) + { + m_modules.SRPIsPBR = subShaderInfo.Data.Contains( TemplateHelperFunctions.HDPBRTag ); + } + + Dictionary ownDuplicatesDict = new Dictionary( duplicatesHelper ); + + TemplateHelperFunctions.CreateShaderGlobalsList( subShaderInfo.Modules , ref m_availableShaderGlobals , ref ownDuplicatesDict , subShaderIx , -1 ); + if( m_modules.SRPType == TemplateSRPType.BiRP ) + { + TemplateHelperFunctions.CheckUnityBuiltinGlobalMacros( subShaderInfo.Modules , ref m_availableShaderGlobals , ref ownDuplicatesDict , subShaderIx , -1 ); + } + + m_passAmount = subShaderInfo.Passes.Count; + + //if( !m_modules.PassTag.IsValid ) + //{ + // m_modules.PassTag.StartIdx = subShaderData.Passes[ 0 ].GlobalStartIdx; + // m_templateProperties.AddId( subShaderData.Data, m_modules.PassTag.Id, subShaderData.Passes[ 0 ].LocalStartIdx, m_modules.PassTag.SearchIndentation ); + // m_modules.PassTag.StartIdx -= m_templateProperties.PropertyDict[ m_modules.PassTag.Id ].Indentation.Length; + // m_templateProperties.PropertyDict[ m_modules.PassTag.Id ].UseIndentationAtStart = true; + // idManager.RegisterId( m_modules.PassTag.StartIdx, m_modules.UniquePrefix + m_modules.PassTag.Id, string.Empty ); + //} + + int firstVisible = -1; + int currAddedPassIdx = 0; + for( int passIdx = 0 ; passIdx < m_passAmount ; passIdx++ ) + { + TemplatePass newPass = new TemplatePass( template , this , subShaderIx , passIdx , idManager , uniquePrefix + "Pass" + passIdx , subShaderInfo.Passes[ passIdx ].GlobalStartIdx , subShaderInfo.Passes[ passIdx ] , ref ownDuplicatesDict ); + if( newPass.AddToList ) + { + if( newPass.IsMainPass && m_mainPass < 0 ) + { + m_mainPass = currAddedPassIdx; + m_foundMainPassTag = true; + } + else if( !newPass.IsInvisible && firstVisible < 0 ) + { + firstVisible = currAddedPassIdx; + } + + m_passes.Add( newPass ); + currAddedPassIdx++; + } + else + { + newPass.Destroy(); + newPass = null; + } + + } + + if( m_mainPass < 0 ) + { + // If no main pass was set then choose the first visible one + m_mainPass = ( firstVisible < 0 ) ? 0 : firstVisible; + m_passes[ m_mainPass ].IsMainPass = true; + } + + ownDuplicatesDict.Clear(); + ownDuplicatesDict = null; + } + + public void Destroy() + { + m_LODContainer = null; + + m_customOptionsContainer = null; + + m_templateProperties.Destroy(); + m_templateProperties = null; + + m_passes.Clear(); + m_passes = null; + + m_modules.Destroy(); + m_modules = null; + + m_availableShaderGlobals.Clear(); + m_availableShaderGlobals = null; + + } + + void FetchLOD( int offsetIdx , string body ) + { + Match match = Regex.Match( body , TemplateHelperFunctions.SubShaderLODPattern ); + if( match != null && match.Groups.Count > 1 ) + { + m_LODContainer.Id = match.Groups[ 0 ].Value; + m_LODContainer.Data = match.Groups[ 1 ].Value; + m_LODContainer.Index = offsetIdx + match.Index; + } + } + + public List Passes { get { return m_passes; } } + public TemplateModulesData Modules { get { return m_modules; } } + public string UniquePrefix { get { return m_uniquePrefix; } } + public TemplatePropertyContainer TemplateProperties { get { return m_templateProperties; } } + public List AvailableShaderGlobals { get { return m_availableShaderGlobals; } } + public TemplateInfoContainer LODContainer { get { return m_LODContainer; } } + public int PassAmount { get { return m_passAmount; } } + public bool FoundMainPass { get { return m_foundMainPassTag; } } + public int MainPass { get { return m_mainPass; } } + public int Idx { get { return m_idx; } } + public TemplateOptionsContainer CustomOptionsContainer { get { return m_customOptionsContainer; } } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs.meta new file mode 100644 index 00000000..db6606b3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f4ff24a5a4c92f745a159f247574c07a +timeCreated: 1517854017 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs new file mode 100644 index 00000000..b46c3e8e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs @@ -0,0 +1,472 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateTagsModule : TemplateModuleParent + { + private const string CustomTagsStr = "Tags"; + private const string TagNameStr = "Name"; + private const string TagValueStr = "Value"; + private const string QueueIndexStr = "Index"; + private const string QueueLabelStr = "Queue"; + private const string RenderTypeLabelStr = "Type"; + private const string CustomRenderTypeLabelStr = "Custom"; + + private const float ShaderKeywordButtonLayoutWidth = 15; + private UndoParentNode m_currentOwner; + + private double m_tagNameCheckTimestamp = 0; + private bool m_tagNameCheckFlag = true; + private int m_tagNameCheckItemId = 0; + private const double TagNameCheckMaxInterval = 1.5; + + [SerializeField] + private bool m_foldout = false; + + [SerializeField] + private List m_availableTags = new List(); + + private Dictionary m_availableTagsDict = new Dictionary(); + + public TemplateTagsModule() : base( "Tags" ) { } + + public void CopyFrom( TemplateTagsModule other ) + { + m_availableTags.Clear(); + m_availableTagsDict.Clear(); + + int count = other.AvailableTags.Count; + for( int i = 0; i < count; i++ ) + { + CustomTagData newData = new CustomTagData( other.AvailableTags[ i ] ); + m_availableTags.Add( newData ); + m_availableTagsDict.Add( newData.TagName, newData ); + } + } + + public void ConfigureFromTemplateData( TemplateTagsModuleData tagsData ) + { + bool newValidData = tagsData.DataCheck == TemplateDataCheck.Valid; + if( newValidData && newValidData != m_validData ) + { + m_availableTags.Clear(); + m_availableTagsDict.Clear(); + int count = tagsData.Tags.Count; + for( int i = 0; i < count; i++ ) + { + CustomTagData tagData = new CustomTagData( tagsData.Tags[ i ].Name, tagsData.Tags[ i ].Value, i ); + m_availableTags.Add( tagData ); + m_availableTagsDict.Add( tagsData.Tags[ i ].Name, tagData ); + } + } + m_validData = newValidData; + } + + public override void ShowUnreadableDataMessage( ParentNode owner ) + { + //bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedCustomTags; + NodeUtils.DrawPropertyGroup( ref m_foldout, CustomTagsStr, base.ShowUnreadableDataMessage ); + //owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedCustomTags = foldout; + } + + public void OnLogicUpdate() + { + if( m_tagNameCheckFlag && ( EditorApplication.timeSinceStartup - m_tagNameCheckTimestamp ) > TagNameCheckMaxInterval ) + { + m_tagNameCheckFlag = false; + if( m_tagNameCheckItemId < m_availableTags.Count ) + { + if( m_availableTags[ m_tagNameCheckItemId ].TagName.Equals( Constants.RenderQueueHelperStr ) ) + { + m_availableTags[ m_tagNameCheckItemId ].SpecialTag = TemplateSpecialTags.Queue; + } + else if( m_availableTags[ m_tagNameCheckItemId ].TagName.Equals( Constants.RenderTypeHelperStr ) ) + { + m_availableTags[ m_tagNameCheckItemId ].SpecialTag = TemplateSpecialTags.RenderType; + } + else if( m_availableTags[ m_tagNameCheckItemId ].TagName.Equals( Constants.DisableBatchingHelperStr ) ) + { + m_availableTags[ m_tagNameCheckItemId ].SpecialTag = TemplateSpecialTags.DisableBatching; + } + else + { + m_availableTags[ m_tagNameCheckItemId ].SpecialTag = TemplateSpecialTags.None; + } + } + } + } + + public override void Draw( UndoParentNode owner, bool style = true ) + { + m_currentOwner = owner; + //bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedCustomTags; + if( style ) + { + NodeUtils.DrawPropertyGroup( ref m_foldout, CustomTagsStr, DrawMainBody, DrawButtons ); + } + else + { + NodeUtils.DrawNestedPropertyGroup( ref m_foldout, CustomTagsStr, DrawMainBody, DrawButtons ); + } + //owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedCustomTags = foldout; + } + + void DrawButtons() + { + EditorGUILayout.Separator(); + + // Add tag + if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_availableTags.Add( new CustomTagData() ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove tag + if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + if( m_availableTags.Count > 0 ) + { + m_availableTags.RemoveAt( m_availableTags.Count - 1 ); + EditorGUI.FocusTextInControl( null ); + } + } + } + + void DrawMainBody() + { + EditorGUI.BeginChangeCheck(); + { + EditorGUILayout.Separator(); + int itemCount = m_availableTags.Count; + + if( itemCount == 0 ) + { + EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one.", MessageType.Info ); + } + + int markedToDelete = -1; + float originalLabelWidth = EditorGUIUtility.labelWidth; + for( int i = 0; i < itemCount; i++ ) + { + m_availableTags[ i ].TagFoldout = m_currentOwner.EditorGUILayoutFoldout( m_availableTags[ i ].TagFoldout, string.Format( "[{0}] - {1}", i, m_availableTags[ i ].TagName ) ); + if( m_availableTags[ i ].TagFoldout ) + { + EditorGUI.indentLevel += 1; + EditorGUIUtility.labelWidth = 70; + //Tag Name + EditorGUI.BeginChangeCheck(); + m_availableTags[ i ].TagName = m_currentOwner.EditorGUILayoutTextField( TagNameStr, m_availableTags[ i ].TagName ); + if( EditorGUI.EndChangeCheck() ) + { + m_availableTags[ i ].TagName = UIUtils.RemoveShaderInvalidCharacters( m_availableTags[ i ].TagName ); + m_tagNameCheckFlag = true; + m_tagNameCheckItemId = i; + m_tagNameCheckTimestamp = EditorApplication.timeSinceStartup; + } + + //Tag Value + switch( m_availableTags[ i ].SpecialTag ) + { + case TemplateSpecialTags.DisableBatching: + { + m_availableTags[ i ].Batching = (DisableBatching)m_currentOwner.EditorGUILayoutEnumPopup( RenderTypeLabelStr, m_availableTags[ i ].Batching ); + m_availableTags[ i ].TagValue = m_availableTags[ i ].Batching.ToString(); + } + break; + case TemplateSpecialTags.RenderType: + { + m_availableTags[ i ].RenderType = (RenderType)m_currentOwner.EditorGUILayoutEnumPopup( RenderTypeLabelStr, m_availableTags[ i ].RenderType ); + if( m_availableTags[ i ].RenderType == RenderType.Custom ) + { + m_availableTags[ i ].TagValue = m_currentOwner.EditorGUILayoutTextField( CustomRenderTypeLabelStr, m_availableTags[ i ].TagValue ); + } + } + break; + case TemplateSpecialTags.Queue: + { + + EditorGUI.BeginChangeCheck(); + m_availableTags[ i ].RenderQueue = (RenderQueue)m_currentOwner.EditorGUILayoutEnumPopup( QueueLabelStr, m_availableTags[ i ].RenderQueue, GUILayout.MinWidth( 150 ) ); + m_availableTags[ i ].RenderQueueOffset = m_currentOwner.EditorGUILayoutIntField( QueueIndexStr, m_availableTags[ i ].RenderQueueOffset ); + if( EditorGUI.EndChangeCheck() ) + { + m_availableTags[ i ].BuildQueueTagValue(); + } + + } + break; + case TemplateSpecialTags.None: + { + EditorGUI.BeginChangeCheck(); + m_availableTags[ i ].TagValue = m_currentOwner.EditorGUILayoutTextField( TagValueStr, m_availableTags[ i ].TagValue ); + if( EditorGUI.EndChangeCheck() ) + { + m_availableTags[ i ].TagValue = UIUtils.RemoveShaderInvalidCharacters( m_availableTags[ i ].TagValue ); + } + } + break; + + } + + EditorGUIUtility.labelWidth = originalLabelWidth; + + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Label( " " ); + // Add new port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + m_availableTags.Insert( i + 1, new CustomTagData() ); + EditorGUI.FocusTextInControl( null ); + } + + //Remove port + if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) + { + markedToDelete = i; + } + } + EditorGUILayout.EndHorizontal(); + + EditorGUI.indentLevel -= 1; + } + + } + if( markedToDelete > -1 ) + { + if( m_availableTags.Count > markedToDelete ) + { + m_availableTags.RemoveAt( markedToDelete ); + EditorGUI.FocusTextInControl( null ); + } + } + EditorGUILayout.Separator(); + } + if( EditorGUI.EndChangeCheck() ) + { + m_isDirty = true; + } + } + + //Method used by template options + // As such. Render Queue will have value and offset separated by , + public void AddSpecialTag( TemplateSpecialTags tag, TemplateActionItem item ) + { + if( tag == TemplateSpecialTags.None ) + return; + + int count = m_availableTags.Count; + for( int i = 0; i < count; i++ ) + { + if( m_availableTags[ i ].SpecialTag == tag ) + { + switch( tag ) + { + case TemplateSpecialTags.DisableBatching: + { + m_availableTags[ i ].Batching = TemplateHelperFunctions.StringToDisableBatching[ item.ActionData ]; + return; + } + case TemplateSpecialTags.RenderType: + { + m_availableTags[ i ].RenderType = TemplateHelperFunctions.StringToRenderType[ item.ActionData ]; + return; + } + case TemplateSpecialTags.Queue: + { + + m_availableTags[ i ].RenderQueue = TemplateHelperFunctions.StringToRenderQueue[ item.ActionData ]; + m_availableTags[ i ].RenderQueueOffset = item.ActionDataIdx; + m_availableTags[ i ].BuildQueueTagValue(); + return; + } + } + } + } + + CustomTagData data = new CustomTagData(); + switch( tag ) + { + case TemplateSpecialTags.DisableBatching: + { + data.SpecialTag = TemplateSpecialTags.DisableBatching; + data.TagName = "DisableBatching"; + data.Batching = TemplateHelperFunctions.StringToDisableBatching[ item.ActionData ]; + } + break; + case TemplateSpecialTags.RenderType: + { + data.SpecialTag = TemplateSpecialTags.RenderType; + data.TagName = "RenderType"; + data.RenderType = TemplateHelperFunctions.StringToRenderType[ item.ActionData ]; + } + break; + case TemplateSpecialTags.Queue: + { + data.SpecialTag = TemplateSpecialTags.Queue; + data.TagName = "Queue"; + data.RenderQueue = TemplateHelperFunctions.StringToRenderQueue[ item.ActionData ]; + data.RenderQueueOffset = item.ActionDataIdx; + data.BuildQueueTagValue(); + } + break; + } + m_availableTags.Add( data ); + } + + void AddTagFromRead( string data ) + { + string[] arr = data.Split( IOUtils.VALUE_SEPARATOR ); + if( arr.Length > 1 ) + { + string name = arr[ 0 ]; + string value = arr[ 1 ]; + + if( !m_availableTagsDict.ContainsKey( name ) ) + { + CustomTagData tagData = new CustomTagData( data, m_availableTags.Count ); + m_availableTags.Add( tagData ); + m_availableTagsDict.Add( name, tagData ); + } + else + { + if( m_availableTagsDict[ name ].TagId > -1 && + m_availableTagsDict[ name ].TagId < m_availableTags.Count ) + { + if( arr.Length == 4 ) + { + m_availableTags[ m_availableTagsDict[ name ].TagId ].SetTagValue( value, arr[ 3 ] ); + } + else + { + m_availableTags[ m_availableTagsDict[ name ].TagId ].SetTagValue( value ); + } + + } + else + { + int count = m_availableTags.Count; + for( int i = 0; i < count; i++ ) + { + if( m_availableTags[ i ].TagName.Equals( name ) ) + { + m_availableTags[ i ].SetTagValue( value ); + } + } + } + } + } + } + + public override void ReadFromString( ref uint index, ref string[] nodeParams ) + { + bool validDataOnMeta = m_validData; + if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) + { + validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( validDataOnMeta ) + { + int count = Convert.ToInt32( nodeParams[ index++ ] ); + for( int i = 0; i < count; i++ ) + { + AddTagFromRead( nodeParams[ index++ ] ); + } + } + } + + public override void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_validData ); + if( m_validData ) + { + int tagsCount = m_availableTags.Count; + IOUtils.AddFieldValueToString( ref nodeInfo, tagsCount ); + for( int i = 0; i < tagsCount; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_availableTags[ i ].ToString() ); + } + } + } + + public void ChangeTagValue( string name , string value ) + { + CustomTagData tag = m_availableTags.Find( x => x.TagName.Equals( name ) ); + if( tag != null ) + tag.TagValue = value; + } + + public string GenerateTags() + { + int tagsCount = m_availableTags.Count; + if( tagsCount == 0 ) + return string.Empty; + + string result = "Tags { "; + + for( int i = 0; i < tagsCount; i++ ) + { + if( m_availableTags[ i ].IsValid ) + { + result += m_availableTags[ i ].GenerateTag(); + if( i < tagsCount - 1 ) + { + result += " "; + } + } + } + + result += " }"; + + return result; + } + + public override void Destroy() + { + m_availableTags.Clear(); + m_availableTags = null; + m_currentOwner = null; + m_availableTagsDict.Clear(); + m_availableTagsDict = null; + } + + public List AvailableTags { get { return m_availableTags; } } + + public bool HasRenderInfo( ref RenderType renderType, ref RenderQueue renderQueue ) + { + if( !m_validData ) + return false; + + bool foundRenderType = false; + bool foundRenderQueue = false; + int count = m_availableTags.Count; + for( int i = 0; i < count; i++ ) + { + if( m_availableTags[ i ].TagName.Equals( Constants.RenderTypeHelperStr ) ) + { + if( TemplateHelperFunctions.StringToRenderType.ContainsKey( m_availableTags[ i ].TagValue ) ) + { + renderType = TemplateHelperFunctions.StringToRenderType[ m_availableTags[ i ].TagValue ]; + foundRenderType = true; + } + } + else if( m_availableTags[ i ].TagName.Equals( Constants.RenderQueueHelperStr ) ) + { + string value = m_availableTags[ i ].TagValue.Split( '+' )[ 0 ].Split( '-' )[ 0 ]; + if( TemplateHelperFunctions.StringToRenderQueue.ContainsKey( value ) ) + { + renderQueue = TemplateHelperFunctions.StringToRenderQueue[ value ]; + foundRenderQueue = true; + } + } + } + return foundRenderType && foundRenderQueue; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs.meta new file mode 100644 index 00000000..fcfffdf5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 905b4a4de4a974a489d7a8aac14e4fcb +timeCreated: 1516719540 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs new file mode 100644 index 00000000..3b82e046 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs @@ -0,0 +1,190 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateVertexData + { + [SerializeField] + private TemplateSemantics m_semantics = TemplateSemantics.NONE; + [SerializeField] + private WirePortDataType m_dataType = WirePortDataType.OBJECT; + [SerializeField] + private string m_varName = string.Empty; + [SerializeField] + private TemplateInfoOnSematics m_dataInfo = TemplateInfoOnSematics.NONE; + [SerializeField] + private string m_dataSwizzle = string.Empty; + [SerializeField] + private bool m_available = false; + [SerializeField] + private string m_varNameWithSwizzle = string.Empty; + [SerializeField] + private bool m_isSingleComponent = true; + [SerializeField] + private bool m_excludeStructPrefix = false; + [SerializeField] + private string[] m_components = { "0", "0", "0", "0" }; + [SerializeField] + private bool[] m_componentUsage = { false, false,false,false }; + + public TemplateVertexData( TemplateSemantics semantics, WirePortDataType dataType, string varName ) + { + m_semantics = semantics; + m_dataType = dataType; + m_varName = varName; + m_varNameWithSwizzle = varName; + } + + public TemplateVertexData( TemplateSemantics semantics, WirePortDataType dataType, string varName, string dataSwizzle ) + { + m_semantics = semantics; + m_dataType = dataType; + m_varName = varName; + m_dataSwizzle = dataSwizzle; + m_varNameWithSwizzle = varName + dataSwizzle; + } + + public TemplateVertexData( TemplateVertexData other ) + { + m_semantics = other.m_semantics; + m_dataType = other.m_dataType; + m_varName = other.m_varName; + m_dataInfo = other.m_dataInfo; + m_dataSwizzle = other.m_dataSwizzle; + m_available = other.m_available; + m_varNameWithSwizzle = other.m_varNameWithSwizzle; + m_isSingleComponent = other.IsSingleComponent; + m_excludeStructPrefix = other.ExcludeStructPrefix; + for( int i = 0; i < 4; i++ ) + { + m_components[ i ] = other.Components[ i ]; + } + } + + public void RegisterComponent( char channelId, string value ) + { + int channelIdInt = -1; + switch( channelId ) + { + case 'r': + case 'x': channelIdInt = 0; break; + case 'g': + case 'y': channelIdInt = 1; break; + case 'b': + case 'z': channelIdInt = 2; break; + case 'a': + case 'w': channelIdInt = 3; break; + } + + if( channelId < 0 ) + { + Debug.LogWarning( "Attempting to create interpolated data from invalid channel " + channelId ); + return; + } + + RegisterComponent( channelIdInt, value ); + } + + public void RegisterComponent( int channelId, string value ) + { + channelId = Mathf.Clamp( channelId, 0, 3 ); + m_components[ channelId ] = value; + m_componentUsage[ channelId ] = true; + m_isSingleComponent = false; + } + + public void BuildVar( PrecisionType precisionType = PrecisionType.Float ) + { + if( m_isSingleComponent ) + return; + WirePortDataType dataType = WirePortDataType.FLOAT; + if( m_componentUsage[ 3 ] ) + { + dataType = WirePortDataType.FLOAT4; + } + else if( m_componentUsage[ 2 ] ) + { + dataType = WirePortDataType.FLOAT3; + } + else if( m_componentUsage[ 1 ] ) + { + dataType = WirePortDataType.FLOAT2; + } + + string newVar = UIUtils.PrecisionWirePortToCgType( precisionType, dataType ); + newVar += "( "; + switch( dataType ) + { + default: newVar += "0"; break; + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + { + newVar += "{0}."+Components[ 0 ]; + } + break; + case WirePortDataType.FLOAT2: + { + newVar += "{0}." + Components[ 0 ] + ", " + + "{0}." + Components[ 1 ]; + } + break; + case WirePortDataType.FLOAT3: + { + newVar += "{0}." + Components[ 0 ] + ", " + + "{0}." + Components[ 1 ] + ", " + + "{0}." + Components[ 2 ]; + } + break; + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + { + newVar += "{0}." + Components[ 0 ] + ", " + + "{0}." + Components[ 1 ] + ", " + + "{0}." + Components[ 2 ] + ", " + + "{0}." + Components[ 3 ]; + } + break; + + } + newVar += " )"; + m_varName = newVar; + m_varNameWithSwizzle = newVar; + } + + public bool ExcludeStructPrefix { get { return m_excludeStructPrefix; } set { m_excludeStructPrefix = value; } } + public bool IsSingleComponent { get { return m_isSingleComponent; } } + public string[] Components { get { return m_components; } } + public TemplateSemantics Semantics { get { return m_semantics; } } + public WirePortDataType DataType { get { return m_dataType; } } + public string VarName { get { return m_varName; } set { m_varName = value; m_varNameWithSwizzle = value + m_dataSwizzle; } } + public string DataSwizzle { get { return m_dataSwizzle; } set { m_dataSwizzle = value; m_varNameWithSwizzle = m_varName + value; } } + public TemplateInfoOnSematics DataInfo { get { return m_dataInfo; } set { m_dataInfo = value; } } + public bool Available { get { return m_available; } set { m_available = value; } } + public string VarNameWithSwizzle { get { return m_varNameWithSwizzle; } } + public WirePortDataType SwizzleType + { + get + { + if ( string.IsNullOrEmpty( m_dataSwizzle ) ) + return m_dataType; + + WirePortDataType newType = m_dataType; + switch ( m_dataSwizzle.Length ) + { + case 2: newType = WirePortDataType.FLOAT;break; + case 3: newType = WirePortDataType.FLOAT2; break; + case 4: newType = WirePortDataType.FLOAT3; break; + case 5: newType = WirePortDataType.FLOAT4; break; + } + + return newType; + } + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs.meta new file mode 100644 index 00000000..a106ca66 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d11e7a9026804bd46962c527fe30d933 +timeCreated: 1496053368 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs new file mode 100644 index 00000000..3e900c71 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs @@ -0,0 +1,285 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + [NodeAttributes( "Template Vertex Data" , "Vertex Data" , "Select and use available vertex data from the template" )] + public class TemplateVertexDataNode : TemplateNodeParent + { + private List m_interpolatorData = null; + + [SerializeField] + private int m_currentDataIdx = -1; + + [SerializeField] + private string m_dataName = string.Empty; + [SerializeField] + private string m_inVarName = string.Empty; + + private string[] m_dataLabels = null; + + private bool m_fetchDataId = false; + private UpperLeftWidgetHelper m_upperLeftWidgetHelper = new UpperLeftWidgetHelper(); + + protected override void CommonInit( int uniqueId ) + { + base.CommonInit( uniqueId ); + m_autoWrapProperties = true; + } + + void FetchDataId() + { + if( m_interpolatorData != null ) + { + m_currentDataIdx = 0; + int count = m_interpolatorData.Count; + m_dataLabels = new string[ count ]; + for( int i = 0 ; i < count ; i++ ) + { + m_dataLabels[ i ] = m_interpolatorData[ i ].VarName; + if( m_interpolatorData[ i ].VarName.Equals( m_dataName ) ) + { + m_currentDataIdx = i; + } + } + UpdateFromId(); + } + else + { + m_currentDataIdx = -1; + } + } + + void UpdateFromId() + { + if( m_interpolatorData != null ) + { + if( m_interpolatorData.Count == 0 ) + { + for( int i = 0 ; i < 4 ; i++ ) + m_containerGraph.DeleteConnection( false , UniqueId , i , false , true ); + + m_headerColor = UIUtils.GetColorFromCategory( "Default" ); + SetAdditonalTitleText( "" ); + m_additionalContent.text = string.Empty; + m_outputPorts[ 0 ].ChangeProperties( "None" , WirePortDataType.OBJECT , false ); + ConfigurePorts(); + return; + } + + bool areCompatible = TemplateHelperFunctions.CheckIfCompatibles( m_outputPorts[ 0 ].DataType , m_interpolatorData[ m_currentDataIdx ].DataType ); + switch( m_interpolatorData[ m_currentDataIdx ].DataType ) + { + default: + case WirePortDataType.INT: + case WirePortDataType.FLOAT: + m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue , m_interpolatorData[ m_currentDataIdx ].DataType , false ); + break; + case WirePortDataType.FLOAT2: + m_outputPorts[ 0 ].ChangeProperties( "XY" , m_interpolatorData[ m_currentDataIdx ].DataType , false ); + break; + case WirePortDataType.FLOAT3: + m_outputPorts[ 0 ].ChangeProperties( "XYZ" , m_interpolatorData[ m_currentDataIdx ].DataType , false ); + break; + case WirePortDataType.FLOAT4: + m_outputPorts[ 0 ].ChangeProperties( "XYZW" , m_interpolatorData[ m_currentDataIdx ].DataType , false ); + break; + case WirePortDataType.COLOR: + m_outputPorts[ 0 ].ChangeProperties( "RGBA" , m_interpolatorData[ m_currentDataIdx ].DataType , false ); + break; + } + + ConfigurePorts(); + + if( !areCompatible ) + { + m_containerGraph.DeleteConnection( false , UniqueId , 0 , false , true ); + } + + m_dataName = m_interpolatorData[ m_currentDataIdx ].VarName; + SetAdditonalTitleText( m_dataName ); + m_sizeIsDirty = true; + CheckWarningState(); + } + } + + public override void DrawProperties() + { + base.DrawProperties(); + if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) + { + return; + } + + if( m_multiPassMode ) + { + DrawMultipassProperties(); + } + + if( m_currentDataIdx > -1 ) + { + EditorGUI.BeginChangeCheck(); + m_currentDataIdx = EditorGUILayoutPopup( DataLabelStr , m_currentDataIdx , m_dataLabels ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromId(); + } + } + } + protected override void OnSubShaderChange() + { + FetchInterpolator(); + FetchDataId(); + } + + protected override void OnPassChange() + { + FetchInterpolator(); + FetchDataId(); + } + + void DrawMultipassProperties() + { + DrawSubShaderUI(); + DrawPassUI(); + } + + public override void Draw( DrawInfo drawInfo ) + { + base.Draw( drawInfo ); + if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) + { + return; + } + + if( m_interpolatorData == null || m_interpolatorData.Count == 0 ) + { + MasterNode masterNode = m_containerGraph.CurrentMasterNode; + FetchInterpolator( masterNode ); + } + + if( m_fetchDataId ) + { + m_fetchDataId = false; + FetchDataId(); + } + + if( m_currentDataIdx > -1 ) + { + EditorGUI.BeginChangeCheck(); + m_currentDataIdx = m_upperLeftWidgetHelper.DrawWidget( this , m_currentDataIdx , m_dataLabels ); + if( EditorGUI.EndChangeCheck() ) + { + UpdateFromId(); + } + } + } + + public override string GenerateShaderForOutput( int outputId , ref MasterNodeDataCollector dataCollector , bool ignoreLocalvar ) + { + if( dataCollector.MasterNodeCategory != AvailableShaderTypes.Template ) + { + UIUtils.ShowMessage( UniqueId , "Template Vertex Data node is only intended for templates use only" , MessageSeverity.Error ); + return m_outputPorts[ 0 ].ErrorValue; + } + + if( dataCollector.IsFragmentCategory ) + { + UIUtils.ShowMessage( UniqueId , "Template Vertex Data node node is only intended for vertex use use only" , MessageSeverity.Error ); + return m_outputPorts[ 0 ].ErrorValue; + } + + if( m_multiPassMode ) + { + if( dataCollector.TemplateDataCollectorInstance.MultipassSubshaderIdx != SubShaderIdx || + dataCollector.TemplateDataCollectorInstance.MultipassPassIdx != PassIdx + ) + { + UIUtils.ShowMessage( UniqueId , string.Format( "{0} is only intended for subshader {1} and pass {2}" , m_dataLabels[ m_currentDataIdx ] , SubShaderIdx , PassIdx ) ); + return m_outputPorts[ outputId ].ErrorValue; + } + } + + return GetOutputVectorItem( 0 , outputId , m_inVarName + m_dataName ); + } + + public override void ReadFromString( ref string[] nodeParams ) + { + base.ReadFromString( ref nodeParams ); + m_dataName = GetCurrentParam( ref nodeParams ); + m_fetchDataId = true; + } + + public override void WriteToString( ref string nodeInfo , ref string connectionsInfo ) + { + base.WriteToString( ref nodeInfo , ref connectionsInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_dataName ); + } + + protected override bool ValidatePass( int passIdx ) + { + return ( m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ passIdx ].VertexFunctionData != null && + m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ passIdx ].VertexDataContainer != null ); + } + + void FetchInterpolator( MasterNode masterNode = null ) + { + FetchMultiPassTemplate( masterNode ); + if( m_multiPassMode ) + { + if( m_templateMPData != null ) + { + m_inVarName = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].VertexFunctionData.InVarName + "."; + m_interpolatorData = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].VertexDataContainer.VertexData; + m_fetchDataId = true; + } + } + else + { + if( masterNode == null ) + masterNode = m_containerGraph.CurrentMasterNode; + + TemplateData currentTemplate = ( masterNode as TemplateMasterNode ).CurrentTemplate; + if( currentTemplate != null ) + { + m_inVarName = currentTemplate.VertexFunctionData.InVarName + "."; + m_interpolatorData = currentTemplate.VertexDataList; + m_fetchDataId = true; + } + else + { + m_interpolatorData = null; + m_currentDataIdx = -1; + } + } + } + + public override void OnMasterNodeReplaced( MasterNode newMasterNode ) + { + base.OnMasterNodeReplaced( newMasterNode ); + if( newMasterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template ) + { + FetchInterpolator( newMasterNode ); + } + else + { + m_interpolatorData = null; + m_currentDataIdx = -1; + } + } + + public override void Destroy() + { + base.Destroy(); + m_dataLabels = null; + m_interpolatorData = null; + m_upperLeftWidgetHelper = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs.meta new file mode 100644 index 00000000..d7a14f60 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5eb32f2452052fb43b6b93c9baa8f02f +timeCreated: 1506610215 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs new file mode 100644 index 00000000..480c72be --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs @@ -0,0 +1,757 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + [Serializable] + public sealed class TemplatesBlendModule : TemplateModuleParent + { + private const string AlphaToMaskStr = "Alpha To Coverage"; + private const string BlendModeStr = " Blend Mode"; + + private const string BlendModesRGBStr = "Blend RGB"; + private const string BlendModesAlphaStr = "Blend Alpha"; + + private const string BlendOpsRGBStr = "Blend Op RGB"; + private const string BlendOpsAlphaStr = "Blend Op Alpha"; + + private const string SourceFactorStr = "Src"; + private const string DstFactorStr = "Dst"; + + private const string AlphaToMaskFormat = "AlphaToMask {0}"; + private const string BlendFactorOff = "Blend Off"; + private const string SingleBlendFactorStr = "Blend{0} {1} {2}"; + private const string SeparateBlendFactorStr = "Blend{0} {1} {2}, {3} {4}"; + + private const string SingleBlendOpStr = "BlendOp{0} {1}"; + private const string SeparateBlendOpStr = "BlendOp{0} {1}, {2}"; + private const string BlendOpOffStr = "BlendOp Off"; + + + private string[] m_commonBlendTypesArr; + private List m_commonBlendTypes = new List + { + new CommonBlendTypes("", AvailableBlendFactor.Zero, AvailableBlendFactor.Zero ), + new CommonBlendTypes("Custom", AvailableBlendFactor.Zero, AvailableBlendFactor.Zero ) , + new CommonBlendTypes("Alpha Blend", AvailableBlendFactor.SrcAlpha, AvailableBlendFactor.OneMinusSrcAlpha ) , + new CommonBlendTypes("Premultiplied", AvailableBlendFactor.One, AvailableBlendFactor.OneMinusSrcAlpha ), + new CommonBlendTypes("Additive", AvailableBlendFactor.One, AvailableBlendFactor.One ), + new CommonBlendTypes("Soft Additive", AvailableBlendFactor.OneMinusDstColor, AvailableBlendFactor.One ), + new CommonBlendTypes("Multiplicative", AvailableBlendFactor.DstColor, AvailableBlendFactor.Zero ), + new CommonBlendTypes("2x Multiplicative", AvailableBlendFactor.DstColor, AvailableBlendFactor.SrcColor ), + new CommonBlendTypes("Particle Additive", AvailableBlendFactor.SrcAlpha, AvailableBlendFactor.One ) + }; + + [SerializeField] + private string m_target = string.Empty; + + [SerializeField] + private bool m_validBlendMode = false; + + [SerializeField] + private bool m_validBlendOp = false; + + [SerializeField] + private bool m_blendModeEnabled = false; + + // Blend Factor + // RGB + [SerializeField] + private int m_currentRGBIndex = 0; + + [SerializeField] + private AvailableBlendFactor m_sourceFactorRGB = AvailableBlendFactor.Zero; + [SerializeField] + private InlineProperty m_sourceFactorRGBInline = new InlineProperty(); + + [SerializeField] + private AvailableBlendFactor m_destFactorRGB = AvailableBlendFactor.Zero; + [SerializeField] + private InlineProperty m_destFactorRGBInline = new InlineProperty(); + + //Alpha + [SerializeField] + private int m_currentAlphaIndex = 0; + + [SerializeField] + private AvailableBlendFactor m_sourceFactorAlpha = AvailableBlendFactor.Zero; + [SerializeField] + private InlineProperty m_sourceFactorAlphaInline = new InlineProperty(); + + [SerializeField] + private AvailableBlendFactor m_destFactorAlpha = AvailableBlendFactor.Zero; + [SerializeField] + private InlineProperty m_destFactorAlphaInline = new InlineProperty(); + + //Blend Ops + [SerializeField] + private bool m_blendOpEnabled = false; + + [SerializeField] + private AvailableBlendOps m_blendOpRGB = AvailableBlendOps.OFF; + + [SerializeField] + private InlineProperty m_blendOpRGBInline = new InlineProperty(); + + [SerializeField] + private AvailableBlendOps m_blendOpAlpha = AvailableBlendOps.OFF; + + [SerializeField] + private InlineProperty m_blendOpAlphaInline = new InlineProperty(); + + public TemplatesBlendModule() : base( "Blend Mode and Ops" ) + { + m_commonBlendTypesArr = new string[ m_commonBlendTypes.Count ]; + for( int i = 0; i < m_commonBlendTypesArr.Length; i++ ) + { + m_commonBlendTypesArr[ i ] = m_commonBlendTypes[ i ].Name; + } + } + + public void CopyFrom( TemplatesBlendModule other, bool allData ) + { + if( allData ) + { + m_independentModule = other.IndependentModule; + m_validBlendMode = other.ValidBlendMode; + m_target = other.Target; + m_validBlendOp = other.ValidBlendOp; + } + m_blendModeEnabled = other.BlendModeEnabled; + m_currentRGBIndex = other.CurrentRGBIndex; + m_sourceFactorRGB = other.SourceFactorRGB; + m_destFactorRGB = other.DestFactorRGB; + m_currentAlphaIndex = other.CurrentAlphaIndex; + m_sourceFactorAlpha = other.SourceFactorAlpha; + m_destFactorAlpha = other.DestFactorAlpha; + m_blendOpEnabled = other.BlendOpEnabled; + m_blendOpRGB = other.BlendOpRGB; + m_blendOpAlpha = other.BlendOpAlpha; + m_sourceFactorRGBInline = other.SourceFactorRGBInline; + m_destFactorRGBInline = other.DestFactorRGBInline; + m_sourceFactorAlphaInline = other.SourceFactorAlphaInline; + m_destFactorAlphaInline = other.DestFactorAlphaInline; + m_blendOpRGBInline = other.BlendOpRGBInline; + m_blendOpAlphaInline = other.BlendOpAlphaInline; + } + + public void ConfigureFromTemplateData( TemplateBlendData blendData ) + { + if( blendData.ValidBlendMode ) + { + if( m_validBlendMode != blendData.ValidBlendMode ) + { + m_blendModeEnabled = true; + m_independentModule = blendData.IndependentModule; + if( string.IsNullOrEmpty( blendData.SourceFactorRGBInline ) ) + { + m_sourceFactorRGB = blendData.SourceFactorRGB; + m_sourceFactorRGBInline.ResetProperty(); + } + else + { + m_sourceFactorRGBInline.SetInlineByName( blendData.SourceFactorRGBInline ); + } + + if( string.IsNullOrEmpty( blendData.DestFactorRGBInline ) ) + { + m_destFactorRGB = blendData.DestFactorRGB; + m_destFactorRGBInline.ResetProperty(); + } + else + { + m_destFactorRGBInline.SetInlineByName( blendData.DestFactorRGBInline ); + } + + if( string.IsNullOrEmpty( blendData.SourceFactorAlphaInline ) ) + { + m_sourceFactorAlpha = blendData.SourceFactorAlpha; + m_sourceFactorAlphaInline.ResetProperty(); + } + else + { + m_sourceFactorAlphaInline.SetInlineByName( blendData.SourceFactorAlphaInline ); + } + if( string.IsNullOrEmpty( blendData.DestFactorAlphaInline ) ) + { + m_destFactorAlpha = blendData.DestFactorAlpha; + m_destFactorAlphaInline.ResetProperty(); + } + else + { + m_destFactorAlphaInline.SetInlineByName( blendData.DestFactorAlphaInline ); + } + + if( blendData.SeparateBlendFactors ) + { + if( blendData.BlendModeOff ) + { + m_currentRGBIndex = 0; + } + else + { + CheckRGBIndex(); + } + CheckAlphaIndex(); + } + else + { + if( blendData.BlendModeOff ) + { + m_currentRGBIndex = 0; + } + else + { + CheckRGBIndex(); + } + m_currentAlphaIndex = 0; + } + } + } + else + { + m_blendModeEnabled = false; + } + + if( blendData.ValidBlendOp ) + { + if( m_validBlendOp != blendData.ValidBlendOp ) + { + m_blendOpEnabled = true; + if( string.IsNullOrEmpty( blendData.BlendOpRGBInline ) ) + { + m_blendOpRGB = blendData.BlendOpRGB; + m_blendOpRGBInline.ResetProperty(); + } + else + { + m_blendOpRGBInline.SetInlineByName( blendData.BlendOpRGBInline ); + } + + if( string.IsNullOrEmpty( blendData.BlendOpAlphaInline ) ) + { + m_blendOpAlpha = blendData.BlendOpAlpha; + m_blendOpAlphaInline.ResetProperty(); + } + else + { + m_blendOpAlphaInline.SetInlineByName( blendData.BlendOpAlphaInline ); + } + } + } + else + { + m_blendOpEnabled = false; + } + + m_target = blendData.Target; + m_validBlendMode = blendData.ValidBlendMode; + m_validBlendOp = blendData.ValidBlendOp; + m_validData = m_validBlendMode || m_validBlendOp; + } + + public override void ShowUnreadableDataMessage( ParentNode owner ) + { + bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendModeModule; + NodeUtils.DrawPropertyGroup( ref foldout, BlendModeStr, base.ShowUnreadableDataMessage ); + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendModeModule = foldout; + } + + public override void Draw( UndoParentNode owner, bool style = true ) + { + bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendModeModule; + if( style ) + { + NodeUtils.DrawPropertyGroup( ref foldout, BlendModeStr + Target, () => + { + DrawBlock( owner, style ); + } ); + } + else + { + NodeUtils.DrawNestedPropertyGroup( ref foldout, BlendModeStr + Target, () => + { + DrawBlock( owner, style ); + } ); + } + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendModeModule = foldout; + } + + void DrawBlock( UndoParentNode owner, bool style ) + { + EditorGUI.BeginChangeCheck(); + { + var cache = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = EditorGUIUtility.labelWidth - 20; + + if( m_blendModeEnabled ) + { + // RGB + EditorGUI.BeginChangeCheck(); + m_currentRGBIndex = owner.EditorGUILayoutPopup( BlendModesRGBStr, m_currentRGBIndex, m_commonBlendTypesArr ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_currentRGBIndex > 1 ) + { + m_sourceFactorRGB = m_commonBlendTypes[ m_currentRGBIndex ].SourceFactor; + m_sourceFactorRGBInline.IntValue = (int)m_sourceFactorRGB; + m_sourceFactorRGBInline.SetInlineNodeValue(); + + m_destFactorRGB = m_commonBlendTypes[ m_currentRGBIndex ].DestFactor; + m_destFactorRGBInline.IntValue = (int)m_destFactorRGB; + m_destFactorRGBInline.SetInlineNodeValue(); + } + } + EditorGUI.BeginDisabledGroup( m_currentRGBIndex == 0 ); + + EditorGUI.BeginChangeCheck(); + float cached = EditorGUIUtility.labelWidth; + if( style ) + { + EditorGUIUtility.labelWidth = 40; + } + else + { + EditorGUIUtility.labelWidth = 25; + } + + EditorGUILayout.BeginHorizontal(); + //m_sourceFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorRGB ); + m_sourceFactorRGBInline.CustomDrawer( ref owner, ( x ) => { m_sourceFactorRGB = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorRGB ); }, SourceFactorStr ); + if( style ) + { + EditorGUI.indentLevel--; + EditorGUIUtility.labelWidth = 25; + } + //m_destFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorRGB ); + m_destFactorRGBInline.CustomDrawer( ref owner, ( x ) => { m_destFactorRGB = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorRGB ); }, DstFactorStr ); + if( style ) + EditorGUI.indentLevel++; + + EditorGUILayout.EndHorizontal(); + + EditorGUIUtility.labelWidth = cached; + if( EditorGUI.EndChangeCheck() ) + { + CheckRGBIndex(); + } + EditorGUI.EndDisabledGroup(); + } + + if( m_blendOpEnabled ) + { + // Both these tests should be removed on a later stage + // ASE v154dev004 changed AvailableBlendOps.OFF value from -1 to 0 + // If importing the new package into an already opened ASE window makes + // hotcode to preserve the -1 value on these variables + if( (int)m_blendOpRGB == -1 ) + m_blendOpRGB = AvailableBlendOps.OFF; + + //m_blendOpRGB = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup( BlendOpsRGBStr, m_blendOpRGB ); + m_blendOpRGBInline.CustomDrawer( ref owner, ( x ) => { m_blendOpRGB = (AvailableBlendOps)x.EditorGUILayoutPopup( BlendOpsRGBStr, (int)m_blendOpRGB, BlendOpsHelper.BlendOpsLabels ); }, BlendOpsRGBStr ); + } + + if( m_blendModeEnabled ) + { + // Alpha + EditorGUILayout.Separator(); + + EditorGUI.BeginChangeCheck(); + m_currentAlphaIndex = owner.EditorGUILayoutPopup( BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_currentAlphaIndex > 0 ) + { + m_sourceFactorAlpha = m_commonBlendTypes[ m_currentAlphaIndex ].SourceFactor; + m_sourceFactorAlphaInline.IntValue = (int)m_sourceFactorAlpha; + m_sourceFactorAlphaInline.SetInlineNodeValue(); + + m_destFactorAlpha = m_commonBlendTypes[ m_currentAlphaIndex ].DestFactor; + m_destFactorAlphaInline.IntValue = (int)m_destFactorAlpha; + m_destFactorAlphaInline.SetInlineNodeValue(); + } + } + EditorGUI.BeginDisabledGroup( m_currentAlphaIndex == 0 ); + + EditorGUI.BeginChangeCheck(); + float cached = EditorGUIUtility.labelWidth; + if( style ) + { + EditorGUIUtility.labelWidth = 40; + } + else + { + EditorGUIUtility.labelWidth = 25; + } + EditorGUILayout.BeginHorizontal(); + //m_sourceFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorAlpha ); + m_sourceFactorAlphaInline.CustomDrawer( ref owner, ( x ) => { m_sourceFactorAlpha = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorAlpha ); }, SourceFactorStr ); + if( style ) + { + EditorGUI.indentLevel--; + EditorGUIUtility.labelWidth = 25; + } + //m_destFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorAlpha ); + m_destFactorAlphaInline.CustomDrawer( ref owner, ( x ) => { m_destFactorAlpha = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorAlpha ); }, DstFactorStr ); + if( style ) + EditorGUI.indentLevel++; + EditorGUILayout.EndHorizontal(); + EditorGUIUtility.labelWidth = cached; + + if( EditorGUI.EndChangeCheck() ) + { + CheckAlphaIndex(); + } + + EditorGUI.EndDisabledGroup(); + //EditorGUILayout.Separator(); + } + + if( m_blendOpEnabled ) + { + if( (int)m_blendOpAlpha == -1 ) + m_blendOpAlpha = AvailableBlendOps.OFF; + + //m_blendOpAlpha = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup( BlendOpsAlphaStr, m_blendOpAlpha ); + m_blendOpAlphaInline.CustomDrawer( ref owner, ( x ) => { m_blendOpAlpha = (AvailableBlendOps)x.EditorGUILayoutPopup( BlendOpsAlphaStr, (int)m_blendOpAlpha, BlendOpsHelper.BlendOpsLabels ); }, BlendOpsAlphaStr ); + } + + EditorGUIUtility.labelWidth = cache; + } + + if( EditorGUI.EndChangeCheck() ) + { + m_isDirty = true; + CustomEdited = true; + } + } + + void CheckRGBIndex() + { + int count = m_commonBlendTypes.Count; + m_currentRGBIndex = 1; + for( int i = 1; i < count; i++ ) + { + if( m_commonBlendTypes[ i ].SourceFactor == m_sourceFactorRGB && m_commonBlendTypes[ i ].DestFactor == m_destFactorRGB ) + { + m_currentRGBIndex = i; + return; + } + } + + } + + void CheckAlphaIndex() + { + int count = m_commonBlendTypes.Count; + m_currentAlphaIndex = 1; + for( int i = 1; i < count; i++ ) + { + if( m_commonBlendTypes[ i ].SourceFactor == m_sourceFactorAlpha && m_commonBlendTypes[ i ].DestFactor == m_destFactorAlpha ) + { + m_currentAlphaIndex = i; + if( m_currentAlphaIndex > 0 && m_currentRGBIndex == 0 ) + m_currentRGBIndex = 1; + return; + } + } + + if( m_currentAlphaIndex > 0 && m_currentRGBIndex == 0 ) + m_currentRGBIndex = 1; + } + + public void ReadAlphaToMaskFromString( ref uint index, ref string[] nodeParams ) + { + //TODO: we should send this data to the alpha to mask module instead + if( UIUtils.CurrentShaderVersion() > 16102 && UIUtils.CurrentShaderVersion() <= 18103) + { + bool validAlphaToMask = Convert.ToBoolean( nodeParams[ index++ ] ); + if( validAlphaToMask ) + { + /*bool alphaToMaskValue = */Convert.ToBoolean( nodeParams[ index++ ] ); + } + } + } + + public void ReadBlendModeFromString( ref uint index, ref string[] nodeParams ) + { + bool validDataOnMeta = m_validBlendMode; + if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) + { + validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( validDataOnMeta ) + { + if( UIUtils.CurrentShaderVersion() < 15304 ) + { + m_currentRGBIndex = Convert.ToInt32( nodeParams[ index++ ] ); + m_sourceFactorRGB = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); + m_destFactorRGB = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); + + m_currentAlphaIndex = Convert.ToInt32( nodeParams[ index++ ] ); + m_sourceFactorAlpha = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); + m_destFactorAlpha = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); + } + else + { + m_currentRGBIndex = Convert.ToInt32( nodeParams[ index++ ] ); + m_sourceFactorRGBInline.ReadFromString( ref index, ref nodeParams ); + m_sourceFactorRGB = (AvailableBlendFactor)m_sourceFactorRGBInline.IntValue; + m_destFactorRGBInline.ReadFromString( ref index, ref nodeParams ); + m_destFactorRGB = (AvailableBlendFactor)m_destFactorRGBInline.IntValue; + + m_currentAlphaIndex = Convert.ToInt32( nodeParams[ index++ ] ); + m_sourceFactorAlphaInline.ReadFromString( ref index, ref nodeParams ); + m_sourceFactorAlpha = (AvailableBlendFactor)m_sourceFactorAlphaInline.IntValue; + m_destFactorAlphaInline.ReadFromString( ref index, ref nodeParams ); + m_destFactorAlpha = (AvailableBlendFactor)m_destFactorAlphaInline.IntValue; + } + } + } + + public void ReadBlendOpFromString( ref uint index, ref string[] nodeParams ) + { + bool validDataOnMeta = m_validBlendOp; + if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) + { + validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( validDataOnMeta ) + { + if( UIUtils.CurrentShaderVersion() < 15304 ) + { + m_blendOpRGB = (AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), nodeParams[ index++ ] ); + m_blendOpAlpha = (AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), nodeParams[ index++ ] ); + } + else + { + m_blendOpRGBInline.ReadFromString( ref index, ref nodeParams ); + m_blendOpAlphaInline.ReadFromString( ref index, ref nodeParams ); + + if( UIUtils.CurrentShaderVersion() < 15404 ) + { + // Now BlendOps enum starts at 0 and not -1 + m_blendOpRGBInline.FloatValue += 1; + m_blendOpAlphaInline.FloatValue += 1; + } + + m_blendOpRGB = (AvailableBlendOps)m_blendOpRGBInline.IntValue; + m_blendOpAlpha = (AvailableBlendOps)m_blendOpAlphaInline.IntValue; + } + //m_blendOpEnabled = ( m_blendOpRGB != AvailableBlendOps.OFF ); + } + } + + public void WriteBlendModeToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_validBlendMode ); + if( m_validBlendMode ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentRGBIndex ); + if( !m_sourceFactorRGBInline.IsValid ) m_sourceFactorRGBInline.IntValue = (int)m_sourceFactorRGB; + m_sourceFactorRGBInline.WriteToString( ref nodeInfo ); + + if( !m_destFactorRGBInline.IsValid ) m_destFactorRGBInline.IntValue = (int)m_destFactorRGB; + m_destFactorRGBInline.WriteToString( ref nodeInfo ); + + IOUtils.AddFieldValueToString( ref nodeInfo, m_currentAlphaIndex ); + if( !m_sourceFactorAlphaInline.IsValid ) m_sourceFactorAlphaInline.IntValue = (int)m_sourceFactorAlpha; + m_sourceFactorAlphaInline.WriteToString( ref nodeInfo ); + + if( !m_destFactorAlphaInline.IsValid ) m_destFactorAlphaInline.IntValue = (int)m_destFactorAlpha; + m_destFactorAlphaInline.WriteToString( ref nodeInfo ); + } + } + + public void WriteBlendOpToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_validBlendOp ); + if( m_validBlendOp ) + { + if( !m_blendOpRGBInline.IsValid ) m_blendOpRGBInline.IntValue = (int)m_blendOpRGB; + m_blendOpRGBInline.WriteToString( ref nodeInfo ); + + if( !m_blendOpAlphaInline.IsValid ) m_blendOpAlphaInline.IntValue = (int)m_blendOpAlpha; + m_blendOpAlphaInline.WriteToString( ref nodeInfo ); + } + } + + public override void ReadFromString( ref uint index, ref string[] nodeParams ) + { + base.ReadFromString( ref index, ref nodeParams ); + ReadBlendModeFromString( ref index, ref nodeParams ); + ReadBlendOpFromString( ref index, ref nodeParams ); + ReadAlphaToMaskFromString( ref index, ref nodeParams ); + } + + public override void WriteToString( ref string nodeInfo ) + { + base.WriteToString( ref nodeInfo ); + WriteBlendModeToString( ref nodeInfo ); + WriteBlendOpToString( ref nodeInfo ); + } + + public override void Destroy() + { + base.Destroy(); + m_sourceFactorRGBInline = null; + m_destFactorRGBInline = null; + m_sourceFactorAlphaInline = null; + m_destFactorAlphaInline = null; + m_blendOpRGBInline = null; + m_blendOpAlphaInline = null; + } + + public string CurrentBlendFactorSingle + { + get + { + return ( m_currentRGBIndex > 0 ) ? string.Format( SingleBlendFactorStr, m_target, m_sourceFactorRGBInline.GetValueOrProperty( m_sourceFactorRGB.ToString() ), m_destFactorRGBInline.GetValueOrProperty( m_destFactorRGB.ToString() ) ) : BlendFactorOff; + } + } + + public string CurrentBlendFactorSeparate + { + get + { + return string.Format( SeparateBlendFactorStr, m_target, + m_sourceFactorRGBInline.GetValueOrProperty( ( m_currentRGBIndex > 0 ? m_sourceFactorRGB.ToString() : AvailableBlendFactor.One.ToString() ) ), + m_destFactorRGBInline.GetValueOrProperty( m_currentRGBIndex > 0 ? m_destFactorRGB.ToString() : AvailableBlendFactor.Zero.ToString() ), + m_sourceFactorAlphaInline.GetValueOrProperty( m_sourceFactorAlpha.ToString() ), + m_destFactorAlphaInline.GetValueOrProperty( m_destFactorAlpha.ToString() ) ); + } + } + + public string CurrentBlendFactor + { + get + { + return ( ( m_currentAlphaIndex > 0 ) ? CurrentBlendFactorSeparate : CurrentBlendFactorSingle ); + } + } + + + public string CurrentBlendOpSingle + { + get + { + return ( m_blendOpRGB != AvailableBlendOps.OFF || m_blendOpRGBInline.IsValid ) ? string.Format( SingleBlendOpStr, Target, m_blendOpRGBInline.GetValueOrProperty( m_blendOpRGB.ToString() ) ) : string.Empty; + } + } + + public string CurrentBlendOpSeparate + { + get + { + return string.Format( SeparateBlendOpStr, Target, m_blendOpRGBInline.GetValueOrProperty( ( m_currentRGBIndex > 0 && m_blendOpRGB != AvailableBlendOps.OFF ) ? m_blendOpRGB.ToString() : AvailableBlendOps.Add.ToString() ), m_blendOpAlphaInline.GetValueOrProperty( m_blendOpAlpha.ToString() ) ); + } + } + + public string CurrentBlendOp { get { return ( ( m_blendOpAlpha != AvailableBlendOps.OFF || m_blendOpAlphaInline.IsValid ) ? CurrentBlendOpSeparate : CurrentBlendOpSingle ); } } + public bool Active { get { return m_blendModeEnabled && ( m_currentRGBIndex > 0 || m_currentAlphaIndex > 0 ); } } + public bool BlendOpActive + { + get + { + return m_blendOpEnabled && + ( + m_blendOpRGBInline.Active || + m_blendOpAlphaInline.Active || + ( !m_blendOpRGBInline.Active && m_blendOpRGB != AvailableBlendOps.OFF ) || + ( !m_blendOpAlphaInline.Active && m_blendOpAlpha != AvailableBlendOps.OFF ) ); + } + } + + public string Target { get { return m_target; } } + public bool ValidBlendMode { get { return m_validBlendMode; } } + public bool ValidBlendOp { get { return m_validBlendOp; } } + public int CurrentRGBIndex { get { return m_currentRGBIndex; } } + + public AvailableBlendFactor SourceFactorRGB + { + get { return m_sourceFactorRGB; } + set + { + m_sourceFactorRGB = value; + m_sourceFactorRGBInline.IntValue = (int)value; + m_sourceFactorRGBInline.Active = false; + } + + } + public AvailableBlendFactor DestFactorRGB + { + get { return m_destFactorRGB; } + set + { + m_destFactorRGB = value; + m_destFactorRGBInline.IntValue = (int)value; + m_destFactorRGBInline.Active = false; + } + } + + public int CurrentAlphaIndex { get { return m_currentAlphaIndex; } set { m_currentAlphaIndex = value; } } + + public AvailableBlendFactor SourceFactorAlpha + { + get { return m_sourceFactorAlpha; } + set + { + m_sourceFactorAlpha = value; + m_sourceFactorAlphaInline.IntValue = (int)value; + m_sourceFactorAlphaInline.Active = false; + } + } + + public AvailableBlendFactor DestFactorAlpha + { + get { return m_destFactorAlpha; } + set + { + m_destFactorAlpha = value; + m_destFactorAlphaInline.IntValue = (int)value; + m_destFactorAlphaInline.Active = false; + + } + } + + public bool BlendModeEnabled { get { return m_blendModeEnabled; } } + public bool BlendOpEnabled { get { return m_blendOpEnabled; } } + public AvailableBlendOps BlendOpRGB + { + get { return m_blendOpRGB; } + set + { + m_blendOpRGB = value; + m_blendOpRGBInline.IntValue = (int)value; + m_blendOpRGBInline.Active = false; + } + } + + public AvailableBlendOps BlendOpAlpha + { + get { return m_blendOpAlpha; } + set + { + m_blendOpAlpha = value; + m_blendOpAlphaInline.IntValue = (int)value; + m_blendOpAlphaInline.Active = false; + } + } + + public InlineProperty SourceFactorRGBInline { get { return m_sourceFactorRGBInline; } } + public InlineProperty DestFactorRGBInline { get { return m_destFactorRGBInline; } } + public InlineProperty SourceFactorAlphaInline { get { return m_sourceFactorAlphaInline; } } + public InlineProperty DestFactorAlphaInline { get { return m_destFactorAlphaInline; } } + public InlineProperty BlendOpRGBInline { get { return m_blendOpRGBInline; } } + public InlineProperty BlendOpAlphaInline { get { return m_blendOpAlphaInline; } } + public bool IsAdditiveRGB { get { return m_validBlendMode && m_blendModeEnabled && ( m_currentRGBIndex > 0 ) && ( m_sourceFactorRGB == AvailableBlendFactor.One ) && ( m_destFactorRGB == AvailableBlendFactor.One ); } } + public bool IsAlphaBlendRGB { get { return m_validBlendMode && m_blendModeEnabled && ( m_currentRGBIndex > 0 ) && ( m_sourceFactorRGB == AvailableBlendFactor.SrcAlpha ) && ( m_destFactorRGB == AvailableBlendFactor.OneMinusSrcAlpha ); } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs.meta new file mode 100644 index 00000000..7f4753a4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7c88941c5badfb7428059cc3ff0c0df9 +timeCreated: 1510933946 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs new file mode 100644 index 00000000..462bc330 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs @@ -0,0 +1,1005 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TemplateInputData + { + public string PortName; + public WirePortDataType DataType; + public MasterNodePortCategory PortCategory; + public int PortUniqueId; + public int OrderId; + public int TagGlobalStartIdx; + public int TagLocalStartIdx; + public string TagId; + public string DefaultValue; + public string LinkId; + + public TemplateInputData( int tagLocalStartIdx, int tagGlobalStartIdx, string tagId, string portName, string defaultValue, WirePortDataType dataType, MasterNodePortCategory portCategory, int portUniqueId, int orderId, string linkId ) + { + DefaultValue = defaultValue; + PortName = portName; + DataType = dataType; + PortCategory = portCategory; + PortUniqueId = portUniqueId; + OrderId = orderId; + TagId = tagId; + TagGlobalStartIdx = tagGlobalStartIdx; + TagLocalStartIdx = tagLocalStartIdx; + LinkId = linkId; + } + + public TemplateInputData( TemplateInputData other ) + { + DefaultValue = other.DefaultValue; + PortName = other.PortName; + DataType = other.DataType; + PortCategory = other.PortCategory; + PortUniqueId = other.PortUniqueId; + OrderId = other.OrderId; + TagId = other.TagId; + TagGlobalStartIdx = other.TagGlobalStartIdx; + LinkId = other.LinkId; + } + } + + + + [Serializable] + public class TemplatePropertyContainer + { + [SerializeField] + private List m_propertyList = new List(); + private Dictionary m_propertyDict = new Dictionary(); + + + public void AddId( TemplateProperty templateProperty ) + { + BuildInfo(); + m_propertyList.Add( templateProperty ); + m_propertyDict.Add( templateProperty.Id, templateProperty ); + } + + public void AddId( string body, string ID, bool searchIndentation = true ) + { + AddId( body, ID, searchIndentation, string.Empty ); + } + + public void AddId( string body, string ID, bool searchIndentation, string customIndentation ) + { + BuildInfo(); + + int propertyIndex = body.IndexOf( ID ); + if( propertyIndex > -1 ) + { + if( searchIndentation ) + { + int identationIndex = -1; + for( int i = propertyIndex; i >= 0; i-- ) + { + if( body[ i ] == TemplatesManager.TemplateNewLine ) + { + identationIndex = i + 1; + break; + } + + if( i == 0 ) + { + identationIndex = 0; + } + } + if( identationIndex > -1 ) + { + int length = propertyIndex - identationIndex; + string indentation = ( length > 0 ) ? body.Substring( identationIndex, length ) : string.Empty; + TemplateProperty templateProperty = new TemplateProperty( ID, indentation, false ); + m_propertyList.Add( templateProperty ); + m_propertyDict.Add( templateProperty.Id, templateProperty ); + } + else + { + TemplateProperty templateProperty = new TemplateProperty( ID, string.Empty, false ); + m_propertyList.Add( templateProperty ); + m_propertyDict.Add( templateProperty.Id, templateProperty ); + } + } + else + { + TemplateProperty templateProperty = new TemplateProperty( ID, customIndentation, true ); + m_propertyList.Add( templateProperty ); + m_propertyDict.Add( templateProperty.Id, templateProperty ); + } + } + } + + + public void AddId( string body, string ID, int propertyIndex, bool searchIndentation ) + { + AddId( body, ID, propertyIndex, searchIndentation, string.Empty ); + } + + public void AddId( string body, string ID, int propertyIndex, bool searchIndentation, string customIndentation ) + { + if( body == null || string.IsNullOrEmpty( body ) ) + return; + + BuildInfo(); + if( searchIndentation && propertyIndex > -1 && propertyIndex < body.Length ) + { + int indentationIndex = -1; + for( int i = propertyIndex; i > 0; i-- ) + { + if( body[ i ] == TemplatesManager.TemplateNewLine ) + { + indentationIndex = i + 1; + break; + } + } + + if( indentationIndex > -1 ) + { + int length = propertyIndex - indentationIndex; + string indentation = ( length > 0 ) ? body.Substring( indentationIndex, length ) : string.Empty; + TemplateProperty templateProperty = new TemplateProperty( ID, indentation, false ); + m_propertyList.Add( templateProperty ); + m_propertyDict.Add( templateProperty.Id, templateProperty ); + } + } + else + { + TemplateProperty templateProperty = new TemplateProperty( ID, customIndentation, true ); + m_propertyList.Add( templateProperty ); + m_propertyDict.Add( templateProperty.Id, templateProperty ); + } + + } + public void BuildInfo() + { + if( m_propertyDict == null ) + { + m_propertyDict = new Dictionary(); + } + + if( m_propertyList.Count != m_propertyDict.Count ) + { + m_propertyDict.Clear(); + for( int i = 0; i < m_propertyList.Count; i++ ) + { + m_propertyDict.Add( m_propertyList[ i ].Id, m_propertyList[ i ] ); + } + } + } + + public void ResetTemplateUsageData() + { + BuildInfo(); + for( int i = 0; i < m_propertyList.Count; i++ ) + { + m_propertyList[ i ].Used = false; + } + } + + public void Reset() + { + m_propertyList.Clear(); + m_propertyDict.Clear(); + } + + public void Destroy() + { + m_propertyList.Clear(); + m_propertyList = null; + m_propertyDict.Clear(); + m_propertyDict = null; + } + + + public Dictionary PropertyDict + { + get + { + BuildInfo(); + return m_propertyDict; + } + } + public List PropertyList { get { return m_propertyList; } } + } + + [Serializable] + public class TemplateProperty + { + public bool UseIndentationAtStart = false; + public string Indentation; + public bool UseCustomIndentation; + public string Id; + public bool AutoLineFeed; + public bool Used; + + public TemplateProperty( string id, string indentation, bool useCustomIndentation ) + { + Id = id; + Indentation = indentation; + UseCustomIndentation = useCustomIndentation; + AutoLineFeed = !string.IsNullOrEmpty( indentation ); + Used = false; + } + } + + [Serializable] + public class TemplateTessVControlTag + { + public string Id; + public int StartIdx; + + public TemplateTessVControlTag() + { + StartIdx = -1; + } + + public bool IsValid { get { return StartIdx >= 0; } } + } + + [Serializable] + public class TemplateTessControlData + { + public string Id; + public int StartIdx; + public string InVarType; + public string InVarName; + public string OutVarType; + public string OutVarName; + + public bool IsValid { get { return StartIdx >= 0; } } + + public TemplateTessControlData() + { + StartIdx = -1; + } + + public TemplateTessControlData( int startIdx, string id, string inVarInfo, string outVarInfo ) + { + StartIdx = startIdx; + Id = id; + string[] inVarInfoArr = inVarInfo.Split( IOUtils.VALUE_SEPARATOR ); + if( inVarInfoArr.Length > 1 ) + { + InVarType = inVarInfoArr[ 1 ]; + InVarName = inVarInfoArr[ 0 ]; + } + + string[] outVarInfoArr = outVarInfo.Split( IOUtils.VALUE_SEPARATOR ); + if( outVarInfoArr.Length > 1 ) + { + OutVarType = outVarInfoArr[ 1 ]; + OutVarName = outVarInfoArr[ 0 ]; + } + } + + public string[] GenerateControl( Dictionary vertexData, List inputList ) + { + List value = new List(); + if( vertexData != null && vertexData.Count > 0 ) + { + foreach( var item in vertexData ) + { + if( inputList.FindIndex( x => { return x.Contains( item.Value.VarName ); } ) > -1 ) + value.Add( string.Format( "{0}.{1} = {2}.{1};", OutVarName, item.Value.VarName, InVarName ) ); + } + } + return value.ToArray(); + } + } + + [Serializable] + public class TemplateTessDomainData + { + public string Id; + public int StartIdx; + public string InVarType; + public string InVarName; + public string OutVarType; + public string OutVarName; + public string BaryVarType; + public string BaryVarName; + + public bool IsValid { get { return StartIdx >= 0; } } + + public TemplateTessDomainData() + { + StartIdx = -1; + } + + public TemplateTessDomainData( int startIdx, string id, string inVarInfo, string outVarInfo, string baryVarInfo ) + { + StartIdx = startIdx; + Id = id; + string[] inVarInfoArr = inVarInfo.Split( IOUtils.VALUE_SEPARATOR ); + if( inVarInfoArr.Length > 1 ) + { + InVarType = inVarInfoArr[ 1 ]; + InVarName = inVarInfoArr[ 0 ]; + } + + string[] outVarInfoArr = outVarInfo.Split( IOUtils.VALUE_SEPARATOR ); + if( outVarInfoArr.Length > 1 ) + { + OutVarType = outVarInfoArr[ 1 ]; + OutVarName = outVarInfoArr[ 0 ]; + } + + string[] baryVarInfoArr = baryVarInfo.Split( IOUtils.VALUE_SEPARATOR ); + if( baryVarInfoArr.Length > 1 ) + { + BaryVarType = baryVarInfoArr[ 1 ]; + BaryVarName = baryVarInfoArr[ 0 ]; + } + } + + public string[] GenerateDomain( Dictionary vertexData, List inputList ) + { + List value = new List(); + if( vertexData != null && vertexData.Count > 0 ) + { + foreach( var item in vertexData ) + { + //o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; + if( inputList.FindIndex( x => { return x.Contains( item.Value.VarName ); } ) > -1 ) + value.Add( string.Format( "{0}.{1} = {2}[0].{1} * {3}.x + {2}[1].{1} * {3}.y + {2}[2].{1} * {3}.z;", OutVarName, item.Value.VarName, InVarName, BaryVarName ) ); + } + } + return value.ToArray(); + } + } + + [Serializable] + public class TemplateFunctionData + { + public int MainBodyLocalIdx; + public string MainBodyName; + + public string Id; + public int Position; + public string InVarType; + public string InVarName; + public string OutVarType; + public string OutVarName; + public MasterNodePortCategory Category; + public TemplateFunctionData( int mainBodyLocalIdx, string mainBodyName, string id, int position, string inVarInfo, string outVarInfo, MasterNodePortCategory category ) + { + MainBodyLocalIdx = mainBodyLocalIdx; + MainBodyName = mainBodyName; + Id = id; + Position = position; + { + string[] inVarInfoArr = inVarInfo.Split( IOUtils.VALUE_SEPARATOR ); + if( inVarInfoArr.Length > 1 ) + { + InVarType = inVarInfoArr[ 1 ]; + InVarName = inVarInfoArr[ 0 ]; + } + } + { + string[] outVarInfoArr = outVarInfo.Split( IOUtils.VALUE_SEPARATOR ); + if( outVarInfoArr.Length > 1 ) + { + OutVarType = outVarInfoArr[ 1 ]; + OutVarName = outVarInfoArr[ 0 ]; + } + } + Category = category; + } + } + + [Serializable] + public class TemplateTagData + { + public int StartIdx = -1; + public string Id; + public bool SearchIndentation; + public string CustomIndentation; + + + public TemplateTagData( int startIdx, string id, bool searchIndentation ) + { + StartIdx = startIdx; + Id = id; + SearchIndentation = searchIndentation; + CustomIndentation = string.Empty; + } + + public TemplateTagData( string id, bool searchIndentation ) + { + Id = id; + SearchIndentation = searchIndentation; + CustomIndentation = string.Empty; + } + + public TemplateTagData( string id, bool searchIndentation, string customIndentation ) + { + Id = id; + SearchIndentation = searchIndentation; + CustomIndentation = customIndentation; + } + + public bool IsValid { get { return StartIdx >= 0; } } + } + + public enum TemplatePortIds + { + Name = 0, + DataType, + UniqueId, + OrderId, + Link + } + + public enum TemplateCommonTagId + { + Property = 0, + Global = 1, + Function = 2, + Tag = 3, + Pragmas = 4, + Pass = 5, + Params_Vert = 6, + Params_Frag = 7 + //CullMode = 8, + //BlendMode = 9, + //BlendOp = 10, + //ColorMask = 11, + //StencilOp = 12 + } + + [Serializable] + public class TemplatesManager : ScriptableObject + { + public static int MPShaderVersion = 14503; + + public static readonly string TemplateShaderNameBeginTag = "/*ase_name*/"; + public static readonly string TemplateStencilTag = "/*ase_stencil*/\n"; + public static readonly string TemplateRenderPlatformsTag = "/*ase_render_platforms*/"; + public static readonly string TemplateAllModulesTag = "/*ase_all_modules*/\n"; + public static readonly string TemplateMPSubShaderTag = "\\bSubShader\\b\\s*{"; + //public static readonly string TemplateMPPassTag = "^\\s*Pass\b\\s*{";//"\\bPass\\b\\s*{"; + public static readonly string TemplateMPPassTag = "\\bPass\\b\\s*{"; + public static readonly string TemplateLocalVarTag = "/*ase_local_var*/"; + public static readonly string TemplateDependenciesListTag = "/*ase_dependencies_list*/"; + public static readonly string TemplatePragmaBeforeTag = "/*ase_pragma_before*/"; + public static readonly string TemplatePragmaTag = "/*ase_pragma*/"; + public static readonly string TemplatePassTag = "/*ase_pass*/"; + public static readonly string TemplatePassesEndTag = "/*ase_pass_end*/"; + public static readonly string TemplateLODsTag = "/*ase_lod*/"; + //public static readonly string TemplatePassTagPattern = @"\s\/\*ase_pass\*\/"; + public static readonly string TemplatePassTagPattern = @"\s\/\*ase_pass[:\*]+"; + public static readonly string TemplatePropertyTag = "/*ase_props*/"; + public static readonly string TemplateGlobalsTag = "/*ase_globals*/"; + public static readonly string TemplateSRPBatcherTag = "/*ase_srp_batcher*/\n"; + public static readonly string TemplateInterpolatorBeginTag = "/*ase_interp("; + public static readonly string TemplateVertexDataTag = "/*ase_vdata:"; + + public static readonly string TemplateTessVControlTag = "/*ase_vcontrol*/"; + public static readonly string TemplateTessControlCodeArea = "/*ase_control_code:"; + public static readonly string TemplateTessDomainCodeArea = "/*ase_domain_code:"; + + //public static readonly string TemplateExcludeFromGraphTag = "/*ase_hide_pass*/"; + public static readonly string TemplateMainPassTag = "/*ase_main_pass*/"; + + public static readonly string TemplateFunctionsTag = "/*ase_funcs*/\n"; + //public static readonly string TemplateTagsTag = "/*ase_tags*/"; + + //public static readonly string TemplateCullModeTag = "/*ase_cull_mode*/"; + //public static readonly string TemplateBlendModeTag = "/*ase_blend_mode*/"; + //public static readonly string TemplateBlendOpTag = "/*ase_blend_op*/"; + //public static readonly string TemplateColorMaskTag = "/*ase_color_mask*/"; + //public static readonly string TemplateStencilOpTag = "/*ase_stencil*/"; + + public static readonly string TemplateCodeSnippetAttribBegin = "#CODE_SNIPPET_ATTRIBS_BEGIN#"; + public static readonly string TemplateCodeSnippetAttribEnd = "#CODE_SNIPPET_ATTRIBS_END#\n"; + public static readonly string TemplateCodeSnippetEnd = "#CODE_SNIPPET_END#\n"; + + public static readonly char TemplateNewLine = '\n'; + + // INPUTS AREA + public static readonly string TemplateInputsVertBeginTag = "/*ase_vert_out:"; + public static readonly string TemplateInputsFragBeginTag = "/*ase_frag_out:"; + public static readonly string TemplateInputsVertParamsTag = "/*ase_vert_input*/"; + public static readonly string TemplateInputsFragParamsTag = "/*ase_frag_input*/"; + + + // CODE AREA + public static readonly string TemplateVertexCodeBeginArea = "/*ase_vert_code:"; + public static readonly string TemplateFragmentCodeBeginArea = "/*ase_frag_code:"; + + + public static readonly string TemplateEndOfLine = "*/\n"; + public static readonly string TemplateEndSectionTag = "*/"; + public static readonly string TemplateFullEndTag = "/*end*/"; + + public static readonly string NameFormatter = "\"{0}\""; + + public static readonly TemplateTagData[] CommonTags = { new TemplateTagData( TemplatePropertyTag,true), + new TemplateTagData( TemplateGlobalsTag,true), + new TemplateTagData( TemplateSRPBatcherTag,true), + new TemplateTagData( TemplateFunctionsTag,true), + //new TemplateTagData( TemplateTagsTag,false," "), + new TemplateTagData( TemplatePragmaBeforeTag,true), + new TemplateTagData( TemplatePragmaTag,true), + new TemplateTagData( TemplatePassTag,true), + new TemplateTagData( TemplateInputsVertParamsTag,false), + new TemplateTagData( TemplateInputsFragParamsTag,false), + new TemplateTagData( TemplateLODsTag,true) + //new TemplateTagData( TemplateCullModeTag,false), + //new TemplateTagData( TemplateBlendModeTag,false), + //new TemplateTagData( TemplateBlendOpTag,false), + //new TemplateTagData( TemplateColorMaskTag,false), + //new TemplateTagData( TemplateStencilOpTag,true), + }; + public static string URPLitGUID = "94348b07e5e8bab40bd6c8a1e3df54cd"; + public static string URPUnlitGUID = "2992e84f91cbeb14eab234972e07ea9d"; + + public static string HDRPLitGUID = "53b46d85872c5b24c8f4f0a1c3fe4c87"; + public static string HDRPUnlitGUID = "7f5cb9c3ea6481f469fdd856555439ef"; + + public static Dictionary DeprecatedTemplates = new Dictionary() + { + }; + + public static Dictionary OfficialTemplates = new Dictionary() + { + { "6ce779933eb99f049b78d6163735e06f","Custom Render Texture/Initialize"}, + { "32120270d1b3a8746af2aca8bc749736","Custom Render Texture/Update"}, + + { "5056123faa0c79b47ab6ad7e8bf059a4","UI/Default" }, + + { "ed95fe726fd7b4644bb42f4d1ddd2bcd","Legacy/Lit"}, + { "0770190933193b94aaa3065e307002fa","Legacy/Unlit"}, + { "899e609c083c74c4ca567477c39edef0","Legacy/Unlit Lightmap" }, + { "e1de45c0d41f68c41b2cc20c8b9c05ef","Legacy/Multi Pass Unlit" }, + + { "32139be9c1eb75640a847f011acf3bcf","Legacy/Post-Processing Stack"}, + { "c71b220b631b6344493ea3cf87110c93","Legacy/Image Effect" }, + + { "0f8ba0101102bb14ebf021ddadce9b49","Legacy/Default Sprites" }, + { "0b6a9f8b4f707c74ca64c0be8e590de0","Legacy/Particles Alpha Blended" }, + + + { URPLitGUID,"Universal/Lit"}, + { URPUnlitGUID,"Universal/Unlit"}, + + { HDRPLitGUID,"HDRP/Lit"}, + { HDRPUnlitGUID,"HDRP/Unlit"}, + }; + + public static readonly string TemplateMenuItemsFileGUID = "da0b931bd234a1e43b65f684d4b59bfb"; + + private Dictionary m_availableTemplates = new Dictionary(); + + [SerializeField] + private List m_sortedTemplates = new List(); + + [SerializeField] + public string[] AvailableTemplateNames; + + [SerializeField] + public bool Initialized = false; + + private Dictionary m_optionsInitialSetup = new Dictionary(); + + public static string CurrTemplateGUIDLoaded = string.Empty; + + public static bool IsTestTemplate { get { return CurrTemplateGUIDLoaded.Equals( "a95a019bbc760714bb8228af04c291d1" ); } } + public static bool ShowDebugMessages = false; + public void RefreshAvailableTemplates() + { + if( m_availableTemplates.Count != m_sortedTemplates.Count ) + { + m_availableTemplates.Clear(); + int count = m_sortedTemplates.Count; + for( int i = 0; i < count; i++ ) + { + m_availableTemplates.Add( m_sortedTemplates[ i ].GUID, m_sortedTemplates[ i ] ); + } + } + } + + struct TemplateDescriptor + { + public TemplateDataParent template; + public string name; + public string guid; + public string path; + public bool isCommunity; + } + + public void Init() + { + if( !Initialized ) + { + if( ShowDebugMessages ) + Debug.Log( "Initialize" ); + + string templateMenuItems = IOUtils.LoadTextFileFromDisk( AssetDatabase.GUIDToAssetPath( TemplateMenuItemsFileGUID ) ); + bool refreshTemplateMenuItems = false; + + string[] allShaders = AssetDatabase.FindAssets( "t:shader" ); + var templates = new Dictionary(); + + // Add official templates first + foreach ( KeyValuePair kvp in OfficialTemplates ) + { + string guid = kvp.Key; + string path = AssetDatabase.GUIDToAssetPath( guid ); + if ( !string.IsNullOrEmpty( path ) && !templates.ContainsKey( guid ) ) + { + var desc = new TemplateDescriptor(); + desc.template = ScriptableObject.CreateInstance(); + desc.name = kvp.Value; + desc.guid = guid; + desc.path = path; + desc.isCommunity = false; + templates.Add( desc.guid, desc ); + } + } + + // Search for other possible templates on the project + var candidates = new List>( allShaders.Length ); + var candidateBag = new ConcurrentBag(); + + for ( int i = 0; i < allShaders.Length; i++ ) + { + if ( !templates.ContainsKey( allShaders[ i ] ) ) + { + candidates.Add( new KeyValuePair( allShaders[ i ], AssetDatabase.GUIDToAssetPath( allShaders[ i ] ) ) ); + } + } + + Parallel.For( 0, candidates.Count, i => + { + string body = File.ReadAllText( candidates[ i ].Value ); ; + if ( body.IndexOf( TemplatesManager.TemplateShaderNameBeginTag ) > -1 ) + { + candidateBag.Add( candidates[ i ].Key ); + } + } ); + + foreach ( var guid in candidateBag ) + { + TemplateDataParent template = GetTemplate( guid ); + if ( template == null && !templates.ContainsKey( guid ) ) + { + var desc = new TemplateDescriptor(); + desc.template = ScriptableObject.CreateInstance(); + desc.name = string.Empty; + desc.guid = guid; + desc.path = AssetDatabase.GUIDToAssetPath( guid ); + desc.isCommunity = true; + templates.Add( desc.guid, desc ); + } + } + + var templateList = templates.Values.ToArray(); + Parallel.For( 0, templateList.Length, i => + { + TemplateDescriptor desc = templateList[ i ]; + desc.template.Init( desc.name, desc.guid, desc.path, desc.isCommunity ); + } ); + + foreach ( var pair in templates ) + { + TemplateDescriptor desc = pair.Value; + + if ( desc.template.IsValid ) + { + AddTemplate( desc.template ); + } + + if ( !desc.isCommunity && !refreshTemplateMenuItems && templateMenuItems.IndexOf( name ) < 0 ) + { + refreshTemplateMenuItems = true; + } + } + + AvailableTemplateNames = new string[ m_sortedTemplates.Count + 1 ]; + AvailableTemplateNames[ 0 ] = "Custom"; + for( int i = 0; i < m_sortedTemplates.Count; i++ ) + { + m_sortedTemplates[ i ].OrderId = i; + AvailableTemplateNames[ i + 1 ] = m_sortedTemplates[ i ].Name; + } + + if( refreshTemplateMenuItems ) + CreateTemplateMenuItems(); + + Initialized = true; + } + } + + //[MenuItem( "Window/Amplify Shader Editor/Create Menu Items", false, 1000 )] + //public static void ForceCreateTemplateMenuItems() + //{ + // UIUtils.CurrentWindow.TemplatesManagerInstance.CreateTemplateMenuItems(); + //} + + public void CreateTemplateMenuItems() + { + if( m_sortedTemplates == null || m_sortedTemplates.Count == 0 ) + return; + + // change names for duplicates + for( int i = 0; i < m_sortedTemplates.Count; i++ ) + { + for( int j = 0; j < i; j++ ) + { + if( m_sortedTemplates[ i ].Name == m_sortedTemplates[ j ].Name ) + { + var match = Regex.Match( m_sortedTemplates[ i ].Name, @"^.*?(\d+(?:[.,]\d+)?)\s*$" ); + if( match.Success ) + { + string strNumber = match.Groups[ 1 ].Value; + int number = int.Parse( strNumber ) + 1; + string firstPart = m_sortedTemplates[ i ].Name.Substring( 0, match.Groups[ 1 ].Index ); + string secondPart = m_sortedTemplates[ i ].Name.Substring( match.Groups[ 1 ].Index + strNumber.Length ); + m_sortedTemplates[ i ].Name = firstPart + number + secondPart; + } + else + { + m_sortedTemplates[ i ].Name += " 1"; + } + } + } + } + + // Sort templates by name + var sorted = new SortedDictionary(); + for ( int i = 0; i < m_sortedTemplates.Count; i++ ) + { + sorted.Add( m_sortedTemplates[ i ].Name, m_sortedTemplates[ i ].GUID ); + } + + System.Text.StringBuilder fileContents = new System.Text.StringBuilder(); + fileContents.Append( "// Amplify Shader Editor - Visual Shader Editing Tool\n" ); + fileContents.Append( "// Copyright (c) Amplify Creations, Lda \n" ); + fileContents.Append( "using UnityEditor;\n" ); + fileContents.Append( "\n" ); + fileContents.Append( "namespace AmplifyShaderEditor\n" ); + fileContents.Append( "{\n" ); + fileContents.Append( "\tpublic class TemplateMenuItems\n" ); + fileContents.Append( "\t{\n" ); + int fixedPriority = 85; + foreach ( var pair in sorted ) + { + fileContents.AppendFormat( "\t\t[MenuItem( \"Assets/Create/Amplify Shader/{0}\", false, {1} )]\n", pair.Key, fixedPriority ); + string itemName = UIUtils.RemoveInvalidCharacters( pair.Key ); + fileContents.AppendFormat( "\t\tpublic static void ApplyTemplate{0}()\n", itemName/*i*/ ); + fileContents.Append( "\t\t{\n" ); + //fileContents.AppendFormat( "\t\t\tAmplifyShaderEditorWindow.CreateNewTemplateShader( \"{0}\" );\n", m_sortedTemplates[ i ].GUID ); + fileContents.AppendFormat( "\t\t\tAmplifyShaderEditorWindow.CreateConfirmationTemplateShader( \"{0}\" );\n", pair.Value ); + fileContents.Append( "\t\t}\n" ); + } + fileContents.Append( "\t}\n" ); + fileContents.Append( "}\n" ); + string filePath = AssetDatabase.GUIDToAssetPath( TemplateMenuItemsFileGUID ); + IOUtils.SaveTextfileToDisk( fileContents.ToString(), filePath, false ); + m_filepath = filePath; + //AssetDatabase.ImportAsset( filePath ); + } + + string m_filepath = string.Empty; + + public void ReimportMenuItems() + { + if( !string.IsNullOrEmpty( m_filepath ) ) + { + AssetDatabase.ImportAsset( m_filepath ); + m_filepath = string.Empty; + } + } + + public int GetIdForTemplate( TemplateData templateData ) + { + if( templateData == null ) + return -1; + + for( int i = 0; i < m_sortedTemplates.Count; i++ ) + { + if( m_sortedTemplates[ i ].GUID.Equals( templateData.GUID ) ) + return m_sortedTemplates[ i ].OrderId; + } + return -1; + } + + + + public void AddTemplate( TemplateDataParent templateData ) + { + if( templateData == null || !templateData.IsValid ) + return; + RefreshAvailableTemplates(); + if( !m_availableTemplates.ContainsKey( templateData.GUID ) ) + { + m_sortedTemplates.Add( templateData ); + m_availableTemplates.Add( templateData.GUID, templateData ); + } + } + + public void RemoveTemplate( string guid ) + { + TemplateDataParent templateData = GetTemplate( guid ); + if( templateData != null ) + { + RemoveTemplate( templateData ); + } + } + + public void RemoveTemplate( TemplateDataParent templateData ) + { + RefreshAvailableTemplates(); + + if( m_availableTemplates != null ) + m_availableTemplates.Remove( templateData.GUID ); + + m_sortedTemplates.Remove( templateData ); + templateData.Destroy(); + } + + public void Destroy() + { + if( TemplatesManager.ShowDebugMessages ) + Debug.Log( "Destroy Manager" ); + if( m_availableTemplates != null ) + { + foreach( KeyValuePair kvp in m_availableTemplates ) + { + kvp.Value.Destroy(); + } + m_availableTemplates.Clear(); + m_availableTemplates = null; + } + int count = m_sortedTemplates.Count; + + for( int i = 0; i < count; i++ ) + { + ScriptableObject.DestroyImmediate( m_sortedTemplates[ i ] ); + } + + m_sortedTemplates.Clear(); + m_sortedTemplates = null; + + AvailableTemplateNames = null; + Initialized = false; + } + + public TemplateDataParent GetTemplate( int id ) + { + if( id < m_sortedTemplates.Count ) + return m_sortedTemplates[ id ]; + + return null; + } + + public TemplateDataParent GetTemplate( string guid ) + { + RefreshAvailableTemplates(); + if( m_availableTemplates == null && m_sortedTemplates != null ) + { + m_availableTemplates = new Dictionary(); + for( int i = 0; i < m_sortedTemplates.Count; i++ ) + { + m_availableTemplates.Add( m_sortedTemplates[ i ].GUID, m_sortedTemplates[ i ] ); + } + } + + if( m_availableTemplates.ContainsKey( guid ) ) + return m_availableTemplates[ guid ]; + + return null; + } + + + public TemplateDataParent GetTemplateByName( string name ) + { + RefreshAvailableTemplates(); + if( m_availableTemplates == null && m_sortedTemplates != null ) + { + m_availableTemplates = new Dictionary(); + for( int i = 0; i < m_sortedTemplates.Count; i++ ) + { + m_availableTemplates.Add( m_sortedTemplates[ i ].GUID, m_sortedTemplates[ i ] ); + } + } + + foreach( KeyValuePair kvp in m_availableTemplates ) + { + if( kvp.Value.DefaultShaderName.Equals( name ) ) + { + return kvp.Value; + } + } + return null; + } + + public TemplateDataParent CheckAndLoadTemplate( string guid ) + { + TemplateDataParent templateData = GetTemplate( guid ); + if( templateData == null ) + { + string datapath = AssetDatabase.GUIDToAssetPath( guid ); + string body = IOUtils.LoadTextFileFromDisk( datapath ); + + if( body.IndexOf( TemplatesManager.TemplateShaderNameBeginTag ) > -1 ) + { + templateData = ScriptableObject.CreateInstance(); + templateData.Init( string.Empty, guid, datapath, true ); + if( templateData.IsValid ) + { + AddTemplate( templateData ); + return templateData; + } + } + } + + return null; + } + + private void OnEnable() + { + if( !Initialized ) + { + Init(); + } + else + { + RefreshAvailableTemplates(); + } + hideFlags = HideFlags.HideAndDontSave; + if( ShowDebugMessages ) + Debug.Log( "On Enable Manager: " + this.GetInstanceID() ); + } + + public void ResetOptionsSetupData() + { + if( ShowDebugMessages ) + Debug.Log( "Reseting options setup data" ); + m_optionsInitialSetup.Clear(); + } + + public bool SetOptionsValue( string optionId, bool value ) + { + if( m_optionsInitialSetup.ContainsKey( optionId ) ) + { + m_optionsInitialSetup[ optionId ] = m_optionsInitialSetup[ optionId ] || value; + } + else + { + m_optionsInitialSetup.Add( optionId, value ); + } + return m_optionsInitialSetup[ optionId ]; + } + + public bool CheckIfDeprecated( string guid , out string newGUID ) + { + if( DeprecatedTemplates.ContainsKey( guid ) ) + { + UIUtils.ShowMessage( "Shader using deprecated template which no longer exists on ASE. Pointing to new correct one, options and connections to master node were reset." ); + newGUID = DeprecatedTemplates[ guid ]; + return true; + } + newGUID = string.Empty; + return false; + } + + public int TemplateCount { get { return m_sortedTemplates.Count; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs.meta new file mode 100644 index 00000000..4d8da191 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 9f0aacdb47cf3b94ebbe9e72af9d3cf1 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs new file mode 100644 index 00000000..3703f7e8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs @@ -0,0 +1,668 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + + [Serializable] + public sealed class TemplatesStencilBufferModule : TemplateModuleParent + { + private const string FoldoutLabelStr = " Stencil Buffer"; + private GUIContent ReferenceValueContent = new GUIContent( "Reference", "The value to be compared against (if Comparison is anything else than always) and/or the value to be written to the buffer (if either Pass, Fail or ZFail is set to replace)" ); + private GUIContent ReadMaskContent = new GUIContent( "Read Mask", "An 8 bit mask as an 0-255 integer, used when comparing the reference value with the contents of the buffer (referenceValue & readMask) comparisonFunction (stencilBufferValue & readMask)" ); + private GUIContent WriteMaskContent = new GUIContent( "Write Mask", "An 8 bit mask as an 0-255 integer, used when writing to the buffer" ); + private const string ComparisonStr = "Comparison"; + private const string PassStr = "Pass"; + private const string FailStr = "Fail"; + private const string ZFailStr = "ZFail"; + + private const string ComparisonFrontStr = "Comp. Front"; + private const string PassFrontStr = "Pass Front"; + private const string FailFrontStr = "Fail Front"; + private const string ZFailFrontStr = "ZFail Front"; + + private const string ComparisonBackStr = "Comp. Back"; + private const string PassBackStr = "Pass Back"; + private const string FailBackStr = "Fail Back"; + private const string ZFailBackStr = "ZFail Back"; + + private Dictionary m_comparisonDict = new Dictionary(); + private Dictionary m_stencilOpsDict = new Dictionary(); + + [SerializeField] + private bool m_active = true; + + private const int ReferenceDefaultValue = 0; + [SerializeField] private InlineProperty m_reference = new InlineProperty( ReferenceDefaultValue ); + + // Read Mask + private const int ReadMaskDefaultValue = 255; + [SerializeField] private InlineProperty m_readMask = new InlineProperty( ReadMaskDefaultValue ); + + //Write Mask + private const int WriteMaskDefaultValue = 255; + [SerializeField] private InlineProperty m_writeMask = new InlineProperty( WriteMaskDefaultValue ); + + //Comparison Function + [NonSerialized] private int ComparisonDefaultValue = 0; + [SerializeField] private InlineProperty m_comparisonFunctionFrontIdx; + [SerializeField] private InlineProperty m_comparisonFunctionBackIdx; + + //Pass Stencil Op + [NonSerialized] private int PassStencilOpDefaultValue = 0; + [SerializeField] private InlineProperty m_passStencilOpFrontIdx; + [SerializeField] private InlineProperty m_passStencilOpBackIdx; + + //Fail Stencil Op + [NonSerialized] private int FailStencilOpDefaultValue = 0; + [SerializeField] private InlineProperty m_failStencilOpFrontIdx; + [SerializeField] private InlineProperty m_failStencilOpBackIdx; + + //ZFail Stencil Op + [NonSerialized] private int ZFailStencilOpDefaultValue = 0; + [SerializeField] private InlineProperty m_zFailStencilOpFrontIdx; + [SerializeField] private InlineProperty m_zFailStencilOpBackIdx; + + public TemplatesStencilBufferModule() : base("Stencil Buffer") + { + for( int i = 0; i < StencilBufferOpHelper.StencilComparisonValues.Length; i++ ) + { + m_comparisonDict.Add( StencilBufferOpHelper.StencilComparisonValues[ i ].ToLower(), i ); + } + + for( int i = 0; i < StencilBufferOpHelper.StencilOpsValues.Length; i++ ) + { + m_stencilOpsDict.Add( StencilBufferOpHelper.StencilOpsValues[ i ].ToLower(), i ); + } + + m_comparisonFunctionFrontIdx = new InlineProperty( ComparisonDefaultValue ); + m_comparisonFunctionBackIdx = new InlineProperty( ComparisonDefaultValue ); + + m_passStencilOpFrontIdx = new InlineProperty( PassStencilOpDefaultValue ); + m_passStencilOpBackIdx = new InlineProperty( PassStencilOpDefaultValue ); + + m_failStencilOpFrontIdx = new InlineProperty( FailStencilOpDefaultValue ); + m_failStencilOpBackIdx = new InlineProperty( FailStencilOpDefaultValue ); + + m_zFailStencilOpFrontIdx = new InlineProperty( ZFailStencilOpDefaultValue ); + m_zFailStencilOpBackIdx = new InlineProperty( ZFailStencilOpDefaultValue ); + } + + public void CopyFrom( TemplatesStencilBufferModule other , bool allData ) + { + if( allData ) + m_independentModule = other.IndependentModule; + + m_active = other.Active; + m_reference.CopyFrom( other.Reference ); + m_readMask.CopyFrom( other.ReadMask ); + m_writeMask.CopyFrom( other.WriteMask ); + m_comparisonFunctionFrontIdx.CopyFrom( other.ComparisonFunctionIdx ); + m_comparisonFunctionBackIdx.CopyFrom( other.ComparisonFunctionBackIdx ); + m_passStencilOpFrontIdx.CopyFrom( other.PassStencilOpIdx ); + m_passStencilOpBackIdx.CopyFrom( other.PassStencilOpBackIdx ); + m_failStencilOpFrontIdx.CopyFrom( other.FailStencilOpIdx ); + m_failStencilOpBackIdx.CopyFrom( other.FailStencilOpBackIdx ); + m_zFailStencilOpFrontIdx.CopyFrom( other.ZFailStencilOpIdx ); + m_zFailStencilOpBackIdx.CopyFrom( other.ZFailStencilOpBackIdx ); + } + + public void ConfigureFromTemplateData( TemplateStencilData stencilData ) + { + bool newValidData = ( stencilData.DataCheck == TemplateDataCheck.Valid ); + if( newValidData && m_validData != newValidData ) + { + m_active = stencilData.Active; + m_independentModule = stencilData.IndependentModule; + if( string.IsNullOrEmpty( stencilData.ReferenceInline ) ) + { + m_reference.IntValue = stencilData.Reference; + m_reference.ResetProperty(); + } + else + { + m_reference.SetInlineByName( stencilData.ReferenceInline ); + } + + if( string.IsNullOrEmpty( stencilData.ReadMaskInline ) ) + { + m_readMask.IntValue = stencilData.ReadMask; + m_readMask.ResetProperty(); + } + else + { + m_readMask.SetInlineByName( stencilData.ReadMaskInline ); + } + + if( string.IsNullOrEmpty( stencilData.WriteMaskInline ) ) + { + m_writeMask.IntValue = stencilData.WriteMask; + m_writeMask.ResetProperty(); + } + else + { + m_writeMask.SetInlineByName( stencilData.WriteMaskInline ); + } + + // Front + if( string.IsNullOrEmpty( stencilData.ComparisonFrontInline ) ) + { + if( !string.IsNullOrEmpty( stencilData.ComparisonFront ) ) + { + m_comparisonFunctionFrontIdx.IntValue = m_comparisonDict[ stencilData.ComparisonFront.ToLower() ]; + } + else + { + m_comparisonFunctionFrontIdx.IntValue = ComparisonDefaultValue; + } + m_comparisonFunctionFrontIdx.ResetProperty(); + } + else + { + m_comparisonFunctionFrontIdx.SetInlineByName( stencilData.ComparisonFrontInline ); + } + + if( string.IsNullOrEmpty( stencilData.PassFrontInline ) ) + { + if( !string.IsNullOrEmpty( stencilData.PassFront ) ) + { + m_passStencilOpFrontIdx.IntValue = m_stencilOpsDict[ stencilData.PassFront.ToLower() ]; + } + else + { + m_passStencilOpFrontIdx.IntValue = PassStencilOpDefaultValue; + } + m_passStencilOpFrontIdx.ResetProperty(); + } + else + { + m_passStencilOpFrontIdx.SetInlineByName( stencilData.PassFrontInline ); + } + + if( string.IsNullOrEmpty( stencilData.FailFrontInline ) ) + { + if( !string.IsNullOrEmpty( stencilData.FailFront ) ) + { + m_failStencilOpFrontIdx.IntValue = m_stencilOpsDict[ stencilData.FailFront.ToLower() ]; + } + else + { + m_failStencilOpFrontIdx.IntValue = FailStencilOpDefaultValue; + } + m_failStencilOpFrontIdx.ResetProperty(); + } + else + { + m_failStencilOpFrontIdx.SetInlineByName( stencilData.FailFrontInline ); + } + + if( string.IsNullOrEmpty( stencilData.ZFailFrontInline ) ) + { + if( !string.IsNullOrEmpty( stencilData.ZFailFront ) ) + { + m_zFailStencilOpFrontIdx.IntValue = m_stencilOpsDict[ stencilData.ZFailFront.ToLower() ]; + } + else + { + m_zFailStencilOpFrontIdx.IntValue = ZFailStencilOpDefaultValue; + } + m_zFailStencilOpFrontIdx.ResetProperty(); + } + else + { + m_zFailStencilOpFrontIdx.SetInlineByName( stencilData.ZFailFrontInline ); + } + + // Back + if ( string.IsNullOrEmpty( stencilData.ComparisonBackInline ) ) + { + if( !string.IsNullOrEmpty( stencilData.ComparisonBack ) ) + { + m_comparisonFunctionBackIdx.IntValue = m_comparisonDict[ stencilData.ComparisonBack.ToLower() ]; + } + else + { + m_comparisonFunctionBackIdx.IntValue = ComparisonDefaultValue; + } + m_comparisonFunctionBackIdx.ResetProperty(); + } + else + { + m_comparisonFunctionBackIdx.SetInlineByName( stencilData.ComparisonBackInline ); + } + + if( string.IsNullOrEmpty( stencilData.PassBackInline ) ) + { + + if( !string.IsNullOrEmpty( stencilData.PassBack ) ) + { + m_passStencilOpBackIdx.IntValue = m_stencilOpsDict[ stencilData.PassBack.ToLower() ]; + } + else + { + m_passStencilOpBackIdx.IntValue = PassStencilOpDefaultValue; + } + m_passStencilOpBackIdx.ResetProperty(); + } + else + { + m_passStencilOpBackIdx.SetInlineByName( stencilData.PassBackInline ); + } + + if( string.IsNullOrEmpty( stencilData.FailBackInline ) ) + { + if( !string.IsNullOrEmpty( stencilData.FailBack ) ) + { + m_failStencilOpBackIdx.IntValue = m_stencilOpsDict[ stencilData.FailBack.ToLower() ]; + } + else + { + m_failStencilOpBackIdx.IntValue = FailStencilOpDefaultValue; + } + m_failStencilOpBackIdx.ResetProperty(); + } + else + { + m_failStencilOpBackIdx.SetInlineByName( stencilData.FailBackInline ); + } + + + if( string.IsNullOrEmpty( stencilData.ZFailBackInline ) ) + { + if( !string.IsNullOrEmpty( stencilData.ZFailBack ) ) + { + m_zFailStencilOpBackIdx.IntValue = m_stencilOpsDict[ stencilData.ZFailBack.ToLower() ]; + } + else + { + m_zFailStencilOpBackIdx.IntValue = ZFailStencilOpDefaultValue; + } + m_zFailStencilOpBackIdx.ResetProperty(); + } + else + { + m_zFailStencilOpBackIdx.SetInlineByName( stencilData.ZFailBackInline ); + } + } + m_validData = newValidData; + } + + public string CreateStencilOp( CullMode cullMode ) + { + if( !m_active ) + return string.Empty; + + string result = "Stencil\n{\n"; + result += string.Format( "\tRef {0}\n", m_reference.GetValueOrProperty() ); + if( m_readMask.IsValid || m_readMask.IntValue != ReadMaskDefaultValue ) + { + result += string.Format( "\tReadMask {0}\n", m_readMask.GetValueOrProperty() ); + } + + if( m_writeMask.IsValid || m_writeMask.IntValue != WriteMaskDefaultValue ) + { + result += string.Format( "\tWriteMask {0}\n", m_writeMask.GetValueOrProperty() ); + } + + if( cullMode == CullMode.Off && + ( m_comparisonFunctionBackIdx.IsValid || m_comparisonFunctionBackIdx.IntValue != ComparisonDefaultValue || + m_passStencilOpBackIdx.IsValid || m_passStencilOpBackIdx.IntValue != PassStencilOpDefaultValue || + m_failStencilOpBackIdx.IsValid || m_failStencilOpBackIdx.IntValue != FailStencilOpDefaultValue || + m_zFailStencilOpBackIdx.IsValid || m_zFailStencilOpBackIdx.IntValue != ZFailStencilOpDefaultValue ) ) + { + if( m_comparisonFunctionFrontIdx.IsValid || m_comparisonFunctionFrontIdx.IntValue != ComparisonDefaultValue ) + result += string.Format( "\tCompFront {0}\n", m_comparisonFunctionFrontIdx.GetValueOrProperty( StencilBufferOpHelper.StencilComparisonValues[ m_comparisonFunctionFrontIdx.IntValue ] ) ); + + if( m_passStencilOpFrontIdx.IsValid || m_passStencilOpFrontIdx.IntValue != PassStencilOpDefaultValue ) + result += string.Format( "\tPassFront {0}\n", m_passStencilOpFrontIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_passStencilOpFrontIdx.IntValue ] ) ); + + if( m_failStencilOpFrontIdx.IsValid || m_failStencilOpFrontIdx.IntValue != FailStencilOpDefaultValue ) + result += string.Format( "\tFailFront {0}\n", m_failStencilOpFrontIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_failStencilOpFrontIdx.IntValue ] ) ); + + if( m_zFailStencilOpFrontIdx.IsValid || m_zFailStencilOpFrontIdx.IntValue != ZFailStencilOpDefaultValue ) + result += string.Format( "\tZFailFront {0}\n", m_zFailStencilOpFrontIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_zFailStencilOpFrontIdx.IntValue ] ) ); + + if( m_comparisonFunctionBackIdx.IsValid || m_comparisonFunctionBackIdx.IntValue != ComparisonDefaultValue ) + result += string.Format( "\tCompBack {0}\n", m_comparisonFunctionBackIdx.GetValueOrProperty( StencilBufferOpHelper.StencilComparisonValues[ m_comparisonFunctionBackIdx.IntValue ] ) ); + + if( m_passStencilOpBackIdx.IsValid || m_passStencilOpBackIdx.IntValue != PassStencilOpDefaultValue ) + result += string.Format( "\tPassBack {0}\n", m_passStencilOpBackIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_passStencilOpBackIdx.IntValue ] ) ); + + if( m_failStencilOpBackIdx.IsValid || m_failStencilOpBackIdx.IntValue != FailStencilOpDefaultValue ) + result += string.Format( "\tFailBack {0}\n", m_failStencilOpBackIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_failStencilOpBackIdx.IntValue ] )); + + if( m_zFailStencilOpBackIdx.IsValid || m_zFailStencilOpBackIdx.IntValue != ZFailStencilOpDefaultValue ) + result += string.Format( "\tZFailBack {0}\n", m_zFailStencilOpBackIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_zFailStencilOpBackIdx.IntValue ] )); + } + else + { + if( m_comparisonFunctionFrontIdx.IsValid || m_comparisonFunctionFrontIdx.IntValue != ComparisonDefaultValue ) + result += string.Format( "\tComp {0}\n", m_comparisonFunctionFrontIdx.GetValueOrProperty(StencilBufferOpHelper.StencilComparisonValues[ m_comparisonFunctionFrontIdx.IntValue ] )); + if( m_passStencilOpFrontIdx.IsValid || m_passStencilOpFrontIdx.IntValue != PassStencilOpDefaultValue ) + result += string.Format( "\tPass {0}\n", m_passStencilOpFrontIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_passStencilOpFrontIdx.IntValue ] )); + if( m_failStencilOpFrontIdx.IsValid || m_failStencilOpFrontIdx.IntValue != FailStencilOpDefaultValue ) + result += string.Format( "\tFail {0}\n", m_failStencilOpFrontIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_failStencilOpFrontIdx.IntValue ] )); + if( m_zFailStencilOpFrontIdx.IsValid || m_zFailStencilOpFrontIdx.IntValue != ZFailStencilOpDefaultValue ) + result += string.Format( "\tZFail {0}\n", m_zFailStencilOpFrontIdx.GetValueOrProperty(StencilBufferOpHelper.StencilOpsValues[ m_zFailStencilOpFrontIdx.IntValue ] )); + } + + result += "}"; + return result; + } + + public override void ShowUnreadableDataMessage( ParentNode owner ) + { + bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedStencilOptions; + NodeUtils.DrawPropertyGroup( ref foldout, FoldoutLabelStr, base.ShowUnreadableDataMessage ); + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedStencilOptions = foldout; + } + + public void Draw( UndoParentNode owner, CullMode cullMode , bool style = true ) + { + bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedStencilOptions; + if( style ) + { + NodeUtils.DrawPropertyGroup( ref foldout, FoldoutLabelStr, () => + { + DrawBlock( owner, cullMode ); + } ); + } + else + { + NodeUtils.DrawNestedPropertyGroup( owner, ref foldout, ref m_active, FoldoutLabelStr, () => + { + DrawBlock( owner, cullMode ); + } ); + } + owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedStencilOptions = foldout; + } + + void DrawBlock( UndoParentNode owner, CullMode cullMode ) + { + bool guiEnabled = GUI.enabled; + GUI.enabled = m_active; + EditorGUI.BeginChangeCheck(); + { + var cache = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = EditorGUIUtility.labelWidth - 20; + m_reference.IntSlider( ref owner, ReferenceValueContent, 0, 255 ); + m_readMask.IntSlider( ref owner, ReadMaskContent, 0, 255 ); + m_writeMask.IntSlider( ref owner, WriteMaskContent, 0, 255 ); + if( cullMode == CullMode.Off ) + { + m_comparisonFunctionFrontIdx.EnumTypePopup( ref owner, ComparisonFrontStr, StencilBufferOpHelper.StencilComparisonLabels ); + m_passStencilOpFrontIdx.EnumTypePopup( ref owner, PassFrontStr, StencilBufferOpHelper.StencilOpsLabels ); + m_failStencilOpFrontIdx.EnumTypePopup( ref owner, FailFrontStr, StencilBufferOpHelper.StencilOpsLabels ); + m_zFailStencilOpFrontIdx.EnumTypePopup( ref owner, ZFailFrontStr, StencilBufferOpHelper.StencilOpsLabels ); + EditorGUILayout.Separator(); + m_comparisonFunctionBackIdx.EnumTypePopup( ref owner, ComparisonBackStr, StencilBufferOpHelper.StencilComparisonLabels ); + m_passStencilOpBackIdx.EnumTypePopup( ref owner, PassBackStr, StencilBufferOpHelper.StencilOpsLabels ); + m_failStencilOpBackIdx.EnumTypePopup( ref owner, FailBackStr, StencilBufferOpHelper.StencilOpsLabels ); + m_zFailStencilOpBackIdx.EnumTypePopup( ref owner, ZFailBackStr, StencilBufferOpHelper.StencilOpsLabels ); + } + else + { + m_comparisonFunctionFrontIdx.EnumTypePopup( ref owner, ComparisonStr, StencilBufferOpHelper.StencilComparisonLabels ); + m_passStencilOpFrontIdx.EnumTypePopup( ref owner, PassFrontStr, StencilBufferOpHelper.StencilOpsLabels ); + m_failStencilOpFrontIdx.EnumTypePopup( ref owner, FailFrontStr, StencilBufferOpHelper.StencilOpsLabels ); + m_zFailStencilOpFrontIdx.EnumTypePopup( ref owner, ZFailFrontStr, StencilBufferOpHelper.StencilOpsLabels ); + } + + EditorGUIUtility.labelWidth = cache; + } + if( EditorGUI.EndChangeCheck() ) + { + m_isDirty = true; + CustomEdited = true; + } + GUI.enabled = guiEnabled; + } + + public override void ReadFromString( ref uint index, ref string[] nodeParams ) + { + base.ReadFromString( ref index, ref nodeParams ); + bool validDataOnMeta = m_validData; + if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) + { + validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( validDataOnMeta ) + { + if( UIUtils.CurrentShaderVersion() > 15307 ) + { + m_active = Convert.ToBoolean( nodeParams[ index++ ] ); + } + + if( UIUtils.CurrentShaderVersion() < 15304 ) + { + m_reference.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_readMask.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_writeMask.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_comparisonFunctionFrontIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_passStencilOpFrontIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_failStencilOpFrontIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_zFailStencilOpFrontIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_comparisonFunctionBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_passStencilOpBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_failStencilOpBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + m_zFailStencilOpBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); + } + else + { + m_reference.ReadFromString( ref index, ref nodeParams ); + m_readMask.ReadFromString( ref index, ref nodeParams ); + m_writeMask.ReadFromString( ref index, ref nodeParams ); + m_comparisonFunctionFrontIdx.ReadFromString( ref index, ref nodeParams ); + m_passStencilOpFrontIdx.ReadFromString( ref index, ref nodeParams ); + m_failStencilOpFrontIdx.ReadFromString( ref index, ref nodeParams ); + m_zFailStencilOpFrontIdx.ReadFromString( ref index, ref nodeParams ); + m_comparisonFunctionBackIdx.ReadFromString( ref index, ref nodeParams ); + m_passStencilOpBackIdx.ReadFromString( ref index, ref nodeParams ); + m_failStencilOpBackIdx.ReadFromString( ref index, ref nodeParams ); + m_zFailStencilOpBackIdx.ReadFromString( ref index, ref nodeParams ); + } + + } + } + + public override void WriteToString( ref string nodeInfo ) + { + base.WriteToString( ref nodeInfo ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_validData ); + if( m_validData ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_active ); + m_reference.WriteToString( ref nodeInfo ); + m_readMask.WriteToString( ref nodeInfo ); + m_writeMask.WriteToString( ref nodeInfo ); + m_comparisonFunctionFrontIdx.WriteToString( ref nodeInfo ); + m_passStencilOpFrontIdx.WriteToString( ref nodeInfo ); + m_failStencilOpFrontIdx.WriteToString( ref nodeInfo ); + m_zFailStencilOpFrontIdx.WriteToString( ref nodeInfo ); + m_comparisonFunctionBackIdx.WriteToString( ref nodeInfo ); + m_passStencilOpBackIdx.WriteToString( ref nodeInfo ); + m_failStencilOpBackIdx.WriteToString( ref nodeInfo ); + m_zFailStencilOpBackIdx.WriteToString( ref nodeInfo ); + } + } + + public override void Destroy() + { + m_comparisonDict.Clear(); + m_comparisonDict = null; + + m_stencilOpsDict.Clear(); + m_stencilOpsDict = null; + + m_reference = null; + m_readMask = null; + m_writeMask = null; + m_comparisonFunctionFrontIdx = null; + m_passStencilOpFrontIdx = null; + m_failStencilOpFrontIdx = null; + m_zFailStencilOpFrontIdx = null; + m_comparisonFunctionBackIdx = null; + m_passStencilOpBackIdx = null; + m_failStencilOpBackIdx = null; + m_zFailStencilOpBackIdx = null; + } + public bool Active { get { return m_active; } } + public InlineProperty Reference { get { return m_reference; } } + public InlineProperty ReadMask { get { return m_readMask; } } + public InlineProperty WriteMask { get { return m_writeMask; } } + public InlineProperty ComparisonFunctionIdx { get { return m_comparisonFunctionFrontIdx; } } + public InlineProperty ComparisonFunctionBackIdx { get { return m_comparisonFunctionBackIdx; } } + public InlineProperty PassStencilOpIdx { get { return m_passStencilOpFrontIdx; } } + public InlineProperty PassStencilOpBackIdx { get { return m_passStencilOpBackIdx; } } + public InlineProperty FailStencilOpIdx { get { return m_failStencilOpFrontIdx; } } + public InlineProperty FailStencilOpBackIdx { get { return m_failStencilOpBackIdx; } } + public InlineProperty ZFailStencilOpIdx { get { return m_zFailStencilOpFrontIdx; } } + public InlineProperty ZFailStencilOpBackIdx { get { return m_zFailStencilOpBackIdx; } } + + + public int ReferenceValue + { + set + { + m_reference.IntValue = value; + m_reference.Active = false; + } + get + { + return m_reference.IntValue; + } + } + + public int ReadMaskValue + { + set + { + m_readMask.IntValue = value; + m_reference.Active = false; + } + get + { + return m_readMask.IntValue; + } + } + + public int WriteMaskValue + { + set + { + m_writeMask.IntValue = value; + m_writeMask.Active = false; + } + get + { + return m_writeMask.IntValue; + } + } + + public int ComparisonFunctionIdxValue + { + set + { + m_comparisonFunctionFrontIdx.IntValue = value; + m_comparisonFunctionFrontIdx.Active = false; + } + get + { + return m_comparisonFunctionFrontIdx.IntValue; + } + } + + public int ComparisonFunctionBackIdxValue + { + set + { + m_comparisonFunctionBackIdx.IntValue = value; + m_comparisonFunctionBackIdx.Active = false; + } + get + { + return m_comparisonFunctionBackIdx.IntValue; + } + } + + public int PassStencilOpIdxValue + { + set + { + m_passStencilOpFrontIdx.IntValue = value; + m_passStencilOpFrontIdx.Active = false; + } + get + { + return m_passStencilOpFrontIdx.IntValue; + } + } + + public int PassStencilOpBackIdxValue + { + set + { + m_passStencilOpBackIdx.IntValue = value; + m_passStencilOpBackIdx.Active = false; + } + get + { + return m_passStencilOpBackIdx.IntValue; + } + } + + public int FailStencilOpIdxValue + { + set + { + m_failStencilOpFrontIdx.IntValue = value; + m_failStencilOpFrontIdx.Active = false; + } + get + { + return m_failStencilOpFrontIdx.IntValue; + } + } + public int FailStencilOpBackIdxValue + { + set + { + m_failStencilOpBackIdx.IntValue = value; + m_failStencilOpBackIdx.Active = false; + } + get + { + return m_failStencilOpBackIdx.IntValue; + } + } + + public int ZFailStencilOpIdxValue + { + set + { + m_zFailStencilOpFrontIdx.IntValue = value; + m_zFailStencilOpFrontIdx.Active = false; + } + get + { + return m_zFailStencilOpFrontIdx.IntValue; + } + } + + public int ZFailStencilOpBackIdxValue + { + set + { + m_zFailStencilOpBackIdx.IntValue = value; + m_zFailStencilOpBackIdx.Active = false; + } + get + { + return m_zFailStencilOpBackIdx.IntValue; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs.meta new file mode 100644 index 00000000..ec74fce6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: fa41b984209fa624aa1fdea5949d9d59 +timeCreated: 1511548974 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils.meta new file mode 100644 index 00000000..f81a149d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 77f9dcd6b7a403a47b926073779ee42f +folderAsset: yes +timeCreated: 1481126944 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs new file mode 100644 index 00000000..782980f4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs @@ -0,0 +1,464 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +using System; +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; +//using UnityEngine.Rendering.PostProcessing; + + +namespace AmplifyShaderEditor +{ + public enum ASEPostProcessEvent + { + BeforeTransparent = 0, + BeforeStack = 1, + AfterStack = 2 + } + + [Serializable] + public class ASEPPSHelperBuffer + { + public string Name; + public string Tooltip; + } + + [Serializable] + public class ASEPPSHelperTool : EditorWindow + { + private const string PPSFullTemplate = + "// Amplify Shader Editor - Visual Shader Editing Tool\n" + + "// Copyright (c) Amplify Creations, Lda \n" + + "#if UNITY_POST_PROCESSING_STACK_V2\n" + + "using System;\n" + + "using UnityEngine;\n" + + "using UnityEngine.Rendering.PostProcessing;\n" + + "\n" + + "[Serializable]\n" + + "[PostProcess( typeof( /*PPSRendererClass*/ ), PostProcessEvent./*PPSEventType*/, \"/*PPSMenuEntry*/\", /*AllowInSceneView*/ )]\n" + + "public sealed class /*PPSSettingsClass*/ : PostProcessEffectSettings\n" + + "{\n" + + "/*PPSPropertiesDeclaration*/" + + "}\n" + + "\n" + + "public sealed class /*PPSRendererClass*/ : PostProcessEffectRenderer\n" + + "{\n" + + "\tpublic override void Render( PostProcessRenderContext context )\n" + + "\t{\n" + + "\t\tvar sheet = context.propertySheets.Get( Shader.Find( \"/*PPSShader*/\" ) );\n" + + "/*PPSPropertySet*/" + + "\t\tcontext.command.BlitFullscreenTriangle( context.source, context.destination, sheet, 0 );\n" + + "\t}\n" + + "}\n" + + "#endif\n"; + + private const string PPSEventType = "/*PPSEventType*/"; + private const string PPSRendererClass = "/*PPSRendererClass*/"; + private const string PPSSettingsClass = "/*PPSSettingsClass*/"; + private const string PPSMenuEntry = "/*PPSMenuEntry*/"; + private const string PPSAllowInSceneView = "/*AllowInSceneView*/"; + private const string PPSShader = "/*PPSShader*/"; + private const string PPSPropertiesDecl = "/*PPSPropertiesDeclaration*/"; + private const string PPSPropertySet = "/*PPSPropertySet*/"; + + public static readonly string PPSPropertySetFormat = "\t\tsheet.properties.{0}( \"{1}\", settings.{1} );\n"; + public static readonly string PPSPropertySetNullPointerCheckFormat = "\t\tif(settings.{1}.value != null) sheet.properties.{0}( \"{1}\", settings.{1} );\n"; + public static readonly string PPSPropertyDecFormat = + "\t[{0}Tooltip( \"{1}\" )]\n" + + "\tpublic {2} {3} = new {2} {{ {4} }};\n"; + public static readonly Dictionary WireToPPSType = new Dictionary() + { + { WirePortDataType.FLOAT,"FloatParameter"}, + { WirePortDataType.FLOAT2,"Vector4Parameter"}, + { WirePortDataType.FLOAT3,"Vector4Parameter"}, + { WirePortDataType.FLOAT4,"Vector4Parameter"}, + { WirePortDataType.COLOR,"ColorParameter"}, + { WirePortDataType.SAMPLER1D,"TextureParameter"}, + { WirePortDataType.SAMPLER2D,"TextureParameter"}, + { WirePortDataType.SAMPLER3D,"TextureParameter"}, + { WirePortDataType.SAMPLERCUBE,"TextureParameter"}, + { WirePortDataType.SAMPLER2DARRAY,"TextureParameter"} + }; + + public static readonly Dictionary WireToPPSValueSet = new Dictionary() + { + { WirePortDataType.FLOAT,"SetFloat"}, + { WirePortDataType.FLOAT2,"SetVector"}, + { WirePortDataType.FLOAT3,"SetVector"}, + { WirePortDataType.FLOAT4,"SetVector"}, + { WirePortDataType.COLOR,"SetColor"}, + { WirePortDataType.SAMPLER1D, "SetTexture"}, + { WirePortDataType.SAMPLER2D, "SetTexture"}, + { WirePortDataType.SAMPLER3D, "SetTexture"}, + { WirePortDataType.SAMPLERCUBE,"SetTexture"}, + { WirePortDataType.SAMPLER2DARRAY,"SetTexture"} + }; + + public static readonly Dictionary ShaderPropertyToPPSType = new Dictionary() + { + { UnityEditor.ShaderUtil.ShaderPropertyType.Float,"FloatParameter"}, + { UnityEditor.ShaderUtil.ShaderPropertyType.Range,"FloatParameter"}, + { UnityEditor.ShaderUtil.ShaderPropertyType.Vector,"Vector4Parameter"}, + { UnityEditor.ShaderUtil.ShaderPropertyType.Color,"ColorParameter"}, + { UnityEditor.ShaderUtil.ShaderPropertyType.TexEnv,"TextureParameter"} + }; + + + public static readonly Dictionary ShaderPropertyToPPSSet = new Dictionary() + { + { UnityEditor.ShaderUtil.ShaderPropertyType.Float,"SetFloat"}, + { UnityEditor.ShaderUtil.ShaderPropertyType.Range,"SetFloat"}, + { UnityEditor.ShaderUtil.ShaderPropertyType.Vector,"SetVector"}, + { UnityEditor.ShaderUtil.ShaderPropertyType.Color,"SetColor"}, + { UnityEditor.ShaderUtil.ShaderPropertyType.TexEnv,"SetTexture"} + }; + + private Dictionary m_excludedProperties = new Dictionary + { + { "_texcoord",true }, + { "__dirty",true} + }; + + private Material m_dummyMaterial = null; + + private DragAndDropTool m_dragAndDropTool; + private Rect m_draggableArea; + + [SerializeField] + private string m_rendererClassName = "PPSRenderer"; + + [SerializeField] + private string m_settingsClassName = "PPSSettings"; + + [SerializeField] + private string m_folderPath = "Assets/"; + + [SerializeField] + private string m_menuEntry = string.Empty; + + [SerializeField] + private bool m_allowInSceneView = true; + + [SerializeField] + private ASEPostProcessEvent m_eventType = ASEPostProcessEvent.AfterStack; + + [SerializeField] + private Shader m_currentShader = null; + + [SerializeField] + private List m_tooltips = new List(); + + [SerializeField] + private bool m_tooltipsFoldout = true; + + private GUIStyle m_contentStyle = null; + private GUIStyle m_pathButtonStyle = null; + private GUIContent m_pathButtonContent = new GUIContent(); + private Vector2 m_scrollPos = Vector2.zero; + + [MenuItem( "Window/Amplify Shader Editor/Post-Processing Stack Tool", false, 1001 )] + static void ShowWindow() + { + ASEPPSHelperTool window = EditorWindow.GetWindow(); + window.titleContent.text = "Post-Processing Stack Tool"; + window.minSize = new Vector2( 302, 350 ); + window.Show(); + } + + void FetchTooltips() + { + m_tooltips.Clear(); + int propertyCount = UnityEditor.ShaderUtil.GetPropertyCount( m_currentShader ); + for( int i = 0; i < propertyCount; i++ ) + { + //UnityEditor.ShaderUtil.ShaderPropertyType type = UnityEditor.ShaderUtil.GetPropertyType( m_currentShader, i ); + string name = UnityEditor.ShaderUtil.GetPropertyName( m_currentShader, i ); + string description = UnityEditor.ShaderUtil.GetPropertyDescription( m_currentShader, i ); + + if( m_excludedProperties.ContainsKey( name )) + continue; + + m_tooltips.Add( new ASEPPSHelperBuffer { Name = name, Tooltip = description } ); + } + } + + void OnGUI() + { + if( m_pathButtonStyle == null ) + m_pathButtonStyle = "minibutton"; + + m_scrollPos = EditorGUILayout.BeginScrollView( m_scrollPos, GUILayout.Height( position.height ) ); + + EditorGUILayout.BeginVertical( m_contentStyle ); + EditorGUI.BeginChangeCheck(); + m_currentShader = EditorGUILayout.ObjectField( "Shader", m_currentShader, typeof( Shader ), false ) as Shader; + if( EditorGUI.EndChangeCheck() ) + { + GetInitialInfo( m_currentShader ); + } + + EditorGUILayout.Separator(); + EditorGUILayout.LabelField( "Path and Filename" ); + EditorGUILayout.BeginHorizontal(); + m_pathButtonContent.text = m_folderPath; + Vector2 buttonSize = m_pathButtonStyle.CalcSize( m_pathButtonContent ); + if( GUILayout.Button( m_pathButtonContent, m_pathButtonStyle, GUILayout.MaxWidth( Mathf.Min( position.width * 0.5f, buttonSize.x ) ) ) ) + { + string folderpath = EditorUtility.OpenFolderPanel( "Save Texture Array to folder", "Assets/", "" ); + folderpath = FileUtil.GetProjectRelativePath( folderpath ); + if( string.IsNullOrEmpty( folderpath ) ) + m_folderPath = "Assets/"; + else + m_folderPath = folderpath + "/"; + } + + m_settingsClassName = EditorGUILayout.TextField( m_settingsClassName, GUILayout.ExpandWidth( true ) ); + + EditorGUILayout.LabelField( ".cs", GUILayout.MaxWidth( 40 ) ); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.HelpBox( "The path for the generated script should be outside of Amplify Shader Editor folder structure due to use of Assembly Definition files which will conflict and prevent to compile correctly.", MessageType.Warning ); + + EditorGUILayout.Separator(); + + m_menuEntry = EditorGUILayout.TextField( "Name", m_menuEntry ); + + EditorGUILayout.Separator(); + + m_allowInSceneView = EditorGUILayout.Toggle( "Allow In Scene View", m_allowInSceneView ); + + EditorGUILayout.Separator(); + + m_eventType = (ASEPostProcessEvent)EditorGUILayout.EnumPopup( "Event Type", m_eventType ); + + EditorGUILayout.Separator(); + + m_tooltipsFoldout = EditorGUILayout.Foldout( m_tooltipsFoldout, "Tooltips" ); + if( m_tooltipsFoldout ) + { + EditorGUI.indentLevel++; + for( int i = 0; i < m_tooltips.Count; i++ ) + { + m_tooltips[ i ].Tooltip = EditorGUILayout.TextField( m_tooltips[ i ].Name, m_tooltips[ i ].Tooltip ); + } + EditorGUI.indentLevel--; + } + + EditorGUILayout.Separator(); + + if( GUILayout.Button( "Build" ) ) + { + System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; + string propertiesDecl = string.Empty; + string propertiesSet = string.Empty; + GetShaderInfoFromShaderAsset( ref propertiesDecl, ref propertiesSet ); + string template = PPSFullTemplate; + template = template.Replace( PPSRendererClass, m_rendererClassName ); + template = template.Replace( PPSSettingsClass, m_settingsClassName ); + template = template.Replace( PPSEventType, m_eventType.ToString() ); + template = template.Replace( PPSPropertiesDecl, propertiesDecl ); + template = template.Replace( PPSPropertySet, propertiesSet ); + template = template.Replace( PPSMenuEntry, m_menuEntry ); + template = template.Replace( PPSAllowInSceneView, m_allowInSceneView?"true":"false" ); + template = template.Replace( PPSShader, m_currentShader.name ); + string path = m_folderPath + m_settingsClassName + ".cs"; + IOUtils.SaveTextfileToDisk( template, path, false ); + System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; + AssetDatabase.Refresh(); + } + + EditorGUILayout.EndVertical(); + EditorGUILayout.EndScrollView(); + m_draggableArea.size = position.size; + m_dragAndDropTool.TestDragAndDrop( m_draggableArea ); + } + + public void GetShaderInfoFromASE( ref string propertiesDecl, ref string propertiesSet ) + { + List properties = UIUtils.CurrentWindow.OutsideGraph.PropertyNodes.NodesList; + int propertyCount = properties.Count; + for( int i = 0; i < propertyCount; i++ ) + { + properties[ i ].GeneratePPSInfo( ref propertiesDecl, ref propertiesSet ); + } + } + + public void GetShaderInfoFromShaderAsset( ref string propertiesDecl, ref string propertiesSet ) + { + bool fetchInitialInfo = false; + if( m_currentShader == null ) + { + Material mat = Selection.activeObject as Material; + if( mat != null ) + { + m_currentShader = mat.shader; + } + else + { + m_currentShader = Selection.activeObject as Shader; + } + fetchInitialInfo = true; + } + + if( m_currentShader != null ) + { + if( fetchInitialInfo ) + GetInitialInfo( m_currentShader ); + + if( m_dummyMaterial == null ) + { + m_dummyMaterial = new Material( m_currentShader ); + } + else + { + m_dummyMaterial.shader = m_currentShader; + } + + int propertyCount = UnityEditor.ShaderUtil.GetPropertyCount( m_currentShader ); + //string allProperties = string.Empty; + int validIds = 0; + for( int i = 0; i < propertyCount; i++ ) + { + UnityEditor.ShaderUtil.ShaderPropertyType type = UnityEditor.ShaderUtil.GetPropertyType( m_currentShader, i ); + string name = UnityEditor.ShaderUtil.GetPropertyName( m_currentShader, i ); + //string description = UnityEditor.ShaderUtil.GetPropertyDescription( m_currentShader, i ); + if( m_excludedProperties.ContainsKey( name )) + continue; + + string defaultValue = string.Empty; + bool nullPointerCheck = false; + switch( type ) + { + case UnityEditor.ShaderUtil.ShaderPropertyType.Color: + { + Color value = m_dummyMaterial.GetColor( name ); + defaultValue = string.Format( "value = new Color({0}f,{1}f,{2}f,{3}f)", value.r, value.g, value.b, value.a ); + } + break; + case UnityEditor.ShaderUtil.ShaderPropertyType.Vector: + { + Vector4 value = m_dummyMaterial.GetVector( name ); + defaultValue = string.Format( "value = new Vector4({0}f,{1}f,{2}f,{3}f)", value.x, value.y, value.z, value.w ); + } + break; + case UnityEditor.ShaderUtil.ShaderPropertyType.Float: + { + float value = m_dummyMaterial.GetFloat( name ); + defaultValue = "value = " + value + "f"; + } + break; + case UnityEditor.ShaderUtil.ShaderPropertyType.Range: + { + float value = m_dummyMaterial.GetFloat( name ); + defaultValue = "value = " + value + "f"; + } + break; + case UnityEditor.ShaderUtil.ShaderPropertyType.TexEnv: + { + nullPointerCheck = true; + } + break; + } + + propertiesDecl += string.Format( PPSPropertyDecFormat, string.Empty, m_tooltips[ validIds ].Tooltip, ShaderPropertyToPPSType[ type ], name, defaultValue ); + propertiesSet += string.Format( nullPointerCheck ? PPSPropertySetNullPointerCheckFormat : PPSPropertySetFormat, ShaderPropertyToPPSSet[ type ], name ); + validIds++; + } + + } + } + + private void GetInitialInfo() + { + MasterNode masterNode = UIUtils.CurrentWindow.OutsideGraph.CurrentMasterNode; + m_menuEntry = masterNode.ShaderName.Replace( "Hidden/", string.Empty ).Replace( ".shader", string.Empty ); + string name = m_menuEntry; + m_rendererClassName = name + "PPSRenderer"; + m_settingsClassName = name + "PPSSettings"; + m_folderPath = "Assets/"; + } + + private void GetInitialInfo( Shader shader ) + { + if( shader == null ) + { + m_scrollPos = Vector2.zero; + m_menuEntry = string.Empty; + m_rendererClassName = "PPSRenderer"; + m_settingsClassName = "PPSSettings"; + m_folderPath = "Assets/"; + m_tooltips.Clear(); + return; + } + + m_menuEntry = shader.name.Replace( "Hidden/", string.Empty ).Replace( ".shader", string.Empty ); + m_menuEntry = UIUtils.RemoveInvalidCharacters( m_menuEntry ); + string name = m_menuEntry.Replace( "/", string.Empty ); + m_rendererClassName = name + "PPSRenderer"; + m_settingsClassName = name + "PPSSettings"; + m_folderPath = AssetDatabase.GetAssetPath( shader ); + m_folderPath = m_folderPath.Replace( System.IO.Path.GetFileName( m_folderPath ), string.Empty ); + + FetchTooltips(); + } + + public void OnValidObjectsDropped( UnityEngine.Object[] droppedObjs ) + { + for( int objIdx = 0; objIdx < droppedObjs.Length; objIdx++ ) + { + Material mat = droppedObjs[ objIdx ] as Material; + if( mat != null ) + { + m_currentShader = mat.shader; + GetInitialInfo( mat.shader ); + return; + } + else + { + Shader shader = droppedObjs[ objIdx ] as Shader; + if( shader != null ) + { + m_currentShader = shader; + GetInitialInfo( shader ); + return; + } + } + } + } + + private void OnEnable() + { + m_draggableArea = new Rect( 0, 0, 1, 1 ); + m_dragAndDropTool = new DragAndDropTool(); + m_dragAndDropTool.OnValidDropObjectEvt += OnValidObjectsDropped; + + if( m_contentStyle == null ) + { + m_contentStyle = new GUIStyle( GUIStyle.none ); + m_contentStyle.margin = new RectOffset( 6, 4, 5, 5 ); + } + + m_pathButtonStyle = null; + + //GetInitialInfo(); + } + + private void OnDestroy() + { + if( m_dummyMaterial != null ) + { + GameObject.DestroyImmediate( m_dummyMaterial ); + m_dummyMaterial = null; + } + + m_dragAndDropTool.Destroy(); + m_dragAndDropTool = null; + + m_tooltips.Clear(); + m_tooltips = null; + + m_contentStyle = null; + m_pathButtonStyle = null; + m_currentShader = null; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs.meta new file mode 100644 index 00000000..162ab4e4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ccaa3765dae023d4b8657544c1aeef4a +timeCreated: 1550254201 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs new file mode 100644 index 00000000..663ea053 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs @@ -0,0 +1,463 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEngine.Rendering; +using UnityEditor; +using UnityEditor.PackageManager.Requests; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Text.RegularExpressions; + +namespace AmplifyShaderEditor +{ + public enum ASEImportFlags + { + None = 0, + URP = 1 << 0, + HDRP = 1 << 1, + Both = URP | HDRP + } + + public static class AssetDatabaseEX + { + private static System.Type type = null; + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.AssetDatabase, UnityEditor" ) : type; } } + + public static void ImportPackageImmediately( string packagePath ) + { + AssetDatabaseEX.Type.InvokeMember( "ImportPackageImmediately", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { packagePath } ); + } + } + + public enum ASESRPBaseline + { + ASE_SRP_INVALID = 0, + ASE_SRP_10 = 100000, + ASE_SRP_11 = 110000, + ASE_SRP_12 = 120000, + ASE_SRP_13 = 130000, + ASE_SRP_14 = 140000, + ASE_SRP_15 = 150000, + ASE_SRP_16 = 160000, + ASE_SRP_17 = 170000 + } + + public class ASESRPPackageDesc + { + public ASESRPBaseline baseline = ASESRPBaseline.ASE_SRP_INVALID; + public string guidURP = string.Empty; + public string guidHDRP = string.Empty; + + public ASESRPPackageDesc( ASESRPBaseline baseline, string guidURP, string guidHDRP ) + { + this.baseline = baseline; + this.guidURP = guidURP; + this.guidHDRP = guidHDRP; + } + } + + [Serializable] + [InitializeOnLoad] + public static class ASEPackageManagerHelper + { + private static string URPPackageId = "com.unity.render-pipelines.universal"; + private static string HDRPPackageId = "com.unity.render-pipelines.high-definition"; + + private static string NewVersionDetectedFormat = "A new {0} version {1} was detected and new templates are being imported.\nPlease hit the Update button on your ASE canvas to recompile your shader under the newest version."; + private static string PackageBaseFormat = "ASE_PkgBase_{0}_{1}"; + private static string PackageCRCFormat = "ASE_PkgCRC_{0}_{1}"; + + private static string SRPKeywordFormat = "ASE_SRP_VERSION {0}"; + private static string ASEVersionKeywordFormat = "ASE_VERSION {0}"; + + private static Dictionary m_srpPackageSupport = new Dictionary() + { + { ( int )ASESRPBaseline.ASE_SRP_10, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_10, "b460b52e6c1feae45b70b7ddc2c45bd6", "2243c8b4e1ab6914995699133f67ab5a" ) }, + { ( int )ASESRPBaseline.ASE_SRP_11, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_11, "b460b52e6c1feae45b70b7ddc2c45bd6", "2243c8b4e1ab6914995699133f67ab5a" ) }, + { ( int )ASESRPBaseline.ASE_SRP_12, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_12, "57fcea0ed8b5eb347923c4c21fa31b57", "9a5e61a8b3421b944863d0946e32da0a" ) }, + { ( int )ASESRPBaseline.ASE_SRP_13, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_13, "57fcea0ed8b5eb347923c4c21fa31b57", "9a5e61a8b3421b944863d0946e32da0a" ) }, + { ( int )ASESRPBaseline.ASE_SRP_14, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_14, "2e9da72e7e3196146bf7d27450013734", "89f0b84148d149d4d96b838d7ef60e92" ) }, + { ( int )ASESRPBaseline.ASE_SRP_15, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_15, "0904cdf24ddcd5042b024326476220d5", "19939ee2cdb76e0489b1b8cd4bed7f3d" ) }, + { ( int )ASESRPBaseline.ASE_SRP_16, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_16, "929783250050f8a448821b6ca1f2c578", "70777e8ce9f3c8d4a8182ca2f965cdb2" ) }, + { ( int )ASESRPBaseline.ASE_SRP_17, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_17, "89da50d95d149b744bf10bd27babcf79", "daf511a6dae20e641a9d69d025f023e4" ) }, + }; + + private static Shader m_lateShader; + private static Material m_lateMaterial; + private static AmplifyShaderFunction m_lateShaderFunction; + + private static ListRequest m_packageListRequest = null; + private static UnityEditor.PackageManager.PackageInfo m_urpPackageInfo; + private static UnityEditor.PackageManager.PackageInfo m_hdrpPackageInfo; + + public static bool FoundURPVersion { get { return m_urpPackageInfo != null; } } + public static bool FoundHDRPVersion { get { return m_hdrpPackageInfo != null; } } + + private static bool m_lateImport = false; + private static string m_latePackageToImport; + private static bool m_requireUpdateList = false; + private static ASEImportFlags m_importingPackage = ASEImportFlags.None; + + public static bool CheckImporter { get { return m_importingPackage != ASEImportFlags.None; } } + public static bool IsProcessing { get { return m_requireUpdateList && m_importingPackage == ASEImportFlags.None; } } + + private static ASESRPBaseline m_currentURPBaseline = ASESRPBaseline.ASE_SRP_INVALID; + private static ASESRPBaseline m_currentHDRPBaseline = ASESRPBaseline.ASE_SRP_INVALID; + + public static ASESRPBaseline CurrentURPBaseline { get { return m_currentURPBaseline; } } + public static ASESRPBaseline CurrentHDRPBaseline { get { return m_currentHDRPBaseline; } } + + private static int m_packageURPVersion = -1; // @diogo: starts as missing + private static int m_packageHDRPVersion = -1; + + public static int PackageSRPVersion { get { return ( m_packageHDRPVersion >= m_packageURPVersion ) ? m_packageHDRPVersion : m_packageURPVersion; } } + public static int CurrentSRPVersion { get { return UIUtils.CurrentWindow.MainGraphInstance.IsSRP ? PackageSRPVersion : -1; } } + + private static string m_projectName = null; + private static string ProjectName + { + get + { + if ( string.IsNullOrEmpty( m_projectName ) ) + { + string[] s = Application.dataPath.Split( '/' ); + m_projectName = s[ s.Length - 2 ]; + } + return m_projectName; + } + } + + static ASEPackageManagerHelper() + { + RequestInfo( true ); + } + + static void WaitForPackageListBeforeUpdating() + { + if ( m_packageListRequest.IsCompleted ) + { + Update(); + EditorApplication.update -= WaitForPackageListBeforeUpdating; + } + } + + public static void RequestInfo( bool updateWhileWaiting = false ) + { + if ( !m_requireUpdateList && m_importingPackage == ASEImportFlags.None ) + { + m_requireUpdateList = true; + m_packageListRequest = UnityEditor.PackageManager.Client.List( true ); + if ( updateWhileWaiting ) + { + EditorApplication.update += WaitForPackageListBeforeUpdating; + } + } + } + + static void FailedPackageImport( string packageName, string errorMessage ) + { + FinishImporter(); + } + + static void CancelledPackageImport( string packageName ) + { + FinishImporter(); + } + + static void CompletedPackageImport( string packageName ) + { + FinishImporter(); + } + + public static void CheckLatePackageImport() + { + if ( !Application.isPlaying && m_lateImport && !string.IsNullOrEmpty( m_latePackageToImport ) ) + { + m_lateImport = false; + StartImporting( m_latePackageToImport ); + m_latePackageToImport = string.Empty; + } + } + + public static void StartImporting( string packagePath ) + { + if ( !Preferences.Project.AutoSRP ) + { + m_importingPackage = ASEImportFlags.None; + return; + } + + if ( Application.isPlaying ) + { + if ( !m_lateImport ) + { + m_lateImport = true; + m_latePackageToImport = packagePath; + Debug.LogWarning( "Amplify Shader Editor requires the \"" + packagePath + "\" package to be installed in order to continue. Please exit Play mode to proceed." ); + } + return; + } + + AssetDatabase.importPackageCancelled += CancelledPackageImport; + AssetDatabase.importPackageCompleted += CompletedPackageImport; + AssetDatabase.importPackageFailed += FailedPackageImport; + AssetDatabase.ImportPackage( packagePath, false ); + //AssetDatabaseEX.ImportPackageImmediately( packagePath ); + } + + public static void FinishImporter() + { + m_importingPackage = ASEImportFlags.None; + AssetDatabase.importPackageCancelled -= CancelledPackageImport; + AssetDatabase.importPackageCompleted -= CompletedPackageImport; + AssetDatabase.importPackageFailed -= FailedPackageImport; + } + + public static void SetupLateShader( Shader shader ) + { + if ( shader == null ) + return; + + //If a previous delayed object is pending discard it and register the new one + // So the last selection will be the choice of opening + //This can happen when trying to open an ASE canvas while importing templates or in play mode + if ( m_lateShader != null ) + { + EditorApplication.delayCall -= LateShaderOpener; + } + + RequestInfo(); + m_lateShader = shader; + EditorApplication.delayCall += LateShaderOpener; + } + + public static void LateShaderOpener() + { + Update(); + if ( IsProcessing ) + { + EditorApplication.delayCall += LateShaderOpener; + } + else + { + AmplifyShaderEditorWindow.ConvertShaderToASE( m_lateShader ); + m_lateShader = null; + } + } + + public static void SetupLateMaterial( Material material ) + { + if ( material == null ) + return; + + //If a previous delayed object is pending discard it and register the new one + // So the last selection will be the choice of opening + //This can happen when trying to open an ASE canvas while importing templates or in play mode + if ( m_lateMaterial != null ) + { + EditorApplication.delayCall -= LateMaterialOpener; + } + + RequestInfo(); + m_lateMaterial = material; + EditorApplication.delayCall += LateMaterialOpener; + } + + public static void LateMaterialOpener() + { + Update(); + if ( IsProcessing ) + { + EditorApplication.delayCall += LateMaterialOpener; + } + else + { + AmplifyShaderEditorWindow.LoadMaterialToASE( m_lateMaterial ); + m_lateMaterial = null; + } + } + + public static void SetupLateShaderFunction( AmplifyShaderFunction shaderFunction ) + { + if ( shaderFunction == null ) + return; + + //If a previous delayed object is pending discard it and register the new one + // So the last selection will be the choice of opening + //This can happen when trying to open an ASE canvas while importing templates or in play mode + if ( m_lateShaderFunction != null ) + { + EditorApplication.delayCall -= LateShaderFunctionOpener; + } + + RequestInfo(); + m_lateShaderFunction = shaderFunction; + EditorApplication.delayCall += LateShaderFunctionOpener; + } + + public static void LateShaderFunctionOpener() + { + Update(); + if ( IsProcessing ) + { + EditorApplication.delayCall += LateShaderFunctionOpener; + } + else + { + AmplifyShaderEditorWindow.LoadShaderFunctionToASE( m_lateShaderFunction, false ); + m_lateShaderFunction = null; + } + } + + private static readonly string SemVerPattern = @"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"; + + private static int PackageVersionStringToCode( string version, out int major, out int minor, out int patch ) + { + MatchCollection matches = Regex.Matches( version, SemVerPattern, RegexOptions.Multiline ); + + bool validMatch = ( matches.Count > 0 && matches[ 0 ].Groups.Count >= 4 ); + major = validMatch ? int.Parse( matches[ 0 ].Groups[ 1 ].Value ) : 99; + minor = validMatch ? int.Parse( matches[ 0 ].Groups[ 2 ].Value ) : 99; + patch = validMatch ? int.Parse( matches[ 0 ].Groups[ 3 ].Value ) : 99; + + int versionCode; + versionCode = major * 10000; + versionCode += minor * 100; + versionCode += patch; + return versionCode; + } + + private static void CodeToPackageVersionElements( int versionCode, out int major, out int minor, out int patch ) + { + major = versionCode / 10000; + minor = versionCode / 100 - major * 100; + patch = versionCode - ( versionCode / 100 ) * 100; + } + + private static int PackageVersionElementsToCode( int major, int minor, int patch ) + { + return major * 10000 + minor * 100 + patch; + } + + private static void CheckPackageImport( ASEImportFlags flag, ASESRPBaseline baseline, string guid, string version ) + { + Debug.Assert( flag == ASEImportFlags.HDRP || flag == ASEImportFlags.URP ); + + string path = AssetDatabase.GUIDToAssetPath( guid ); + + if ( !string.IsNullOrEmpty( path ) && File.Exists( path ) ) + { + uint currentCRC = IOUtils.CRC32( File.ReadAllBytes( path ) ); + + string srpName = flag.ToString(); + string packageBaseKey = string.Format( PackageBaseFormat, srpName, ProjectName ); + string packageCRCKey = string.Format( PackageCRCFormat, srpName, ProjectName ); + + ASESRPBaseline savedBaseline = ( ASESRPBaseline )EditorPrefs.GetInt( packageBaseKey ); + uint savedCRC = ( uint )EditorPrefs.GetInt( packageCRCKey, 0 ); + + bool foundNewVersion = ( savedBaseline != baseline ) || ( savedCRC != currentCRC ); + + EditorPrefs.SetInt( packageBaseKey, ( int )baseline ); + EditorPrefs.SetInt( packageCRCKey, ( int )currentCRC ); + + string testPath0 = string.Empty; + string testPath1 = string.Empty; + + switch ( flag ) + { + case ASEImportFlags.URP: + { + testPath0 = AssetDatabase.GUIDToAssetPath( TemplatesManager.URPLitGUID ); + testPath1 = AssetDatabase.GUIDToAssetPath( TemplatesManager.URPUnlitGUID ); + break; + } + case ASEImportFlags.HDRP: + { + testPath0 = AssetDatabase.GUIDToAssetPath( TemplatesManager.HDRPLitGUID ); + testPath1 = AssetDatabase.GUIDToAssetPath( TemplatesManager.HDRPUnlitGUID ); + break; + } + } + + if ( !File.Exists( testPath0 ) || !File.Exists( testPath1 ) || foundNewVersion ) + { + if ( foundNewVersion ) + { + Debug.Log( string.Format( NewVersionDetectedFormat, srpName, version ) ); + } + m_importingPackage |= flag; + StartImporting( path ); + } + } + } + + public static void Update() + { + CheckLatePackageImport(); + + if ( m_requireUpdateList && m_importingPackage == ASEImportFlags.None ) + { + if ( m_packageListRequest != null && m_packageListRequest.IsCompleted && m_packageListRequest.Result != null ) + { + m_requireUpdateList = false; + foreach ( UnityEditor.PackageManager.PackageInfo pi in m_packageListRequest.Result ) + { + int version = PackageVersionStringToCode( pi.version, out int major, out int minor, out int patch ); + int baseline = PackageVersionElementsToCode( major, 0, 0 ); + ASESRPPackageDesc match; + + if ( pi.name.Equals( URPPackageId ) && m_srpPackageSupport.TryGetValue( baseline, out match ) ) + { + // Universal Rendering Pipeline + m_currentURPBaseline = match.baseline; + m_packageURPVersion = version; + m_urpPackageInfo = pi; + + CheckPackageImport( ASEImportFlags.URP, match.baseline, match.guidURP, pi.version ); + } + else if ( pi.name.Equals( HDRPPackageId ) && m_srpPackageSupport.TryGetValue( baseline, out match ) ) + { + // High-Definition Rendering Pipeline + m_currentHDRPBaseline = match.baseline; + m_packageHDRPVersion = version; + m_hdrpPackageInfo = pi; + + CheckPackageImport( ASEImportFlags.HDRP, match.baseline, match.guidHDRP, pi.version ); + } + } + } + } + } + + public static void SetASEVersionInfoOnDataCollector( ref MasterNodeDataCollector dataCollector ) + { + if ( m_requireUpdateList ) + { + Update(); + } + + dataCollector.AddToDirectives( string.Format( ASEVersionKeywordFormat, VersionInfo.FullNumber ), -1, AdditionalLineType.Define ); + } + + public static void SetSRPInfoOnDataCollector( ref MasterNodeDataCollector dataCollector ) + { + if ( m_requireUpdateList ) + { + Update(); + } + + if ( dataCollector.CurrentSRPType == TemplateSRPType.HDRP ) + { + dataCollector.AddToDirectives( string.Format( SRPKeywordFormat, m_packageHDRPVersion ), -1, AdditionalLineType.Define ); + } + else if ( dataCollector.CurrentSRPType == TemplateSRPType.URP ) + { + dataCollector.AddToDirectives( string.Format( SRPKeywordFormat, m_packageURPVersion ), -1, AdditionalLineType.Define ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs.meta new file mode 100644 index 00000000..ad7bbe2a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f48de3e34ed250945ba8c16d98b8ca0e +timeCreated: 1548881060 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleAsset.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleAsset.cs new file mode 100644 index 00000000..8b55a25e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleAsset.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +namespace AmplifyShaderEditor +{ + + [Serializable] + public class ASESaveBundleAsset : ScriptableObject + { + [SerializeField] + private string m_packageContentsOrigin = string.Empty; + + [SerializeField] + private List m_allExtras = new List(); + + [SerializeField] + private string m_packageTargetPath = string.Empty; + + [SerializeField] + private string m_packageTargetName = string.Empty; + + [SerializeField] + private List m_allShaders = new List(); + + public string PackageContentsOrigin { get { return m_packageContentsOrigin; } } + public List AllExtras{ get { return m_allExtras; } } + public string PackageTargetPath{ get{ return m_packageTargetPath;}} + public string PackageTargetName{ get { return m_packageTargetName; } } + public List AllShaders { get { return m_allShaders; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleAsset.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleAsset.cs.meta new file mode 100644 index 00000000..3a93f53d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleAsset.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e0d8dab404a624247bc5d60b401b28d4 +timeCreated: 1634216888 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleAsset.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleTool.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleTool.cs new file mode 100644 index 00000000..c81408a5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleTool.cs @@ -0,0 +1,476 @@ +using UnityEngine; +using UnityEditor; +using UnityEditorInternal; +using System; +using System.Collections.Generic; +using System.Text.RegularExpressions; + +namespace AmplifyShaderEditor +{ + + public enum ASESaveBundleAssetAction + { + Update, + Export, + UpdateAndExport + } + + [CustomEditor( typeof( ASESaveBundleAsset ) )] + public class ASESaveBundleAssetEditor : Editor + { + public ASESaveBundleAsset Instance; + private DragAndDropTool m_dragAndDropTool; + + private SerializedObject m_so; + + private SerializedProperty m_packageContentsOrigin; + private GUIContent m_packageContentsOriginLabel = new GUIContent("Main Content"); + + private SerializedProperty m_allExtras; + + private SerializedProperty m_packageTargetPath; + private GUIContent m_packageTargetPathLabel = new GUIContent( "Target Path" ); + + private SerializedProperty m_packageTargetName; + private GUIContent m_packageTargetNameLabel = new GUIContent( "Target Name" ); + + private SerializedProperty m_allShaders; + + [SerializeField] + private ReorderableList m_listShaders = null; + + [SerializeField] + private ReorderableList m_listExtras = null; + + public void OnEnable() + { + Instance = (ASESaveBundleAsset)target; + + m_so = serializedObject; + m_packageContentsOrigin = m_so.FindProperty( "m_packageContentsOrigin" ); + m_packageTargetPath = m_so.FindProperty( "m_packageTargetPath" ); + m_packageTargetName = m_so.FindProperty( "m_packageTargetName" ); + m_allShaders = m_so.FindProperty( "m_allShaders" ); + + if( m_listShaders == null ) + { + m_listShaders = new ReorderableList( m_so , m_allShaders , true , true , true , true ); + m_listShaders.elementHeight = 16; + + m_listShaders.drawElementCallback = ( Rect rect , int index , bool isActive , bool isFocused ) => + { + m_allShaders.GetArrayElementAtIndex( index ).objectReferenceValue = (Shader)EditorGUI.ObjectField( rect , "Shader " + index , m_allShaders.GetArrayElementAtIndex( index ).objectReferenceValue , typeof( Shader ) , false ); + }; + + m_listShaders.drawHeaderCallback = ( Rect rect ) => + { + EditorGUI.LabelField( rect , "Shader List" ); + }; + + m_listShaders.onAddCallback = ( list ) => + { + m_allShaders.InsertArrayElementAtIndex( m_allShaders.arraySize ); + m_allShaders.GetArrayElementAtIndex( m_allShaders.arraySize - 1 ).objectReferenceValue = null; + }; + + m_listShaders.onRemoveCallback = ( list ) => + { + m_allShaders.GetArrayElementAtIndex( list.index ).objectReferenceValue = null; + m_allShaders.DeleteArrayElementAtIndex( list.index ); + }; + } + + m_allExtras = m_so.FindProperty( "m_allExtras" ); + if( m_listExtras == null ) + { + m_listExtras = new ReorderableList( m_so , m_allExtras , true , true , true , true ); + m_listExtras.elementHeight = 18; + + m_listExtras.drawElementCallback = ( Rect rect , int index , bool isActive , bool isFocused ) => + { + rect.width -= 55; + m_allExtras.GetArrayElementAtIndex( index ).stringValue = (string)EditorGUI.TextField( rect , "Path " + index , m_allExtras.GetArrayElementAtIndex( index ).stringValue ); + + rect.x += rect.width; + rect.width = 55; + if( GUI.Button( rect, "Browse" ) ) + m_allExtras.GetArrayElementAtIndex( index ).stringValue = ASESaveBundleTool.FetchPath( "Folder Path" , m_allExtras.GetArrayElementAtIndex( index ).stringValue ); + }; + + m_listExtras.drawHeaderCallback = ( Rect rect ) => + { + EditorGUI.LabelField( rect , "Extra Paths" ); + }; + + m_listExtras.onAddCallback = ( list ) => + { + m_allExtras.InsertArrayElementAtIndex( m_allExtras.arraySize ); + m_allExtras.GetArrayElementAtIndex( m_allExtras.arraySize - 1 ).stringValue = string.Empty; + }; + + m_listExtras.onRemoveCallback = ( list ) => + { + m_allExtras.GetArrayElementAtIndex( list.index ).stringValue = string.Empty; + m_allExtras.DeleteArrayElementAtIndex( list.index ); + }; + } + + m_dragAndDropTool = new DragAndDropTool(); + m_dragAndDropTool.OnValidDropObjectEvt += OnValidObjectsDropped; + } + + void FetchValidShadersFromPath( string path , bool updateProperty ) + { + if( !path.StartsWith( "Assets" ) ) + { + int idx = path.IndexOf( "Assets" ); + if( idx >= 0 ) + { + path = path.Substring( idx ); + } + } + + if( AssetDatabase.IsValidFolder( path ) ) + { + if( updateProperty ) + m_packageContentsOrigin.stringValue = path; + + string[] pathArr = { path }; + string[] shaderInDir = AssetDatabase.FindAssets( "t:Shader" , pathArr ); + for( int shaderIdx = 0 ; shaderIdx < shaderInDir.Length ; shaderIdx++ ) + { + Shader internalShader = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( shaderInDir[ shaderIdx ] ) ); + if( internalShader != null && IOUtils.IsASEShader( internalShader ) ) + { + m_allShaders.InsertArrayElementAtIndex( m_allShaders.arraySize ); + m_allShaders.GetArrayElementAtIndex( m_allShaders.arraySize - 1 ).objectReferenceValue = internalShader; + m_so.ApplyModifiedProperties(); + } + } + } + } + + public void OnValidObjectsDropped( UnityEngine.Object[] droppedObjs ) + { + for( int objIdx = 0 ; objIdx < droppedObjs.Length ; objIdx++ ) + { + Shader shader = droppedObjs[ objIdx ] as Shader; + if( shader != null ) + { + if( IOUtils.IsASEShader( shader ) ) + { + m_allShaders.InsertArrayElementAtIndex( m_allShaders.arraySize ); + m_allShaders.GetArrayElementAtIndex( m_allShaders.arraySize - 1 ).objectReferenceValue = shader; + m_so.ApplyModifiedProperties(); + } + } + else + { + DefaultAsset asset = droppedObjs[ objIdx ] as DefaultAsset; + if( asset != null ) + { + string path = AssetDatabase.GetAssetPath( asset ); + FetchValidShadersFromPath( path,true ); + } + } + } + + Instance.AllShaders.Sort( ( x , y ) => string.Compare( x.name , y.name ) ); + m_so.Update(); + } + + private void OnDestroy() + { + m_dragAndDropTool.Destroy(); + m_dragAndDropTool = null; + } + + + public override void OnInspectorGUI() + { + m_so.Update(); + EditorGUILayout.Separator(); + + EditorGUILayout.BeginHorizontal(); + { + EditorGUILayout.PropertyField( m_packageContentsOrigin, m_packageContentsOriginLabel ); + if( GUILayout.Button( "Browse", GUILayout.MaxWidth( 55 ) ) ) + { + m_packageContentsOrigin.stringValue = ASESaveBundleTool.FetchPath( "Folder Path" , m_packageContentsOrigin.stringValue ); + } + if( GUILayout.Button( "Fetch" , GUILayout.MaxWidth( 45 ) ) ) + { + FetchValidShadersFromPath( m_packageContentsOrigin.stringValue, false ); + } + } + EditorGUILayout.EndHorizontal(); + + if( m_listExtras != null ) + m_listExtras.DoLayoutList(); + + EditorGUILayout.Separator(); + + EditorGUILayout.BeginHorizontal(); + { + EditorGUILayout.PropertyField( m_packageTargetPath , m_packageTargetPathLabel ); + if( GUILayout.Button( "Browse",GUILayout.MaxWidth(55) )) + m_packageTargetPath.stringValue = EditorUtility.OpenFolderPanel( "Folder Path" , m_packageTargetPath.stringValue , "" ); + } + EditorGUILayout.EndHorizontal(); + EditorGUILayout.PropertyField( m_packageTargetName, m_packageTargetNameLabel ); + + EditorGUILayout.Separator(); + if( GUILayout.Button( "Clear" ) ) + { + m_allShaders.ClearArray(); + } + + if( m_listShaders != null ) + m_listShaders.DoLayoutList(); + + EditorGUILayout.Separator(); + + m_dragAndDropTool.TestDragAndDrop( new Rect( 0 , 0 , Screen.width , Screen.height ) ); + + m_so.ApplyModifiedProperties(); + } + } + + public class ASESaveBundleTool : EditorWindow + { + private const string UpdateAllStr = "Update All"; + private const string UpdateAllStyle = "prebutton"; + + + [SerializeField] + private ASESaveBundleAsset m_asset; + + [SerializeField] + private ASESaveBundleAsset m_dummyAsset; + + private GUIStyle m_contentStyle = null; + + private Vector2 m_scrollPos; + private GUIContent m_ViewToolIcon; + + ASESaveBundleAssetEditor m_editor; + + private const string Title = "Batch Save and Pack"; + + [NonSerialized] + private GUIStyle m_titleStyle; + + [MenuItem( "Window/Amplify Shader Editor/"+ Title , false , 1001 )] + static void ShowWindow() + { + ASESaveBundleTool window = EditorWindow.GetWindow(); + window.titleContent.text = "Batch Save..."; + window.titleContent.tooltip = Title; + window.minSize = new Vector2( 302 , 350 ); + window.Show(); + } + + private void OnEnable() + { + if( m_contentStyle == null ) + { + m_contentStyle = new GUIStyle( GUIStyle.none ); + m_contentStyle.margin = new RectOffset( 6 , 4 , 5 , 5 ); + } + + if( m_ViewToolIcon == null ) + { + m_ViewToolIcon = EditorGUIUtility.IconContent( "icons/d_ViewToolZoom.png" ); + } + } + + private void OnDestroy() + { + DestroyImmediate( m_editor ); + if( m_dummyAsset != null && m_dummyAsset != m_asset ) + DestroyImmediate( m_dummyAsset ); + } + + + public static string FetchPath( string title, string folderpath ) + { + folderpath = EditorUtility.OpenFolderPanel( title , folderpath , "" ); + folderpath = FileUtil.GetProjectRelativePath( folderpath ); + if( string.IsNullOrEmpty( folderpath ) ) + folderpath = "Assets"; + + return folderpath; + } + + private bool m_updatingShaders = false; + + private void ExportCurrent( ASESaveBundleAsset currentAsset ) + { + List pathsList = new List(); + pathsList.Add( currentAsset.PackageContentsOrigin ); + for( int i = 0 ; i < currentAsset.AllExtras.Count ; i++ ) + { + if( currentAsset.AllExtras[ i ].StartsWith( "Assets" ) ) + { + pathsList.Add( currentAsset.AllExtras[ i ] ); + } + else + { + int idx = currentAsset.AllExtras[ i ].IndexOf( "Assets" ); + if( idx >= 0 ) + { + pathsList.Add( currentAsset.AllExtras[ i ].Substring( idx ) ); + } + } + + } + AssetDatabase.ExportPackage( pathsList.ToArray() , currentAsset.PackageTargetPath + "/" + currentAsset.PackageTargetName + ".unitypackage" , ExportPackageOptions.Recurse | ExportPackageOptions.Interactive ); + } + + private void OnGUI() + { + if( m_updatingShaders ) + { + m_updatingShaders = EditorPrefs.HasKey( AmplifyShaderEditorWindow.ASEFileList ); + } + + + if( m_titleStyle == null ) + { + m_titleStyle = new GUIStyle( "BoldLabel" ); + m_titleStyle.fontSize = 13; + m_titleStyle.alignment = TextAnchor.MiddleCenter; + } + + + EditorGUILayout.LabelField( Title , m_titleStyle ); + EditorGUI.BeginDisabledGroup( m_updatingShaders ); + { + ASESaveBundleAsset currentAsset = null; + if( m_asset != null ) + { + currentAsset = m_asset; + } + else + { + if( m_dummyAsset == null ) + { + m_dummyAsset = ScriptableObject.CreateInstance(); + m_dummyAsset.name = "Dummy"; + } + currentAsset = m_dummyAsset; + } + + m_scrollPos = EditorGUILayout.BeginScrollView( m_scrollPos , GUILayout.Height( position.height ) ); + { + float cachedWidth = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 100; + EditorGUILayout.BeginVertical( m_contentStyle ); + { + EditorGUI.BeginDisabledGroup( currentAsset.AllShaders.Count <= 0 ); + { + // Update all shaders + if( GUILayout.Button( UpdateAllStr/* , UpdateAllStyle , GUILayout.Height( 20 )*/ ) ) + { + m_updatingShaders = true; + string[] assetPaths = new string[ currentAsset.AllShaders.Count ]; + for( int i = 0 ; i < assetPaths.Length ; i++ ) + { + assetPaths[ i ] = AssetDatabase.GetAssetPath( currentAsset.AllShaders[ i ] ); + } + AmplifyShaderEditorWindow.LoadAndSaveList( assetPaths ); + } + + if( GUILayout.Button( "Remove Custom Inspector" ) ) + { + int count = currentAsset.AllShaders.Count; + for( int i = 0 ; i < count ; i++ ) + { + EditorUtility.DisplayProgressBar( "Removing custom inspector", currentAsset.AllShaders[i].name , i / ( count - 1 ) ); + string path = AssetDatabase.GetAssetPath( currentAsset.AllShaders[ i ] ); + string shaderBody = IOUtils.LoadTextFileFromDisk( path ); + shaderBody = Regex.Replace( shaderBody , TemplateHelperFunctions.CustomInspectorPattern , string.Empty ,RegexOptions.Multiline ); + shaderBody = UIUtils.ForceLFLineEnding( shaderBody ); + IOUtils.SaveTextfileToDisk( shaderBody , path , false ); + } + AssetDatabase.Refresh(); + EditorUtility.ClearProgressBar(); + } + } + EditorGUI.EndDisabledGroup(); + + + EditorGUI.BeginDisabledGroup( string.IsNullOrEmpty( currentAsset.PackageTargetName ) || string.IsNullOrEmpty( currentAsset.PackageTargetPath ) ); + { + if( GUILayout.Button( "Export Unity Package" ) ) + { + ExportCurrent( currentAsset ); + } + } + EditorGUI.EndDisabledGroup(); + EditorGUILayout.Separator(); + // Asset creation/load + EditorGUILayout.BeginHorizontal(); + m_asset = EditorGUILayout.ObjectField( "Asset Preset" , m_asset , typeof( ASESaveBundleAsset ) , false ) as ASESaveBundleAsset; + if( GUILayout.Button( m_asset != null ? "Save" : "Create" , "minibutton" , GUILayout.Width( 50 ) ) ) + { + string defaultName = "ShaderBundlePreset"; + string assetPath = string.Empty; + if( m_asset != null ) + { + defaultName = m_asset.name; + assetPath = Application.dataPath.Substring(0, Application.dataPath.Length - 6 )+ AssetDatabase.GetAssetPath( m_asset ); + } + string path = EditorUtility.SaveFilePanelInProject( "Save as" , defaultName , "asset" , string.Empty , assetPath ); + if( !string.IsNullOrEmpty( path ) ) + { + ASESaveBundleAsset outfile = AssetDatabase.LoadMainAssetAtPath( path ) as ASESaveBundleAsset; + if( outfile != null ) + { + EditorUtility.CopySerialized( currentAsset , outfile ); + AssetDatabase.SaveAssets(); + Selection.activeObject = outfile; + EditorGUIUtility.PingObject( outfile ); + } + else + { + if( m_asset != null ) + { + currentAsset = ScriptableObject.CreateInstance(); + EditorUtility.CopySerialized( m_asset , currentAsset ); + } + AssetDatabase.CreateAsset( currentAsset , path ); + Selection.activeObject = currentAsset; + EditorGUIUtility.PingObject( currentAsset ); + m_asset = currentAsset; + } + } + } + EditorGUILayout.EndHorizontal(); + if( Event.current.type == EventType.Layout ) + { + if( m_editor == null ) + { + m_editor = Editor.CreateEditor( currentAsset , typeof( ASESaveBundleAssetEditor ) ) as ASESaveBundleAssetEditor; + } + else + { + if( m_editor.Instance != currentAsset ) + { + DestroyImmediate( m_editor ); + m_editor = Editor.CreateEditor( currentAsset , typeof( ASESaveBundleAssetEditor ) ) as ASESaveBundleAssetEditor; + } + } + } + if( m_editor != null ) + m_editor.OnInspectorGUI(); + + } + EditorGUILayout.EndVertical(); + } + EditorGUILayout.EndScrollView(); + } + EditorGUI.EndDisabledGroup(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleTool.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleTool.cs.meta new file mode 100644 index 00000000..744a9d34 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleTool.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 10b84d00b09113748ac1353969d01918 +timeCreated: 1634216888 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASESaveBundleTool.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs new file mode 100644 index 00000000..0d710572 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs @@ -0,0 +1,512 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using UnityEngine.Networking; +using System.Collections; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + public class ASEStartScreen : EditorWindow + { + [MenuItem( "Window/Amplify Shader Editor/Start Screen", false, 1999 )] + public static void Init() + { + ASEStartScreen window = (ASEStartScreen)GetWindow( typeof( ASEStartScreen ), true, "Amplify Shader Editor Start Screen" ); + window.minSize = new Vector2( 650, 500 ); + window.maxSize = new Vector2( 650, 500 ); + window.Show(); + } + + private static readonly string ChangeLogGUID = "580cccd3e608b7f4cac35ea46d62d429"; + private static readonly string ResourcesGUID = "c0a0a980c9ba86345bc15411db88d34f"; + private static readonly string BuiltInGUID = "e00e6f90ab8233e46a41c5e33917c642"; + private static readonly string UniversalGUID = "a9d68dd8913f05d4d9ce75e7b40c6044"; + private static readonly string HighDefinitionGUID = "d1c0b77896049554fa4b635531caf741"; + + private static readonly string IconGUID = "2c6536772776dd84f872779990273bfc"; + + public static readonly string ChangelogURL = "https://amplify.pt/Banner/ASEchangelog.json"; + + private static readonly string ManualURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Manual"; + private static readonly string BasicURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Tutorials#Official_-_Basics"; + private static readonly string BeginnerURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Tutorials#Official_-_Beginner_Series"; + private static readonly string NodesURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Nodes"; + private static readonly string SRPURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Scriptable_Rendering_Pipeline"; + private static readonly string FunctionsURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Manual#Shader_Functions"; + private static readonly string TemplatesURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Templates"; + private static readonly string APIURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/API"; + private static readonly string SGtoASEURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Shader_Graph_to_ASE"; + + private static readonly string DiscordURL = "https://discordapp.com/invite/EdrVAP5"; + private static readonly string ForumURL = "https://forum.unity.com/threads/best-tool-asset-store-award-amplify-shader-editor-node-based-shader-creation-tool.430959/"; + + private static readonly string SiteURL = "http://amplify.pt/download/"; + private static readonly string StoreURL = "https://assetstore.unity.com/packages/tools/visual-scripting/amplify-shader-editor-68570"; + + private static readonly GUIContent SamplesTitle = new GUIContent( "Shader Samples", "Import samples according to you project rendering pipeline" ); + private static readonly GUIContent ResourcesTitle = new GUIContent( "Learning Resources", "Check the online wiki for various topics about how to use ASE with node examples and explanations" ); + private static readonly GUIContent CommunityTitle = new GUIContent( "Community", "Need help? Reach us through our discord server or the official support Unity forum" ); + private static readonly GUIContent UpdateTitle = new GUIContent( "Latest Update", "Check the lastest additions, improvements and bug fixes done to ASE" ); + private static readonly GUIContent ASETitle = new GUIContent( "Amplify Shader Editor", "Are you using the latest version? Now you know" ); + + private const string OnlineVersionWarning = "Please enable \"Allow downloads over HTTP*\" in Player Settings to access latest version information via Start Screen."; + + Vector2 m_scrollPosition = Vector2.zero; + Preferences.ShowOption m_startup = Preferences.ShowOption.Never; + + [NonSerialized] + Texture packageIcon = null; + [NonSerialized] + Texture textIcon = null; + [NonSerialized] + Texture webIcon = null; + + GUIContent HDRPbutton = null; + GUIContent URPbutton = null; + GUIContent BuiltInbutton = null; + + GUIContent Manualbutton = null; + GUIContent Basicbutton = null; + GUIContent Beginnerbutton = null; + GUIContent Nodesbutton = null; + GUIContent SRPusebutton = null; + GUIContent Functionsbutton = null; + GUIContent Templatesbutton = null; + GUIContent APIbutton = null; + GUIContent SGtoASEbutton = null; + + GUIContent DiscordButton = null; + GUIContent ForumButton = null; + + GUIContent ASEIcon = null; + RenderTexture rt; + + [NonSerialized] + GUIStyle m_buttonStyle = null; + [NonSerialized] + GUIStyle m_buttonLeftStyle = null; + [NonSerialized] + GUIStyle m_buttonRightStyle = null; + [NonSerialized] + GUIStyle m_minibuttonStyle = null; + [NonSerialized] + GUIStyle m_labelStyle = null; + [NonSerialized] + GUIStyle m_linkStyle = null; + + private ChangeLogInfo m_changeLog; + private bool m_infoDownloaded = false; + private string m_newVersion = string.Empty; + + private static Dictionary m_srpSamplePackages = new Dictionary() + { + { ( int )ASESRPBaseline.ASE_SRP_10, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_10, "2edbf4a9b9544774bbef617e92429664", "9da5530d5ebfab24c8ecad68795e720f" ) }, + { ( int )ASESRPBaseline.ASE_SRP_11, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_11, "2edbf4a9b9544774bbef617e92429664", "9da5530d5ebfab24c8ecad68795e720f" ) }, + { ( int )ASESRPBaseline.ASE_SRP_12, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_12, "13ab599a7bda4e54fba3e92a13c9580a", "aa102d640b98b5d4781710a3a3dd6983" ) }, + { ( int )ASESRPBaseline.ASE_SRP_13, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_13, "13ab599a7bda4e54fba3e92a13c9580a", "aa102d640b98b5d4781710a3a3dd6983" ) }, + { ( int )ASESRPBaseline.ASE_SRP_14, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_14, "f6f268949ccf3f34fa4d18e92501ed82", "7a0bb33169d95ec499136d59cb25918b" ) }, + { ( int )ASESRPBaseline.ASE_SRP_15, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_15, "69bc3229216b1504ea3e28b5820bbb0d", "641c955d37d2fac4f87e00ac5c9d9bd8" ) }, + { ( int )ASESRPBaseline.ASE_SRP_16, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_16, "4f665a06c5a2aa5499fa1c79ac058999", "2690f45490c175045bbdc63395bf6278" ) }, + { ( int )ASESRPBaseline.ASE_SRP_17, new ASESRPPackageDesc( ASESRPBaseline.ASE_SRP_17, "47fc5ccecd261894994c1e9e827cf553", "f42c2bc4dab4723429b0d30b635c3035" ) }, + }; + + private void OnEnable() + { + rt = new RenderTexture( 16, 16, 0 ); + rt.Create(); + + m_startup = (Preferences.ShowOption)EditorPrefs.GetInt( Preferences.User.Keys.StartUp, 0 ); + + if( textIcon == null ) + { + Texture icon = EditorGUIUtility.IconContent( "TextAsset Icon" ).image; + var cache = RenderTexture.active; + RenderTexture.active = rt; + Graphics.Blit( icon, rt ); + RenderTexture.active = cache; + textIcon = rt; + + Manualbutton = new GUIContent( " Manual", textIcon ); + Basicbutton = new GUIContent( " Basic use tutorials", textIcon ); + Beginnerbutton = new GUIContent( " Beginner Series", textIcon ); + Nodesbutton = new GUIContent( " Node List", textIcon ); + SRPusebutton = new GUIContent( " SRP HDRP/URP use", textIcon ); + Functionsbutton = new GUIContent( " Shader Functions", textIcon ); + Templatesbutton = new GUIContent( " Shader Templates", textIcon ); + APIbutton = new GUIContent( " Node API", textIcon ); + SGtoASEbutton = new GUIContent( " Shader Graph to ASE", textIcon ); + } + + if( packageIcon == null ) + { + packageIcon = EditorGUIUtility.IconContent( "BuildSettings.Editor.Small" ).image; + HDRPbutton = new GUIContent( " HDRP Samples", packageIcon ); + URPbutton = new GUIContent( " URP Samples", packageIcon ); + BuiltInbutton = new GUIContent( " Built-In Samples", packageIcon ); + } + + if( webIcon == null ) + { + webIcon = EditorGUIUtility.IconContent( "BuildSettings.Web.Small" ).image; + DiscordButton = new GUIContent( " Discord", webIcon ); + ForumButton = new GUIContent( " Unity Forum", webIcon ); + } + + if( m_changeLog == null ) + { + var changelog = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( ChangeLogGUID ) ); + string lastUpdate = string.Empty; + if(changelog != null ) + { + int oldestReleaseIndex = changelog.text.LastIndexOf( string.Format( "v{0}.{1}.{2}", VersionInfo.Major, VersionInfo.Minor, VersionInfo.Release ) ); + + lastUpdate = changelog.text.Substring( 0, changelog.text.IndexOf( "\nv", oldestReleaseIndex + 25 ) );// + "\n..."; + lastUpdate = lastUpdate.Replace( "* ", "\u2022 " ); + } + m_changeLog = new ChangeLogInfo( VersionInfo.FullNumber, lastUpdate ); + } + + if( ASEIcon == null ) + { + ASEIcon = new GUIContent( AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( IconGUID ) ) ); + } + } + + private void OnDisable() + { + if( rt != null ) + { + rt.Release(); + DestroyImmediate( rt ); + } + } + + public void OnGUI() + { + if( !m_infoDownloaded ) + { + m_infoDownloaded = true; + + StartBackgroundTask( StartRequest( ChangelogURL, () => + { + var temp = ChangeLogInfo.CreateFromJSON( www.downloadHandler.text ); + if( temp != null && temp.Version >= m_changeLog.Version ) + { + m_changeLog = temp; + } + + int version = m_changeLog.Version; + int major = version / 10000; + int minor = version / 1000 - major * 10; + int release = version / 100 - ( version / 1000 ) * 10; + int revision = version - ( version / 100 ) * 100; + + m_newVersion = major + "." + minor + "." + release + ( revision > 0 ? "." + revision : "" ); + + Repaint(); + } ) ); + } + + if( m_buttonStyle == null ) + { + m_buttonStyle = new GUIStyle( GUI.skin.button ); + m_buttonStyle.alignment = TextAnchor.MiddleLeft; + } + + if( m_buttonLeftStyle == null ) + { + m_buttonLeftStyle = new GUIStyle( "ButtonLeft" ); + m_buttonLeftStyle.alignment = TextAnchor.MiddleLeft; + m_buttonLeftStyle.margin = m_buttonStyle.margin; + m_buttonLeftStyle.margin.right = 0; + } + + if( m_buttonRightStyle == null ) + { + m_buttonRightStyle = new GUIStyle( "ButtonRight" ); + m_buttonRightStyle.alignment = TextAnchor.MiddleLeft; + m_buttonRightStyle.margin = m_buttonStyle.margin; + m_buttonRightStyle.margin.left = 0; + } + + if( m_minibuttonStyle == null ) + { + m_minibuttonStyle = new GUIStyle( "MiniButton" ); + m_minibuttonStyle.alignment = TextAnchor.MiddleLeft; + m_minibuttonStyle.margin = m_buttonStyle.margin; + m_minibuttonStyle.margin.left = 20; + m_minibuttonStyle.normal.textColor = m_buttonStyle.normal.textColor; + m_minibuttonStyle.hover.textColor = m_buttonStyle.hover.textColor; + } + + if( m_labelStyle == null ) + { + m_labelStyle = new GUIStyle( "BoldLabel" ); + m_labelStyle.margin = new RectOffset( 4, 4, 4, 4 ); + m_labelStyle.padding = new RectOffset( 2, 2, 2, 2 ); + m_labelStyle.fontSize = 13; + } + + if( m_linkStyle == null ) + { + var inv = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "1004d06b4b28f5943abdf2313a22790a" ) ); // find a better solution for transparent buttons + m_linkStyle = new GUIStyle(); + m_linkStyle.normal.textColor = new Color( 0.2980392f, 0.4901961f, 1f ); + m_linkStyle.hover.textColor = Color.white; + m_linkStyle.active.textColor = Color.grey; + m_linkStyle.margin.top = 3; + m_linkStyle.margin.bottom = 2; + m_linkStyle.hover.background = inv; + m_linkStyle.active.background = inv; + } + + EditorGUILayout.BeginHorizontal( GUIStyle.none, GUILayout.ExpandWidth( true ) ); + { + // left column + EditorGUILayout.BeginVertical( GUILayout.Width( 175 ) ); + { + GUILayout.Label( SamplesTitle, m_labelStyle ); + EditorGUILayout.BeginHorizontal(); + if( GUILayout.Button( HDRPbutton, m_buttonLeftStyle ) ) + ImportSample( HDRPbutton.text, TemplateSRPType.HDRP ); + + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.BeginHorizontal(); + if( GUILayout.Button( URPbutton, m_buttonLeftStyle ) ) + ImportSample( URPbutton.text, TemplateSRPType.URP ); + + EditorGUILayout.EndHorizontal(); + if( GUILayout.Button( BuiltInbutton, m_buttonStyle ) ) + ImportSample( BuiltInbutton.text, TemplateSRPType.BiRP ); + + GUILayout.Space( 10 ); + + GUILayout.Label( ResourcesTitle, m_labelStyle ); + if( GUILayout.Button( Manualbutton, m_buttonStyle ) ) + Application.OpenURL( ManualURL ); + + if( GUILayout.Button( Basicbutton, m_buttonStyle ) ) + Application.OpenURL( BasicURL ); + + if( GUILayout.Button( Beginnerbutton, m_buttonStyle ) ) + Application.OpenURL( BeginnerURL ); + + if( GUILayout.Button( Nodesbutton, m_buttonStyle ) ) + Application.OpenURL( NodesURL ); + + if( GUILayout.Button( SRPusebutton, m_buttonStyle ) ) + Application.OpenURL( SRPURL ); + + if( GUILayout.Button( Functionsbutton, m_buttonStyle ) ) + Application.OpenURL( FunctionsURL ); + + if( GUILayout.Button( Templatesbutton, m_buttonStyle ) ) + Application.OpenURL( TemplatesURL ); + + if( GUILayout.Button( APIbutton, m_buttonStyle ) ) + Application.OpenURL( APIURL ); + + if ( GUILayout.Button( SGtoASEbutton, m_buttonStyle ) ) + Application.OpenURL( SGtoASEURL ); + } + EditorGUILayout.EndVertical(); + + // right column + EditorGUILayout.BeginVertical( GUILayout.Width( 650 - 175 - 9 ), GUILayout.ExpandHeight( true ) ); + { + GUILayout.Label( CommunityTitle, m_labelStyle ); + EditorGUILayout.BeginHorizontal( GUILayout.ExpandWidth( true ) ); + { + if( GUILayout.Button( DiscordButton, GUILayout.ExpandWidth( true ) ) ) + { + Application.OpenURL( DiscordURL ); + } + if( GUILayout.Button( ForumButton, GUILayout.ExpandWidth( true ) ) ) + { + Application.OpenURL( ForumURL ); + } + } + EditorGUILayout.EndHorizontal(); + GUILayout.Label( UpdateTitle, m_labelStyle ); + m_scrollPosition = GUILayout.BeginScrollView( m_scrollPosition, "ProgressBarBack", GUILayout.ExpandHeight( true ), GUILayout.ExpandWidth( true ) ); + GUILayout.Label( m_changeLog.LastUpdate, "WordWrappedMiniLabel", GUILayout.ExpandHeight( true ) ); + GUILayout.EndScrollView(); + + EditorGUILayout.BeginHorizontal( GUILayout.ExpandWidth( true ) ); + { + EditorGUILayout.BeginVertical(); + GUILayout.Label( ASETitle, m_labelStyle ); + + GUILayout.Label( "Installed Version: " + VersionInfo.StaticToString() ); + + if( m_changeLog.Version > VersionInfo.FullNumber ) + { + var cache = GUI.color; + GUI.color = Color.red; + GUILayout.Label( "New version available: " + m_newVersion, "BoldLabel" ); + GUI.color = cache; + } + else + { + var cache = GUI.color; + GUI.color = Color.green; + GUILayout.Label( "You are using the latest version", "BoldLabel" ); + GUI.color = cache; + } + + EditorGUILayout.BeginHorizontal(); + GUILayout.Label( "Download links:" ); + if( GUILayout.Button( "Amplify", m_linkStyle ) ) + Application.OpenURL( SiteURL ); + GUILayout.Label( "-" ); + if( GUILayout.Button( "Asset Store", m_linkStyle ) ) + Application.OpenURL( StoreURL ); + EditorGUILayout.EndHorizontal(); + GUILayout.Space( 7 ); + EditorGUILayout.EndVertical(); + + GUILayout.FlexibleSpace(); + EditorGUILayout.BeginVertical(); + GUILayout.Space( 7 ); + GUILayout.Label( ASEIcon ); + EditorGUILayout.EndVertical(); + } + EditorGUILayout.EndHorizontal(); + } + EditorGUILayout.EndVertical(); + } + EditorGUILayout.EndHorizontal(); + + + EditorGUILayout.BeginHorizontal( "ProjectBrowserBottomBarBg", GUILayout.ExpandWidth( true ), GUILayout.Height(22) ); + { + GUILayout.FlexibleSpace(); + EditorGUI.BeginChangeCheck(); + var cache = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 100; + m_startup = (Preferences.ShowOption)EditorGUILayout.EnumPopup( "Show At Startup", m_startup, GUILayout.Width( 220 ) ); + EditorGUIUtility.labelWidth = cache; + if( EditorGUI.EndChangeCheck() ) + { + EditorPrefs.SetInt( Preferences.User.Keys.StartUp, (int)m_startup ); + } + } + EditorGUILayout.EndHorizontal(); + } + + void ImportSample( string pipeline, TemplateSRPType srpType ) + { + if( EditorUtility.DisplayDialog( "Import Sample", "This will import the samples for" + pipeline.Replace( " Samples", "" ) + ", please make sure the pipeline is properly installed and/or selected before importing the samples.\n\nContinue?", "Yes", "No" ) ) + { + AssetDatabase.ImportPackage( AssetDatabase.GUIDToAssetPath( ResourcesGUID ), false ); + + switch ( srpType ) + { + case TemplateSRPType.BiRP: + { + AssetDatabase.ImportPackage( AssetDatabase.GUIDToAssetPath( BuiltInGUID ), false ); + break; + } + case TemplateSRPType.URP: + { + if ( m_srpSamplePackages.TryGetValue( ( int )ASEPackageManagerHelper.CurrentURPBaseline, out ASESRPPackageDesc desc ) ) + { + string path = AssetDatabase.GUIDToAssetPath( desc.guidURP ); + if ( !string.IsNullOrEmpty( path ) ) + { + AssetDatabase.ImportPackage( AssetDatabase.GUIDToAssetPath( UniversalGUID ), false ); + AssetDatabase.ImportPackage( path, false ); + } + } + break; + } + case TemplateSRPType.HDRP: + { + if ( m_srpSamplePackages.TryGetValue( ( int )ASEPackageManagerHelper.CurrentHDRPBaseline, out ASESRPPackageDesc desc ) ) + { + string path = AssetDatabase.GUIDToAssetPath( desc.guidHDRP ); + if ( !string.IsNullOrEmpty( path ) ) + { + AssetDatabase.ImportPackage( AssetDatabase.GUIDToAssetPath( HighDefinitionGUID ), false ); + AssetDatabase.ImportPackage( path, false ); + } + } + break; + } + default: + { + // no action + break; + } + + } + } + } + + UnityWebRequest www; + + IEnumerator StartRequest( string url, Action success = null ) + { + using( www = UnityWebRequest.Get( url ) ) + { + yield return www.SendWebRequest(); + + while( www.isDone == false ) + yield return null; + + if( success != null ) + success(); + } + } + + public static void StartBackgroundTask( IEnumerator update, Action end = null ) + { + EditorApplication.CallbackFunction closureCallback = null; + + closureCallback = () => + { + try + { + if( update.MoveNext() == false ) + { + if( end != null ) + end(); + EditorApplication.update -= closureCallback; + } + } + catch( Exception ex ) + { + if( end != null ) + end(); + Debug.LogException( ex ); + EditorApplication.update -= closureCallback; + } + }; + + EditorApplication.update += closureCallback; + } + } + + [Serializable] + internal class ChangeLogInfo + { + public int Version; + public string LastUpdate; + + public static ChangeLogInfo CreateFromJSON( string jsonString ) + { + return JsonUtility.FromJson( jsonString ); + } + + public ChangeLogInfo( int version, string lastUpdate ) + { + Version = version; + LastUpdate = lastUpdate; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs.meta new file mode 100644 index 00000000..5364bbc8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3e7433fb42db4d9428571bfcd0da64f3 +timeCreated: 1585827066 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs new file mode 100644 index 00000000..1fb3a0d6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs @@ -0,0 +1,808 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda +//#define NEW_TEXTURE_3D_METHOD + +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; +using UnityEditorInternal; +using System; +using System.IO; + +namespace AmplifyShaderEditor +{ + [CustomEditor( typeof( TextureArrayCreatorAsset ) )] + public class TextureArrayCreatorAssetEditor : Editor + { + private string[] m_sizesStr = { "32", "64", "128", "256", "512", "1024", "2048", "4096", "8192" }; + private int[] m_sizes = { 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192 }; + + private const string ArrayFilename = "NewTextureArray"; + private const string Texture3DFilename = "NewTexture3D"; + + private GUIContent m_pathButtonContent = new GUIContent(); + private GUIStyle m_pathButtonStyle = null; + + public TextureArrayCreatorAsset Instance; + + private DragAndDropTool m_dragAndDropTool; + + SerializedObject m_so; + SerializedProperty m_selectedSize; + SerializedProperty m_lockRatio; + SerializedProperty m_sizeX; + SerializedProperty m_sizeY; + SerializedProperty m_tex3DMode; + SerializedProperty m_linearMode; + SerializedProperty m_mipMaps; + SerializedProperty m_wrapMode; + SerializedProperty m_filterMode; + SerializedProperty m_anisoLevel; + SerializedProperty m_selectedFormatEnum; + SerializedProperty m_quality; + SerializedProperty m_folderPath; + SerializedProperty m_fileName; + SerializedProperty m_filenameChanged; + SerializedProperty m_allTextures; + + [SerializeField] + private ReorderableList m_listTextures = null; + + [SerializeField] + private int m_previewSize; + + public void OnEnable() + { + Instance = (TextureArrayCreatorAsset)target; + + m_so = serializedObject; + m_selectedSize = m_so.FindProperty( "m_selectedSize" ); + m_lockRatio = m_so.FindProperty( "m_lockRatio" ); + m_sizeX = m_so.FindProperty( "m_sizeX" ); + m_sizeY = m_so.FindProperty( "m_sizeY" ); + m_tex3DMode = m_so.FindProperty( "m_tex3DMode" ); + m_linearMode = m_so.FindProperty( "m_linearMode" ); + m_mipMaps = m_so.FindProperty( "m_mipMaps" ); + m_wrapMode = m_so.FindProperty( "m_wrapMode" ); + m_filterMode = m_so.FindProperty( "m_filterMode" ); + m_anisoLevel = m_so.FindProperty( "m_anisoLevel" ); + m_selectedFormatEnum = m_so.FindProperty( "m_selectedFormatEnum" ); + m_quality = m_so.FindProperty( "m_quality" ); + m_folderPath = m_so.FindProperty( "m_folderPath" ); + m_fileName = m_so.FindProperty( "m_fileName" ); + m_filenameChanged = m_so.FindProperty( "m_filenameChanged" ); + m_allTextures = m_so.FindProperty( "m_allTextures" ); + + if( m_listTextures == null ) + { + m_listTextures = new ReorderableList( m_so, m_allTextures, true, true, true, true ); + m_listTextures.elementHeight = 16; + + m_listTextures.drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => + { + m_allTextures.GetArrayElementAtIndex( index ).objectReferenceValue = (Texture2D)EditorGUI.ObjectField( rect, "Texture " + index, m_allTextures.GetArrayElementAtIndex( index ).objectReferenceValue, typeof( Texture2D ), false ); + }; + + m_listTextures.drawHeaderCallback = ( Rect rect ) => + { + m_previewSize = EditorGUI.IntSlider( rect, "Texture List", m_previewSize, 16, 64 ); + if( (float)m_previewSize != m_listTextures.elementHeight ) + m_listTextures.elementHeight = m_previewSize; + }; + + m_listTextures.onAddCallback = ( list ) => + { + m_allTextures.InsertArrayElementAtIndex( m_allTextures.arraySize ); + m_allTextures.GetArrayElementAtIndex( m_allTextures.arraySize - 1 ).objectReferenceValue = null; + }; + + m_listTextures.onRemoveCallback = ( list ) => + { + m_allTextures.GetArrayElementAtIndex( list.index ).objectReferenceValue = null; + m_allTextures.DeleteArrayElementAtIndex( list.index ); + }; + } + + m_dragAndDropTool = new DragAndDropTool(); + m_dragAndDropTool.OnValidDropObjectEvt += OnValidObjectsDropped; + } + + public void OnValidObjectsDropped( UnityEngine.Object[] droppedObjs ) + { + for( int objIdx = 0; objIdx < droppedObjs.Length; objIdx++ ) + { + Texture2D tex = droppedObjs[ objIdx ] as Texture2D; + if( tex != null ) + { + m_allTextures.InsertArrayElementAtIndex( m_allTextures.arraySize ); + m_allTextures.GetArrayElementAtIndex( m_allTextures.arraySize - 1 ).objectReferenceValue = tex; + m_so.ApplyModifiedProperties(); + } + else + { + DefaultAsset asset = droppedObjs[ objIdx ] as DefaultAsset; + if( asset != null ) + { + string path = AssetDatabase.GetAssetPath( asset ); + if( AssetDatabase.IsValidFolder( path ) ) + { + string[] pathArr = { path }; + string[] texInDir = AssetDatabase.FindAssets( "t:Texture2D", pathArr ); + for( int texIdx = 0; texIdx < texInDir.Length; texIdx++ ) + { + Texture2D internalTex = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( texInDir[ texIdx ] ) ); + if( internalTex != null ) + { + m_allTextures.InsertArrayElementAtIndex( m_allTextures.arraySize ); + m_allTextures.GetArrayElementAtIndex( m_allTextures.arraySize - 1 ).objectReferenceValue = internalTex; + m_so.ApplyModifiedProperties(); + } + } + } + } + } + } + + Instance.AllTextures.Sort( ( x, y ) => string.Compare( x.name, y.name ) ); + m_so.Update(); + } + + private void OnDestroy() + { + m_dragAndDropTool.Destroy(); + m_dragAndDropTool = null; + } + + public override void OnInspectorGUI() + { + m_so.Update(); + + if( m_pathButtonStyle == null ) + m_pathButtonStyle = "minibutton"; + + EditorGUILayout.BeginHorizontal(); + var cache = EditorGUIUtility.labelWidth; + EditorGUILayout.PrefixLabel( "Size" ); + EditorGUIUtility.labelWidth = 16; + if( m_lockRatio.boolValue ) + { + m_selectedSize.intValue = EditorGUILayout.Popup( "X", m_selectedSize.intValue, m_sizesStr ); + EditorGUI.BeginDisabledGroup( m_lockRatio.boolValue ); + EditorGUILayout.Popup( "Y", m_selectedSize.intValue, m_sizesStr ); + EditorGUI.EndDisabledGroup(); + } + else + { + EditorGUILayout.PropertyField( m_sizeX, new GUIContent( "X" ) ); + EditorGUILayout.PropertyField( m_sizeY, new GUIContent( "Y" ) ); + } + EditorGUIUtility.labelWidth = 100; + m_lockRatio.boolValue = GUILayout.Toggle( m_lockRatio.boolValue, "L", "minibutton", GUILayout.Width( 18 ) ); + if( m_lockRatio.boolValue ) + { + m_sizeX.intValue = m_sizes[ m_selectedSize.intValue ]; + m_sizeY.intValue = m_sizes[ m_selectedSize.intValue ]; + } + EditorGUIUtility.labelWidth = cache; + EditorGUILayout.EndHorizontal(); + EditorGUI.BeginChangeCheck(); + EditorGUILayout.PropertyField( m_tex3DMode, new GUIContent( "Texture 3D" ) ); + if( EditorGUI.EndChangeCheck() ) + { + if( !m_filenameChanged.boolValue ) + { + m_fileName.stringValue = m_tex3DMode.boolValue ? Texture3DFilename : ArrayFilename; + } + } + EditorGUILayout.PropertyField( m_linearMode, new GUIContent( "Linear" ) ); + EditorGUILayout.PropertyField( m_mipMaps ); + EditorGUILayout.PropertyField( m_wrapMode ); + EditorGUILayout.PropertyField( m_filterMode ); + m_anisoLevel.intValue = EditorGUILayout.IntSlider( "Aniso Level", m_anisoLevel.intValue, 0, 16 ); + EditorGUILayout.PropertyField( m_selectedFormatEnum, new GUIContent( "Format" ) ); + + if( m_selectedFormatEnum.intValue == (int)TextureFormat.DXT1Crunched ) + { + m_selectedFormatEnum.intValue = (int)TextureFormat.DXT1; + Debug.Log( "Texture Array does not support crunched DXT1 format. Changing to DXT1..." ); + } + else if( m_selectedFormatEnum.intValue == (int)TextureFormat.DXT5Crunched ) + { + m_selectedFormatEnum.intValue = (int)TextureFormat.DXT5; + Debug.Log( "Texture Array does not support crunched DXT5 format. Changing to DXT5..." ); + } + + m_quality.intValue = EditorGUILayout.IntSlider( "Format Quality", m_quality.intValue, 0, 100 ); + EditorGUILayout.Separator(); + + EditorGUILayout.LabelField( "Path and Name" ); + EditorGUILayout.BeginHorizontal(); + m_pathButtonContent.text = m_folderPath.stringValue; + Vector2 buttonSize = m_pathButtonStyle.CalcSize( m_pathButtonContent ); + if( GUILayout.Button( m_pathButtonContent, m_pathButtonStyle, GUILayout.MaxWidth( Mathf.Min( Screen.width * 0.5f, buttonSize.x ) ) ) ) + { + string folderpath = EditorUtility.OpenFolderPanel( "Save Texture Array to folder", "Assets/", "" ); + folderpath = FileUtil.GetProjectRelativePath( folderpath ); + if( string.IsNullOrEmpty( folderpath ) ) + m_folderPath.stringValue = "Assets/"; + else + m_folderPath.stringValue = folderpath + "/"; + } + EditorGUI.BeginChangeCheck(); + m_fileName.stringValue = EditorGUILayout.TextField( m_fileName.stringValue, GUILayout.ExpandWidth( true ) ); + if( EditorGUI.EndChangeCheck() ) + { + m_filenameChanged.boolValue = m_fileName.stringValue == ArrayFilename ? false : true; + } + EditorGUILayout.LabelField( ".asset", GUILayout.MaxWidth( 40 ) ); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.Separator(); + + if( GUILayout.Button( "Clear" ) ) + { + m_allTextures.ClearArray(); + } + + if( m_listTextures != null ) + m_listTextures.DoLayoutList(); + + EditorGUILayout.Separator(); + + m_dragAndDropTool.TestDragAndDrop( new Rect( 0, 0, Screen.width, Screen.height ) ); + + m_so.ApplyModifiedProperties(); + } + } + + public class ASETextureArrayCreator : EditorWindow + { + [MenuItem( "Window/Amplify Shader Editor/Texture Array Creator", false, 1001 )] + static void ShowWindow() + { + ASETextureArrayCreator window = EditorWindow.GetWindow(); + window.titleContent.text = "Texture Array"; + window.minSize = new Vector2( 302, 350 ); + window.Show(); + } + + private const string ClearButtonStr = "Clear"; + private const string TextureFilter = "t:Texture2D"; + private const string BuildArrayMessage = "Build Array"; + private const string BuildTexture3DMessage = "Build Texture 3D"; + private const string ArrayFilename = "NewTextureArray"; + private const string Texture3DFilename = "NewTexture3D"; + + TextureArrayCreatorAssetEditor m_editor; + + [SerializeField] + private TextureArrayCreatorAsset m_asset; + + [SerializeField] + private TextureArrayCreatorAsset m_dummyAsset; + + private static List UncompressedFormats = new List() + { + TextureFormat.RGBAFloat, + TextureFormat.RGBAHalf, + TextureFormat.ARGB32, + TextureFormat.RGBA32, + TextureFormat.RGB24, + TextureFormat.Alpha8 + }; + + private GUIStyle m_contentStyle = null; + + private Vector2 m_scrollPos; + private Texture m_lastSaved; + private string m_message = string.Empty; + + private void OnEnable() + { + if( m_contentStyle == null ) + { + m_contentStyle = new GUIStyle( GUIStyle.none ); + m_contentStyle.margin = new RectOffset( 6, 4, 5, 5 ); + } + } + + private void OnDestroy() + { + DestroyImmediate( m_editor ); + if( m_dummyAsset != null && m_dummyAsset != m_asset ) + DestroyImmediate( m_dummyAsset ); + } + + void OnGUI() + { + TextureArrayCreatorAsset currentAsset = null; + if( m_asset != null ) + { + currentAsset = m_asset; + } + else + { + if( m_dummyAsset == null ) + { + m_dummyAsset = ScriptableObject.CreateInstance(); + m_dummyAsset.name = "Dummy"; + } + currentAsset = m_dummyAsset; + } + + m_scrollPos = EditorGUILayout.BeginScrollView( m_scrollPos, GUILayout.Height( position.height ) ); + float cachedWidth = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 100; + EditorGUILayout.BeginVertical( m_contentStyle ); + + string buildButtonStr = currentAsset.Tex3DMode ? BuildTexture3DMessage : BuildArrayMessage; + // build button + EditorGUILayout.BeginHorizontal(); + EditorGUI.BeginDisabledGroup( currentAsset.AllTextures.Count <= 0 ); + if( GUILayout.Button( buildButtonStr, "prebutton", GUILayout.Height( 20 ) ) ) + { + bool showWarning = false; + for( int i = 0; i < currentAsset.AllTextures.Count; i++ ) + { + if( currentAsset.AllTextures[ i ].width != currentAsset.SizeX || currentAsset.AllTextures[ i ].height != currentAsset.SizeY ) + { + showWarning = true; + } + } + + if( !showWarning ) + { + m_message = string.Empty; + if( currentAsset.Tex3DMode ) + BuildTexture3D( currentAsset ); + else + BuildArray( currentAsset ); + } + else if( EditorUtility.DisplayDialog( "Warning!", "Some textures need to be resized to fit the selected size. Do you want to continue?", "Yes", "No" ) ) + { + m_message = string.Empty; + if( currentAsset.Tex3DMode ) + BuildTexture3D( currentAsset ); + else + BuildArray( currentAsset ); + } + } + EditorGUI.EndDisabledGroup(); + EditorGUI.BeginDisabledGroup( m_lastSaved == null ); + GUIContent icon = EditorGUIUtility.IconContent( "icons/d_ViewToolZoom.png" ); + if( GUILayout.Button( icon, "prebutton", GUILayout.Width( 28 ), GUILayout.Height( 20 ) ) ) + { + EditorGUIUtility.PingObject( m_lastSaved ); + } + EditorGUI.EndDisabledGroup(); + EditorGUILayout.EndHorizontal(); + + // message + if( !string.IsNullOrEmpty( m_message ) ) + if( GUILayout.Button( "BUILD REPORT (click to hide):\n\n" + m_message, "helpbox" ) ) + m_message = string.Empty; + + // asset + EditorGUILayout.BeginHorizontal(); + m_asset = EditorGUILayout.ObjectField( "Asset Preset", m_asset, typeof( TextureArrayCreatorAsset ), false ) as TextureArrayCreatorAsset; + if( GUILayout.Button( m_asset != null ? "Save" : "Create", "minibutton", GUILayout.Width( 50 ) ) ) + { + string defaultName = "ArrayPreset"; + if( m_asset != null ) + defaultName = m_asset.name; + + string path = EditorUtility.SaveFilePanelInProject( "Save as", defaultName, "asset", string.Empty ); + if( !string.IsNullOrEmpty( path ) ) + { + TextureArrayCreatorAsset outfile = AssetDatabase.LoadMainAssetAtPath( path ) as TextureArrayCreatorAsset; + if( outfile != null ) + { + EditorUtility.CopySerialized( currentAsset, outfile ); + AssetDatabase.SaveAssets(); + Selection.activeObject = outfile; + EditorGUIUtility.PingObject( outfile ); + } + else + { + if( m_asset != null ) + { + currentAsset = ScriptableObject.CreateInstance(); + EditorUtility.CopySerialized( m_asset, currentAsset ); + } + AssetDatabase.CreateAsset( currentAsset, path ); + Selection.activeObject = currentAsset; + EditorGUIUtility.PingObject( currentAsset ); + m_asset = currentAsset; + } + } + } + EditorGUILayout.EndHorizontal(); + EditorGUILayout.Separator(); + + if( Event.current.type == EventType.Layout ) + { + if( m_editor == null ) + { + m_editor = Editor.CreateEditor( currentAsset, typeof( TextureArrayCreatorAssetEditor ) ) as TextureArrayCreatorAssetEditor; + } + else + { + if( m_editor.Instance != currentAsset ) + { + DestroyImmediate( m_editor ); + m_editor = Editor.CreateEditor( currentAsset, typeof( TextureArrayCreatorAssetEditor ) ) as TextureArrayCreatorAssetEditor; + } + } + } + if( m_editor != null ) + m_editor.OnInspectorGUI(); + + GUILayout.Space( 20 ); + EditorGUILayout.EndVertical(); + EditorGUIUtility.labelWidth = cachedWidth; + EditorGUILayout.EndScrollView(); + } + + private void CopyToArray( ref Texture2D from, ref Texture2DArray to, int arrayIndex, int mipLevel, bool compressed = true ) + { + if( compressed ) + { + Graphics.CopyTexture( from, 0, mipLevel, to, arrayIndex, mipLevel ); + } + else + { + to.SetPixels( from.GetPixels(), arrayIndex, mipLevel ); + to.Apply(); + } + } + +#if NEW_TEXTURE_3D_METHOD + private void BuildTexture3D( TextureArrayCreatorAsset asset ) + { + int sizeX = asset.SizeX; + int sizeY = asset.SizeY; + + Texture3D texture3D = new Texture3D( sizeX, sizeY, asset.AllTextures.Count, asset.SelectedFormatEnum, asset.MipMaps ); + texture3D.wrapMode = asset.WrapMode; + texture3D.filterMode = asset.FilterMode; + texture3D.anisoLevel = asset.AnisoLevel; + //texture3D.Apply( false ); + RenderTexture cache = RenderTexture.active; + RenderTexture rt = new RenderTexture( sizeX, sizeY, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default ); + rt.Create(); + List textures = new List( asset.AllTextures.Count ); + + for( int i = 0; i < asset.AllTextures.Count; i++ ) + { + // build report + int widthChanges = asset.AllTextures[ i ].width < sizeX ? -1 : asset.AllTextures[ i ].width > sizeX ? 1 : 0; + int heightChanges = asset.AllTextures[ i ].height < sizeY ? -1 : asset.AllTextures[ i ].height > sizeY ? 1 : 0; + if( ( widthChanges < 0 && heightChanges <= 0 ) || ( widthChanges <= 0 && heightChanges < 0 ) ) + m_message += asset.AllTextures[ i ].name + " was upscaled\n"; + else if( ( widthChanges > 0 && heightChanges >= 0 ) || ( widthChanges >= 0 && heightChanges > 0 ) ) + m_message += asset.AllTextures[ i ].name + " was downscaled\n"; + else if( ( widthChanges > 0 && heightChanges < 0 ) || ( widthChanges < 0 && heightChanges > 0 ) ) + m_message += asset.AllTextures[ i ].name + " changed dimensions\n"; + + // blit image to upscale or downscale the image to any size + RenderTexture.active = rt; + + bool cachedsrgb = GL.sRGBWrite; + GL.sRGBWrite = !asset.LinearMode; + Graphics.Blit( asset.AllTextures[ i ], rt ); + GL.sRGBWrite = cachedsrgb; + + textures.Add( new Texture2D( sizeX, sizeY, TextureFormat.ARGB32, asset.MipMaps, asset.LinearMode ) ); + textures[ i ].ReadPixels( new Rect( 0, 0, sizeX, sizeY ), 0, 0, asset.MipMaps ); + RenderTexture.active = null; + + bool isCompressed = UncompressedFormats.FindIndex( x => x.Equals( asset.SelectedFormatEnum ) ) < 0; + if( isCompressed ) + { + EditorUtility.CompressTexture( textures[ i ], asset.SelectedFormatEnum, asset.Quality ); + // t2d.Apply( false ); + } + textures[ i ].Apply( false ); + } + + rt.Release(); + RenderTexture.active = cache; + + if( m_message.Length > 0 ) + m_message = m_message.Substring( 0, m_message.Length - 1 ); + + int sizeZ = textures.Count; + Color[] colors = new Color[ sizeX * sizeY * sizeZ ]; + int idx = 0; + for( int z = 0; z < sizeZ; z++ ) + { + for( int y = 0; y < sizeY; y++ ) + { + for( int x = 0; x < sizeX; x++, idx++ ) + { + colors[ idx ] = textures[ z ].GetPixel(x,y); + } + } + } + + texture3D.SetPixels( colors ); + texture3D.Apply(); + + string path = asset.FolderPath + asset.FileName + ".asset"; + Texture3D outfile = AssetDatabase.LoadMainAssetAtPath( path ) as Texture3D; + if( outfile != null ) + { + EditorUtility.CopySerialized( texture3D, outfile ); + AssetDatabase.SaveAssets(); + EditorGUIUtility.PingObject( outfile ); + m_lastSaved = outfile; + } + else + { + AssetDatabase.CreateAsset( texture3D, path ); + EditorGUIUtility.PingObject( texture3D ); + m_lastSaved = texture3D; + } + } +#else + private void BuildTexture3D( TextureArrayCreatorAsset asset ) + { + int sizeX = asset.SizeX; + int sizeY = asset.SizeY; + int numLevels = 1 + (int)Mathf.Floor( Mathf.Log( Mathf.Max( sizeX, sizeY ), 2 ) ); + int mipCount = asset.MipMaps ? numLevels : 1; + + Texture3D texture3D = new Texture3D( sizeX, sizeY, asset.AllTextures.Count, asset.SelectedFormatEnum, asset.MipMaps ); + texture3D.wrapMode = asset.WrapMode; + texture3D.filterMode = asset.FilterMode; + texture3D.anisoLevel = asset.AnisoLevel; + texture3D.Apply( false ); + RenderTexture cache = RenderTexture.active; + RenderTexture rt = new RenderTexture( sizeX, sizeY, 0, RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Default ); + rt.Create(); + List> mipColor = new List>(); + if( asset.MipMaps ) + { + for( int i = 0; i < mipCount; i++ ) + { + mipColor.Add( new List() ); + } + } + else + { + mipColor.Add( new List() ); + } + + for( int i = 0; i < asset.AllTextures.Count; i++ ) + { + // build report + int widthChanges = asset.AllTextures[ i ].width < sizeX ? -1 : asset.AllTextures[ i ].width > sizeX ? 1 : 0; + int heightChanges = asset.AllTextures[ i ].height < sizeY ? -1 : asset.AllTextures[ i ].height > sizeY ? 1 : 0; + if( ( widthChanges < 0 && heightChanges <= 0 ) || ( widthChanges <= 0 && heightChanges < 0 ) ) + m_message += asset.AllTextures[ i ].name + " was upscaled\n"; + else if( ( widthChanges > 0 && heightChanges >= 0 ) || ( widthChanges >= 0 && heightChanges > 0 ) ) + m_message += asset.AllTextures[ i ].name + " was downscaled\n"; + else if( ( widthChanges > 0 && heightChanges < 0 ) || ( widthChanges < 0 && heightChanges > 0 ) ) + m_message += asset.AllTextures[ i ].name + " changed dimensions\n"; + + // blit image to upscale or downscale the image to any size + RenderTexture.active = rt; + + bool cachedsrgb = GL.sRGBWrite; + GL.sRGBWrite = !asset.LinearMode; + Graphics.Blit( asset.AllTextures[ i ], rt ); + GL.sRGBWrite = cachedsrgb; + + bool isCompressed = UncompressedFormats.FindIndex( x => x.Equals( asset.SelectedFormatEnum ) ) < 0; + TextureFormat validReadPixelsFormat = isCompressed ? TextureFormat.RGBAFloat : asset.SelectedFormatEnum; + Texture2D t2d = new Texture2D( sizeX, sizeY, validReadPixelsFormat, asset.MipMaps, asset.LinearMode ); + t2d.ReadPixels( new Rect( 0, 0, sizeX, sizeY ), 0, 0, asset.MipMaps ); + RenderTexture.active = null; + + if( isCompressed ) + { + EditorUtility.CompressTexture( t2d, asset.SelectedFormatEnum, asset.Quality ); + // t2d.Apply( false ); + } + t2d.Apply( false ); + + if( asset.MipMaps ) + { + for( int mip = 0; mip < mipCount; mip++ ) + { + mipColor[ mip ].AddRange( t2d.GetPixels( mip ) ); + } + } + else + { + mipColor[ 0 ].AddRange( t2d.GetPixels( 0 ) ); + } + } + + rt.Release(); + RenderTexture.active = cache; + + if( m_message.Length > 0 ) + m_message = m_message.Substring( 0, m_message.Length - 1 ); + + for( int i = 0; i < mipCount; i++ ) + { + texture3D.SetPixels( mipColor[ i ].ToArray(), i ); + } + + texture3D.Apply( false ); + + string path = asset.FolderPath + asset.FileName + ".asset"; + Texture3D outfile = AssetDatabase.LoadMainAssetAtPath( path ) as Texture3D; + if( outfile != null ) + { + EditorUtility.CopySerialized( texture3D, outfile ); + AssetDatabase.SaveAssets(); + EditorGUIUtility.PingObject( outfile ); + m_lastSaved = outfile; + } + else + { + AssetDatabase.CreateAsset( texture3D, path ); + EditorGUIUtility.PingObject( texture3D ); + m_lastSaved = texture3D; + } + } +#endif + private void BuildTexture3DAutoMips( TextureArrayCreatorAsset asset ) + { + int sizeX = asset.SizeX; + int sizeY = asset.SizeY; + + Texture3D texture3D = new Texture3D( sizeX, sizeY, asset.AllTextures.Count, asset.SelectedFormatEnum, asset.MipMaps ); + texture3D.wrapMode = asset.WrapMode; + texture3D.filterMode = asset.FilterMode; + texture3D.anisoLevel = asset.AnisoLevel; + texture3D.Apply( false ); + RenderTexture cache = RenderTexture.active; + RenderTexture rt = new RenderTexture( sizeX, sizeY, 0, RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Default ); + rt.Create(); + List texColors = new List(); + + for( int i = 0; i < asset.AllTextures.Count; i++ ) + { + // build report + int widthChanges = asset.AllTextures[ i ].width < sizeX ? -1 : asset.AllTextures[ i ].width > sizeX ? 1 : 0; + int heightChanges = asset.AllTextures[ i ].height < sizeY ? -1 : asset.AllTextures[ i ].height > sizeY ? 1 : 0; + if( ( widthChanges < 0 && heightChanges <= 0 ) || ( widthChanges <= 0 && heightChanges < 0 ) ) + m_message += asset.AllTextures[ i ].name + " was upscaled\n"; + else if( ( widthChanges > 0 && heightChanges >= 0 ) || ( widthChanges >= 0 && heightChanges > 0 ) ) + m_message += asset.AllTextures[ i ].name + " was downscaled\n"; + else if( ( widthChanges > 0 && heightChanges < 0 ) || ( widthChanges < 0 && heightChanges > 0 ) ) + m_message += asset.AllTextures[ i ].name + " changed dimensions\n"; + + // blit image to upscale or downscale the image to any size + RenderTexture.active = rt; + + bool cachedsrgb = GL.sRGBWrite; + GL.sRGBWrite = !asset.LinearMode; + Graphics.Blit( asset.AllTextures[ i ], rt ); + GL.sRGBWrite = cachedsrgb; + + bool isCompressed = UncompressedFormats.FindIndex( x => x.Equals( asset.SelectedFormatEnum ) ) < 0; + TextureFormat validReadPixelsFormat = isCompressed ? TextureFormat.RGBAFloat : asset.SelectedFormatEnum; + Texture2D t2d = new Texture2D( sizeX, sizeY, validReadPixelsFormat, asset.MipMaps, asset.LinearMode ); + t2d.ReadPixels( new Rect( 0, 0, sizeX, sizeY ), 0, 0, asset.MipMaps ); + RenderTexture.active = null; + + if( isCompressed ) + { + EditorUtility.CompressTexture( t2d, asset.SelectedFormatEnum, asset.Quality ); + t2d.Apply( false ); + } + texColors.AddRange( t2d.GetPixels() ); + } + + rt.Release(); + RenderTexture.active = cache; + + if( m_message.Length > 0 ) + m_message = m_message.Substring( 0, m_message.Length - 1 ); + + texture3D.SetPixels( texColors.ToArray() ); + texture3D.Apply(); + + string path = asset.FolderPath + asset.FileName + ".asset"; + Texture3D outfile = AssetDatabase.LoadMainAssetAtPath( path ) as Texture3D; + if( outfile != null ) + { + EditorUtility.CopySerialized( texture3D, outfile ); + AssetDatabase.SaveAssets(); + EditorGUIUtility.PingObject( outfile ); + m_lastSaved = outfile; + } + else + { + AssetDatabase.CreateAsset( texture3D, path ); + EditorGUIUtility.PingObject( texture3D ); + m_lastSaved = texture3D; + } + } + + private void BuildArray( TextureArrayCreatorAsset asset ) + { + int sizeX = asset.SizeX; + int sizeY = asset.SizeY; + + Texture2DArray textureArray = new Texture2DArray( sizeX, sizeY, asset.AllTextures.Count, asset.SelectedFormatEnum, asset.MipMaps, asset.LinearMode ); + textureArray.wrapMode = asset.WrapMode; + textureArray.filterMode = asset.FilterMode; + textureArray.anisoLevel = asset.AnisoLevel; + textureArray.Apply( false ); + RenderTexture cache = RenderTexture.active; + RenderTexture rt = new RenderTexture( sizeX, sizeY, 0, RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Default ); + rt.Create(); + for( int i = 0; i < asset.AllTextures.Count; i++ ) + { + // build report + int widthChanges = asset.AllTextures[ i ].width < sizeX ? -1 : asset.AllTextures[ i ].width > sizeX ? 1 : 0; + int heightChanges = asset.AllTextures[ i ].height < sizeY ? -1 : asset.AllTextures[ i ].height > sizeY ? 1 : 0; + if( ( widthChanges < 0 && heightChanges <= 0 ) || ( widthChanges <= 0 && heightChanges < 0 ) ) + m_message += asset.AllTextures[ i ].name + " was upscaled\n"; + else if( ( widthChanges > 0 && heightChanges >= 0 ) || ( widthChanges >= 0 && heightChanges > 0 ) ) + m_message += asset.AllTextures[ i ].name + " was downscaled\n"; + else if( ( widthChanges > 0 && heightChanges < 0 ) || ( widthChanges < 0 && heightChanges > 0 ) ) + m_message += asset.AllTextures[ i ].name + " changed dimensions\n"; + + // blit image to upscale or downscale the image to any size + RenderTexture.active = rt; + + bool cachedsrgb = GL.sRGBWrite; + GL.sRGBWrite = !asset.LinearMode; + Graphics.Blit( asset.AllTextures[ i ], rt ); + GL.sRGBWrite = cachedsrgb; + + bool isCompressed = UncompressedFormats.FindIndex( x => x.Equals( asset.SelectedFormatEnum ) ) < 0; + TextureFormat validReadPixelsFormat = isCompressed ? TextureFormat.RGBAFloat : asset.SelectedFormatEnum; + Texture2D t2d = new Texture2D( sizeX, sizeY, validReadPixelsFormat, asset.MipMaps, asset.LinearMode ); + t2d.ReadPixels( new Rect( 0, 0, sizeX, sizeY ), 0, 0, asset.MipMaps ); + RenderTexture.active = null; + + if( isCompressed ) + { + EditorUtility.CompressTexture( t2d, asset.SelectedFormatEnum, asset.Quality ); + t2d.Apply( false ); + } + + if( asset.MipMaps ) + { + int maxSize = Mathf.Max( sizeX, sizeY ); + int numLevels = 1 + (int)Mathf.Floor( Mathf.Log( maxSize, 2 ) ); + for( int mip = 0; mip < numLevels; mip++ ) + { + CopyToArray( ref t2d, ref textureArray, i, mip, isCompressed ); + } + } + else + { + CopyToArray( ref t2d, ref textureArray, i, 0, isCompressed ); + } + } + + rt.Release(); + RenderTexture.active = cache; + if( m_message.Length > 0 ) + m_message = m_message.Substring( 0, m_message.Length - 1 ); + + string path = asset.FolderPath + asset.FileName + ".asset"; + Texture2DArray outfile = AssetDatabase.LoadMainAssetAtPath( path ) as Texture2DArray; + if( outfile != null ) + { + EditorUtility.CopySerialized( textureArray, outfile ); + AssetDatabase.SaveAssets(); + EditorGUIUtility.PingObject( outfile ); + m_lastSaved = outfile; + } + else + { + AssetDatabase.CreateAsset( textureArray, path ); + EditorGUIUtility.PingObject( textureArray ); + m_lastSaved = textureArray; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs.meta new file mode 100644 index 00000000..f632381e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 436dc8bc09773454db57b9fbf799ec9d +timeCreated: 1504633068 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs new file mode 100644 index 00000000..bb752722 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs @@ -0,0 +1,571 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System; +using System.Reflection; + +namespace AmplifyShaderEditor +{ + public static class MaterialPropertyHandlerEx + { + private static System.Type type = null; + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.MaterialPropertyHandler, UnityEditor" ) : type; } } + public static object GetHandler( Shader shader, string name ) + { + return MaterialPropertyHandlerEx.Type.InvokeMember( "GetHandler", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { shader, name } ); + } + + public static void OnGUI( object obj, ref Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor ) + { + Type.InvokeMember( "OnGUI", BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null, obj, new object[] { position, prop, label, editor } ); + } + + public static float GetPropertyHeight( object obj, MaterialProperty prop, string label, MaterialEditor editor ) + { + return (float)Type.InvokeMember( "GetPropertyHeight", BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null, obj, new object[] { prop, label, editor } ); + } + + public static object PropertyDrawer( object obj ) + { + return Type.InvokeMember( "propertyDrawer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty, null, obj, new object[] {} ); + } + } + + internal class MaterialInspector : ShaderGUI + { + private const string CopyButtonStr = "Copy Values"; + private const string PasteButtonStr = "Paste Values"; + private const string PreviewModelPref = "ASEMI_PREVIEWMODEL"; + + private static MaterialEditor m_instance = null; + private static bool m_refreshOnUndo = false; + + private bool m_initialized = false; + private double m_lastRenderedTime; + private PreviewRenderUtility m_previewRenderUtility; + private Mesh m_targetMesh; + private Vector2 m_previewDir = new Vector2( 120f, -20f ); + private int m_selectedMesh = 0; + private int m_prevSelectedMesh = 0; + + + // Reflection Fields + + private FieldInfo m_previewDirDefault = null; + + private Type m_modelInspectorType = null; + private MethodInfo m_renderMeshMethod = null; + private Type m_previewGUIType = null; + private MethodInfo m_dragMethod = null; + private FieldInfo m_selectedField = null; + private FieldInfo m_infoField = null; + + #if UNITY_2020_1_OR_NEWER + private Type m_previewSettingsType = null; + object m_previewSettingsInstance; + FieldInfo previewDirInfo; + FieldInfo shadedMaterialInfo; + FieldInfo activeMaterialInfo; + #endif + + public override void OnClosed( Material material ) + { + base.OnClosed( material ); + CleanUp(); + } + + void CleanUp() + { + if( m_previewRenderUtility != null ) + { + m_previewRenderUtility.Cleanup(); + m_previewRenderUtility = null; + } + } + + void UndoRedoPerformed() + { + m_refreshOnUndo = true; + } + + ~MaterialInspector() + { + UndoUtils.UnregisterUndoRedoCallback( UndoRedoPerformed ); + CleanUp(); + } + public override void OnGUI( MaterialEditor materialEditor, MaterialProperty[] properties ) + { + IOUtils.Init(); + Material mat = materialEditor.target as Material; + + if( mat == null ) + return; + + m_instance = materialEditor; + + if( !m_initialized ) + { + Init(); + m_initialized = true; + UndoUtils.RegisterUndoRedoCallback( UndoRedoPerformed ); + } + + if( Event.current.type == EventType.Repaint && + mat.HasProperty( IOUtils.DefaultASEDirtyCheckId ) && + mat.GetInt( IOUtils.DefaultASEDirtyCheckId ) == 1 ) + { + mat.SetInt( IOUtils.DefaultASEDirtyCheckId, 0 ); + UIUtils.ForceUpdateFromMaterial(); + //Event.current.Use(); + } + + if( materialEditor.isVisible ) + { + GUILayout.BeginVertical(); + { + GUILayout.Space( 3 ); + if( GUILayout.Button( "Open in Shader Editor" ) ) + { + ASEPackageManagerHelper.SetupLateMaterial( mat ); + } + + GUILayout.BeginHorizontal(); + { + if( GUILayout.Button( CopyButtonStr ) ) + { + System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; + + Shader shader = mat.shader; + int propertyCount = UnityEditor.ShaderUtil.GetPropertyCount( shader ); + string allProperties = string.Empty; + for( int i = 0; i < propertyCount; i++ ) + { + UnityEditor.ShaderUtil.ShaderPropertyType type = UnityEditor.ShaderUtil.GetPropertyType( shader, i ); + string name = UnityEditor.ShaderUtil.GetPropertyName( shader, i ); + string valueStr = string.Empty; + switch( type ) + { + case UnityEditor.ShaderUtil.ShaderPropertyType.Color: + { + Color value = mat.GetColor( name ); + valueStr = value.r.ToString() + IOUtils.VECTOR_SEPARATOR + + value.g.ToString() + IOUtils.VECTOR_SEPARATOR + + value.b.ToString() + IOUtils.VECTOR_SEPARATOR + + value.a.ToString(); + } + break; + case UnityEditor.ShaderUtil.ShaderPropertyType.Vector: + { + Vector4 value = mat.GetVector( name ); + valueStr = value.x.ToString() + IOUtils.VECTOR_SEPARATOR + + value.y.ToString() + IOUtils.VECTOR_SEPARATOR + + value.z.ToString() + IOUtils.VECTOR_SEPARATOR + + value.w.ToString(); + } + break; + case UnityEditor.ShaderUtil.ShaderPropertyType.Float: + { + float value = mat.GetFloat( name ); + valueStr = value.ToString(); + } + break; + case UnityEditor.ShaderUtil.ShaderPropertyType.Range: + { + float value = mat.GetFloat( name ); + valueStr = value.ToString(); + } + break; + case UnityEditor.ShaderUtil.ShaderPropertyType.TexEnv: + { + Texture value = mat.GetTexture( name ); + valueStr = AssetDatabase.GetAssetPath( value ); + Vector2 offset = mat.GetTextureOffset( name ); + Vector2 scale = mat.GetTextureScale( name ); + valueStr += IOUtils.VECTOR_SEPARATOR + scale.x.ToString() + + IOUtils.VECTOR_SEPARATOR + scale.y.ToString() + + IOUtils.VECTOR_SEPARATOR + offset.x.ToString() + + IOUtils.VECTOR_SEPARATOR + offset.y.ToString(); + } + break; + } + + allProperties += name + IOUtils.FIELD_SEPARATOR + type + IOUtils.FIELD_SEPARATOR + valueStr; + + if( i < ( propertyCount - 1 ) ) + { + allProperties += IOUtils.LINE_TERMINATOR; + } + } + EditorPrefs.SetString( IOUtils.MAT_CLIPBOARD_ID, allProperties ); + System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; + } + + if( GUILayout.Button( PasteButtonStr ) ) + { + System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; + string propertiesStr = EditorPrefs.GetString( IOUtils.MAT_CLIPBOARD_ID, string.Empty ); + if( !string.IsNullOrEmpty( propertiesStr ) ) + { + string[] propertyArr = propertiesStr.Split( IOUtils.LINE_TERMINATOR ); + bool validData = true; + try + { + for( int i = 0; i < propertyArr.Length; i++ ) + { + string[] valuesArr = propertyArr[ i ].Split( IOUtils.FIELD_SEPARATOR ); + if( valuesArr.Length != 3 ) + { + Debug.LogWarning( "Material clipboard data is corrupted" ); + validData = false; + break; + } + else if( mat.HasProperty( valuesArr[ 0 ] ) ) + { + UnityEditor.ShaderUtil.ShaderPropertyType type = (UnityEditor.ShaderUtil.ShaderPropertyType)Enum.Parse( typeof( UnityEditor.ShaderUtil.ShaderPropertyType ), valuesArr[ 1 ] ); + switch( type ) + { + case UnityEditor.ShaderUtil.ShaderPropertyType.Color: + { + string[] colorVals = valuesArr[ 2 ].Split( IOUtils.VECTOR_SEPARATOR ); + if( colorVals.Length != 4 ) + { + Debug.LogWarning( "Material clipboard data is corrupted" ); + validData = false; + break; + } + else + { + mat.SetColor( valuesArr[ 0 ], new Color( Convert.ToSingle( colorVals[ 0 ] ), + Convert.ToSingle( colorVals[ 1 ] ), + Convert.ToSingle( colorVals[ 2 ] ), + Convert.ToSingle( colorVals[ 3 ] ) ) ); + } + } + break; + case UnityEditor.ShaderUtil.ShaderPropertyType.Vector: + { + string[] vectorVals = valuesArr[ 2 ].Split( IOUtils.VECTOR_SEPARATOR ); + if( vectorVals.Length != 4 ) + { + Debug.LogWarning( "Material clipboard data is corrupted" ); + validData = false; + break; + } + else + { + mat.SetVector( valuesArr[ 0 ], new Vector4( Convert.ToSingle( vectorVals[ 0 ] ), + Convert.ToSingle( vectorVals[ 1 ] ), + Convert.ToSingle( vectorVals[ 2 ] ), + Convert.ToSingle( vectorVals[ 3 ] ) ) ); + } + } + break; + case UnityEditor.ShaderUtil.ShaderPropertyType.Float: + { + mat.SetFloat( valuesArr[ 0 ], Convert.ToSingle( valuesArr[ 2 ] ) ); + } + break; + case UnityEditor.ShaderUtil.ShaderPropertyType.Range: + { + mat.SetFloat( valuesArr[ 0 ], Convert.ToSingle( valuesArr[ 2 ] ) ); + } + break; + case UnityEditor.ShaderUtil.ShaderPropertyType.TexEnv: + { + string[] texVals = valuesArr[ 2 ].Split( IOUtils.VECTOR_SEPARATOR ); + if( texVals.Length != 5 ) + { + Debug.LogWarning( "Material clipboard data is corrupted" ); + validData = false; + break; + } + else + { + mat.SetTexture( valuesArr[ 0 ], AssetDatabase.LoadAssetAtPath( texVals[ 0 ] ) ); + mat.SetTextureScale( valuesArr[ 0 ], new Vector2( Convert.ToSingle( texVals[ 1 ] ), Convert.ToSingle( texVals[ 2 ] ) ) ); + mat.SetTextureOffset( valuesArr[ 0 ], new Vector2( Convert.ToSingle( texVals[ 3 ] ), Convert.ToSingle( texVals[ 4 ] ) ) ); + } + } + break; + } + } + } + } + catch( Exception e ) + { + Debug.LogException( e ); + validData = false; + } + + + if( validData ) + { + materialEditor.PropertiesChanged(); + UIUtils.CopyValuesFromMaterial( mat ); + } + else + { + EditorPrefs.SetString( IOUtils.MAT_CLIPBOARD_ID, string.Empty ); + } + } + System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; + } + } + GUILayout.EndHorizontal(); + GUILayout.Space( 5 ); + } + GUILayout.EndVertical(); + } + EditorGUI.BeginChangeCheck(); + //base.OnGUI( materialEditor, properties ); + + // Draw custom properties instead of calling BASE to use single line texture properties + materialEditor.SetDefaultGUIWidths(); + + if( m_infoField == null ) + { + m_infoField = typeof( MaterialEditor ).GetField( "m_InfoMessage", BindingFlags.Instance | BindingFlags.NonPublic ); + } + + string info = m_infoField.GetValue( materialEditor ) as string; + if( !string.IsNullOrEmpty( info ) ) + { + EditorGUILayout.HelpBox( info, MessageType.Info ); + } + else + { + GUIUtility.GetControlID( "EditorTextField".GetHashCode(), FocusType.Passive, new Rect( 0f, 0f, 0f, 0f ) ); + } + + for( int i = 0; i < properties.Length; i++ ) + { + if( ( properties[ i ].flags & ( MaterialProperty.PropFlags.HideInInspector | MaterialProperty.PropFlags.PerRendererData ) ) == MaterialProperty.PropFlags.None ) + { + // Removed no scale offset one line texture property for consistency :( sad face + //if( ( properties[ i ].flags & MaterialProperty.PropFlags.NoScaleOffset ) == MaterialProperty.PropFlags.NoScaleOffset ) + //{ + // object obj = MaterialPropertyHandlerEx.GetHandler( mat.shader, properties[ i ].name ); + // if( obj != null ) + // { + // float height = MaterialPropertyHandlerEx.GetPropertyHeight( obj, properties[ i ], properties[ i ].displayName, materialEditor ); + // //Rect rect = (Rect)materialEditor.GetType().InvokeMember( "GetPropertyRect", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, materialEditor, new object[] { properties[ i ], properties[ i ].displayName, true } ); + // Rect rect = EditorGUILayout.GetControlRect( true, height, EditorStyles.layerMaskField ); + // MaterialPropertyHandlerEx.OnGUI( obj, ref rect, properties[ i ], new GUIContent( properties[ i ].displayName ), materialEditor ); + + // if( MaterialPropertyHandlerEx.PropertyDrawer( obj ) != null ) + // continue; + + // rect = EditorGUILayout.GetControlRect( true, height, EditorStyles.layerMaskField ); + // materialEditor.TexturePropertyMiniThumbnail( rect, properties[ i ], properties[ i ].displayName, string.Empty ); + // } + // else + // { + // materialEditor.TexturePropertySingleLine( new GUIContent( properties[ i ].displayName ), properties[ i ] ); + // } + //} + //else + //{ + float propertyHeight = materialEditor.GetPropertyHeight( properties[ i ], properties[ i ].displayName ); + Rect controlRect = EditorGUILayout.GetControlRect( true, propertyHeight, EditorStyles.layerMaskField, new GUILayoutOption[ 0 ] ); + materialEditor.ShaderProperty( controlRect, properties[ i ], properties[ i ].displayName ); + //} + } + } + + EditorGUILayout.Space(); + materialEditor.RenderQueueField(); + materialEditor.EnableInstancingField(); + materialEditor.DoubleSidedGIField(); + materialEditor.LightmapEmissionProperty(); + if( m_refreshOnUndo || EditorGUI.EndChangeCheck() ) + { + m_refreshOnUndo = false; + + string isEmissive = mat.GetTag( "IsEmissive", false, "false" ); + if( isEmissive.Equals( "true" ) ) + { + mat.globalIlluminationFlags &= (MaterialGlobalIlluminationFlags)3; + } + else + { + mat.globalIlluminationFlags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack; + } + + UIUtils.CopyValuesFromMaterial( mat ); + } + + if( materialEditor.RequiresConstantRepaint() && m_lastRenderedTime + 0.032999999821186066 < EditorApplication.timeSinceStartup ) + { + this.m_lastRenderedTime = EditorApplication.timeSinceStartup; + materialEditor.Repaint(); + } + } + + private void Init() + { + string guid = EditorPrefs.GetString( PreviewModelPref, "" ); + if( !string.IsNullOrEmpty( guid ) ) + { + m_targetMesh = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( guid ) ); + } + } + + public override void OnMaterialPreviewSettingsGUI( MaterialEditor materialEditor ) + { + + base.OnMaterialPreviewSettingsGUI( materialEditor ); + + if( UnityEditor.ShaderUtil.hardwareSupportsRectRenderTexture ) + { + EditorGUI.BeginChangeCheck(); + m_targetMesh = (Mesh)EditorGUILayout.ObjectField( m_targetMesh, typeof( Mesh ), false, GUILayout.MaxWidth( 120 ) ); + if( EditorGUI.EndChangeCheck() ) + { + if( m_targetMesh != null ) + { + EditorPrefs.SetString( PreviewModelPref, AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_targetMesh ) ) ); + } + else + { + EditorPrefs.SetString( PreviewModelPref, "" ); + } + } + + if( m_selectedField == null ) + { + m_selectedField = typeof( MaterialEditor ).GetField( "m_SelectedMesh", BindingFlags.Instance | BindingFlags.NonPublic ); + } + + if( m_previewDirDefault == null ) + { + m_previewDirDefault = typeof( MaterialEditor ).GetField( "m_PreviewDir" , BindingFlags.Instance | BindingFlags.NonPublic ); + } + + + m_selectedMesh = (int)m_selectedField.GetValue( materialEditor ); + if ( m_selectedMesh != m_prevSelectedMesh ) + { + m_prevSelectedMesh = m_selectedMesh; + if( m_targetMesh != null ) + { + m_targetMesh = null; + EditorPrefs.SetString( PreviewModelPref, "" ); + } + } + } + + if( GUILayout.Button( "R" ,GUILayout.MaxWidth(17), GUILayout.MaxHeight( 13 ) ) ) + { + m_previewDir = new Vector2( 0 , 0 ); + if( m_previewDirDefault != null ) + m_previewDirDefault.SetValue( materialEditor , m_previewDir ); + } + } + + public override void OnMaterialInteractivePreviewGUI( MaterialEditor materialEditor, Rect r, GUIStyle background ) + { + if( Event.current.type == EventType.DragExited ) + { + if( DragAndDrop.objectReferences.Length > 0 ) + { + GameObject dropped = DragAndDrop.objectReferences[ 0 ] as GameObject; + if( dropped != null ) + { + m_targetMesh = AssetDatabase.LoadAssetAtPath( AssetDatabase.GetAssetPath( dropped ) ); + EditorPrefs.SetString( PreviewModelPref, AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_targetMesh ) ) ); + } + } + } + + if( m_targetMesh == null ) + { + base.OnMaterialInteractivePreviewGUI( materialEditor, r, background ); + return; + } + + Material mat = materialEditor.target as Material; + + if( m_previewRenderUtility == null ) + { + m_previewRenderUtility = new PreviewRenderUtility(); + m_previewRenderUtility.cameraFieldOfView = 30f; + } + + if( m_previewGUIType == null ) + { + m_previewGUIType = Type.GetType( "PreviewGUI, UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" ); + m_dragMethod = m_previewGUIType.GetMethod( "Drag2D", BindingFlags.Static | BindingFlags.Public ); + } + + m_previewDir = ( Vector2 )m_dragMethod.Invoke( m_previewGUIType, new object[] { m_previewDir, r } ); + + if ( m_modelInspectorType == null ) + { + m_modelInspectorType = Type.GetType( "UnityEditor.MeshPreview, UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" ); + if ( m_modelInspectorType == null ) + { + m_modelInspectorType = Type.GetType( "UnityEditor.ModelInspector, UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" ); + } + m_renderMeshMethod = m_modelInspectorType.GetMethod( "RenderMeshPreview", BindingFlags.Static | BindingFlags.NonPublic ); + } + + #if UNITY_2020_1_OR_NEWER + + m_previewDir = ( Vector2 )m_dragMethod.Invoke( m_previewGUIType, new object[] { m_previewDir, r } ); + + if ( m_previewSettingsType == null ) + { + m_previewSettingsType = m_modelInspectorType.GetNestedType( "PreviewSettings", BindingFlags.NonPublic ); + if ( m_previewSettingsType == null ) + { + m_previewSettingsType = m_modelInspectorType.GetNestedType( "Settings", BindingFlags.NonPublic ); + } + } + + if ( m_previewSettingsInstance == null ) + { + m_previewSettingsInstance = Activator.CreateInstance( m_previewSettingsType ); + } + + if ( shadedMaterialInfo == null || activeMaterialInfo == null || previewDirInfo == null ) + { + shadedMaterialInfo = m_previewSettingsType.GetField( "shadedPreviewMaterial", BindingFlags.Instance | BindingFlags.Public ); + activeMaterialInfo = m_previewSettingsType.GetField( "activeMaterial", BindingFlags.Instance | BindingFlags.Public ); + previewDirInfo = m_previewSettingsType.GetField( "previewDir", BindingFlags.Instance | BindingFlags.Public ); + } + + if ( shadedMaterialInfo == null || activeMaterialInfo == null || previewDirInfo == null ) + { + shadedMaterialInfo = m_previewSettingsType.GetField( "m_ShadedPreviewMaterial", BindingFlags.Instance | BindingFlags.NonPublic ); + activeMaterialInfo = m_previewSettingsType.GetField( "m_ActiveMaterial", BindingFlags.Instance | BindingFlags.NonPublic ); + previewDirInfo = m_previewSettingsType.GetField( "m_PreviewDir", BindingFlags.Instance | BindingFlags.NonPublic ); + } + + shadedMaterialInfo.SetValue( m_previewSettingsInstance, mat ); + activeMaterialInfo.SetValue( m_previewSettingsInstance, mat ); + previewDirInfo.SetValue( m_previewSettingsInstance, m_previewDir ); + + if ( Event.current.type == EventType.Repaint ) + { + m_previewRenderUtility.BeginPreview( r, background ); + m_renderMeshMethod.Invoke( m_modelInspectorType, new object[] { m_targetMesh, m_previewRenderUtility, m_previewSettingsInstance, -1 } ); + m_previewRenderUtility.EndAndDrawPreview( r ); + } + + #else + + if( Event.current.type == EventType.Repaint ) + { + m_previewRenderUtility.BeginPreview( r, background ); + m_renderMeshMethod.Invoke( m_modelInspectorType, new object[] { m_targetMesh, m_previewRenderUtility, mat, null, m_previewDir, -1 } ); + m_previewRenderUtility.EndAndDrawPreview( r ); + } + + #endif + } + + public static MaterialEditor Instance { get { return m_instance; } set { m_instance = value; } } + } +} \ No newline at end of file diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs.meta new file mode 100644 index 00000000..fcbec57e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a1c012872b428594f95e585bd19e5347 +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs new file mode 100644 index 00000000..2025ef6c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs @@ -0,0 +1,953 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Reflection; +using System.Globalization; +using UnityEngine; +using UnityEditor; +using AmplifyShaderEditor; + +namespace AmplifyShaderEditor +{ + [CustomEditor( typeof( Shader ) )] + internal class CustomShaderInspector : Editor + { + internal class Styles + { + public static Texture2D errorIcon = EditorGUIUtilityEx.LoadIcon( "console.erroricon.sml" ); + + public static Texture2D warningIcon = EditorGUIUtilityEx.LoadIcon( "console.warnicon.sml" ); + #if UNITY_2020_1_OR_NEWER + public static GUIContent togglePreprocess = EditorGUIUtilityEx.TextContent( "Preprocess only|Show preprocessor output instead of compiled shader code" ); + #if UNITY_2020_2_OR_NEWER + public static GUIContent toggleStripLineDirective = EditorGUIUtility.TrTextContent( "Strip #line directives", "Strip #line directives from preprocessor output" ); + #endif + #endif + public static GUIContent showSurface = EditorGUIUtilityEx.TextContent( "Show generated code|Show generated code of a surface shader" ); + + public static GUIContent showFF = EditorGUIUtilityEx.TextContent( "Show generated code|Show generated code of a fixed function shader" ); + + public static GUIContent showCurrent = new GUIContent( "Compile and show code | ▾" ); + + public static GUIStyle messageStyle = "CN StatusInfo"; + + public static GUIStyle evenBackground = "CN EntryBackEven"; + + public static GUIContent no = EditorGUIUtilityEx.TextContent( "no" ); + + public static GUIContent builtinShader = EditorGUIUtilityEx.TextContent( "Built-in shader" ); + + public static GUIContent arrayValuePopupButton = EditorGUIUtilityEx.TextContent( "..." ); + } +#if UNITY_2020_1_OR_NEWER + private static bool s_PreprocessOnly = false; +#if UNITY_2020_2_OR_NEWER + private static bool s_StripLineDirectives = true; +#endif +#endif + private const float kSpace = 5f; + + const float kValueFieldWidth = 200.0f; + const float kArrayValuePopupBtnWidth = 25.0f; + + private static readonly string[] kPropertyTypes = new string[] + { + "Color: ", + "Vector: ", + "Float: ", + "Range: ", + "Texture: " + }; + + private static readonly string[] kTextureTypes = new string[] + { + "No Texture?: ", + "1D?: ", + "2D: ", + "3D: ", + "Cube: ", + "2DArray: ", + "Any texture: " + }; + + private static readonly int kErrorViewHash = "ShaderErrorView".GetHashCode(); + + private Vector2 m_ScrollPosition = Vector2.zero; + + private PreviewRenderUtility m_previewRenderUtility; + private Material m_material; + private Mesh m_previewMesh; + private Vector2 m_mouseDelta; + private Transform m_cameraTransform; + private bool m_allowOpenInCanvas = true; + + private static int m_sliderHashCode = -1; + private const float MaxDeltaY = 90; + private const int DefaultMouseSpeed = 1; + private const int ShiftMouseSpeed = 3; + private const float DeltaMultiplier = 135f; + private void ValidateData() + { + if ( m_previewRenderUtility == null ) + { + m_previewRenderUtility = new PreviewRenderUtility(); + m_cameraTransform = m_previewRenderUtility.camera.transform; + m_cameraTransform.position = new Vector3( 0, 0, -4 ); + m_cameraTransform.rotation = Quaternion.identity; + } + + if ( m_material == null ) + { + m_material = new Material( target as Shader ); + m_material.hideFlags = HideFlags.DontSave; + } + + if ( m_previewMesh == null ) + { + m_previewMesh = Resources.GetBuiltinResource( "Sphere.fbx" ); + } + + if ( m_sliderHashCode < 0 ) + { + "Slider".GetHashCode(); + } + } + + public override bool HasPreviewGUI() + { + ValidateData(); + return true; + } + + public static Vector2 CheckMouseMovement( Vector2 scrollPosition, Rect position ) + { + int controlID = GUIUtility.GetControlID( m_sliderHashCode, FocusType.Passive ); + Event current = Event.current; + switch ( current.GetTypeForControl( controlID ) ) + { + case EventType.MouseDown: + { + if ( position.Contains( current.mousePosition ) && position.width > 50f ) + { + GUIUtility.hotControl = controlID; + current.Use(); + EditorGUIUtility.SetWantsMouseJumping( 1 ); + } + } + break; + case EventType.MouseUp: + { + if ( GUIUtility.hotControl == controlID ) + { + GUIUtility.hotControl = 0; + } + EditorGUIUtility.SetWantsMouseJumping( 0 ); + } + break; + case EventType.MouseDrag: + { + if ( GUIUtility.hotControl == controlID ) + { + scrollPosition -= DeltaMultiplier * current.delta * ( float ) ( ( current.shift ) ? ShiftMouseSpeed : DefaultMouseSpeed ) / Mathf.Min( position.width, position.height ); + scrollPosition.y = Mathf.Clamp( scrollPosition.y, -MaxDeltaY, MaxDeltaY ); + current.Use(); + } + } + break; + } + return scrollPosition; + } + + public override void OnPreviewGUI( Rect r, GUIStyle background ) + { + m_mouseDelta = CheckMouseMovement( m_mouseDelta, r ); + + if ( Event.current.type == EventType.Repaint ) + { + m_previewRenderUtility.BeginPreview( r, background ); + + Texture resultRender = m_previewRenderUtility.EndPreview(); + m_previewRenderUtility.DrawMesh( m_previewMesh, Matrix4x4.identity, m_material, 0 ); + m_cameraTransform.rotation = Quaternion.Euler( new Vector3( -m_mouseDelta.y, -m_mouseDelta.x, 0 ) ); + m_cameraTransform.position = m_cameraTransform.forward * -8f; + m_previewRenderUtility.camera.Render(); + GUI.DrawTexture( r, resultRender, ScaleMode.StretchToFill, false ); + } + } + + void OnDestroy() + { + CleanUp(); + } + + public void OnDisable() + { + CleanUp(); + if( m_SrpCompatibilityCheckMaterial != null ) + { + GameObject.DestroyImmediate( m_SrpCompatibilityCheckMaterial ); + } + } + + void CleanUp() + { + if( m_previewRenderUtility != null ) + { + m_previewRenderUtility.Cleanup(); + m_previewRenderUtility = null; + } + + if( m_previewMesh != null ) + { + Resources.UnloadAsset( m_previewMesh ); + m_previewMesh = null; + } + + if( m_previewRenderUtility != null ) + { + m_previewRenderUtility.Cleanup(); + m_previewRenderUtility = null; + } + m_material = null; + } + + private Material m_SrpCompatibilityCheckMaterial = null; + public Material srpCompatibilityCheckMaterial + { + get + { + if( m_SrpCompatibilityCheckMaterial == null ) + { + m_SrpCompatibilityCheckMaterial = new Material( target as Shader ); + } + return m_SrpCompatibilityCheckMaterial; + } + } + + public virtual void OnEnable() + { + Shader s = this.target as Shader; + if( s!= null ) + ShaderUtilEx.FetchCachedErrors( s ); + + m_allowOpenInCanvas = IOUtils.IsASEShader( s ); + } + + private static string GetPropertyType( Shader s, int index ) + { + UnityEditor.ShaderUtil.ShaderPropertyType propertyType = UnityEditor.ShaderUtil.GetPropertyType( s, index ); + if ( propertyType == UnityEditor.ShaderUtil.ShaderPropertyType.TexEnv ) + { + return CustomShaderInspector.kTextureTypes[ ( int ) UnityEditor.ShaderUtil.GetTexDim( s, index ) ]; + } + return CustomShaderInspector.kPropertyTypes[ ( int ) propertyType ]; + } + + public override void OnInspectorGUI() + { + Shader shader = this.target as Shader; + if ( shader == null ) + { + return; + } + + GUI.enabled = true; + + GUILayout.Space( 3 ); + GUILayout.BeginHorizontal(); + { + GUI.enabled = m_allowOpenInCanvas; + if ( GUILayout.Button( "Open in Shader Editor" ) ) + { + ASEPackageManagerHelper.SetupLateShader( shader ); + } + GUI.enabled = true; + + if ( GUILayout.Button( "Open in Text Editor" ) ) + { + if( UIUtils.IsUnityNativeShader( shader ) ) + { + Debug.LogWarningFormat( "Action not allowed. Attempting to load the native {0} shader into Text Editor", shader.name ); + } + else + { + AssetDatabase.OpenAsset( shader, 1 ); + } + } + } + GUILayout.EndHorizontal(); + + GUILayout.Space( 5 ); + EditorGUI.indentLevel = 0; + this.ShowShaderCodeArea( shader ); + if ( shader.isSupported ) + { + EditorGUILayout.LabelField( "Cast shadows", ( !ShaderUtilEx.HasShadowCasterPass( shader ) ) ? "no" : "yes", new GUILayoutOption[ 0 ] ); + EditorGUILayout.LabelField( "Render queue", ShaderUtilEx.GetRenderQueue( shader ).ToString( System.Globalization.CultureInfo.InvariantCulture ), new GUILayoutOption[ 0 ] ); + EditorGUILayout.LabelField( "LOD", ShaderUtilEx.GetLOD( shader ).ToString( System.Globalization.CultureInfo.InvariantCulture ), new GUILayoutOption[ 0 ] ); + EditorGUILayout.LabelField( "Ignore projector", ( !ShaderUtilEx.DoesIgnoreProjector( shader ) ) ? "no" : "yes", new GUILayoutOption[ 0 ] ); + string label; + switch ( ShaderEx.GetDisableBatching( shader ) ) + { + case DisableBatchingType.False: + label = "no"; + break; + case DisableBatchingType.True: + label = "yes"; + break; + case DisableBatchingType.WhenLODFading: + label = "when LOD fading is on"; + break; + default: + label = "unknown"; + break; + } + EditorGUILayout.LabelField( "Disable batching", label, new GUILayoutOption[ 0 ] ); + ShowKeywords( shader ); + srpCompatibilityCheckMaterial.SetPass( 0 ); + + int shaderActiveSubshaderIndex = ShaderUtilEx.GetShaderActiveSubshaderIndex( shader ); + int sRPBatcherCompatibilityCode = ShaderUtilEx.GetSRPBatcherCompatibilityCode( shader, shaderActiveSubshaderIndex ); + string label2 = ( sRPBatcherCompatibilityCode != 0 ) ? "not compatible" : "compatible"; + EditorGUILayout.LabelField( "SRP Batcher", label2 ); + if( sRPBatcherCompatibilityCode != 0 ) + { + EditorGUILayout.HelpBox( ShaderUtilEx.GetSRPBatcherCompatibilityIssueReason( shader, shaderActiveSubshaderIndex, sRPBatcherCompatibilityCode ), MessageType.Info ); + } + + CustomShaderInspector.ShowShaderProperties( shader ); + } + } + + private void ShowKeywords( Shader s ) + { + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel( "Keywords", EditorStyles.miniButton ); + + Rect buttonRect = GUILayoutUtility.GetRect( Styles.arrayValuePopupButton, GUI.skin.button, GUILayout.MinWidth( kValueFieldWidth ) ); + buttonRect.width = kArrayValuePopupBtnWidth; + if( GUI.Button( buttonRect, Styles.arrayValuePopupButton, EditorStyles.miniButton ) ) + { + var globalKeywords = ShaderUtilEx.GetShaderGlobalKeywords( s ); + var localKeywords = ShaderUtilEx.GetShaderLocalKeywords( s ); + PopupWindow.Show( buttonRect, new KeywordsPopup( globalKeywords, localKeywords, 150.0f ) ); + } + + EditorGUILayout.EndHorizontal(); + } + + private void ShowShaderCodeArea( Shader s ) + { + CustomShaderInspector.ShowSurfaceShaderButton( s ); + CustomShaderInspector.ShowFixedFunctionShaderButton( s ); + this.ShowCompiledCodeButton( s ); + this.ShowShaderErrors( s ); + } + + private static void ShowShaderProperties( Shader s ) + { + GUILayout.Space( 5f ); + GUILayout.Label( "Properties:", EditorStyles.boldLabel, new GUILayoutOption[ 0 ] ); + int propertyCount = UnityEditor.ShaderUtil.GetPropertyCount( s ); + for ( int i = 0; i < propertyCount; i++ ) + { + string propertyName = UnityEditor.ShaderUtil.GetPropertyName( s, i ); + string label = CustomShaderInspector.GetPropertyType( s, i ) + UnityEditor.ShaderUtil.GetPropertyDescription( s, i ); + EditorGUILayout.LabelField( propertyName, label, new GUILayoutOption[ 0 ] ); + } + } + + internal static void ShaderErrorListUI( UnityEngine.Object shader, ShaderError[] errors, ref Vector2 scrollPosition ) + { + int num = errors.Length; + GUILayout.Space( 5f ); + GUILayout.Label( string.Format( "Errors ({0}):", num ), EditorStyles.boldLabel, new GUILayoutOption[ 0 ] ); + int controlID = GUIUtility.GetControlID( CustomShaderInspector.kErrorViewHash, FocusType.Passive ); + float minHeight = Mathf.Min( ( float ) num * 20f + 40f, 150f ); + scrollPosition = GUILayout.BeginScrollView( scrollPosition, GUISkinEx.GetCurrentSkin().box, new GUILayoutOption[] + { + GUILayout.MinHeight(minHeight) + } ); + EditorGUIUtility.SetIconSize( new Vector2( 16f, 16f ) ); + float height = CustomShaderInspector.Styles.messageStyle.CalcHeight( EditorGUIUtilityEx.TempContent( CustomShaderInspector.Styles.errorIcon ), 100f ); + Event current = Event.current; + for ( int i = 0; i < num; i++ ) + { + Rect controlRect = EditorGUILayout.GetControlRect( false, height, new GUILayoutOption[ 0 ] ); + string message = errors[ i ].message; + string platform = errors[ i ].platform; + bool flag = errors[ i ].warning != 0; + string lastPathNameComponent = FileUtilEx.GetLastPathNameComponent( errors[ i ].file ); + int line = errors[ i ].line; + if ( current.type == EventType.MouseDown && current.button == 0 && controlRect.Contains( current.mousePosition ) ) + { + GUIUtility.keyboardControl = controlID; + if ( current.clickCount == 2 ) + { + string file = errors[ i ].file; + UnityEngine.Object @object = ( !string.IsNullOrEmpty( file ) ) ? AssetDatabase.LoadMainAssetAtPath( file ) : null; + AssetDatabase.OpenAsset( @object ?? shader, line ); + GUIUtility.ExitGUI(); + } + current.Use(); + } + if ( current.type == EventType.ContextClick && controlRect.Contains( current.mousePosition ) ) + { + current.Use(); + GenericMenu genericMenu = new GenericMenu(); + int errorIndex = i; + genericMenu.AddItem( new GUIContent( "Copy error text" ), false, delegate + { + string text = errors[ errorIndex ].message; + if ( !string.IsNullOrEmpty( errors[ errorIndex ].messageDetails ) ) + { + text += '\n'; + text += errors[ errorIndex ].messageDetails; + } + EditorGUIUtility.systemCopyBuffer = text; + } ); + genericMenu.ShowAsContext(); + } + if ( current.type == EventType.Repaint && ( i & 1 ) == 0 ) + { + GUIStyle evenBackground = CustomShaderInspector.Styles.evenBackground; + evenBackground.Draw( controlRect, false, false, false, false ); + } + Rect rect = controlRect; + rect.xMin = rect.xMax; + if ( line > 0 ) + { + GUIContent content; + if ( string.IsNullOrEmpty( lastPathNameComponent ) ) + { + content = EditorGUIUtilityEx.TempContent( line.ToString( System.Globalization.CultureInfo.InvariantCulture ) ); + } + else + { + content = EditorGUIUtilityEx.TempContent( lastPathNameComponent + ":" + line.ToString( System.Globalization.CultureInfo.InvariantCulture ) ); + } + Vector2 vector = EditorStyles.miniLabel.CalcSize( content ); + rect.xMin -= vector.x; + GUI.Label( rect, content, EditorStyles.miniLabel ); + rect.xMin -= 2f; + if ( rect.width < 30f ) + { + rect.xMin = rect.xMax - 30f; + } + } + Rect position = rect; + position.width = 0f; + if ( platform.Length > 0 ) + { + GUIContent content2 = EditorGUIUtilityEx.TempContent( platform ); + Vector2 vector2 = EditorStyles.miniLabel.CalcSize( content2 ); + position.xMin -= vector2.x; + Color contentColor = GUI.contentColor; + GUI.contentColor = new Color( 1f, 1f, 1f, 0.5f ); + GUI.Label( position, content2, EditorStyles.miniLabel ); + GUI.contentColor = contentColor; + position.xMin -= 2f; + } + Rect position2 = controlRect; + position2.xMax = position.xMin; + GUI.Label( position2, EditorGUIUtilityEx.TempContent( message, ( !flag ) ? CustomShaderInspector.Styles.errorIcon : CustomShaderInspector.Styles.warningIcon ), CustomShaderInspector.Styles.messageStyle ); + } + EditorGUIUtility.SetIconSize( Vector2.zero ); + GUILayout.EndScrollView(); + } + + ShaderMessage[] m_ShaderMessages; + + private void ShowShaderErrors( Shader s ) + { + if( Event.current.type == EventType.Layout ) + { + int n = ShaderUtil.GetShaderMessageCount( s ); + m_ShaderMessages = null; + if( n >= 1 ) + { + m_ShaderMessages = ShaderUtil.GetShaderMessages( s ); + } + } + + if( m_ShaderMessages == null ) + return; + + ShaderInspectorEx.ShaderErrorListUI( s, m_ShaderMessages, ref this.m_ScrollPosition ); + } + + private void ShowCompiledCodeButton( Shader s ) + { +#if UNITY_2020_1_OR_NEWER + using( new EditorGUI.DisabledScope( !EditorSettings.cachingShaderPreprocessor ) ) + { + s_PreprocessOnly = EditorGUILayout.Toggle( Styles.togglePreprocess, s_PreprocessOnly ); +#if UNITY_2020_2_OR_NEWER + if( s_PreprocessOnly ) + { + s_StripLineDirectives = EditorGUILayout.Toggle( Styles.toggleStripLineDirective, s_StripLineDirectives ); + } +#endif + } +#endif + EditorGUILayout.BeginHorizontal( new GUILayoutOption[ 0 ] ); + EditorGUILayout.PrefixLabel( "Compiled code", EditorStyles.miniButton ); + + bool hasCode = ShaderUtilEx.HasShaderSnippets( s ) || ShaderUtilEx.HasSurfaceShaders( s ) || ShaderUtilEx.HasFixedFunctionShaders( s ); + if( hasCode ) + { + GUIContent showCurrent = Styles.showCurrent; + Rect rect = GUILayoutUtility.GetRect( showCurrent, EditorStyles.miniButton, new GUILayoutOption[] + { + GUILayout.ExpandWidth(false) + } ); + Rect position = new Rect( rect.xMax - 16f, rect.y, 16f, rect.height ); + if( EditorGUIEx.ButtonMouseDown( position, GUIContent.none, FocusType.Passive, GUIStyle.none ) ) + { + Rect last = GUILayoutUtilityEx.TopLevel_GetLast(); + PopupWindow.Show( last, (PopupWindowContent)Activator.CreateInstance( System.Type.GetType( "UnityEditor.ShaderInspectorPlatformsPopup, UnityEditor" ), new object[] { s } ) ); + GUIUtility.ExitGUI(); + } + if( GUI.Button( rect, showCurrent, EditorStyles.miniButton ) ) + { +#if UNITY_2020_1 + ShaderUtilEx.OpenCompiledShader( s, ShaderInspectorPlatformsPopupEx.GetCurrentMode(), ShaderInspectorPlatformsPopupEx.GetCurrentPlatformMask(), ShaderInspectorPlatformsPopupEx.GetCurrentVariantStripping() == 0, s_PreprocessOnly ); +#elif UNITY_2020_2_OR_NEWER + ShaderUtilEx.OpenCompiledShader( s, ShaderInspectorPlatformsPopupEx.GetCurrentMode(), ShaderInspectorPlatformsPopupEx.GetCurrentPlatformMask(), ShaderInspectorPlatformsPopupEx.GetCurrentVariantStripping() == 0, s_PreprocessOnly, s_StripLineDirectives ); +#else + ShaderUtilEx.OpenCompiledShader( s, ShaderInspectorPlatformsPopupEx.GetCurrentMode(), ShaderInspectorPlatformsPopupEx.GetCurrentPlatformMask(), ShaderInspectorPlatformsPopupEx.GetCurrentVariantStripping() == 0 ); +#endif + GUIUtility.ExitGUI(); + } + } + else + { + GUILayout.Button( "none (precompiled shader)", GUI.skin.label, new GUILayoutOption[ 0 ] ); + } + EditorGUILayout.EndHorizontal(); + } + + private static void ShowSurfaceShaderButton( Shader s ) + { + bool flag = ShaderUtilEx.HasSurfaceShaders( s ); + EditorGUILayout.BeginHorizontal( new GUILayoutOption[ 0 ] ); + EditorGUILayout.PrefixLabel( "Surface shader", EditorStyles.miniButton ); + if ( flag ) + { + if ( !( AssetImporter.GetAtPath( AssetDatabase.GetAssetPath( s ) ) == null ) ) + { + if ( GUILayout.Button( CustomShaderInspector.Styles.showSurface, EditorStyles.miniButton, new GUILayoutOption[] + { + GUILayout.ExpandWidth(false) + } ) ) + { + ShaderUtilEx.OpenParsedSurfaceShader( s ); + GUIUtility.ExitGUI(); + } + } + else + { + GUILayout.Button( CustomShaderInspector.Styles.builtinShader, GUI.skin.label, new GUILayoutOption[ 0 ] ); + } + } + else + { + GUILayout.Button( CustomShaderInspector.Styles.no, GUI.skin.label, new GUILayoutOption[ 0 ] ); + } + EditorGUILayout.EndHorizontal(); + } + + private static void ShowFixedFunctionShaderButton( Shader s ) + { + bool flag = ShaderUtilEx.HasFixedFunctionShaders( s ); + EditorGUILayout.BeginHorizontal( new GUILayoutOption[ 0 ] ); + EditorGUILayout.PrefixLabel( "Fixed function", EditorStyles.miniButton ); + if ( flag ) + { + if ( !( AssetImporter.GetAtPath( AssetDatabase.GetAssetPath( s ) ) == null ) ) + { + if ( GUILayout.Button( CustomShaderInspector.Styles.showFF, EditorStyles.miniButton, new GUILayoutOption[] + { + GUILayout.ExpandWidth(false) + } ) ) + { + ShaderUtilEx.OpenGeneratedFixedFunctionShader( s ); + GUIUtility.ExitGUI(); + } + } + else + { + GUILayout.Button( CustomShaderInspector.Styles.builtinShader, GUI.skin.label, new GUILayoutOption[ 0 ] ); + } + } + else + { + GUILayout.Button( CustomShaderInspector.Styles.no, GUI.skin.label, new GUILayoutOption[ 0 ] ); + } + EditorGUILayout.EndHorizontal(); + } + } + + internal class KeywordsPopup : PopupWindowContent + { + private Vector2 m_ScrollPos = Vector2.zero; + private string[] m_GlobalKeywords; + private string[] m_LocalKeywords; + private bool m_GlobalKeywordsExpended; + private bool m_LocalKeywordsExpended; + private float m_WindowWidth; + + private static readonly GUIStyle m_Style = EditorStyles.miniLabel; + + public KeywordsPopup( string[] globalKeywords, string[] localKeywords, float windowWidth ) + { + m_GlobalKeywords = globalKeywords; + m_LocalKeywords = localKeywords; + m_GlobalKeywordsExpended = true; + m_LocalKeywordsExpended = true; + m_WindowWidth = windowWidth; + } + + public override Vector2 GetWindowSize() + { + var numValues = m_GlobalKeywords.Length + m_LocalKeywords.Length + 2; + var lineHeight = m_Style.lineHeight + m_Style.padding.vertical + m_Style.margin.top; + return new Vector2( m_WindowWidth, Math.Min( lineHeight * numValues, 250.0f ) ); + } + + public override void OnGUI( Rect rect ) + { + m_ScrollPos = EditorGUILayout.BeginScrollView( m_ScrollPos ); + + m_GlobalKeywordsExpended = KeywordsFoldout( m_GlobalKeywordsExpended, "Global Keywords", m_GlobalKeywords ); + m_LocalKeywordsExpended = KeywordsFoldout( m_LocalKeywordsExpended, "Local Keywords", m_LocalKeywords ); + + EditorGUILayout.EndScrollView(); + } + + private bool KeywordsFoldout( bool expended, string name, string[] values ) + { + expended = EditorGUILayout.Foldout( expended, name, true, m_Style ); + + if( expended ) + { + EditorGUI.indentLevel++; + for( int i = 0; i < values.Length; ++i ) + { + EditorGUILayout.LabelField( values[ i ], m_Style ); + } + EditorGUI.indentLevel--; + } + + return expended; + } + } + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // UNITY EDITOR EXTENSIONS + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + public enum DisableBatchingType + { + False, + True, + WhenLODFading + } + + public struct ShaderError + { + public string message; + public string messageDetails; + public string platform; + public string file; + public int line; + public int warning; + } + + public static class EditorGUIUtilityEx + { + private static System.Type type = null; + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.EditorGUIUtility, UnityEditor" ) : type; } } + + public static Texture2D LoadIcon( string icon ) + { + return ( Texture2D ) EditorGUIUtilityEx.Type.InvokeMember( "LoadIcon", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { icon } ); + } + + public static GUIContent TextContent( string t ) + { + return ( GUIContent ) EditorGUIUtilityEx.Type.InvokeMember( "TextContent", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { t } ); + } + + internal static GUIContent TempContent( string t ) + { + return ( GUIContent ) EditorGUIUtilityEx.Type.InvokeMember( "TempContent", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { t } ); + } + + internal static GUIContent TempContent( Texture i ) + { + return ( GUIContent ) EditorGUIUtilityEx.Type.InvokeMember( "TempContent", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { i } ); + } + + internal static GUIContent TempContent( string t, Texture i ) + { + return ( GUIContent ) EditorGUIUtilityEx.Type.InvokeMember( "TempContent", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { t, i } ); + } + } + + public static class GUILayoutUtilityEx + { + private static System.Type type = null; + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.GUILayoutUtility, UnityEngine" ) : type; } } + + public static Rect TopLevel_GetLast() + { + System.Type guiLayoutGroup = System.Type.GetType( "UnityEngine.GUILayoutGroup, UnityEngine" ); + var topLevel = GUILayoutUtilityEx.Type.GetProperty( "topLevel", BindingFlags.NonPublic | BindingFlags.Static ).GetValue( null, null ); + return ( Rect ) guiLayoutGroup.InvokeMember( "GetLast", BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod, null, topLevel, new object[] { } ); + } + } + + public static class ShaderEx + { + private static System.Type type = null; + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.Shader, UnityEngine" ) : type; } } + + public static DisableBatchingType GetDisableBatching( Shader s ) + { + return ( DisableBatchingType ) ShaderEx.Type.GetProperty( "disableBatching", BindingFlags.NonPublic | BindingFlags.Instance ).GetValue( s, new object[ 0 ] ); + } + } + + public static class ShaderUtilEx + { + private static System.Type type = null; + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.ShaderUtil, UnityEditor" ) : type; } } + + public static void OpenParsedSurfaceShader( Shader s ) + { + ShaderUtilEx.Type.InvokeMember( "OpenParsedSurfaceShader", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); + } + + public static void OpenGeneratedFixedFunctionShader( Shader s ) + { + ShaderUtilEx.Type.InvokeMember( "OpenGeneratedFixedFunctionShader", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); + } + +#if UNITY_2020_1 + public static void OpenCompiledShader( Shader shader, int mode, int customPlatformsMask, bool includeAllVariants, bool preprocessOnly ) + { + ShaderUtilEx.Type.InvokeMember( "OpenCompiledShader", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { shader, mode, customPlatformsMask, includeAllVariants, preprocessOnly } ); + } +#elif UNITY_2020_2_OR_NEWER + public static void OpenCompiledShader( Shader shader, int mode, int customPlatformsMask, bool includeAllVariants, bool preprocessOnly, bool stripLineDirectives ) + { + ShaderUtilEx.Type.InvokeMember( "OpenCompiledShader", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { shader, mode, customPlatformsMask, includeAllVariants, preprocessOnly, stripLineDirectives } ); + } +#else + public static void OpenCompiledShader( Shader shader, int mode, int customPlatformsMask, bool includeAllVariants ) + { + ShaderUtilEx.Type.InvokeMember( "OpenCompiledShader", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { shader, mode, customPlatformsMask, includeAllVariants } ); + } +#endif + public static void FetchCachedErrors( Shader s ) + { + ShaderUtilEx.Type.InvokeMember( "FetchCachedMessages", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); + } + + public static string[] GetShaderGlobalKeywords( Shader s ) + { + return ShaderUtilEx.Type.InvokeMember( "GetShaderGlobalKeywords", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ) as string[]; + } + + public static string[] GetShaderLocalKeywords( Shader s ) + { + return ShaderUtilEx.Type.InvokeMember( "GetShaderLocalKeywords", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ) as string[]; + } + + public static int GetShaderErrorCount( Shader s ) + { + return ShaderUtil.GetShaderMessageCount( s ); + } + + public static int GetAvailableShaderCompilerPlatforms() + { + return (int)ShaderUtilEx.Type.InvokeMember( "GetAvailableShaderCompilerPlatforms", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { } ); + } + + public static ShaderError[] GetShaderErrors( Shader s ) + { + System.Type shaderErrorType = System.Type.GetType( "UnityEditor.ShaderError, UnityEditor" ); + var errorList = ( System.Collections.IList ) ShaderUtilEx.Type.InvokeMember( "GetShaderErrors", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); + + FieldInfo messageField = shaderErrorType.GetField( "message", BindingFlags.Public | BindingFlags.Instance ); + FieldInfo messageDetailsField = shaderErrorType.GetField( "messageDetails", BindingFlags.Public | BindingFlags.Instance ); + FieldInfo platformField = shaderErrorType.GetField( "platform", BindingFlags.Public | BindingFlags.Instance ); + FieldInfo fileField = shaderErrorType.GetField( "file", BindingFlags.Public | BindingFlags.Instance ); + FieldInfo lineField = shaderErrorType.GetField( "line", BindingFlags.Public | BindingFlags.Instance ); + FieldInfo warningField = shaderErrorType.GetField( "warning", BindingFlags.Public | BindingFlags.Instance ); + + ShaderError[] errors = new ShaderError[ errorList.Count ]; + for ( int i = 0; i < errorList.Count; i++ ) + { + errors[ i ].message = ( string ) messageField.GetValue( errorList[ i ] ); + errors[ i ].messageDetails = ( string ) messageDetailsField.GetValue( errorList[ i ] ); + errors[ i ].platform = ( string ) platformField.GetValue( errorList[ i ] ); + errors[ i ].file = ( string ) fileField.GetValue( errorList[ i ] ); + errors[ i ].line = ( int ) lineField.GetValue( errorList[ i ] ); + errors[ i ].warning = ( int ) warningField.GetValue( errorList[ i ] ); + } + return errors; + } + + public static bool HasShaderSnippets( Shader s ) + { + return ( bool ) ShaderUtilEx.Type.InvokeMember( "HasShaderSnippets", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); + } + + public static bool HasSurfaceShaders( Shader s ) + { + return ( bool ) ShaderUtilEx.Type.InvokeMember( "HasSurfaceShaders", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); + } + + public static bool HasFixedFunctionShaders( Shader s ) + { + return ( bool ) ShaderUtilEx.Type.InvokeMember( "HasFixedFunctionShaders", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); + } + + public static bool HasShadowCasterPass( Shader s ) + { + return ( bool ) ShaderUtilEx.Type.InvokeMember( "HasShadowCasterPass", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); + } + + public static int GetRenderQueue( Shader s ) + { + return ( int ) ShaderUtilEx.Type.InvokeMember( "GetRenderQueue", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); + } + + public static int GetLOD( Shader s ) + { + return ( int ) ShaderUtilEx.Type.InvokeMember( "GetLOD", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); + } + + public static bool DoesIgnoreProjector( Shader s ) + { + return ( bool ) ShaderUtilEx.Type.InvokeMember( "DoesIgnoreProjector", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); + } + + public static int GetShaderActiveSubshaderIndex( Shader s ) + { + return (int)ShaderUtilEx.Type.InvokeMember( "GetShaderActiveSubshaderIndex", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); + } + + public static int GetSRPBatcherCompatibilityCode( Shader s, int subShaderIdx ) + { + return (int)ShaderUtilEx.Type.InvokeMember( "GetSRPBatcherCompatibilityCode", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s, subShaderIdx } ); + } + + public static string GetSRPBatcherCompatibilityIssueReason( Shader s, int subShaderIdx, int err ) + { + return (string)ShaderUtilEx.Type.InvokeMember( "GetSRPBatcherCompatibilityIssueReason", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s, subShaderIdx, err } ); + } + } + + public static class FileUtilEx + { + private static System.Type type = null; + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.FileUtil, UnityEditor" ) : type; } } + + public static string GetLastPathNameComponent( string path ) + { + return ( string ) FileUtilEx.Type.InvokeMember( "GetLastPathNameComponent", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { path } ); + } + } + + public static class ShaderInspectorEx + { + private static System.Type type = null; + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.ShaderInspector, UnityEditor" ) : type; } } + + public static void ShaderErrorListUI( UnityEngine.Object shader, ShaderMessage[] messages, ref Vector2 scrollPosition ) + { + Type.InvokeMember( "ShaderErrorListUI", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { shader, messages, scrollPosition } ); + } + } + + public static class GUISkinEx + { + private static System.Type type = null; + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.GUISkin, UnityEngine" ) : type; } } + + public static GUISkin GetCurrentSkin() + { + return ( GUISkin ) GUISkinEx.Type.GetField( "current", BindingFlags.NonPublic | BindingFlags.Static ).GetValue( null ); + } + } + + public static class EditorGUIEx + { + public static System.Type Type = typeof( EditorGUI ); + + public static bool ButtonMouseDown( Rect position, GUIContent content, FocusType focusType, GUIStyle style ) + { + return EditorGUI.DropdownButton( position, content, focusType, style ); + } + + public static float kObjectFieldMiniThumbnailHeight + { + get + { + return (float)EditorGUIEx.Type.InvokeMember( "kObjectFieldMiniThumbnailHeight", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetField, null, null, new object[] {} ); + } + } + + public static float kSingleLineHeight + { + get + { + return (float)EditorGUIEx.Type.InvokeMember( "kSingleLineHeight", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetField, null, null, new object[] { } ); + } + } + + public static Gradient GradientField( Rect position, Gradient gradient ) + { + return EditorGUI.GradientField( position, gradient ); + } + } + + internal static class EditorGUILayoutEx + { + public static System.Type Type = typeof( EditorGUILayout ); + public static Gradient GradientField( Gradient value, params GUILayoutOption[] options ) + { + return EditorGUILayout.GradientField( value, options ); + } + + public static Gradient GradientField( string label, Gradient value, params GUILayoutOption[] options ) + { + return EditorGUILayout.GradientField( label, value, options ); + } + } + + public static class ShaderInspectorPlatformsPopupEx + { + private static System.Type type = null; + public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.ShaderInspectorPlatformsPopup, UnityEditor" ) : type; } } + + public static int GetCurrentMode() + { + return ( int ) ShaderInspectorPlatformsPopupEx.Type.GetProperty( "currentMode", BindingFlags.Public | BindingFlags.Static ).GetValue( null, null ); + } + + public static int GetCurrentPlatformMask() + { + return ( int ) ShaderInspectorPlatformsPopupEx.Type.GetProperty( "currentPlatformMask", BindingFlags.Public | BindingFlags.Static ).GetValue( null, null ); + } + + public static int GetCurrentVariantStripping() + { + return ( int ) ShaderInspectorPlatformsPopupEx.Type.GetProperty( "currentVariantStripping", BindingFlags.Public | BindingFlags.Static ).GetValue( null, null ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs.meta new file mode 100644 index 00000000..eb7b0aad --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 641dff721f3c24c4188f01fea49484cb +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs new file mode 100644 index 00000000..7b9c67c6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs @@ -0,0 +1,254 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEditor; +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public class EditorVariable + { + protected string m_labelName; + protected string m_name; + protected T m_value; + protected T m_defaultValue; + + public EditorVariable( string name, string labelName, T defaultValue ) { m_name = name; m_labelName = labelName; m_defaultValue = defaultValue; m_value = defaultValue; } + public string Name { get { return m_name; } } + + public virtual T Value + { + get { return m_value; } + set + { + m_value = value; + } + } + public string LabelName { get { return m_labelName; } } + } + + public sealed class EditorVariableFloat : EditorVariable + { + public EditorVariableFloat( string name, string labelName, float defaultValue ) : base( name, labelName, defaultValue ) + { + m_value = EditorPrefs.GetFloat( name, m_defaultValue ); + } + + public override float Value + { + get { return m_value; } + set + { + if( m_value != value ) + { + m_value = value; + EditorPrefs.SetFloat( m_name, m_value ); + } + } + } + } + + public sealed class EditorVariableBool : EditorVariable + { + public EditorVariableBool( string name, string labelName, bool defaultValue ) : base( name, labelName, defaultValue ) + { + m_value = EditorPrefs.GetBool( name, m_defaultValue ); + } + + public override bool Value + { + get { return m_value; } + set + { + if( m_value != value ) + { + m_value = value; + EditorPrefs.SetBool( m_name, m_value ); + } + } + } + } + + public sealed class EditorVariableInt : EditorVariable + { + public EditorVariableInt( string name, string labelName, int defaultValue ) : base( name, labelName, defaultValue ) + { + m_value = EditorPrefs.GetInt( name, m_defaultValue ); + } + + public override int Value + { + get { return m_value; } + set + { + if( m_value != value ) + { + m_value = value; + EditorPrefs.SetInt( m_name, m_value ); + } + } + } + } + + public sealed class EditorVariableString : EditorVariable + { + public EditorVariableString( string name, string labelName, string defaultValue ) : base( name, labelName, defaultValue ) + { + m_value = EditorPrefs.GetString( name, m_defaultValue ); + } + + public override string Value + { + get { return m_value; } + set + { + if( !m_value.Equals( value ) ) + { + m_value = value; + EditorPrefs.SetString( m_name, m_value ); + } + } + } + } + + public class EditorVariablesManager + { + public static EditorVariableBool LiveMode = new EditorVariableBool( "ASELiveMode", "LiveMode", false ); + public static EditorVariableBool OutlineActiveMode = new EditorVariableBool( "ASEOutlineActiveMode", " Outline", false ); + public static EditorVariableBool NodeParametersMaximized = new EditorVariableBool( "ASENodeParametersVisible", " NodeParameters", true ); + public static EditorVariableBool NodePaletteMaximized = new EditorVariableBool( "ASENodePaletteVisible", " NodePalette", true ); + public static EditorVariableBool ExpandedRenderingPlatforms = new EditorVariableBool( "ASEExpandedRenderingPlatforms", " ExpandedRenderingPlatforms", false ); + public static EditorVariableBool ExpandedRenderingOptions = new EditorVariableBool( "ASEExpandedRenderingOptions", " ExpandedRenderingPlatforms", false ); + public static EditorVariableBool ExpandedGeneralShaderOptions = new EditorVariableBool( "ASEExpandedGeneralShaderOptions", " ExpandedGeneralShaderOptions", false ); + public static EditorVariableBool ExpandedBlendOptions = new EditorVariableBool( "ASEExpandedBlendOptions", " ExpandedBlendOptions", false ); + public static EditorVariableBool ExpandedStencilOptions = new EditorVariableBool( "ASEExpandedStencilOptions", " ExpandedStencilOptions", false ); + public static EditorVariableBool ExpandedVertexOptions = new EditorVariableBool( "ASEExpandedVertexOptions", " ExpandedVertexOptions", false ); + public static EditorVariableBool ExpandedFunctionInputs = new EditorVariableBool( "ASEExpandedFunctionInputs", " ExpandedFunctionInputs", false ); + public static EditorVariableBool ExpandedFunctionSwitches = new EditorVariableBool( "ASEExpandedFunctionSwitches", " ExpandedFunctionSwitches", false ); + public static EditorVariableBool ExpandedFunctionOutputs = new EditorVariableBool( "ASEExpandedFunctionOutputs", " ExpandedFunctionOutputs", false ); + public static EditorVariableBool ExpandedAdditionalIncludes = new EditorVariableBool( "ASEExpandedAdditionalIncludes", " ExpandedAdditionalIncludes", false ); + public static EditorVariableBool ExpandedAdditionalDefines = new EditorVariableBool( "ASEExpandedAdditionalDefines", " ExpandedAdditionalDefines", false ); + public static EditorVariableBool ExpandedAdditionalDirectives = new EditorVariableBool( "ASEExpandedAdditionalDirectives", " ExpandedAdditionalDirectives", false ); + public static EditorVariableBool ExpandedCustomTags = new EditorVariableBool( "ASEExpandedCustomTags", " ExpandedCustomTags", false ); + public static EditorVariableBool ExpandedAdditionalSurfaceOptions = new EditorVariableBool( "ASEExpandedAdditionalSurfaceOptions", " ExpandedAdditionalSurfaceOptions", false ); + public static EditorVariableBool ExpandedAdditionalPragmas = new EditorVariableBool( "ASEExpandedAdditionalPragmas", " ExpandedAdditionalPragmas", false ); + public static EditorVariableBool ExpandedDependencies = new EditorVariableBool( "ASEExpandedDependencies", " ExpandedDependencies", false ); + public static EditorVariableBool ExpandedDepth = new EditorVariableBool( "ASEExpandedDepth", " ExpandedDepth", false ); + public static EditorVariableBool ExpandedTesselation = new EditorVariableBool( "ASEExpandedTesselation", " ExpandedTesselation", false ); + public static EditorVariableBool ExpandedProperties = new EditorVariableBool( "ASEExpandedProperties", " ExpandedProperties", false ); + public static EditorVariableBool ExpandedUsePass = new EditorVariableBool( "ASEUsePass", " UsePass", false ); + //Templates + public static EditorVariableBool ExpandedBlendModeModule = new EditorVariableBool( "ASEExpandedBlendModeModule", " ExpandedBlendModeModule", false ); + } + + [Serializable] + public class InnerWindowEditorVariables + { + [SerializeField] + private bool m_liveMode = false; + [SerializeField] + private bool m_outlineActiveMode = false; + [SerializeField] + private bool m_nodeParametersMaximized = false; + [SerializeField] + private bool m_nodePaletteMaximized = false; + [SerializeField] + private bool m_expandedRenderingPlatforms = false; + [SerializeField] + private bool m_expandedRenderingOptions = false; + [SerializeField] + private bool m_expandedGeneralShaderOptions = false; + [SerializeField] + private bool m_expandedBlendOptions = false; + [SerializeField] + private bool m_expandedStencilOptions = false; + [SerializeField] + private bool m_expandedVertexOptions = false; + [SerializeField] + private bool m_expandedFunctionInputs = false; + [SerializeField] + private bool m_expandedFunctionSwitches = false; + [SerializeField] + private bool m_expandedFunctionOutputs = false; + [SerializeField] + private bool m_expandedAdditionalIncludes = false; + [SerializeField] + private bool m_expandedAdditionalDefines = false; + [SerializeField] + private bool m_expandedAdditionalDirectives = false; + [SerializeField] + private bool m_expandedCustomTags = false; + [SerializeField] + private bool m_expandedAdditionalSurfaceOptions = false; + [SerializeField] + private bool m_expandedAdditionalPragmas = false; + [SerializeField] + private bool m_expandedDependencies = false; + [SerializeField] + private bool m_expandedBlendModeModule = false; + [SerializeField] + private bool m_expandedDepth = false; + [SerializeField] + private bool m_expandedTesselation = false; + [SerializeField] + private bool m_expandedProperties = false; + [SerializeField] + private bool m_expandedUsePass = false; + + public void Initialize() + { + m_liveMode = EditorVariablesManager.LiveMode.Value; + m_outlineActiveMode = EditorVariablesManager.OutlineActiveMode.Value; + m_nodeParametersMaximized = EditorVariablesManager.NodeParametersMaximized.Value; + m_nodePaletteMaximized = EditorVariablesManager.NodePaletteMaximized.Value; + m_expandedRenderingPlatforms = EditorVariablesManager.ExpandedRenderingPlatforms.Value; + m_expandedRenderingOptions = EditorVariablesManager.ExpandedRenderingOptions.Value; + m_expandedGeneralShaderOptions = EditorVariablesManager.ExpandedGeneralShaderOptions.Value; + m_expandedBlendOptions = EditorVariablesManager.ExpandedBlendOptions.Value; + m_expandedStencilOptions = EditorVariablesManager.ExpandedStencilOptions.Value; + m_expandedVertexOptions = EditorVariablesManager.ExpandedVertexOptions.Value; + m_expandedFunctionInputs = EditorVariablesManager.ExpandedFunctionInputs.Value; + m_expandedFunctionSwitches = EditorVariablesManager.ExpandedFunctionSwitches.Value; + m_expandedFunctionOutputs = EditorVariablesManager.ExpandedFunctionOutputs.Value; + m_expandedAdditionalIncludes = EditorVariablesManager.ExpandedAdditionalIncludes.Value; + m_expandedAdditionalDefines = EditorVariablesManager.ExpandedAdditionalDefines.Value; + m_expandedAdditionalDirectives = EditorVariablesManager.ExpandedAdditionalDirectives.Value; + m_expandedCustomTags = EditorVariablesManager.ExpandedCustomTags.Value; + m_expandedAdditionalSurfaceOptions = EditorVariablesManager.ExpandedAdditionalSurfaceOptions.Value; + m_expandedAdditionalPragmas = EditorVariablesManager.ExpandedAdditionalPragmas.Value; + m_expandedDependencies = EditorVariablesManager.ExpandedDependencies.Value; + m_expandedBlendModeModule = EditorVariablesManager.ExpandedBlendModeModule.Value; + m_expandedDepth = EditorVariablesManager.ExpandedDepth.Value; + m_expandedTesselation = EditorVariablesManager.ExpandedTesselation.Value; + m_expandedProperties = EditorVariablesManager.ExpandedProperties.Value; + m_expandedUsePass = EditorVariablesManager.ExpandedUsePass.Value; + } + + public bool LiveMode{ get { return m_liveMode; } set { m_liveMode = value; EditorVariablesManager.LiveMode.Value = value; } } + public bool OutlineActiveMode { get { return m_outlineActiveMode; } set { m_outlineActiveMode = value; EditorVariablesManager.OutlineActiveMode.Value = value; } } + public bool NodeParametersMaximized { get { return m_nodeParametersMaximized; } set { m_nodeParametersMaximized = value; EditorVariablesManager.NodeParametersMaximized.Value = value; } } + public bool NodePaletteMaximized { get { return m_nodePaletteMaximized; } set { m_nodePaletteMaximized = value; EditorVariablesManager.NodePaletteMaximized.Value = value; } } + public bool ExpandedRenderingPlatforms { get { return m_expandedRenderingPlatforms; } set { m_expandedRenderingPlatforms = value; EditorVariablesManager.ExpandedRenderingPlatforms.Value = value; } } + public bool ExpandedRenderingOptions { get { return m_expandedRenderingOptions; } set { m_expandedRenderingOptions = value; EditorVariablesManager.ExpandedRenderingOptions.Value = value; } } + public bool ExpandedGeneralShaderOptions { get { return m_expandedGeneralShaderOptions; } set { m_expandedGeneralShaderOptions = value; EditorVariablesManager.ExpandedGeneralShaderOptions.Value = value; } } + public bool ExpandedBlendOptions { get { return m_expandedBlendOptions; } set { m_expandedBlendOptions = value; EditorVariablesManager.ExpandedBlendOptions.Value = value; } } + public bool ExpandedStencilOptions { get { return m_expandedStencilOptions; } set { m_expandedStencilOptions = value; EditorVariablesManager.ExpandedStencilOptions.Value = value; } } + public bool ExpandedVertexOptions { get { return m_expandedVertexOptions; } set { m_expandedVertexOptions = value; EditorVariablesManager.ExpandedVertexOptions.Value = value; } } + public bool ExpandedFunctionInputs { get { return m_expandedFunctionInputs; } set { m_expandedFunctionInputs = value; EditorVariablesManager.ExpandedFunctionInputs.Value = value; } } + public bool ExpandedFunctionSwitches { get { return m_expandedFunctionSwitches; } set { m_expandedFunctionSwitches = value; EditorVariablesManager.ExpandedFunctionSwitches.Value = value; } } + public bool ExpandedFunctionOutputs { get { return m_expandedFunctionOutputs; } set { m_expandedFunctionOutputs = value; EditorVariablesManager.ExpandedFunctionOutputs.Value = value; } } + public bool ExpandedAdditionalIncludes { get { return m_expandedAdditionalIncludes; } set { m_expandedAdditionalIncludes = value; EditorVariablesManager.ExpandedAdditionalIncludes.Value = value; } } + public bool ExpandedAdditionalDefines { get { return m_expandedAdditionalDefines; } set { m_expandedAdditionalDefines = value; EditorVariablesManager.ExpandedAdditionalDefines.Value = value; } } + public bool ExpandedAdditionalDirectives { get { return m_expandedAdditionalDirectives; } set { m_expandedAdditionalDirectives = value; EditorVariablesManager.ExpandedAdditionalDirectives.Value = value; } } + public bool ExpandedCustomTags { get { return m_expandedCustomTags; } set { m_expandedCustomTags = value; EditorVariablesManager.ExpandedCustomTags.Value = value; } } + public bool ExpandedAdditionalSurfaceOptions { get { return m_expandedAdditionalSurfaceOptions; } set { m_expandedAdditionalSurfaceOptions = value; EditorVariablesManager.ExpandedAdditionalSurfaceOptions.Value = value; } } + public bool ExpandedAdditionalPragmas { get { return m_expandedAdditionalPragmas; } set { m_expandedAdditionalPragmas = value; EditorVariablesManager.ExpandedAdditionalPragmas.Value = value; } } + public bool ExpandedDependencies { get { return m_expandedDependencies; } set { m_expandedDependencies = value; EditorVariablesManager.ExpandedDependencies.Value = value; } } + public bool ExpandedBlendModeModule { get { return m_expandedBlendModeModule; } set { m_expandedBlendModeModule = value; EditorVariablesManager.ExpandedBlendModeModule.Value = value; } } + public bool ExpandedDepth { get { return m_expandedDepth; } set { m_expandedDepth = value; EditorVariablesManager.ExpandedDepth.Value = value; } } + public bool ExpandedTesselation { get { return m_expandedTesselation; } set { m_expandedTesselation = value; EditorVariablesManager.ExpandedTesselation.Value = value; } } + public bool ExpandedProperties { get { return m_expandedProperties; } set { m_expandedProperties = value; EditorVariablesManager.ExpandedProperties.Value = value; } } + public bool ExpandedUsePass { get { return m_expandedUsePass; } set { m_expandedUsePass = value; EditorVariablesManager.ExpandedUsePass.Value = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs.meta new file mode 100644 index 00000000..a4af2e6b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d402e3c7d578ee046a5d0826b9a41c27 +timeCreated: 1487245046 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs new file mode 100644 index 00000000..981a9844 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs @@ -0,0 +1,1963 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +namespace AmplifyShaderEditor +{ + public static class GeneratorUtils + { + public const string VertexBlendWeightsStr = "ase_blendWeights"; + public const string VertexBlendIndicesStr = "ase_blendIndices"; + public const string ObjectPositionStr = "ase_objectPosition"; + public const string ObjectScaleStr = "ase_objectScale"; + public const string ParentObjectScaleStr = "ase_parentObjectScale"; + public const string ObjectBoundsMinStr = "ase_objectBoundsMin"; + public const string ObjectBoundsMaxStr = "ase_objectBoundsMax"; + public const string ObjectBoundsSizeStr = "ase_objectBoundsSize"; + public const string ScreenDepthStr = "ase_screenDepth"; + public const string DepthLinearEyeStr = "ase_depthLinearEye"; + public const string DepthLinear01Str = "ase_depthLinear01"; + public const string DepthEyeStr = "ase_depthEye"; + public const string DepthRawStr = "ase_depthRaw"; + public const string ViewPositionStr = "ase_positionVS"; + public const string ViewHPositionStr = "ase_hpositionVS"; + public const string WorldViewVectorStr = "ase_viewVectorWS"; + public const string WorldViewDirectionStr = "ase_viewDirWS"; + public const string WorldViewDirectionSafeStr = "ase_viewDirSafeWS"; + public const string ObjectViewVectorStr = "ase_viewVectorOS"; + public const string ObjectViewDirectionStr = "ase_viewDirOS"; + public const string ObjectViewDirectionSafeStr = "ase_viewDirSafeOS"; + public const string ViewViewVectorStr = "ase_viewVectorVS"; + public const string ViewViewDirectionStr = "ase_viewDirVS"; + public const string ViewViewDirectionSafeStr = "ase_viewDirSafeVS"; + public const string TangentViewVectorStr = "ase_viewVectorTS"; + public const string TangentViewDirectionStr = "ase_viewDirTS"; + public const string TangentViewDirectionSafeStr = "ase_viewDirSafeTS"; + public const string ClipPositionStr = "ase_positionCS"; + public const string VertexPosition3Str = "ase_positionOS"; + public const string VertexPosition4Str = "ase_positionOS4f"; + public const string VertexNormalStr = "ase_normalOS"; + public const string VertexTangentStr = "ase_tangentOS"; + public const string VertexTangentSignStr = "ase_tangentSign"; + public const string VertexBitangentStr = "ase_bitangentOS"; + public const string ScreenPosRawStr = "ase_positionSS"; + public const string ScreenPosNormStr = "ase_positionSSNorm"; + public const string ScreenPosCenterStr = "ase_positionSS_Center"; + public const string ScreenPosTiledStr = "ase_positionSS_Tiled"; + public const string ScreenPosPixelStr = "ase_positionSS_Pixel"; + public const string NormalizedScreenPosFormat = "{0} / {0}.w"; + public const string GrabScreenPositionStr = "ase_grabScreenPos"; + public const string GrabScreenPositionNormalizedStr = "ase_grabScreenPosNorm"; + public const string WorldPositionStr = "ase_positionWS"; + public const string RelativeWorldPositionStr = "ase_positionRWS"; + public const string VFaceStr = "ase_vface"; + public const string ShadowCoordsStr = "ase_shadowCoords"; + public const string WorldLightDirStr = "ase_lightDirWS"; + public const string ObjectLightDirStr = "ase_lightDirOS"; + public const string WorldNormalStr = "ase_normalWS"; + public const string NormalizedWorldNormalStr = "ase_normalWSNorm"; + public const string WorldReflectionStr = "ase_reflectionWS"; + public const string WorldTangentStr = "ase_tangentWS"; + public const string WorldBitangentStr = "ase_bitangentWS"; + public const string WorldToTangentStr = "ase_worldToTangent"; + public const string ObjectToTangentStr = "ase_objectToTangent"; + public const string TangentToWorldPreciseStr = "ase_tangentToWorldPrecise"; + public const string TangentToWorldFastStr = "ase_tangentToWorldFast"; + public const string TangentToObjectStr = "ase_tangentToObject"; + public const string TangentToObjectFastStr = "ase_tangentToObjectFast"; + + public static readonly string[] DepthModeStr = { "Linear Eye", "Linear 0-1", "Eye", "0-1" }; + public static readonly string[] DepthModeVarNameStr = { "depthLinearEye", "depthLinear01_", "depthEye", "depth01_" }; + + private const string Float3Format = "float3 {0} = {1};"; + private const string Float4Format = "float4 {0} = {1};"; + private const string GrabFunctionHeader = "inline float4 ASE_ComputeGrabScreenPos( float4 pos )"; + private const string GrabFunctionCall = "ASE_ComputeGrabScreenPos( {0} )"; + private const string Identity4x4 = "ase_identity4x4"; + private const string FaceVertex = "ase_faceVertex"; + private const string ase_MatrixInvP = "ase_matrixInvP"; + private const string ase_MatrixInvVP = "ase_matrixInvVP"; + private const string ase_MatrixInvMVP = "ase_matrixInvMVP"; + + private const string SurfaceScreenPosFormat = "{0}( {1}.screenPos.xyz , {1}.screenPos.w + 1e-7 )"; + + private static readonly string[] GrabFunctionBody = { + "#if UNITY_UV_STARTS_AT_TOP", + "float scale = -1.0;", + "#else", + "float scale = 1.0;", + "#endif", + "float4 o = pos;", + "o.y = pos.w * 0.5f;", + "o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y;", + "return o;" + }; + + private static readonly string InverseProjectionMatrixFunctionHeader = "InverseProjectionMatrix()"; + private static readonly string[] InverseProjectionMatrixFunctionBody = + { + "float4x4 InverseProjectionMatrix()\n", + "{\n", + "\tfloat4x4 m = UNITY_MATRIX_P;\n", + "\tfloat n11 = m[ 0 ][ 0 ];\n", + "\tfloat n22 = m[ 1 ][ 1 ];\n", + "\tfloat n33 = m[ 2 ][ 2 ];\n", + "\tfloat n34 = m[ 3 ][ 2 ];\n", + "\tfloat n43 = m[ 2 ][ 3 ];\n", + "\tfloat t11 = -n22 * n34 * n43;\n", + "\tfloat det = n11 * t11;\n", + "\tfloat idet = 1.0f / det;\n", + "\tm[ 0 ][ 0 ] = +t11* idet;\n", + "\tm[ 1 ][ 1 ] = -n11* n34 * n43* idet;\n", + "\tm[ 2 ][ 2 ] = 0;\n", + "\tm[ 2 ][ 3 ] = -n11* n22 * n43* idet;\n", + "\tm[ 3 ][ 2 ] = -n11* n22 * n34* idet;\n", + "\tm[ 3 ][ 3 ] = +n11* n22 * n33* idet;\n", + "\treturn m;\n", + "}\n" + }; + + private static readonly string ScreenPosNormToPixelFunctionHeader = "ASEScreenPositionNormalizedToPixel( {0} )"; + private static readonly string[] ScreenPosNormToPixelFunctionBody = { + "float4 ASEScreenPositionNormalizedToPixel( float4 screenPosNorm )\n", + "{\n", + "\tfloat4 screenPosPixel = screenPosNorm * float4( _ScreenParams.xy, 1, 1 );\n", + "\t#if UNITY_UV_STARTS_AT_TOP\n", + "\t\tscreenPosPixel.xy = float2( screenPosPixel.x, ( _ProjectionParams.x < 0 ) ? _ScreenParams.y - screenPosPixel.y : screenPosPixel.y );\n", + "\t#else\n", + "\t\tscreenPosPixel.xy = float2( screenPosPixel.x, ( _ProjectionParams.x > 0 ) ? _ScreenParams.y - screenPosPixel.y : screenPosPixel.y );\n", + "\t#endif\n", + "\treturn screenPosPixel;\n", + "}\n" + }; + + // MATRIX IDENTITY + static public string GenerateIdentity4x4( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + dataCollector.AddLocalVariable( uniqueId, "float4x4 ase_identity4x4 = float4x4(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1);" ); + return Identity4x4; + } + + // OBJECT POSITION + static public string GenerateObjectPosition( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + if ( dataCollector.IsTemplate ) + return dataCollector.TemplateDataCollectorInstance.GenerateObjectPosition( ref dataCollector, uniqueId ); + + string value = "UNITY_MATRIX_M._m03_m13_m23"; + dataCollector.AddLocalVariable( uniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, ObjectPositionStr, value ); + return ObjectPositionStr; + } + + // OBJECT SCALE + static public string GenerateObjectScale( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + if ( dataCollector.IsTemplate ) + return dataCollector.TemplateDataCollectorInstance.GenerateObjectScale( ref dataCollector, uniqueId ); + + //string value= "1/float3( length( unity_WorldToObject[ 0 ].xyz ), length( unity_WorldToObject[ 1 ].xyz ), length( unity_WorldToObject[ 2 ].xyz ) );"; + string value = "float3( length( unity_ObjectToWorld[ 0 ].xyz ), length( unity_ObjectToWorld[ 1 ].xyz ), length( unity_ObjectToWorld[ 2 ].xyz ) )"; + dataCollector.AddLocalVariable( uniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, ObjectScaleStr, value ); + return ObjectScaleStr; + } + + static public string GenerateRotationIndependentObjectScale( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + if ( dataCollector.IsTemplate ) + return dataCollector.TemplateDataCollectorInstance.GenerateRotationIndependentObjectScale( ref dataCollector, uniqueId ); + + string value = "(1.0/float3( length( unity_WorldToObject[ 0 ].xyz ), length( unity_WorldToObject[ 1 ].xyz ), length( unity_WorldToObject[ 2 ].xyz ) ))"; + dataCollector.AddLocalVariable( uniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, ParentObjectScaleStr, value ); + return ParentObjectScaleStr; + } + + // POSITION + static public string GeneratePosition( ref MasterNodeDataCollector dataCollector, int uniqueId, PositionNode.Space space ) + { + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetPosition( space ); + } + + string result; + if ( space == PositionNode.Space.Object ) + { + result = GenerateVertexPosition( ref dataCollector, uniqueId, WirePortDataType.FLOAT3 ); + } + else if ( space == PositionNode.Space.RelativeWorld ) + { + result = GenerateRelativeWorldPosition( ref dataCollector, uniqueId ); + } + else if ( space == PositionNode.Space.View ) + { + result = GenerateViewPosition( ref dataCollector, uniqueId ); + } + else // PositionNode.Space.World + { + result = GenerateWorldPosition( ref dataCollector, uniqueId ); + } + return result; + } + + static public string GenerateWorldPosition( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + PrecisionType precision = PrecisionType.Float; + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetWorldPos(); + } + + if ( !dataCollector.HasLocalVariableByName( WorldPositionStr ) ) + { + dataCollector.AddToInput( -1, SurfaceInputs.WORLD_POS, precision ); + + string result; + if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + result = "mul( unity_ObjectToWorld, " + Constants.VertexShaderInputStr + ".vertex )"; + } + else + { + result = Constants.InputVarStr + ".worldPos"; + } + + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, WorldPositionStr, result ); + } + return WorldPositionStr; + } + + static public string GenerateRelativeWorldPosition( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + PrecisionType precision = PrecisionType.Float; + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetRelativeWorldPos(); + } + + if ( !dataCollector.HasLocalVariableByName( RelativeWorldPositionStr ) ) + { + if ( dataCollector.TesselationActive ) + { + string positionWS = GenerateWorldPosition( ref dataCollector, uniqueId ); + + string invProjMatrix = GeneratorUtils.GenerateInverseProjection( ref dataCollector, uniqueId, precision ); + + if ( !dataCollector.HasLocalVariableByName( ClipPositionStr ) ) + { + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, ClipPositionStr, + string.Format( "UnityWorldToClipPos( {0} )", positionWS ) ); + } + + if ( !dataCollector.HasLocalVariableByName( ViewHPositionStr ) ) + { + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, ViewHPositionStr, + string.Format( "mul( {0}, {1} )", invProjMatrix, ClipPositionStr ) ); + } + + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, RelativeWorldPositionStr, + string.Format( "mul( ( float3x3 )UNITY_MATRIX_I_V, {0}.xyz / {0}.w )", ViewHPositionStr ) ); + } + else + { + string positionOS = GenerateVertexPosition( ref dataCollector, uniqueId, WirePortDataType.FLOAT4, false, MasterNodePortCategory.Vertex ); + + string positionRWSOutput = string.Format( "{0}.{1}", Constants.VertexShaderOutputStr, RelativeWorldPositionStr ); + string positionRWSInput = string.Format( "{0}.{1}", Constants.InputVarStr, RelativeWorldPositionStr ); + + string invProjMatrix = GeneratorUtils.GenerateInverseProjection( ref dataCollector, uniqueId, precision, false, MasterNodePortCategory.Vertex ); + + dataCollector.AddToInput( uniqueId, RelativeWorldPositionStr, WirePortDataType.FLOAT3 ); + + if ( !dataCollector.HasLocalVariableByName( ClipPositionStr ) ) + { + dataCollector.AddToVertexLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4, ClipPositionStr, + string.Format( "UnityObjectToClipPos( {0} )", positionOS ) ); + } + + if ( !dataCollector.HasLocalVariableByName( ViewHPositionStr ) ) + { + dataCollector.AddToVertexLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4, ViewHPositionStr, + string.Format( "mul( {0}, {1} )", invProjMatrix, ClipPositionStr ) ); + } + + dataCollector.AddToVertexLocalVariables( uniqueId, precision, WirePortDataType.FLOAT3, RelativeWorldPositionStr, + string.Format( "mul( ( float3x3 )UNITY_MATRIX_I_V, {0}.xyz / {0}.w )", ViewHPositionStr ) ); + + dataCollector.AddToVertexLocalVariables( uniqueId, positionRWSOutput, RelativeWorldPositionStr ); + + if ( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) + { + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, RelativeWorldPositionStr, positionRWSInput ); + } + } + } + return RelativeWorldPositionStr; + } + + static public string GenerateViewPosition( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + PrecisionType precision = PrecisionType.Float; + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetViewPos(); + } + + if ( !dataCollector.HasLocalVariableByName( ViewPositionStr ) ) + { + string result; + if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + string positionOS = Constants.VertexShaderInputStr + ".vertex"; + result = string.Format( "UnityObjectToViewPos( {0} )", positionOS ); + } + else + { + dataCollector.AddToInput( -1, SurfaceInputs.WORLD_POS, precision ); + + string positionWS = Constants.InputVarStr + ".worldPos"; + result = string.Format( "UnityWorldToViewPos( {0} )", positionWS ); + } + + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, ViewPositionStr, result ); + } + return ViewPositionStr; + } + + // WORLD REFLECTION + static public string GenerateWorldReflection( ref MasterNodeDataCollector dataCollector, int uniqueId, bool normalize = false ) + { + if ( dataCollector.IsTemplate ) + return dataCollector.TemplateDataCollectorInstance.GetWorldReflection( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, true, MasterNodePortCategory.Fragment, normalize ); + + string precisionType = UIUtils.PrecisionWirePortToCgType( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, WirePortDataType.FLOAT3 ); + string result = string.Empty; + if ( !dataCollector.DirtyNormal ) + result = Constants.InputVarStr + ".worldRefl"; + else + result = "WorldReflectionVector( " + Constants.InputVarStr + ", " + precisionType + "( 0, 0, 1 ) )"; + + if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + result = "UnityObjectToWorldNormal( " + Constants.VertexShaderInputStr + ".normal )"; + if ( normalize ) + { + result = string.Format( "normalize( {0} )", result ); + } + + dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, string.Concat( precisionType, " ", WorldReflectionStr, " = ", result, ";" ) ); + return WorldReflectionStr; + } + + // WORLD NORMAL + static public string GenerateWorldNormal( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precisionType, string normal, string outputId ) + { + if ( dataCollector.IsTemplate ) + return dataCollector.TemplateDataCollectorInstance.GetWorldNormal( uniqueId, precisionType, normal, outputId ); + + string tanToWorld = GenerateTangentToWorldMatrixFast( ref dataCollector, uniqueId, precisionType ); + return string.Format( "mul({0},{1})", tanToWorld, normal ); + + } + static public string GenerateWorldNormal( ref MasterNodeDataCollector dataCollector, int uniqueId, bool normalize = false ) + { + PrecisionType precision = UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision; + + if ( dataCollector.IsTemplate ) + return dataCollector.TemplateDataCollectorInstance.GetWorldNormal( precision, true, MasterNodePortCategory.Fragment, normalize ); + + string precisionType = UIUtils.PrecisionWirePortToCgType( precision, WirePortDataType.FLOAT3 ); + string result = string.Empty; + if ( !dataCollector.DirtyNormal ) + result = Constants.InputVarStr + ".worldNormal"; + else + result = "WorldNormalVector( " + Constants.InputVarStr + ", " + precisionType + "( 0, 0, 1 ) )"; + + if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + result = "UnityObjectToWorldNormal( " + Constants.VertexShaderInputStr + ".normal )"; + + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, WorldNormalStr, result ); + if ( normalize ) + { + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, NormalizedWorldNormalStr, "normalize( " + WorldNormalStr + " )" ); + return NormalizedWorldNormalStr; + } + return WorldNormalStr; + } + + // WORLD TANGENT + static public string GenerateWorldTangent( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + if ( dataCollector.IsTemplate ) + return dataCollector.TemplateDataCollectorInstance.GetWorldTangent( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + + string precisionType = UIUtils.PrecisionWirePortToCgType( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, WirePortDataType.FLOAT3 ); + string result = "WorldNormalVector( " + Constants.InputVarStr + ", " + precisionType + "( 1, 0, 0 ) )"; + + if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + result = "UnityObjectToWorldDir( " + Constants.VertexShaderInputStr + ".tangent.xyz )"; + dataCollector.AddLocalVariable( uniqueId, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, WirePortDataType.FLOAT3, WorldTangentStr, result ); + //dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, string.Concat( precisionType, " ", WorldTangentStr, " = ", result, ";" ) ); + return WorldTangentStr; + } + + // WORLD BITANGENT + static public string GenerateWorldBitangent( ref MasterNodeDataCollector dataCollector, int uniqueId ) + { + if ( dataCollector.IsTemplate ) + return dataCollector.TemplateDataCollectorInstance.GetWorldBinormal( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + + string precisionType = UIUtils.PrecisionWirePortToCgType( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, WirePortDataType.FLOAT3 ); + string result = "WorldNormalVector( " + Constants.InputVarStr + ", " + precisionType + "( 0, 1, 0 ) )"; + + if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) + { + string worldNormal = GenerateWorldNormal( ref dataCollector, uniqueId ); + string worldTangent = GenerateWorldTangent( ref dataCollector, uniqueId ); + dataCollector.AddToVertexLocalVariables( uniqueId, string.Format( "half tangentSign = {0}.tangent.w * ( unity_WorldTransformParams.w >= 0.0 ? 1.0 : -1.0 );", Constants.VertexShaderInputStr ) ); + result = "cross( " + worldNormal + ", " + worldTangent + " ) * tangentSign"; + } + + dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, string.Concat( precisionType, " ", WorldBitangentStr, " = ", result, ";" ) ); + return WorldBitangentStr; + } + + // OBJECT TO TANGENT MATRIX + static public string GenerateObjectToTangentMatrix( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) + { + string normal = GenerateVertexNormal( ref dataCollector, uniqueId, precision ); + string tangent = GenerateVertexTangent( ref dataCollector, uniqueId, precision, WirePortDataType.FLOAT3 ); + string bitangen = GenerateVertexBitangent( ref dataCollector, uniqueId, precision ); + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3x3, ObjectToTangentStr, "float3x3( " + tangent + ", " + bitangen + ", " + normal + " )" ); + return ObjectToTangentStr; + } + + // TANGENT TO OBJECT + //static public string GenerateTangentToObjectMatrixFast( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) + //{ + // string normal = GenerateVertexNormal( ref dataCollector, uniqueId, precision ); + // string tangent = GenerateVertexTangent( ref dataCollector, uniqueId, precision ); + // string bitangent = GenerateVertexBitangent( ref dataCollector, uniqueId, precision ); + + // string result = string.Format( "float3x3({0}.x,{1}.x,{2}.x,{0}.y,{1}.y,{2}.y,{0}.z,{1}.z,{2}.z)",tangent,bitangent,normal ); + // dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3x3, TangentToObjectFastStr, result ); + // return TangentToObjectFastStr; + //} + + //static public string GenerateTangentToObjectMatrixPrecise( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) + //{ + // string objectToTangent = GenerateObjectToTangentMatrix( ref dataCollector, uniqueId, precision ); + // Add3x3InverseFunction( ref dataCollector, UIUtils.PrecisionWirePortToCgType( precision, WirePortDataType.FLOAT ) ); + // dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3x3, TangentToObjectStr, string.Format( Inverse3x3Header, objectToTangent ) ); + // return TangentToObjectStr; + //} + + // WORLD TO TANGENT MATRIX + static public string GenerateWorldToTangentMatrix( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) + { + if ( dataCollector.IsTemplate ) + return dataCollector.TemplateDataCollectorInstance.GetWorldToTangentMatrix( precision ); + + if ( dataCollector.IsFragmentCategory ) + { + dataCollector.ForceNormal = true; + + dataCollector.AddToInput( -1, SurfaceInputs.WORLD_NORMAL, precision ); + dataCollector.AddToInput( -1, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + } + + string worldNormal = GenerateWorldNormal( ref dataCollector, uniqueId ); + string worldTangent = GenerateWorldTangent( ref dataCollector, uniqueId ); + string worldBitangent = GenerateWorldBitangent( ref dataCollector, uniqueId ); + + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3x3, WorldToTangentStr, "float3x3( " + worldTangent + ", " + worldBitangent + ", " + worldNormal + " )" ); + return WorldToTangentStr; + } + + // TANGENT TO WORLD + static public string GenerateTangentToWorldMatrixFast( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) + { + if ( dataCollector.IsTemplate ) + return dataCollector.TemplateDataCollectorInstance.GetTangentToWorldMatrixFast( precision ); + + if ( dataCollector.IsFragmentCategory ) + { + dataCollector.ForceNormal = true; + + dataCollector.AddToInput( -1, SurfaceInputs.WORLD_NORMAL, precision ); + dataCollector.AddToInput( -1, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + } + + string worldNormal = GenerateWorldNormal( ref dataCollector, uniqueId ); + string worldTangent = GenerateWorldTangent( ref dataCollector, uniqueId ); + string worldBitangent = GenerateWorldBitangent( ref dataCollector, uniqueId ); + + string result = string.Format( "float3x3({0}.x,{1}.x,{2}.x,{0}.y,{1}.y,{2}.y,{0}.z,{1}.z,{2}.z)", worldTangent, worldBitangent, worldNormal ); + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3x3, TangentToWorldFastStr, result ); + return TangentToWorldFastStr; + } + + static public string GenerateTangentToWorldMatrixPrecise( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) + { + if ( dataCollector.IsTemplate ) + return dataCollector.TemplateDataCollectorInstance.GetTangentToWorldMatrixPrecise( precision ); + + if ( dataCollector.IsFragmentCategory ) + { + dataCollector.ForceNormal = true; + + dataCollector.AddToInput( -1, SurfaceInputs.WORLD_NORMAL, precision ); + dataCollector.AddToInput( -1, SurfaceInputs.INTERNALDATA, addSemiColon: false ); + } + + string worldToTangent = GenerateWorldToTangentMatrix( ref dataCollector, uniqueId, precision ); + Add3x3InverseFunction( ref dataCollector, UIUtils.PrecisionWirePortToCgType( precision, WirePortDataType.FLOAT ) ); + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3x3, TangentToWorldPreciseStr, string.Format( Inverse3x3Header, worldToTangent ) ); + return TangentToWorldPreciseStr; + } + + // MATRICES + static public string GenerateInverseProjection( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string value; + if ( dataCollector.IsSRP ) + { + value = "UNITY_MATRIX_I_P"; + } + else + { + dataCollector.AddFunction( InverseProjectionMatrixFunctionBody[ 0 ], InverseProjectionMatrixFunctionBody, false ); + value = InverseProjectionMatrixFunctionHeader; + } + + if ( !useMasterNodeCategory && customCategory == MasterNodePortCategory.Vertex ) + { + dataCollector.AddToVertexLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4x4, ase_MatrixInvP, value ); + } + else + { + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4x4, ase_MatrixInvP, value ); + } + return ase_MatrixInvP; + } + + static public string GenerateInverseViewProjection( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string value; + if ( dataCollector.IsSRP ) + { + value = "mul( GetViewToWorldMatrix(), UNITY_MATRIX_I_P )"; + } + else + { + value = string.Format( "mul( UNITY_MATRIX_I_V, {0} )", GenerateInverseProjection( ref dataCollector, uniqueId, precision ) ); + } + if ( !useMasterNodeCategory && customCategory == MasterNodePortCategory.Vertex ) + { + dataCollector.AddToVertexLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4x4, ase_MatrixInvVP, value ); + } + else + { + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4x4, ase_MatrixInvVP, value ); + } + return ase_MatrixInvVP; + } + + static public string GenerateInverseModelViewProjection( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + string value; + if ( dataCollector.IsSRP ) + { + value = "mul( GetWorldToObjectMatrix(), mul( GetViewToWorldMatrix(), UNITY_MATRIX_I_P ) )"; + } + else + { + value = string.Format( "mul( unity_WorldToObject, {0} )", GenerateInverseViewProjection( ref dataCollector, uniqueId, precision ) ); + } + if ( !useMasterNodeCategory && customCategory == MasterNodePortCategory.Vertex ) + { + dataCollector.AddToVertexLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4x4, ase_MatrixInvMVP, value ); + } + else + { + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4x4, ase_MatrixInvMVP, value ); + } + return ase_MatrixInvMVP; + } + + // SAMPLER STATES + static public string GenerateSamplerState( ref MasterNodeDataCollector dataCollector, int uniqueId, string propertyName, VariableMode varMode, bool returnPropertyName = false ) + { + + string sampler = string.Format( Constants.SamplerFormat, propertyName ); + string samplerDecl = string.Empty; + + ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; + if ( outsideGraph.IsSRP ) + //if( dataCollector.IsSRP ) + samplerDecl = string.Format( Constants.SamplerDeclSRPFormat, sampler ) + ";"; + else + samplerDecl = string.Format( Constants.SamplerDeclFormat, sampler ) + ";"; + if ( varMode == VariableMode.Create ) + dataCollector.AddToUniforms( uniqueId, samplerDecl ); + + if ( returnPropertyName ) + return propertyName; + else + return sampler; + } + + public static string GetPropertyFromSamplerState( string sampler ) + { + if ( sampler.StartsWith( "sampler" ) ) + return sampler.Remove( 0, 7 ); + else + return sampler; + } + + public static string GetSamplerDeclaraction( string texture, WirePortDataType type, string termination = "" ) + { + return GetSamplerDeclaraction( texture, Constants.WireToTexture[ type ], termination ); + } + + public static string GetSamplerDeclaraction( string sampler, TextureType type, string termination = "" ) + { + ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; + if ( outsideGraph.SamplingMacros || type == TextureType.Texture2DArray ) + { + if ( outsideGraph.IsSRP ) + return string.Format( Constants.SamplerDeclSRPFormat, sampler ) + termination; + else + return string.Format( Constants.SamplerDeclFormat, sampler ) + termination; + } + + // we don't use sampler states when macros are not available + return string.Empty; + } + + // PROPERTY MACRO + public static string GetPropertyDeclaraction( string texture, WirePortDataType type, string termination = "" ) + { + return GetPropertyDeclaraction( texture, Constants.WireToTexture[ type ], termination ); + } + + public static string GetPropertyDeclaraction( string texture, TextureType type, string termination = "" ) + { + if ( type == TextureType.Texture1D ) + return "sampler1D " + texture + termination; + + ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; + if ( outsideGraph.SamplingMacros || type == TextureType.Texture2DArray ) + { + if ( outsideGraph.IsSRP ) + return string.Format( Constants.TexDeclarationNoSamplerSRPMacros[ type ], texture ) + termination; + else + return string.Format( Constants.TexDeclarationNoSamplerStandardMacros[ type ], texture ) + termination; + } + + return UIUtils.TextureTypeToCgType( type ) + " " + texture + termination; + } + + // SAMPLING CALL + public static string GenerateSamplingCall( ref MasterNodeDataCollector dataCollector, WirePortDataType type, string property, string samplerState, string uv, MipType mip = MipType.Auto, params string[] mipData ) + { + ParentGraph ousideGraph = UIUtils.CurrentWindow.OutsideGraph; + string result = string.Empty; + string mipSuffix = string.Empty; + + //samplerState = GetPropertyFromSamplerState( samplerState ); + TextureType textureType = Constants.WireToTexture[ type ]; + + bool usingMacro = false; + if ( ousideGraph.SamplingMacros || textureType == TextureType.Texture2DArray ) + usingMacro = true; + + switch ( mip ) + { + default: + case MipType.Auto: + break; + case MipType.MipLevel: + mipSuffix = usingMacro ? "_LOD" : "lod"; + break; + case MipType.MipBias: + mipSuffix = usingMacro ? "_BIAS" : "bias"; + break; + case MipType.Derivative: + mipSuffix = usingMacro ? "_GRAD" : "grad"; + break; + } + + string mipParams = string.Empty; + if ( mip != MipType.Auto ) + { + for ( int i = 0; i < mipData.Length; i++ ) + { + mipParams += ", " + mipData[ i ]; + } + } + + if ( usingMacro ) + { + if ( ousideGraph.IsSRP ) + { + if ( textureType == TextureType.Texture3D && ( mip == MipType.MipBias || mip == MipType.Derivative ) ) + AddCustom3DSRPMacros( ref dataCollector ); + // srp macro + result = string.Format( Constants.TexSampleSRPMacros[ textureType ], mipSuffix, property, samplerState, uv + mipParams ); + } + else + { + AddCustomStandardSamplingMacros( ref dataCollector, type, mip ); + result = string.Format( Constants.TexSampleSamplerStandardMacros[ textureType ], mipSuffix, property, samplerState, uv + mipParams ); + + } + } + else + { + //no macro : builtin and srp + string uvs = uv + mipParams; + string emptyParam = ", 0"; + if ( textureType == TextureType.Texture3D || textureType == TextureType.Cube ) + emptyParam = string.Empty; + + if ( ( mip == MipType.MipBias || mip == MipType.MipLevel ) ) + uvs = "float4( " + uv + emptyParam + mipParams + " )"; + + result = string.Format( Constants.TexSampleStandard[ textureType ], mipSuffix, property, uvs ); + } + return result; + } + + public static string GenerateScaleOffsettedUV( TextureType texType, string uvName, string propertyName, bool addST ) + { + if ( addST ) + propertyName += "_ST"; + + switch ( texType ) + { + case TextureType.Texture1D: return uvName + " * " + propertyName + ".x + " + propertyName + ".z"; + case TextureType.Texture2D: return uvName + " * " + propertyName + ".xy + " + propertyName + ".zw"; + case TextureType.Texture3D: + case TextureType.Cube: return uvName + " * " + propertyName + ".xy + " + propertyName + ".zw"; + default: + case TextureType.Texture2DArray: + case TextureType.ProceduralTexture: return uvName; + } + } + // AUTOMATIC UVS - SURFACE ONLY + static public string GenerateAutoUVs( ref MasterNodeDataCollector dataCollector, int uniqueId, int index, string propertyName = null, WirePortDataType size = WirePortDataType.FLOAT2, string scale = null, string offset = null, string outputId = null ) + { + string result = string.Empty; + string varName = string.Empty; + string indexStr = index > 0 ? ( index + 1 ).ToString() : ""; + string sizeDif = string.Empty; + WirePortDataType maxSize = dataCollector.GetMaxTextureChannelSize( index ); + + //if( maxSize == WirePortDataType.FLOAT3 ) + // sizeDif = "3"; + //else if( maxSize == WirePortDataType.FLOAT4 ) + // sizeDif = "4"; + + if ( !dataCollector.IsTemplate && index > 3 ) + { + string texCoordNameIn = TemplateHelperFunctions.BaseInterpolatorName + index; + string texCoordNameOut = TemplateHelperFunctions.BaseInterpolatorName + ( index + 1 ).ToString(); + if ( dataCollector.IsFragmentCategory ) + { + GenerateValueInVertex( ref dataCollector, uniqueId, maxSize, PrecisionType.Float, Constants.VertexShaderInputStr + "." + texCoordNameIn, texCoordNameOut, true ); + result = Constants.InputVarStr + "." + texCoordNameOut; + } + else + { + result = Constants.VertexShaderInputStr + "." + texCoordNameIn; + } + + if ( !string.IsNullOrEmpty( propertyName ) ) + { + + varName = "uv" + indexStr + ( maxSize != WirePortDataType.FLOAT2 ? "s" + sizeDif : "" ) + propertyName; + dataCollector.AddToUniforms( uniqueId, "uniform float4 " + propertyName + "_ST;" ); + if ( maxSize > WirePortDataType.FLOAT2 ) + { + dataCollector.UsingHigherSizeTexcoords = true; + dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, PrecisionType.Float, maxSize, varName, result ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, varName + ".xy = " + result + ".xy * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw;" ); + } + else + { + dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, PrecisionType.Float, maxSize, varName, result + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw" ); + } + + result = varName; + } + + switch ( maxSize ) + { + default: + case WirePortDataType.FLOAT2: + { + result += ".xy"; + } + break; + case WirePortDataType.FLOAT3: + { + result += ".xyz"; + } + break; + case WirePortDataType.FLOAT4: break; + } + + if ( size < maxSize ) + { + switch ( size ) + { + case WirePortDataType.FLOAT2: result += ".xy"; break; + case WirePortDataType.FLOAT3: result += ".xyz"; break; + } + } + + return result; + } + + if ( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) + { + string dummyPropUV = "_tex" + sizeDif + "coord" + indexStr; + string dummyUV = "uv" + indexStr + dummyPropUV; + + dataCollector.AddToProperties( uniqueId, "[HideInInspector] " + dummyPropUV + "( \"\", 2D ) = \"white\" {}", 100 ); + dataCollector.AddToInput( uniqueId, dummyUV, maxSize ); + + result = Constants.InputVarStr + "." + dummyUV; + } + else + { + result = Constants.VertexShaderInputStr + ".texcoord"; + if ( index > 0 ) + { + result += index.ToString(); + } + + switch ( maxSize ) + { + default: + case WirePortDataType.FLOAT2: + { + result += ".xy"; + } + break; + case WirePortDataType.FLOAT3: + { + result += ".xyz"; + } + break; + case WirePortDataType.FLOAT4: break; + } + } + + varName = "uv" + indexStr + ( maxSize != WirePortDataType.FLOAT2 ? "s" + sizeDif : "" ) + "_TexCoord" + outputId; + + if ( !string.IsNullOrEmpty( propertyName ) ) + { + string finalVarName = "uv" + indexStr + ( maxSize != WirePortDataType.FLOAT2 ? "s" + sizeDif : "" ) + propertyName; + + dataCollector.AddToUniforms( uniqueId, "uniform float4 " + propertyName + "_ST;" ); + if ( maxSize > WirePortDataType.FLOAT2 ) + { + dataCollector.UsingHigherSizeTexcoords = true; + dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, PrecisionType.Float, maxSize, finalVarName, result ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, finalVarName + ".xy = " + result + ".xy * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw;" ); + } + else + { + dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, PrecisionType.Float, size, finalVarName, result + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw" ); + } + + result = finalVarName; + } + else if ( !string.IsNullOrEmpty( scale ) || !string.IsNullOrEmpty( offset ) ) + { + if ( maxSize > WirePortDataType.FLOAT2 ) + { + dataCollector.UsingHigherSizeTexcoords = true; + dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, PrecisionType.Float, size, varName, result ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, varName + ".xy = " + result + ".xy" + ( string.IsNullOrEmpty( scale ) ? "" : " * " + scale ) + ( string.IsNullOrEmpty( offset ) ? "" : " + " + offset ) + ";" ); + } + else + { + dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, PrecisionType.Float, size, varName, result + ( string.IsNullOrEmpty( scale ) ? "" : " * " + scale ) + ( string.IsNullOrEmpty( offset ) ? "" : " + " + offset ) ); + } + + result = varName; + } + else if ( dataCollector.PortCategory == MasterNodePortCategory.Fragment ) + { + if ( maxSize > WirePortDataType.FLOAT2 ) + dataCollector.UsingHigherSizeTexcoords = true; + } + if ( size < maxSize ) + { + switch ( size ) + { + case WirePortDataType.FLOAT2: result += ".xy"; break; + case WirePortDataType.FLOAT3: result += ".xyz"; break; + } + } + return result; + } + + // SCREEN POSITION + static public string GenerateScreenPositionNormalizedForValue( string customVertexPos, string outputId, ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool addInput = true ) + { + if ( !dataCollector.HasLocalVariableByName( ScreenPosNormStr ) ) + { + string screenPos = GenerateScreenPositionRawForValue( customVertexPos, outputId, ref dataCollector, uniqueId, precision, addInput ); + + // TODO: check later if precision can be half + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, ScreenPosNormStr, string.Format( NormalizedScreenPosFormat, screenPos ) ); + dataCollector.AddLocalVariable( uniqueId, string.Format( "{0}.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? {0}.z : {0}.z * 0.5 + 0.5;", ScreenPosNormStr ) ); + } + return ScreenPosNormStr; + } + + static public string GenerateScreenPositionNormalized( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool addInput = true, string customScreenPos = null ) + { + string screenPos; + string varName; + if ( string.IsNullOrEmpty( customScreenPos ) ) + { + screenPos = GenerateScreenPositionRaw( ref dataCollector, uniqueId, precision, addInput ); + varName = ScreenPosNormStr; + } + else + { + screenPos = customScreenPos; + varName = ScreenPosNormStr + uniqueId; + } + + if ( !dataCollector.HasLocalVariableByName( varName ) ) + { + // TODO: check later if precision can be half + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, varName, string.Format( NormalizedScreenPosFormat, screenPos ) ); + dataCollector.AddLocalVariable( uniqueId, string.Format( "{0}.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? {0}.z : {0}.z * 0.5 + 0.5;", varName ) ); + } + return varName; + } + + static public string GenerateScreenPositionRawForValue( string customVertexPosition, string outputId, ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool addInput = true ) + { + // overriding precision + precision = PrecisionType.Float; + + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetScreenPosForValue( precision, customVertexPosition, outputId ); + } + + string screenPosFrag = ScreenPosRawStr + outputId; + + if ( dataCollector.IsTemplate || !dataCollector.TesselationActive ) + { + string value = GenerateVertexScreenPositionRawForValue( customVertexPosition, outputId, ref dataCollector, uniqueId, precision ); + + if ( !dataCollector.IsFragmentCategory ) + { + return value; + } + + string screenPosVertex = "screenPosition" + outputId; + dataCollector.AddToInput( uniqueId, screenPosVertex, WirePortDataType.FLOAT4, precision ); + dataCollector.AddToVertexLocalVariables( uniqueId, Constants.VertexShaderOutputStr + "." + screenPosVertex + " = " + value + ";" ); + + + string globalResult = Constants.InputVarStr + "." + screenPosVertex; + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, screenPosFrag, globalResult ); + } + else + { + string value = string.Format( "ComputeScreenPos( UnityObjectToClipPos( {0} ) )", customVertexPosition ); + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, screenPosFrag, value ); + } + return screenPosFrag; + } + + static public string GenerateScreenPositionRaw( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool addInput = true ) + { + // overriding precision + precision = PrecisionType.Float; + + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetScreenPosRaw( precision ); + } + + if ( dataCollector.UsingCustomScreenPos && dataCollector.IsFragmentCategory ) + { + string value = GenerateVertexScreenPositionRaw( ref dataCollector, uniqueId, precision ); + dataCollector.AddToInput( uniqueId, "screenPosition", WirePortDataType.FLOAT4, precision ); + dataCollector.AddToVertexLocalVariables( uniqueId, Constants.VertexShaderOutputStr + ".screenPosition = " + value + ";" ); + + string globalResult = Constants.InputVarStr + ".screenPosition"; + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, ScreenPosRawStr, globalResult ); + return ScreenPosRawStr; + } + else if ( !dataCollector.IsFragmentCategory ) + { + return GenerateVertexScreenPositionRaw( ref dataCollector, uniqueId, precision ); + } + + + if ( !dataCollector.HasLocalVariableByName( ScreenPosRawStr ) ) + { + if ( addInput ) + { + dataCollector.AddToInput( uniqueId, SurfaceInputs.SCREEN_POS, precision ); + dataCollector.AddToIncludes( uniqueId, Constants.UnityShaderVariables ); + } + + string value = string.Format( SurfaceScreenPosFormat, UIUtils.PrecisionWirePortToCgType( precision, WirePortDataType.FLOAT4 ), Constants.InputVarStr ); + dataCollector.AddToLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4, ScreenPosRawStr, value ); + } + return ScreenPosRawStr; + } + + static public string GenerateScreenPositionCenter( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool addInput = true ) + { + string screenPosNorm = GenerateScreenPositionNormalized( ref dataCollector, uniqueId, precision, addInput ); + string value = string.Format( "float4( {0}.xy * 2 - 1, 0, 0 )", screenPosNorm ); + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, GeneratorUtils.ScreenPosCenterStr, value ); + return GeneratorUtils.ScreenPosCenterStr; + } + + + static public string GenerateScreenPositionTiled( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool addInput = true ) + { + string screenPosNorm = GenerateScreenPositionNormalized( ref dataCollector, uniqueId, precision, addInput ); + string value = string.Format( "frac( float4( ( {0}.x * 2 - 1 ) * _ScreenParams.x / _ScreenParams.y, {0}.y * 2 - 1, 0, 0 ) )", screenPosNorm ); + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, GeneratorUtils.ScreenPosTiledStr, value ); + return GeneratorUtils.ScreenPosTiledStr; + } + + static public void GenerateScreenPosNormToPixelFunction( ref MasterNodeDataCollector dataCollector ) + { + dataCollector.AddFunction( ScreenPosNormToPixelFunctionBody[ 0 ], ScreenPosNormToPixelFunctionBody, false ); + } + + static public string GenerateScreenPosNormToPixelFunctionCall( string screenPosNorm ) + { + return string.Format( ScreenPosNormToPixelFunctionHeader, screenPosNorm ); + } + + static public string GenerateScreenPositionPixel( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool addInput = true ) + { + string screenPosNorm = GenerateScreenPositionNormalized( ref dataCollector, uniqueId, precision, addInput ); + GenerateScreenPosNormToPixelFunction( ref dataCollector ); + string value = GenerateScreenPosNormToPixelFunctionCall( screenPosNorm ); + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, GeneratorUtils.ScreenPosPixelStr, value ); + return GeneratorUtils.ScreenPosPixelStr; + } + + // DEPTH + static public string ApplyLinearDepthModifier( ref MasterNodeDataCollector dataCollector, string instruction, DepthMode depthMode ) + { + if ( depthMode == DepthMode.DepthLinearEye || depthMode == DepthMode.DepthLinear01 ) + { + string space = ( depthMode == DepthMode.DepthLinearEye ) ? "LinearEyeDepth" : "Linear01Depth"; + + if ( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + instruction = string.Format( "{0}( {1}, _ZBufferParams )", space, instruction ); + } + else + { + instruction = string.Format( "{0}( {1} )", space, instruction ); + } + } + return instruction; + } + + static public string GenerateSurfaceDepth( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, DepthMode depthMode ) + { + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetSurfaceDepth( depthMode, precision ); + } + + string screenPos = GeneratorUtils.GenerateScreenPositionRaw( ref dataCollector, uniqueId, precision ); + string instruction = string.Format( "{0}.z / {0}.w", screenPos ); + string varName; + + switch ( depthMode ) + { + case DepthMode.DepthLinearEye: + { + instruction = ApplyLinearDepthModifier( ref dataCollector, instruction, depthMode ); + varName = GeneratorUtils.DepthLinearEyeStr; + break; + } + case DepthMode.DepthLinear01: + { + instruction = ApplyLinearDepthModifier( ref dataCollector, instruction, depthMode ); + varName = GeneratorUtils.DepthLinear01Str; + break; + } + case DepthMode.DepthEye: + { + instruction = string.Format( "( {0} ) * ( _ProjectionParams.z - _ProjectionParams.y )", instruction ); + varName = GeneratorUtils.DepthEyeStr; + break; + } + case DepthMode.Depth01: + default: + { + varName = GeneratorUtils.DepthRawStr; + break; + } + } + + dataCollector.AddToLocalVariables( uniqueId, precision, WirePortDataType.FLOAT, varName, instruction ); + return varName; + } + + // GRAB SCREEN POSITION + static public string GenerateGrabScreenPosition( ref MasterNodeDataCollector dataCollector , int uniqueId , PrecisionType precision , bool addInput = true , string customScreenPos = null ) + { + // overriding precision + precision = PrecisionType.Float; + + string screenPos = string.Empty; + if( string.IsNullOrEmpty( customScreenPos ) ) + screenPos = GenerateScreenPositionRaw( ref dataCollector , uniqueId , precision , addInput ); + else + screenPos = customScreenPos; + + string computeBody = string.Empty; + IOUtils.AddFunctionHeader( ref computeBody , GrabFunctionHeader ); + foreach( string line in GrabFunctionBody ) + IOUtils.AddFunctionLine( ref computeBody , line ); + IOUtils.CloseFunctionBody( ref computeBody ); + string functionResult = dataCollector.AddFunctions( GrabFunctionCall , computeBody , screenPos ); + + dataCollector.AddLocalVariable( uniqueId , precision , WirePortDataType.FLOAT4 , GrabScreenPositionStr , functionResult ); + return GrabScreenPositionStr; + } + + // GRAB SCREEN POSITION NORMALIZED + static public string GenerateGrabScreenPositionNormalized( ref MasterNodeDataCollector dataCollector , int uniqueId , PrecisionType precision , bool addInput = true , string customScreenPos = null ) + { + string stringPosVar = GenerateGrabScreenPosition( ref dataCollector, uniqueId, precision, addInput, customScreenPos ); + + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, GrabScreenPositionNormalizedStr, string.Format( NormalizedScreenPosFormat, stringPosVar ) ); + return GrabScreenPositionNormalizedStr; + } + + // SCREEN POSITION ON VERT + static public string GenerateVertexScreenPositionRawForValue( string customVertexPosition , string outputId , ref MasterNodeDataCollector dataCollector , int uniqueId , PrecisionType precision ) + { + // overriding precision + precision = PrecisionType.Float; + + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetScreenPosForValue( precision, customVertexPosition, outputId ); + } + + string screenPosVarName = ScreenPosRawStr + outputId; + if ( !dataCollector.HasLocalVariableByName( screenPosVarName, MasterNodePortCategory.Vertex ) ) + { + string value = string.Format( "ComputeScreenPos( UnityObjectToClipPos( {0} ) )", customVertexPosition ); + dataCollector.AddToVertexLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4, screenPosVarName, value ); + } + return screenPosVarName; + } + + static public string GenerateVertexScreenPositionRaw( ref MasterNodeDataCollector dataCollector , int uniqueId , PrecisionType precision ) + { + // overriding precision + precision = PrecisionType.Float; + + if( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetScreenPosRaw( precision ); + } + + if ( !dataCollector.HasLocalVariableByName( ScreenPosRawStr, MasterNodePortCategory.Vertex ) ) + { + string value = string.Format( "ComputeScreenPos( UnityObjectToClipPos( {0}.vertex ) )", Constants.VertexShaderInputStr ); + dataCollector.AddToVertexLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4, ScreenPosRawStr, value ); + } + return ScreenPosRawStr; + } + + // VERTEX POSITION + static public string GenerateVertexPosition( ref MasterNodeDataCollector dataCollector, int uniqueId, WirePortDataType type, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) + { + // overriding precision + var precision = PrecisionType.Float; + + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetVertexPosition( type, precision ); + } + + MasterNodePortCategory portCategory = useMasterNodeCategory ? dataCollector.PortCategory : customCategory; + string varName = ( type == WirePortDataType.FLOAT3 ) ? VertexPosition3Str : VertexPosition4Str; + string swizzle = ( type == WirePortDataType.FLOAT3 ) ? ".xyz" : string.Empty; + + if ( portCategory == MasterNodePortCategory.Vertex ) + { + if ( !dataCollector.HasLocalVariableByName( varName, MasterNodePortCategory.Vertex ) ) + { + string result = string.Format( "{0}.vertex{1}", Constants.VertexShaderInputStr, swizzle ); + dataCollector.AddToVertexLocalVariables( uniqueId, precision, type, varName, result ); + } + } + else if ( !dataCollector.HasLocalVariableByName( varName ) ) + { + if ( dataCollector.TesselationActive ) + { + dataCollector.AddToInput( -1, SurfaceInputs.WORLD_POS, precision ); + dataCollector.AddToIncludes( uniqueId, Constants.UnityShaderVariables ); + + string positionWS = string.Format( "{0}.worldPos", Constants.InputVarStr ); + string result = string.Format( "mul( unity_WorldToObject, float4( {0}, 1 ) )", positionWS ); + dataCollector.AddLocalVariable( uniqueId, precision, type, varName, result ); + } + else + { + string positionOS = GeneratorUtils.VertexPosition4Str; + string positionOSOutput = string.Format( "{0}.{1}", Constants.VertexShaderOutputStr, positionOS ); + string positionOSInput = string.Format( "{0}.{1}", Constants.InputVarStr, positionOS ); + + dataCollector.AddToInput( uniqueId, positionOS, WirePortDataType.FLOAT4 ); + + if ( !dataCollector.HasLocalVariableByName( positionOS, MasterNodePortCategory.Vertex ) ) + { + dataCollector.AddToVertexLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4, positionOS, + string.Format( "{0}.vertex", Constants.VertexShaderInputStr ) ); + } + dataCollector.AddToVertexLocalVariables( uniqueId, positionOSOutput, positionOS ); + + string result = positionOSInput + swizzle; + dataCollector.AddLocalVariable( uniqueId, precision, type, varName, result ); + } + } + return varName; + } + + // VERTEX NORMAL + static public string GenerateVertexNormal( ref MasterNodeDataCollector dataCollector , int uniqueId , PrecisionType precision ) + { + if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + return dataCollector.TemplateDataCollectorInstance.GetVertexNormal( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + } + + string value = Constants.VertexShaderInputStr + ".normal.xyz"; + if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) + { + GenerateWorldNormal( ref dataCollector , uniqueId ); + dataCollector.AddLocalVariable( uniqueId , precision , WirePortDataType.FLOAT3 , VertexNormalStr , "mul( unity_WorldToObject, float4( " + WorldNormalStr + ", 0 ) )" ); + dataCollector.AddLocalVariable( uniqueId , VertexNormalStr + " = normalize( " + VertexNormalStr + " );" ); + //dataCollector.AddToLocalVariables( uniqueId, precision, WirePortDataType.FLOAT3, VertexNormalStr, "mul( unity_WorldToObject, float4( " + WorldNormalStr + ", 0 ) )" ); + } + else + { + dataCollector.AddLocalVariable( uniqueId , precision , WirePortDataType.FLOAT3 , VertexNormalStr , value ); + } + return VertexNormalStr; + } + + // VERTEX TANGENT + static public string GenerateVertexTangent( ref MasterNodeDataCollector dataCollector , int uniqueId , PrecisionType precision , WirePortDataType size ) + { + if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + return dataCollector.TemplateDataCollectorInstance.GetVertexTangent( size , UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + } + + if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) + { + GenerateWorldTangent( ref dataCollector , uniqueId ); + dataCollector.AddLocalVariable( uniqueId , precision , WirePortDataType.FLOAT4 , VertexTangentStr , "mul( unity_WorldToObject, float4( " + WorldTangentStr + ", 0 ) )" ); + dataCollector.AddLocalVariable( uniqueId , VertexTangentStr +" = normalize( " + VertexTangentStr + " );"); + } + else + { + string value = Constants.VertexShaderInputStr + ".tangent"; + dataCollector.AddLocalVariable( uniqueId , precision , WirePortDataType.FLOAT4 , VertexTangentStr , value ); + } + + return ( size == WirePortDataType.FLOAT4 ) ? VertexTangentStr : VertexTangentStr + ".xyz"; + } + + // VERTEX TANGENT SIGN + static public string GenerateVertexTangentSign( ref MasterNodeDataCollector dataCollector , int uniqueId , PrecisionType precision ) + { + if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + return dataCollector.TemplateDataCollectorInstance.GetTangentSign( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + } + + string value = Constants.VertexShaderInputStr + ".tangent.w"; + if( dataCollector.IsFragmentCategory ) + { + dataCollector.AddToInput( uniqueId , VertexTangentSignStr , WirePortDataType.FLOAT , PrecisionType.Half ); + dataCollector.AddToVertexLocalVariables( uniqueId , Constants.VertexShaderOutputStr + "." + VertexTangentSignStr + " = " + Constants.VertexShaderInputStr + ".tangent.w;" ); + return Constants.InputVarStr + "." + VertexTangentSignStr; + } + else + { + dataCollector.AddLocalVariable( uniqueId , precision , WirePortDataType.FLOAT , VertexTangentSignStr , value ); + } + return VertexTangentSignStr; + } + + // VERTEX BITANGENT + static public string GenerateVertexBitangent( ref MasterNodeDataCollector dataCollector , int uniqueId , PrecisionType precision ) + { + if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) + { + return dataCollector.TemplateDataCollectorInstance.GetVertexBitangent( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); + } + + if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) + { + GenerateWorldBitangent( ref dataCollector , uniqueId ); + dataCollector.AddLocalVariable( uniqueId , precision , WirePortDataType.FLOAT3 , VertexBitangentStr , "mul( unity_WorldToObject, float4( " + WorldBitangentStr + ", 0 ) )" ); + dataCollector.AddLocalVariable( uniqueId , VertexBitangentStr + " = normalize( " + VertexBitangentStr + " );" ); + } + else + { + GenerateVertexNormal( ref dataCollector , uniqueId , precision ); + GenerateVertexTangent( ref dataCollector , uniqueId , precision , WirePortDataType.FLOAT3 ); + dataCollector.AddLocalVariable( uniqueId , precision , WirePortDataType.FLOAT3 , VertexBitangentStr , "cross( " + VertexNormalStr + ", " + VertexTangentStr + ") * " + Constants.VertexShaderInputStr + ".tangent.w * ( unity_WorldTransformParams.w >= 0.0 ? 1.0 : -1.0 )" ); + } + return VertexBitangentStr; + } + + // VERTEX POSITION ON FRAG + static public string GenerateVertexPositionOnFrag( ref MasterNodeDataCollector dataCollector , int uniqueId , PrecisionType precision ) + { + if ( !dataCollector.HasLocalVariableByName( VertexPosition4Str ) ) + { + dataCollector.AddToInput( uniqueId, SurfaceInputs.WORLD_POS ); + dataCollector.AddToIncludes( uniqueId, Constants.UnityShaderVariables ); + + string value = "mul( unity_WorldToObject, float4( " + Constants.InputVarStr + ".worldPos , 1 ) )"; + + dataCollector.AddToLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4, VertexPosition4Str, value ); + + } + return VertexPosition4Str; + } + + // CLIP POSITION ON FRAG + static public string GenerateScreenPositionRawOnFrag( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) + { + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetScreenPosRaw( precision ); + } + + if ( !dataCollector.HasLocalVariableByName( GeneratorUtils.ScreenPosRawStr ) ) + { + dataCollector.AddToInput( uniqueId, SurfaceInputs.SCREEN_POS ); + dataCollector.AddToIncludes( uniqueId, Constants.UnityShaderVariables ); + + string value = string.Format( SurfaceScreenPosFormat, UIUtils.PrecisionWirePortToCgType( precision, WirePortDataType.FLOAT4 ), Constants.InputVarStr ); + dataCollector.AddToLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4, GeneratorUtils.ScreenPosRawStr, value ); + } + return GeneratorUtils.ScreenPosRawStr; + } + + static public string GenerateScreenPositionNormalizedOnFrag( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) + { + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetScreenPosNormalized( precision ); + } + + if ( !dataCollector.HasLocalVariableByName( GeneratorUtils.ScreenPosNormStr ) ) + { + string screenPosRaw = GenerateScreenPositionRawOnFrag( ref dataCollector, uniqueId, precision ); + string clipPlaneTestOp = string.Format( "{0}.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? {0}.z : {0}.z * 0.5 + 0.5;", GeneratorUtils.ScreenPosNormStr ); + dataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT4, GeneratorUtils.ScreenPosNormStr, string.Format( GeneratorUtils.NormalizedScreenPosFormat, screenPosRaw ) ); + dataCollector.AddLocalVariable( -1, clipPlaneTestOp ); + } + return GeneratorUtils.ScreenPosNormStr; + } + + static public string GenerateScreenPositionCenterOnFrag( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) + { + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetScreenPosCenter( precision ); + } + + if ( !dataCollector.HasLocalVariableByName( GeneratorUtils.ScreenPosCenterStr ) ) + { + string screenPosNorm = GenerateScreenPositionNormalizedOnFrag( ref dataCollector, uniqueId, precision ); + string value = string.Format( "float4( {0}.xy * 2 - 1, 0, 0 )", screenPosNorm ); + dataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT4, GeneratorUtils.ScreenPosCenterStr, value ); + } + return GeneratorUtils.ScreenPosCenterStr; + } + + static public string GenerateScreenPositionTiledOnFrag( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) + { + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetScreenPosTiled( precision ); + } + + if ( !dataCollector.HasLocalVariableByName( GeneratorUtils.ScreenPosTiledStr ) ) + { + string screenPosNorm = GenerateScreenPositionNormalizedOnFrag( ref dataCollector, uniqueId, precision ); + string value = string.Format( "frac( float4( ( {0}.x * 2 - 1 ) * _ScreenParams.x / _ScreenParams.y, {0}.y * 2 - 1, 0, 0 ) )", screenPosNorm ); + dataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT4, GeneratorUtils.ScreenPosTiledStr, value ); + } + return GeneratorUtils.ScreenPosTiledStr; + } + + static public string GenerateScreenPositionPixelOnFrag( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) + { + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetScreenPosPixel( precision ); + } + + if ( !dataCollector.HasLocalVariableByName( GeneratorUtils.ScreenPosPixelStr ) ) + { + string screenPosNorm = GenerateScreenPositionNormalizedOnFrag( ref dataCollector, uniqueId, precision ); + GeneratorUtils.GenerateScreenPosNormToPixelFunction( ref dataCollector ); + dataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT4, GeneratorUtils.ScreenPosPixelStr, GeneratorUtils.GenerateScreenPosNormToPixelFunctionCall( screenPosNorm ) ); + } + return GeneratorUtils.ScreenPosPixelStr; + } + + // VIEW DIRECTION + static public string GenerateViewVector( ref MasterNodeDataCollector dataCollector, int uniqueId, ViewSpace space = ViewSpace.World ) + { + PrecisionType precision = UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision; + if ( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetViewVector( precisionType: precision, space: space ); + } + + string varName; + switch ( space ) + { + case ViewSpace.Tangent: varName = GeneratorUtils.TangentViewVectorStr; break; + case ViewSpace.Object: varName = GeneratorUtils.ObjectViewVectorStr; break; + case ViewSpace.View: varName = GeneratorUtils.ViewViewVectorStr; break; + case ViewSpace.World: + default: varName = GeneratorUtils.WorldViewVectorStr; break; + } + + if ( !dataCollector.HasLocalVariableByName( varName ) ) + { + string worldPos = GenerateWorldPosition( ref dataCollector, uniqueId ); + string viewVectorWS = "( _WorldSpaceCameraPos.xyz - " + worldPos + " )"; + + string viewDir; + if ( space == ViewSpace.Tangent ) + { + viewDir = "mul( " + GenerateWorldToTangentMatrix( ref dataCollector, uniqueId, precision ) + ", " + viewVectorWS + " )"; + } + else if ( space == ViewSpace.Object ) + { + viewDir = "mul( ( float3x3 )unity_WorldToObject, " + viewVectorWS + " )"; + } + else if ( space == ViewSpace.View ) + { + viewDir = "mul( ( float3x3 )UNITY_MATRIX_V, " + viewVectorWS + " )"; + } + else + { + viewDir = viewVectorWS; + } + + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, varName, viewDir ); + } + return varName; + } + + static public string GenerateViewDirection( ref MasterNodeDataCollector dataCollector, int uniqueId, NormalizeType normalizeType = NormalizeType.Regular, ViewSpace space = ViewSpace.World ) + { + PrecisionType precision = UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision; + if( dataCollector.IsTemplate ) + { + return dataCollector.TemplateDataCollectorInstance.GetViewDir( precisionType: precision, normalizeType: normalizeType, space: space ); + } + + string varName; + switch ( space ) + { + case ViewSpace.Tangent: varName = ( normalizeType == NormalizeType.Regular ) ? GeneratorUtils.TangentViewDirectionStr : GeneratorUtils.TangentViewDirectionSafeStr; break; + case ViewSpace.Object: varName = ( normalizeType == NormalizeType.Regular ) ? GeneratorUtils.ObjectViewDirectionStr : GeneratorUtils.ObjectViewDirectionSafeStr; break; + case ViewSpace.View: varName = ( normalizeType == NormalizeType.Regular ) ? GeneratorUtils.ViewViewDirectionStr : GeneratorUtils.ViewViewDirectionSafeStr; break; + case ViewSpace.World: + default: varName = ( normalizeType == NormalizeType.Regular ) ? GeneratorUtils.WorldViewDirectionStr : GeneratorUtils.WorldViewDirectionSafeStr; break; + } + + if ( !dataCollector.HasLocalVariableByName( varName ) ) + { + string viewVector = GenerateViewVector( ref dataCollector, uniqueId, space ); + + if ( normalizeType == NormalizeType.Regular ) + { + viewVector = "normalize( " + viewVector + " )"; + } + else if ( normalizeType == NormalizeType.Safe ) + { + viewVector = TemplateHelperFunctions.SafeNormalize( dataCollector, viewVector ); + } + + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, varName, viewVector ); + } + return varName; + } + + const string FaceVertexInstr = "(dot({0},float3(0,0,1)))"; + static public string GenerateVertexFace( ref MasterNodeDataCollector dataCollector , int uniqueId ) + { + string viewDir = GenerateViewDirection( ref dataCollector, uniqueId, space: ViewSpace.Tangent ); + dataCollector.AddLocalVariable( -1, PrecisionType.Float, WirePortDataType.FLOAT, FaceVertex, string.Format( FaceVertexInstr, viewDir ) ); + return FaceVertex; + + } + // VIEW POS + static public string GenerateViewPositionOnFrag( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) + { + // overriding precision + precision = PrecisionType.Float; + + if( dataCollector.IsTemplate ) + UnityEngine.Debug.LogWarning( "View Pos not implemented on Templates" ); + + string vertexName = GenerateVertexPositionOnFrag( ref dataCollector, uniqueId, precision ); + string value = string.Format( "UnityObjectToViewPos( {0} )", vertexName ); + dataCollector.AddToLocalVariables( uniqueId, precision, WirePortDataType.FLOAT3, ViewPositionStr, value ); + return ViewPositionStr; + } + + // SCREEN DEPTH + static public string GenerateScreenDepthOnFrag( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) + { + // overriding precision + precision = PrecisionType.Float; + + if( dataCollector.IsTemplate ) + UnityEngine.Debug.LogWarning( "Screen Depth not implemented on Templates" ); + + string viewPos = GenerateViewPositionOnFrag( ref dataCollector, uniqueId, precision ); + string value = string.Format( "-{0}.z", viewPos ); + dataCollector.AddToLocalVariables( uniqueId, precision, WirePortDataType.FLOAT, ScreenDepthStr, value ); + return ScreenDepthStr; + } + + // LIGHT DIRECTION WORLD + static public string GenerateWorldLightDirection( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) + { + dataCollector.AddToIncludes( uniqueId, Constants.UnityCgLibFuncs ); + string worldPos = GeneratorUtils.GenerateWorldPosition( ref dataCollector, uniqueId ); + dataCollector.AddLocalVariable( uniqueId, "#if defined(LIGHTMAP_ON) && UNITY_VERSION < 560 //aseld" ); + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, WorldLightDirStr, "0" ); + dataCollector.AddLocalVariable( uniqueId, "#else //aseld" ); + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, WorldLightDirStr, ( dataCollector.SafeNormalizeLightDir ? "Unity_SafeNormalize" : "normalize" ) + "( UnityWorldSpaceLightDir( " + worldPos + " ) )" ); + dataCollector.AddLocalVariable( uniqueId, "#endif //aseld" ); + return WorldLightDirStr; + } + + private static readonly string[] SafeNormalize = + { + "float{0} ASESafeNormalize(float{0} inVec)\n", + "{\n", + "\tfloat dp3 = max(1.175494351e-38, dot(inVec, inVec));\n", + "\treturn inVec* rsqrt(dp3);\n", + "}\n", + }; + + private static readonly string ASEUnpackNormalRGBCall = "ASEUnpackNormalRGB({0},{1})"; + private static readonly string[] ASEUnpackNormalRGB = + { + "float3 ASEUnpackNormalRGB(float4 PackedNormal, float Scale = 1.0 )\n", + "{\n", + "\tfloat3 normal;\n", + "\tnormal.xyz = PackedNormal.rgb * 2.0 - 1.0;\n", + "\tnormal.xy *= Scale;\n", + "\treturn normal;\n", + "}\n" + }; + + static public string NormalizeValue( ref MasterNodeDataCollector dataCollector , bool safeNormalize , WirePortDataType dataType, string value ) + { + string normalizeInstruction = string.Empty; + if( safeNormalize ) + { + string[] finalFunction = null; + string[] funcVersion = SafeNormalize; + + finalFunction = new string[ funcVersion.Length ]; + + switch( dataType ) + { + case WirePortDataType.FLOAT: + finalFunction[0] = string.Format( funcVersion[ 0 ] , string.Empty ); + break; + case WirePortDataType.FLOAT2: + finalFunction[ 0 ] = string.Format( funcVersion[ 0 ] , "2" ); + break; + case WirePortDataType.FLOAT3: + finalFunction[ 0 ] = string.Format( funcVersion[ 0 ] , "3" ); + break; + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + finalFunction[ 0 ] = string.Format( funcVersion[ 0 ] , "4" ); + break; + default: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + case WirePortDataType.INT: + case WirePortDataType.OBJECT: + case WirePortDataType.SAMPLER1D: + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.UINT: + case WirePortDataType.UINT4: + case WirePortDataType.SAMPLER2DARRAY: + case WirePortDataType.SAMPLERSTATE:return value; + } + + for( int i = 1 ; i < funcVersion.Length ; i++ ) + { + finalFunction[ i ] = funcVersion[ i ]; + } + dataCollector.AddFunction( finalFunction[ 0 ] , finalFunction , false ); + normalizeInstruction = "ASESafeNormalize"; + } + else + { + normalizeInstruction = "normalize"; + } + + return normalizeInstruction = normalizeInstruction + "( " + value + " )"; + + } + // LIGHT DIRECTION Object + static public string GenerateObjectLightDirection( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, string vertexPos ) + { + dataCollector.AddToIncludes( uniqueId, Constants.UnityCgLibFuncs ); + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, ObjectLightDirStr, "normalize( ObjSpaceLightDir( " + vertexPos + " ) )" ); + return ObjectLightDirStr; + } + + // UNPACK NORMALS + public static string GenerateUnpackNormalStr( ref MasterNodeDataCollector dataCollector, PrecisionType precision, int uniqueId, string outputId, string src, bool applyScale, string scale, UnpackInputMode inputMode ) + { + string funcName; + + if( inputMode == UnpackInputMode.Object ) + { + dataCollector.AddFunction( ASEUnpackNormalRGB[ 0 ] , ASEUnpackNormalRGB , false ); + return string.Format( ASEUnpackNormalRGBCall, src , scale ); + } + + if( dataCollector.IsTemplate && dataCollector.IsSRP ) + { + if( applyScale ) + { + dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, "unpack" + outputId, "UnpackNormalScale( " + src + ", " + scale + " )" ); + dataCollector.AddLocalVariable( uniqueId, "unpack" + outputId + ".z = lerp( 1, unpack" + outputId + ".z, saturate(" + scale + ") );" ); + funcName = "unpack" + outputId; + } + else + { + funcName = "UnpackNormalScale( " + src + ", " + scale + " )"; + } + } + else + { + funcName = applyScale ? "UnpackScaleNormal( " + src + ", " + scale + " )" : "UnpackNormal( " + src + " )"; + } + return funcName; + } + + //MATRIX INVERSE + // 3x3 + public static string Inverse3x3Header = "Inverse3x3( {0} )"; + public static string[] Inverse3x3Function = + { + "{0}3x3 Inverse3x3({0}3x3 input)\n", + "{\n", + "\t{0}3 a = input._11_21_31;\n", + "\t{0}3 b = input._12_22_32;\n", + "\t{0}3 c = input._13_23_33;\n", + "\treturn {0}3x3(cross(b,c), cross(c,a), cross(a,b)) * (1.0 / dot(a,cross(b,c)));\n", + "}\n" + }; + + public static bool[] Inverse3x3FunctionFlags = + { + true, + false, + true, + true, + true, + true, + false + }; + + public static void Add3x3InverseFunction( ref MasterNodeDataCollector dataCollector, string precisionString ) + { + if( !dataCollector.HasFunction( Inverse3x3Header ) ) + { + //Hack to be used util indent is properly used + int currIndent = UIUtils.ShaderIndentLevel; + if( dataCollector.IsTemplate ) + { + UIUtils.ShaderIndentLevel = 0; + } + else + { + UIUtils.ShaderIndentLevel = 1; + UIUtils.ShaderIndentLevel++; + } + string finalFunction = string.Empty; + for( int i = 0; i < Inverse3x3Function.Length; i++ ) + { + finalFunction += UIUtils.ShaderIndentTabs + ( Inverse3x3FunctionFlags[ i ] ? string.Format( Inverse3x3Function[ i ], precisionString ) : Inverse3x3Function[ i ] ); + } + + + UIUtils.ShaderIndentLevel = currIndent; + + dataCollector.AddFunction( Inverse3x3Header, finalFunction ); + } + } + + public static string GenerateValueInVertex( ref MasterNodeDataCollector dataCollector, int uniqueId, WirePortDataType dataType, PrecisionType currentPrecisionType, string dataValue, string dataName, bool createInterpolator ) + { + if( !dataCollector.IsFragmentCategory ) + return dataValue; + + //TEMPLATES + if( dataCollector.IsTemplate ) + { + if( createInterpolator && dataCollector.TemplateDataCollectorInstance.HasCustomInterpolatedData( dataName ) ) + return dataName; + + MasterNodePortCategory category = dataCollector.PortCategory; + dataCollector.PortCategory = MasterNodePortCategory.Vertex; + + dataCollector.PortCategory = category; + + if( createInterpolator ) + { + dataCollector.TemplateDataCollectorInstance.RegisterCustomInterpolatedData( dataName, dataType, currentPrecisionType, dataValue ); + } + else + { + dataCollector.AddToVertexLocalVariables( -1, currentPrecisionType, dataType, dataName, dataValue ); + } + + return dataName; + } + + //SURFACE + { + if( dataCollector.TesselationActive ) + { + UIUtils.ShowMessage( "Unable to use Vertex to Frag when Tessellation is active" ); + switch( dataType ) + { + case WirePortDataType.FLOAT2: + { + return "(0).xx"; + } + case WirePortDataType.FLOAT3: + { + return "(0).xxx"; + } + case WirePortDataType.FLOAT4: + case WirePortDataType.COLOR: + { + return "(0).xxxx"; + } + } + return "0"; + } + + if( createInterpolator ) + dataCollector.AddToInput( uniqueId, dataName, dataType, currentPrecisionType ); + + MasterNodePortCategory portCategory = dataCollector.PortCategory; + dataCollector.PortCategory = MasterNodePortCategory.Vertex; + if( createInterpolator ) + { + dataCollector.AddLocalVariable( uniqueId, Constants.VertexShaderOutputStr + "." + dataName, dataValue + ";" ); + } + else + { + dataCollector.AddLocalVariable( uniqueId, currentPrecisionType, dataType, dataName, dataValue ); + } + dataCollector.PortCategory = portCategory; + return createInterpolator ? Constants.InputVarStr + "." + dataName : dataName; + } + } + + public static void AddCustomStandardSamplingMacros( ref MasterNodeDataCollector dataCollector, TextureType type, MipType mip ) + { + AddCustomStandardSamplingMacros( ref dataCollector, Constants.TextureToWire[ type ], mip ); + } + + public static void AddCustomStandardSamplingMacros( ref MasterNodeDataCollector dataCollector, WirePortDataType type, MipType mip ) + { + MacrosMask result = MacrosMask.NONE; + switch( mip ) + { + default: + case MipType.Auto: + result |= MacrosMask.AUTO; + break; + case MipType.MipLevel: + result |= MacrosMask.LOD; + break; + case MipType.MipBias: + result |= MacrosMask.BIAS; + break; + case MipType.Derivative: + result |= MacrosMask.GRAD; + break; + } + + switch( type ) + { + default: + case WirePortDataType.SAMPLER2D: + dataCollector.Using2DMacrosMask |= result; + break; + case WirePortDataType.SAMPLER3D: + dataCollector.Using3DMacrosMask |= result; + break; + case WirePortDataType.SAMPLERCUBE: + dataCollector.UsingCUBEMacrosMask |= result; + break; + case WirePortDataType.SAMPLER2DARRAY: + dataCollector.Using2DArrayMacrosMask |= result; + break; + } + } + + public static void AddCustom3DSRPMacros( ref MasterNodeDataCollector dataCollector ) + { + // add just once + if( dataCollector.UsingExtra3DSRPMacros ) + return; + + dataCollector.UsingExtra3DSRPMacros = true; + for( int i = 0; i < Constants.CustomSRPSamplingMacros.Length; i++ ) + dataCollector.AddToDirectives( Constants.CustomSRPSamplingMacros[ i ] ); + } + + public static void AddCustomArraySamplingMacros( ref MasterNodeDataCollector dataCollector ) + { + // add just once + if( dataCollector.UsingArrayDerivatives ) + return; + + dataCollector.UsingArrayDerivatives = true; + for( int i = 0; i < Constants.CustomArraySamplingMacros.Length; i++ ) + dataCollector.AddToDirectives( Constants.CustomArraySamplingMacros[ i ] ); + } + + /*public static void AddCustomASEMacros( ref MasterNodeDataCollector dataCollector ) + { + string varPrefix = dataCollector.IsSRP ? varPrefix = "TEXTURE" : "UNITY_DECLARE_TEX"; + + if( dataCollector.IsSRP ) + { + for( int i = 0; i < Constants.CustomASESRPArgsMacros.Length; i++ ) + { + dataCollector.AddToDirectives( Constants.CustomASESRPArgsMacros[ i ] ); + } + + for( int i = 0; i < Constants.CustomSRPSamplingMacros.Length; i++ ) + { + dataCollector.AddToDirectives( Constants.CustomSRPSamplingMacros[ i ] ); + } + } + else + { + + for( int i = 0; i < Constants.CustomASEStandardArgsMacros.Length; i++ ) + { + dataCollector.AddToDirectives( Constants.CustomASEStandardArgsMacros[ i ] ); + } + + for( int i = 0; i < Constants.CustomStandardSamplingMacros.Length; i++ ) + { + dataCollector.AddToDirectives( Constants.CustomStandardSamplingMacros[ i ] ); + } + } + + for( int i = 0; i < Constants.CustomASEDeclararionMacros.Length; i++ ) + { + string value = string.Format( Constants.CustomASEDeclararionMacros[ i ], varPrefix ); + dataCollector.AddToDirectives( value ); + } + + string samplePrefix = string.Empty; + string samplerArgs = string.Empty; + string samplerDecl = string.Empty; + + if( dataCollector.IsSRP ) + { + samplePrefix = "SAMPLE_TEXTURE"; + samplerArgs = "samplerName,"; + + for( int i = 0; i < Constants.CustomASESamplingMacros.Length; i++ ) + { + string value = string.Format( Constants.CustomASESamplingMacros[ i ], samplerArgs, samplePrefix, samplerDecl ); + dataCollector.AddToDirectives( value ); + } + } + else + { + samplePrefix = "UNITY_SAMPLE_TEX"; + samplerArgs = "samplerName,"; + samplerDecl = "_SAMPLER"; + dataCollector.AddToDirectives( Constants.CustomASEStandarSamplingMacrosHelper[ 0 ] ); + for( int i = 0; i < Constants.CustomASESamplingMacros.Length; i++ ) + { + string value = string.Format( Constants.CustomASESamplingMacros[ i ], samplerArgs, samplePrefix, samplerDecl ); + dataCollector.AddToDirectives( value ); + } + dataCollector.AddToDirectives( Constants.CustomASEStandarSamplingMacrosHelper[ 1 ] ); + samplerArgs = string.Empty; + samplerDecl = string.Empty; + for( int i = 0; i < Constants.CustomASESamplingMacros.Length; i++ ) + { + string value = string.Format( Constants.CustomASESamplingMacros[ i ], samplerArgs, samplePrefix, samplerDecl ); + dataCollector.AddToDirectives( value ); + } + dataCollector.AddToDirectives( Constants.CustomASEStandarSamplingMacrosHelper[ 2 ] ); + } + }*/ + + public static void RegisterUnity2019MatrixDefines( ref MasterNodeDataCollector dataCollector ) + { + if( dataCollector.IsSRP && dataCollector.TemplateDataCollectorInstance.IsHDRP ) + { + //dataCollector.AddToDefines( -1, "unity_CameraProjection UNITY_MATRIX_P" ); + //dataCollector.AddToDefines( -1, "unity_CameraInvProjection UNITY_MATRIX_I_P" ); + //dataCollector.AddToDefines( -1, "unity_WorldToCamera UNITY_MATRIX_V" ); + //dataCollector.AddToDefines( -1, "unity_CameraToWorld UNITY_MATRIX_I_V" ); + + dataCollector.AddToUniforms( -1, "float4x4 unity_CameraProjection;" ); + dataCollector.AddToUniforms( -1, "float4x4 unity_CameraInvProjection;" ); + dataCollector.AddToUniforms( -1, "float4x4 unity_WorldToCamera;" ); + dataCollector.AddToUniforms( -1, "float4x4 unity_CameraToWorld;" ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs.meta new file mode 100644 index 00000000..2ecfe94a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7ab31d77d200c7a4ca43f4bf159de6b3 +timeCreated: 1490798546 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs new file mode 100644 index 00000000..3a699c60 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs @@ -0,0 +1,117 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEditor; +using UnityEngine; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + public enum MessageSeverity + { + Normal, + Warning, + Error + } + public class GenericMessageData + { + public string message; + public MessageSeverity severity; + public bool console; + public GenericMessageData( string msg, MessageSeverity svrty, bool csle ) + { + message = msg; + severity = svrty; + console = csle; + } + } + + class GenericMessageUI + { + public delegate void OnMessageDisplay( string message, MessageSeverity severity, bool console ); + public event OnMessageDisplay OnMessageDisplayEvent; + + private const double MESSAGE_TIME = 2; + private double m_currentMessageStartTime; + private Queue m_messageQueue; + private bool m_displayingMessage; + + public GenericMessageUI() + { + m_messageQueue = new Queue(); + m_displayingMessage = false; + m_currentMessageStartTime = EditorApplication.timeSinceStartup; + } + + public void Destroy() + { + m_messageQueue.Clear(); + OnMessageDisplayEvent = null; + } + + public void AddToQueue( string message, MessageSeverity severity, bool console ) + { + m_messageQueue.Enqueue( new GenericMessageData( message, severity, console ) ); + } + + public void Log( string message ) + { + m_messageQueue.Enqueue( new GenericMessageData( message, MessageSeverity.Normal, true ) ); + Debug.Log( message ); + } + + public void LogError( string message ) + { + m_messageQueue.Enqueue( new GenericMessageData( message, MessageSeverity.Error, true ) ); + Debug.LogError( message ); + } + + public void LogWarning( string message ) + { + m_messageQueue.Enqueue( new GenericMessageData( message, MessageSeverity.Warning, true ) ); + Debug.LogWarning( message ); + } + + public void CheckForMessages() + { + if ( m_displayingMessage ) + { + double timeLeft = EditorApplication.timeSinceStartup - m_currentMessageStartTime; + if ( timeLeft > MESSAGE_TIME ) + { + m_displayingMessage = false; + } + } + + if ( !m_displayingMessage ) + { + if ( m_messageQueue.Count > 0 ) + { + m_displayingMessage = true; + GenericMessageData data = m_messageQueue.Dequeue(); + m_currentMessageStartTime = EditorApplication.timeSinceStartup; + + if ( OnMessageDisplayEvent != null ) + OnMessageDisplayEvent( data.message, data.severity, data.console ); + } + } + } + + public void CleanUpMessageStack() + { + m_displayingMessage = false; + m_messageQueue.Clear(); + } + + public void StartMessageCounter() + { + m_displayingMessage = true; + m_currentMessageStartTime = EditorApplication.timeSinceStartup; + } + + public bool DisplayingMessage + { + get { return ( m_displayingMessage || m_messageQueue.Count > 0 ); } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs.meta new file mode 100644 index 00000000..7547efea --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 87cfef50a69ad24479fb8b472dac6d6e +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs new file mode 100644 index 00000000..76730325 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs @@ -0,0 +1,1056 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.IO; +using System.Security.Cryptography; +using System.Collections.Generic; +using System.Reflection; +using System.Linq; +using UnityEngine; +using UnityEditor; +using UnityEditor.Build; +using System.Threading; +using UnityEditor.VersionControl; +using System.Text.RegularExpressions; + +namespace AmplifyShaderEditor +{ + public enum ShaderLoadResult + { + LOADED, + TEMPLATE_LOADED, + FILE_NOT_FOUND, + ASE_INFO_NOT_FOUND, + UNITY_NATIVE_PATHS + } + + public class Worker + { + public static readonly object locker = new object(); + public void DoWork() + { + while( IOUtils.ActiveThread ) + { + if( IOUtils.SaveInThreadFlag ) + { + IOUtils.SaveInThreadFlag = false; + lock( locker ) + { + IOUtils.SaveInThreadShaderBody = string.Format( IOUtils.ShaderCopywriteMessage, VersionInfo.StaticToString() ) + IOUtils.SaveInThreadShaderBody; + // Add checksum + string checksum = IOUtils.CreateChecksum( IOUtils.SaveInThreadShaderBody ); + IOUtils.SaveInThreadShaderBody += IOUtils.CHECKSUM + IOUtils.VALUE_SEPARATOR + checksum; + + // Write to disk + StreamWriter fileWriter = new StreamWriter( IOUtils.SaveInThreadPathName ); + try + { + fileWriter.Write( IOUtils.SaveInThreadShaderBody ); + Debug.Log( "Saving complete" ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + finally + { + fileWriter.Close(); + } + } + } + } + Debug.Log( "Thread closed" ); + } + } + + public static class IOUtils + { + public delegate void OnShaderAction( Shader shader , bool isTemplate , string type ); + public static OnShaderAction OnShaderSavedEvent; + public static OnShaderAction OnShaderTypeChangedEvent; + + public static readonly string ShaderCopywriteMessage = "// Made with Amplify Shader Editor v{0}\n// Available at the Unity Asset Store - http://u3d.as/y3X \n"; + public static readonly string GrabPassEmpty = "\t\tGrabPass{ }\n"; + public static readonly string GrabPassBegin = "\t\tGrabPass{ \""; + public static readonly string GrabPassEnd = "\" }\n"; + public static readonly string PropertiesBegin = "\tProperties\n\t{\n"; + public static readonly string PropertiesEnd = "\t}\n"; + public static readonly string PropertiesElement = "\t\t{0}\n"; + public static readonly string PropertiesElementsRaw = "{0}\n"; + + public static readonly string PragmaTargetHeader = "\t\t#pragma target {0}\n"; + public static readonly string InstancedPropertiesHeader = "multi_compile_instancing"; + public static readonly string VirtualTexturePragmaHeader = "multi_compile _ _VT_SINGLE_MODE"; + + public static readonly string InstancedPropertiesBegin = "UNITY_INSTANCING_CBUFFER_START({0})"; + public static readonly string InstancedPropertiesEnd = "UNITY_INSTANCING_CBUFFER_END"; + public static readonly string InstancedPropertiesElement = "UNITY_DEFINE_INSTANCED_PROP({0}, {1})"; + public static readonly string InstancedPropertiesData = "UNITY_ACCESS_INSTANCED_PROP({0})"; + + public static readonly string DotsInstancedPropertiesData = "\tUNITY_DOTS_INSTANCED_PROP({0}, {1})"; + public static string DotsInstancedDefinesData + { + get + { + if ( ASEPackageManagerHelper.PackageSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_13 ) + { + return "#define {1} UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT({0} , {1})"; + } + else if ( ASEPackageManagerHelper.PackageSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_12 ) + { + return "#define {1} UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO({0} , Metadata{1})"; + } + else + { + return "#define {1} UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO({0} , Metadata_{1})"; + } + } + } + + public static readonly string LWSRPInstancedPropertiesBegin = "UNITY_INSTANCING_BUFFER_START({0})"; + public static readonly string LWSRPInstancedPropertiesEnd = "UNITY_INSTANCING_BUFFER_END({0})"; + public static readonly string LWSRPInstancedPropertiesElement = "UNITY_DEFINE_INSTANCED_PROP({0}, {1})"; + public static readonly string LWSRPInstancedPropertiesData = "UNITY_ACCESS_INSTANCED_PROP({0},{1})"; + + public static readonly string SRPCBufferPropertiesBegin = "CBUFFER_START( UnityPerMaterial )";//"CBUFFER_START({0})"; + public static readonly string SRPCBufferPropertiesEnd = "CBUFFER_END"; + + + public static readonly string InstancedPropertiesBeginTabs = "\t\t" + InstancedPropertiesBegin + "\n"; + public static readonly string InstancedPropertiesEndTabs = "\t\t" + InstancedPropertiesEnd + "\n"; + public static readonly string InstancedPropertiesElementTabs = "\t\t\t" + InstancedPropertiesElement + "\n"; + + public static readonly string MetaBegin = "defaultTextures:"; + public static readonly string MetaEnd = "userData:"; + public static readonly string ShaderBodyBegin = "/*ASEBEGIN"; + public static readonly string ShaderBodyEnd = "ASEEND*/"; + //public static readonly float CurrentVersionFlt = 0.4f; + //public static readonly string CurrentVersionStr = "Version=" + CurrentVersionFlt; + + public static readonly string CHECKSUM = "//CHKSM"; + public static readonly string LAST_OPENED_OBJ_ID = "ASELASTOPENOBJID"; + + public static readonly string MAT_CLIPBOARD_ID = "ASEMATCLIPBRDID"; + public static readonly char FIELD_SEPARATOR = ';'; + public static readonly char VALUE_SEPARATOR = '='; + public static readonly char LINE_TERMINATOR = '\n'; + public static readonly char VECTOR_SEPARATOR = ','; + public static readonly char FLOAT_SEPARATOR = '.'; + public static readonly char CLIPBOARD_DATA_SEPARATOR = '|'; + public static readonly char MATRIX_DATA_SEPARATOR = '|'; + public readonly static string NO_TEXTURES = ""; + public static readonly string SaveShaderStr = "Please enter shader name to save"; + public static readonly string FloatifyStr = ".0"; + + // Node parameter names + public const string NodeParam = "Node"; + public const string NodePosition = "Position"; + public const string NodeId = "Id"; + public const string NodeType = "Type"; + public const string WireConnectionParam = "WireConnection"; + + public static readonly uint NodeTypeId = 1; + + public static readonly int InNodeId = 1; + public static readonly int InPortId = 2; + public static readonly int OutNodeId = 3; + public static readonly int OutPortId = 4; + + public readonly static string DefaultASEDirtyCheckName = "__dirty"; + public readonly static string DefaultASEDirtyCheckProperty = "[HideInInspector] " + DefaultASEDirtyCheckName + "( \"\", Int ) = 1"; + public readonly static string DefaultASEDirtyCheckUniform = "uniform int " + DefaultASEDirtyCheckName + " = 1;"; + + public readonly static string MaskClipValueName = "_Cutoff"; + public readonly static string MaskClipValueProperty = MaskClipValueName + "( \"{0}\", Float ) = {1}"; + public readonly static string MaskClipValueUniform = "uniform float " + MaskClipValueName + " = {0};"; + + public readonly static string ChromaticAberrationProperty = "_ChromaticAberration"; + + //public static readonly string ASEFolderGUID = "daca988099666ec40aaa2cde22bb4935"; + //public static string ASEResourcesPath = "/Plugins/EditorResources/"; + //public static string ASEFolderPath; + + //public static bool IsShaderFunctionWindow = false; + + + public static int DefaultASEDirtyCheckId; + + // this is to be used in combination with AssetDatabase.GetAssetPath, both of these include the Assets/ path so we need to remove from one of them + public static string dataPath; + + + public static string EditorResourcesGUID = "0932db7ec1402c2489679c4b72eab5eb"; + public static string GraphBgTextureGUID = "881c304491028ea48b5027ac6c62cf73"; + public static string GraphFgTextureGUID = "8c4a7fca2884fab419769ccc0355c0c1"; + public static string WireTextureGUID = "06e687f68dd96f0448c6d8217bbcf608"; + public static string MasterNodeOnTextureGUID = "26c64fcee91024a49980ea2ee9d1a2fb"; + public static string MasterNodeOffTextureGUID = "712aee08d999c16438e2d694f42428e8"; + public static string GPUInstancedOnTextureGUID = "4b0c2926cc71c5846ae2a29652d54fb6"; + public static string GPUInstancedOffTextureGUID = "486c7766baaf21b46afb63c1121ef03e"; + public static string MainSkinGUID = "57482289c346f104a8162a3a79aaff9d"; + + public static string UpdateOutdatedGUID = "cce638be049286c41bcbd0a26c356b18"; + public static string UpdateOFFGUID = "99d70ac09b4db9742b404c3f92d8564b"; + public static string UpdateUpToDatedGUID = "ce30b12fbb3223746bcfef9ea82effe3"; + public static string LiveOffGUID = "bb16faf366bcc6c4fbf0d7666b105354"; + public static string LiveOnGUID = "6a0ae1d7892333142aeb09585572202c"; + public static string LivePendingGUID = "e3182200efb67114eb5050f8955e1746"; + public static string CleanupOFFGUID = "f62c0c3a5ddcd844e905fb2632fdcb15"; + public static string CleanUpOnGUID = "615d853995cf2344d8641fd19cb09b5d"; + public static string TakeScreenshotOFFGUID = "7587de2e3bec8bf4d973109524ccc6b1"; + public static string TakeScreenshotONGUID = "7587de2e3bec8bf4d973109524ccc6b1"; + public static string ShareOFFGUID = "bc5bd469748466a459badfab23915cb0"; + public static string ShareONGUID = "bc5bd469748466a459badfab23915cb0"; + public static string OpenSourceCodeOFFGUID = "f7e8834b42791124095a8b7f2d4daac2"; + public static string OpenSourceCodeONGUID = "8b114792ff84f6546880c031eda42bc0"; + public static string FocusNodeGUID = "da673e6179c67d346abb220a6935e359"; + public static string FitViewGUID = "1def740f2314c6b4691529cadeee2e9c"; + public static string ShowInfoWindowGUID = "77af20044e9766840a6be568806dc22e"; + public static string ShowTipsWindowGUID = "066674048bbb1e64e8cdcc6c3b4abbeb"; + public static string ShowConsoleWindowGUID = "9a81d7df8e62c044a9d1cada0c8a2131"; + + + public static Dictionary NodeTypeReplacer = new Dictionary() + { + {"AmplifyShaderEditor.RotateAboutAxis", "AmplifyShaderEditor.RotateAboutAxisNode"}, + {"GlobalArrayNode", "AmplifyShaderEditor.GlobalArrayNode"}, + {"AmplifyShaderEditor.SimpleMaxOp", "AmplifyShaderEditor.SimpleMaxOpNode"}, + {"AmplifyShaderEditor.SimpleMinNode", "AmplifyShaderEditor.SimpleMinOpNode"}, + {"AmplifyShaderEditor.TFHCRemap", "AmplifyShaderEditor.TFHCRemapNode"}, + {"AmplifyShaderEditor.TFHCPixelateUV", "AmplifyShaderEditor.TFHCPixelate"}, + {"AmplifyShaderEditor.VirtualTexturePropertyNode", "AmplifyShaderEditor.VirtualTextureObject"} + }; + + private static readonly string AmplifyShaderEditorDefineSymbol = "AMPLIFY_SHADER_EDITOR"; + + ///////////////////////////////////////////////////////////////////////////// + // THREAD IO UTILS + public static bool SaveInThreadFlag = false; + public static string SaveInThreadShaderBody; + public static string SaveInThreadPathName; + public static Thread SaveInThreadMainThread; + public static bool ActiveThread = true; + private static bool UseSaveThread = false; + + private static bool Initialized = false; + + public static bool FunctionNodeChanged = false; + + public static List AllOpenedWindows = new List(); + + public static Type[] GetTypesInNamespace( Assembly assembly , string nameSpace ) + { + return assembly.GetTypes().Where( t => String.Equals( t.Namespace , nameSpace , StringComparison.Ordinal ) ).ToArray(); + } + + public static List LoadedAssemblies; + + public static Type[] GetAssemblyTypesArray() + { + Type[] availableTypes = null; + if( LoadedAssemblies == null ) + { + LoadedAssemblies = new List(); + try + { + UnityEditor.Compilation.Assembly[] assemblies = UnityEditor.Compilation.CompilationPipeline.GetAssemblies( UnityEditor.Compilation.AssembliesType.Editor ); + for( int i = 0 ; i < assemblies.Length ; i++ ) + { + if( !assemblies[ i ].name.StartsWith( "Unity" ) && !assemblies[ i ].name.Equals( "AmplifyShaderEditor" ) ) + { + Assembly assembly = Assembly.Load( assemblies[ i ].name ); + LoadedAssemblies.Add( assembly ); + Type[] extraTypes = GetTypesInNamespace( assembly , "AmplifyShaderEditor" ); + if( extraTypes.Length > 0 ) + { + availableTypes = ( availableTypes == null ) ? extraTypes : availableTypes.Concat( extraTypes ).ToArray(); + } + } + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + else + { + int count = LoadedAssemblies.Count; + for( int i = 0 ; i < count ; i++ ) + { + Type[] extraTypes = GetTypesInNamespace( LoadedAssemblies[i] , "AmplifyShaderEditor" ); + if( extraTypes.Length > 0 ) + { + availableTypes = ( availableTypes == null ) ? extraTypes : availableTypes.Concat( extraTypes ).ToArray(); + } + } + } + + return availableTypes; + } + + public static Type GetAssemblyType( string typeName ) + { + if( LoadedAssemblies == null ) + { + LoadedAssemblies = new List(); + try + { + UnityEditor.Compilation.Assembly[] assemblies = UnityEditor.Compilation.CompilationPipeline.GetAssemblies( UnityEditor.Compilation.AssembliesType.Editor ); + for( int i = 0 ; i < assemblies.Length ; i++ ) + { + if( !assemblies[ i ].name.StartsWith( "Unity" ) && !assemblies[ i ].name.Equals( "AmplifyShaderEditor" ) ) + { + Assembly assembly = Assembly.Load( assemblies[ i ].name ); + LoadedAssemblies.Add( assembly ); + Type type = assembly.GetType( typeName ); + if( type != null ) + return type; + } + } + } + catch( Exception e ) + { + Debug.LogException( e ); + } + } + else + { + int count = LoadedAssemblies.Count; + for( int i = 0 ; i < count ; i++ ) + { + Type type = LoadedAssemblies[i].GetType( typeName ); + if( type != null ) + return type; + } + } + + return null; + } + + public static void ClearLoadedAssemblies() + { + if( LoadedAssemblies != null ) + { + LoadedAssemblies.Clear(); + LoadedAssemblies = null; + } + } + + public static void StartSaveThread( string shaderBody , string pathName ) + { + if( Provider.enabled && Provider.isActive ) + { + Asset loadedAsset = Provider.GetAssetByPath( FileUtil.GetProjectRelativePath( pathName ) ); + if( loadedAsset != null ) + { + //Task statusTask = Provider.Status( loadedAsset ); + //statusTask.Wait(); + //if( Provider.CheckoutIsValid( statusTask.assetList[ 0 ] ) ) + { + Task checkoutTask = Provider.Checkout( loadedAsset , CheckoutMode.Both ); + checkoutTask.Wait(); + } + } + } + + if( UseSaveThread ) + { + if( !SaveInThreadFlag ) + { + if( SaveInThreadMainThread == null ) + { + Worker worker = new Worker(); + SaveInThreadMainThread = new Thread( worker.DoWork ); + SaveInThreadMainThread.Start(); + Debug.Log( "Thread created" ); + } + + SaveInThreadShaderBody = shaderBody; + SaveInThreadPathName = pathName; + SaveInThreadFlag = true; + } + } + else + { + SaveTextfileToDisk( shaderBody , pathName ); + } + } + + //////////////////////////////////////////////////////////////////////////// + public static void SetAmplifyDefineSymbolOnBuildTargetGroup( BuildTargetGroup targetGroup ) + { + #if UNITY_2021_2_OR_NEWER + var namedBuildTarget = NamedBuildTarget.FromBuildTargetGroup( targetGroup ); + string currData = PlayerSettings.GetScriptingDefineSymbols( namedBuildTarget ); + #else + string currData = PlayerSettings.GetScriptingDefineSymbolsForGroup( targetGroup ); + #endif + if( !currData.Contains( AmplifyShaderEditorDefineSymbol ) ) + { + if( string.IsNullOrEmpty( currData ) ) + { + #if UNITY_2021_2_OR_NEWER + PlayerSettings.SetScriptingDefineSymbols( namedBuildTarget, AmplifyShaderEditorDefineSymbol ); + #else + PlayerSettings.SetScriptingDefineSymbolsForGroup( targetGroup, AmplifyShaderEditorDefineSymbol ); + #endif + } + else + { + if( !currData[ currData.Length - 1 ].Equals( ';' ) ) + { + currData += ';'; + } + currData += AmplifyShaderEditorDefineSymbol; + + #if UNITY_2021_2_OR_NEWER + PlayerSettings.SetScriptingDefineSymbols( namedBuildTarget, currData ); + #else + PlayerSettings.SetScriptingDefineSymbolsForGroup( targetGroup, currData ); + #endif + } + } + } + + public static void RemoveAmplifyDefineSymbolOnBuildTargetGroup( BuildTargetGroup targetGroup ) + { + #if UNITY_2021_2_OR_NEWER + var namedBuildTarget = NamedBuildTarget.FromBuildTargetGroup( targetGroup ); + string currData = PlayerSettings.GetScriptingDefineSymbols( namedBuildTarget ); + #else + string currData = PlayerSettings.GetScriptingDefineSymbolsForGroup( targetGroup ); + #endif + if( currData.Contains( AmplifyShaderEditorDefineSymbol ) ) + { + currData = currData.Replace( AmplifyShaderEditorDefineSymbol + ";" , "" ); + currData = currData.Replace( ";" + AmplifyShaderEditorDefineSymbol , "" ); + currData = currData.Replace( AmplifyShaderEditorDefineSymbol , "" ); + + #if UNITY_2021_2_OR_NEWER + PlayerSettings.SetScriptingDefineSymbols( namedBuildTarget, currData ); + #else + PlayerSettings.SetScriptingDefineSymbolsForGroup( targetGroup, currData ); + #endif + } + } + + //Adding this attribute so scripting defining symbol can be registered right away so custom nodes using ASE ( under that symbol ) can be caught + // the first time ASE opens + [InitializeOnLoadMethod] + public static void Init() + { + if( !Initialized ) + { + Initialized = true; + Preferences.Initialize(); + if ( Preferences.Project.DefineSymbol ) + SetAmplifyDefineSymbolOnBuildTargetGroup( EditorUserBuildSettings.selectedBuildTargetGroup ); + //Array BuildTargetGroupValues = Enum.GetValues( typeof( BuildTargetGroup )); + //for ( int i = 0; i < BuildTargetGroupValues.Length; i++ ) + //{ + // if( i != 0 && i != 15 && i != 16 ) + // SetAmplifyDefineSymbolOnBuildTargetGroup( ( BuildTargetGroup ) BuildTargetGroupValues.GetValue( i ) ); + //} + + DefaultASEDirtyCheckId = Shader.PropertyToID( DefaultASEDirtyCheckName ); + dataPath = Application.dataPath.Remove( Application.dataPath.Length - 6 ); + + + //ASEFolderPath = AssetDatabase.GUIDToAssetPath( ASEFolderGUID ); + //ASEResourcesPath = ASEFolderPath + ASEResourcesPath; + } + } + + + public static void DumpTemplateManagers() + { + for( int i = 0 ; i < AllOpenedWindows.Count ; i++ ) + { + if( AllOpenedWindows[ i ].TemplatesManagerInstance != null ) + { + Debug.Log( AllOpenedWindows[ i ].titleContent.text + ": " + AllOpenedWindows[ i ].TemplatesManagerInstance.GetInstanceID() ); + } + } + } + + public static TemplatesManager FirstValidTemplatesManager + { + get + { + for( int i = 0 ; i < AllOpenedWindows.Count ; i++ ) + { + if( AllOpenedWindows[ i ].TemplatesManagerInstance != null ) + { + return AllOpenedWindows[ i ].TemplatesManagerInstance; + } + } + return null; + } + } + + public static void UpdateSFandRefreshWindows( AmplifyShaderFunction function ) + { + for( int i = 0 ; i < AllOpenedWindows.Count ; i++ ) + { + AllOpenedWindows[ i ].LateRefreshAvailableNodes(); + if( AllOpenedWindows[ i ].IsShaderFunctionWindow ) + { + if( AllOpenedWindows[ i ].OpenedShaderFunction == function ) + { + AllOpenedWindows[ i ].UpdateTabTitle(); + } + } + } + } + + public static void UpdateIO() + { + int windowCount = AllOpenedWindows.Count; + if( windowCount == 0 ) + { + EditorApplication.update -= IOUtils.UpdateIO; + return; + } + + for( int i = 0 ; i < AllOpenedWindows.Count ; i++ ) + { + if( AllOpenedWindows[ i ] == EditorWindow.focusedWindow ) + { + UIUtils.CurrentWindow = AllOpenedWindows[ i ]; + } + + if( FunctionNodeChanged ) + AllOpenedWindows[ i ].CheckFunctions = true; + + if( AllOpenedWindows[ i ] == null ) + { + AllOpenedWindows.RemoveAt( i ); + i--; + } + } + + if( FunctionNodeChanged ) + FunctionNodeChanged = false; + } + + public static void Destroy() + { + ActiveThread = false; + if( SaveInThreadMainThread != null ) + { + SaveInThreadMainThread.Abort(); + SaveInThreadMainThread = null; + } + } + + public static void GetShaderName( out string shaderName , out string fullPathname , string defaultName , string customDatapath ) + { + string currDatapath = String.IsNullOrEmpty( customDatapath ) ? Application.dataPath : customDatapath; + fullPathname = EditorUtility.SaveFilePanelInProject( "Select Shader to save" , defaultName , "shader" , SaveShaderStr , currDatapath ); + if( !String.IsNullOrEmpty( fullPathname ) ) + { + shaderName = fullPathname.Remove( fullPathname.Length - 7 ); // -7 remove .shader extension + string[] subStr = shaderName.Split( '/' ); + if( subStr.Length > 0 ) + { + shaderName = subStr[ subStr.Length - 1 ]; // Remove pathname + } + } + else + { + shaderName = string.Empty; + } + } + + public static void AddTypeToString( ref string myString , string typeName ) + { + myString += typeName; + } + + public static void AddFieldToString( ref string myString , string fieldName , object fieldValue ) + { + myString += FIELD_SEPARATOR + fieldName + VALUE_SEPARATOR + fieldValue; + } + + public static void AddFieldValueToString( ref string myString , object fieldValue ) + { + myString += FIELD_SEPARATOR + fieldValue.ToString(); + } + + public static void AddLineTerminator( ref string myString ) + { + myString += LINE_TERMINATOR; + } + + public static string CreateChecksum( string buffer ) + { + SHA1 sha1 = SHA1.Create(); + byte[] buf = System.Text.Encoding.UTF8.GetBytes( buffer ); + byte[] hash = sha1.ComputeHash( buf , 0 , buf.Length ); + string hashstr = BitConverter.ToString( hash ).Replace( "-" , "" ); + return hashstr; + } + + public static void SaveTextfileToDisk( string shaderBody , string pathName , bool addAdditionalInfo = true ) + { + + if( addAdditionalInfo ) + { + shaderBody = string.Format( ShaderCopywriteMessage, VersionInfo.StaticToString() ) + shaderBody; + // Add checksum + string checksum = CreateChecksum( shaderBody ); + shaderBody += CHECKSUM + VALUE_SEPARATOR + checksum; + } + + // Write to disk + StreamWriter fileWriter = new StreamWriter( pathName ); + try + { + fileWriter.Write( shaderBody ); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + finally + { + fileWriter.Close(); + } + } + + public static string AddAdditionalInfo( string shaderBody ) + { + shaderBody = string.Format( ShaderCopywriteMessage, VersionInfo.StaticToString() ) + shaderBody; + string checksum = CreateChecksum( shaderBody ); + shaderBody += CHECKSUM + VALUE_SEPARATOR + checksum; + return shaderBody; + } + + public static string LoadTextFileFromDisk( string pathName ) + { + string result = string.Empty; + if( !string.IsNullOrEmpty( pathName ) && File.Exists( pathName ) ) + { + + StreamReader fileReader = null; + try + { + fileReader = new StreamReader( pathName ); + result = fileReader.ReadToEnd(); + } + catch( Exception e ) + { + Debug.LogException( e ); + } + finally + { + if( fileReader != null ) + fileReader.Close(); + } + } + return result; + } + + public static bool IsASEShader( Shader shader ) + { + string datapath = AssetDatabase.GetAssetPath( shader ); + if( UIUtils.IsUnityNativeShader( datapath ) ) + { + return false; + } + + string buffer = LoadTextFileFromDisk( datapath ); + if( String.IsNullOrEmpty( buffer ) || !IOUtils.HasValidShaderBody( ref buffer ) ) + { + return false; + } + return true; + } + + public static bool IsShaderFunction( string functionInfo ) + { + string buffer = functionInfo; + if( String.IsNullOrEmpty( buffer ) || !IOUtils.HasValidShaderBody( ref buffer ) ) + { + return false; + } + return true; + } + + public static bool HasValidShaderBody( ref string shaderBody ) + { + int shaderBodyBeginId = shaderBody.IndexOf( ShaderBodyBegin ); + if( shaderBodyBeginId > -1 ) + { + int shaderBodyEndId = shaderBody.IndexOf( ShaderBodyEnd ); + return ( shaderBodyEndId > -1 && shaderBodyEndId > shaderBodyBeginId ); + } + return false; + } + + public static int[] AllIndexesOf( this string str , string substr , bool ignoreCase = false ) + { + if( string.IsNullOrEmpty( str ) || string.IsNullOrEmpty( substr ) ) + { + throw new ArgumentException( "String or substring is not specified." ); + } + + List indexes = new List(); + int index = 0; + + while( ( index = str.IndexOf( substr , index , ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal ) ) != -1 ) + { + indexes.Add( index++ ); + } + + return indexes.ToArray(); + } + + public static void AddFunctionHeader( ref string function , string header ) + { + function += string.Format( "\t\t{0}\n\t\t{{\n", header ); + } + + public static void AddSingleLineFunction( ref string function , string header ) + { + function += string.Format( "\t\t{0}", header ); + } + + public static void AddFunctionLine( ref string function , string line ) + { + function += string.Format( "\t\t\t{0}\n", line ); + } + + public static void CloseFunctionBody( ref string function ) + { + function += "\t\t}\n"; + } + + public static string CreateFullFunction( string header , params string[] functionLines ) + { + string result = string.Empty; + AddFunctionHeader( ref result , header ); + for( int i = 0 ; i > functionLines.Length ; i++ ) + { + AddFunctionLine( ref result , functionLines[ i ] ); + } + CloseFunctionBody( ref result ); + return result; + } + + public static string CreateCodeComments( bool forceForwardSlash , params string[] comments ) + { + string finalComment = string.Empty; + if( comments.Length == 1 ) + { + finalComment = "//" + comments[ 0 ]; + } + else + { + if( forceForwardSlash ) + { + for( int i = 0 ; i < comments.Length ; i++ ) + { + finalComment += "//" + comments[ i ]; + if( i < comments.Length - 1 ) + { + finalComment += "\n\t\t\t"; + } + } + } + else + { + finalComment = "/*"; + for( int i = 0 ; i < comments.Length ; i++ ) + { + if( i != 0 ) + finalComment += "\t\t\t"; + finalComment += comments[ i ]; + if( i < comments.Length - 1 ) + finalComment += "\n"; + } + finalComment += "*/"; + } + } + return finalComment; + } + + public static string GetUVChannelDeclaration( string uvName , int channelId , int set ) + { + string uvSetStr = ( set == 0 ) ? "uv" : "uv" + Constants.AvailableUVSetsStr[ set ]; + return "float2 " + uvSetStr + uvName /*+ " : TEXCOORD" + channelId*/; + } + + public static string GetUVChannelName( string uvName , int set ) + { + string uvSetStr = ( set == 0 ) ? "uv" : "uv" + Constants.AvailableUVSetsStr[ set ]; + return uvSetStr + uvName; + } + + public static string GetVertexUVChannelName( int set ) + { + string uvSetStr = ( set == 0 ) ? "texcoord" : ( "texcoord" + set.ToString() ); + return uvSetStr; + } + + //Floatify adds a .0 to the number as soon operarions with floats require that + // if value % 1 != 0 it has decimal numbers + // The regex checks if number is something like 4e+07 which cannot be "floatified" + private const string CheckFloatifyPatt = "[eE][+-]"; + public static string Floatify( float value ) + { + string finalValue = value.ToString(); + return ( value % 1 ) != 0 ? finalValue : + ( Regex.IsMatch( finalValue , CheckFloatifyPatt ) ? finalValue : finalValue + FloatifyStr ); + } + + public static string Vector2ToString( Vector2 data ) + { + return data.x.ToString() + VECTOR_SEPARATOR + data.y.ToString(); + } + + public static string Vector3ToString( Vector3 data ) + { + return data.x.ToString() + VECTOR_SEPARATOR + data.y.ToString() + VECTOR_SEPARATOR + data.z.ToString(); + } + + public static string Vector4ToString( Vector4 data ) + { + return data.x.ToString() + VECTOR_SEPARATOR + data.y.ToString() + VECTOR_SEPARATOR + data.z.ToString() + VECTOR_SEPARATOR + data.w.ToString(); + } + + public static string ColorToString( Color data ) + { + return data.r.ToString() + VECTOR_SEPARATOR + data.g.ToString() + VECTOR_SEPARATOR + data.b.ToString() + VECTOR_SEPARATOR + data.a.ToString(); + } + + public static string Matrix3x3ToString( Matrix4x4 matrix ) + { + return matrix[ 0 , 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 0 , 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 0 , 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + + matrix[ 1 , 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 1 , 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 1 , 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + + matrix[ 2 , 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 2 , 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 2 , 2 ].ToString(); + } + + public static string Matrix4x4ToString( Matrix4x4 matrix ) + { + return matrix[ 0 , 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 0 , 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 0 , 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 0 , 3 ].ToString() + IOUtils.VECTOR_SEPARATOR + + matrix[ 1 , 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 1 , 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 1 , 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 1 , 3 ].ToString() + IOUtils.VECTOR_SEPARATOR + + matrix[ 2 , 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 2 , 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 2 , 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 2 , 3 ].ToString() + IOUtils.VECTOR_SEPARATOR + + matrix[ 3 , 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 3 , 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 3 , 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 3 , 3 ].ToString(); + } + + public static Vector2 StringToVector2( string data ) + { + string[] parsedData = data.Split( VECTOR_SEPARATOR ); + if( parsedData.Length >= 2 ) + { + return new Vector2( Convert.ToSingle( parsedData[ 0 ] ) , + Convert.ToSingle( parsedData[ 1 ] ) ); + } + return Vector2.zero; + } + + public static Vector3 StringToVector3( string data ) + { + string[] parsedData = data.Split( VECTOR_SEPARATOR ); + if( parsedData.Length >= 3 ) + { + return new Vector3( Convert.ToSingle( parsedData[ 0 ] ) , + Convert.ToSingle( parsedData[ 1 ] ) , + Convert.ToSingle( parsedData[ 2 ] ) ); + } + return Vector3.zero; + } + + public static Vector4 StringToVector4( string data ) + { + string[] parsedData = data.Split( VECTOR_SEPARATOR ); + if( parsedData.Length >= 4 ) + { + return new Vector4( Convert.ToSingle( parsedData[ 0 ] ) , + Convert.ToSingle( parsedData[ 1 ] ) , + Convert.ToSingle( parsedData[ 2 ] ) , + Convert.ToSingle( parsedData[ 3 ] ) ); + } + return Vector4.zero; + } + + public static Color StringToColor( string data ) + { + string[] parsedData = data.Split( VECTOR_SEPARATOR ); + if( parsedData.Length >= 4 ) + { + return new Color( Convert.ToSingle( parsedData[ 0 ] ) , + Convert.ToSingle( parsedData[ 1 ] ) , + Convert.ToSingle( parsedData[ 2 ] ) , + Convert.ToSingle( parsedData[ 3 ] ) ); + } + return Color.white; + } + + public static Matrix4x4 StringToMatrix3x3( string data ) + { + string[] parsedData = data.Split( VECTOR_SEPARATOR ); + if( parsedData.Length == 9 ) + { + Matrix4x4 matrix = new Matrix4x4(); + matrix[ 0 , 0 ] = Convert.ToSingle( parsedData[ 0 ] ); + matrix[ 0 , 1 ] = Convert.ToSingle( parsedData[ 1 ] ); + matrix[ 0 , 2 ] = Convert.ToSingle( parsedData[ 2 ] ); + + matrix[ 1 , 0 ] = Convert.ToSingle( parsedData[ 3 ] ); + matrix[ 1 , 1 ] = Convert.ToSingle( parsedData[ 4 ] ); + matrix[ 1 , 2 ] = Convert.ToSingle( parsedData[ 5 ] ); + + matrix[ 2 , 0 ] = Convert.ToSingle( parsedData[ 6 ] ); + matrix[ 2 , 1 ] = Convert.ToSingle( parsedData[ 7 ] ); + matrix[ 2 , 2 ] = Convert.ToSingle( parsedData[ 8 ] ); + return matrix; + } + return Matrix4x4.identity; + } + + public static Matrix4x4 StringToMatrix4x4( string data ) + { + string[] parsedData = data.Split( VECTOR_SEPARATOR ); + if( parsedData.Length == 16 ) + { + Matrix4x4 matrix = new Matrix4x4(); + matrix[ 0 , 0 ] = Convert.ToSingle( parsedData[ 0 ] ); + matrix[ 0 , 1 ] = Convert.ToSingle( parsedData[ 1 ] ); + matrix[ 0 , 2 ] = Convert.ToSingle( parsedData[ 2 ] ); + matrix[ 0 , 3 ] = Convert.ToSingle( parsedData[ 3 ] ); + + matrix[ 1 , 0 ] = Convert.ToSingle( parsedData[ 4 ] ); + matrix[ 1 , 1 ] = Convert.ToSingle( parsedData[ 5 ] ); + matrix[ 1 , 2 ] = Convert.ToSingle( parsedData[ 6 ] ); + matrix[ 1 , 3 ] = Convert.ToSingle( parsedData[ 7 ] ); + + matrix[ 2 , 0 ] = Convert.ToSingle( parsedData[ 8 ] ); + matrix[ 2 , 1 ] = Convert.ToSingle( parsedData[ 9 ] ); + matrix[ 2 , 2 ] = Convert.ToSingle( parsedData[ 10 ] ); + matrix[ 2 , 3 ] = Convert.ToSingle( parsedData[ 11 ] ); + + matrix[ 3 , 0 ] = Convert.ToSingle( parsedData[ 12 ] ); + matrix[ 3 , 1 ] = Convert.ToSingle( parsedData[ 13 ] ); + matrix[ 3 , 2 ] = Convert.ToSingle( parsedData[ 14 ] ); + matrix[ 3 , 3 ] = Convert.ToSingle( parsedData[ 15 ] ); + return matrix; + } + return Matrix4x4.identity; + } + + public static void SaveTextureToDisk( Texture2D tex , string pathname ) + { + byte[] rawData = tex.GetRawTextureData(); + Texture2D newTex = new Texture2D( tex.width , tex.height , tex.format , tex.mipmapCount > 1 , false ); + newTex.LoadRawTextureData( rawData ); + newTex.Apply(); + byte[] pngData = newTex.EncodeToPNG(); + File.WriteAllBytes( pathname , pngData ); + } + + //public static void SaveObjToList( string newObj ) + //{ + // Debug.Log( UIUtils.CurrentWindow.Lastpath ); + // UIUtils.CurrentWindow.Lastpath = newObj; + // string lastOpenedObj = EditorPrefs.GetString( IOUtils.LAST_OPENED_OBJ_ID ); + // string[] allLocations = lastOpenedObj.Split( ':' ); + + // string lastLocation = allLocations[ allLocations.Length - 1 ]; + + // string resave = string.Empty; + // for ( int i = 0; i < allLocations.Length; i++ ) + // { + // if ( string.IsNullOrEmpty( allLocations[ i ] ) ) + // continue; + + // resave += allLocations[ i ]; + // resave += ":"; + // } + + // resave += newObj; + // EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, resave ); + //} + + //public static void DeleteObjFromList( string newObj ) + //{ + // string lastOpenedObj = EditorPrefs.GetString( IOUtils.LAST_OPENED_OBJ_ID ); + // string[] allLocations = lastOpenedObj.Split( ':' ); + + // string resave = string.Empty; + // for ( int i = 0; i < allLocations.Length; i++ ) + // { + // if ( string.IsNullOrEmpty( allLocations[ i ] ) || newObj.Equals( allLocations[ i ] ) ) + // continue; + + // resave += allLocations[ i ]; + // if ( i < allLocations.Length - 1 ) + // resave += ":"; + // } + + // EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, resave ); + //} + + // Polynomial: 0xedb88320 + static readonly uint[] crc32_tab = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d + }; + + public static uint CRC32( byte[] buf, uint crc = 0 ) + { + uint i = 0; + uint size = ( uint )buf.Length; + crc = crc ^ 0xFFFFFFFF; + while ( size-- > 0 ) + { + crc = crc32_tab[ ( crc ^ buf[ i++ ] ) & 0xFF ] ^ ( crc >> 8 ); + } + return crc ^ 0xFFFFFFFF; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs.meta new file mode 100644 index 00000000..1fa944f3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d39b4c96fb4d7f847b3a21c377d4188d +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs new file mode 100644 index 00000000..2b11c271 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs @@ -0,0 +1,381 @@ +using UnityEngine; +using UnityEditor; +using System; + +namespace AmplifyShaderEditor +{ + [System.Serializable] + public class InlineProperty + { + [SerializeField] + private float m_value = 0; + + [SerializeField] + private bool m_active = false; + + [SerializeField] + private int m_nodeId = -1; + + [SerializeField] + private string m_nodePropertyName = string.Empty; + + [SerializeField] + private bool m_inlineButtonVisible = true; + + public InlineProperty() + { + InlinePropertyTable.Register( this ); + } + + public InlineProperty( float val ) : base() + { + m_value = val; + } + + public InlineProperty( int val ) : base() + { + m_value = val; + } + + public void ResetProperty() + { + m_nodeId = -1; + m_active = false; + } + + public void CopyFrom( InlineProperty other ) + { + m_value = other.m_value; + m_active = other.m_active; + m_nodeId = other.m_nodeId; + } + + public void SetInlineByName( string propertyName ) + { + m_nodeId = UIUtils.GetFloatIntNodeIdByName( propertyName ); + m_nodePropertyName = propertyName; + m_active = !string.IsNullOrEmpty( propertyName ); + } + + public void CheckInlineButton() + { + if( m_inlineButtonVisible ) + { + if( GUILayout.Button( UIUtils.FloatIntIconON , UIUtils.FloatIntPickerONOFF , GUILayout.Width( 15 ) , GUILayout.Height( 15 ) ) ) + m_active = !m_active; + } + } + + public void IntField( ref UndoParentNode owner , string content ) + { + if( !m_active ) + { + EditorGUILayout.BeginHorizontal(); + m_value = owner.EditorGUILayoutIntField( content , (int)m_value ); + CheckInlineButton(); + EditorGUILayout.EndHorizontal(); + } + else + { + DrawPicker( ref owner , content ); + } + } + + public void IntSlider( ref UndoParentNode owner , GUIContent content , int min , int max ) + { + if( !m_active ) + { + EditorGUILayout.BeginHorizontal(); + m_value = owner.EditorGUILayoutIntSlider( content , (int)m_value , min , max ); + CheckInlineButton(); + EditorGUILayout.EndHorizontal(); + } + else + { + DrawPicker( ref owner , content ); + } + } + + public void IntSlider( ref UndoParentNode owner , string content , int min , int max ) + { + if( !m_active ) + { + EditorGUILayout.BeginHorizontal(); + m_value = owner.EditorGUILayoutIntSlider( content , (int)m_value , min , max ); + CheckInlineButton(); + EditorGUILayout.EndHorizontal(); + } + else + { + DrawPicker( ref owner , content ); + } + } + + public void EnumTypePopup( ref UndoParentNode owner , string content , string[] displayOptions ) + { + if( !m_active ) + { + EditorGUILayout.BeginHorizontal(); + m_value = owner.EditorGUILayoutPopup( content , (int)m_value , displayOptions ); + CheckInlineButton(); + EditorGUILayout.EndHorizontal(); + + } + else + { + DrawPicker( ref owner , content ); + } + } + + public void FloatField( ref UndoParentNode owner , string content ) + { + if( !m_active ) + { + EditorGUILayout.BeginHorizontal(); + m_value = owner.EditorGUILayoutFloatField( content , m_value ); + CheckInlineButton(); + EditorGUILayout.EndHorizontal(); + } + else + { + DrawPicker( ref owner , content ); + } + } + + public void SliderField( ref UndoParentNode owner , string content , float min , float max ) + { + if( !m_active ) + { + EditorGUILayout.BeginHorizontal(); + m_value = owner.EditorGUILayoutSlider( content , m_value , min , max ); + CheckInlineButton(); + EditorGUILayout.EndHorizontal(); + } + else + { + DrawPicker( ref owner , content ); + } + } + + public void RangedFloatField( ref UndoParentNode owner , string content , float min , float max ) + { + if( !m_active ) + { + EditorGUILayout.BeginHorizontal(); + m_value = owner.EditorGUILayoutRangedFloatField( content , m_value , min , max ); + CheckInlineButton(); + EditorGUILayout.EndHorizontal(); + } + else + { + DrawPicker( ref owner , content ); + } + } + + + public void CustomDrawer( ref UndoParentNode owner , DrawPropertySection Drawer , string content ) + { + if( !m_active ) + { + EditorGUILayout.BeginHorizontal(); + Drawer( owner ); + CheckInlineButton(); + EditorGUILayout.EndHorizontal(); + } + else + { + DrawPicker( ref owner , content ); + } + } + + public delegate void DrawPropertySection( UndoParentNode owner ); + + private void DrawPicker( ref UndoParentNode owner , GUIContent content ) + { + DrawPicker( ref owner , content.text ); + } + + private void DrawPicker( ref UndoParentNode owner , string content ) + { + EditorGUILayout.BeginHorizontal(); + string[] intArraysNames = owner.ContainerGraph.ParentWindow.CurrentGraph.FloatIntNodes.NodesArr; + int[] intIds = owner.ContainerGraph.ParentWindow.CurrentGraph.FloatIntNodes.NodeIds; + int prevNodeId = m_nodeId; + m_nodeId = owner.EditorGUILayoutIntPopup( content , m_nodeId , intArraysNames , intIds ); + if ( m_nodeId != prevNodeId ) + { + m_nodePropertyName = UIUtils.GetFloatIntNameByNodeId( m_nodeId, m_nodePropertyName ); + } + if ( GUILayout.Button( UIUtils.FloatIntIconOFF , UIUtils.FloatIntPickerONOFF , GUILayout.Width( 15 ) , GUILayout.Height( 15 ) ) ) + m_active = !m_active; + EditorGUILayout.EndHorizontal(); + } + + public string GetValueOrProperty( bool parentesis = true ) + { + if( m_active ) + { + PropertyNode node = GetPropertyNode(); + if( node != null ) + { + return parentesis ? "[" + node.PropertyName + "]" : node.PropertyName; + } + else if ( !string.IsNullOrEmpty( m_nodePropertyName ) ) + { + return parentesis ? "[" + m_nodePropertyName + "]" : m_nodePropertyName; + } + else + { + m_active = false; + m_nodeId = -1; + return m_value.ToString(); + } + } + else + { + return m_value.ToString(); + } + } + + public string GetValueOrProperty( string defaultValue , bool parentesis = true ) + { + if( m_active ) + { + PropertyNode node = GetPropertyNode(); + if( node != null ) + { + return parentesis ? "[" + node.PropertyName + "]" : node.PropertyName; + } + else if ( !string.IsNullOrEmpty( m_nodePropertyName ) ) + { + return parentesis ? "[" + m_nodePropertyName + "]" : m_nodePropertyName; + } + else if( !string.IsNullOrEmpty( defaultValue ) ) + { + m_active = false; + m_nodeId = -1; + return defaultValue; + } + else + { + m_active = false; + m_nodeId = -1; + return m_value.ToString(); + } + } + else + { + return defaultValue; + } + } + + public void TryResolveDependency() + { + if ( m_active && !string.IsNullOrEmpty( m_nodePropertyName ) ) + { + m_nodeId = UIUtils.GetFloatIntNodeIdByName( m_nodePropertyName ); + } + } + + private void TryReadUniqueId( string param ) + { + if ( Preferences.User.ForceTemplateInlineProperties && !string.IsNullOrEmpty( m_nodePropertyName ) ) + { + // @diogo: exception path => ignore param and revert to template default + m_nodeId = UIUtils.GetFloatIntNodeIdByName( m_nodePropertyName ); + + // @diogo: by defaulting to template we are signaling the inline property is active + m_active = true; + } + else + { + // @diogo: normal path + if ( int.TryParse( param, out int nodeId ) ) + { + m_nodeId = Convert.ToInt32( param ); + m_nodePropertyName = UIUtils.GetFloatIntNameByNodeId( m_nodeId, m_nodePropertyName ); + } + else + { + m_nodePropertyName = param; + m_nodeId = UIUtils.GetFloatIntNodeIdByName( m_nodePropertyName ); + } + } + } + + public void ReadFromString( ref uint index , ref string[] nodeParams , bool isInt = true ) + { + m_value = isInt ? Convert.ToInt32( nodeParams[ index++ ] ) : Convert.ToSingle( nodeParams[ index++ ] ); + m_active = Convert.ToBoolean( nodeParams[ index++ ] ); + TryReadUniqueId( nodeParams[ index++ ] ); + } + + public void ReadFromSingle( string singleLine ) + { + string[] data = singleLine.Split( IOUtils.VECTOR_SEPARATOR ); + m_value = Convert.ToSingle( data[ 0 ] , System.Globalization.CultureInfo.InvariantCulture ); + m_active = Convert.ToBoolean( data[ 1 ] ); + TryReadUniqueId( data[ 2 ] ); + } + + public void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo , m_value ); + IOUtils.AddFieldValueToString( ref nodeInfo , m_active ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_nodePropertyName ); + } + + public string WriteToSingle() + { + return m_value.ToString( System.Globalization.CultureInfo.InvariantCulture ) + IOUtils.VECTOR_SEPARATOR + m_active + IOUtils.VECTOR_SEPARATOR + m_nodePropertyName; + } + + public void SetInlineNodeValue() + { + if( IsValid ) + { + RangedFloatNode fnode = UIUtils.GetNode( m_nodeId ) as RangedFloatNode; + if( fnode != null ) + { + fnode.Value = m_value; + fnode.SetMaterialValueFromInline( m_value ); + } + else + { + IntNode inode = UIUtils.GetNode( m_nodeId ) as IntNode; + inode.Value = (int)m_value; + inode.SetMaterialValueFromInline( (int)m_value ); + } + } + } + + public bool IsValid { get { return m_active; } } + + public PropertyNode GetPropertyNode() + { + if( m_nodeId >= 0 ) + return UIUtils.GetNode( m_nodeId ) as PropertyNode; + + if( m_nodeId < -1 ) + { + if( !string.IsNullOrEmpty( m_nodePropertyName ) ) + return UIUtils.GetInternalTemplateNode( m_nodePropertyName ); + + + return UIUtils.GetInternalTemplateNode( m_nodeId ); + } + + return null; + } + + public void HideInlineButton() + { + m_inlineButtonVisible = false; + } + + public int IntValue { get { return (int)m_value; } set { m_value = value; } } + public float FloatValue { get { return m_value; } set { m_value = value; } } + public bool Active { get { return m_active; } set { m_active = value; } } + public int NodeId { get { return m_nodeId; } set { m_nodeId = value; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs.meta new file mode 100644 index 00000000..cb4115f0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f4f4421f529503243bfef5076ae82512 +timeCreated: 1519298230 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlinePropertyTable.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlinePropertyTable.cs new file mode 100644 index 00000000..13ea1329 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlinePropertyTable.cs @@ -0,0 +1,43 @@ +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + public class InlinePropertyTable + { + // @diogo: Used to keep track of inline properties during Graph loading process, in order to resolve + // dependencies AFTER the meta data is parsed, not during the process, making it order agnostic. + + static List m_pool = new List( 32 ); + static List m_trackingTable = null; + + public static void Initialize() + { + m_trackingTable = m_pool; // keep memory allocated, despite empty list + } + + public static void Register( InlineProperty prop ) + { + if ( m_trackingTable != null ) + { + m_trackingTable.Add( prop ); + } + } + + public static void ResolveDependencies() + { + if ( m_trackingTable != null ) + { + foreach ( var prop in m_trackingTable ) + { + prop.TryResolveDependency(); + } + + m_trackingTable.Clear(); + m_trackingTable = null; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlinePropertyTable.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlinePropertyTable.cs.meta new file mode 100644 index 00000000..bc9e29b6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InlinePropertyTable.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 5e4654284143e4149873b379a6ea5adc +timeCreated: 1519298230 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InlinePropertyTable.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs new file mode 100644 index 00000000..5f9837eb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs @@ -0,0 +1,168 @@ +using UnityEditor; +using UnityEngine; +using System; +using System.Collections; +using UnityEngine.Networking; + +namespace AmplifyShaderEditor +{ + [InitializeOnLoad] + public class InvalidDataChecker + { + private static string[] m_invalidData = { "674ea7bed6b1cd94b8057074298096db", //"/Samples", + "2738539936eacef409be91f148b2a4a0", //"/Resources", + "c880e50f07f2be9499d414ac6f9f3a7a", //"/Templates", + "563f992b9989cf547ac59bf748442c17"};//"/Textures"}; + //private static string m_ASEFolderPath; + private static string m_invalidDataCollected = string.Empty; + static InvalidDataChecker() + { + bool foundInvalidData = false; + //m_ASEFolderPath = AssetDatabase.GUIDToAssetPath( IOUtils.ASEFolderGUID ); + int count = 0; + for ( int i = 0; i < m_invalidData.Length; i++ ) + { + //m_invalidData[ i ] = m_ASEFolderPath + m_invalidData[ i ]; + m_invalidData[ i ] = AssetDatabase.GUIDToAssetPath( m_invalidData[ i ] ); + if ( AssetDatabase.IsValidFolder( m_invalidData[ i ] ) ) + { + foundInvalidData = true; + m_invalidDataCollected += m_invalidData[ i ]+"\n"; + count += 1; + } + } + if ( count < 5 ) + { + for ( ; count < 5; count++ ) + { + m_invalidDataCollected += "\n"; + } + } + + if ( foundInvalidData ) + { + InvalidDataPopUp window = ( InvalidDataPopUp ) EditorWindow.GetWindow( typeof( InvalidDataPopUp ), true, "Found Invalid Data" ); + window.minSize = new Vector2( 502, 265 ); + window.maxSize = new Vector2( 502, 265 ); + window.Show(); + } + + EditorApplication.update += Update; + } + + static void Update() + { + EditorApplication.update -= Update; + + if( !EditorApplication.isPlayingOrWillChangePlaymode ) + { + Preferences.ShowOption show = Preferences.ShowOption.Never; + if( !EditorPrefs.HasKey( Preferences.User.Keys.StartUp ) ) + { + show = Preferences.ShowOption.Always; + EditorPrefs.SetInt( Preferences.User.Keys.StartUp, 0 ); + } + else + { + if( Time.realtimeSinceStartup < 10 ) + { + show = (Preferences.ShowOption) EditorPrefs.GetInt( Preferences.User.Keys.StartUp, 0 ); + // check version here + if( show == Preferences.ShowOption.OnNewVersion ) + { + ASEStartScreen.StartBackgroundTask( StartRequest( ASEStartScreen.ChangelogURL, () => + { + var changeLog = ChangeLogInfo.CreateFromJSON( www.downloadHandler.text ); + if( changeLog != null ) + { + if( changeLog.Version > VersionInfo.FullNumber ) + ASEStartScreen.Init(); + } + } ) ); + } + } + } + + if( show == Preferences.ShowOption.Always ) + ASEStartScreen.Init(); + } + } + + static UnityWebRequest www; + + static IEnumerator StartRequest( string url, Action success = null ) + { + using( www = UnityWebRequest.Get( url ) ) + { + yield return www.SendWebRequest(); + + while( www.isDone == false ) + yield return null; + + if( success != null ) + success(); + } + } + + public static void CleanInvalidData() + { + for ( int i = 0; i < m_invalidData.Length; i++ ) + { + if ( FileUtil.DeleteFileOrDirectory( m_invalidData[ i ] ) ) + { + Debug.Log( "Removed invalid " + m_invalidData[ i ] ); + if ( FileUtil.DeleteFileOrDirectory( m_invalidData[ i ] + ".meta" ) ) + { + Debug.Log( "Removed invalid " + m_invalidData[ i ] + ".meta" ); + } + } + } + AssetDatabase.Refresh(); + } + + public static string InvalidDataCollected { get { return m_invalidDataCollected; } } + } + + public class InvalidDataPopUp : EditorWindow + { + private readonly GUIContent m_buttonContent = new GUIContent( "Remove Invalid Data" ); + private Vector2 m_scrollPosition = Vector2.zero; + public void OnGUI() + { + GUILayout.BeginVertical(); + { + GUIStyle labelStyle = new GUIStyle( EditorStyles.label ); + labelStyle.alignment = TextAnchor.MiddleCenter; + labelStyle.wordWrap = true; + GUILayout.Label( "\nAmplify Shader Editor " + VersionInfo.StaticToString(), labelStyle, GUILayout.ExpandWidth( true ) ); + GUILayout.Space( 5 ); + GUILayout.Label( "Invalid/Legacy Data was found on your previous ASE folder which needs to be removed in order for it to work correctly." , labelStyle, GUILayout.ExpandWidth( true ) ); + GUILayout.Space( 5 ); + GUILayout.Label( "Below are the detected files/folders which require to be removed.", labelStyle, GUILayout.ExpandWidth( true ) ); + GUILayout.Space( 5 ); + + m_scrollPosition = GUILayout.BeginScrollView( m_scrollPosition ,GUILayout.Height(85)); + + GUILayout.TextArea( InvalidDataChecker.InvalidDataCollected ); + GUILayout.EndScrollView(); + + + GUILayout.Label( "VERY IMPORTANT: If you have assets of yours inside these folders you need to move them to another location before hitting the button below or they will be PERMANENTLY DELETED", labelStyle, GUILayout.ExpandWidth( true ) ); + GUILayout.Space( 5 ); + + GUILayout.BeginHorizontal(); + { + GUILayout.Space( 151 ); + if ( GUILayout.Button( m_buttonContent, GUILayout.Width( 200 ) ) ) + { + InvalidDataChecker.CleanInvalidData(); + Close(); + } + } + GUILayout.EndHorizontal(); + } + GUILayout.EndVertical(); + + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs.meta new file mode 100644 index 00000000..aaeef2d7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: c71b815458d61e24184a60dbce19573d +timeCreated: 1481126959 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs new file mode 100644 index 00000000..18887e02 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs @@ -0,0 +1,334 @@ +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; +using System; +using System.Linq; +using System.Reflection; +using System.Text; +using System.IO; + +namespace AmplifyShaderEditor +{ + public enum DebugScreenShotNodeState + { + CreateNode, + FocusOnNode, + TakeScreenshot, + WaitFrame, + DeleteNode + }; + + public enum DebugUndoNodeState + { + CreateNode, + FocusOnNode, + WaitFrameCreate, + DeleteNode, + WaitFrameDelete, + UndoNode, + WaitFrameUndo, + PrepareForNext + }; + + + public class NodeExporterUtils + { + //Auto-Screenshot nodes + private RenderTexture m_screenshotRT; + private Texture2D m_screenshotTex2D; + private List m_screenshotList = new List(); + private DebugScreenShotNodeState m_screenShotState; + private bool m_takingShots = false; + + private DebugUndoNodeState m_undoState; + private bool m_testingUndo = false; + + + private AmplifyShaderEditorWindow m_window; + private ParentNode m_node; + + + private string m_pathname; + + public NodeExporterUtils( AmplifyShaderEditorWindow window ) + { + m_window = window; + UndoUtils.RegisterUndoRedoCallback( OnUndoRedoPerformed ); + } + + public void OnUndoRedoPerformed() + { + if( m_testingUndo && m_undoState == DebugUndoNodeState.WaitFrameUndo ) + { + m_undoState = DebugUndoNodeState.PrepareForNext; + } + } + + public void CalculateShaderInstructions( Shader shader ) + { + //Type shaderutilType = Type.GetType( "UnityEditor.ShaderUtil, UnityEditor" ); + //shaderutilType.InvokeMember( "OpenCompiledShader", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { shader, mode, customPlatformsMask, includeAllVariants } ); + } + + public void ActivateAutoScreenShot( string pathname, int from, int to ) + { + + m_pathname = pathname; + if( !System.IO.Directory.Exists( m_pathname ) ) + { + System.IO.Directory.CreateDirectory( m_pathname ); + } + + m_screenshotRT = new RenderTexture( (int)m_window.position.width, (int)m_window.position.height, 0 ); + m_screenshotTex2D = new Texture2D( (int)m_window.position.width, (int)m_window.position.height, TextureFormat.RGB24, false ); + + RenderTexture.active = m_screenshotRT; + m_window.CurrentPaletteWindow.FillList( ref m_screenshotList, true ); + m_window.CurrentGraph.ClearGraph(); + if( m_window.IsShaderFunctionWindow ) + { + m_window.CurrentGraph.CurrentOutputNode.Vec2Position = new Vector2( 1500, 0 ); + } + else + { + m_window.CurrentGraph.CurrentMasterNode.Vec2Position = new Vector2( 1500, 0 ); + } + m_window.ResetCameraSettings(); + + m_takingShots = true; + m_screenShotState = DebugScreenShotNodeState.CreateNode; + + } + + public void ActivateNodesURL( int from , int to ) + { + m_window.CurrentPaletteWindow.FillList( ref m_screenshotList, true ); + + if( to < 0 || to > m_screenshotList.Count ) + to = m_screenshotList.Count; + + if( from >= to ) + return; + + for( int i = from; i < to; i++ ) + { + if( m_screenshotList[ i ].NodeType != typeof( FunctionNode ) ) + { + Application.OpenURL( m_screenshotList[ i ].NodeAttributes.NodeUrl ); + } + } + } + + public void ActivateAutoUndo() + { + m_window.CurrentPaletteWindow.FillList( ref m_screenshotList, true ); + m_window.CurrentGraph.ClearGraph(); + m_window.CurrentGraph.CurrentMasterNode.Vec2Position = new Vector2( 1500, 0 ); + m_window.ResetCameraSettings(); + + m_testingUndo = true; + m_undoState = DebugUndoNodeState.CreateNode; + } + + private Type[] GetTypesInNamespace( Assembly assembly , string nameSpace ) + { + return assembly.GetTypes().Where( t => String.Equals( t.Namespace , nameSpace , StringComparison.Ordinal ) ).ToArray(); + } + + public void GenerateNodesCSV( string path ) + { + path += "AvailableNodesCSV.txt"; + StringBuilder result = new StringBuilder(); + result.AppendLine( "Nodes" ); + result.AppendLine( "Name,Updated" ); + try + { + //IEnumerable availableTypes = AppDomain.CurrentDomain.GetAssemblies().ToList().SelectMany( type => type.GetTypes() ); + var mainAssembly = Assembly.GetExecutingAssembly(); + Type[] availableTypes = GetTypesInNamespace( mainAssembly , "AmplifyShaderEditor" ); + foreach( System.Type type in availableTypes ) + { + foreach( NodeAttributes attribute in Attribute.GetCustomAttributes( type ).OfType() ) + { + if( attribute.Available && !attribute.Deprecated ) + { + result.AppendLine( attribute.Name + ", false" ); + } + } + } + } + catch( ReflectionTypeLoadException exception ) + { + Debug.LogException( exception ); + } + + result.AppendLine(); + result.AppendLine( "Shader Functions" ); + result.AppendLine( "Name,Updated" ); + string[] guids = AssetDatabase.FindAssets( "t:AmplifyShaderFunction" ); + for( int i = 0 ; i < guids.Length ; i++ ) + { + AmplifyShaderFunction sf = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( guids[ i ] ) ); + result.AppendLine( sf.FunctionName + ",false" ); + } + + IOUtils.SaveTextfileToDisk( result.ToString() , path , false ); + Debug.Log( "Available nodes CSV saved to: " + path ); + } + + public void Update() + { + if( m_testingUndo ) + { + if( Event.current.type == EventType.Repaint ) + { + m_window.Focus(); + switch( m_undoState ) + { + case DebugUndoNodeState.CreateNode: + { + m_window.CurrentGraph.DeSelectAll(); + m_node = m_window.CreateNode( m_screenshotList[ 0 ].NodeType, Vector2.zero, null, true ); + m_node.RefreshExternalReferences(); + m_undoState = DebugUndoNodeState.FocusOnNode; + Debug.Log( "Created " + m_node.Attributes.Name ); + } + break; + case DebugUndoNodeState.FocusOnNode: + { + m_window.FocusOnPoint( m_node.TruePosition.center, 1, false ); + m_undoState = DebugUndoNodeState.WaitFrameCreate; + Debug.Log( "Focused " + m_node.Attributes.Name ); + } + break; + case DebugUndoNodeState.WaitFrameCreate: + { + m_undoState = DebugUndoNodeState.DeleteNode; + Debug.Log( "Waiting on Create" ); + } + break; + case DebugUndoNodeState.DeleteNode: + { + Debug.Log( "Deleting " + m_node.Attributes.Name ); + m_window.DeleteSelectedNodeWithRepaint(); + m_undoState = DebugUndoNodeState.WaitFrameDelete; + } + break; + case DebugUndoNodeState.WaitFrameDelete: + { + m_undoState = DebugUndoNodeState.UndoNode; + Debug.Log( "Waiting on Delete" ); + } + break; + case DebugUndoNodeState.UndoNode: + { + Debug.Log( "Performing Undo" ); + m_undoState = DebugUndoNodeState.WaitFrameUndo; + UndoUtils.PerformUndo(); + } + break; + case DebugUndoNodeState.WaitFrameUndo: { } break; + case DebugUndoNodeState.PrepareForNext: + { + m_screenshotList.RemoveAt( 0 ); + Debug.Log( "Undo Performed. Nodes Left " + m_screenshotList.Count ); + m_testingUndo = m_screenshotList.Count > 0; + if( m_testingUndo ) + { + m_undoState = DebugUndoNodeState.CreateNode; + Debug.Log( "Going to next node" ); + } + else + { + Debug.Log( "Finished Undo Test" ); + } + } + break; + + } + } + } + + + if( m_takingShots ) + { + m_window.Focus(); + switch( m_screenShotState ) + { + case DebugScreenShotNodeState.CreateNode: + { + m_node = m_window.CreateNode( m_screenshotList[ 0 ].NodeType, Vector2.zero, null, false ); + m_node.RefreshExternalReferences(); + m_screenShotState = DebugScreenShotNodeState.FocusOnNode; + + + } + break; + case DebugScreenShotNodeState.FocusOnNode: + { + //m_window.FocusOnNode( m_node, 1, false ); + m_window.FocusOnPoint( m_node.TruePosition.center, 1, false ); + m_screenShotState = DebugScreenShotNodeState.TakeScreenshot; + } + break; + case DebugScreenShotNodeState.TakeScreenshot: + { + if( m_screenshotRT != null && Event.current.type == EventType.Repaint ) + { + m_screenshotTex2D.ReadPixels( new Rect( 0, 0, m_screenshotRT.width, m_screenshotRT.height ), 0, 0 ); + m_screenshotTex2D.Apply(); + + byte[] bytes = m_screenshotTex2D.EncodeToPNG(); + string pictureFilename = UIUtils.ReplaceInvalidStrings( m_screenshotList[ 0 ].Name ); + pictureFilename = UIUtils.RemoveInvalidCharacters( pictureFilename ); + + System.IO.File.WriteAllBytes( m_pathname + pictureFilename + ".png", bytes ); + m_screenShotState = DebugScreenShotNodeState.WaitFrame; + } + } + break; + case DebugScreenShotNodeState.WaitFrame: { Debug.Log( "Wait Frame" ); m_screenShotState = DebugScreenShotNodeState.DeleteNode; } break; + case DebugScreenShotNodeState.DeleteNode: + { + m_window.DestroyNode( m_node ); + m_screenshotList.RemoveAt( 0 ); + m_takingShots = m_screenshotList.Count > 0; + Debug.Log( "Destroy Node " + m_screenshotList.Count ); + + if( m_takingShots ) + { + m_screenShotState = DebugScreenShotNodeState.CreateNode; + } + else + { + RenderTexture.active = null; + m_screenshotRT.Release(); + UnityEngine.Object.DestroyImmediate( m_screenshotRT ); + m_screenshotRT = null; + UnityEngine.Object.DestroyImmediate( m_screenshotTex2D ); + m_screenshotTex2D = null; + } + } + break; + }; + } + } + + public void Destroy() + { + m_window = null; + if( m_screenshotRT != null ) + { + m_screenshotRT.Release(); + UnityEngine.Object.DestroyImmediate( m_screenshotRT ); + m_screenshotRT = null; + } + + if( m_screenshotTex2D != null ) + { + UnityEngine.Object.DestroyImmediate( m_screenshotTex2D ); + m_screenshotTex2D = null; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs.meta new file mode 100644 index 00000000..0219e21a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: f9b3f6c515f0e16469de89d9e22263c5 +timeCreated: 1486374353 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.Project.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.Project.cs new file mode 100644 index 00000000..4bafd120 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.Project.cs @@ -0,0 +1,106 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.IO; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public partial class Preferences + { + public class Project + { + public static bool AutoSRP => Values.AutoSRP; + public static bool DefineSymbol => Values.DefineSymbol; + public static string TemplateExtensions => Values.TemplateExtensions; + + private class Styles + { + public static readonly GUIContent AutoSRP = new GUIContent( "Auto import SRP shader templates", "By default Amplify Shader Editor checks for your SRP version and automatically imports the correct corresponding shader templates.\nTurn this OFF if you prefer to import them manually." ); + public static readonly GUIContent DefineSymbol = new GUIContent( "Add Amplify Shader Editor define symbol", "Turning it OFF will disable the automatic insertion of the define symbol and remove it from the list while turning it ON will do the opposite.\nThis is used for compatibility with other plugins, if you are not sure if you need this leave it ON." ); + public static readonly GUIContent TemplateExtensions = new GUIContent( "Template Extensions", "Supported file extensions for parsing shader templates." ); + } + + private class Defaults + { + public const bool AutoSRP = true; + public const bool DefineSymbol = true; + public const string TemplateExtensions = ".shader;.shader.template"; + } + + [Serializable] + private struct Layout + { + public bool AutoSRP; + public bool DefineSymbol; + public string TemplateExtensions; + } + + private const string RelativePath = "ProjectSettings/AmplifyShaderEditor.asset"; + private static string FullPath = Path.GetFullPath( RelativePath ); + private static Layout Values = new Layout(); + + public static void ResetSettings() + { + Values.AutoSRP = Defaults.AutoSRP; + Values.DefineSymbol = Defaults.DefineSymbol; + Values.TemplateExtensions = Defaults.TemplateExtensions; + } + + public static void LoadSettings() + { + try + { + Values = JsonUtility.FromJson( File.ReadAllText( FullPath ) ); + } + catch ( System.Exception e ) + { + if ( e.GetType() == typeof( FileNotFoundException ) ) + { + ResetSettings(); + + // @diogo: try to retrieve the old preferences if file does not exist yet + Values.AutoSRP = EditorPrefs.GetBool( "ASEAutoSRP", Defaults.AutoSRP ); + Values.DefineSymbol = EditorPrefs.GetBool( "ASEDefineSymbol", Defaults.DefineSymbol ); + + SaveSettings(); + } + else + { + Debug.LogWarning( "[AmplifyTexture] Failed importing \"" + RelativePath + "\". Reverting to default settings." ); + } + } + } + + public static void SaveSettings() + { + if ( DefineSymbol ) + { + IOUtils.SetAmplifyDefineSymbolOnBuildTargetGroup( EditorUserBuildSettings.selectedBuildTargetGroup ); + } + else + { + IOUtils.RemoveAmplifyDefineSymbolOnBuildTargetGroup( EditorUserBuildSettings.selectedBuildTargetGroup ); + } + + try + { + File.WriteAllText( FullPath, JsonUtility.ToJson( Values ) ); + } + catch ( System.Exception ) + { + // TODO: Not critical? + } + } + + public static void InspectorLayout() + { + Values.AutoSRP = EditorGUILayout.Toggle( Styles.AutoSRP, Values.AutoSRP ); + Values.DefineSymbol = EditorGUILayout.Toggle( Styles.DefineSymbol, Values.DefineSymbol ); + Values.TemplateExtensions = EditorGUILayout.TextField( Styles.TemplateExtensions, Values.TemplateExtensions ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.Project.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.Project.cs.meta new file mode 100644 index 00000000..196a6a87 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.Project.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: d6ca58aab98bca44384d9845269ada5b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.Project.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.User.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.User.cs new file mode 100644 index 00000000..e9a427d6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.User.cs @@ -0,0 +1,157 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public partial class Preferences + { + public enum ShowOption + { + Always = 0, + OnNewVersion = 1, + Never = 2 + } + + public class User + { + private class Styles + { + public static readonly GUIContent StartUp = new GUIContent( "Show start screen on Unity launch", "You can set if you want to see the start screen everytime Unity launchs, only just when there's a new version available or never." ); + public static readonly GUIContent AlwaysSnapToGrid = new GUIContent( "Always Snap to Grid", "Always snap to grid when dragging nodes around, instead of using control." ); + public static readonly GUIContent EnableUndo = new GUIContent( "Enable Undo (unstable)", "Enables undo for actions within the shader graph canvas. Currently unstable, use with caution." ); + public static readonly GUIContent ClearLog = new GUIContent( "Clear Log on Update", "Clears the previously generated log each time the Update button is pressed." ); + public static readonly GUIContent LogShaderCompile = new GUIContent( "Log Shader Compile", "Log message to console when a shader compilation is finished." ); + public static readonly GUIContent LogBatchCompile = new GUIContent( "Log Batch Compile", "Log message to console when a batch compilation is finished." ); + public static readonly GUIContent UpdateOnSceneSave = new GUIContent( "Update on Scene save (Ctrl+S)", "ASE is aware of Ctrl+S and will use it to save shader." ); + public static readonly GUIContent DisablePreviews = new GUIContent( "Disable Node Previews", "Disable preview on nodes from being updated to boost up performance on large graphs." ); + public static readonly GUIContent DisableMaterialMode = new GUIContent( "Disable Material Mode", "Disable enter Material Mode graph when double-clicking on material asset." ); + public static readonly GUIContent ForceTemplateMinShaderModel = new GUIContent( "Force Template Min. Shader Model", "If active, when loading a shader its shader model will be replaced by the one specified in template if what is loaded is below the one set over the template." ); + public static readonly GUIContent ForceTemplateInlineProperties = new GUIContent( "Force Template Inline Properties", "If active, defaults all inline properties to template values." ); + } + + private class Defaults + { + public const ShowOption StartUp = ShowOption.Always; + public const bool AlwaysSnapToGrid = true; + public const bool EnableUndo = false; + public const bool ClearLog = true; + public const bool LogShaderCompile = false; + public const bool LogBatchCompile = false; + public const bool UpdateOnSceneSave = true; + public const bool DisablePreviews = false; + public const bool DisableMaterialMode = false; + public const bool ForceTemplateMinShaderModel = true; + public const bool ForceTemplateInlineProperties = false; + } + + // @diogo: make this private + public class Keys + { + public static string StartUp = "ASELastSession"; + public static string AlwaysSnapToGrid = "ASEAlwaysSnapToGrid"; + public static string EnableUndo = "ASEEnableUndo"; + public static string ClearLog = "ASEClearLog"; + public static string LogShaderCompile = "ASELogShaderCompile"; + public static string LogBatchCompile = "ASELogBatchCompile"; + public static string UpdateOnSceneSave = "ASEUpdateOnSceneSave"; + public static string DisablePreviews = "ASEActivatePreviews"; + public static string DisableMaterialMode = "ASEDisableMaterialMode"; + public static string ForceTemplateMinShaderModel = "ASEForceTemplateMinShaderModel"; + public static string ForceTemplateInlineProperties = "ASEForceTemplateInlineProperties"; + } + + public static ShowOption StartUp = Defaults.StartUp; + public static bool AlwaysSnapToGrid = Defaults.AlwaysSnapToGrid; + public static bool EnableUndo = Defaults.EnableUndo; + public static bool ClearLog = Defaults.ClearLog; + public static bool LogShaderCompile = Defaults.LogShaderCompile; + public static bool LogBatchCompile = Defaults.LogBatchCompile; + public static bool UpdateOnSceneSave = Defaults.UpdateOnSceneSave; + public static bool DisablePreviews = Defaults.DisablePreviews; + public static bool DisableMaterialMode = Defaults.DisableMaterialMode; + public static bool ForceTemplateMinShaderModel = Defaults.ForceTemplateMinShaderModel; + public static bool ForceTemplateInlineProperties = Defaults.ForceTemplateInlineProperties; + + public static void ResetSettings() + { + EditorPrefs.DeleteKey( Keys.StartUp ); + EditorPrefs.DeleteKey( Keys.AlwaysSnapToGrid ); + EditorPrefs.DeleteKey( Keys.EnableUndo ); + EditorPrefs.DeleteKey( Keys.ClearLog ); + EditorPrefs.DeleteKey( Keys.LogShaderCompile ); + EditorPrefs.DeleteKey( Keys.LogBatchCompile ); + EditorPrefs.DeleteKey( Keys.UpdateOnSceneSave ); + EditorPrefs.DeleteKey( Keys.DisablePreviews ); + EditorPrefs.DeleteKey( Keys.DisableMaterialMode ); + EditorPrefs.DeleteKey( Keys.ForceTemplateMinShaderModel ); + EditorPrefs.DeleteKey( Keys.ForceTemplateInlineProperties ); + + StartUp = Defaults.StartUp; + AlwaysSnapToGrid = Defaults.AlwaysSnapToGrid; + EnableUndo = Defaults.EnableUndo; + ClearLog = Defaults.ClearLog; + LogShaderCompile = Defaults.LogShaderCompile; + LogBatchCompile = Defaults.LogBatchCompile; + UpdateOnSceneSave = Defaults.UpdateOnSceneSave; + DisablePreviews = Defaults.DisablePreviews; + DisableMaterialMode = Defaults.DisableMaterialMode; + ForceTemplateMinShaderModel = Defaults.ForceTemplateMinShaderModel; + ForceTemplateInlineProperties = Defaults.ForceTemplateInlineProperties; + } + + public static void LoadSettings() + { + StartUp = ( ShowOption )EditorPrefs.GetInt( Keys.StartUp, ( int )Defaults.StartUp ); + AlwaysSnapToGrid = EditorPrefs.GetBool( Keys.AlwaysSnapToGrid, Defaults.AlwaysSnapToGrid ); + EnableUndo = EditorPrefs.GetBool( Keys.EnableUndo, Defaults.EnableUndo ); + ClearLog = EditorPrefs.GetBool( Keys.ClearLog, Defaults.ClearLog ); + LogShaderCompile = EditorPrefs.GetBool( Keys.LogShaderCompile, Defaults.LogShaderCompile ); + LogBatchCompile = EditorPrefs.GetBool( Keys.LogBatchCompile, Defaults.LogBatchCompile ); + UpdateOnSceneSave = EditorPrefs.GetBool( Keys.UpdateOnSceneSave, Defaults.UpdateOnSceneSave ); + DisablePreviews = EditorPrefs.GetBool( Keys.DisablePreviews, Defaults.DisablePreviews ); + DisableMaterialMode = EditorPrefs.GetBool( Keys.DisableMaterialMode, Defaults.DisableMaterialMode ); + ForceTemplateMinShaderModel = EditorPrefs.GetBool( Keys.ForceTemplateMinShaderModel, Defaults.ForceTemplateMinShaderModel ); + ForceTemplateInlineProperties = EditorPrefs.GetBool( Keys.ForceTemplateInlineProperties, Defaults.ForceTemplateInlineProperties ); + } + + public static void SaveSettings() + { + bool prevDisablePreviews = EditorPrefs.GetBool( Keys.DisablePreviews, false ); + if ( DisablePreviews != prevDisablePreviews ) + { + UIUtils.ActivatePreviews( !DisablePreviews ); + } + + EditorPrefs.SetInt( Keys.StartUp, ( int )StartUp ); + EditorPrefs.SetBool( Keys.AlwaysSnapToGrid, AlwaysSnapToGrid ); + EditorPrefs.SetBool( Keys.EnableUndo, EnableUndo ); + EditorPrefs.SetBool( Keys.ClearLog, ClearLog ); + EditorPrefs.SetBool( Keys.LogShaderCompile, LogShaderCompile ); + EditorPrefs.SetBool( Keys.LogBatchCompile, LogBatchCompile ); + EditorPrefs.SetBool( Keys.UpdateOnSceneSave, UpdateOnSceneSave ); + EditorPrefs.SetBool( Keys.DisablePreviews, DisablePreviews ); + EditorPrefs.SetBool( Keys.DisableMaterialMode, DisableMaterialMode ); + EditorPrefs.SetBool( Keys.ForceTemplateMinShaderModel, ForceTemplateMinShaderModel ); + EditorPrefs.SetBool( Keys.ForceTemplateInlineProperties, ForceTemplateInlineProperties ); + } + + public static void InspectorLayout() + { + StartUp = ( ShowOption )EditorGUILayout.EnumPopup( Styles.StartUp, StartUp ); + AlwaysSnapToGrid = EditorGUILayout.Toggle( Styles.AlwaysSnapToGrid, AlwaysSnapToGrid ); + EnableUndo = EditorGUILayout.Toggle( Styles.EnableUndo, EnableUndo ); + ClearLog = EditorGUILayout.Toggle( Styles.ClearLog, ClearLog ); + LogShaderCompile = EditorGUILayout.Toggle( Styles.LogShaderCompile, LogShaderCompile ); + LogBatchCompile = EditorGUILayout.Toggle( Styles.LogBatchCompile, LogBatchCompile ); + UpdateOnSceneSave = EditorGUILayout.Toggle( Styles.UpdateOnSceneSave, UpdateOnSceneSave ); + DisablePreviews = EditorGUILayout.Toggle( Styles.DisablePreviews, DisablePreviews ); + DisableMaterialMode = EditorGUILayout.Toggle( Styles.DisableMaterialMode, DisableMaterialMode ); + ForceTemplateMinShaderModel = EditorGUILayout.Toggle( Styles.ForceTemplateMinShaderModel, ForceTemplateMinShaderModel ); + ForceTemplateInlineProperties = EditorGUILayout.Toggle( Styles.ForceTemplateInlineProperties, ForceTemplateInlineProperties ); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.User.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.User.cs.meta new file mode 100644 index 00000000..3fce2bbf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.User.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: ab4d917144f5cdc498a08f865e37754c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.User.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs new file mode 100644 index 00000000..2bbad9c8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs @@ -0,0 +1,83 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public partial class Preferences + { + [SettingsProvider] + public static SettingsProvider AmplifyShaderEditorSettings() + { + var provider = new SettingsProvider( "Preferences/Amplify Shader Editor", SettingsScope.User ) + { + guiHandler = ( string searchContext ) => + { + PreferencesGUI(); + }, + + keywords = new HashSet( new[] { "start", "screen", "import", "shader", "templates", "macros", "macros", "define", "symbol" } ), + + }; + return provider; + } + + private static void ResetSettings() + { + User.ResetSettings(); + Project.ResetSettings(); + + User.SaveSettings(); + Project.SaveSettings(); + } + + private static void LoadSettings() + { + User.LoadSettings(); + Project.LoadSettings(); + } + + public static void Initialize() + { + LoadSettings(); + } + + public static void PreferencesGUI() + { + var cache = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 250; + + EditorGUI.BeginChangeCheck(); + { + EditorGUILayout.LabelField( "User", EditorStyles.boldLabel ); + User.InspectorLayout(); + } + if ( EditorGUI.EndChangeCheck() ) + { + User.SaveSettings(); + } + + EditorGUI.BeginChangeCheck(); + { + EditorGUILayout.LabelField( "Project", EditorStyles.boldLabel ); + Project.InspectorLayout(); + } + if ( EditorGUI.EndChangeCheck() ) + { + Project.SaveSettings(); + } + + EditorGUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + if( GUILayout.Button( "Reset and Forget All" ) ) + { + ResetSettings(); + } + EditorGUILayout.EndHorizontal(); + EditorGUIUtility.labelWidth = cache; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs.meta new file mode 100644 index 00000000..06ce93e7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: d036571a581792b44951e3723aef2c01 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs new file mode 100644 index 00000000..f803ac20 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public static class RectExtension + { + private static Rect ValidateBoundaries( this Rect thisRect ) + { + if ( thisRect.yMin > thisRect.yMax ) + { + float yMin = thisRect.yMin; + thisRect.yMin = thisRect.yMax; + thisRect.yMax = yMin; + } + + if ( thisRect.xMin > thisRect.xMax ) + { + float xMin = thisRect.xMin; + thisRect.xMin = thisRect.xMax; + thisRect.xMax = xMin; + } + return thisRect; + } + + public static bool Includes( this Rect thisRect , Rect other ) + { + thisRect = thisRect.ValidateBoundaries(); + other = other.ValidateBoundaries(); + + if ( other.xMin >= thisRect.xMin && other.xMax <= thisRect.xMax ) + { + if ( other.yMin >= thisRect.yMin && other.yMax <= thisRect.yMax ) + { + return true; + } + } + return false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs.meta new file mode 100644 index 00000000..914ece74 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e5a7e5c0308e038448cd1a235bf840ca +timeCreated: 1501521591 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs new file mode 100644 index 00000000..d620b6b3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs @@ -0,0 +1,185 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public enum InlineSamplerFilteringMode + { + Point, + Linear, + Trilinear + }; + + public enum InlineSamplerWrapMode + { + Clamp, + Repeat, + Mirror, + MirrorOnce + }; + + public enum InlineSamplerWrapCoordinates + { + All, + U, + V, + W + }; + + [Serializable] + public class InlineSamplerWrapOptions + { + public InlineSamplerWrapMode WrapMode = InlineSamplerWrapMode.Clamp; + public InlineSamplerWrapCoordinates Coordinates = InlineSamplerWrapCoordinates.All; + public string InlineValue + { + get + { + string name = "_"+WrapMode.ToString(); + if( Coordinates != InlineSamplerWrapCoordinates.All ) + name += Coordinates.ToString(); + name += "_"; + return name; + } + } + } + + [Serializable] + public class SamplerStateAutoGenerator + { + private const int MaxCount = 3; + private const float ButtonLayoutWidth = 15; + private const string AdditionalWrapsStr = "Additional Wraps"; + private const string InlineSamplerStateStr = "Inline Sampler State"; + + [SerializeField] + private InlineSamplerFilteringMode m_filterMode = InlineSamplerFilteringMode.Point; + + [SerializeField] + private InlineSamplerWrapOptions m_mainWrapMode = new InlineSamplerWrapOptions(); + + [SerializeField] + private List m_additionalWrapOptions = new List(); + + [SerializeField] + private bool m_visibleWrapsFoldout = false; + + [SerializeField] + private bool m_visibleMainFoldout = false; + + [NonSerialized] + private UndoParentNode m_owner; + + public void Destroy() + { + m_mainWrapMode = null; + m_additionalWrapOptions.Clear(); + m_additionalWrapOptions = null; + } + + public string AddToDataCollector( ref MasterNodeDataCollector dataCollector ) + { + string inlineSampler = "sampler_"; + + inlineSampler += m_filterMode.ToString(); + inlineSampler += m_mainWrapMode.InlineValue; + + int count = m_additionalWrapOptions.Count; + for( int i = 0; i < count; i++ ) + { + inlineSampler += m_additionalWrapOptions[ i ].InlineValue; + } + return inlineSampler; + } + + void DrawAddRemoveButtons() + { + int count = m_additionalWrapOptions.Count; + if( count < MaxCount && m_owner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) + { + m_additionalWrapOptions.Add( new InlineSamplerWrapOptions() ); + EditorGUI.FocusTextInControl( null ); + } + + if( count > 0 && m_owner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) + { + m_additionalWrapOptions.RemoveAt( count - 1 ); + EditorGUI.FocusTextInControl( null ); + } + } + + public void Draw( UndoParentNode owner ) + { + m_owner = owner; + NodeUtils.DrawNestedPropertyGroup( ref m_visibleMainFoldout, InlineSamplerStateStr, DrawMain ); + } + + void DrawMain() + { + m_filterMode = (InlineSamplerFilteringMode)m_owner.EditorGUILayoutEnumPopup( m_filterMode ); + + EditorGUILayout.BeginHorizontal(); + m_mainWrapMode.WrapMode = (InlineSamplerWrapMode)m_owner.EditorGUILayoutEnumPopup( m_mainWrapMode.WrapMode ); + m_mainWrapMode.Coordinates = (InlineSamplerWrapCoordinates)m_owner.EditorGUILayoutEnumPopup( m_mainWrapMode.Coordinates ); + EditorGUILayout.EndHorizontal(); + NodeUtils.DrawNestedPropertyGroup( ref m_visibleWrapsFoldout, AdditionalWrapsStr, DrawAdditionalWrapModes, DrawAddRemoveButtons ); + } + + void DrawAdditionalWrapModes() + { + EditorGUILayout.Space(); + int count = m_additionalWrapOptions.Count; + for( int i = 0; i < count; i++ ) + { + float maxWidth = 90; + EditorGUILayout.BeginHorizontal(); + m_additionalWrapOptions[ i ].WrapMode = (InlineSamplerWrapMode)m_owner.EditorGUILayoutEnumPopup( m_additionalWrapOptions[ i ].WrapMode ,GUILayout.MaxWidth( maxWidth ) ); + m_additionalWrapOptions[ i ].Coordinates = (InlineSamplerWrapCoordinates)m_owner.EditorGUILayoutEnumPopup( m_additionalWrapOptions[ i ].Coordinates, GUILayout.MaxWidth( maxWidth ) ); + EditorGUILayout.EndHorizontal(); + } + } + + public void ReadFromString( ref uint index, ref string[] nodeParams ) + { + Enum.TryParse( nodeParams[ index++ ], out m_filterMode ); + Enum.TryParse( nodeParams[ index++ ], out m_mainWrapMode.Coordinates ); + + int count = 0; + int.TryParse( nodeParams[ index++ ], out count ); + for( int i = 0; i < count; i++ ) + { + InlineSamplerWrapOptions option = new InlineSamplerWrapOptions(); + + Enum.TryParse( nodeParams[ index++ ], out option.WrapMode ); + Enum.TryParse( nodeParams[ index++ ], out option.Coordinates ); + + m_additionalWrapOptions.Add( option ); + } + } + + public void WriteToString( ref string nodeInfo ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_filterMode ); + + IOUtils.AddFieldValueToString( ref nodeInfo, m_mainWrapMode.WrapMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_mainWrapMode.Coordinates ); + + int count = m_additionalWrapOptions.Count; + IOUtils.AddFieldValueToString( ref nodeInfo, count ); + if( count > 0 ) + { + for( int i = 0; i < count; i++ ) + { + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalWrapOptions[i].WrapMode ); + IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalWrapOptions[i].Coordinates ); + } + } + + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs.meta new file mode 100644 index 00000000..96486d27 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: fe831fe9de481bc4b9df1c1142bb9aa5 +timeCreated: 1580322794 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShaderBodyTokenizer.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShaderBodyTokenizer.cs new file mode 100644 index 00000000..321c924a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShaderBodyTokenizer.cs @@ -0,0 +1,155 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Globalization; +using System.Text.RegularExpressions; + +namespace AmplifyShaderEditor +{ + public struct TokenDesc + { + public string name; + public int position; + public int line; + + public TokenDesc( string name, int position, int line ) + { + this.name = name; + this.position = position; + this.line = line; + } + } + + public class ShaderBodyTokenTable + { + private int count = 0; + public int Count { get { return count; } } + + private LinkedList tokens = new LinkedList(); + private Dictionary>> tokensByName = new Dictionary>>(); + private Dictionary>> tokensByLine = new Dictionary>>(); + + private static List> EmptyTokenList = new List>(); + + public bool Contains( string token ) + { + return tokensByName.ContainsKey( token ); + } + + public List> ListTokensByName( string name ) + { + if ( tokensByName.TryGetValue( name, out List> list ) ) + { + return list; + } + return EmptyTokenList; + } + + public List> ListTokensByLine( int line ) + { + if ( tokensByLine.TryGetValue( line, out List> list ) ) + { + return list; + } + return EmptyTokenList; + } + + public void Add( string name, int position, int line ) + { + var node = tokens.AddLast( new TokenDesc( name, position, line ) ); + + if ( !tokensByName.TryGetValue( name, out List> listPerName ) ) + { + listPerName = new List>(); + tokensByName.Add( name, listPerName ); + } + + if ( !tokensByLine.TryGetValue( line, out List> listPerLine ) ) + { + listPerLine = new List>(); + tokensByLine.Add( line, listPerLine ); + } + + listPerName.Add( node ); + listPerLine.Add( node ); + count++; + } + } + + public class ShaderBodyTokenizer + { + private static double TimeSinceStartup + { + #if UNITY_2020_2_OR_NEWER + get { return Time.realtimeSinceStartupAsDouble; } + #else + get { return Time.realtimeSinceStartup; } + #endif + } + + public static ShaderBodyTokenTable Process( string body ) + { + var tokens = new ShaderBodyTokenTable(); + int charIndex = 0; + int charCount = body.Length; + int line = 0; + var tokenBuilder = new StringBuilder( 1024 ); + do + { + char c = body[ charIndex++ ]; + bool isBreak = ( c == '\n' ); + bool isEmpty = ( isBreak || c == ' ' || c == '\t' || c == '\r' || c == '(' || c == ')' || c == '{' || c == '}' || c == '[' || c == ']' || c == ';' || c == ',' || c == '\"' ); + if ( !isEmpty ) + { + tokenBuilder.Clear(); + int position = charIndex; + + while ( !isEmpty && charIndex < charCount ) + { + tokenBuilder.Append( c ); + c = body[ charIndex++ ]; + isBreak = ( c == '\n' ); + isEmpty = ( isBreak || c == ' ' || c == '\t' || c == '\r' || c == '(' || c == ')' || c == '{' || c == '}' || c == '[' || c == ']' || c == ';' || c == ',' || c == '\"' ); + line += isBreak ? 1 : 0; + } + + string token = tokenBuilder.ToString(); + if ( !token.StartsWith( "//" ) ) + { + tokens.Add( token, position, line ); + } + } + else + { + line += isBreak ? 1 : 0; + } + } while ( charIndex < charCount ); + return tokens; + } + + public static void TestProcess( string body ) + { + UnityEngine.Profiling.Profiler.BeginSample( "Tokenize" ); + double start = TimeSinceStartup; + ShaderBodyTokenTable tokens = ShaderBodyTokenizer.Process( body ); + UnityEngine.Profiling.Profiler.EndSample(); + Debug.Log( "Found " + tokens.Count + " tokens, taking " + ( ( TimeSinceStartup - start ) * 1000 ) + " ms" ); + Debug.Log( "Has Fallback " + tokens.Contains( "Fallback" ) ); + Debug.Log( "Has CustomEditor " + tokens.Contains( "CustomEditor" ) ); + var list = tokens.ListTokensByName( "CustomEditor" ); + foreach ( var node in list ) + { + Debug.Log( "Name: " + node.Value.name + ", Position: " + node.Value.position + ", Line: " + node.Value.line ); + } + + //foreach ( var node in list ) + // + //File.WriteAllLines( "C:/Users/Diogo/Desktop/dump.txt", tokens.Keys ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShaderBodyTokenizer.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShaderBodyTokenizer.cs.meta new file mode 100644 index 00000000..aeb86783 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShaderBodyTokenizer.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6852cf9e70d26d54eb91f7b259b65dfb +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ShaderBodyTokenizer.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs new file mode 100644 index 00000000..3e48aa82 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs @@ -0,0 +1,215 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + public class ShortcutItem + { + public delegate void ShortcutFunction(); + public ShortcutFunction MyKeyDownFunctionPtr; + public ShortcutFunction MyKeyUpFunctionPtr; + public string Name; + public string Description; + + public ShortcutItem( string name, string description ) + { + Name = name; + Description = description; + } + + public ShortcutItem( string name, string description, ShortcutFunction myKeyDownFunctionPtr, ShortcutFunction myKeyUpFunctionPtr = null ) + { + Name = name; + Description = description; + MyKeyDownFunctionPtr = myKeyDownFunctionPtr; + MyKeyUpFunctionPtr = myKeyUpFunctionPtr; + } + + public void Destroy() + { + MyKeyDownFunctionPtr = null; + MyKeyUpFunctionPtr = null; + } + } + + public class ShortcutsManager + { + public static readonly KeyCode ScrollUpKey = KeyCode.PageUp; + public static readonly KeyCode ScrollDownKey = KeyCode.PageDown; + + + private const string ItemWikiFormat = "*[{0}]: {1}\n"; + private Dictionary> m_editorShortcutsDict = new Dictionary>(); + private Dictionary m_editorNoModifiersShortcutsDict = new Dictionary(); + private List m_editorShortcutsList = new List(); + + private Dictionary m_nodesShortcutsDict = new Dictionary(); + private List m_nodesShortcutsList = new List(); + + public void DumpShortcutsToDisk( string pathname ) + { + if ( !System.IO.Directory.Exists( pathname ) ) + { + System.IO.Directory.CreateDirectory( pathname ); + } + + string list = "=== Full Shortcut List ===\n"; + list += "==== Editor ====\n"; + for ( int i = 0; i < m_editorShortcutsList.Count; i++ ) + { + list += string.Format( ItemWikiFormat, m_editorShortcutsList[ i ].Name, m_editorShortcutsList[ i ].Description ); + } + list += "\n"; + list += "==== Nodes ====\n"; + for ( int i = 0; i < m_nodesShortcutsList.Count; i++ ) + { + list += string.Format( ItemWikiFormat, m_nodesShortcutsList[ i ].Name, m_nodesShortcutsList[ i ].Description ); + } + + string shortcutsPathnames = pathname + "KeyboardShortcuts.txt"; + Debug.Log( " Creating shortcuts file at " + shortcutsPathnames ); + IOUtils.SaveTextfileToDisk( list, shortcutsPathnames, false ); + } + + public void RegisterNodesShortcuts( KeyCode key, string nodeName ) + { + if ( m_nodesShortcutsDict.ContainsKey( key ) ) + { + if ( DebugConsoleWindow.DeveloperMode ) + { + Debug.Log( "Attempting to register an already used node shortcut key " + key ); + } + return; + } + m_nodesShortcutsDict.Add( key, new ShortcutItem( key.ToString(), nodeName ) ); + m_nodesShortcutsList.Add( m_nodesShortcutsDict[ key ] ); + } + + public void RegisterEditorShortcut( bool showOnList, EventModifiers modifiers, KeyCode key, string description, ShortcutItem.ShortcutFunction myKeyDownFunctionPtr, ShortcutItem.ShortcutFunction myKeyUpFunctionPtr = null ) + { + if ( m_editorShortcutsDict.ContainsKey( key ) ) + { + if ( m_editorShortcutsDict[ key ].ContainsKey( modifiers ) ) + { + if ( DebugConsoleWindow.DeveloperMode ) + { + Debug.Log( "Attempting to register an already used editor shortcut key " + key ); + } + return; + } + } + else + { + m_editorShortcutsDict.Add( key, new Dictionary() ); + } + ShortcutItem item = new ShortcutItem( ( ( modifiers == EventModifiers.None || modifiers == EventModifiers.FunctionKey ) ? key.ToString() : modifiers + " + " + key ), description, myKeyDownFunctionPtr, myKeyUpFunctionPtr ); + m_editorShortcutsDict[ key ].Add( modifiers, item ); + if ( showOnList ) + m_editorShortcutsList.Add( item ); + } + + public void RegisterEditorShortcut( bool showOnList, KeyCode key, string description, ShortcutItem.ShortcutFunction myKeyDownFunctionPtr, ShortcutItem.ShortcutFunction myKeyUpFunctionPtr = null ) + { + if ( m_editorNoModifiersShortcutsDict.ContainsKey( key ) ) + { + if ( DebugConsoleWindow.DeveloperMode ) + { + Debug.Log( "Attempting to register an already used editor shortcut key " + key ); + } + return; + } + + ShortcutItem item = new ShortcutItem( key.ToString(), description, myKeyDownFunctionPtr, myKeyUpFunctionPtr ); + m_editorNoModifiersShortcutsDict.Add( key, item ); + if ( showOnList ) + m_editorShortcutsList.Add( item ); + } + + public bool ActivateShortcut( EventModifiers modifiers, KeyCode key, bool isKeyDown ) + { + if ( m_editorShortcutsDict.ContainsKey( key ) ) + { + if ( isKeyDown ) + { + if ( m_editorShortcutsDict[ key ].ContainsKey( modifiers ) ) + { + if ( m_editorShortcutsDict[ key ][ modifiers ].MyKeyDownFunctionPtr != null ) + { + m_editorShortcutsDict[ key ][ modifiers ].MyKeyDownFunctionPtr(); + return true; + } + } + } + else + { + if ( m_editorShortcutsDict[ key ].ContainsKey( modifiers ) ) + { + if ( m_editorShortcutsDict[ key ][ modifiers ].MyKeyUpFunctionPtr != null ) + { + m_editorShortcutsDict[ key ][ modifiers ].MyKeyUpFunctionPtr(); + return true; + } + } + } + } + + if ( modifiers == EventModifiers.None && m_editorNoModifiersShortcutsDict.ContainsKey( key ) ) + { + if ( isKeyDown ) + { + if ( m_editorNoModifiersShortcutsDict[ key ].MyKeyDownFunctionPtr != null ) + { + m_editorNoModifiersShortcutsDict[ key ].MyKeyDownFunctionPtr(); + return true; + } + } + else + { + if ( m_editorNoModifiersShortcutsDict[ key ].MyKeyUpFunctionPtr != null ) + { + m_editorNoModifiersShortcutsDict[ key ].MyKeyUpFunctionPtr(); + return true; + } + } + } + + return false; + } + + public void Destroy() + { + foreach ( KeyValuePair kvp in m_editorNoModifiersShortcutsDict ) + { + kvp.Value.Destroy(); + } + m_editorNoModifiersShortcutsDict.Clear(); + m_editorNoModifiersShortcutsDict = null; + + foreach ( KeyValuePair> kvpKey in m_editorShortcutsDict ) + { + foreach ( KeyValuePair kvpMod in kvpKey.Value ) + { + kvpMod.Value.Destroy(); + } + kvpKey.Value.Clear(); + } + m_editorShortcutsDict.Clear(); + m_editorShortcutsDict = null; + + m_editorShortcutsList.Clear(); + m_editorShortcutsList = null; + + m_nodesShortcutsDict.Clear(); + m_nodesShortcutsDict = null; + + m_nodesShortcutsList.Clear(); + m_nodesShortcutsList = null; + } + + public List AvailableEditorShortcutsList { get { return m_editorShortcutsList; } } + public List AvailableNodesShortcutsList { get { return m_nodesShortcutsList; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs.meta new file mode 100644 index 00000000..022f1612 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 15917e71489c3ca4dbc5fdef9bb37433 +timeCreated: 1487952057 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TextureArrayCreatorAsset.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TextureArrayCreatorAsset.cs new file mode 100644 index 00000000..bf7b2777 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TextureArrayCreatorAsset.cs @@ -0,0 +1,78 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TextureArrayCreatorAsset : ScriptableObject + { + #pragma warning disable + [SerializeField] + private int m_selectedSize = 4; + + [SerializeField] + private bool m_lockRatio = true; + + [SerializeField] + private int m_sizeX = 512; + + [SerializeField] + private int m_sizeY = 512; + + [SerializeField] + private bool m_tex3DMode = false; + + [SerializeField] + private bool m_linearMode = false; + + [SerializeField] + private bool m_mipMaps = true; + + [SerializeField] + private TextureWrapMode m_wrapMode = TextureWrapMode.Repeat; + + [SerializeField] + private FilterMode m_filterMode = FilterMode.Bilinear; + + [SerializeField] + private int m_anisoLevel = 1; + + [SerializeField] + private TextureFormat m_selectedFormatEnum = TextureFormat.ARGB32; + + [SerializeField] + private int m_quality = 100; + + [SerializeField] + private string m_folderPath = "Assets/"; + + [SerializeField] + private string m_fileName = "NewTextureArray"; + + [SerializeField] + private bool m_filenameChanged = false; + + [SerializeField] + private List m_allTextures = new List(); + + public int SelectedSize { get { return m_selectedSize; } } + public int SizeX { get { return m_sizeX; } } + public int SizeY { get { return m_sizeY; } } + public bool Tex3DMode { get { return m_tex3DMode; } } + public bool LinearMode { get { return m_linearMode; } } + public bool MipMaps { get { return m_mipMaps; } } + public TextureWrapMode WrapMode { get { return m_wrapMode; } } + public FilterMode FilterMode { get { return m_filterMode; } } + public int AnisoLevel { get { return m_anisoLevel; } } + public TextureFormat SelectedFormatEnum { get { return m_selectedFormatEnum; } } + public int Quality { get { return m_quality; } } + public string FolderPath { get { return m_folderPath; } } + public string FileName { get { return m_fileName; } } + public List AllTextures { get { return m_allTextures; } } + #pragma warning restore + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TextureArrayCreatorAsset.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TextureArrayCreatorAsset.cs.meta new file mode 100644 index 00000000..8b3936f1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TextureArrayCreatorAsset.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 47f91343d4ad12542b3eb9511e2b310c +timeCreated: 1596799060 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/TextureArrayCreatorAsset.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs new file mode 100644 index 00000000..1d888355 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs @@ -0,0 +1,148 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System.IO; +using System.Reflection; +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class TipsWindow : MenuParent + { + private static bool m_showWindow = false; + private bool m_dontShowAtStart = false; + + private static List AllTips = new List() { + "You can press W to toggle between a flat and color coded Wires and ports.", + "You can press CTRL+W to toggle between multiline or singleline Wire connections.", + "You can press P to globally open all node Previews.", + "You can press F to Focus your selection, single tap centers the selection while double tap it to also zooms on in.", + "You can press CTRL+F to open a search bar and Find a node by it's title", + "You can press SPACE to open a context menu to add a new node and press TAB or SHIFT+TAB tocycle between the found nodes", + "You can remove a node without breaking the graph connections by pressing ALT and then dragging the node out", + "You can switch two input connections holding CTRL while dragging one input connection into the other", + }; + + int m_currentTip = 0; + + public TipsWindow( AmplifyShaderEditorWindow parentWindow ) : base( parentWindow, 0, 0, 0, 64, "Tips", MenuAnchor.TOP_LEFT, MenuAutoSize.NONE ) + { + //m_dontShowAtStart = EditorPrefs.GetBool( "DontShowTipAtStart", false ); + } + + public override void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus ) + { + base.Draw( parentPosition, mousePosition, mouseButtonId, hasKeyboadFocus ); + + DrawWindow( mousePosition ); + } + + public void DrawWindow( Vector2 mousePosition ) + { + if( !m_showWindow ) + return; + + Rect windowRect = new Rect( 0, 0, Screen.width, Screen.height ); + Vector2 center = windowRect.center; + windowRect.size = new Vector2( 300, 200 ); + windowRect.center = center; + Color temp = GUI.color; + GUI.color = Color.white; + GUI.Label( windowRect, string.Empty, GUI.skin.FindStyle( "flow node 0" ) ); + + if( Event.current.type == EventType.MouseDown && !windowRect.Contains( mousePosition ) ) + m_showWindow = false; + + Rect titleRect = windowRect; + titleRect.height = 35; + GUI.Label( titleRect, "Quick Tip!", GUI.skin.FindStyle( "TL Selection H2" ) ); + Rect button = titleRect; + button.size = new Vector2( 14, 14 ); + button.y += 2; + button.x = titleRect.xMax - 16; + if( GUI.Button( button, string.Empty, GUI.skin.FindStyle( "WinBtnClose" ) ) ) + CloseWindow(); + + button.y += 100; + if( GUI.Button( button, ">" ) ) + { + m_currentTip++; + if( m_currentTip >= AllTips.Count ) + m_currentTip = 0; + } + + Rect textRect = windowRect; + textRect.yMin = titleRect.yMax; + GUI.Label( textRect, AllTips[ m_currentTip ], GUI.skin.FindStyle( "WordWrappedLabel" ) ); + + Rect footerRect = windowRect; + footerRect.yMin = footerRect.yMax - 18; + footerRect.x += 3; + GUI.Label( footerRect, (m_currentTip + 1) + " of " + AllTips.Count + " tips" ); + footerRect.x += 170; + EditorGUI.BeginChangeCheck(); + m_dontShowAtStart = GUI.Toggle( footerRect, m_dontShowAtStart, "Don't show at start" ); + if( EditorGUI.EndChangeCheck() ) + { + EditorPrefs.SetBool( "DontShowTipAtStart", m_dontShowAtStart ); + } + GUI.color = temp; + + if( Event.current.type == EventType.MouseDown && windowRect.Contains( mousePosition ) ) + { + Event.current.Use(); + ParentWindow.MouseInteracted = true; + } + } + + public override void Destroy() + { + base.Destroy(); + } + + public static void ShowWindow( bool toggle = true ) + { + if( toggle ) + m_showWindow = !m_showWindow; + else + m_showWindow = true; + + //Test(); + //ExportCompiledShaders(); + } + + //public static void Test() + //{ + // Shader shader = UIUtils.CurrentWindow.CurrentGraph.CurrentShader; + // int mode = EditorPrefs.GetInt( "ShaderInspectorPlatformMode", 1 ); + // int mask = EditorPrefs.GetInt( "ShaderInspectorPlatformMask", 524287 ); + // bool strip = EditorPrefs.GetInt( "ShaderInspectorVariantStripping", 1 ) == 0; + // ShaderUtilEx.OpenCompiledShader( shader, mode, mask, strip ); + //} + + //public static void ExportCompiledShaders() + //{ + // Shader shader = UIUtils.CurrentWindow.CurrentGraph.CurrentShader; + // string shaderPath = AssetDatabase.GetAssetPath( shader ); + // SerializedObject so = new SerializedObject( shader ); + // SerializedProperty prop = so.FindProperty( "m_Script" ); + // var compiledShaderString = prop.stringValue; + // Directory.CreateDirectory( Application.dataPath + "/../ShaderSource/" ); + // if( compiledShaderString == null ) + // return; + // var outputPath = Application.dataPath + "/../ShaderSource/" + Path.GetFileNameWithoutExtension( shaderPath ) + "_compiled.shader"; + // var sw = File.CreateText( outputPath ); + // sw.Write( compiledShaderString ); + // sw.Close(); + //} + + public static void CloseWindow() + { + m_showWindow = false; + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs.meta new file mode 100644 index 00000000..4ce789e7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 565dc3c9725b0db49b7d5ea17d151682 +timeCreated: 1504704078 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs new file mode 100644 index 00000000..21f00b39 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs @@ -0,0 +1,3209 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; +using System; +using System.Reflection; +using System.Text.RegularExpressions; + +namespace AmplifyShaderEditor +{ + public enum ASEColorSpace + { + Auto, + Gamma, + Linear + } + + public enum SurfaceInputs + { + DEPTH = 0, + UV_COORDS, + UV2_COORDS, + VIEW_DIR, + COLOR, + SCREEN_POS, + WORLD_POS, + WORLD_REFL, + WORLD_NORMAL, + FRONT_FACING, + FRONT_FACING_VFACE, + INTERNALDATA + } + + public enum CustomStyle + { + NodeWindowOff = 0, + NodeWindowOn, + NodeTitle, + NodeHeader, + CommentaryHeader, + ShaderLibraryTitle, + ShaderLibraryAddToList, + ShaderLibraryRemoveFromList, + ShaderLibraryOpenListed, + ShaderLibrarySelectionAsTemplate, + ShaderLibraryItem, + CommentaryTitle, + PortEmptyIcon, + PortFullIcon, + InputPortlabel, + OutputPortLabel, + CommentaryResizeButton, + CommentaryResizeButtonInv, + CommentaryBackground, + MinimizeButton, + MaximizeButton, + NodePropertiesTitle, + ShaderModeTitle, + MaterialModeTitle, + ShaderNoMaterialModeTitle, + PropertyValuesTitle, + ShaderModeNoShader, + MainCanvasTitle, + ShaderBorder, + MaterialBorder, + SamplerTextureRef, + SamplerTextureIcon, + CustomExpressionAddItem, + CustomExpressionRemoveItem, + CustomExpressionSmallAddItem, + CustomExpressionSmallRemoveItem, + ResetToDefaultInspectorButton, + SliderStyle, + ObjectPicker, + NodePropertyPicker, + NodePreviewExpander, + NodePreviewCollapser, + SamplerButton, + SamplerFrame, + CommentarySuperTitle, + MiniButtonTopLeft, + MiniButtonTopMid, + MiniButtonTopRight, + ShaderFunctionBorder, + ShaderFunctionMode, + RightShaderMode, + FlatBackground, + DocumentationLink, + GraphButtonIcon, + GraphButton, + NodeWindowOffSquare, + NodeHeaderSquare, + NodeWindowOnSquare, + ConsoleLogMessage, + ConsoleLogCircle + } + + public enum MasterNodePortCategory + { + Vertex = 1 << 0, + Fragment = 1 << 1, + Tessellation = 1 << 2, + Debug = 1 << 3 + } + + public enum PortGenType + { + NonCustomLighting, + //Normal = 1 << 1, + //Emission = 1 << 2, + //Metallic = 1 << 3, + //Specular = 1 << 4, + CustomLighting + } + + public struct NodeData + { + public MasterNodePortCategory Category; + public int OrderIndex; + public int GraphDepth; + public NodeData( MasterNodePortCategory category ) + { + Category = category; + OrderIndex = 0; + GraphDepth = -1; + } + } + + public struct NodeCastInfo + { + public int NodeId; + public int PortId; + public NodeCastInfo( int nodeId, int portId ) + { + NodeId = nodeId; + PortId = portId; + } + public override string ToString() + { + return NodeId.ToString() + PortId.ToString(); + } + }; + + public struct ButtonClickId + { + public const int LeftMouseButton = 0; + public const int RightMouseButton = 1; + public const int MiddleMouseButton = 2; + } + + public enum ASESelectionMode + { + Shader = 0, + Material, + ShaderFunction + } + + public enum DrawOrder + { + Background, + Default + } + + public enum NodeConnectionStatus + { + Not_Connected = 0, + Connected, + Error, + Island + } + + public enum InteractionMode + { + Target, + Other, + Both + } + + public enum FunctionNodeCategories + { + Custom, + CameraAndScreen, + ConstantsAndProperties, + Functions, + ImageEffects, + Light, + LogicalOperators, + MathOperators, + MatrixOperators, + Miscellaneous, + ObjectTransform, + SurfaceData, + Textures, + Time, + TrigonometryOperators, + UVCoordinates, + VectorOperators, + VertexData + } + + public enum TransformSpaceFrom + { + Object = 0, + World, + View, + Tangent + } + + public enum TransformSpaceTo + { + Object = 0, + World, + View, + Tangent, + Clip, + Screen + } + + public class UIUtils + { + public static string NewTemplateGUID; + public static int SerializeHelperCounter = 0; + public static bool IgnoreDeselectAll = false; + + public static bool DirtyMask = true; + public static bool Initialized = false; + public static float HeaderMaxHeight; + public static float CurrentHeaderHeight; + public static GUISkin MainSkin = null; + public static GUIStyle PlusStyle; + public static GUIStyle MinusStyle; + public static GUIStyle RangedFloatSliderStyle; + public static GUIStyle RangedFloatSliderThumbStyle; + public static GUIStyle SwitchNodePopUp; + public static GUIStyle PropertyPopUp; + public static GUIStyle ObjectField; + public static GUIStyle PreviewExpander; + public static GUIStyle PreviewCollapser; + public static GUIStyle ObjectFieldThumb; + public static GUIStyle ObjectFieldThumbOverlay; + public static GUIStyle InspectorPopdropdownStyle; + public static GUIStyle InspectorPopdropdownFallback; + public static GUIStyle BoldErrorStyle; + public static GUIStyle BoldWarningStyle; + public static GUIStyle BoldInfoStyle; + public static GUIStyle Separator; + public static GUIStyle ToolbarMainTitle; + public static GUIStyle ToolbarSearchTextfield; + public static GUIStyle ToolbarSearchCancelButton; + public static GUIStyle MiniButtonTopLeft; + public static GUIStyle MiniButtonTopMid; + public static GUIStyle MiniButtonTopRight; + + public static GUIStyle CommentaryTitle; + public static GUIStyle StickyNoteText; + public static GUIStyle InputPortLabel; + public static GUIStyle OutputPortLabel; + + public static GUIStyle MiniObjectFieldThumbOverlay; + public static GUIStyle MiniSamplerButton; + + public static GUIStyle NodeWindowOffSquare; + public static GUIStyle NodeHeaderSquare; + public static GUIStyle NodeWindowOnSquare; + public static GUIStyle InternalDataOnPort; + public static GUIStyle InternalDataBackground; + + public static GUIStyle GraphButtonIcon; + public static GUIStyle GraphButton; + public static GUIStyle GraphDropDown; + + public static GUIStyle EmptyStyle = new GUIStyle(); + + public static GUIStyle ConsoleLogLabel; + public static GUIStyle ConsoleLogMessage; + public static GUIStyle ConsoleLogCircle; + + public static GUIStyle TooltipBox; + public static GUIStyle Box; + public static GUIStyle Button; + public static GUIStyle TextArea; + public static GUIStyle Label; + public static GUIStyle Toggle; + public static GUIStyle Textfield; + + public static GUIStyle UnZoomedNodeTitleStyle; + public static GUIStyle UnZoomedPropertyValuesTitleStyle; + public static GUIStyle UnZoomedInputPortStyle; + public static GUIStyle UnZoomedOutputPortPortStyle; + + // Node Property Menu items + public static GUIStyle MenuItemToggleStyle; + public static GUIStyle MenuItemEnableStyle; + public static GUIStyle MenuItemBackgroundStyle; + public static GUIStyle MenuItemToolbarStyle; + public static GUIStyle MenuItemInspectorDropdownStyle; + + public static GUIStyle FloatIntPickerONOFF; + + public static bool UsingProSkin = false; + + public static Texture ShaderIcon { get { return EditorGUIUtility.IconContent( "Shader Icon" ).image; } } + public static Texture MaterialIcon { get { return EditorGUIUtility.IconContent( "Material Icon" ).image; } } + + //50be8291f9514914aa55c66c49da67cf + public static Texture ShaderFunctionIcon { get { return AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "50be8291f9514914aa55c66c49da67cf" ) ); } } + + public static Texture2D WireNodeSelection = null; + public static Texture2D SliderButton = null; + + public static Texture2D SmallErrorIcon = null; + public static Texture2D SmallWarningIcon = null; + public static Texture2D SmallInfoIcon = null; + + public static Texture2D CheckmarkIcon = null; + public static Texture2D PopupIcon = null; + + public static Texture2D MasterNodeOnTexture = null; + public static Texture2D MasterNodeOffTexture = null; + + public static Texture2D GPUInstancedOnTexture = null; + public static Texture2D GPUInstancedOffTexture = null; + + public static GUIContent LockIconOpen = null; + public static GUIContent LockIconClosed = null; + + public static GUIContent FloatIntIconON = null; + public static GUIContent FloatIntIconOFF = null; + + public static bool ShowContextOnPick = true; + + private static AmplifyShaderEditorWindow m_currentWindow = null; + public static AmplifyShaderEditorWindow CurrentWindow + { + get + { + if( m_currentWindow == null ) + { + for( int i = 0 ; i < IOUtils.AllOpenedWindows.Count ; i++ ) + { + if( IOUtils.AllOpenedWindows[ i ] != null ) + { + m_currentWindow = IOUtils.AllOpenedWindows[ i ]; + } + else + { + //Debug.Log("No Window Found!"); + } + } + } + return m_currentWindow; + } + set { m_currentWindow = value; } + } + + public static Vector2 PortsSize; + public static Vector3 PortsDelta; + public static Vector3 ScaledPortsDelta; + + public static RectOffset RectOffsetZero; + public static RectOffset RectOffsetOne; + public static RectOffset RectOffsetTwo; + public static RectOffset RectOffsetThree; + public static RectOffset RectOffsetFour; + public static RectOffset RectOffsetFive; + public static RectOffset RectOffsetSix; + + public static Material LinearMaterial = null; + public static Shader IntShader = null; + public static Shader FloatShader = null; + public static Shader Vector2Shader = null; + public static Shader Vector3Shader = null; + public static Shader Vector4Shader = null; + public static Shader ColorShader = null; + public static Shader Texture2DShader = null; + public static Shader MaskingShader = null; + + public static bool InhibitMessages = false; + + + private static int m_shaderIndentLevel = 0; + private static string m_shaderIndentTabs = string.Empty; + + //Label Vars + + private static TextAnchor m_alignment; + private static TextClipping m_clipping; + private static bool m_wordWrap; + private static int m_fontSize; + private static Color m_fontColor; + private static FontStyle m_fontStyle; + + + private static string NumericNamePattern = @"^\d"; + private static System.Globalization.TextInfo m_textInfo; + private static string m_latestOpenedFolder = string.Empty; + private static Dictionary m_undoHelper = new Dictionary(); + + private static Dictionary AvailableKeywordsDict = new Dictionary(); + public static readonly string[] AvailableKeywords = + { + "Custom", + "ETC1_EXTERNAL_ALPHA", + "PIXELSNAP_ON", + "UNITY_PASS_FORWARDBASE", + "UNITY_PASS_FORWARDADD", + "UNITY_PASS_DEFERRED", + "UNITY_PASS_SHADOWCASTER", + "UNITY_INSTANCING_ENABLED", + "DIRECTIONAL_COOKIE" + + }; + + private static Dictionary AvailableURPKeywordsDict = new Dictionary(); + public static readonly string[] AvailableURPKeywords = + { + "Custom", + "ETC1_EXTERNAL_ALPHA", + "PIXELSNAP_ON", + "SHADERPASS_EXTRA_PREPASS", + "SHADERPASS_FORWARD", + "SHADERPASS_SHADOWCASTER", + "SHADERPASS_DEPTHONLY", + "SHADERPASS_META", + "SHADERPASS_2D", + "UNITY_INSTANCING_ENABLED", + "DIRECTIONAL_COOKIE" + }; + + //private static Dictionary URPToBultinKeywordsDict = new Dictionary() + //{ + // {"SHADERPASS_FORWARD","UNITY_PASS_FORWARDBASE"}, + // {"SHADERPASS_SHADOWCASTER","UNITY_PASS_SHADOWCASTER"} + //}; + + //private static Dictionary BultinToURPKeywordsDict = new Dictionary() + //{ + // {"UNITY_PASS_FORWARDBASE","SHADERPASS_FORWARD"}, + // {"UNITY_PASS_SHADOWCASTER","SHADERPASS_SHADOWCASTER"} + //}; + + public static readonly string[] CategoryPresets = + { + "", + "Camera And Screen", + "Constants And Properties", + "Functions", + "Image Effects", + "Lighting", + "Logical Operators", + "Math Operators", + "Matrix Operators", + "Miscellaneous", + "Object Transform", + "Surface Data", + "Textures", + "Time", + "Trigonometry Operators", + "UV Coordinates", + "Vector Operators", + "Vertex Data" + }; + + private static Dictionary m_portCategoryToArrayIdx = new Dictionary + { + { MasterNodePortCategory.Vertex,0}, + { MasterNodePortCategory.Tessellation,0}, + { MasterNodePortCategory.Fragment,1}, + { MasterNodePortCategory.Debug,1} + }; + + private static Dictionary m_reservedPropertyNames = new Dictionary + { + { "UNITY_MATRIX_MVP", string.Empty}, + { "UNITY_MATRIX_MV", string.Empty}, + { "UNITY_MATRIX_V", string.Empty}, + { "UNITY_MATRIX_P", string.Empty}, + { "UNITY_MATRIX_VP", string.Empty}, + { "UNITY_MATRIX_T_MV", string.Empty}, + { "UNITY_MATRIX_IT_MV", string.Empty}, + { "UNITY_MATRIX_TEXTURE0", string.Empty}, + { "UNITY_MATRIX_TEXTURE1", string.Empty}, + { "UNITY_MATRIX_TEXTURE2", string.Empty}, + { "UNITY_MATRIX_TEXTURE3", string.Empty}, + { "_Object2World", string.Empty}, + { "_WorldSpaceCameraPos", string.Empty}, + { "unity_Scale", string.Empty}, + { "_ModelLightColor", string.Empty}, + { "_SpecularLightColor", string.Empty}, + { "_ObjectSpaceLightPos", string.Empty}, + { "_Light2World", string.Empty}, + { "_World2Light", string.Empty}, + { "_Object2Light", string.Empty}, + { "_Time", string.Empty}, + { "_SinTime", string.Empty}, + { "_CosTime", string.Empty}, + { "unity_DeltaTime", string.Empty}, + { "_ProjectionParams", string.Empty}, + { "_ScreenParams", string.Empty} + }; + + private static Dictionary m_exampleMaterialIDs = new Dictionary() + { + //Community + {"2Sided", "8ebbbf2c99a544ca780a2573ef1450fc" }, + {"DissolveBurn", "f144f2d7ff3daf349a2b7f0fd81ec8ac" }, + {"MourEnvironmentGradient", "b64adae401bc073408ac7bff0993c107" }, + {"ForceShield", "0119aa6226e2a4cfdb6c9a5ba9df7820" }, + {"HighlightAnimated", "3d232e7526f6e426cab994cbec1fc287" }, + {"Hologram", "b422c600f1c3941b8bc7e95db33476ad" }, + {"LowPolyWater", "0557703d3791a4286a62f8ee709d5bef"}, + //Official + {"AnimatedFire", "63ea5eae6d954a14292033589d0d4275" }, + {"AnimatedFire-ShaderFunction", "9c6c9fcb82afe874a825a9e680e694b2" }, + {"BurnEffect", "0b019675a8064414b97862a02f644166" }, + {"CubemapReflections", "2c299f827334e9c459a60931aea62260" }, + {"DitheringFade", "610507217b7dcad4d97e6e03e9844171" }, + {"DoubleLayerCustomSurface", "846aec4914103104d99e9e31a217b548" }, + {"NormalExtrusion", "70a5800fbba039f46b438a2055bc6c71" }, + {"MatcapSample", "da8aaaf01fe8f2b46b2fbcb803bd7af4" }, + {"ParallaxMappingIterations", "a0cea9c3f318ac74d89cd09134aad000" }, + {"SandPOM", "905481dc696211145b88dc4bac2545f3" }, + {"ParallaxWindow", "63ad0e7afb1717b4e95adda8904ab0c3" }, + {"LocalPosCutoff", "fed8c9d33a691084c801573feeed5a62" }, + {"ImprovedReadFromAtlasTiled", "941b31b251ea8e74f9198d788a604c9b" }, + {"ReadFromAtlasTiled", "2d5537aa702f24645a1446dc3be92bbf" }, + {"ReflectRefractSoapBubble", "a844987c9f2e7334abaa34f12feda3b9" }, + {"RimLight", "e2d3a4d723cf1dc4eab1d919f3324dbc" }, + {"RefractedShadows", "11818aa28edbeb04098f3b395a5bfc1d" }, + {"TextureArray", "0f572993ab788a346aea45f2f797b7fa" }, + {"ObjectNormalRefraction", "f1a0a645876302547b608ce881c94e6d" }, + {"ShaderBallInterior", "e47ee174f55b6144b9c1a942bb23d82a" }, + {"ScreenSpaceCurvature", "2e794cb9b3900b043a37ba28cdc2f907" }, + {"ScreenSpaceDetail", "3a0163d12fede4d47a1f818a66a115de" }, + {"SimpleNoise", "cc167bc6c2063a14f84a5a77be541194" }, + {"SimpleBlur", "1d283ff911af20e429180bb15d023661" }, + {"SimpleGPUInstancing", "9d609a7c8d00c7c4c9bdcdcdba154b81" }, + {"SimpleLambert", "54b29030f7d7ffe4b84f2f215dede5ac" }, + {"SimpleRefraction", "58c94d2f48acdc049a53b4ca53d6d98a" }, + {"SimpleTexture", "9661085a7d249a54c95078ac8e7ff004" }, + {"SnowAccum", "e3bd639f50ae1a247823079047a8dc01" }, + {"StencilDiffuse01", "9f47f529fdeddd948a2d2722f73e6ac4" }, + {"StencilMask01", "6f870834077d59b44ac421c36f619d59" }, + {"StencilDiffuse02", "11cdb862d5ba68c4eae526765099305b" }, + {"StencilMask02", "344696733b065c646b18c1aa2eacfdb7" }, + {"StencilDiffuse03", "75e851f6c686a5f42ab900222b29355b" }, + {"StencilMask03", "c7b3018ad495c6b479f2e3f8564aa6dc" }, + {"AnimatedRefraction", "e414af1524d258047bb6b82b8860062c" }, + {"Tessellation", "efb669a245f17384c88824d769d0087c" }, + {"Translucency", "842ba3dcdd461ea48bdcfcea316cbcc4" }, + {"Transmission", "1b21506b7afef734facfc42c596caa7b" }, + {"Transparency", "e323a62068140c2408d5601877e8de2c" }, + {"TriplanarProjection", "663d512de06d4e24db5205c679f394cb" }, + {"TwoSideWithFace", "c953c4b601ba78e4f870d24d038b67f6" }, + {"Ground", "48df9bdf7b922d94bb3167e6db39c943" }, + {"WaterSample", "288137d67ce790e41903020c572ab4d7" }, + {"WorldPosSlices", "013cc03f77f3d034692f902db8928787" } + }; + + private static Dictionary m_textureTypeToCgType = new Dictionary() + { + {TextureType.Texture1D, "sampler1D" }, + {TextureType.Texture2D, "sampler2D" }, + {TextureType.Texture3D, "sampler3D" }, + {TextureType.Cube , "samplerCUBE"}, + {TextureType.Texture2DArray, "sampler2DArray" }, + {TextureType.ProceduralTexture, "sampler2D" } + }; + + + private static Dictionary m_nodeCategoryToColor = new Dictionary() + { + { "Master", new Color( 0.6f, 0.52f, 0.43f, 1.0f )}, + { "Default", new Color( 0.26f, 0.35f, 0.44f, 1.0f )}, + { "Vertex Data", new Color( 0.8f, 0.07f, 0.18f, 1.0f)}, + { "Primitive", new Color( 0.8f, 0.07f, 0.18f, 1.0f)}, + { "Object", new Color( 0.8f, 0.07f, 0.18f, 1.0f)}, + { "Math Operators", new Color( 0.26f, 0.35f, 0.44f, 1.0f )}, + { "Logical Operators", new Color( 0.0f, 0.55f, 0.45f, 1.0f)}, + { "Trigonometry Operators", new Color( 0.1f, 0.20f, 0.35f, 1.0f)}, + { "Image Effects", new Color( 0.5f, 0.2f, 0.90f, 1.0f)}, + { "Miscellaneous", new Color( 0.49f, 0.32f, 0.60f, 1.0f)}, + { "Camera And Screen", new Color( 0.75f, 0.10f, 0.30f, 1.0f )}, + { "Constants And Properties", new Color( 0.42f, 0.70f, 0.22f, 1.0f) }, + { "Surface Data", new Color( 0.92f, 0.73f, 0.03f, 1.0f)}, + { "Matrix Transform", new Color( 0.09f, 0.43f, 0.2f, 1.0f) }, + { "Time", new Color( 0.25f, 0.25f, 0.25f, 1.0f)}, + { "Functions", new Color( 1.00f, 0.4f, 0.0f, 1.0f) }, + { "Vector Operators", new Color( 0.22f, 0.20f, 0.45f, 1.0f)}, + { "Matrix Operators", new Color( 0.45f, 0.9f, 0.20f, 1.0f) }, + { "Lighting", new Color( 1.0f, 0.9f, 0.0f, 1.0f) }, + { "Textures", new Color( 0.15f, 0.40f, 0.8f, 1.0f)}, + { "Commentary", new Color( 0.7f, 0.7f, 0.7f, 1.0f)}, + { "UV Coordinates", new Color( 0.89f, 0.59f, 0.0f, 1.0f) }, + { "Object Transform", new Color( 0.15f, 0.4f, 0.49f, 1.0f)}, + { "Vertex Transform", new Color( 0.15f, 0.4f, 0.49f, 1.0f)} + }; + + private static Dictionary> m_toolButtonTooltips = new Dictionary> + { + { ToolButtonType.New, new List() { "Create new shader." } }, + { ToolButtonType.Open, new List() { "Open existing shader." } }, + { ToolButtonType.Save, new List() { "No changes to save.", "Save current changes." } }, + { ToolButtonType.Library, new List() { "Lists custom shader selection." } }, + { ToolButtonType.Options, new List() { "Open Options menu." } }, + { ToolButtonType.Update, new List() { "Open or create a new shader first.", "Click to enable to update current shader.", "Shader up-to-date." } }, + { ToolButtonType.Live, new List() { "Open or create a new shader first.", "Click to enable live shader preview", "Click to enable live shader and material preview." , "Live preview active, click to disable." } }, + { ToolButtonType.TakeScreenshot, new List() { "Take screenshot", "Take screenshot" }}, + { ToolButtonType.Share, new List() { "Share selection", "Share selection" }}, + { ToolButtonType.CleanUnusedNodes, new List() { "No unconnected nodes to clean.", "Remove all nodes not connected( directly or indirectly) to the master node." }}, + { ToolButtonType.Help, new List() { "Show help window." } }, + { ToolButtonType.FocusOnMasterNode,new List() { "Focus on active master node." } }, + { ToolButtonType.FocusOnSelection, new List() { "Focus on selection fit to screen ( if none selected )." } } + }; + + private static Color[] m_dataTypeToColorMonoMode = { new Color( 0.5f , 0.5f , 0.5f , 1.0f ) , Color.white }; + private static Dictionary m_dataTypeToColor = new Dictionary( new WirePortDataTypeComparer() ) + { + { WirePortDataType.OBJECT, Color.white}, + { WirePortDataType.SAMPLERSTATE,Color.white}, + { WirePortDataType.FLOAT, Color.gray}, + { WirePortDataType.FLOAT2, new Color(1f,1f,0f,1f)}, + { WirePortDataType.FLOAT3, new Color(0.5f,0.5f,1f,1f)}, + { WirePortDataType.FLOAT4, new Color(1f,0,1f,1f)}, + { WirePortDataType.FLOAT3x3, new Color(0.5f,1f,0.5f,1f)}, + { WirePortDataType.FLOAT4x4, new Color(0.5f,1f,0.5f,1f)}, + { WirePortDataType.COLOR, new Color(1f,0,1f,1f)}, + { WirePortDataType.INT, Color.white}, + { WirePortDataType.SAMPLER1D, new Color(1f,0.5f,0f,1f)}, + { WirePortDataType.SAMPLER2D, new Color(1f,0.5f,0f,1f)}, + { WirePortDataType.SAMPLER3D, new Color(1f,0.5f,0f,1f)}, + { WirePortDataType.SAMPLERCUBE, new Color(1f,0.5f,0f,1f)}, + { WirePortDataType.SAMPLER2DARRAY, new Color(1f,0.5f,0f,1f)} + }; + + private static Dictionary m_dataTypeToName = new Dictionary() + { + { WirePortDataType.OBJECT, "Generic Object"}, + { WirePortDataType.FLOAT, "Float"}, + { WirePortDataType.FLOAT2, "Vector2"}, + { WirePortDataType.FLOAT3, "Vector3"}, + { WirePortDataType.FLOAT4, "Vector4"}, + { WirePortDataType.FLOAT3x3, "3x3 Matrix"}, + { WirePortDataType.FLOAT4x4, "4x4 Matrix"}, + { WirePortDataType.COLOR, "Color"}, + { WirePortDataType.INT, "Int"}, + { WirePortDataType.SAMPLER1D, "Sampler1D"}, + { WirePortDataType.SAMPLER2D, "Sampler2D"}, + { WirePortDataType.SAMPLER3D, "Sampler3D"}, + { WirePortDataType.SAMPLERCUBE, "SamplerCUBE"}, + { WirePortDataType.SAMPLER2DARRAY, "Sampler2DArray"}, + { WirePortDataType.SAMPLERSTATE,"Sampler State"}, + }; + + private static Dictionary m_inputTypeDeclaration = new Dictionary() + { + { SurfaceInputs.DEPTH, "{0} Depth : SV_Depth"}, + { SurfaceInputs.UV_COORDS, "{0}2 uv"},// texture uv must have uv or uv2 followed by the texture name + { SurfaceInputs.UV2_COORDS, "{0}2 uv2"}, + { SurfaceInputs.VIEW_DIR, "{0}3 viewDir"}, + { SurfaceInputs.COLOR, Constants.ColorInput}, + { SurfaceInputs.SCREEN_POS, "{0}4 screenPos"}, + { SurfaceInputs.WORLD_POS, "{0}3 worldPos"}, + { SurfaceInputs.WORLD_REFL, "{0}3 worldRefl"}, + { SurfaceInputs.WORLD_NORMAL,"{0}3 worldNormal"}, + { SurfaceInputs.FRONT_FACING, Constants.IsFrontFacingInput}, + { SurfaceInputs.FRONT_FACING_VFACE, Constants.IsFrontFacingInputVFACE}, + { SurfaceInputs.INTERNALDATA, Constants.InternalData} + }; + + private static Dictionary m_inputTypeName = new Dictionary() + { + { SurfaceInputs.DEPTH, "Depth"}, + { SurfaceInputs.UV_COORDS, "uv"},// texture uv must have uv or uv2 followed by the texture name + { SurfaceInputs.UV2_COORDS, "uv2"}, + { SurfaceInputs.VIEW_DIR, "viewDir"}, + { SurfaceInputs.COLOR, Constants.ColorVariable}, + { SurfaceInputs.SCREEN_POS, "screenPos"}, + { SurfaceInputs.WORLD_POS, "worldPos"}, + { SurfaceInputs.WORLD_REFL, "worldRefl"}, + { SurfaceInputs.WORLD_NORMAL, "worldNormal"}, + { SurfaceInputs.FRONT_FACING, Constants.IsFrontFacingVariable}, + }; + + private static Dictionary m_precisionTypeToCg = new Dictionary() + { + {PrecisionType.Float, "float"}, + {PrecisionType.Half, "half"}, + {PrecisionType.Inherit, "float"} + }; + + private static Dictionary m_qualifierToCg = new Dictionary() + { + { VariableQualifiers.In, string.Empty}, + {VariableQualifiers.Out, "out"}, + {VariableQualifiers.InOut, "inout"} + }; + + private static Dictionary m_precisionWirePortToCgType = new Dictionary() + { + {WirePortDataType.FLOAT, "{0}"}, + {WirePortDataType.FLOAT2, "{0}2"}, + {WirePortDataType.FLOAT3, "{0}3"}, + {WirePortDataType.FLOAT4, "{0}4"}, + {WirePortDataType.FLOAT3x3, "{0}3x3"}, + {WirePortDataType.FLOAT4x4, "{0}4x4"}, + {WirePortDataType.COLOR, "{0}4"}, + {WirePortDataType.INT, "int"}, + {WirePortDataType.SAMPLER1D, "sampler1D"}, + {WirePortDataType.SAMPLER2D, "sampler2D"}, + {WirePortDataType.SAMPLER3D, "sampler3D"}, + {WirePortDataType.SAMPLERCUBE, "samplerCUBE"}, + {WirePortDataType.SAMPLER2DARRAY, "sampler2DArray"}, + {WirePortDataType.SAMPLERSTATE, "SamplerState"} + }; + + private static Dictionary m_precisionWirePortToStandardMacroType = new Dictionary() + { + {WirePortDataType.FLOAT, "{0}"}, + {WirePortDataType.FLOAT2, "{0}2"}, + {WirePortDataType.FLOAT3, "{0}3"}, + {WirePortDataType.FLOAT4, "{0}4"}, + {WirePortDataType.FLOAT3x3, "{0}3x3"}, + {WirePortDataType.FLOAT4x4, "{0}4x4"}, + {WirePortDataType.COLOR, "{0}4"}, + {WirePortDataType.INT, "int"}, + {WirePortDataType.SAMPLER1D, "sampler1D"}, + {WirePortDataType.SAMPLER2D, "UNITY_DECLARE_TEX2D_NOSAMPLER("}, + {WirePortDataType.SAMPLER3D, "UNITY_DECLARE_TEX3D_NOSAMPLER("}, + {WirePortDataType.SAMPLERCUBE, "UNITY_DECLARE_TEXCUBE_NOSAMPLER("}, + {WirePortDataType.SAMPLER2DARRAY, "UNITY_DECLARE_TEX2DARRAY_NOSAMPLER("}, + {WirePortDataType.SAMPLERSTATE, "SamplerState"} + }; + + private static Dictionary m_precisionWirePortToSRPMacroType = new Dictionary() + { + {WirePortDataType.FLOAT, "{0}"}, + {WirePortDataType.FLOAT2, "{0}2"}, + {WirePortDataType.FLOAT3, "{0}3"}, + {WirePortDataType.FLOAT4, "{0}4"}, + {WirePortDataType.FLOAT3x3, "{0}3x3"}, + {WirePortDataType.FLOAT4x4, "{0}4x4"}, + {WirePortDataType.COLOR, "{0}4"}, + {WirePortDataType.INT, "int"}, + {WirePortDataType.SAMPLER1D, "sampler1D"}, + {WirePortDataType.SAMPLER2D, "TEXTURE2D("}, + {WirePortDataType.SAMPLER3D, "TEXTURE3D("}, + {WirePortDataType.SAMPLERCUBE, "TEXTURECUBE("}, + {WirePortDataType.SAMPLER2DARRAY, "TEXTURE2D_ARRAY("}, + {WirePortDataType.SAMPLERSTATE, "SamplerState"} + }; + + private static Dictionary m_wirePortToCgType = new Dictionary() + { + { WirePortDataType.FLOAT, "float"}, + {WirePortDataType.FLOAT2, "float2"}, + {WirePortDataType.FLOAT3, "float3"}, + {WirePortDataType.FLOAT4, "float4"}, + {WirePortDataType.FLOAT3x3, "float3x3"}, + {WirePortDataType.FLOAT4x4, "float4x4"}, + {WirePortDataType.COLOR, "float4"}, + {WirePortDataType.INT, "int"}, + {WirePortDataType.SAMPLER1D, "sampler1D"}, + {WirePortDataType.SAMPLER2D, "sampler2D"}, + {WirePortDataType.SAMPLER3D, "sampler3D"}, + {WirePortDataType.SAMPLERCUBE, "samplerCUBE"}, + {WirePortDataType.SAMPLER2DARRAY, "sampler2DArray"}, + {WirePortDataType.UINT, "uint"}, + {WirePortDataType.UINT4, "uint4"}, + {WirePortDataType.SAMPLERSTATE, "SamplerState"} + }; + + private static Dictionary m_keycodeToString = new Dictionary() + { + {KeyCode.Alpha0,"0" }, + {KeyCode.Alpha1,"1" }, + {KeyCode.Alpha2,"2" }, + {KeyCode.Alpha3,"3" }, + {KeyCode.Alpha4,"4" }, + {KeyCode.Alpha5,"5" }, + {KeyCode.Alpha6,"6" }, + {KeyCode.Alpha7,"7" }, + {KeyCode.Alpha8,"8" }, + {KeyCode.Alpha9,"9" } + }; + + private static Dictionary m_wireStatusToColor = new Dictionary() + { + { WireStatus.Default,new Color(0.7f,0.7f,0.7f,1.0f) }, + {WireStatus.Highlighted,Color.yellow }, + {WireStatus.Selected,Color.white} + }; + + private static Dictionary m_autoSwizzle = new Dictionary() + { + {WirePortDataType.FLOAT, ".x"}, + {WirePortDataType.FLOAT2, ".xy"}, + {WirePortDataType.FLOAT3, ".xyz"}, + {WirePortDataType.FLOAT4, ".xyzw"} + }; + + private static Dictionary m_unityNativeShaderPaths = new Dictionary + { + { "Resources/unity_builtin_extra", true }, + { "Library/unity default resources", true } + }; + + private static Dictionary m_portPriority = new Dictionary() + { + {WirePortDataType.OBJECT, 0}, + {WirePortDataType.SAMPLERSTATE, 0}, + {WirePortDataType.SAMPLER1D, 0}, + {WirePortDataType.SAMPLER2D, 0}, + {WirePortDataType.SAMPLER3D, 0}, + {WirePortDataType.SAMPLERCUBE, 0}, + {WirePortDataType.SAMPLER2DARRAY, 0}, + {WirePortDataType.FLOAT3x3, 1}, + {WirePortDataType.FLOAT4x4, 2}, + {WirePortDataType.INT, 3}, + {WirePortDataType.UINT, 3}, + {WirePortDataType.FLOAT, 4}, + {WirePortDataType.FLOAT2, 5}, + {WirePortDataType.FLOAT3, 6}, + {WirePortDataType.FLOAT4, 7}, + {WirePortDataType.COLOR, 7} + }; + + private static readonly string IncorrectInputConnectionErrorMsg = "Input Port {0} from node {1} has type {2}\nwhich is incompatible with connection of type {3} from port {4} on node {5}"; + private static readonly string IncorrectOutputConnectionErrorMsg = "Output Port {0} from node {1} has type {2}\nwhich is incompatible with connection of type {3} from port {4} on node {5}"; + private static readonly string NoVertexModeNodeWarning = "{0} is unable to generate code in vertex function"; + + private static float SwitchFixedHeight; + private static float SwitchFontSize; + private static RectOffset SwitchNodeBorder; + private static RectOffset SwitchNodeMargin; + private static RectOffset SwitchNodeOverflow; + private static RectOffset SwitchNodePadding; + + private static RenderTexture m_dummyPreviewRT; + public static void ForceExampleShaderCompilation() + { + CurrentWindow.ForceMaterialsToUpdate( ref m_exampleMaterialIDs ); + + } + + public static void Destroy() + { + if( IOUtils.AllOpenedWindows != null && IOUtils.AllOpenedWindows.Count > 0 ) + { + return; + } + else + { + IOUtils.AllOpenedWindows.Clear(); + } + + IOUtils.ClearLoadedAssemblies(); + + Initialized = false; + + if( m_dummyPreviewRT != null ) + m_dummyPreviewRT.Release(); + + ScriptableObject.DestroyImmediate( m_dummyPreviewRT ); + + m_dummyPreviewRT = null; + PlusStyle = null; + MinusStyle = null; + m_textInfo = null; + RangedFloatSliderStyle = null; + RangedFloatSliderThumbStyle = null; + PropertyPopUp = null; + ObjectField = null; + PreviewExpander = null; + PreviewCollapser = null; + MenuItemToggleStyle = null; + MenuItemEnableStyle = null; + MenuItemBackgroundStyle = null; + MenuItemToolbarStyle = null; + MenuItemInspectorDropdownStyle = null; + ObjectFieldThumb = null; + ObjectFieldThumbOverlay = null; + InspectorPopdropdownStyle = null; + InspectorPopdropdownFallback = null; + TooltipBox = null; + UnZoomedNodeTitleStyle = null; + UnZoomedPropertyValuesTitleStyle = null; + UnZoomedInputPortStyle = null; + UnZoomedOutputPortPortStyle = null; + ToolbarSearchTextfield = null; + ToolbarSearchCancelButton = null; + FloatIntPickerONOFF = null; + Box = null; + Button = null; + TextArea = null; + Label = null; + Toggle = null; + Textfield = null; + + CommentaryTitle = null; + StickyNoteText = null; + InputPortLabel = null; + OutputPortLabel = null; + + IntShader = null; + FloatShader = null; + Vector2Shader = null; + Vector3Shader = null; + Vector4Shader = null; + ColorShader = null; + Texture2DShader = null; + + MaskingShader = null; + + BoldErrorStyle = null; + BoldWarningStyle = null; + BoldInfoStyle = null; + Separator = null; + ToolbarMainTitle = null; + + GraphButtonIcon = null; + GraphButton = null; + GraphDropDown = null; + + ConsoleLogLabel = null; + ConsoleLogMessage = null; + ConsoleLogCircle = null; + + MiniButtonTopLeft = null; + MiniButtonTopMid = null; + MiniButtonTopRight = null; + + NodeWindowOffSquare = null; + NodeHeaderSquare = null; + NodeWindowOnSquare = null; + InternalDataOnPort = null; + InternalDataBackground = null; + + MiniObjectFieldThumbOverlay = null; + MiniSamplerButton = null; + + Resources.UnloadAsset( SmallErrorIcon ); + SmallErrorIcon = null; + + Resources.UnloadAsset( SmallWarningIcon ); + SmallWarningIcon = null; + + Resources.UnloadAsset( SmallInfoIcon ); + SmallInfoIcon = null; + + LockIconOpen = null; + LockIconClosed = null; + + FloatIntIconON = null; + FloatIntIconOFF = null; + + Resources.UnloadAsset( CheckmarkIcon ); + CheckmarkIcon = null; + + Resources.UnloadAsset( PopupIcon ); + PopupIcon = null; + + Resources.UnloadAsset( MasterNodeOnTexture ); + MasterNodeOnTexture = null; + + Resources.UnloadAsset( MasterNodeOffTexture ); + MasterNodeOffTexture = null; + + Resources.UnloadAsset( GPUInstancedOnTexture ); + GPUInstancedOnTexture = null; + + Resources.UnloadAsset( GPUInstancedOffTexture ); + GPUInstancedOffTexture = null; + + MainSkin = null; + + if( LinearMaterial != null ) + GameObject.DestroyImmediate( LinearMaterial ); + + LinearMaterial = null; + + if( m_undoHelper == null ) + { + m_undoHelper.Clear(); + m_undoHelper = null; + } + MaterialInspector.Instance = null; + } + + public static void ResetMainSkin() + { + if( (object)MainSkin != null ) + { + CurrentHeaderHeight = HeaderMaxHeight; + ScaledPortsDelta = PortsDelta; + MainSkin.textField.fontSize = (int)( Constants.TextFieldFontSize ); + MainSkin.label.fontSize = (int)( Constants.DefaultFontSize ); + MainSkin.customStyles[ (int)CustomStyle.NodeTitle ].fontSize = (int)( Constants.DefaultTitleFontSize ); + + InputPortLabel.fontSize = (int)( Constants.DefaultFontSize ); + OutputPortLabel.fontSize = (int)( Constants.DefaultFontSize ); + CommentaryTitle.fontSize = (int)( Constants.DefaultFontSize ); + StickyNoteText.fontSize = (int)( Constants.DefaultFontSize ); + } + } + + public static void InitMainSkin() + { + MainSkin = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( IOUtils.MainSkinGUID ) , typeof( GUISkin ) ) as GUISkin; + Initialized = true; + Texture2D portTex = GetCustomStyle( CustomStyle.PortEmptyIcon ).normal.background; + PortsSize = new Vector2( portTex.width , portTex.height ); + PortsDelta = new Vector3( 0.5f * PortsSize.x , 0.5f * PortsSize.y ); + HeaderMaxHeight = MainSkin.customStyles[ (int)CustomStyle.NodeHeader ].normal.background.height; + + RectOffsetZero = new RectOffset( 0 , 0 , 0 , 0 ); + RectOffsetOne = new RectOffset( 1 , 1 , 1 , 1 ); + RectOffsetTwo = new RectOffset( 2 , 2 , 2 , 2 ); + RectOffsetThree = new RectOffset( 3 , 3 , 3 , 3 ); + RectOffsetFour = new RectOffset( 4 , 4 , 4 , 4 ); + RectOffsetFive = new RectOffset( 5 , 5 , 5 , 5 ); + RectOffsetSix = new RectOffset( 6 , 6 , 6 , 6 ); + + PropertyPopUp = GetCustomStyle( CustomStyle.NodePropertyPicker ); + ObjectField = new GUIStyle( (GUIStyle)"ObjectField" ); + PreviewExpander = GetCustomStyle( CustomStyle.NodePreviewExpander ); + PreviewCollapser = GetCustomStyle( CustomStyle.NodePreviewCollapser ); + + WireNodeSelection = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "bfe0b03d5d60cea4f9d4b2d1d121e592" ) , typeof( Texture2D ) ) as Texture2D; + SliderButton = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "dd563e33152bb6443b099b4139ceecb9" ) , typeof( Texture2D ) ) as Texture2D; + + SmallErrorIcon = EditorGUIUtility.Load( "icons/d_console.erroricon.sml.png" ) as Texture2D; + SmallWarningIcon = EditorGUIUtility.Load( "icons/d_console.warnicon.sml.png" ) as Texture2D; + SmallInfoIcon = EditorGUIUtility.Load( "icons/d_console.infoicon.sml.png" ) as Texture2D; + + LockIconOpen = new GUIContent( EditorGUIUtility.IconContent( "LockIcon-On" ) ); + LockIconOpen.tooltip = "Click to unlock and customize the variable name"; + LockIconClosed = new GUIContent( EditorGUIUtility.IconContent( "LockIcon" ) ); + LockIconClosed.tooltip = "Click to lock and auto-generate the variable name"; + + if( UsingProSkin ) + { + FloatIntIconON = new GUIContent( EditorGUIUtility.IconContent( "CircularToggle_ON" ) ); + FloatIntIconOFF = new GUIContent( EditorGUIUtility.IconContent( "CircularToggle_OFF" ) ); + } + else + { + FloatIntIconON = new GUIContent( ( AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "ac0860a6a77e29d4091ba790a17daa0f" ) , typeof( Texture2D ) ) as Texture2D ) ); + FloatIntIconOFF = new GUIContent( ( AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "1aaca50d084b0bb43854f075ce2f302b" ) , typeof( Texture2D ) ) as Texture2D ) ); + } + + CommentaryTitle = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.CommentaryTitle ] ); + StickyNoteText = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.CommentaryTitle ] ); + StickyNoteText.wordWrap = true; + StickyNoteText.alignment = TextAnchor.UpperLeft; + InputPortLabel = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.InputPortlabel ] ); + OutputPortLabel = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.OutputPortLabel ] ); + + CheckmarkIcon = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "e9c4642eaa083a54ab91406d8449e6ac" ) , typeof( Texture2D ) ) as Texture2D; + PopupIcon = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "d2384a227b4ac4943b73c8151393e502" ) , typeof( Texture2D ) ) as Texture2D; + + BoldErrorStyle = new GUIStyle( (GUIStyle)"BoldLabel" ); + BoldErrorStyle.normal.textColor = Color.red; + BoldErrorStyle.alignment = TextAnchor.MiddleCenter; + BoldWarningStyle = new GUIStyle( (GUIStyle)"BoldLabel" ); + BoldWarningStyle.normal.textColor = Color.yellow; + BoldWarningStyle.alignment = TextAnchor.MiddleCenter; + BoldInfoStyle = new GUIStyle( (GUIStyle)"BoldLabel" ); + BoldInfoStyle.normal.textColor = Color.white; + BoldInfoStyle.alignment = TextAnchor.MiddleCenter; + + ToolbarMainTitle = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.MainCanvasTitle ] ); + Separator = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.FlatBackground ] ); + MiniButtonTopLeft = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.MiniButtonTopLeft ] ); + MiniButtonTopMid = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.MiniButtonTopMid ] ); + MiniButtonTopRight = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.MiniButtonTopRight ] ); + + InternalDataOnPort = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.NodeTitle ] ); + InternalDataOnPort.fontSize = 8; + InternalDataOnPort.fontStyle = FontStyle.BoldAndItalic; + InternalDataBackground = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.NodeWindowOffSquare ] ); + InternalDataBackground.normal.background = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "330fd0c8f074a3c4f8042114a61a73d9" ) , typeof( Texture2D ) ) as Texture2D; + InternalDataBackground.overflow = RectOffsetOne; + + MiniObjectFieldThumbOverlay = new GUIStyle( (GUIStyle)"ObjectFieldThumbOverlay" ); + MiniSamplerButton = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.SamplerButton ] ); + + m_textInfo = new System.Globalization.CultureInfo( "en-US" , false ).TextInfo; + RangedFloatSliderStyle = new GUIStyle( GUI.skin.horizontalSlider ); + RangedFloatSliderThumbStyle = new GUIStyle( GUI.skin.horizontalSliderThumb ); + RangedFloatSliderThumbStyle.normal.background = SliderButton; + RangedFloatSliderThumbStyle.active.background = null; + RangedFloatSliderThumbStyle.hover.background = null; + RangedFloatSliderThumbStyle.focused.background = null; + RangedFloatSliderThumbStyle.overflow = new RectOffset( 1 , 1 , -4 , 4 ); + RangedFloatSliderThumbStyle.margin = RectOffsetZero; + + SwitchNodePopUp = new GUIStyle( (GUIStyle)"Popup" ); + // RectOffset cannot be initiliazed on constructor + SwitchNodeBorder = new RectOffset( 4 , 15 , 3 , 3 ); + SwitchNodeMargin = new RectOffset( 4 , 4 , 3 , 3 ); + SwitchNodeOverflow = new RectOffset( 0 , 0 , -1 , 2 ); + SwitchNodePadding = new RectOffset( 6 , 14 , 2 , 3 ); + SwitchFixedHeight = 18; + SwitchFontSize = 10; + + GraphButtonIcon = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.GraphButtonIcon ] ); + GraphButton = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.GraphButton ] ); + GraphDropDown = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.GraphButton ] ); + GraphDropDown.padding.right = 20; + + Box = new GUIStyle( MainSkin.box ); + Button = new GUIStyle( GUI.skin.button ); + TextArea = new GUIStyle( GUI.skin.textArea ); + Label = new GUIStyle( GUI.skin.label ); + Toggle = new GUIStyle( GUI.skin.toggle ); + Textfield = new GUIStyle( GUI.skin.textField ); + //ShaderIcon = EditorGUIUtility.IconContent( "Shader Icon" ).image; + //MaterialIcon = EditorGUIUtility.IconContent( "Material Icon" ).image; + + ConsoleLogLabel = new GUIStyle( GUI.skin.label ); + ConsoleLogLabel.wordWrap = true; + ConsoleLogMessage = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.ConsoleLogMessage ] ); + ConsoleLogCircle = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.ConsoleLogCircle ] ); + + NodeWindowOffSquare = GetCustomStyle( CustomStyle.NodeWindowOffSquare ); + NodeHeaderSquare = GetCustomStyle( CustomStyle.NodeHeaderSquare ); + NodeWindowOnSquare = GetCustomStyle( CustomStyle.NodeWindowOnSquare ); + + UnZoomedNodeTitleStyle = new GUIStyle( GetCustomStyle( CustomStyle.NodeTitle ) ); + UnZoomedNodeTitleStyle.fontSize = 13; + + UnZoomedPropertyValuesTitleStyle = new GUIStyle( GetCustomStyle( CustomStyle.PropertyValuesTitle ) ); + UnZoomedPropertyValuesTitleStyle.fontSize = 11; + + UnZoomedInputPortStyle = new GUIStyle( InputPortLabel ); + UnZoomedInputPortStyle.fontSize = (int)Constants.DefaultFontSize; + + UnZoomedOutputPortPortStyle = new GUIStyle( OutputPortLabel ); + UnZoomedOutputPortPortStyle.fontSize = (int)Constants.DefaultFontSize; + + ObjectFieldThumb = new GUIStyle( (GUIStyle)"ObjectFieldThumb" ); + ObjectFieldThumbOverlay = new GUIStyle( (GUIStyle)"ObjectFieldThumbOverlay" ); + + FloatIntPickerONOFF = new GUIStyle( "metimelabel" ); + FloatIntPickerONOFF.padding.left = -2; + FloatIntPickerONOFF.margin = new RectOffset( 0 , 2 , 2 , 2 ); + + TooltipBox = new GUIStyle( (GUIStyle)"Tooltip" ); + TooltipBox.richText = true; + + MasterNodeOnTexture = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( IOUtils.MasterNodeOnTextureGUID ) ); + MasterNodeOffTexture = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( IOUtils.MasterNodeOnTextureGUID ) ); + + GPUInstancedOnTexture = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( IOUtils.GPUInstancedOnTextureGUID ) ); + GPUInstancedOffTexture = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( IOUtils.GPUInstancedOffTextureGUID ) ); + + CheckNullMaterials(); + + UsingProSkin = EditorGUIUtility.isProSkin; + FetchMenuItemStyles(); + } + + public static bool IsLoading + { + get { return CurrentWindow.OutsideGraph.IsLoading; } + } + + public static void CheckNullMaterials() + { + if( LinearMaterial == null ) + { + Shader linearShader = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "e90ef6ea05743b84baf9549874c52e47" ) ); //linear previews + LinearMaterial = new Material( linearShader ); + } + + if( IntShader == null ) + IntShader = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "0f64d695b6ffacc469f2dd31432a232a" ) ); //int + if( FloatShader == null ) + FloatShader = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "d9ca47581ac157145bff6f72ac5dd73e" ) ); //ranged float + if( Vector2Shader == null ) + Vector2Shader = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "88b4191eb06084d4da85d1dd2f984085" ) ); //vector2 + if( Vector3Shader == null ) + Vector3Shader = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "8a44d38f06246bf48944b3f314bc7920" ) ); //vector3 + if( Vector4Shader == null ) + Vector4Shader = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "aac241d0e47a5a84fbd2edcd640788dc" ) ); //vector4 + if( ColorShader == null ) + ColorShader = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "6cf365ccc7ae776488ae8960d6d134c3" ) ); //color node + if( MaskingShader == null ) + MaskingShader = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "9c34f18ebe2be3e48b201b748c73dec0" ) ); //masking shader + if( Texture2DShader == null ) + Texture2DShader = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "13bd295c44d04e1419f20f792d331e33" ) ); //texture2d shader + } + + public static void SetPreviewShaderConstants() + { + var worldCameraPos = new Vector3( 0, 0, -5 ); + var objectToWorldMatrix = Matrix4x4.identity; + var worldToObjectMatrix = Matrix4x4.identity; + var viewMatrix = new Matrix4x4( + new Vector4( 1, 0, 0, 0 ), + new Vector4( 0, 1, 0, 0 ), + new Vector4( 0, 0,-1,-1 ), + new Vector4( 0, 0, 0, 1 ) ); + var viewMatrixInv = new Matrix4x4( + new Vector4( 1, 0, 0, 0 ), + new Vector4( 0, 1, 0, 0 ), + new Vector4( 0, 0,-1, 0 ), + new Vector4( 0, 0,-1, 1 ) ); + + Shader.SetGlobalVector( "preview_WorldSpaceCameraPos", worldCameraPos ); ; + Shader.SetGlobalMatrix( "preview_WorldToObject", worldToObjectMatrix ); + Shader.SetGlobalMatrix( "preview_ObjectToWorld", objectToWorldMatrix ); + Shader.SetGlobalMatrix( "preview_MatrixV", viewMatrix ); + Shader.SetGlobalMatrix( "preview_MatrixInvV", viewMatrixInv ); + } + + private static void FetchMenuItemStyles() + { + ObjectFieldThumb = new GUIStyle( (GUIStyle)"ObjectFieldThumb" ); + ObjectFieldThumbOverlay = new GUIStyle( (GUIStyle)"ObjectFieldThumbOverlay" ); + MenuItemToggleStyle = new GUIStyle( (GUIStyle)"foldout" ); + MenuItemEnableStyle = UsingProSkin ? new GUIStyle( (GUIStyle)"OL ToggleWhite" ) : new GUIStyle( (GUIStyle)"OL Toggle" ); + MenuItemBackgroundStyle = new GUIStyle( (GUIStyle)"TE NodeBackground" ); + MenuItemToolbarStyle = new GUIStyle( (GUIStyle)"toolbarbutton" ) { fixedHeight = 20 }; + MenuItemInspectorDropdownStyle = new GUIStyle( (GUIStyle)"toolbardropdown" ) { fixedHeight = 20 }; + MenuItemInspectorDropdownStyle.margin.bottom = 2; + + + InspectorPopdropdownStyle = new GUIStyle( GUI.skin.GetStyle( "PopupCurveDropdown" ) ); + InspectorPopdropdownStyle.alignment = TextAnchor.MiddleRight; + InspectorPopdropdownStyle.border.bottom = 16; + + InspectorPopdropdownFallback = new GUIStyle( InspectorPopdropdownStyle ); + InspectorPopdropdownFallback.overflow = new RectOffset( 0 , -5 , 0 , 0 ); + + PlusStyle = ( EditorGUIUtility.isProSkin ) ? new GUIStyle( GetCustomStyle( CustomStyle.CustomExpressionAddItem ) ) : new GUIStyle( (GUIStyle)"OL Plus" ); + PlusStyle.imagePosition = ImagePosition.ImageOnly; + PlusStyle.overflow = new RectOffset( -2 , 0 , -4 , 0 ); + + MinusStyle = ( EditorGUIUtility.isProSkin ) ? new GUIStyle( GetCustomStyle( CustomStyle.CustomExpressionRemoveItem ) ) : new GUIStyle( (GUIStyle)"OL Minus" ); + MinusStyle.contentOffset = Vector2.zero; + MinusStyle.imagePosition = ImagePosition.ImageOnly; + MinusStyle.overflow = new RectOffset( -2 , 0 , -4 , 0 ); + + if ( GUI.skin.FindStyle( "ToolbarSearchTextField" ) != null ) + { + // @diogo: new, fixed + ToolbarSearchTextfield = new GUIStyle( ( GUIStyle )"ToolbarSearchTextField" ); + ToolbarSearchCancelButton = new GUIStyle( ( GUIStyle )"ToolbarSearchCancelButton" ); + } + else + { + // @diogo: old, typo + ToolbarSearchTextfield = new GUIStyle( ( GUIStyle )"ToolbarSeachTextField" ); + ToolbarSearchCancelButton = new GUIStyle( ( GUIStyle )"ToolbarSeachCancelButton" ); + } + } + + public static void UpdateMainSkin( DrawInfo drawInfo ) + { + CurrentHeaderHeight = HeaderMaxHeight * drawInfo.InvertedZoom; + ScaledPortsDelta = drawInfo.InvertedZoom * PortsDelta; + MainSkin.textField.fontSize = (int)( Constants.TextFieldFontSize * drawInfo.InvertedZoom ); + MainSkin.label.fontSize = (int)( Constants.DefaultFontSize * drawInfo.InvertedZoom ); + + MainSkin.customStyles[ (int)CustomStyle.NodeTitle ].fontSize = (int)( Constants.DefaultTitleFontSize * drawInfo.InvertedZoom ); + MainSkin.customStyles[ (int)CustomStyle.PropertyValuesTitle ].fontSize = (int)( Constants.PropertiesTitleFontSize * drawInfo.InvertedZoom ); + + InputPortLabel.fontSize = (int)( Constants.DefaultFontSize * drawInfo.InvertedZoom ); + OutputPortLabel.fontSize = (int)( Constants.DefaultFontSize * drawInfo.InvertedZoom ); + CommentaryTitle.fontSize = (int)( Constants.DefaultFontSize * drawInfo.InvertedZoom ); + StickyNoteText.fontSize = (int)( Constants.DefaultFontSize * drawInfo.InvertedZoom ); + + RangedFloatSliderStyle.fixedHeight = 18 * drawInfo.InvertedZoom; + RangedFloatSliderThumbStyle.fixedHeight = 12 * drawInfo.InvertedZoom; + RangedFloatSliderThumbStyle.fixedWidth = 10 * drawInfo.InvertedZoom; + RangedFloatSliderThumbStyle.overflow.left = (int)( 1 * drawInfo.InvertedZoom ); + RangedFloatSliderThumbStyle.overflow.right = (int)( 1 * drawInfo.InvertedZoom ); + RangedFloatSliderThumbStyle.overflow.top = (int)( -4 * drawInfo.InvertedZoom ); + RangedFloatSliderThumbStyle.overflow.bottom = (int)( 4 * drawInfo.InvertedZoom ); + + SwitchNodePopUp.fixedHeight = SwitchFixedHeight * drawInfo.InvertedZoom; + + SwitchNodePopUp.border.left = (int)( SwitchNodeBorder.left * drawInfo.InvertedZoom ); + SwitchNodePopUp.border.right = (int)( SwitchNodeBorder.right * drawInfo.InvertedZoom ); + SwitchNodePopUp.border.top = (int)( SwitchNodeBorder.top * drawInfo.InvertedZoom ); + SwitchNodePopUp.border.bottom = (int)( SwitchNodeBorder.bottom * drawInfo.InvertedZoom ); + + SwitchNodePopUp.margin.left = (int)( SwitchNodeMargin.left * drawInfo.InvertedZoom ); + SwitchNodePopUp.margin.right = (int)( SwitchNodeMargin.right * drawInfo.InvertedZoom ); + SwitchNodePopUp.margin.top = (int)( SwitchNodeMargin.top * drawInfo.InvertedZoom ); + SwitchNodePopUp.margin.bottom = (int)( SwitchNodeMargin.bottom * drawInfo.InvertedZoom ); + + SwitchNodePopUp.overflow.left = (int)( SwitchNodeOverflow.left * drawInfo.InvertedZoom ); + SwitchNodePopUp.overflow.right = (int)( SwitchNodeOverflow.right * drawInfo.InvertedZoom ); + SwitchNodePopUp.overflow.top = (int)( SwitchNodeOverflow.top * drawInfo.InvertedZoom ); + SwitchNodePopUp.overflow.bottom = (int)( SwitchNodeOverflow.bottom * drawInfo.InvertedZoom ); + + SwitchNodePopUp.padding.left = (int)( SwitchNodePadding.left * drawInfo.InvertedZoom ); + SwitchNodePopUp.padding.right = (int)( SwitchNodePadding.right * drawInfo.InvertedZoom ); + SwitchNodePopUp.padding.top = (int)( SwitchNodePadding.top * drawInfo.InvertedZoom ); + SwitchNodePopUp.padding.bottom = (int)( SwitchNodePadding.bottom * drawInfo.InvertedZoom ); + + SwitchNodePopUp.fontSize = (int)( SwitchFontSize * drawInfo.InvertedZoom ); + + BoldErrorStyle.fontSize = (int)( 12 * drawInfo.InvertedZoom ); + BoldWarningStyle.fontSize = (int)( 12 * drawInfo.InvertedZoom ); + BoldInfoStyle.fontSize = (int)( 12 * drawInfo.InvertedZoom ); + + PropertyPopUp.fixedHeight = Constants.PropertyPickerHeight * drawInfo.InvertedZoom; + PropertyPopUp.fixedWidth = Constants.PropertyPickerWidth * drawInfo.InvertedZoom; + if( UsingProSkin != EditorGUIUtility.isProSkin ) + { + UsingProSkin = EditorGUIUtility.isProSkin; + FetchMenuItemStyles(); + } + + GraphDropDown.padding.left = (int)( 2 * drawInfo.InvertedZoom + 2 ); + GraphDropDown.padding.right = (int)( 20 * drawInfo.InvertedZoom ); + GraphDropDown.fontSize = (int)( 10 * drawInfo.InvertedZoom ); + + PreviewExpander.fixedHeight = Constants.PreviewExpanderHeight * drawInfo.InvertedZoom; + PreviewExpander.fixedWidth = Constants.PreviewExpanderWidth * drawInfo.InvertedZoom; + + PreviewCollapser.fixedHeight = Constants.PreviewExpanderHeight * drawInfo.InvertedZoom; + PreviewCollapser.fixedWidth = Constants.PreviewExpanderWidth * drawInfo.InvertedZoom; + + MainSkin.customStyles[ (int)CustomStyle.SamplerButton ].fontSize = (int)( 9 * drawInfo.InvertedZoom ); + ObjectFieldThumbOverlay.fontSize = (int)( 9 * drawInfo.InvertedZoom ); + MiniButtonTopLeft.fontSize = (int)( 9 * drawInfo.InvertedZoom ); + MiniButtonTopMid.fontSize = (int)( 9 * drawInfo.InvertedZoom ); + MiniButtonTopRight.fontSize = (int)( 9 * drawInfo.InvertedZoom ); + + MiniObjectFieldThumbOverlay.fontSize = (int)( 7 * drawInfo.InvertedZoom ); + MiniSamplerButton.fontSize = (int)( 8 * drawInfo.InvertedZoom ); + + InternalDataOnPort.fontSize = (int)( 8 * drawInfo.InvertedZoom ); + ToolbarMainTitle.padding.left = 0; + ToolbarMainTitle.padding.right = 0; + + CheckNullMaterials(); + } + + public static void CacheLabelVars() + { + m_alignment = GUI.skin.label.alignment; + m_clipping = GUI.skin.label.clipping; + m_wordWrap = GUI.skin.label.wordWrap; + m_fontSize = GUI.skin.label.fontSize; + m_fontStyle = GUI.skin.label.fontStyle; + m_fontColor = GUI.skin.label.normal.textColor; + } + + public static void RestoreLabelVars() + { + GUI.skin.label.alignment = m_alignment; + GUI.skin.label.clipping = m_clipping; + GUI.skin.label.wordWrap = m_wordWrap; + GUI.skin.label.fontSize = m_fontSize; + GUI.skin.label.fontStyle = m_fontStyle; + GUI.skin.label.normal.textColor = m_fontColor; + } + + public static string GetTooltipForToolButton( ToolButtonType toolButtonType , int state ) { return m_toolButtonTooltips[ toolButtonType ][ state ]; } + + public static string KeyCodeToString( KeyCode keyCode ) + { + if( m_keycodeToString.ContainsKey( keyCode ) ) + return m_keycodeToString[ keyCode ]; + + return keyCode.ToString(); + } + + public static string TextureTypeToCgType( TextureType type ) { return m_textureTypeToCgType[ type ]; } + + public static string QualifierToCg( VariableQualifiers qualifier ) + { + return m_qualifierToCg[ qualifier ]; + } + + public static string WirePortToCgType( WirePortDataType type ) + { + if( type == WirePortDataType.OBJECT ) + return string.Empty; + + return m_wirePortToCgType[ type ]; + } + + public static string FinalPrecisionWirePortToCgType( PrecisionType precisionType , WirePortDataType type ) + { + return PrecisionWirePortToCgType( precisionType , type ); + } + + public static string PrecisionWirePortToCgType( PrecisionType precisionType , WirePortDataType type ) + { + if( type == WirePortDataType.OBJECT ) + return string.Empty; + + if( type == WirePortDataType.INT ) + return m_wirePortToCgType[ type ]; + + if( type == WirePortDataType.UINT ) + return m_wirePortToCgType[ type ]; + + if( type == WirePortDataType.UINT4 ) + return m_wirePortToCgType[ type ]; + + return string.Format( m_precisionWirePortToCgType[ type ] , m_precisionTypeToCg[ precisionType ] ); + } + + public static string PrecisionWirePortToTypeValue( PrecisionType precisionType , WirePortDataType type , string varName/*, bool isSRP, bool samplingMacro*/ ) + { + string result = string.Empty; + string varType = string.Empty; + if( type == WirePortDataType.OBJECT ) + varType = string.Empty; + + if( type == WirePortDataType.INT ) + varType = m_wirePortToCgType[ type ]; + + if( type == WirePortDataType.UINT ) + varType = m_wirePortToCgType[ type ]; + + switch( type ) + { + default: + case WirePortDataType.OBJECT: + case WirePortDataType.SAMPLERSTATE: + case WirePortDataType.FLOAT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + case WirePortDataType.COLOR: + case WirePortDataType.UINT: + case WirePortDataType.INT: + case WirePortDataType.SAMPLER1D: + varType = string.Format( m_precisionWirePortToCgType[ type ] , m_precisionTypeToCg[ precisionType ] ); + result = varType + " " + varName; + break; + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.SAMPLER2DARRAY: + ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; + if( outsideGraph.SamplingMacros /*&& !outsideGraph.IsStandardSurface*/ ) + { + if( outsideGraph.IsSRP ) + varType = string.Format( m_precisionWirePortToSRPMacroType[ type ] , m_precisionTypeToCg[ precisionType ] ); + else + varType = string.Format( m_precisionWirePortToStandardMacroType[ type ] , m_precisionTypeToCg[ precisionType ] ); + result = varType + varName + ")"; + } + else + { + varType = string.Format( m_precisionWirePortToCgType[ type ] , m_precisionTypeToCg[ precisionType ] ); + result = varType + " " + varName; + } + break; + } + + return result; + } + + public static string GetAutoSwizzle( WirePortDataType type ) + { + return m_autoSwizzle[ type ]; + } + + public static Color GetColorForDataType( WirePortDataType dataType , bool monochromeMode = true , bool isInput = true ) + { + if( monochromeMode ) + { + return isInput ? m_dataTypeToColorMonoMode[ 0 ] : m_dataTypeToColorMonoMode[ 1 ]; + } + else + { + if( m_dataTypeToColor.ContainsKey( dataType ) ) + return m_dataTypeToColor[ dataType ]; + } + return m_dataTypeToColor[ WirePortDataType.OBJECT ]; + } + + public static bool IsValidType( WirePortDataType type ) + { + switch( type ) + { + case WirePortDataType.OBJECT: + case WirePortDataType.SAMPLERSTATE: + case WirePortDataType.FLOAT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + case WirePortDataType.COLOR: + case WirePortDataType.INT: + case WirePortDataType.SAMPLER1D: + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.SAMPLER2DARRAY: + return true; + } + return false; + } + public static string GetNameForDataType( WirePortDataType dataType ) { return m_dataTypeToName[ dataType ]; } + + public static string GetInputDeclarationFromType( PrecisionType precision , SurfaceInputs inputType ) + { + string precisionStr = m_precisionTypeToCg[ precision ]; + return string.Format( m_inputTypeDeclaration[ inputType ] , precisionStr ); + } + + public static string GetInputValueFromType( SurfaceInputs inputType ) { return m_inputTypeName[ inputType ]; } + private static string CreateLocalValueName( PrecisionType precision , WirePortDataType dataType , string localOutputValue , string value ) { return string.Format( Constants.LocalValueDecWithoutIdent , PrecisionWirePortToCgType( precision , dataType ) , localOutputValue , value ); } + + public static string CastPortType( ref MasterNodeDataCollector dataCollector , PrecisionType nodePrecision , object value , WirePortDataType oldType , WirePortDataType newType , string parameterName = null ) + { + if( oldType == newType || newType == WirePortDataType.OBJECT ) + { + return ( parameterName != null ) ? parameterName : value.ToString(); + } + + PrecisionType currentPrecision = nodePrecision; + string precisionStr = m_precisionTypeToCg[ currentPrecision ]; + string newTypeStr = m_wirePortToCgType[ newType ]; + newTypeStr = m_textInfo.ToTitleCase( newTypeStr ); + int castId = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) ? dataCollector.AvailableVertexTempId : dataCollector.AvailableFragTempId; + string localVarName = "temp_cast_" + castId; + string result = string.Empty; + bool useRealValue = ( parameterName == null ); + + switch( oldType ) + { + case WirePortDataType.FLOAT: + { + switch( newType ) + { + case WirePortDataType.OBJECT: result = useRealValue ? value.ToString() : parameterName; break; + case WirePortDataType.FLOAT2: + { + string localVal = CreateLocalValueName( currentPrecision , newType , localVarName , string.Format( Constants.CastHelper , ( ( useRealValue ) ? value.ToString() : parameterName ) , "xx" ) ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory , -1 , localVal ); + result = localVarName; + } + break; + case WirePortDataType.FLOAT3: + { + string localVal = CreateLocalValueName( currentPrecision , newType , localVarName , string.Format( Constants.CastHelper , ( ( useRealValue ) ? value.ToString() : parameterName ) , "xxx" ) ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory , -1 , localVal ); + result = localVarName; + } + break; + case WirePortDataType.COLOR: + { + string localVal = CreateLocalValueName( currentPrecision , newType , localVarName , string.Format( Constants.CastHelper , ( ( useRealValue ) ? value.ToString() : parameterName ) , "xxxx" ) ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory , -1 , localVal ); + result = localVarName; + } + break; + case WirePortDataType.FLOAT4: + { + string localVal = CreateLocalValueName( currentPrecision , newType , localVarName , string.Format( Constants.CastHelper , ( ( useRealValue ) ? value.ToString() : parameterName ) , "xxxx" ) ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory , -1 , localVal ); + result = localVarName; + } + break; + case WirePortDataType.FLOAT3x3: + { + string localVal = CreateLocalValueName( currentPrecision , newType , localVarName , ( ( useRealValue ) ? value.ToString() : parameterName ) ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory , -1 , localVal ); + result = localVarName; + } + break; + case WirePortDataType.FLOAT4x4: + { + string localVal = CreateLocalValueName( currentPrecision , newType , localVarName , ( ( useRealValue ) ? value.ToString() : parameterName ) ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory , -1 , localVal ); + result = localVarName; + } + break; + case WirePortDataType.INT: + { + result = ( useRealValue ) ? ( (int)value ).ToString() : "(int)" + parameterName; + } + break; + case WirePortDataType.UINT: + { + result = ( useRealValue ) ? ( (int)value ).ToString() : "(uint)" + parameterName; + } + break; + } + } + break; + case WirePortDataType.FLOAT2: + { + Vector2 vecVal = useRealValue ? (Vector2)value : Vector2.zero; + switch( newType ) + { + case WirePortDataType.OBJECT: result = useRealValue ? precisionStr + "2( " + vecVal.x + " , " + vecVal.y + " )" : parameterName; break; + case WirePortDataType.FLOAT: + { + result = ( useRealValue ) ? vecVal.x.ToString() : parameterName + ".x"; + } + break; + case WirePortDataType.FLOAT3: + { + result = ( useRealValue ) ? precisionStr + "3( " + vecVal.x + " , " + vecVal.y + " , " + " 0.0 )" : precisionStr + "3( " + parameterName + " , 0.0 )"; + } + break; + case WirePortDataType.COLOR: + case WirePortDataType.FLOAT4: + { + result = ( useRealValue ) ? precisionStr + "4( " + vecVal.x + " , " + vecVal.y + " , " + " 0.0 , 0.0 )" : precisionStr + "4( " + parameterName + ", 0.0 , 0.0 )"; + } + break; + } + } + break; + case WirePortDataType.FLOAT3: + { + Vector3 vecVal = useRealValue ? (Vector3)value : Vector3.zero; + switch( newType ) + { + case WirePortDataType.OBJECT: result = useRealValue ? precisionStr + "3( " + vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " )" : parameterName; break; + case WirePortDataType.FLOAT: + { + result = ( useRealValue ) ? vecVal.x.ToString() : parameterName + ".x"; + } + break; + case WirePortDataType.FLOAT2: + { + result = ( useRealValue ) ? precisionStr + "2( " + vecVal.x + " , " + vecVal.y + " )" : parameterName + ".xy"; + } + break; + case WirePortDataType.COLOR: + case WirePortDataType.FLOAT4: + { + result = ( useRealValue ) ? precisionStr + "4( " + vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " , 0.0 )" : precisionStr + "4( " + parameterName + " , 0.0 )"; + } + break; + //case WirePortDataType.FLOAT3x3: + //{ + // if ( useRealValue ) + // { + // result = precisionStr + "3x3( " + vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " , " + + // vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " , " + + // vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " )"; + // } + // else + // { + // string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, parameterName ); + // CurrentDataCollector.AddToLocalVariables( portCategory, -1, localVal ); + // result = precisionStr + "3x3( " + localVarName + ".x , " + localVarName + ".y , " + localVarName + ".x , " + + // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".y , " + + // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z )"; + // } + //} + //break; + //case WirePortDataType.FLOAT4x4: + //{ + // if ( useRealValue ) + // { + // result = precisionStr + "4x4( " + vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , 0 , " + + // vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , 0 , " + + // vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , 0 , " + + // vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , 0 )"; + // } + // else + // { + // string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, parameterName ); + // CurrentDataCollector.AddToLocalVariables( portCategory, -1, localVal ); + // result = precisionStr + "4x4( " + localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , 0 , " + + // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , 0 , " + + // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , 0 , " + + // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , 0 )"; + // } + //} + //break; + } + } + break; + case WirePortDataType.FLOAT4: + { + Vector4 vecVal = useRealValue ? (Vector4)value : Vector4.zero; + switch( newType ) + { + case WirePortDataType.OBJECT: result = useRealValue ? precisionStr + "4( " + vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " , " + vecVal.w + " )" : parameterName; break; + case WirePortDataType.FLOAT: + { + result = ( useRealValue ) ? vecVal.x.ToString() : parameterName + ".x"; + } + break; + case WirePortDataType.FLOAT2: + { + result = ( useRealValue ) ? precisionStr + "2( " + vecVal.x + " , " + vecVal.y + " )" : parameterName + ".xy"; + } + break; + case WirePortDataType.FLOAT3: + { + result = ( useRealValue ) ? precisionStr + "3( " + vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " )" : parameterName + ".xyz"; + } + break; + //case WirePortDataType.FLOAT4x4: + //{ + // if ( useRealValue ) + // { + // result = precisionStr + "4x4( " + vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , " + vecVal + ".w , " + + // vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , " + vecVal + ".w , " + + // vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , " + vecVal + ".w , " + + // vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , " + vecVal + ".w )"; + // } + // else + // { + // string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, parameterName ); + // CurrentDataCollector.AddToLocalVariables( portCategory, -1, localVal ); + // result = precisionStr + "4x4( " + localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w , " + + // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w , " + + // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w , " + + // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w )"; + // } + //} + //break; + case WirePortDataType.COLOR: + { + result = useRealValue ? precisionStr + "4( " + vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " , " + vecVal.w + " )" : parameterName; + } + break; + } + } + break; + case WirePortDataType.FLOAT3x3: + { + //Matrix4x4 matrixVal = useRealValue ? ( Matrix4x4 ) value : Matrix4x4.identity; + //switch ( newType ) + //{ + // case WirePortDataType.OBJECT: + // case WirePortDataType.FLOAT4x4: + // { + // result = ( useRealValue ) ? precisionStr + "4x4(" + matrixVal.m00 + " , " + matrixVal.m01 + " , " + matrixVal.m02 + " , " + matrixVal.m03 + " , " + + // matrixVal.m10 + " , " + matrixVal.m11 + " , " + matrixVal.m12 + " , " + matrixVal.m10 + " , " + + // matrixVal.m20 + " , " + matrixVal.m21 + " , " + matrixVal.m22 + " , " + matrixVal.m20 + " , " + + // matrixVal.m30 + " , " + matrixVal.m31 + " , " + matrixVal.m32 + " , " + matrixVal.m30 + " )" : precisionStr + "4x4(" + parameterName + ")"; + // } + // break; + //} + } + break; + case WirePortDataType.FLOAT4x4: + { + Matrix4x4 matrixVal = useRealValue ? (Matrix4x4)value : Matrix4x4.identity; + switch( newType ) + { + case WirePortDataType.OBJECT: + { + result = ( useRealValue ) ? precisionStr + "4x4(" + matrixVal.m00 + " , " + matrixVal.m01 + " , " + matrixVal.m02 + " , " + matrixVal.m03 + " , " + + matrixVal.m10 + " , " + matrixVal.m11 + " , " + matrixVal.m12 + " , " + matrixVal.m10 + " , " + + matrixVal.m20 + " , " + matrixVal.m21 + " , " + matrixVal.m22 + " , " + matrixVal.m20 + " , " + + matrixVal.m30 + " , " + matrixVal.m31 + " , " + matrixVal.m32 + " , " + matrixVal.m30 + " )" : parameterName; + } + break; + } + } + break; + case WirePortDataType.COLOR: + { + Color colorValue = ( useRealValue ) ? (Color)value : Color.black; + switch( newType ) + { + case WirePortDataType.OBJECT: result = useRealValue ? precisionStr + "4( " + colorValue.r + " , " + colorValue.g + " , " + colorValue.b + " , " + colorValue.a + " )" : parameterName; break; + case WirePortDataType.FLOAT: + { + result = ( useRealValue ) ? colorValue.r.ToString() : parameterName + ".r"; + } + break; + case WirePortDataType.FLOAT2: + { + result = ( useRealValue ) ? precisionStr + "2( " + colorValue.r + " , " + colorValue.g + " )" : parameterName + ".rg"; + } + break; + case WirePortDataType.FLOAT3: + { + result = ( useRealValue ) ? precisionStr + "3( " + colorValue.r + " , " + colorValue.g + " , " + colorValue.b + " )" : parameterName + ".rgb"; + } + break; + case WirePortDataType.FLOAT4: + { + result = useRealValue ? precisionStr + "4( " + colorValue.r + " , " + colorValue.g + " , " + colorValue.b + " , " + colorValue.a + " )" : parameterName; + } + break; + //case WirePortDataType.FLOAT4x4: + //{ + // if ( useRealValue ) + // { + // result = precisionStr + "4x4( " + colorValue.r + " , " + colorValue.g + " , " + colorValue.b + " , " + colorValue.a + " , " + + // colorValue.r + " , " + colorValue.g + " , " + colorValue.b + " , " + colorValue.a + " , " + + // colorValue.r + " , " + colorValue.g + " , " + colorValue.b + " , " + colorValue.a + " , " + + // colorValue.r + " , " + colorValue.g + " , " + colorValue.b + " , " + colorValue.a + " )"; + // } + // else + // { + // string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, parameterName ); + // CurrentDataCollector.AddToLocalVariables( portCategory, -1, localVal ); + + // result = precisionStr + "4x4( " + localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w , " + + // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w , " + + // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w , " + + // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w )"; + // } + //} + //break; + } + } + break; + case WirePortDataType.INT: + { + switch( newType ) + { + case WirePortDataType.OBJECT: result = useRealValue ? value.ToString() : parameterName; break; + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.COLOR: + case WirePortDataType.FLOAT4: + { + string localVal = CreateLocalValueName( currentPrecision , newType , localVarName , ( ( useRealValue ) ? value.ToString() : parameterName ) ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory , -1 , localVal ); + result = localVarName; + } + break; + case WirePortDataType.FLOAT3x3: + { + string localVal = CreateLocalValueName( currentPrecision , oldType , localVarName , ( ( useRealValue ) ? value.ToString() : parameterName ) ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory , -1 , localVal ); + result = localVarName; + } + break; + case WirePortDataType.FLOAT4x4: + { + string localVal = CreateLocalValueName( currentPrecision , oldType , localVarName , ( ( useRealValue ) ? value.ToString() : parameterName ) ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory , -1 , localVal ); + result = localVarName; + } + break; + case WirePortDataType.FLOAT: + { + result = ( useRealValue ) ? ( (int)value ).ToString() : "(float)" + parameterName; + } + break; + case WirePortDataType.UINT: + { + result = ( useRealValue ) ? ( (int)value ).ToString() : "(uint)" + parameterName; + } + break; + } + } + break; + case WirePortDataType.UINT: + { + switch( newType ) + { + case WirePortDataType.OBJECT: result = useRealValue ? value.ToString() : parameterName; break; + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.COLOR: + case WirePortDataType.FLOAT4: + { + string localVal = CreateLocalValueName( currentPrecision , newType , localVarName , ( ( useRealValue ) ? value.ToString() : parameterName ) ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory , -1 , localVal ); + result = localVarName; + } + break; + case WirePortDataType.FLOAT3x3: + { + string localVal = CreateLocalValueName( currentPrecision , oldType , localVarName , ( ( useRealValue ) ? value.ToString() : parameterName ) ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory , -1 , localVal ); + result = localVarName; + } + break; + case WirePortDataType.FLOAT4x4: + { + string localVal = CreateLocalValueName( currentPrecision , oldType , localVarName , ( ( useRealValue ) ? value.ToString() : parameterName ) ); + dataCollector.AddToLocalVariables( dataCollector.PortCategory , -1 , localVal ); + result = localVarName; + } + break; + case WirePortDataType.FLOAT: + { + result = ( useRealValue ) ? ( (int)value ).ToString() : "(float)" + parameterName; + } + break; + case WirePortDataType.INT: + { + result = ( useRealValue ) ? ( (int)value ).ToString() : "(int)" + parameterName; + } + break; + } + } + break; + } + if( result.Equals( string.Empty ) ) + { + result = "0"; + string warningStr = string.Format( "Unable to cast from {0} to {1}. Generating dummy data ( {2} )" , oldType , newType , result ); + + if( oldType == WirePortDataType.SAMPLER1D || oldType == WirePortDataType.SAMPLER2D || oldType == WirePortDataType.SAMPLER3D || oldType == WirePortDataType.SAMPLERCUBE || oldType == WirePortDataType.SAMPLER2DARRAY ) + { + warningStr = string.Format( "Unable to cast from {0} to {1}. You might want to use a Texture Sample node and connect it to the 'Tex' port. Generating dummy data ( {2} )" , oldType , newType , result ); + } + ShowMessage( warningStr , MessageSeverity.Warning ); + } + return result; + } + + public static bool CanCast( WirePortDataType from , WirePortDataType to ) + { + if( from == WirePortDataType.OBJECT || to == WirePortDataType.OBJECT || from == to ) + return true; + + switch( from ) + { + case WirePortDataType.FLOAT: + { + if( to == WirePortDataType.INT ) + return true; + } + break; + case WirePortDataType.FLOAT2: + { + return false; + } + case WirePortDataType.FLOAT3: + { + if( to == WirePortDataType.COLOR || + to == WirePortDataType.FLOAT4 ) + return true; + } + break; + case WirePortDataType.FLOAT4: + { + if( to == WirePortDataType.FLOAT3 || + to == WirePortDataType.COLOR ) + return true; + } + break; + case WirePortDataType.FLOAT3x3: + { + if( to == WirePortDataType.FLOAT4x4 ) + return true; + } + break; + case WirePortDataType.FLOAT4x4: + { + if( to == WirePortDataType.FLOAT3x3 ) + return true; + } + break; + case WirePortDataType.COLOR: + { + if( to == WirePortDataType.FLOAT3 || + to == WirePortDataType.FLOAT4 ) + return true; + + } + break; + case WirePortDataType.INT: + { + if( to == WirePortDataType.FLOAT ) + return true; + } + break; + } + + return false; + } + + public static int GetChannelsAmount( WirePortDataType type ) + { + switch( type ) + { + case WirePortDataType.OBJECT: return 0; + case WirePortDataType.FLOAT: return 1; + case WirePortDataType.FLOAT2: return 2; + case WirePortDataType.FLOAT3: return 3; + case WirePortDataType.FLOAT4: return 4; + case WirePortDataType.FLOAT3x3: return 9; + case WirePortDataType.FLOAT4x4: return 16; + case WirePortDataType.COLOR: return 4; + case WirePortDataType.INT: return 1; + case WirePortDataType.UINT: return 1; + } + return 0; + } + + public static WirePortDataType GetWireTypeForChannelAmount( int channelAmount ) + { + switch( channelAmount ) + { + case 1: return WirePortDataType.FLOAT; + case 2: return WirePortDataType.FLOAT2; + case 3: return WirePortDataType.FLOAT3; + case 4: return WirePortDataType.FLOAT4; + case 9: return WirePortDataType.FLOAT3x3; + case 16: return WirePortDataType.FLOAT4x4; + } + return WirePortDataType.FLOAT; + } + + public static string GenerateUniformName( bool excludeUniformKeyword , WirePortDataType dataType , string dataName ) + { + return GenerateUniformName( excludeUniformKeyword , WirePortToCgType( dataType ) , dataName ); + } + + public static string GenerateUniformName( bool excludeUniformKeyword , string dataType , string dataName ) + { + int index = excludeUniformKeyword ? 1 : 0; + return string.Format( Constants.UniformDec[ index ] , dataType , dataName ); + } + + public static string GeneratePropertyName( string name , PropertyType propertyType , bool forceUnderscore = false ) + { + if( string.IsNullOrEmpty( name ) ) + return name; + + name = RemoveInvalidCharacters( name ); + if( propertyType != PropertyType.Global || forceUnderscore ) + { + if( name[ 0 ] != '_' ) + { + name = '_' + name; + } + } + + return name; + } + + public static string UrlReplaceInvalidStrings( string originalString ) + { + for( int i = 0 ; i < Constants.UrlReplacementStringValuesLen ; i++ ) + { + originalString = originalString.Replace( Constants.UrlReplacementStringValues[ i , 0 ] , Constants.UrlReplacementStringValues[ i , 1 ] ); + } + return originalString; + } + + public static string ReplaceInvalidStrings( string originalString ) + { + for( int i = 0 ; i < Constants.ReplacementStringValuesLen ; i++ ) + { + originalString = originalString.Replace( Constants.ReplacementStringValues[ i , 0 ] , Constants.ReplacementStringValues[ i , 1 ] ); + } + return originalString; + } + + public static string RemoveWikiInvalidCharacters( string originalString ) + { + for( int i = 0 ; i < Constants.WikiInvalidChars.Length ; i++ ) + { + originalString = originalString.Replace( Constants.WikiInvalidChars[ i ] , string.Empty ); + } + return originalString; + } + + public static string RemoveInvalidEnumCharacters( string originalString ) + { + for( int i = 0 ; i < Constants.EnumInvalidChars.Length ; i++ ) + { + originalString = originalString.Replace( Constants.EnumInvalidChars[ i ] , string.Empty ); + } + return originalString; + } + + public static string RemoveInvalidAttrCharacters( string originalString ) + { + for( int i = 0 ; i < Constants.AttrInvalidChars.Length ; i++ ) + { + originalString = originalString.Replace( Constants.AttrInvalidChars[ i ] , string.Empty ); + } + return originalString; + } + + public static string RemoveHeaderAttrCharacters( string originalString ) + { + for( int i = 0 ; i < Constants.AttrInvalidChars.Length ; i++ ) + { + originalString = originalString.Replace( Constants.HeaderInvalidChars[ i ] , string.Empty ); + } + return originalString; + } + + public static string RemoveInvalidCharacters( string originalString ) + { + for( int i = 0 ; i < Constants.OverallInvalidChars.Length ; i++ ) + { + originalString = originalString.Replace( Constants.OverallInvalidChars[ i ] , string.Empty ); + } + return originalString; + } + + public static string RemoveRegisterInvalidCharacters(string originalString) + { + for (int i = 0; i < Constants.RegisterInvalidChars.Length; i++) + { + originalString = originalString.Replace(Constants.RegisterInvalidChars[i], string.Empty); + } + return originalString; + } + + public static string RemoveShaderInvalidCharacters( string originalString ) + { + originalString = originalString.Replace( '\\' , '/' ); + for( int i = 0 ; i < Constants.ShaderInvalidChars.Length ; i++ ) + { + originalString = originalString.Replace( Constants.ShaderInvalidChars[ i ] , string.Empty ); + } + return originalString; + } + + public static bool IsUnityNativeShader( Shader shader ) + { + string pathName = AssetDatabase.GetAssetPath( shader ); + + if( pathName.Contains( "unity_builtin_extra" ) || + pathName.Contains( "unity default resources" ) ) + return true; + + return false; + } + public static bool IsUnityNativeShader( string path ) { return m_unityNativeShaderPaths.ContainsKey( path ); } + + public static string GetComponentForPosition( int pos , WirePortDataType type , bool addDot = false ) + { + string result = addDot ? "." : string.Empty; + switch( pos ) + { + case 0: + { + return ( ( type == WirePortDataType.COLOR ) ? ( result + "r" ) : ( result + "x" ) ); + } + case 1: + { + return ( ( type == WirePortDataType.COLOR ) ? ( result + "g" ) : ( result + "y" ) ); + } + case 2: + { + return ( ( type == WirePortDataType.COLOR ) ? ( result + "b" ) : ( result + "z" ) ); + } + case 3: + { + return ( ( type == WirePortDataType.COLOR ) ? ( result + "a" ) : ( result + "w" ) ); + } + } + return string.Empty; + } + + public static string InvalidParameter( ParentNode node ) + { + ShowMessage( node.UniqueId , "Invalid entrance type on node" + node , MessageSeverity.Error ); + return "0"; + } + + public static string NoConnection( ParentNode node ) + { + ShowMessage( node.UniqueId , "No Input connection on node" + node , MessageSeverity.Error ); + return "0"; + } + + public static string UnknownError( ParentNode node ) + { + ShowMessage( node.UniqueId , "Unknown error on node" + node , MessageSeverity.Error ); + return "0"; + } + + public static string GetTex2DProperty( string name , TexturePropertyValues defaultValue ) { return name + "(\"" + name + "\", 2D) = \"" + defaultValue + "\" {}"; } + public static string AddBrackets( string value ) { return "( " + value + " )"; } + public static Color GetColorFromWireStatus( WireStatus status ) { return m_wireStatusToColor[ status ]; } + public static bool HasColorCategory( string category ) { return m_nodeCategoryToColor.ContainsKey( category ); } + public static void AddColorCategory( string category , Color color ) + { + m_nodeCategoryToColor.Add( category , color ); + } + + public static Color AddColorCategory( string category , string hexColor ) + { + try + { + Color color = new Color(); + ColorUtility.TryParseHtmlString( hexColor , out color ); + m_nodeCategoryToColor.Add( category , color ); + return color; + } + catch( System.Exception e ) + { + Debug.LogException( e ); + } + return m_nodeCategoryToColor[ "Default" ]; + } + + public static Color GetColorFromCategory( string category ) + { + if( m_nodeCategoryToColor.ContainsKey( category ) ) + return m_nodeCategoryToColor[ category ]; + + + if( DebugConsoleWindow.DeveloperMode ) + Debug.LogWarning( category + " category does not contain an associated color" ); + + return m_nodeCategoryToColor[ "Default" ]; + } + + public static string LatestOpenedFolder + { + get { return m_latestOpenedFolder; } + set { m_latestOpenedFolder = value; } + } + + public static void ActivatePreviews( bool value ) + { + int count = IOUtils.AllOpenedWindows.Count; + for( int i = 0 ; i < count ; i++ ) + { + IOUtils.AllOpenedWindows[ i ].ActivatePreviews( value ); + } + } + + public static Shader CreateNewUnlit() + { + if( CurrentWindow == null ) + return null; + + string shaderName; + string pathName; + Shader newShader = null; + IOUtils.GetShaderName( out shaderName , out pathName , "MyUnlitShader" , m_latestOpenedFolder ); + if( !System.String.IsNullOrEmpty( shaderName ) && !System.String.IsNullOrEmpty( pathName ) ) + { + CurrentWindow.CreateNewGraph( shaderName ); + CurrentWindow.PreMadeShadersInstance.FlatColorSequence.Execute(); + + CurrentWindow.CurrentGraph.CurrentMasterNode.SetName( shaderName ); + newShader = CurrentWindow.CurrentGraph.FireMasterNode( pathName , true ); + AssetDatabase.Refresh(); + } + return newShader; + } + + public static Shader CreateNewEmpty( string customPath = null , string customShaderName = null ) + { + if( CurrentWindow == null ) + return null; + + string shaderName; + string pathName; + Shader newShader = null; + + + string path = AssetDatabase.GetAssetPath( Selection.activeObject ); + if( path == "" ) + { + path = "Assets"; + } + else if( System.IO.Path.GetExtension( path ) != "" ) + { + path = path.Replace( System.IO.Path.GetFileName( AssetDatabase.GetAssetPath( Selection.activeObject ) ) , "" ); + } + + + if( string.IsNullOrEmpty( customPath ) ) + { + IOUtils.GetShaderName( out shaderName , out pathName , Constants.DefaultShaderName , m_latestOpenedFolder ); + } + else + { + pathName = customPath; + if( string.IsNullOrEmpty( customShaderName ) ) + { + shaderName = Constants.DefaultShaderName; + int indexOfAssets = pathName.IndexOf( "Assets" ); + string uniquePath = ( indexOfAssets > 0 ) ? pathName.Remove( 0 , indexOfAssets ) : pathName; + string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath( uniquePath + shaderName + ".shader" ); + pathName = assetPathAndName; + shaderName = assetPathAndName.Remove( 0 , assetPathAndName.IndexOf( shaderName ) ); + } + else + { + shaderName = customShaderName; + } + shaderName = shaderName.Remove( shaderName.Length - 7 ); + } + if( !System.String.IsNullOrEmpty( shaderName ) && !System.String.IsNullOrEmpty( pathName ) ) + { + m_latestOpenedFolder = pathName; + + CurrentWindow.titleContent.text = AmplifyShaderEditorWindow.GenerateTabTitle( shaderName ); + CurrentWindow.titleContent.image = ShaderIcon; + CurrentWindow.CreateNewGraph( shaderName ); + CurrentWindow.LastOpenedLocation = pathName; + CurrentWindow.CurrentGraph.CurrentMasterNode.SetName( shaderName ); + newShader = CurrentWindow.CurrentGraph.FireMasterNode( pathName , true ); + AssetDatabase.Refresh(); + } + + return newShader; + } + + + public static Shader CreateNewEmptyTemplate( string templateGUID , string customPath = null , string customShaderName = null ) + { + if( CurrentWindow == null ) + return null; + + string shaderName; + string pathName; + Shader newShader = null; + + + string path = AssetDatabase.GetAssetPath( Selection.activeObject ); + if( path == "" ) + { + path = "Assets"; + } + else if( System.IO.Path.GetExtension( path ) != "" ) + { + path = path.Replace( System.IO.Path.GetFileName( AssetDatabase.GetAssetPath( Selection.activeObject ) ) , "" ); + } + + + if( string.IsNullOrEmpty( customPath ) ) + { + IOUtils.GetShaderName( out shaderName , out pathName , Constants.DefaultShaderName , m_latestOpenedFolder ); + } + else + { + pathName = customPath; + if( string.IsNullOrEmpty( customShaderName ) ) + { + shaderName = Constants.DefaultShaderName; + int indexOfAssets = pathName.IndexOf( "Assets" ); + string uniquePath = ( indexOfAssets > 0 ) ? pathName.Remove( 0 , indexOfAssets ) : pathName; + string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath( uniquePath + shaderName + ".shader" ); + pathName = assetPathAndName; + shaderName = assetPathAndName.Remove( 0 , assetPathAndName.IndexOf( shaderName ) ); + } + else + { + shaderName = customShaderName; + } + shaderName = shaderName.Remove( shaderName.Length - 7 ); + } + if( !System.String.IsNullOrEmpty( shaderName ) && !System.String.IsNullOrEmpty( pathName ) ) + { + m_latestOpenedFolder = pathName; + + CurrentWindow.titleContent.text = AmplifyShaderEditorWindow.GenerateTabTitle( shaderName ); + CurrentWindow.titleContent.image = UIUtils.ShaderIcon; + CurrentWindow.CreateNewTemplateGraph( templateGUID ); + CurrentWindow.CurrentGraph.CurrentMasterNode.SetName( shaderName ); + newShader = CurrentWindow.CurrentGraph.FireMasterNode( pathName , true ); + AssetDatabase.Refresh(); + } + + return newShader; + } + + + public static void SetDelayedMaterialMode( Material material ) + { + if( CurrentWindow == null ) + return; + CurrentWindow.SetDelayedMaterialMode( material ); + } + + public static void CreateEmptyFromInvalid( Shader shader ) + { + if( CurrentWindow == null ) + return; + + CurrentWindow.CreateNewGraph( shader ); + CurrentWindow.ForceRepaint(); + } + + public static void CreateEmptyFunction( AmplifyShaderFunction shaderFunction ) + { + if( CurrentWindow == null ) + return; + + CurrentWindow.CreateNewFunctionGraph( shaderFunction ); + CurrentWindow.SaveToDisk( false ); + CurrentWindow.ForceRepaint(); + } + + public static void DrawFloat( UndoParentNode owner , ref Rect propertyDrawPos , ref float value , float newLabelWidth = 8 ) + { + float labelWidth = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = newLabelWidth; + value = owner.EditorGUIFloatField( propertyDrawPos , " " , value , UIUtils.MainSkin.textField ); + EditorGUIUtility.labelWidth = labelWidth; + } + + public static GUIStyle GetCustomStyle( CustomStyle style ) + { + return ( Initialized ) ? MainSkin.customStyles[ (int)style ] : null; + } + + public static void SetCustomStyle( CustomStyle style , GUIStyle guiStyle ) + { + if( MainSkin != null ) + MainSkin.customStyles[ (int)style ] = new GUIStyle( guiStyle ); + } + + public static void OpenFile() + { + if( CurrentWindow == null ) + return; + string newShader = EditorUtility.OpenFilePanel( "Select Shader to open" , m_latestOpenedFolder , "shader" ); + if( !System.String.IsNullOrEmpty( newShader ) ) + { + m_latestOpenedFolder = newShader.Substring( 0 , newShader.LastIndexOf( '/' ) + 1 ); + int relFilenameId = newShader.IndexOf( Application.dataPath ); + if( relFilenameId > -1 ) + { + string relFilename = newShader.Substring( relFilenameId + Application.dataPath.Length - 6 );// -6 need to also copy the assets/ part + CurrentWindow.LoadFromDisk( relFilename ); + } + else + { + ShowMessage( "Can only load shaders\nfrom inside the projects folder" , MessageSeverity.Error ); + } + } + } + + public static bool DetectNodeLoopsFrom( ParentNode node , Dictionary currentNodes ) + { + for( int i = 0 ; i < node.InputPorts.Count ; i++ ) + { + if( node.InputPorts[ i ].IsConnected ) + { + ParentNode newNode = node.InputPorts[ i ].GetOutputNode(); + if( !currentNodes.ContainsKey( newNode.UniqueId ) ) + RecursiveNodeFill( newNode , currentNodes ); + } + } + + bool found = currentNodes.ContainsKey( node.UniqueId ); + currentNodes.Clear(); + currentNodes = null; + + return found; + } + + private static void RecursiveNodeFill( ParentNode node , Dictionary currentNodes ) + { + if( !currentNodes.ContainsKey( node.UniqueId ) ) + currentNodes.Add( node.UniqueId , 1 ); + + for( int i = 0 ; i < node.InputPorts.Count ; i++ ) + { + if( node.InputPorts[ i ].IsConnected ) + { + ParentNode newNode = node.InputPorts[ i ].GetOutputNode(); + if( !currentNodes.ContainsKey( newNode.UniqueId ) ) + RecursiveNodeFill( newNode , currentNodes ); + } + } + } + + public static ParentNode CreateNode( System.Type type , bool registerUndo , Vector2 pos , int nodeId = -1 , bool addLast = true ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.CurrentGraph.CreateNode( type , registerUndo , pos , nodeId , addLast ); + } + return null; + } + + public static void DestroyNode( int nodeId ) + { + if( CurrentWindow != null ) + { + CurrentWindow.CurrentGraph.DestroyNode( nodeId ); + } + } + + public static void ShowMessage( int ownerId , string message , MessageSeverity severity = MessageSeverity.Normal , bool registerTimestamp = true ) + { + if( CurrentWindow != null ) + { + CurrentWindow.ShowMessage( ownerId , message , severity , registerTimestamp ); + } + } + + public static void ShowMessage( string message , MessageSeverity severity = MessageSeverity.Normal , bool registerTimestamp = true ) + { + if( CurrentWindow != null ) + { + CurrentWindow.ShowMessage( message , severity , registerTimestamp ); + } + } + + public static ParentNode GetNode( int nodeId ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.CurrentGraph.GetNode( nodeId ); + } + return null; + } + + public static PropertyNode GetInternalTemplateNode( int nodeId ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.CurrentGraph.GetInternalTemplateNode( nodeId ); + } + return null; + } + + public static string GetInternalTemplateNodePropertyName( int nodeId ) + { + if ( CurrentWindow != null ) + { + PropertyNode node = CurrentWindow.CurrentGraph.GetInternalTemplateNode( nodeId ); + return ( node != null ) ? node.PropertyName : string.Empty; + } + return string.Empty; + } + + public static PropertyNode GetInternalTemplateNode( string propertyName ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.CurrentGraph.GetInternalTemplateNode( propertyName ); + } + return null; + } + + public static int GetInternalTemplateNodeId( string propertyName ) + { + if ( CurrentWindow != null && !string.IsNullOrEmpty( propertyName) ) + { + PropertyNode node = CurrentWindow.CurrentGraph.GetInternalTemplateNode( propertyName ); + return ( node != null ) ? node.UniqueId : -1; + } + return -1; + } + + public static void DeleteConnection( bool isInput , int nodeId , int portId , bool registerOnLog , bool propagateCallback ) + { + if( CurrentWindow != null ) + { + CurrentWindow.DeleteConnection( isInput , nodeId , portId , registerOnLog , propagateCallback ); + } + } + + public static void ConnectInputToOutput( int inNodeId , int inPortId , int outNodeId , int outPortId ) + { + if( CurrentWindow != null ) + { + CurrentWindow.ConnectInputToOutput( inNodeId , inPortId , outNodeId , outPortId ); + } + } + + public static Shader CreateNewGraph( string name ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.CreateNewGraph( name ); + } + return null; + } + public static void SetConnection( int InNodeId , int InPortId , int OutNodeId , int OutPortId ) + { + if( CurrentWindow != null ) + { + CurrentWindow.CurrentGraph.SetConnection( InNodeId , InPortId , OutNodeId , OutPortId ); + } + } + + public static bool IsChannelAvailable( int channelId ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.DuplicatePrevBufferInstance.IsChannelAvailable( channelId ); + } + return false; + } + + public static bool ReleaseUVChannel( int nodeId , int channelId ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.DuplicatePrevBufferInstance.ReleaseUVChannel( nodeId , channelId ); + } + return false; + } + + public static bool RegisterUVChannel( int nodeId , int channelId , string name ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.DuplicatePrevBufferInstance.RegisterUVChannel( nodeId , channelId , name ); + } + return false; + } + + public static void GetFirstAvailableName( int nodeId , WirePortDataType type , out string outProperty , out string outInspector , bool useCustomPrefix = false , string customPrefix = null ) + { + outProperty = string.Empty; + outInspector = string.Empty; + if( CurrentWindow != null ) + { + CurrentWindow.DuplicatePrevBufferInstance.GetFirstAvailableName( nodeId , type , out outProperty , out outInspector , useCustomPrefix , customPrefix ); + } + } + + + public static bool IsNumericName( string name ) + { + Match match = Regex.Match( name , NumericNamePattern ); + if( match != null && match.Success ) + return true; + return false; + } + + public static bool CheckInvalidUniformName( string name ) + { + if( m_reservedPropertyNames.ContainsKey( name ) ) + { + ShowMessage( string.Format( Constants.ReservedPropertyNameStr , name ) ); + return true; + } + + if( IsNumericName( name ) ) + { + ShowMessage( string.Format( Constants.NumericPropertyNameStr , name ) ); + return true; + } + + return false; + } + + public static bool RegisterUniformName( int nodeId , string name ) + { + if( CheckInvalidUniformName( name ) ) + { + return false; + } + + if( CurrentWindow != null ) + { + return CurrentWindow.DuplicatePrevBufferInstance.RegisterUniformName( nodeId , name ); + } + return false; + } + + public static bool ReleaseUniformName( int nodeId , string name ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.DuplicatePrevBufferInstance.ReleaseUniformName( nodeId , name ); + } + return false; + } + + public static bool IsUniformNameAvailable( string name ) + { + if( CheckInvalidUniformName( name ) ) + { + return false; + } + + if( CurrentWindow != null ) + { + return CurrentWindow.DuplicatePrevBufferInstance.IsUniformNameAvailable( name ); + } + return false; + } + + public static int CheckUniformNameOwner( string name ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.DuplicatePrevBufferInstance.CheckUniformNameOwner( name ); + } + return -1; + } + + public static string GetUniqueUniformName( string name ) + { + if( CurrentWindow.DuplicatePrevBufferInstance.IsUniformNameAvailable( name ) ) + { + return name; + } + + int num = 0; + Regex reg = new Regex( @"([0-9]+)$" ); + Match match = reg.Match( name ); + if( match.Success ) + { + string s = match.Groups[ 1 ].Captures[ 0 ].Value; + num = int.Parse( s ); + name = name.Replace( s , "" ); + } + + for( int i = num + 1 ; i < 1000 ; i++ ) + { + string testName = name + i; + + if( CheckInvalidUniformName( testName ) ) + { + continue; + } + + if( CurrentWindow != null ) + { + if( CurrentWindow.DuplicatePrevBufferInstance.IsUniformNameAvailable( testName ) ) + { + return testName; + } + } + } + return name; + } + + public static bool RegisterLocalVariableName( int nodeId , string name ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.DuplicatePrevBufferInstance.RegisterLocalVariableName( nodeId , name ); + } + return false; + } + + public static bool ReleaseLocalVariableName( int nodeId , string name ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.DuplicatePrevBufferInstance.ReleaseLocalVariableName( nodeId , name ); + } + return false; + } + + public static bool IsLocalvariableNameAvailable( string name ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.DuplicatePrevBufferInstance.IsLocalvariableNameAvailable( name ); + } + return false; + } + + public static string GetChannelName( int channelId ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.DuplicatePrevBufferInstance.GetChannelName( channelId ); + } + return string.Empty; + } + + public static void SetChannelName( int channelId , string name ) + { + if( CurrentWindow != null ) + { + CurrentWindow.DuplicatePrevBufferInstance.SetChannelName( channelId , name ); + } + } + + public static int RegisterFirstAvailableChannel( int nodeId , string name ) + { + if( CurrentWindow != null ) + { + return CurrentWindow.DuplicatePrevBufferInstance.RegisterFirstAvailableChannel( nodeId , name ); + } + return -1; + } + + public static int PortCategorytoAttayIdx( MasterNodePortCategory category ) + { + if( m_portCategoryToArrayIdx.ContainsKey( category ) ) + return m_portCategoryToArrayIdx[ category ]; + + return m_portCategoryToArrayIdx[ MasterNodePortCategory.Fragment ]; + } + + public static bool DisplayDialog( string shaderPath ) + { + string value = System.String.Format( "Save changes to the shader {0} before closing?" , shaderPath ); + return EditorUtility.DisplayDialog( "Load selected" , value , "Yes" , "No" ); + } + + public static void ForceUpdateFromMaterial() + { + if( CurrentWindow != null ) + { + // CurrentWindow.Focus(); + CurrentWindow.ForceUpdateFromMaterial(); + } + } + + public static void MarkToRepaint() { if( CurrentWindow != null ) CurrentWindow.MarkToRepaint(); } + public static void RequestSave() { if( CurrentWindow != null ) CurrentWindow.RequestSave(); } + + public static string PropertyFloatToString( float value ) + { + return value.ToString( "0.####################" ); + } + + public static int CurrentShaderVersion() + { + if( CurrentWindow != null ) + { + return CurrentWindow.CurrentGraph.LoadedShaderVersion; + } + return -1; + } + + public static bool IsProperty( PropertyType type ) { return ( type == PropertyType.Property || type == PropertyType.InstancedProperty ); } + + public static MasterNode CurrentMasterNode() + { + if( CurrentWindow != null ) + { + return CurrentWindow.CurrentGraph.CurrentMasterNode; + } + return null; + } + + public static void AddVirtualTextureCount() { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.AddVirtualTextureCount(); } } + + public static bool HasVirtualTexture() + { + if( CurrentWindow != null ) + { + return CurrentWindow.CurrentGraph.HasVirtualTexture; + } + return false; + } + + public static void RemoveVirtualTextureCount() { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.RemoveVirtualTextureCount(); } } + + //public static void AddInstancePropertyCount() { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.AddInstancePropertyCount(); } } + + public static bool IsInstancedShader() + { + if( CurrentWindow != null ) + { + return CurrentWindow.CurrentGraph.IsInstancedShader; + } + return false; + } + + //public static void RemoveInstancePropertyCount() { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.RemoveInstancePropertyCount(); } } + //public static void AddNormalDependentCount() { if ( CurrentWindow != null ) { CurrentWindow.CurrentGraph.AddNormalDependentCount(); } } + //public static void RemoveNormalDependentCount() { if ( CurrentWindow != null ) { CurrentWindow.CurrentGraph.RemoveNormalDependentCount(); } } + //public static bool IsNormalDependent() + //{ + // if ( CurrentWindow != null ) + // { + // return CurrentWindow.CurrentGraph.IsNormalDependent; + // } + // return false; + //} + + public static void CopyValuesFromMaterial( Material mat ) + { + if( CurrentWindow != null && CurrentWindow.CurrentMaterial == mat ) + { + CurrentWindow.CurrentGraph.CopyValuesFromMaterial( mat ); + } + else + { + int aseWindowCount = IOUtils.AllOpenedWindows.Count; + for( int i = 0 ; i < aseWindowCount ; i++ ) + { + if( IOUtils.AllOpenedWindows[ i ] != m_currentWindow && IOUtils.AllOpenedWindows[ i ].CurrentMaterial == mat ) + { + IOUtils.AllOpenedWindows[ i ].CurrentGraph.CopyValuesFromMaterial( mat ); + break; + } + } + } + } + + // Sampler Node + public static void RegisterSamplerNode( SamplerNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.SamplerNodes.AddNode( node ); } } + public static void UnregisterSamplerNode( SamplerNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.SamplerNodes.RemoveNode( node ); } } + public static string[] SamplerNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.SamplerNodes.NodesArr; } return null; } + public static SamplerNode GetSamplerNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.SamplerNodes.GetNode( idx ); } return null; } + public static void UpdateSamplerDataNode( int uniqueId , string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.SamplerNodes.UpdateDataOnNode( uniqueId , data ); } } + public static int GetSamplerNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.SamplerNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } + public static int GetSamplerNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.SamplerNodes.NodesList.Count; } return -1; } + + // Float Node + public static void RegisterFloatIntNode( PropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FloatIntNodes.AddNode( node ); } } + public static void UnregisterFloatIntNode( PropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FloatIntNodes.RemoveNode( node ); } } + public static string[] FloatIntNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FloatIntNodes.NodesArr; } return null; } + public static int[] FloatIntNodeIds() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FloatIntNodes.NodeIds; } return null; } + public static PropertyNode GetFloatIntNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FloatIntNodes.GetNode( idx ); } return null; } + public static void UpdateFloatIntDataNode( int uniqueId , string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FloatIntNodes.UpdateDataOnNode( uniqueId , data ); } } + public static int GetFloatIntNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FloatIntNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } + public static int GetFloatIntNodeIdByName( string name ) + { + if( CurrentWindow != null ) + { + UsageListFloatIntNodes list = CurrentWindow.CurrentGraph.FloatIntNodes; + int count = list.Count; + for( int i = 0 ; i < count ; i++ ) + { + if( list.NodesList[ i ].PropertyName.Equals( name ) ) + return list.NodesList[ i ].UniqueId; + } + } + return -1; + } + public static string GetFloatIntNameByNodeId( int uniqueId, string defaultName = null ) + { + PropertyNode node = UIUtils.GetFloatIntNodeByUniqueId( uniqueId ); + return ( node != null ) ? node.PropertyName : defaultName; + } + public static PropertyNode GetFloatIntNodeByUniqueId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FloatIntNodes.GetNodeByUniqueId( uniqueId ); } return null; } + + // Texture Property + public static void RegisterTexturePropertyNode( TexturePropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.TexturePropertyNodes.AddNode( node ); } } + public static void UnregisterTexturePropertyNode( TexturePropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.TexturePropertyNodes.RemoveNode( node ); } } + public static string[] TexturePropertyNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TexturePropertyNodes.NodesArr; } return null; } + public static TexturePropertyNode GetTexturePropertyNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TexturePropertyNodes.GetNode( idx ); } return null; } + public static void UpdateTexturePropertyDataNode( int uniqueId , string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.TexturePropertyNodes.UpdateDataOnNode( uniqueId , data ); } } + public static int GetTexturePropertyNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TexturePropertyNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } + public static int GetTexturePropertyNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TexturePropertyNodes.NodesList.Count; } return -1; } + + // Texture Array + public static void RegisterTextureArrayNode( TextureArrayNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.TextureArrayNodes.AddNode( node ); } } + public static void UnregisterTextureArrayNode( TextureArrayNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.TextureArrayNodes.RemoveNode( node ); } } + public static string[] TextureArrayNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TextureArrayNodes.NodesArr; } return null; } + public static TextureArrayNode GetTextureArrayNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TextureArrayNodes.GetNode( idx ); } return null; } + public static void UpdateTextureArrayDataNode( int uniqueId , string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.TextureArrayNodes.UpdateDataOnNode( uniqueId , data ); } } + public static int GetTextureArrayNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TextureArrayNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } + public static int GetTextureArrayNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TextureArrayNodes.NodesList.Count; } return -1; } + + // Raw Property Node + public static void RegisterRawPropertyNode( PropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.OutsideGraph.RawPropertyNodes.AddNode( node ); } } + public static void UnregisterRawPropertyNode( PropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.OutsideGraph.RawPropertyNodes.RemoveNode( node ); } } + + // Property Node + public static void RegisterPropertyNode( PropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.PropertyNodes.AddNode( node ); } } + public static void UnregisterPropertyNode( PropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.PropertyNodes.RemoveNode( node ); } } + public static string[] PropertyNodeNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.PropertyNodes.NodesArr; } return null; } + public static PropertyNode GetPropertyNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.PropertyNodes.GetNode( idx ); } return null; } + public static PropertyNode GetPropertyNodeByUniqueId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.PropertyNodes.GetNodeByUniqueId( uniqueId ); } return null; } + public static void UpdatePropertyDataNode( int uniqueId , string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.PropertyNodes.UpdateDataOnNode( uniqueId , data ); } } + public static int GetPropertyNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.PropertyNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } + public static List PropertyNodesList() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.PropertyNodes.NodesList; } return null; } + public static int GetPropertyNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.PropertyNodes.NodesList.Count; } return -1; } + + // Function Inputs + public static void RegisterFunctionInputNode( FunctionInput node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionInputNodes.AddNode( node ); } } + public static void UnregisterFunctionInputNode( FunctionInput node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionInputNodes.RemoveNode( node ); } } + public static void UpdateFunctionInputData( int uniqueId , string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionInputNodes.UpdateDataOnNode( uniqueId , data ); } } + public static List FunctionInputList() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionInputNodes.NodesList; } return null; } + + // Function Nodes + public static void RegisterFunctionNode( FunctionNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionNodes.AddNode( node ); } } + public static void UnregisterFunctionNode( FunctionNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionNodes.RemoveNode( node ); } } + public static void UpdateFunctionData( int uniqueId , string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionNodes.UpdateDataOnNode( uniqueId , data ); } } + public static List FunctionList() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionNodes.NodesList; } return null; } + + // Function Outputs + public static void RegisterFunctionOutputNode( FunctionOutput node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionOutputNodes.AddNode( node ); } } + public static void UnregisterFunctionOutputNode( FunctionOutput node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionOutputNodes.RemoveNode( node ); } } + public static void UpdateFunctionOutputData( int uniqueId , string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionOutputNodes.UpdateDataOnNode( uniqueId , data ); } } + public static List FunctionOutputList() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionOutputNodes.NodesList; } return null; } + + // Function Switches Copy + public static void RegisterFunctionSwitchCopyNode( FunctionSwitch node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionSwitchCopyNodes.AddNode( node ); } } + public static void UnregisterFunctionSwitchCopyNode( FunctionSwitch node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionSwitchCopyNodes.RemoveNode( node ); } } + public static void UpdateFunctionSwitchCopyData( int uniqueId , string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionSwitchCopyNodes.UpdateDataOnNode( uniqueId , data ); } } + public static List FunctionSwitchCopyList() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionSwitchCopyNodes.NodesList; } return null; } + + // Function Switches + public static void RegisterFunctionSwitchNode( FunctionSwitch node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionSwitchNodes.AddNode( node ); } } + public static void UnregisterFunctionSwitchNode( FunctionSwitch node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionSwitchNodes.RemoveNode( node ); } } + public static void UpdateFunctionSwitchData( int uniqueId , string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionSwitchNodes.UpdateDataOnNode( uniqueId , data ); } } + public static List FunctionSwitchList() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionSwitchNodes.NodesList; } return null; } + public static void UpdateFunctionSwitchArr() { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionSwitchNodes.UpdateNodeArr(); } } + public static string[] FunctionSwitchesNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionSwitchNodes.NodesArr; } return null; } + public static FunctionSwitch GetFunctionSwitchNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionSwitchNodes.GetNode( idx ); } return null; } + public static int GetFunctionSwitchNodeIndex( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionSwitchNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } + + // Screen Color Node + public static void RegisterScreenColorNode( ScreenColorNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.ScreenColorNodes.AddNode( node ); } } + public static void UnregisterScreenColorNode( ScreenColorNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.ScreenColorNodes.RemoveNode( node ); } } + public static string[] ScreenColorNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.ScreenColorNodes.NodesArr; } return null; } + public static ScreenColorNode GetScreenColorNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.ScreenColorNodes.GetNode( idx ); } return null; } + public static int GetScreenColorNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.ScreenColorNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } + public static void UpdateScreenColorDataNode( int uniqueId , string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.ScreenColorNodes.UpdateDataOnNode( uniqueId , data ); } } + public static int GetScreenColorNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.ScreenColorNodes.NodesList.Count; } return -1; } + + // Local Var Node + public static int RegisterLocalVarNode( RegisterLocalVarNode node ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.LocalVarNodes.AddNode( node ); } return -1; } + public static void UnregisterLocalVarNode( RegisterLocalVarNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.LocalVarNodes.RemoveNode( node ); } } + public static string[] LocalVarNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.LocalVarNodes.NodesArr; } return null; } + public static int LocalVarNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.LocalVarNodes.NodesList.Count; } return 0; } + public static int GetLocalVarNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.LocalVarNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } + public static RegisterLocalVarNode GetLocalVarNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.LocalVarNodes.GetNode( idx ); } return null; } + public static void UpdateLocalVarDataNode( int uniqueId , string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.LocalVarNodes.UpdateDataOnNode( uniqueId , data ); } } + + //Global Array + public static void RegisterGlobalArrayNode( GlobalArrayNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.GlobalArrayNodes.AddNode( node ); } } + public static void UnregisterGlobalArrayNode( GlobalArrayNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.GlobalArrayNodes.RemoveNode( node ); } } + public static string[] GlobalArrayNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.GlobalArrayNodes.NodesArr; } return null; } + public static GlobalArrayNode GetGlobalArrayNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.GlobalArrayNodes.GetNode( idx ); } return null; } + public static int GetGlobalArrayNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.GlobalArrayNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } + public static void UpdateGlobalArrayDataNode( int uniqueId , string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.GlobalArrayNodes.UpdateDataOnNode( uniqueId , data ); } } + public static int GetGlobalArrayNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.GlobalArrayNodes.NodesList.Count; } return -1; } + + + public static void FocusOnNode( ParentNode node , float zoom , bool selectNode ) { if( CurrentWindow != null ) { CurrentWindow.FocusOnNode( node , zoom , selectNode ); } } + public static PrecisionType CurrentPrecision() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.CurrentPrecision; } return PrecisionType.Float; } + public static string CurrentPrecisionCg() { if( CurrentWindow != null ) { return m_precisionTypeToCg[ CurrentWindow.CurrentGraph.CurrentPrecision ]; } return m_precisionTypeToCg[ PrecisionType.Float ]; } + + public static PrecisionType GetFinalPrecision( PrecisionType precision ) + { + if( CurrentWindow != null && CurrentWindow.CurrentGraph != null ) + { + PrecisionType mainPrecision = CurrentWindow.CurrentGraph.CurrentPrecision; + if( (int)mainPrecision > (int)precision ) + return mainPrecision; + } + return precision; + } + + public static bool GetNodeAvailabilityInBitArray( int bitArray , NodeAvailability availability ) { return ( bitArray & (int)availability ) != 0; } + public static bool GetCategoryInBitArray( int bitArray , MasterNodePortCategory category ) { return ( bitArray & (int)category ) != 0; } + public static void SetCategoryInBitArray( ref int bitArray , MasterNodePortCategory category ) { bitArray = bitArray | (int)category; } + + public static int GetPriority( WirePortDataType type ) { return m_portPriority[ type ]; } + + public static void ShowIncompatiblePortMessage( bool fromInput , ParentNode inNode , WirePort inPort , ParentNode outNode , WirePort outPort ) + { + string inPortName = inPort.Name.Equals( Constants.EmptyPortValue ) ? inPort.PortId.ToString() : inPort.Name; + string outPortName = outPort.Name.Equals( Constants.EmptyPortValue ) ? outPort.PortId.ToString() : outPort.Name; + ShowMessage( outNode.UniqueId , string.Format( ( fromInput ? IncorrectInputConnectionErrorMsg : IncorrectOutputConnectionErrorMsg ) , inPortName , inNode.Attributes.Name , inPort.DataType , outPort.DataType , outPortName , outNode.Attributes.Name ) ); + } + + public static void ShowNoVertexModeNodeMessage( ParentNode node ) + { + ShowMessage( node.UniqueId , string.Format( NoVertexModeNodeWarning , node.Attributes.Name ) , MessageSeverity.Warning ); + } + + public static int TotalExampleMaterials { get { return m_exampleMaterialIDs.Count; } } + + public static int ShaderIndentLevel + { + get { return m_shaderIndentLevel; } + set + { + m_shaderIndentLevel = Mathf.Max( value , 0 ); + m_shaderIndentTabs = string.Empty; + for( int i = 0 ; i < m_shaderIndentLevel ; i++ ) { m_shaderIndentTabs += "\t"; } + } + } + + public static string ShaderIndentTabs { get { return m_shaderIndentTabs; } } + public static void AddLineToShaderBody( ref string ShaderBody , string line ) { ShaderBody += m_shaderIndentTabs + line; } + public static void AddMultiLineToShaderBody( ref string ShaderBody , string[] lines ) + { + for( int i = 0 ; i < lines.Length ; i++ ) + { + ShaderBody += m_shaderIndentTabs + lines[ i ]; + } + } + + public static void ClearUndoHelper() + { + m_undoHelper.Clear(); + } + + public static bool CheckUndoNode( ParentNode node ) + { + if( node == null ) + return false; + if( m_undoHelper.ContainsKey( node.UniqueId ) ) + { + return false; + } + + m_undoHelper.Add( node.UniqueId , node ); + EditorUtility.SetDirty( node ); + return true; + } + + public static void MarkUndoAction() + { + SerializeHelperCounter = 2; + } + + public static bool SerializeFromUndo() + { + if( SerializeHelperCounter > 0 ) + { + SerializeHelperCounter--; + return true; + } + return false; + } + + public static int GetKeywordId( string keyword , TemplateSRPType type = TemplateSRPType.BiRP ) + { + switch( type ) + { + default: + case TemplateSRPType.BiRP: + { + if( AvailableKeywordsDict.Count != AvailableKeywords.Length ) + { + AvailableKeywordsDict.Clear(); + for( int i = 1 ; i < AvailableKeywords.Length ; i++ ) + { + AvailableKeywordsDict.Add( AvailableKeywords[ i ] , i ); + } + } + + if( AvailableKeywordsDict.ContainsKey( keyword ) ) + { + return AvailableKeywordsDict[ keyword ]; + } + } + break; + case TemplateSRPType.HDRP: + case TemplateSRPType.URP: + { + if( AvailableURPKeywordsDict.Count != AvailableURPKeywords.Length ) + { + AvailableURPKeywordsDict.Clear(); + for( int i = 1 ; i < AvailableURPKeywords.Length ; i++ ) + { + AvailableURPKeywordsDict.Add( AvailableURPKeywords[ i ] , i ); + } + } + + if( AvailableURPKeywordsDict.ContainsKey( keyword ) ) + { + return AvailableURPKeywordsDict[ keyword ]; + } + } + break; + } + + + return 0; + } + public static string ForceLFLineEnding( string body ) + { + body = body.Replace( "\r\n" , "\n" ); + body = body.Replace( "\r" , "\n" ); + return body; + } + + public static RenderTexture DummyRT + { + get + { + if( m_dummyPreviewRT == null ) + { + m_dummyPreviewRT = new RenderTexture( 128 , 128 , 0 , RenderTextureFormat.ARGB32 ); + RenderTexture temp = RenderTexture.active; + RenderTexture.active = m_dummyPreviewRT; + Graphics.Blit( Texture2D.blackTexture , m_dummyPreviewRT ); + RenderTexture.active = temp; + } + return m_dummyPreviewRT; + } + } + + static EditorGUIUtility obj = new EditorGUIUtility(); + static MethodInfo drawColorSwatchMI = null; + + public static void DrawColorSwatch( Rect position, Color color, bool showAlpha, bool hdr ) + { + if ( drawColorSwatchMI == null ) + { + MethodInfo[] methods = typeof( EditorGUIUtility ).GetMethods( BindingFlags.NonPublic | BindingFlags.Static ); + foreach ( MethodInfo mi in methods ) + { + if ( mi.Name == "DrawColorSwatch" && mi.GetParameters().Length == 4 ) + { + drawColorSwatchMI = mi; + break; + } + } + } + + if ( drawColorSwatchMI != null ) + { + drawColorSwatchMI.Invoke( obj, new object[] { position, color, showAlpha, hdr } ); + } + else + { + Debug.LogError( "[AmplifyShaderEditor] Method EditorGUIUtility.DrawColorSwatch(Rect, Color, bool, bool) not found. Please contact support." ); + } + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs.meta new file mode 100644 index 00000000..742c0782 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 23e0210afe076544ca92d761094a9119 +timeCreated: 1481126954 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs new file mode 100644 index 00000000..87cdbecf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs @@ -0,0 +1,118 @@ +using UnityEditor; +using UnityEngine; +using UnityEngine.Profiling; +using UnityEngine.Internal; +using System; + +namespace AmplifyShaderEditor +{ + public class UndoUtils + { + public static void RegisterUndoRedoCallback( Undo.UndoRedoCallback onUndoRedo ) + { + if ( Preferences.User.EnableUndo ) + { + Undo.undoRedoPerformed -= onUndoRedo; + Undo.undoRedoPerformed += onUndoRedo; + } + } + + public static void UnregisterUndoRedoCallback( Undo.UndoRedoCallback onUndoRedo ) + { + if ( Preferences.User.EnableUndo ) + { + Undo.undoRedoPerformed -= onUndoRedo; + } + } + + public static void RegisterCompleteObjectUndo( UnityEngine.Object objectToUndo, string name ) + { + if ( Preferences.User.EnableUndo ) + { + Profiler.BeginSample( "Undo_RegisterCompleteObjectUndo" ); + Undo.RegisterCompleteObjectUndo( objectToUndo, name ); + Profiler.EndSample(); + } + } + + public static void RegisterCreatedObjectUndo( UnityEngine.Object objectToUndo, string name ) + { + if ( Preferences.User.EnableUndo ) + { + Profiler.BeginSample( "Undo_RegisterCreatedObjectUndo" ); + Undo.RegisterCreatedObjectUndo( objectToUndo, name ); + Profiler.EndSample(); + } + } + + public static void ClearUndo( UnityEngine.Object obj ) + { + if ( Preferences.User.EnableUndo ) + { + Profiler.BeginSample( "Undo_ClearUndo" ); + Undo.ClearUndo( obj ); + Profiler.EndSample(); + } + } + + public static void RecordObject( UnityEngine.Object objectToUndo, string name ) + { + if ( Preferences.User.EnableUndo ) + { + Profiler.BeginSample( "Undo_RecordObject" ); + Undo.RecordObject( objectToUndo, name ); + Profiler.EndSample(); + } + } + + public static void RecordObjects( UnityEngine.Object[] objectsToUndo, string name ) + { + if ( Preferences.User.EnableUndo ) + { + Profiler.BeginSample( "Undo_RecordObjects" ); + Undo.RecordObjects( objectsToUndo, name ); + Profiler.EndSample(); + } + } + + public static void DestroyObjectImmediate( UnityEngine.Object objectToUndo ) + { + if ( Preferences.User.EnableUndo ) + { + Profiler.BeginSample( "Undo_DestroyObjectImmediate" ); + Undo.DestroyObjectImmediate( objectToUndo ); + Profiler.EndSample(); + } + } + + public static void PerformUndo() + { + if ( Preferences.User.EnableUndo ) + { + Profiler.BeginSample( "Undo_PerformUndo" ); + Undo.PerformUndo(); + Profiler.EndSample(); + } + } + + public static void PerformRedo() + { + if ( Preferences.User.EnableUndo ) + { + Profiler.BeginSample( "Undo_PerformRedo" ); + Undo.PerformRedo(); + Profiler.EndSample(); + } + } + + public static void IncrementCurrentGroup() + { + if ( Preferences.User.EnableUndo ) + { + Profiler.BeginSample( "Undo_IncrementCurrentGroup" ); + Undo.IncrementCurrentGroup(); + Profiler.EndSample(); + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs.meta new file mode 100644 index 00000000..ae5e6445 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 89dee7566d97f1847b9fe114e1c9a1a2 +timeCreated: 1489603190 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs new file mode 100644 index 00000000..9e92fe2d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs @@ -0,0 +1,91 @@ +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public class UpperLeftWidgetHelper + { + public int DrawWidget( ParentNode owner, int selectedIndex, GUIContent[] displayedOptions ) + { + if( owner.DropdownEditing ) + { + int newValue = owner.EditorGUIPopup( owner.DropdownRect, selectedIndex, displayedOptions, UIUtils.PropertyPopUp ); + if( newValue != selectedIndex ) + { + owner.DropdownEditing = false; + } + return newValue; + } + return selectedIndex; + } + + public int DrawWidget( ParentNode owner, int selectedIndex, string[] displayedOptions ) + { + if( owner.DropdownEditing ) + { + int newValue = owner.EditorGUIPopup( owner.DropdownRect, selectedIndex, displayedOptions, UIUtils.PropertyPopUp ); + if( newValue != selectedIndex ) + { + owner.DropdownEditing = false; + } + return newValue; + } + return selectedIndex; + } + + public int DrawWidget( ParentNode owner, int selectedIndex, string[] displayedOptions, int[] optionValues ) + { + if( owner.DropdownEditing ) + { + int newValue = owner.EditorGUIIntPopup( owner.DropdownRect, selectedIndex, displayedOptions, optionValues, UIUtils.PropertyPopUp ); + if( newValue != selectedIndex ) + { + owner.DropdownEditing = false; + } + return newValue; + } + return selectedIndex; + } + + // GC free version + public void DrawWidget( ref TEnum selectedIndex, ParentNode owner, Action callback ) where TEnum : struct + { + if( owner.DropdownEditing ) + { + Enum asEnumType = selectedIndex as Enum; + if( asEnumType != null ) + { + EditorGUI.BeginChangeCheck(); + selectedIndex = ( owner.EditorGUIEnumPopup( owner.DropdownRect, asEnumType, UIUtils.PropertyPopUp ) as TEnum? ).Value; + if( EditorGUI.EndChangeCheck() ) + { + owner.DropdownEditing = false; + if( callback != null ) + callback( owner ); + } + } + } + } + + /* + * USE THIS OVERRIDE IN CASE THE NODE DOESN'T HAVE PREVIEW + */ + //public override void AfterCommonInit() + //{ + // base.AfterCommonInit(); + // if( PaddingTitleLeft == 0 ) + // { + // PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + // if( PaddingTitleRight == 0 ) + // PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; + // } + //} + + + /* + * USE THE SOURCE CODE BELOW INTO THE NODE YOU WANT THE WIDGET TO SHOW + */ + //private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs.meta new file mode 100644 index 00000000..d0608815 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 32dbececad3a67a4fbde694ae50ce82c +timeCreated: 1504080603 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs new file mode 100644 index 00000000..42f432c8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs @@ -0,0 +1,257 @@ +#if UNITY_EDITOR +using System; +using System.Reflection; +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public static class WindowHelper + { + private class R_EditorWindow + { + private EditorWindow m_instance; + private System.Type m_type; + + public R_EditorWindow( EditorWindow instance ) + { + m_instance = instance; + m_type = instance.GetType(); + } + + public object Parent + { + get + { + var field = m_type.GetField( "m_Parent", BindingFlags.Instance | BindingFlags.NonPublic ); + return field.GetValue( m_instance ); + } + } + + public object Docked + { + get + { + var property = m_type.GetProperty( "docked", BindingFlags.Instance | BindingFlags.NonPublic ); + return property.GetValue( m_instance, null ); + } + } + } + + private class R_DockArea + { + private object m_instance; + private System.Type m_type; + + public R_DockArea( object instance ) + { + m_instance = instance; + m_type = instance.GetType(); + } + + public object Window + { + get + { + var property = m_type.GetProperty( "window", BindingFlags.Instance | BindingFlags.Public ); + return property.GetValue( m_instance, null ); + } + } + + public object ActualView + { + get + { + var field = m_type.GetField( "m_ActualView", BindingFlags.Instance | BindingFlags.NonPublic ); + return field.GetValue( m_instance ); + } + } + + public object OriginalDragSource + { + set + { + var field = m_type.GetField( "s_OriginalDragSource", BindingFlags.Static | BindingFlags.NonPublic ); + field.SetValue( null, value ); + } + } + + + public void AddTab( EditorWindow pane ) + { + var method = m_type.GetMethod( "AddTab", BindingFlags.Instance | BindingFlags.Public, null, new System.Type[] { typeof( EditorWindow ), typeof( bool ) }, null ); + if( method != null ) + method.Invoke( m_instance, new object[] { pane, true } ); + } + + public void RemoveTab( EditorWindow pane ) + { + if( !pane.maximized ) + { + var method = m_type.GetMethod( "RemoveTab", BindingFlags.Instance | BindingFlags.Public, null, new System.Type[] { typeof( EditorWindow ) }, null ); + if( method != null ) + method.Invoke( m_instance, new object[] { pane } ); + } + } + } + + private class R_ContainerWindow + { + private object m_instance; + private System.Type m_type; + + public R_ContainerWindow( object instance ) + { + m_instance = instance; + m_type = instance.GetType(); + } + + public object RootSplitView + { + get + { + var property = m_type.GetProperty( "rootSplitView", BindingFlags.Instance | BindingFlags.Public ); + return property.GetValue( m_instance, null ); + } + } + + public object RootView + { + get + { + var property = m_type.GetProperty( "rootView", BindingFlags.Instance | BindingFlags.Public ); + return property.GetValue( m_instance, null ); + } + } + + public object WindowPtr + { + get + { + var all = m_type.GetNestedTypes(); + foreach( var item in all ) + { + Debug.Log( item.Name ); + } + var property = m_type.GetField( "m_WindowPtr", BindingFlags.Instance | BindingFlags.NonPublic ); + return property.GetValue( m_instance ); + } + } + } + + private class R_SplitView + { + private object m_instance; + private System.Type m_type; + + public R_SplitView( object instance ) + { + m_instance = instance; + m_type = instance.GetType(); + } + + public object DragOver( EditorWindow child, Vector2 screenPoint ) + { + var method = m_type.GetMethod( "DragOver", BindingFlags.Instance | BindingFlags.Public ); + return method.Invoke( m_instance, new object[] { child, screenPoint } ); + } + + public void PerformDrop( EditorWindow child, object dropInfo, Vector2 screenPoint ) + { + var method = m_type.GetMethod( "PerformDrop", BindingFlags.Instance | BindingFlags.Public ); + method.Invoke( m_instance, new object[] { child, dropInfo, screenPoint } ); + } + } + + public enum DockPosition + { + Left, + Top, + Right, + Bottom + } + + public static bool IsDocked( this EditorWindow wnd ) + { + #if UNITY_2020_2_OR_NEWER + return wnd.docked; + #else + var parent = new R_EditorWindow( wnd ); + return (bool)parent.Docked; + #endif + } + + public static void Undock( this EditorWindow wnd ) + { + var parent = new R_EditorWindow( wnd ); + var dockArea = new R_DockArea( parent.Parent ); + dockArea.RemoveTab( wnd ); + wnd.Show( true ); + } + + public static void RemoveTab( this EditorWindow wnd ) + { + var parent = new R_EditorWindow( wnd ); + var dockArea = new R_DockArea( parent.Parent ); + dockArea.RemoveTab( wnd ); + } + + /// + /// Docks the second window to the first window at the given position + /// + public static void Dock( this EditorWindow wnd, EditorWindow other, DockPosition position ) + { + var mousePosition = GetFakeMousePosition( wnd, position ); + + var parent = new R_EditorWindow( wnd ); + var child = new R_EditorWindow( other ); + var dockArea = new R_DockArea( parent.Parent ); + var containerWindow = new R_ContainerWindow( dockArea.Window ); + var splitView = new R_SplitView( containerWindow.RootSplitView ); + var dropInfo = splitView.DragOver( other, mousePosition ); + dockArea.OriginalDragSource = child.Parent; + splitView.PerformDrop( other, dropInfo, mousePosition ); + } + + + /// + /// Adds the the second window as a tab at the end of the first window tab list + /// + /// + /// + public static void AddTab( this EditorWindow existingWindow, EditorWindow newWindow ) + { + var parent = new R_EditorWindow( existingWindow ); + var child = new R_EditorWindow( newWindow ); + var dockArea = new R_DockArea( parent.Parent ); + dockArea.OriginalDragSource = child.Parent; + dockArea.AddTab( newWindow ); + } + + private static Vector2 GetFakeMousePosition( EditorWindow wnd, DockPosition position ) + { + Vector2 mousePosition = Vector2.zero; + + // The 20 is required to make the docking work. + // Smaller values might not work when faking the mouse position. + switch ( position ) + { + case DockPosition.Left: + mousePosition = new Vector2( 20, wnd.position.size.y / 2 ); + break; + case DockPosition.Top: + mousePosition = new Vector2( wnd.position.size.x / 2, 20 ); + break; + case DockPosition.Right: + mousePosition = new Vector2( wnd.position.size.x - 20, wnd.position.size.y / 2 ); + break; + case DockPosition.Bottom: + mousePosition = new Vector2( wnd.position.size.x / 2, wnd.position.size.y - 20 ); + break; + } + + return GUIUtility.GUIToScreenPoint( mousePosition ); + } + } +} +#endif diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs.meta new file mode 100644 index 00000000..1252a187 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ad6ef05d39dc39e42b8bfe0bdb826b7a +timeCreated: 1494336778 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs new file mode 100644 index 00000000..f655a1bd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs @@ -0,0 +1,150 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +#if UNITY_EDITOR_WIN + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; + +namespace AmplifyShaderEditor +{ + public class WindowsUtil + { + public const int GWL_STYLE = -16; //hex constant for style changing + public const int WS_BORDER = 0x00800000; //window with border + public const int WS_CAPTION = 0x00C00000; //window with a title bar with border + public const int WS_SYSMENU = 0x00080000; //window with no borders etc. + public const int WS_MAXIMIZE = 0x01000000; + public const int WS_MAXIMIZEBOX = 0x00010000; + public const int WS_MINIMIZE = 0x20000000; + public const int WS_MINIMIZEBOX = 0x00020000; + public const int WS_SIZEBOX = 0x00040000; + public const int WS_VISIBLE = 0x10000000; + public const int WS_TABSTOP = 0x00010000; + public const int WS_CLIPCHILDREN = 0x02000000; + public const int WS_CLIPSIBLINGS = 0x04000000; + + [DllImport( "user32.dll", EntryPoint = "SetWindowPos" )] + public static extern bool SetWindowPos( System.IntPtr hwnd, int hWndInsertAfter, int x, int Y, int cx, int cy, int wFlags ); + + public delegate bool EnumWindowsProc( System.IntPtr hWnd, System.IntPtr lParam ); + + [DllImport( "user32.dll", CharSet = CharSet.Auto, ExactSpelling = true )] + public static extern IntPtr GetDesktopWindow(); + + [DllImport( "user32.dll" )] + public static extern int SetWindowLong( IntPtr hWnd, int nIndex, int dwNewLong ); + + [DllImport( "user32.dll" )] + public static extern int GetWindowLong( IntPtr hWnd, int nIndex ); + + [DllImport( "user32.dll", ExactSpelling = true, SetLastError = true )] + internal static extern int MapWindowPoints( IntPtr hWndFrom, IntPtr hWndTo, [In, Out] ref Rect rect, [MarshalAs( UnmanagedType.U4 )] int cPoints ); + + [DllImport( "user32.dll" )] + public static extern bool EnumWindows( EnumWindowsProc enumProc, System.IntPtr lParam ); + + [DllImport( "user32" )] + [return: MarshalAs( UnmanagedType.Bool )] + public static extern bool EnumChildWindows( IntPtr window, EnumWindowProc callback, IntPtr lParam ); + + public delegate bool EnumWindowProc( IntPtr hwnd, IntPtr lParam ); + + [DllImport( "user32.dll", SetLastError = true )] + public static extern bool MoveWindow( IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint ); + + [DllImport( "user32.dll", CharSet = CharSet.Auto, SetLastError = true )] + public static extern int GetWindowThreadProcessId( System.IntPtr handle, out int processId ); + + [DllImport( "user32.dll", SetLastError = true )] + public static extern IntPtr FindWindowEx( string lpClassName, string lpWindowName ); + + // Find window by Caption only. Note you must pass IntPtr.Zero as the first parameter. + [DllImport( "user32.dll", EntryPoint = "FindWindow", SetLastError = true )] + public static extern IntPtr FindWindowByCaptionEx( IntPtr ZeroOnly, string lpWindowName ); + + [DllImport( "user32.dll", SetLastError = true, CharSet = CharSet.Auto )] + public static extern int GetClassName( IntPtr hWnd, StringBuilder lpClassName, int nMaxCount ); + + [DllImport( "user32.dll" )] + public static extern int GetWindowText( System.IntPtr hWnd, StringBuilder text, int nMaxCount ); + + [DllImport( "user32.dll" )] + public static extern int GetWindowTextLength( System.IntPtr hWnd ); + + [DllImport( "user32.dll" )] + public static extern IntPtr FindWindowEx( IntPtr parentWindow, IntPtr previousChildWindow, string windowClass, string windowTitle ); + + [DllImport( "user32.dll" )] + public static extern IntPtr GetActiveWindow(); + + [DllImport( "user32.dll" )] + public static extern bool GetWindowRect( System.IntPtr hwnd, ref Rect rectangle ); + + static public IntPtr[] GetProcessWindows( int processId ) + { + List output = new List(); + IntPtr winPtr = IntPtr.Zero; + do + { + winPtr = FindWindowEx( IntPtr.Zero, winPtr, null, null ); + int id; + GetWindowThreadProcessId( winPtr, out id ); + if ( id == processId ) + output.Add( winPtr ); + } while ( winPtr != IntPtr.Zero ); + + return output.ToArray(); + } + + public struct Rect + { + public int Left { get; set; } + public int Top { get; set; } + public int Right { get; set; } + public int Bottom { get; set; } + public int Width { get { return Right - Left; } } + public int Height { get { return Bottom - Top; } } + + public override string ToString() + { + return "(l: " + Left + ", r: " + Right + ", t: " + Top + ", b: " + Bottom + ")"; + } + } + + public static bool GetProcessRect( System.Diagnostics.Process process, ref Rect rect ) + { + IntPtr[] winPtrs = WindowsUtil.GetProcessWindows( process.Id ); + + for ( int i = 0; i < winPtrs.Length; i++ ) + { + bool gotRect = WindowsUtil.GetWindowRect( winPtrs[ i ], ref rect ); + if ( gotRect && ( rect.Left != 0 && rect.Top != 0 ) ) + return true; + } + return false; + } + + public static void SetWindowPosition( int x, int y, int sizeX = 0, int sizeY = 0 ) + { + System.Diagnostics.Process process = System.Diagnostics.Process.GetCurrentProcess(); + process.Refresh(); + + EnumWindows( delegate ( System.IntPtr wnd, System.IntPtr param ) + { + int id; + GetWindowThreadProcessId( wnd, out id ); + if ( id == process.Id ) + { + SetWindowPos( wnd, 0, x, y, sizeX, sizeY, sizeX * sizeY == 0 ? 1 : 0 ); + return false; + } + + return true; + }, System.IntPtr.Zero ); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs.meta new file mode 100644 index 00000000..bc11aaac --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 84d9a18b60b810c4c894886264a89da0 +timeCreated: 1559138384 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version.meta new file mode 100644 index 00000000..c5ba7b81 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6072f991722ef6c44b167cf204724a52 +folderAsset: yes +timeCreated: 1481126944 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/About.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/About.cs new file mode 100644 index 00000000..a1477515 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/About.cs @@ -0,0 +1,66 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + public class About : EditorWindow + { + private const string AboutImageGUID = "8aba6bb20faf8824d9d81946542f1ce1"; + private Vector2 m_scrollPosition = Vector2.zero; + private Texture2D m_aboutImage; + + [MenuItem( "Window/Amplify Shader Editor/About...", false, 2001 )] + static void Init() + { + About window = (About)GetWindow( typeof( About ), true, "About Amplify Shader Editor" ); + window.minSize = new Vector2( 502, 290 ); + window.maxSize = new Vector2( 502, 290 ); + window.Show(); + } + + [MenuItem( "Window/Amplify Shader Editor/Manual", false, 2000 )] + static void OpenManual() + { + Application.OpenURL( "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Manual" ); + } + + private void OnEnable() + { + m_aboutImage = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( AboutImageGUID ) ); + } + + public void OnGUI() + { + m_scrollPosition = GUILayout.BeginScrollView( m_scrollPosition ); + + GUILayout.BeginVertical(); + + GUILayout.Space( 10 ); + + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.Box( m_aboutImage, GUIStyle.none ); + + if( Event.current.type == EventType.MouseUp && GUILayoutUtility.GetLastRect().Contains( Event.current.mousePosition ) ) + Application.OpenURL( "http://www.amplify.pt" ); + + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + + GUIStyle labelStyle = new GUIStyle( EditorStyles.label ); + labelStyle.alignment = TextAnchor.MiddleCenter; + labelStyle.wordWrap = true; + + GUILayout.Label( "\nAmplify Shader Editor " + VersionInfo.StaticToString(), labelStyle, GUILayout.ExpandWidth( true ) ); + + GUILayout.Label( "\nCopyright (c) Amplify Creations, Lda. All rights reserved.\n", labelStyle, GUILayout.ExpandWidth( true ) ); + + GUILayout.EndVertical(); + + GUILayout.EndScrollView(); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/About.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/About.cs.meta new file mode 100644 index 00000000..c494cf7f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/About.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: b52649079e4f9ef488724bd3c72449ed +timeCreated: 1481126958 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Version/About.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs new file mode 100644 index 00000000..6eb7e9ea --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs @@ -0,0 +1,24 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; + +namespace AmplifyShaderEditor +{ + [Serializable] + public class VersionInfo + { + public const byte Major = 1; + public const byte Minor = 9; + public const byte Release = 8; + public static byte Revision = 1; + + public static string StaticToString() + { + return string.Format( "{0}.{1}.{2}", Major, Minor, Release ) + ( Revision > 0 ? "." + Revision.ToString() : "" ); + } + + public static int FullNumber { get { return Major * 10000 + Minor * 1000 + Release * 100 + Revision; } } + public static string FullLabel { get { return "Version=" + FullNumber; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs.meta new file mode 100644 index 00000000..ed32abd0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 581602482686da34180d35b169cd357a +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires.meta new file mode 100644 index 00000000..04d01cf2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 81b7f9ca313139248a5500a6da3c8a12 +folderAsset: yes +timeCreated: 1481126944 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs new file mode 100644 index 00000000..ab8011ff --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs @@ -0,0 +1,156 @@ +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + public class GLDraw + { + /* + * Clipping code: http://forum.unity3d.com/threads/17066-How-to-draw-a-GUI-2D-quot-line-quot?p=230386#post230386 + * Thick line drawing code: http://unifycommunity.com/wiki/index.php?title=VectorLine + */ + public static Material LineMaterial = null; + public static bool MultiLine = false; + private static Shader LineShader = null; + private static Rect BoundBox = new Rect(); + private static Vector3[] Allv3Points = new Vector3[] { }; + private static Vector2[] AllPerpendiculars = new Vector2[] { }; + private static Color[] AllColors = new Color[] { }; + private static Vector2 StartPt = Vector2.zero; + private static Vector2 EndPt = Vector2.zero; + + private static Vector3 Up = new Vector3( 0, 1, 0 ); + private static Vector3 Zero = new Vector3( 0, 0, 0 ); + + private static Vector2 Aux1Vec2 = Vector2.zero; + + private static int HigherBoundArray = 0; + + public static void CreateMaterial() + { + if( (object)LineMaterial != null && (object)LineShader != null ) + return; + + LineShader = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "50fc796413bac8b40aff70fb5a886273" ) ); + LineMaterial = new Material( LineShader ); + + LineMaterial.hideFlags = HideFlags.HideAndDontSave; + } + + public static void DrawCurve( Vector3[] allPoints, Vector2[] allNormals, Color[] allColors, int pointCount ) + { + CreateMaterial(); + LineMaterial.SetPass( ( MultiLine ? 1 : 0 ) ); + + GL.Begin( GL.TRIANGLE_STRIP ); + for( int i = 0; i < pointCount; i++ ) + { + GL.Color( allColors[ i ] ); + GL.TexCoord( Zero ); + GL.Vertex3( allPoints[ i ].x - allNormals[ i ].x, allPoints[ i ].y - allNormals[ i ].y, 0 ); + GL.TexCoord( Up ); + GL.Vertex3( allPoints[ i ].x + allNormals[ i ].x, allPoints[ i ].y + allNormals[ i ].y, 0 ); + } + GL.End(); + + } + + public static Rect DrawBezier( Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color color, float width, int type = 1 ) + { + int segments = Mathf.FloorToInt( ( start - end ).magnitude / 20 ) * 3; // Three segments per distance of 20 + return DrawBezier( start, startTangent, end, endTangent, color, width, segments, type ); + } + + public static Rect DrawBezier( Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color color, float width, int segments, int type = 1 ) + { + return DrawBezier( start, startTangent, end, endTangent, color, color, width, segments, type ); + } + + public static Rect DrawBezier( Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color startColor, Color endColor, float width, int segments, int type = 1 ) + { + int pointsCount = segments + 1; + int linesCount = segments; + + HigherBoundArray = HigherBoundArray > pointsCount ? HigherBoundArray : pointsCount; + + Allv3Points = Handles.MakeBezierPoints( start, end, startTangent, endTangent, pointsCount ); + if( AllColors.Length < HigherBoundArray ) + { + AllColors = new Color[ HigherBoundArray ]; + AllPerpendiculars = new Vector2[ HigherBoundArray ]; + } + + startColor.a = ( type * 0.25f ); + endColor.a = ( type * 0.25f ); + + float minX = Allv3Points[ 0 ].x; + float minY = Allv3Points[ 0 ].y; + float maxX = Allv3Points[ 0 ].x; + float maxY = Allv3Points[ 0 ].y; + + float amount = 1 / (float)linesCount; + for( int i = 0; i < pointsCount; i++ ) + { + if( i == 0 ) + { + AllColors[ 0 ] = startColor; + StartPt.Set( startTangent.y, start.x ); + EndPt.Set( start.y, startTangent.x ); + } + else if( i == pointsCount - 1 ) + { + AllColors[ pointsCount - 1 ] = endColor; + StartPt.Set( end.y, endTangent.x ); + EndPt.Set( endTangent.y, end.x ); + } + else + { + AllColors[ i ] = Color.LerpUnclamped( startColor, endColor, amount * i ); + + minX = ( Allv3Points[ i ].x < minX ) ? Allv3Points[ i ].x : minX; + minY = ( Allv3Points[ i ].y < minY ) ? Allv3Points[ i ].y : minY; + maxX = ( Allv3Points[ i ].x > maxX ) ? Allv3Points[ i ].x : maxX; + maxY = ( Allv3Points[ i ].y > maxY ) ? Allv3Points[ i ].y : maxY; + StartPt.Set( Allv3Points[ i + 1 ].y, Allv3Points[ i - 1 ].x ); + EndPt.Set( Allv3Points[ i - 1 ].y, Allv3Points[ i + 1 ].x ); + } + Aux1Vec2.Set( StartPt.x - EndPt.x, StartPt.y - EndPt.y ); + FastNormalized( ref Aux1Vec2 ); + //aux1Vec2.FastNormalized(); + Aux1Vec2.Set( Aux1Vec2.x * width, Aux1Vec2.y * width ); + AllPerpendiculars[ i ] = Aux1Vec2; + } + + BoundBox.Set( minX, minY, ( maxX - minX ), ( maxY - minY ) ); + + DrawCurve( Allv3Points, AllPerpendiculars, AllColors, pointsCount ); + return BoundBox; + } + + private static void FastNormalized( ref Vector2 v ) + { + float len = Mathf.Sqrt( v.x * v.x + v.y * v.y ); + v.Set( v.x / len, v.y / len ); + } + + public static void Destroy() + { + GameObject.DestroyImmediate( LineMaterial ); + LineMaterial = null; + + Resources.UnloadAsset( LineShader ); + LineShader = null; + } + } + + //public static class VectorEx + //{ + // public static void FastNormalized( this Vector2 v ) + // { + // float len = Mathf.Sqrt( v.x * v.x + v.y * v.y ); + // v.Set( v.x / len, v.y / len ); + // } + //} +} + diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs.meta new file mode 100644 index 00000000..48c63db3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7647d2525992b7748a587740fd596977 +timeCreated: 1481126956 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs new file mode 100644 index 00000000..bbbe8a29 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs @@ -0,0 +1,1493 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; +using UnityEditor; + +namespace AmplifyShaderEditor +{ + [Serializable] + public sealed class InputPort : WirePort + { + private const string InputDefaultNameStr = "Input"; + [SerializeField] + private int m_externalNodeLink = -1; + + [SerializeField] + private int m_externalPortLink = -1; + + [SerializeField] + private string m_externalLinkId = string.Empty; + + [SerializeField] + private bool m_typeLocked; + + [SerializeField] + private string m_internalData = string.Empty; + + [SerializeField] + private string m_internalDataWrapper = string.Empty; + + [SerializeField] + private string m_dataName = string.Empty; + + [SerializeField] + private string m_internalDataPropertyLabel = string.Empty; + + // this will only is important on master node + [SerializeField] + private MasterNodePortCategory m_category = MasterNodePortCategory.Fragment; + + [SerializeField] + private PortGenType m_genType; + + private string m_propertyName = string.Empty; + private int m_cachedPropertyId = -1; + + private int m_cachedIntShaderID = -1; + private int m_cachedFloatShaderID = -1; + private int m_cachedVectorShaderID = -1; + private int m_cachedColorShaderID = -1; + private int m_cached2DShaderID = -1; + private int m_cachedDefaultTexShaderID = -1; + + [SerializeField] + private bool m_drawInternalData = false; + + //[SerializeField] + //private RenderTexture m_inputPreview = null; + //[SerializeField] + private RenderTexture m_inputPreviewTexture = null; + private Material m_inputPreviewMaterial = null; + private Shader m_inputPreviewShader = null; + + [SerializeField] + private int m_previewInternalInt = 0; + [SerializeField] + private float m_previewInternalFloat = 0; + [SerializeField] + private Vector2 m_previewInternalVec2 = Vector2.zero; + [SerializeField] + private Vector3 m_previewInternalVec3 = Vector3.zero; + [SerializeField] + private Vector4 m_previewInternalVec4 = Vector4.zero; + [SerializeField] + private Color m_previewInternalColor = Color.clear; + [SerializeField] + private Matrix4x4 m_previewInternalMatrix4x4 = Matrix4x4.identity; + + private int m_propertyNameInt = 0; + private ParentNode m_node = null; + + public InputPort() : base( -1, -1, WirePortDataType.FLOAT, string.Empty ) { m_typeLocked = true; } + public InputPort( int nodeId, int portId, WirePortDataType dataType, string name, bool typeLocked, int orderId = -1, MasterNodePortCategory category = MasterNodePortCategory.Fragment, PortGenType genType = PortGenType.NonCustomLighting ) : base( nodeId, portId, dataType, name, orderId ) + { + m_dataName = name; + m_internalDataPropertyLabel = ( string.IsNullOrEmpty( name ) || name.Equals( Constants.EmptyPortValue ) ) ? InputDefaultNameStr : name; + m_typeLocked = typeLocked; + m_category = category; + m_genType = genType; + } + + public InputPort( int nodeId, int portId, WirePortDataType dataType, string name, string dataName, bool typeLocked, int orderId = -1, MasterNodePortCategory category = MasterNodePortCategory.Fragment, PortGenType genType = PortGenType.NonCustomLighting ) : base( nodeId, portId, dataType, name, orderId ) + { + m_dataName = dataName; + m_internalDataPropertyLabel = ( string.IsNullOrEmpty( name ) || name.Equals( Constants.EmptyPortValue ) ) ? InputDefaultNameStr : name; + m_typeLocked = typeLocked; + m_category = category; + m_genType = genType; + } + + public void SetExternalLink( int nodeId, int portId ) + { + m_externalNodeLink = nodeId; + m_externalPortLink = portId; + } + + public override bool CheckValidType( WirePortDataType dataType ) + { + if( m_typeLocked ) + return ( dataType == m_dataType ); + + return base.CheckValidType( dataType ); + } + + public override void FullDeleteConnections() + { + UIUtils.DeleteConnection( true, m_nodeId, m_portId, true, true ); + } + + public override void NotifyExternalRefencesOnChange() + { + for( int i = 0; i < m_externalReferences.Count; i++ ) + { + ParentNode node = UIUtils.GetNode( m_externalReferences[ i ].NodeId ); + if( node ) + { + OutputPort port = node.GetOutputPortByUniqueId( m_externalReferences[ i ].PortId ); + port.UpdateInfoOnExternalConn( m_nodeId, m_portId, m_dataType ); + node.OnConnectedInputNodeChanges( m_externalReferences[ i ].PortId, m_nodeId, m_portId, m_name, m_dataType ); + } + } + } + + public void UpdatePreviewInternalData() + { + switch( m_dataType ) + { + case WirePortDataType.INT: m_previewInternalInt = IntInternalData; break; + case WirePortDataType.FLOAT: m_previewInternalFloat = FloatInternalData; break; + case WirePortDataType.FLOAT2: m_previewInternalVec2 = Vector2InternalData; break; + case WirePortDataType.FLOAT3: m_previewInternalVec3 = Vector3InternalData; break; + case WirePortDataType.FLOAT4: m_previewInternalVec4 = Vector4InternalData; break; + case WirePortDataType.COLOR: m_previewInternalColor = ColorInternalData; break; + } + } + + void UpdateVariablesFromInternalData() + { + string[] data = String.IsNullOrEmpty( m_internalData ) ? null : m_internalData.Split( IOUtils.VECTOR_SEPARATOR ); + bool reset = ( data == null || data.Length == 0 ); + m_internalDataUpdated = false; + try + { + switch( m_dataType ) + { + case WirePortDataType.OBJECT:break; + case WirePortDataType.FLOAT: m_previewInternalFloat = reset ? 0 : Convert.ToSingle( data[ 0 ] ); break; + case WirePortDataType.INT: + { + if( reset ) + { + m_previewInternalInt = 0; + } + else + { + if( data[ 0 ].Contains( "." ) ) + { + m_previewInternalInt = (int)Convert.ToSingle( data[ 0 ] ); + } + else + { + m_previewInternalInt = Convert.ToInt32( data[ 0 ] ); + } + } + } + break; + case WirePortDataType.FLOAT2: + { + if( reset ) + { + m_previewInternalVec2 = Vector2.zero; + } + else + { + if( data.Length < 2 ) + { + m_previewInternalVec2.x = Convert.ToSingle( data[ 0 ] ); + m_previewInternalVec2.y = 0; + } + else + { + m_previewInternalVec2.x = Convert.ToSingle( data[ 0 ] ); + m_previewInternalVec2.y = Convert.ToSingle( data[ 1 ] ); + } + } + } + break; + case WirePortDataType.FLOAT3: + { + if( reset ) + { + m_previewInternalVec3 = Vector3.zero; + } + else + { + int count = Mathf.Min( data.Length, 3 ); + for( int i = 0; i < count; i++ ) + { + m_previewInternalVec3[ i ] = Convert.ToSingle( data[ i ] ); + } + if( count < 3 ) + { + for( int i = count; i < 3; i++ ) + { + m_previewInternalVec3[ i ] = 0; + } + } + } + + } + break; + case WirePortDataType.FLOAT4: + { + if( reset ) + { + m_previewInternalVec4 = Vector4.zero; + } + else + { + int count = Mathf.Min( data.Length, 4 ); + for( int i = 0; i < count; i++ ) + { + m_previewInternalVec4[ i ] = Convert.ToSingle( data[ i ] ); + } + if( count < 4 ) + { + for( int i = count; i < 4; i++ ) + { + m_previewInternalVec4[ i ] = 0; + } + } + } + } + break; + case WirePortDataType.COLOR: + { + if( reset ) + { + m_previewInternalColor = Color.black; + } + else + { + int count = Mathf.Min( data.Length, 4 ); + for( int i = 0; i < count; i++ ) + { + m_previewInternalColor[ i ] = Convert.ToSingle( data[ i ] ); + } + if( count < 4 ) + { + for( int i = count; i < 4; i++ ) + { + m_previewInternalColor[ i ] = 0; + } + } + } + } + break; + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + if( reset ) + { + m_previewInternalMatrix4x4 = Matrix4x4.identity; + } + else + { + int count = Mathf.Min( data.Length, 16 ); + int overallIdx = 0; + for( int i = 0; i < 4; i++ ) + { + for( int j = 0; j < 4; j++ ) + { + if( overallIdx < count ) + { + m_previewInternalMatrix4x4[ i, j ] = Convert.ToSingle( data[ overallIdx ] ); + } + else + { + m_previewInternalMatrix4x4[ i, j ] = ( ( i == j ) ? 1 : 0 ); + } + overallIdx++; + } + } + } + } + break; + } + } + catch( Exception e ) + { + if( DebugConsoleWindow.DeveloperMode ) + Debug.LogException( e ); + } + } + + void UpdateInternalDataFromVariables( bool forceDecimal = false ) + { + switch( m_dataType ) + { + case WirePortDataType.OBJECT:break; + case WirePortDataType.FLOAT: + { + if( forceDecimal && m_previewInternalFloat == (int)m_previewInternalFloat ) + m_internalData = m_previewInternalFloat.ToString("0.0##############"); // to make sure integer values like 0 or 1 are generated as 0.0 and 1.0 + else + m_internalData = m_previewInternalFloat.ToString(); + m_internalDataWrapper = string.Empty; + } + break; + case WirePortDataType.INT: + { + m_internalData = m_previewInternalInt.ToString(); + m_internalDataWrapper = string.Empty; + } + break; + case WirePortDataType.FLOAT2: + { + m_internalData = m_previewInternalVec2.x.ToString() + IOUtils.VECTOR_SEPARATOR + + m_previewInternalVec2.y.ToString(); + m_internalDataWrapper = "float2( {0} )"; + } + break; + case WirePortDataType.FLOAT3: + { + m_internalData = m_previewInternalVec3.x.ToString() + IOUtils.VECTOR_SEPARATOR + + m_previewInternalVec3.y.ToString() + IOUtils.VECTOR_SEPARATOR + + m_previewInternalVec3.z.ToString(); + m_internalDataWrapper = "float3( {0} )"; + } + break; + case WirePortDataType.FLOAT4: + { + m_internalData = m_previewInternalVec4.x.ToString() + IOUtils.VECTOR_SEPARATOR + + m_previewInternalVec4.y.ToString() + IOUtils.VECTOR_SEPARATOR + + m_previewInternalVec4.z.ToString() + IOUtils.VECTOR_SEPARATOR + + m_previewInternalVec4.w.ToString(); + + m_internalDataWrapper = "float4( {0} )"; + } + break; + case WirePortDataType.COLOR: + { + m_internalData = m_previewInternalColor.r.ToString() + IOUtils.VECTOR_SEPARATOR + + m_previewInternalColor.g.ToString() + IOUtils.VECTOR_SEPARATOR + + m_previewInternalColor.b.ToString() + IOUtils.VECTOR_SEPARATOR + + m_previewInternalColor.a.ToString(); + + m_internalDataWrapper = "float4( {0} )"; + } + break; + case WirePortDataType.FLOAT3x3: + { + m_internalData = m_previewInternalMatrix4x4[ 0, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 0, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 0, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + + m_previewInternalMatrix4x4[ 1, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 1, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 1, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + + m_previewInternalMatrix4x4[ 2, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 2, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 2, 2 ].ToString(); + + m_internalDataWrapper = "float3x3( {0} )"; + + } + break; + case WirePortDataType.FLOAT4x4: + { + m_internalData = m_previewInternalMatrix4x4[ 0, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 0, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 0, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 0, 3 ].ToString() + IOUtils.VECTOR_SEPARATOR + + m_previewInternalMatrix4x4[ 1, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 1, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 1, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 1, 3 ].ToString() + IOUtils.VECTOR_SEPARATOR + + m_previewInternalMatrix4x4[ 2, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 2, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 2, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 2, 3 ].ToString() + IOUtils.VECTOR_SEPARATOR + + m_previewInternalMatrix4x4[ 3, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 3, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 3, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 3, 3 ].ToString(); + + m_internalDataWrapper = "float4x4( {0} )"; + } + break; + } + } + + //This gets the 3x3 matrix inside of the 4x4 + private string Matrix3x3WrappedData() + { + string tempInternal = string.Empty; + + string[] data = String.IsNullOrEmpty( m_internalData ) ? null : m_internalData.Split( IOUtils.VECTOR_SEPARATOR ); + if( data.Length == 16 ) + { + int o = 0; + for( int i = 0; i < 8; i++ ) + { + if( i == 3 || i == 6 ) + o++; + tempInternal += data[ i + o ] + IOUtils.VECTOR_SEPARATOR; + } + + tempInternal += data[ 10 ]; + + return String.Format( m_internalDataWrapper, tempInternal ); + } + else + { + return String.Format( m_internalDataWrapper, m_internalData ); + } + } + + private string SamplerWrappedData( ref MasterNodeDataCollector dataCollector ) + { + m_internalData = "_Sampler" + PortId + UIUtils.GetNode( m_nodeId ).OutputId; + + dataCollector.AddToUniforms( m_nodeId, GeneratorUtils.GetPropertyDeclaraction( m_internalData, TextureType.Texture2D, ";" ) ); + + return m_internalData; + } + + //TODO: Replace GenerateShaderForOutput(...) calls to this one + // This is a new similar method to GenerateShaderForOutput(...) which always autocasts + public string GeneratePortInstructions( ref MasterNodeDataCollector dataCollector ) + { + InputPort linkPort = ExternalLink; + if( linkPort != null ) + { + return linkPort.GeneratePortInstructions( ref dataCollector ); + } + + string result = string.Empty; + if( m_externalReferences.Count > 0 && !m_locked ) + { + result = UIUtils.GetNode( m_externalReferences[ 0 ].NodeId ).GenerateShaderForOutput( m_externalReferences[ 0 ].PortId, ref dataCollector, false ); + if( m_externalReferences[ 0 ].DataType != m_dataType ) + { + result = UIUtils.CastPortType( ref dataCollector, UIUtils.GetNode( m_nodeId ).CurrentPrecisionType, null, m_externalReferences[ 0 ].DataType, m_dataType, result ); + } + } + else + { + UpdateInternalDataFromVariables( true ); + if( DataType == WirePortDataType.FLOAT3x3 ) + result = Matrix3x3WrappedData(); + else if( DataType == WirePortDataType.SAMPLER2D ) + result = SamplerWrappedData( ref dataCollector ); + else + result = !String.IsNullOrEmpty( m_internalDataWrapper ) ? String.Format( m_internalDataWrapper, m_internalData ) : m_internalData; + } + return result; + } + + public string GenerateShaderForOutput( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) + { + InputPort linkPort = ExternalLink; + if( linkPort != null ) + { + return linkPort.GenerateShaderForOutput( ref dataCollector, ignoreLocalVar ); + } + + string result = string.Empty; + if( m_externalReferences.Count > 0 && !m_locked ) + { + result = UIUtils.GetNode( m_externalReferences[ 0 ].NodeId ).GenerateShaderForOutput( m_externalReferences[ 0 ].PortId, ref dataCollector, ignoreLocalVar ); + } + else + { + UpdateInternalDataFromVariables( true ); + if( !String.IsNullOrEmpty( m_internalDataWrapper ) ) + { + if( DataType == WirePortDataType.FLOAT3x3 ) + result = Matrix3x3WrappedData(); + else + result = String.Format( m_internalDataWrapper, m_internalData ); + } + else + { + result = m_internalData; + } + } + return result; + } + + public string GenerateShaderForOutput( ref MasterNodeDataCollector dataCollector, WirePortDataType inputPortType, bool ignoreLocalVar, bool autoCast = false ) + { + InputPort linkPort = ExternalLink; + if( linkPort != null ) + { + return linkPort.GenerateShaderForOutput( ref dataCollector, inputPortType, ignoreLocalVar, autoCast ); + } + + string result = string.Empty; + if( m_externalReferences.Count > 0 && !m_locked ) + { + result = UIUtils.GetNode( m_externalReferences[ 0 ].NodeId ).GenerateShaderForOutput( m_externalReferences[ 0 ].PortId, ref dataCollector, ignoreLocalVar ); + if( autoCast && m_externalReferences[ 0 ].DataType != inputPortType ) + { + result = UIUtils.CastPortType( ref dataCollector, UIUtils.GetNode( m_nodeId ).CurrentPrecisionType, null, m_externalReferences[ 0 ].DataType, inputPortType, result ); + } + } + else + { + UpdateInternalDataFromVariables( true ); + if( !String.IsNullOrEmpty( m_internalDataWrapper ) ) + { + if( DataType == WirePortDataType.FLOAT3x3 ) + result = Matrix3x3WrappedData(); + else + result = String.Format( m_internalDataWrapper, m_internalData ); + } + else + { + result = m_internalData; + } + } + + return result; + } + + public OutputPort GetOutputConnection( int connID = 0 ) + { + if( connID < m_externalReferences.Count ) + { + return UIUtils.GetNode( m_externalReferences[ connID ].NodeId ).GetOutputPortByUniqueId( m_externalReferences[ connID ].PortId ); + } + return null; + } + + public ParentNode GetOutputNodeWhichIsNotRelay( int connID = 0 ) + { + if( connID < m_externalReferences.Count ) + { + ParentNode node = UIUtils.GetNode( m_externalReferences[ connID ].NodeId ); + if( node is WireNode || node is RelayNode || node is FunctionInput ) + { + return node.InputPorts[ 0 ].GetOutputNodeWhichIsNotRelay( connID ); + } + + return node; + } + return null; + } + + public ParentNode GetOutputNode( int connID = 0 ) + { + if( connID < m_externalReferences.Count ) + { + return UIUtils.GetNode( m_externalReferences[ connID ].NodeId ); + } + return null; + } + + public bool TypeLocked + { + get { return m_typeLocked; } + } + + public void WriteToString( ref string myString ) + { + if( m_externalReferences.Count != 1 || m_isDummy ) + { + return; + } + + IOUtils.AddTypeToString( ref myString, IOUtils.WireConnectionParam ); + IOUtils.AddFieldValueToString( ref myString, m_nodeId ); + IOUtils.AddFieldValueToString( ref myString, m_portId ); + IOUtils.AddFieldValueToString( ref myString, m_externalReferences[ 0 ].NodeId ); + IOUtils.AddFieldValueToString( ref myString, m_externalReferences[ 0 ].PortId ); + IOUtils.AddLineTerminator( ref myString ); + } + + public void ShowInternalData( Rect rect, UndoParentNode owner, bool useCustomLabel = false, string customLabel = null ) + { + string label = ( useCustomLabel == true && customLabel != null ) ? customLabel : m_internalDataPropertyLabel; + switch( m_dataType ) + { + case WirePortDataType.OBJECT: + { + InternalData = owner.EditorGUITextField( rect, label, InternalData ); + } + break; + case WirePortDataType.FLOAT: + { + FloatInternalData = owner.EditorGUIFloatField( rect, label, FloatInternalData ); + } + break; + case WirePortDataType.FLOAT2: + { + Vector2InternalData = owner.EditorGUIVector2Field( rect, label, Vector2InternalData ); + } + break; + case WirePortDataType.FLOAT3: + { + Vector3InternalData = owner.EditorGUIVector3Field( rect, label, Vector3InternalData ); + } + break; + case WirePortDataType.FLOAT4: + { + Vector4InternalData = owner.EditorGUIVector4Field( rect, label, Vector4InternalData ); + } + break; + case WirePortDataType.FLOAT3x3: + { + Matrix4x4 matrix = Matrix4x4InternalData; + Vector3 currVec3 = Vector3.zero; + for( int i = 0; i < 3; i++ ) + { + Vector4 currVec = matrix.GetRow( i ); + currVec3.Set( currVec.x, currVec.y, currVec.z ); + EditorGUI.BeginChangeCheck(); + currVec3 = owner.EditorGUIVector3Field( rect, label + "[ " + i + " ]", currVec3 ); + rect.y += 2*EditorGUIUtility.singleLineHeight; + if( EditorGUI.EndChangeCheck() ) + { + currVec.Set( currVec3.x, currVec3.y, currVec3.z, currVec.w ); + matrix.SetRow( i, currVec ); + } + } + Matrix4x4InternalData = matrix; + } + break; + case WirePortDataType.FLOAT4x4: + { + Matrix4x4 matrix = Matrix4x4InternalData; + for( int i = 0; i < 4; i++ ) + { + Vector4 currVec = matrix.GetRow( i ); + EditorGUI.BeginChangeCheck(); + currVec = owner.EditorGUIVector4Field( rect, label + "[ " + i + " ]", currVec ); + rect.y += 2*EditorGUIUtility.singleLineHeight; + if( EditorGUI.EndChangeCheck() ) + { + matrix.SetRow( i, currVec ); + } + } + Matrix4x4InternalData = matrix; + } + break; + case WirePortDataType.COLOR: + { + ColorInternalData = owner.EditorGUIColorField( rect, label, ColorInternalData ); + } + break; + case WirePortDataType.INT: + { + IntInternalData = owner.EditorGUIIntField( rect, label, IntInternalData ); + } + break; + } + } + + public void ShowInternalData( UndoParentNode owner, bool useCustomLabel = false, string customLabel = null ) + { + string label = ( useCustomLabel == true && customLabel != null ) ? customLabel : m_internalDataPropertyLabel; + switch( m_dataType ) + { + case WirePortDataType.OBJECT: + case WirePortDataType.FLOAT: + { + FloatInternalData = owner.EditorGUILayoutFloatField( label, FloatInternalData ); + } + break; + case WirePortDataType.FLOAT2: + { + Vector2InternalData = owner.EditorGUILayoutVector2Field( label, Vector2InternalData ); + } + break; + case WirePortDataType.FLOAT3: + { + Vector3InternalData = owner.EditorGUILayoutVector3Field( label, Vector3InternalData ); + } + break; + case WirePortDataType.FLOAT4: + { + Vector4InternalData = owner.EditorGUILayoutVector4Field( label, Vector4InternalData ); + } + break; + case WirePortDataType.FLOAT3x3: + { + Matrix4x4 matrix = Matrix4x4InternalData; + Vector3 currVec3 = Vector3.zero; + for( int i = 0; i < 3; i++ ) + { + Vector4 currVec = matrix.GetRow( i ); + currVec3.Set( currVec.x, currVec.y, currVec.z ); + EditorGUI.BeginChangeCheck(); + currVec3 = owner.EditorGUILayoutVector3Field( label + "[ " + i + " ]", currVec3 ); + if( EditorGUI.EndChangeCheck() ) + { + currVec.Set( currVec3.x, currVec3.y, currVec3.z, currVec.w ); + matrix.SetRow( i, currVec ); + } + } + Matrix4x4InternalData = matrix; + } + break; + case WirePortDataType.FLOAT4x4: + { + Matrix4x4 matrix = Matrix4x4InternalData; + for( int i = 0; i < 4; i++ ) + { + Vector4 currVec = matrix.GetRow( i ); + EditorGUI.BeginChangeCheck(); + currVec = owner.EditorGUILayoutVector4Field( label + "[ " + i + " ]", currVec ); + if( EditorGUI.EndChangeCheck() ) + { + matrix.SetRow( i, currVec ); + } + } + Matrix4x4InternalData = matrix; + } + break; + case WirePortDataType.COLOR: + { + ColorInternalData = owner.EditorGUILayoutColorField( label, ColorInternalData ); + } + break; + case WirePortDataType.INT: + { + IntInternalData = owner.EditorGUILayoutIntField( label, IntInternalData ); + } + break; + } + } + public bool IsZeroInternalData + { + get + { + switch( m_dataType ) + { + + case WirePortDataType.FLOAT: return Mathf.Abs(m_previewInternalFloat) < 0.001f; + case WirePortDataType.UINT: + case WirePortDataType.INT: return m_previewInternalInt == 0; + case WirePortDataType.FLOAT2: + return (Mathf.Abs( m_previewInternalVec2.x ) < 0.001f && + Mathf.Abs( m_previewInternalVec2.y ) < 0.001f); + case WirePortDataType.FLOAT3: + return (Mathf.Abs( m_previewInternalVec3.x ) < 0.001f && + Mathf.Abs( m_previewInternalVec3.y ) < 0.001f && + Mathf.Abs( m_previewInternalVec3.z ) < 0.001f ); + case WirePortDataType.UINT4: + case WirePortDataType.FLOAT4: + return (Mathf.Abs( m_previewInternalVec4.x ) < 0.001f && + Mathf.Abs( m_previewInternalVec4.y ) < 0.001f && + Mathf.Abs( m_previewInternalVec4.z ) < 0.001f && + Mathf.Abs( m_previewInternalVec4.w ) < 0.001f ); + case WirePortDataType.COLOR: + return (Mathf.Abs( m_previewInternalColor.r ) < 0.001f && + Mathf.Abs( m_previewInternalColor.g ) < 0.001f && + Mathf.Abs( m_previewInternalColor.b ) < 0.001f && + Mathf.Abs( m_previewInternalColor.a ) < 0.001f); + + } + return true; + } + } + public float FloatInternalData + { + set { m_previewInternalFloat = value; m_internalDataUpdated = false; } + get { return m_previewInternalFloat; } + } + + public int IntInternalData + { + set { m_previewInternalInt = value; m_internalDataUpdated = false; } + get { return m_previewInternalInt; } + } + + public Vector2 Vector2InternalData + { + set { m_previewInternalVec2 = value; m_internalDataUpdated = false; } + get { return m_previewInternalVec2; } + } + + public Vector3 Vector3InternalData + { + set { m_previewInternalVec3 = value; m_internalDataUpdated = false; } + get { return m_previewInternalVec3; } + } + + public Vector4 Vector4InternalData + { + set { m_previewInternalVec4 = value; m_internalDataUpdated = false; } + get { return m_previewInternalVec4; } + } + + public Color ColorInternalData + { + set { m_previewInternalColor = value; m_internalDataUpdated = false; } + get { return m_previewInternalColor; } + } + + public Matrix4x4 Matrix4x4InternalData + { + set { m_previewInternalMatrix4x4 = value; m_internalDataUpdated = false; } + get { return m_previewInternalMatrix4x4; } + } + + public string SamplerInternalData + { + set { InternalData = UIUtils.RemoveInvalidCharacters( value ); m_internalDataUpdated = false; } + get { return m_internalData; } + } + + public override void ForceClearConnection() + { + UIUtils.DeleteConnection( true, m_nodeId, m_portId, false, true ); + } + + private bool m_internalDataUpdated = false; + private string m_displayInternalData = string.Empty; + public string DisplayInternalData + { + get + { + if( !m_internalDataUpdated ) + { + UpdateInternalDataFromVariables(); + m_internalDataUpdated = true; + m_displayInternalData = "( "+ m_internalData + " )"; + } + return m_displayInternalData; + } + } + + public string InternalData + { + get + { + UpdateInternalDataFromVariables(); + return m_internalData; + } + set + { + m_internalData = value; + UpdateVariablesFromInternalData(); + } + } + + public string WrappedInternalData + { + get + { + UpdateInternalDataFromVariables(); + return string.IsNullOrEmpty( m_internalDataWrapper ) ? m_internalData : String.Format( m_internalDataWrapper, m_internalData ); + } + } + + public override WirePortDataType DataType + { + get { return base.DataType; } + // must be set to update internal data. do not delete + set + { + m_internalDataUpdated = false; + switch( DataType ) + { + case WirePortDataType.FLOAT: + { + switch( value ) + { + case WirePortDataType.FLOAT2: m_previewInternalVec2.x = m_previewInternalFloat; break; + case WirePortDataType.FLOAT3: m_previewInternalVec3.x = m_previewInternalFloat; break; + case WirePortDataType.FLOAT4: m_previewInternalVec4.x = m_previewInternalFloat; break; + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + // @diogo: not applicable + break; + } + case WirePortDataType.COLOR: m_previewInternalColor.r = m_previewInternalFloat; break; + case WirePortDataType.INT: m_previewInternalInt = (int)m_previewInternalFloat; break; + } + break; + } + case WirePortDataType.FLOAT2: + { + switch( value ) + { + case WirePortDataType.FLOAT: m_previewInternalFloat = m_previewInternalVec2.x; break; + case WirePortDataType.FLOAT3: + { + m_previewInternalVec3.x = m_previewInternalVec2.x; + m_previewInternalVec3.y = m_previewInternalVec2.y; + break; + } + case WirePortDataType.FLOAT4: + { + m_previewInternalVec4.x = m_previewInternalVec2.x; + m_previewInternalVec4.y = m_previewInternalVec2.y; + break; + } + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + // @diogo: not applicable + break; + } + case WirePortDataType.COLOR: + { + m_previewInternalColor.r = m_previewInternalVec2.x; + m_previewInternalColor.g = m_previewInternalVec2.y; + break; + } + case WirePortDataType.INT: m_previewInternalInt = (int)m_previewInternalVec2.x; break; + } + break; + } + case WirePortDataType.FLOAT3: + { + switch( value ) + { + case WirePortDataType.FLOAT: m_previewInternalFloat = m_previewInternalVec3.x; break; + case WirePortDataType.FLOAT2: + { + m_previewInternalVec2.x = m_previewInternalVec3.x; + m_previewInternalVec2.y = m_previewInternalVec3.y; + break; + } + case WirePortDataType.FLOAT4: + { + m_previewInternalVec4.x = m_previewInternalVec3.x; + m_previewInternalVec4.y = m_previewInternalVec3.y; + m_previewInternalVec4.z = m_previewInternalVec3.z; + break; + } + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + // @diogo: not applicable + break; + } + case WirePortDataType.COLOR: + { + m_previewInternalColor.r = m_previewInternalVec3.x; + m_previewInternalColor.g = m_previewInternalVec3.y; + m_previewInternalColor.b = m_previewInternalVec3.z; + break; + } + case WirePortDataType.INT: m_previewInternalInt = (int)m_previewInternalVec3.x; break; + } + break; + } + case WirePortDataType.FLOAT4: + { + switch( value ) + { + case WirePortDataType.FLOAT: m_previewInternalFloat = m_previewInternalVec4.x; break; + case WirePortDataType.FLOAT2: + { + m_previewInternalVec2.x = m_previewInternalVec4.x; + m_previewInternalVec2.y = m_previewInternalVec4.y; + break; + } + case WirePortDataType.FLOAT3: + { + m_previewInternalVec3.x = m_previewInternalVec4.x; + m_previewInternalVec3.y = m_previewInternalVec4.y; + m_previewInternalVec3.z = m_previewInternalVec4.z; + break; + } + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + // @diogo: not applicable + break; + } + case WirePortDataType.COLOR: + { + m_previewInternalColor.r = m_previewInternalVec4.x; + m_previewInternalColor.g = m_previewInternalVec4.y; + m_previewInternalColor.b = m_previewInternalVec4.z; + m_previewInternalColor.a = m_previewInternalVec4.w; + break; + } + case WirePortDataType.INT: m_previewInternalInt = (int)m_previewInternalVec4.x; break; + } + break; + } + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + // @diogo: not applicable + break; + } + case WirePortDataType.COLOR: + { + switch( value ) + { + case WirePortDataType.FLOAT: m_previewInternalFloat = m_previewInternalColor.r; break; + case WirePortDataType.FLOAT2: + { + m_previewInternalVec2.x = m_previewInternalColor.r; + m_previewInternalVec2.y = m_previewInternalColor.g; + break; + } + case WirePortDataType.FLOAT3: + { + m_previewInternalVec3.x = m_previewInternalColor.r; + m_previewInternalVec3.y = m_previewInternalColor.g; + m_previewInternalVec3.z = m_previewInternalColor.b; + break; + } + case WirePortDataType.FLOAT4: + { + m_previewInternalVec4.x = m_previewInternalColor.r; + m_previewInternalVec4.y = m_previewInternalColor.g; + m_previewInternalVec4.z = m_previewInternalColor.b; + m_previewInternalVec4.w = m_previewInternalColor.a; + break; + } + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + // @diogo: not applicable + break; + } + case WirePortDataType.INT: m_previewInternalInt = (int)m_previewInternalColor.r; break; + } + break; + } + case WirePortDataType.INT: + { + switch( value ) + { + case WirePortDataType.FLOAT: m_previewInternalFloat = m_previewInternalInt; break; + case WirePortDataType.FLOAT2: m_previewInternalVec2.x = m_previewInternalInt; break; + case WirePortDataType.FLOAT3: m_previewInternalVec3.x = m_previewInternalInt; break; + case WirePortDataType.FLOAT4: m_previewInternalVec4.x = m_previewInternalInt; break; + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + // @diogo: not applicable + break; + } + case WirePortDataType.COLOR: m_previewInternalColor.r = m_previewInternalInt; break; + } + break; + } + } + base.DataType = value; + } + } + + public string DataName + { + get { return m_dataName; } + set { m_dataName = value; } + } + + public bool IsFragment { get { return m_category == MasterNodePortCategory.Fragment || m_category == MasterNodePortCategory.Debug; } } + public MasterNodePortCategory Category + { + set { m_category = value; } + get { return m_category; } + } + + private int CachedIntPropertyID + { + get + { + if( m_cachedIntShaderID == -1 ) + m_cachedIntShaderID = Shader.PropertyToID( "_InputInt" ); + return m_cachedIntShaderID; + } + } + + private int CachedFloatPropertyID + { + get + { + if( m_cachedFloatShaderID == -1 ) + m_cachedFloatShaderID = Shader.PropertyToID( "_InputFloat" ); + return m_cachedFloatShaderID; + } + } + + private int CachedVectorPropertyID + { + get + { + if( m_cachedVectorShaderID == -1 ) + m_cachedVectorShaderID = Shader.PropertyToID( "_InputVector" ); + return m_cachedVectorShaderID; + } + } + + private int CachedColorPropertyID + { + get + { + if( m_cachedColorShaderID == -1 ) + m_cachedColorShaderID = Shader.PropertyToID( "_InputColor" ); + return m_cachedColorShaderID; + } + } + + private int CachedDefaultTexPropertyID + { + get + { + if( m_cachedDefaultTexShaderID == -1 ) + m_cachedDefaultTexShaderID = Shader.PropertyToID( "_Default" ); + return m_cachedDefaultTexShaderID; + } + } + + private int Cached2DPropertyID + { + get + { + if( m_cached2DShaderID == -1 ) + m_cached2DShaderID = Shader.PropertyToID( "_Input2D" ); + return m_cached2DShaderID; + } + } + + public int CachedPropertyId + { + get { return m_cachedPropertyId; } + } + + public bool InputNodeHasPreview( ParentGraph container ) + { + ParentNode node = null; + if( m_externalReferences.Count > 0) + { + node = container.GetNode( m_externalReferences[ 0 ].NodeId ); + } + + if( node != null ) + return node.HasPreviewShader; + + return false; + } + + public void PreparePortCacheID() + { + if( m_propertyNameInt != PortId || string.IsNullOrEmpty( m_propertyName ) ) + { + m_propertyNameInt = PortId; + m_propertyName = "_" + Convert.ToChar( PortId + 65 ); + m_cachedPropertyId = Shader.PropertyToID( m_propertyName ); + } + + if( m_cachedPropertyId == -1 ) + m_cachedPropertyId = Shader.PropertyToID( m_propertyName ); + } + + public void SetPreviewInputTexture( ParentGraph container ) + { + PreparePortCacheID(); + + if( (object)m_node == null ) + { + m_node = container.GetNode( NodeId ); + //m_node = UIUtils.GetNode( NodeId ); + } + + if( ExternalReferences.Count>0 ) + { + m_node.PreviewMaterial.SetTexture( m_cachedPropertyId, container.GetNode( ExternalReferences[ 0 ].NodeId ).GetOutputPortByUniqueId( ExternalReferences[ 0 ].PortId ).OutputPreviewTexture ); + } + //m_node.PreviewMaterial.SetTexture( m_cachedPropertyId, GetOutputConnection( 0 ).OutputPreviewTexture ); + } + + private void SetPortPreviewShader( Shader portShader ) + { + if( m_inputPreviewShader != portShader ) + { + m_inputPreviewShader = portShader; + InputPreviewMaterial.shader = portShader; + } + } + + public void SetPreviewInputValue( ParentGraph container ) + { + if( m_inputPreviewTexture == null ) + { + m_inputPreviewTexture = new RenderTexture( Constants.PreviewSize , Constants.PreviewSize , 0, Constants.PreviewFormat , RenderTextureReadWrite.Linear ); + m_inputPreviewTexture.wrapMode = TextureWrapMode.Repeat; + } + + switch( DataType ) + { + case WirePortDataType.INT: + { + SetPortPreviewShader( UIUtils.IntShader ); + + InputPreviewMaterial.SetInt( CachedIntPropertyID, m_previewInternalInt ); + } + break; + case WirePortDataType.FLOAT: + { + SetPortPreviewShader( UIUtils.FloatShader ); + //Debug.Log( m_previewInternalFloat ); + InputPreviewMaterial.SetFloat( CachedFloatPropertyID, m_previewInternalFloat ); + } + break; + case WirePortDataType.FLOAT2: + { + SetPortPreviewShader( UIUtils.Vector2Shader ); + + Vector2 v2 = m_previewInternalVec2;// Vector2InternalData; + InputPreviewMaterial.SetVector( CachedVectorPropertyID, new Vector4( v2.x, v2.y, 0, 0 ) ); + } + break; + case WirePortDataType.FLOAT3: + { + SetPortPreviewShader( UIUtils.Vector3Shader ); + + Vector3 v3 = m_previewInternalVec3;// Vector3InternalData; + InputPreviewMaterial.SetVector( CachedVectorPropertyID, new Vector4( v3.x, v3.y, v3.z, 0 ) ); + } + break; + case WirePortDataType.FLOAT4: + { + SetPortPreviewShader( UIUtils.Vector4Shader ); + + InputPreviewMaterial.SetVector( CachedVectorPropertyID, m_previewInternalVec4 ); + } + break; + case WirePortDataType.COLOR: + { + SetPortPreviewShader( UIUtils.ColorShader ); + + InputPreviewMaterial.SetColor( CachedColorPropertyID, m_previewInternalColor ); + } + break; + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + { + SetPortPreviewShader( UIUtils.FloatShader ); + + InputPreviewMaterial.SetFloat( CachedFloatPropertyID, 1 ); + } + break; + case WirePortDataType.SAMPLER2D: + { + SetPortPreviewShader( UIUtils.Texture2DShader ); + } + break; + default: + { + SetPortPreviewShader( UIUtils.FloatShader ); + + InputPreviewMaterial.SetFloat( CachedFloatPropertyID, 0 ); + } + break; + } + + RenderTexture temp = RenderTexture.active; + RenderTexture.active = m_inputPreviewTexture; + Graphics.Blit( null, m_inputPreviewTexture, InputPreviewMaterial ); + RenderTexture.active = temp; + + PreparePortCacheID(); + + //if( (object)m_node == null ) + // m_node = UIUtils.GetNode( NodeId ); + + if( (object)m_node == null ) + { + m_node = container.GetNode( NodeId ); + //m_node = UIUtils.GetNode( NodeId ); + } + //m_propertyName = "_A"; + //Debug.Log( m_propertyName ); + m_node.PreviewMaterial.SetTexture( m_propertyName, m_inputPreviewTexture ); + } + + public override void ChangePortId( int newPortId ) + { + if( IsConnected ) + { + int count = ExternalReferences.Count; + for( int connIdx = 0; connIdx < count; connIdx++ ) + { + int nodeId = ExternalReferences[ connIdx ].NodeId; + int portId = ExternalReferences[ connIdx ].PortId; + ParentNode node = UIUtils.GetNode( nodeId ); + if( node != null ) + { + OutputPort outputPort = node.GetOutputPortByUniqueId( portId ); + int outputCount = outputPort.ExternalReferences.Count; + for( int j = 0; j < outputCount; j++ ) + { + if( outputPort.ExternalReferences[ j ].NodeId == NodeId && + outputPort.ExternalReferences[ j ].PortId == PortId ) + { + outputPort.ExternalReferences[ j ].PortId = newPortId; + } + } + } + } + } + + PortId = newPortId; + } + + public override void Destroy() + { + base.Destroy(); + //if ( m_inputPreview != null ) + // UnityEngine.ScriptableObject.DestroyImmediate( m_inputPreview ); + //m_inputPreview = null; + + if( m_inputPreviewTexture != null ) + { + m_inputPreviewTexture.Release(); + UnityEngine.ScriptableObject.DestroyImmediate( m_inputPreviewTexture ); + } + m_inputPreviewTexture = null; + + if( m_inputPreviewMaterial != null ) + UnityEngine.ScriptableObject.DestroyImmediate( m_inputPreviewMaterial ); + m_inputPreviewMaterial = null; + + m_inputPreviewShader = null; + + m_node = null; + } + + public Shader InputPreviewShader + { + get + { + if( m_inputPreviewShader == null ) + m_inputPreviewShader = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "d9ca47581ac157145bff6f72ac5dd73e" ) ); //ranged float + + if( m_inputPreviewShader == null ) + m_inputPreviewShader = Shader.Find( "Unlit/Colored Transparent" ); + + return m_inputPreviewShader; + } + set + { + m_inputPreviewShader = value; + } + } + + public Material InputPreviewMaterial + { + get + { + if( m_inputPreviewMaterial == null ) + m_inputPreviewMaterial = new Material( InputPreviewShader ); + + return m_inputPreviewMaterial; + } + //set + //{ + // m_inputPreviewMaterial = value; + //} + } + + public override string Name + { + get { return m_name; } + set + { + m_name = value; + m_internalDataPropertyLabel = ( string.IsNullOrEmpty( value ) || value.Equals( Constants.EmptyPortValue ) ) ? InputDefaultNameStr : value; + m_dirtyLabelSize = true; + } + } + + public string InternalDataName + { + get { return m_internalDataPropertyLabel; } + set { m_internalDataPropertyLabel = value; } + } + + public bool AutoDrawInternalData + { + get { return m_drawInternalData; } + set { m_drawInternalData = value; } + } + + public PortGenType GenType + { + get { return m_genType; } + set { m_genType = value; } + } + + public bool ValidInternalData + { + get + { + switch( m_dataType ) + { + case WirePortDataType.FLOAT: + case WirePortDataType.FLOAT2: + case WirePortDataType.FLOAT3: + case WirePortDataType.FLOAT4: + case WirePortDataType.FLOAT3x3: + case WirePortDataType.FLOAT4x4: + case WirePortDataType.COLOR: + case WirePortDataType.INT: return true; + case WirePortDataType.OBJECT: + case WirePortDataType.SAMPLER1D: + case WirePortDataType.SAMPLER2D: + case WirePortDataType.SAMPLER3D: + case WirePortDataType.SAMPLERCUBE: + case WirePortDataType.SAMPLER2DARRAY: + case WirePortDataType.SAMPLERSTATE: + default: return false; + } + } + } + + //public RenderTexture InputPreviewTexture + //{ + // get + // { + // if( IsConnected ) + // return GetOutputConnection( 0 ).OutputPreviewTexture; + // else + // return m_inputPreviewTexture; + // } + //} + + public RenderTexture InputPreviewTexture( ParentGraph container ) + { + if( IsConnected ) + { + if( m_externalReferences.Count > 0 ) + return container.GetNode( m_externalReferences[ 0 ].NodeId ).GetOutputPortByUniqueId( m_externalReferences[ 0 ].PortId ).OutputPreviewTexture; + else + return null; + } + else + { + return m_inputPreviewTexture; + } + } + + public string ExternalLinkId + { + get { return m_externalLinkId; } + set + { + m_externalLinkId = value; + if( string.IsNullOrEmpty( value ) ) + { + m_externalNodeLink = -1; + m_externalPortLink = -1; + } + } + } + + public bool HasOwnOrLinkConnection { get { return IsConnected || HasConnectedExternalLink; } } + public bool HasExternalLink { get { return m_externalNodeLink > -1 && m_externalPortLink > -1; } } + + public bool HasConnectedExternalLink + { + get + { + InputPort link = ExternalLink; + return ( link != null && link.IsConnected ); + } + } + + public InputPort ExternalLink + { + get + { + if( HasExternalLink ) + { + ParentNode linkNode = UIUtils.GetNode( m_externalNodeLink ); + if( linkNode != null ) + { + return linkNode.GetInputPortByUniqueId( m_externalPortLink ); + } + } + return null; + } + } + + public ParentNode ExternalLinkNode + { + get + { + if( HasExternalLink ) + { + return UIUtils.GetNode( m_externalNodeLink ); + } + return null; + } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs.meta new file mode 100644 index 00000000..5259ee01 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e8199169aaf7f404492a0f2353fb52f9 +timeCreated: 1481126960 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs new file mode 100644 index 00000000..4a2557b8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs @@ -0,0 +1,314 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEditor; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [System.Serializable] + public sealed class OutputPort : WirePort + { + public delegate void OnNewPreviewRTCreated(); + public OnNewPreviewRTCreated OnNewPreviewRTCreatedEvent; + + [SerializeField] + private bool m_connectedToMasterNode; + + [SerializeField] + private bool[] m_isLocalValue = { false, false}; + + [SerializeField] + private string[] m_localOutputValue = { string.Empty,string.Empty}; + + //[SerializeField] + //private int m_isLocalWithPortType = 0; + + private RenderTexture m_outputPreview = null; + private Material m_outputMaskMaterial = null; + + private int m_indexPreviewOffset = 0; + + public OutputPort( ParentNode owner, int nodeId, int portId, WirePortDataType dataType, string name ) : base( nodeId, portId, dataType, name ) + { + LabelSize = Vector2.zero; + OnNewPreviewRTCreatedEvent += owner.SetPreviewDirtyFromOutputs; + } + + public string ErrorValue + { + get + { + string value = string.Empty; + switch( m_dataType ) + { + default: + case WirePortDataType.OBJECT: + case WirePortDataType.INT: + case WirePortDataType.FLOAT: value = "(0)"; break; + case WirePortDataType.FLOAT2: value = "half2(0,0)"; break; + case WirePortDataType.FLOAT3: value = "half3(0,0,0)"; break; + case WirePortDataType.COLOR: + case WirePortDataType.FLOAT4: value = "half4(0,0,0,0)"; break; + case WirePortDataType.FLOAT3x3: value = "half3x3(0,0,0,0,0,0,0,0,0)"; break; + case WirePortDataType.FLOAT4x4: value = "half4x4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)"; break; + } + return value; + } + } + + public bool ConnectedToMasterNode + { + get { return m_connectedToMasterNode; } + set { m_connectedToMasterNode = value; } + } + + public override void FullDeleteConnections() + { + UIUtils.DeleteConnection( false, m_nodeId, m_portId, true, true ); + } + + public bool HasConnectedNode + { + get + { + int count = m_externalReferences.Count; + for( int i = 0; i < count; i++ ) + { + if( UIUtils.GetNode( m_externalReferences[ i ].NodeId ).IsConnected ) + return true; + } + return false; + } + } + public InputPort GetInputConnection( int connID = 0 ) + { + if( connID < m_externalReferences.Count ) + { + return UIUtils.GetNode( m_externalReferences[ connID ].NodeId ).GetInputPortByUniqueId( m_externalReferences[ connID ].PortId ); + } + return null; + } + + public ParentNode GetInputNode( int connID = 0 ) + { + if( connID < m_externalReferences.Count ) + { + return UIUtils.GetNode( m_externalReferences[ connID ].NodeId ); + } + return null; + } + + public override void NotifyExternalRefencesOnChange() + { + for( int i = 0; i < m_externalReferences.Count; i++ ) + { + ParentNode node = UIUtils.GetNode( m_externalReferences[ i ].NodeId ); + if( node ) + { + node.CheckSpherePreview(); + InputPort port = node.GetInputPortByUniqueId( m_externalReferences[ i ].PortId ); + port.UpdateInfoOnExternalConn( m_nodeId, m_portId, m_dataType ); + node.OnConnectedOutputNodeChanges( m_externalReferences[ i ].PortId, m_nodeId, m_portId, m_name, m_dataType ); + } + } + } + + public void ChangeTypeWithRestrictions( WirePortDataType newType, int restrictions ) + { + if( m_dataType != newType ) + { + DataType = newType; + for( int i = 0; i < m_externalReferences.Count; i++ ) + { + ParentNode inNode = UIUtils.GetNode( m_externalReferences[ i ].NodeId ); + InputPort inputPort = inNode.GetInputPortByUniqueId( m_externalReferences[ i ].PortId ); + + bool valid = false; + if( restrictions == 0 ) + { + valid = true; + } + else + { + valid = ( restrictions & (int)inputPort.DataType ) != 0; + } + + if( valid ) + { + inNode.CheckSpherePreview(); + inputPort.UpdateInfoOnExternalConn( m_nodeId, m_portId, m_dataType ); + inNode.OnConnectedOutputNodeChanges( m_externalReferences[ i ].PortId, m_nodeId, m_portId, m_name, m_dataType ); + } + else + { + InvalidateConnection( m_externalReferences[ i ].NodeId, m_externalReferences[ i ].PortId ); + inputPort.InvalidateConnection( NodeId, PortId ); + i--; + } + } + } + } + + public override void ChangePortId( int newPortId ) + { + if( IsConnected ) + { + int count = ExternalReferences.Count; + for( int connIdx = 0; connIdx < count; connIdx++ ) + { + int nodeId = ExternalReferences[ connIdx ].NodeId; + int portId = ExternalReferences[ connIdx ].PortId; + ParentNode node = UIUtils.GetNode( nodeId ); + if( node != null ) + { + InputPort inputPort = node.GetInputPortByUniqueId( portId ); + int inputCount = inputPort.ExternalReferences.Count; + for( int j = 0; j < inputCount; j++ ) + { + if( inputPort.ExternalReferences[ j ].NodeId == NodeId && + inputPort.ExternalReferences[ j ].PortId == PortId ) + { + inputPort.ExternalReferences[ j ].PortId = newPortId; + } + } + } + } + } + + PortId = newPortId; + } + + public string ConfigOutputLocalValue( PrecisionType precisionType, string value, string customName, MasterNodePortCategory category ) + { + int idx = UIUtils.PortCategorytoAttayIdx( category ); + ParentGraph currentGraph = UIUtils.GetNode( NodeId ).ContainerGraph; + string autoGraphId = currentGraph.GraphId > 0 ? "_g" + currentGraph.GraphId : string.Empty; + m_localOutputValue[idx] = string.IsNullOrEmpty( customName ) ? ( "temp_output_" + m_nodeId + "_" + PortId + autoGraphId ) : customName; + m_isLocalValue[idx] = true; + //m_isLocalWithPortType |= (int)category; + return string.Format( Constants.LocalValueDecWithoutIdent, UIUtils.PrecisionWirePortToCgType( precisionType, DataType ), m_localOutputValue[idx], value ); + } + + public void SetLocalValue( string value, MasterNodePortCategory category ) + { + int idx = UIUtils.PortCategorytoAttayIdx( category ); + m_isLocalValue[idx] = true; + m_localOutputValue[ idx ] = value; + //m_isLocalWithPortType |= (int)category; + } + + public void ResetLocalValue() + { + for( int i = 0; i < m_localOutputValue.Length; i++ ) + { + m_localOutputValue[ i ] = string.Empty; + m_isLocalValue[i] = false; + } + //m_isLocalWithPortType = 0; + } + + public void ResetLocalValueIfNot( MasterNodePortCategory category ) + { + int idx = UIUtils.PortCategorytoAttayIdx( category ); + for( int i = 0; i < m_localOutputValue.Length; i++ ) + { + if( i != idx ) + { + m_localOutputValue[ i ] = string.Empty; + m_isLocalValue[ i ] = false; + } + } + } + + public void ResetLocalValueOnCategory( MasterNodePortCategory category ) + { + int idx = UIUtils.PortCategorytoAttayIdx( category ); + m_localOutputValue[ idx ] = string.Empty; + m_isLocalValue[ idx ] = false; + } + + public bool IsLocalOnCategory( MasterNodePortCategory category ) + { + int idx = UIUtils.PortCategorytoAttayIdx( category ); + return m_isLocalValue[ idx ]; + //return ( m_isLocalWithPortType & (int)category ) != 0; ; + } + + public override void ForceClearConnection() + { + UIUtils.DeleteConnection( false, m_nodeId, m_portId, false, true ); + } + + public bool IsLocalValue( MasterNodePortCategory category ) + { + int idx = UIUtils.PortCategorytoAttayIdx( category ); + return m_isLocalValue[ idx ]; + } + + public string LocalValue(MasterNodePortCategory category) + { + int idx = UIUtils.PortCategorytoAttayIdx( category ); + return m_localOutputValue[idx]; + } + + public RenderTexture OutputPreviewTexture + { + get + { + if( Preferences.User.DisablePreviews ) + { + return UIUtils.DummyRT; + } + + if( m_outputPreview == null ) + { + m_outputPreview = new RenderTexture( Constants.PreviewSize , Constants.PreviewSize , 0 , Constants.PreviewFormat , RenderTextureReadWrite.Linear ); + m_outputPreview.wrapMode = TextureWrapMode.Repeat; + if( OnNewPreviewRTCreatedEvent != null ) + OnNewPreviewRTCreatedEvent(); + } + + return m_outputPreview; + } + set { m_outputPreview = value; } + } + + public int IndexPreviewOffset + { + get { return m_indexPreviewOffset; } + set { m_indexPreviewOffset = value; } + } + + public override void Destroy() + { + base.Destroy(); + if( m_outputPreview != null ) + { + m_outputPreview.Release(); + UnityEngine.ScriptableObject.DestroyImmediate( m_outputPreview ); + } + m_outputPreview = null; + + if( m_outputMaskMaterial != null ) + UnityEngine.ScriptableObject.DestroyImmediate( m_outputMaskMaterial ); + m_outputMaskMaterial = null; + + OnNewPreviewRTCreatedEvent = null; + } + + public Material MaskingMaterial + { + get + { + if( m_outputMaskMaterial == null ) + { + //m_outputMaskMaterial = new Material( AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "9c34f18ebe2be3e48b201b748c73dec0" ) ) ); + m_outputMaskMaterial = new Material( UIUtils.MaskingShader ); + } + return m_outputMaskMaterial; + } + //set { m_outputMaskMaterial = value; } + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs.meta new file mode 100644 index 00000000..7b39ee5d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 82722ce1ba0df314490a9362e503727c +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs new file mode 100644 index 00000000..6753ff02 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs @@ -0,0 +1,58 @@ +using UnityEngine; + +namespace AmplifyShaderEditor +{ + [System.Serializable] + public class WireBezierReference + { + private Rect m_boundingBox; + private int m_inNodeId; + private int m_inPortId; + private int m_outNodeId; + private int m_outPortId; + + public WireBezierReference() + { + m_boundingBox = new Rect(); + m_inNodeId = -1; + m_inPortId = -1; + m_outNodeId = -1; + m_outPortId = -1; + } + + public WireBezierReference( ref Rect area, int inNodeId, int inPortId, int outNodeId, int outPortId ) + { + UpdateInfo( ref area, inNodeId, inPortId, outNodeId, outPortId ); + } + + public void UpdateInfo( ref Rect area, int inNodeId, int inPortId, int outNodeId, int outPortId ) + { + m_boundingBox = area; + m_inNodeId = inNodeId; + m_inPortId = inPortId; + m_outNodeId = outNodeId; + m_outPortId = outPortId; + } + + public bool Contains( Vector2 position ) + { + return m_boundingBox.Contains( position ); + } + + public void DebugDraw() + { + GUI.Label( m_boundingBox, string.Empty, UIUtils.GetCustomStyle( CustomStyle.MainCanvasTitle )); + } + + public override string ToString() + { + return string.Format( "In node: {0} port: {1} -> Out node: {2} port: {3}", m_inNodeId, m_inPortId, m_outNodeId, m_outPortId ); + } + + public Rect BoundingBox { get { return m_boundingBox; } } + public int InNodeId { get { return m_inNodeId; } } + public int InPortId { get { return m_inPortId; } } + public int OutNodeId { get { return m_outNodeId; } } + public int OutPortId { get { return m_outPortId; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs.meta new file mode 100644 index 00000000..b8cdf918 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 499682ec40529f44480d58747ad7ab44 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs new file mode 100644 index 00000000..c7e1b078 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs @@ -0,0 +1,606 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using UnityEngine; +using UnityEditor; + +using System.Collections.Generic; + +namespace AmplifyShaderEditor +{ + public enum WirePortDataType + { + OBJECT = 1 << 1, + FLOAT = 1 << 2, + FLOAT2 = 1 << 3, + FLOAT3 = 1 << 4, + FLOAT4 = 1 << 5, + FLOAT3x3 = 1 << 6, + FLOAT4x4 = 1 << 7, + COLOR = 1 << 8, + INT = 1 << 9, + SAMPLER1D = 1 << 10, + SAMPLER2D = 1 << 11, + SAMPLER3D = 1 << 12, + SAMPLERCUBE = 1 << 13, + UINT = 1 << 14, + SAMPLER2DARRAY = 1 << 15, + SAMPLERSTATE = 1 << 16, + UINT4 = 1 << 17 + } + + public enum VariableQualifiers + { + In = 0, + Out, + InOut + } + + public struct WirePortDataTypeComparer : IEqualityComparer + { + public bool Equals( WirePortDataType x, WirePortDataType y ) + { + return x == y; + } + + public int GetHashCode( WirePortDataType obj ) + { + // you need to do some thinking here, + return (int)obj; + } + } + + [System.Serializable] + public class WirePort + { + private const double PortClickTime = 0.2; + + private double m_lastTimeClicked = -1; + + private Vector2 m_labelSize; + private Vector2 m_unscaledLabelSize; + protected bool m_dirtyLabelSize = true; + + private bool m_isEditable = false; + private bool m_editingName = false; + + protected int m_portRestrictions = 0; + + private bool m_repeatButtonState = false; + + [SerializeField] + private Rect m_position; + + [SerializeField] + private Rect m_labelPosition; + + [SerializeField] + protected int m_nodeId = -1; + + [SerializeField] + protected int m_portId = -1; + + [SerializeField] + protected int m_orderId = -1; + + [SerializeField] + protected WirePortDataType m_dataType = WirePortDataType.FLOAT; + + [SerializeField] + protected string m_name; + + [SerializeField] + protected List m_externalReferences; + + [SerializeField] + protected bool m_locked = false; + + [SerializeField] + protected bool m_visible = true; + + [SerializeField] + protected bool m_isDummy = false; + + [SerializeField] + protected bool m_hasCustomColor = false; + + [SerializeField] + protected Color m_customColor = Color.white; + + [SerializeField] + protected Rect m_activePortArea; + + public WirePort( int nodeId, int portId, WirePortDataType dataType, string name, int orderId = -1 ) + { + m_nodeId = nodeId; + m_portId = portId; + m_orderId = orderId; + m_dataType = dataType; + m_name = name; + m_externalReferences = new List(); + } + + public virtual void Destroy() + { + m_externalReferences.Clear(); + m_externalReferences = null; + } + + public void SetFreeForAll() + { + m_portRestrictions = -1; + } + + public void AddPortForbiddenTypes( params WirePortDataType[] forbiddenTypes ) + { + if( forbiddenTypes != null ) + { + if( m_portRestrictions == 0 ) + { + //if no previous restrictions are detected then we set up the bit array so we can set is bit correctly + m_portRestrictions = int.MaxValue; + } + + for( int i = 0; i < forbiddenTypes.Length; i++ ) + { + m_portRestrictions = m_portRestrictions & ( int.MaxValue - (int)forbiddenTypes[ i ] ); + } + } + } + + public void AddPortRestrictions( params WirePortDataType[] validTypes ) + { + if( validTypes != null ) + { + for( int i = 0; i < validTypes.Length; i++ ) + { + m_portRestrictions = m_portRestrictions | (int)validTypes[ i ]; + } + } + } + + public void CreatePortRestrictions( params WirePortDataType[] validTypes ) + { + m_portRestrictions = 0; + if( validTypes != null ) + { + for( int i = 0; i < validTypes.Length; i++ ) + { + m_portRestrictions = m_portRestrictions | (int)validTypes[ i ]; + } + } + } + + public virtual bool CheckValidType( WirePortDataType dataType ) + { + if( m_portRestrictions == 0 ) + { + return true; + } + + return ( m_portRestrictions & (int)dataType ) != 0; + } + + public bool ConnectTo( WireReference port ) + { + if( m_locked ) + return false; + + if( m_externalReferences.Contains( port ) ) + return false; + + m_externalReferences.Add( port ); + return true; + } + + public bool ConnectTo( int nodeId, int portId ) + { + if( m_locked ) + return false; + + + foreach( WireReference reference in m_externalReferences ) + { + if( reference.NodeId == nodeId && reference.PortId == portId ) + { + return false; + } + } + m_externalReferences.Add( new WireReference( nodeId, portId, m_dataType, false ) ); + return true; + } + + public bool ConnectTo( int nodeId, int portId, WirePortDataType dataType, bool typeLocked ) + { + if( m_locked ) + return false; + + foreach( WireReference reference in m_externalReferences ) + { + if( reference.NodeId == nodeId && reference.PortId == portId ) + { + return false; + } + } + m_externalReferences.Add( new WireReference( nodeId, portId, dataType, typeLocked ) ); + return true; + } + + public void DummyAdd( int nodeId, int portId ) + { + m_externalReferences.Insert( 0, new WireReference( nodeId, portId, WirePortDataType.OBJECT, false ) ); + m_isDummy = true; + } + + public void DummyRemove() + { + m_externalReferences.RemoveAt( 0 ); + m_isDummy = false; + } + + public void DummyClear() + { + m_externalReferences.Clear(); + m_isDummy = false; + } + + public WireReference GetConnection( int connID = 0 ) + { + if( connID < m_externalReferences.Count ) + return m_externalReferences[ connID ]; + return null; + } + + public void ChangeProperties( string newName, WirePortDataType newType, bool invalidateConnections ) + { + Name = newName; + ChangeType( newType, invalidateConnections ); + //if ( m_dataType != newType ) + //{ + // DataType = newType; + // if ( invalidateConnections ) + // { + // InvalidateAllConnections(); + // } + // else + // { + // NotifyExternalRefencesOnChange(); + // } + //} + } + + public void ChangeType( WirePortDataType newType, bool invalidateConnections ) + { + if( m_dataType != newType ) + { + //ParentNode node = UIUtils.GetNode( m_nodeId ); + //if ( node ) + //{ + // UndoUtils.RegisterCompleteObjectUndo( node.ContainerGraph.ParentWindow, Constants.UndoChangeTypeNodesId ); + // UndoUtils.RecordObject( node, Constants.UndoChangeTypeNodesId ); + //} + DataType = newType; + if( invalidateConnections ) + { + InvalidateAllConnections(); + } + else + { + NotifyExternalRefencesOnChange(); + } + } + } + + public virtual void ChangePortId( int newId ) { } + public virtual void NotifyExternalRefencesOnChange() { } + + public void UpdateInfoOnExternalConn( int nodeId, int portId, WirePortDataType type ) + { + for( int i = 0; i < m_externalReferences.Count; i++ ) + { + if( m_externalReferences[ i ].NodeId == nodeId && m_externalReferences[ i ].PortId == portId ) + { + m_externalReferences[ i ].DataType = type; + } + } + } + + public void InvalidateConnection( int nodeId, int portId ) + { + int id = -1; + for( int i = 0; i < m_externalReferences.Count; i++ ) + { + if( m_externalReferences[ i ].NodeId == nodeId && m_externalReferences[ i ].PortId == portId ) + { + id = i; + break; + } + } + + if( id > -1 ) + m_externalReferences.RemoveAt( id ); + } + + public void RemoveInvalidConnections() + { + Debug.Log( "Cleaning invalid connections" ); + List validConnections = new List(); + for( int i = 0; i < m_externalReferences.Count; i++ ) + { + if( m_externalReferences[ i ].IsValid ) + { + validConnections.Add( m_externalReferences[ i ] ); + } + else + { + Debug.Log( "Detected invalid connection on node " + m_nodeId + " port " + m_portId ); + } + } + m_externalReferences.Clear(); + m_externalReferences = validConnections; + } + + public void InvalidateAllConnections() + { + m_externalReferences.Clear(); + } + + public virtual void FullDeleteConnections() { } + + public bool IsConnectedTo( int nodeId, int portId ) + { + if( m_locked ) + return false; + + for( int i = 0; i < m_externalReferences.Count; i++ ) + { + if( m_externalReferences[ i ].NodeId == nodeId && m_externalReferences[ i ].PortId == portId ) + return true; + } + return false; + } + + public WirePortDataType ConnectionType( int id = 0 ) + { + return ( id < m_externalReferences.Count ) ? m_externalReferences[ id ].DataType : DataType; + } + + public bool CheckMatchConnectionType( int id = 0 ) + { + if( id < m_externalReferences.Count ) + return m_externalReferences[ id ].DataType == DataType; + + return false; + } + + public void MatchPortToConnection( int id = 0 ) + { + if( id < m_externalReferences.Count ) + { + DataType = m_externalReferences[ id ].DataType; + } + } + + public void ResetWireReferenceStatus() + { + for( int i = 0; i < m_externalReferences.Count; i++ ) + { + m_externalReferences[ i ].WireStatus = WireStatus.Default; + } + } + + public bool InsideActiveArea( Vector2 pos ) + { + return m_activePortArea.Contains( pos ); + } + + public void Click() + { + if( m_isEditable ) + { + if( ( EditorApplication.timeSinceStartup - m_lastTimeClicked ) < PortClickTime ) + { + m_editingName = true; + GUI.FocusControl( "port" + m_nodeId.ToString() + m_portId.ToString() ); + TextEditor te = (TextEditor)GUIUtility.GetStateObject( typeof( TextEditor ), GUIUtility.keyboardControl ); + if( te != null ) + { + te.SelectAll(); + } + } + + m_lastTimeClicked = EditorApplication.timeSinceStartup; + } + } + + public bool Draw( Rect textPos, GUIStyle style ) + { + bool changeFlag = false; + if( m_isEditable && m_editingName ) + { + textPos.width = m_labelSize.x; + EditorGUI.BeginChangeCheck(); + GUI.SetNextControlName( "port" + m_nodeId.ToString() + m_portId.ToString() ); + m_name = GUI.TextField( textPos, m_name, style ); + if( EditorGUI.EndChangeCheck() ) + { + m_dirtyLabelSize = true; + changeFlag = true; + } + + if( Event.current.isKey && ( Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter ) ) + { + m_editingName = false; + GUIUtility.keyboardControl = 0; + } + } + else + { + GUI.Label( textPos, m_name, style ); + } + //GUI.Label( textPos, string.Empty ); + return changeFlag; + } + + public void ResetEditing() + { + m_editingName = false; + } + + public virtual void ForceClearConnection() { } + + public bool IsConnected + { + get { return ( m_externalReferences.Count > 0 && !m_locked ); } + } + + public List ExternalReferences + { + get { return m_externalReferences; } + } + + public int ConnectionCount + { + get { return m_externalReferences.Count; } + } + + public Rect Position + { + get { return m_position; } + set { m_position = value; } + } + + public Rect LabelPosition + { + get { return m_labelPosition; } + set { m_labelPosition = value; } + } + + public int PortId + { + get { return m_portId; } + set { m_portId = value; } + } + + public int OrderId + { + get { return m_orderId; } + set { m_orderId = value; } + } + + + public int NodeId + { + get { return m_nodeId; } + set { m_nodeId = value; } + } + + public virtual WirePortDataType DataType + { + get { return m_dataType; } + set { m_dataType = value; } + } + + public bool Visible + { + get { return m_visible; } + set + { + m_visible = value; + if( !m_visible && IsConnected ) + { + ForceClearConnection(); + } + } + } + + public bool Locked + { + get { return m_locked; } + set + { + //if ( m_locked && IsConnected ) + //{ + // ForceClearConnection(); + //} + m_locked = value; + } + } + + public virtual string Name + { + get { return m_name; } + set { m_name = value; m_dirtyLabelSize = true; } + } + + public bool DirtyLabelSize + { + get { return m_dirtyLabelSize; } + set { m_dirtyLabelSize = value; } + } + + public bool HasCustomColor + { + get { return m_hasCustomColor; } + } + + public Color CustomColor + { + get { return m_customColor; } + set + { + m_hasCustomColor = true; + m_customColor = value; + } + } + + public Rect ActivePortArea + { + get { return m_activePortArea; } + set { m_activePortArea = value; } + } + + public Vector2 LabelSize + { + get { return m_labelSize; } + set { m_labelSize = value; } + } + + public Vector2 UnscaledLabelSize + { + get { return m_unscaledLabelSize; } + set { m_unscaledLabelSize = value; } + } + + public bool IsEditable + { + get { return m_isEditable; } + set { m_isEditable = value; } + } + + public bool Available { get { return m_visible && !m_locked; } } + public override string ToString() + { + string dump = ""; + dump += "Order: " + m_orderId + "\n"; + dump += "Name: " + m_name + "\n"; + dump += " Type: " + m_dataType; + dump += " NodeId : " + m_nodeId; + dump += " PortId : " + m_portId; + dump += "\nConnections:\n"; + foreach( WireReference wirePort in m_externalReferences ) + { + dump += wirePort + "\n"; + } + return dump; + } + + public bool RepeatButtonState + { + get { return m_repeatButtonState; } + set { m_repeatButtonState = value; } + } + public bool IsDummy { get { return m_isDummy; } } + public bool NotFreeForAllTypes { get { return m_portRestrictions != -1; } } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs.meta new file mode 100644 index 00000000..fc2ee96e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 4709687a4844c9545a254c2ddbf3ca63 +timeCreated: 1481126955 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs new file mode 100644 index 00000000..fb2b3472 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs @@ -0,0 +1,126 @@ +// Amplify Shader Editor - Visual Shader Editing Tool +// Copyright (c) Amplify Creations, Lda + +using System; +using UnityEngine; + +namespace AmplifyShaderEditor +{ + public enum WireStatus + { + Default = 0, + Highlighted, + Selected + } + + [Serializable] + public sealed class WireReference + { + private WireStatus m_status = WireStatus.Default; + + + + [SerializeField] + private int m_nodeId = -1; + [SerializeField] + private int m_portId = -1; + [SerializeField] + private WirePortDataType m_dataType = WirePortDataType.FLOAT; + [SerializeField] + private bool m_typeLocked = false; + + + + public WireReference() + { + m_nodeId = -1; + m_portId = -1; + m_dataType = WirePortDataType.FLOAT; + m_typeLocked = false; + m_status = WireStatus.Default; + } + + public WireReference( int nodeId, int portId, WirePortDataType dataType, bool typeLocked ) + { + m_portId = portId; + m_nodeId = nodeId; + m_dataType = dataType; + m_typeLocked = typeLocked; + m_status = WireStatus.Default; + } + + public void Invalidate() + { + m_nodeId = -1; + m_portId = -1; + m_typeLocked = false; + m_status = WireStatus.Default; + } + + public void SetReference( int nodeId, int portId, WirePortDataType dataType, bool typeLocked ) + { + m_nodeId = nodeId; + m_portId = portId; + m_dataType = dataType; + m_typeLocked = typeLocked; + } + + public void SetReference( WirePort port ) + { + m_nodeId = port.NodeId; + m_portId = port.PortId; + m_dataType = port.DataType; + } + + public bool IsValid + { + get { return ( m_nodeId != -1 && m_portId != -1 ); } + } + + public int NodeId + { + get { return m_nodeId; } + } + + public int PortId + { + get { return m_portId; } + set { m_portId = value; } + } + + public WirePortDataType DataType + { + get { return m_dataType; } + set { m_dataType = value; } + } + + public bool TypeLocked + { + get { return m_typeLocked; } + } + + public WireStatus WireStatus + { + get { return m_status; } + set { m_status = value; } + } + + public override string ToString() + { + string dump = ""; + dump += "* Wire Reference *\n"; + dump += "NodeId : " + m_nodeId + "\n"; + dump += "PortId : " + m_portId + "\n"; + dump += "DataType " + m_dataType + "\n"; ; + return dump; + } + + public void WriteToString( ref string myString ) + { + IOUtils.AddFieldToString( ref myString, "PortId", m_portId ); + IOUtils.AddFieldToString( ref myString, "NodeID", m_nodeId ); + IOUtils.AddFieldToString( ref myString, "DataType", m_dataType ); + IOUtils.AddFieldToString( ref myString, "TypeLocked", m_typeLocked ); + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs.meta b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs.meta new file mode 100644 index 00000000..e3c37585 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 99fb607e60678c44da002d6b694400dc +timeCreated: 1481126957 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources.meta new file mode 100644 index 00000000..82d54d77 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0932db7ec1402c2489679c4b72eab5eb +folderAsset: yes +timeCreated: 1481126943 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/GUISkins.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/GUISkins.meta new file mode 100644 index 00000000..18ce2da9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/GUISkins.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0ecdc2c57c073bd4796f1ae8da7f851f +folderAsset: yes +timeCreated: 1481126943 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin new file mode 100644 index 00000000..58289c64 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin @@ -0,0 +1,5340 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 1 + m_Script: {fileID: 12001, guid: 0000000000000000e000000000000000, type: 0} + m_Name: MainSkin + m_EditorClassIdentifier: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_box: + m_Name: box + m_Normal: + m_Background: {fileID: 2800000, guid: a702c1245d15ddb48b8fba73bf951a65, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.79999995, g: 0.79999995, b: 0.79999995, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 1 + m_Right: 1 + m_Top: 1 + m_Bottom: 1 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 1 + m_Right: 1 + m_Top: 1 + m_Bottom: 1 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_button: + m_Name: button + m_Normal: + m_Background: {fileID: 2800000, guid: 87629cdfe03457046b57a25b1ea3096d, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 87629cdfe03457046b57a25b1ea3096d, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 87629cdfe03457046b57a25b1ea3096d, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: 87629cdfe03457046b57a25b1ea3096d, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 6c0712566778b3f4383fc3bb16edc880, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: 6c0712566778b3f4383fc3bb16edc880, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: 6c0712566778b3f4383fc3bb16edc880, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_toggle: + m_Name: toggle + m_Normal: + m_Background: {fileID: 11018, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.89112896, g: 0.89112896, b: 0.89112896, a: 1} + m_Hover: + m_Background: {fileID: 11014, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 11013, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 11016, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.8901961, g: 0.8901961, b: 0.8901961, a: 1} + m_OnHover: + m_Background: {fileID: 11015, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 11017, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 14 + m_Right: 0 + m_Top: 14 + m_Bottom: 0 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 15 + m_Right: 0 + m_Top: 3 + m_Bottom: 0 + m_Overflow: + m_Left: -1 + m_Right: 0 + m_Top: -4 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_label: + m_Name: label + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 15 + m_FontStyle: 0 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + m_textField: + m_Name: textfield + m_Normal: + m_Background: {fileID: 11024, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.79999995, g: 0.79999995, b: 0.79999995, a: 1} + m_Hover: + m_Background: {fileID: 11026, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.9, g: 0.9, b: 0.9, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 11026, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 11025, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 3 + m_Right: 3 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 11 + m_FontStyle: 0 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 3 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_textArea: + m_Name: textarea + m_Normal: + m_Background: {fileID: 11024, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.9019608, g: 0.9019608, b: 0.9019608, a: 1} + m_Hover: + m_Background: {fileID: 11026, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.79999995, g: 0.79999995, b: 0.79999995, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 11025, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 3 + m_Right: 3 + m_Top: 3 + m_Bottom: 3 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 1 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_window: + m_Name: window + m_Normal: + m_Background: {fileID: 2800000, guid: bd8a303795331fe48b05eee287c0b3e5, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: bd8a303795331fe48b05eee287c0b3e5, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 4fdd9ad2fb20f14438637f9b085fbe81, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: bd8a303795331fe48b05eee287c0b3e5, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: bd8a303795331fe48b05eee287c0b3e5, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: bd8a303795331fe48b05eee287c0b3e5, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: 4fdd9ad2fb20f14438637f9b085fbe81, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: bd8a303795331fe48b05eee287c0b3e5, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 7 + m_Right: 7 + m_Top: 37 + m_Bottom: 7 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 10 + m_Right: 10 + m_Top: 25 + m_Bottom: 10 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 10 + m_FontStyle: 1 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: -18} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_horizontalSlider: + m_Name: horizontalslider + m_Normal: + m_Background: {fileID: 11009, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 3 + m_Right: 3 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: -1 + m_Right: -1 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: -2 + m_Bottom: -3 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 12 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_horizontalSliderThumb: + m_Name: horizontalsliderthumb + m_Normal: + m_Background: {fileID: 11011, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 11012, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 11010, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 4 + m_Right: 4 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 7 + m_Right: 7 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: -1 + m_Right: -1 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 12 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_verticalSlider: + m_Name: verticalslider + m_Normal: + m_Background: {fileID: 11021, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 3 + m_Bottom: 3 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: -1 + m_Bottom: -1 + m_Overflow: + m_Left: -2 + m_Right: -3 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 12 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 1 + m_verticalSliderThumb: + m_Name: verticalsliderthumb + m_Normal: + m_Background: {fileID: 11011, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 11012, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 11010, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 7 + m_Bottom: 7 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: -1 + m_Bottom: -1 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 12 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 1 + m_horizontalScrollbar: + m_Name: horizontalscrollbar + m_Normal: + m_Background: {fileID: 11008, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 9 + m_Right: 9 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 1 + m_Bottom: 4 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 15 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_horizontalScrollbarThumb: + m_Name: horizontalscrollbarthumb + m_Normal: + m_Background: {fileID: 11007, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 6 + m_Right: 6 + m_Top: 6 + m_Bottom: 6 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 6 + m_Right: 6 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: -1 + m_Bottom: 1 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 13 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_horizontalScrollbarLeftButton: + m_Name: horizontalscrollbarleftbutton + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_horizontalScrollbarRightButton: + m_Name: horizontalscrollbarrightbutton + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_verticalScrollbar: + m_Name: verticalscrollbar + m_Normal: + m_Background: {fileID: 11020, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 9 + m_Bottom: 9 + m_Margin: + m_Left: 1 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 1 + m_Bottom: 1 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 15 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_verticalScrollbarThumb: + m_Name: verticalscrollbarthumb + m_Normal: + m_Background: {fileID: 11019, guid: 0000000000000000e000000000000000, type: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 6 + m_Right: 6 + m_Top: 6 + m_Bottom: 6 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 6 + m_Bottom: 6 + m_Overflow: + m_Left: -1 + m_Right: -1 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 15 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 1 + m_verticalScrollbarUpButton: + m_Name: verticalscrollbarupbutton + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_verticalScrollbarDownButton: + m_Name: verticalscrollbardownbutton + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_ScrollView: + m_Name: scrollview + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_CustomStyles: + - m_Name: NodeWindowOff + m_Normal: + m_Background: {fileID: 2800000, guid: 60c283ffa9a758646ab70a2fe7ff5f71, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 6 + m_Right: 6 + m_Top: 6 + m_Bottom: 6 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 1 + m_Right: 1 + m_Top: 1 + m_Bottom: 1 + m_Font: {fileID: 0} + m_FontSize: 13 + m_FontStyle: 1 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: -18} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: NodeWindowOn + m_Normal: + m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 6 + m_Right: 6 + m_Top: 6 + m_Bottom: 6 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 2 + m_Right: 2 + m_Top: 2 + m_Bottom: 2 + m_Font: {fileID: 0} + m_FontSize: 6 + m_FontStyle: 1 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: NodeTitle + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 13 + m_FontStyle: 1 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 3 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 1 + - m_Name: NodeHeader + m_Normal: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 6 + m_Right: 6 + m_Top: 6 + m_Bottom: 4 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 1 + m_Right: 1 + m_Top: 1 + m_Bottom: 1 + m_Font: {fileID: 0} + m_FontSize: 13 + m_FontStyle: 1 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: CommentaryHeader + m_Normal: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 7 + m_Right: 7 + m_Top: 7 + m_Bottom: 7 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 1 + m_Right: 1 + m_Top: 1 + m_Bottom: 1 + m_Font: {fileID: 0} + m_FontSize: 15 + m_FontStyle: 1 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 1 + m_ContentOffset: {x: 8, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: ShaderLibraryTitle + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 7 + m_Right: 7 + m_Top: 7 + m_Bottom: 7 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 23 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 20 + m_FontStyle: 1 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: ShaderLibraryAddToList + m_Normal: + m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 20 + m_FontStyle: 0 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 23 + m_FixedHeight: 21 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: ShaderLibraryRemoveFromList + m_Normal: + m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 20 + m_FontStyle: 1 + m_Alignment: 2 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 23 + m_FixedHeight: 21 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: ShaderLibraryOpenListed + m_Normal: + m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 20 + m_FontStyle: 1 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 23 + m_FixedHeight: 21 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: ShaderLibrarySelectionAsTemplate + m_Normal: + m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 20 + m_FontStyle: 1 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 23 + m_FixedHeight: 21 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: ShaderLibraryItem + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 10 + m_Right: 10 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 15 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: CommentaryTitle + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 10 + m_Right: 10 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 15 + m_FontStyle: 1 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: PortEmptyIcon + m_Normal: + m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: PortFullIcon + m_Normal: + m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: InputPortLabel + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 10 + m_Right: 10 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 15 + m_FontStyle: 0 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 3 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 1 + - m_Name: OutputPortLabel + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 15 + m_FontStyle: 0 + m_Alignment: 5 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: CommentaryResizeButton + m_Normal: + m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 15 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: CommentaryResizeButtonInv + m_Normal: + m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 15 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: CommentaryBackground + m_Normal: + m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 6 + m_Right: 6 + m_Top: 6 + m_Bottom: 6 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 1 + m_Right: 1 + m_Top: 1 + m_Bottom: 1 + m_Font: {fileID: 0} + m_FontSize: 15 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: -18} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: MinimizeButton + m_Normal: + m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 15 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: MaximizeButton + m_Normal: + m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 15 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: NodePropertiesTitle + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 15 + m_FontStyle: 1 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: ShaderModeTitle + m_Normal: + m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Hover: + m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Active: + m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Focused: + m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnNormal: + m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnHover: + m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnActive: + m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnFocused: + m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Border: + m_Left: 30 + m_Right: 0 + m_Top: 0 + m_Bottom: 38 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 14 + m_FontStyle: 1 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 34, y: -1} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 1 + - m_Name: MaterialModeTitle + m_Normal: + m_Background: {fileID: 2800000, guid: 5725fa8ee04e1be449af059f5735cd81, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Hover: + m_Background: {fileID: 2800000, guid: 5725fa8ee04e1be449af059f5735cd81, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Focused: + m_Background: {fileID: 2800000, guid: 5725fa8ee04e1be449af059f5735cd81, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 5725fa8ee04e1be449af059f5735cd81, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnHover: + m_Background: {fileID: 2800000, guid: 5725fa8ee04e1be449af059f5735cd81, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnFocused: + m_Background: {fileID: 2800000, guid: 5725fa8ee04e1be449af059f5735cd81, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Border: + m_Left: 0 + m_Right: 40 + m_Top: 0 + m_Bottom: 38 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 14 + m_FontStyle: 1 + m_Alignment: 5 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: -44, y: -1} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 1 + - m_Name: ShaderNoMaterialModeTitle + m_Normal: + m_Background: {fileID: 2800000, guid: 7040748e1c49b9648aeeefef41c8a3d5, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Hover: + m_Background: {fileID: 2800000, guid: 7040748e1c49b9648aeeefef41c8a3d5, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Focused: + m_Background: {fileID: 2800000, guid: 7040748e1c49b9648aeeefef41c8a3d5, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 7040748e1c49b9648aeeefef41c8a3d5, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnHover: + m_Background: {fileID: 2800000, guid: 7040748e1c49b9648aeeefef41c8a3d5, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnActive: + m_Background: {fileID: 2800000, guid: 7040748e1c49b9648aeeefef41c8a3d5, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnFocused: + m_Background: {fileID: 2800000, guid: 7040748e1c49b9648aeeefef41c8a3d5, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 14 + m_FontStyle: 1 + m_Alignment: 5 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: -44, y: 9} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: PropertyValuesTitle + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5882353} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 11 + m_FontStyle: 3 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 3 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 1 + - m_Name: ShaderModeNoShader + m_Normal: + m_Background: {fileID: 2800000, guid: df81b9531d8ef704f96072ce6910db68, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Border: + m_Left: 30 + m_Right: 0 + m_Top: 0 + m_Bottom: 38 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 14 + m_FontStyle: 1 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 34, y: -1} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 1 + - m_Name: MainCanvasTitle + m_Normal: + m_Background: {fileID: 2800000, guid: bdb42c87b8801e94e886c5c0d60b3014, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.41911763, g: 0.41911763, b: 0.41911763, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 6 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 17 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 1 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: ShaderBorder + m_Normal: + m_Background: {fileID: 2800000, guid: 555b6a287b4121b479d412e6ea92bb2e, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 10 + m_Right: 10 + m_Top: 10 + m_Bottom: 10 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 17 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: MaterialBorder + m_Normal: + m_Background: {fileID: 2800000, guid: 157b94751c138d84bbe1768c672b5168, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 10 + m_Right: 10 + m_Top: 10 + m_Bottom: 10 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 17 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: SamplerTextureRef + m_Normal: + m_Background: {fileID: 2800000, guid: f9bd85ea2601b824c87556c13e852933, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 13 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 1 + - m_Name: SamplerTextureIcon + m_Normal: + m_Background: {fileID: 2800000, guid: 7cabe27e9427ef346a6b6557106353fd, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 7cabe27e9427ef346a6b6557106353fd, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 13 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: CustomExpressionAddItem + m_Normal: + m_Background: {fileID: 2800000, guid: 7eb057fdbf020504fb6c9c3c78031e5e, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 52bbe770f45f531419e44a69be67ccba, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Border: + m_Left: 12 + m_Right: 0 + m_Top: 12 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 15 + m_Right: 3 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: -2 + m_Right: 0 + m_Top: -4 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 17 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: CustomExpressionRemoveItem + m_Normal: + m_Background: {fileID: 2800000, guid: 839cb1530f95ad14ab58762161a9cb06, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 1ba096552f9cbbb418ee2286856bb352, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Border: + m_Left: 12 + m_Right: 0 + m_Top: 12 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 15 + m_Right: 3 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: -2 + m_Right: 0 + m_Top: -4 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 17 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: CustomExpressionSmallAddItem + m_Normal: + m_Background: {fileID: 2800000, guid: 1bd93c39ca74ac041b79ae289e9b9f08, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 1bd93c39ca74ac041b79ae289e9b9f08, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 13 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 1 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 20 + m_FixedHeight: 18 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: CustomExpressionSmallRemoveItem + m_Normal: + m_Background: {fileID: 2800000, guid: f4d31aa109c919d4595094f627510932, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: f4d31aa109c919d4595094f627510932, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 13 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 1 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 25 + m_FixedHeight: 18 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: ResetToDefaultInspectorButton + m_Normal: + m_Background: {fileID: 2800000, guid: a51794475a883744db8d524cee84e5fc, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: a51794475a883744db8d524cee84e5fc, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 2 + m_Top: 6 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: -2 + m_Right: 2 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 13 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 10 + m_FixedHeight: 9 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: SliderStyle + m_Normal: + m_Background: {fileID: 2800000, guid: 4cabb2d6785b8aa4db0c0a34e1e00f04, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 3 + m_Right: 3 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: ObjectPicker + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: + - {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 8 + m_Right: 31 + m_Top: 0 + m_Bottom: 16 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 0 + m_Right: 3 + m_Top: 0 + m_Bottom: 1 + m_Overflow: + m_Left: -24 + m_Right: -1 + m_Top: 0 + m_Bottom: -1 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 8 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 3 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: NodePropertyPicker + m_Normal: + m_Background: {fileID: 2800000, guid: 94816692c85001f4dab01ec3666943c0, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 16 + m_FixedHeight: 16 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: NodePreviewExpander + m_Normal: + m_Background: {fileID: 2800000, guid: 1f3a46793c375864ab816c0d78061e4e, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 16 + m_FixedHeight: 16 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: NodePreviewCollapser + m_Normal: + m_Background: {fileID: 2800000, guid: dae54b5aa457b474e8a1599de1073d26, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 16 + m_FixedHeight: 16 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: SamplerButton + m_Normal: + m_Background: {fileID: 2800000, guid: b57dd36838fb19c449fd4559efe3f800, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Border: + m_Left: 2 + m_Right: 0 + m_Top: 2 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 1 + m_Top: 0 + m_Bottom: -1 + m_Overflow: + m_Left: 0 + m_Right: 1 + m_Top: 0 + m_Bottom: 1 + m_Font: {fileID: 3021071571035331536, guid: 0000000000000000d000000000000000, + type: 0} + m_FontSize: 9 + m_FontStyle: 0 + m_Alignment: 5 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 3 + m_ContentOffset: {x: 0, y: 1} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: SamplerFrame + m_Normal: + m_Background: {fileID: 2800000, guid: c1912a55d2f211d468ddeb7b1386dd41, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Border: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 3 + m_Right: 3 + m_Top: 3 + m_Bottom: 3 + m_Overflow: + m_Left: 1 + m_Right: 1 + m_Top: 1 + m_Bottom: 1 + m_Font: {fileID: 3021071571035331536, guid: 0000000000000000d000000000000000, + type: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: CommentarySuperTitle + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5882353} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_Border: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 3 + m_Right: 3 + m_Top: 3 + m_Bottom: 3 + m_Overflow: + m_Left: 1 + m_Right: 1 + m_Top: 1 + m_Bottom: 1 + m_Font: {fileID: 3021071571035331536, guid: 0000000000000000d000000000000000, + type: 0} + m_FontSize: 18 + m_FontStyle: 2 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 3 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: MiniButtonBotLeft + m_Normal: + m_Background: {fileID: 2800000, guid: 9f2d5e61dd9821b44a410f36519781d7, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Hover: + m_Background: {fileID: 2800000, guid: 6f3901bfd2342774ba74e117e43d6db7, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 4c872bb553406fe44a9d0046a0ef9bc5, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: 7ef06ce40d713d34790e78278ee82dea, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Border: + m_Left: 1 + m_Right: 2 + m_Top: 2 + m_Bottom: 1 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 1 + m_Right: 0 + m_Top: 1 + m_Bottom: 0 + m_Font: {fileID: 3021071571035331536, guid: 0000000000000000d000000000000000, + type: 0} + m_FontSize: 9 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: MiniButtonBotMid + m_Normal: + m_Background: {fileID: 2800000, guid: eaf512a569994074b9b268ff098b0f03, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Hover: + m_Background: {fileID: 2800000, guid: c86cb249299fb7249b5ee7fb27ef1951, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 133e79bed45185d408f4c5410f89dded, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: 542d7546736ddd244a145ef7103678fb, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Border: + m_Left: 1 + m_Right: 1 + m_Top: 2 + m_Bottom: 1 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 1 + m_Bottom: 0 + m_Font: {fileID: 3021071571035331536, guid: 0000000000000000d000000000000000, + type: 0} + m_FontSize: 9 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: MiniButtonBotRight + m_Normal: + m_Background: {fileID: 2800000, guid: bfcecef29876cc54db85363cf2feebb2, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Hover: + m_Background: {fileID: 2800000, guid: df6fb8448a382c743bd124cc0da55113, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 3821e905373e9fb4aac56ad254ba5769, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: d3098ebd60a35494e9977bd96b923298, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Border: + m_Left: 1 + m_Right: 2 + m_Top: 2 + m_Bottom: 1 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 1 + m_Top: 1 + m_Bottom: 0 + m_Font: {fileID: 3021071571035331536, guid: 0000000000000000d000000000000000, + type: 0} + m_FontSize: 9 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: ShaderFunctionBorder + m_Normal: + m_Background: {fileID: 2800000, guid: 94cd628d3d8e07d40a85d82b3fdad15d, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: + - {fileID: -3646434626659933611, guid: 0000000000000000d000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: + - {fileID: -3080321147634112521, guid: 0000000000000000d000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: + - {fileID: -3976217546018649614, guid: 0000000000000000d000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Border: + m_Left: 10 + m_Right: 10 + m_Top: 10 + m_Bottom: 10 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 17 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: ShaderFunctionMode + m_Normal: + m_Background: {fileID: 2800000, guid: 68897d376b60748438e0ae3474ebe558, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: + - {fileID: -3646434626659933611, guid: 0000000000000000d000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: + - {fileID: -3080321147634112521, guid: 0000000000000000d000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: + - {fileID: -3976217546018649614, guid: 0000000000000000d000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Border: + m_Left: 30 + m_Right: 0 + m_Top: 0 + m_Bottom: 38 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 14 + m_FontStyle: 1 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 34, y: -1} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 1 + - m_Name: RightShaderMode + m_Normal: + m_Background: {fileID: 2800000, guid: 5725fa8ee04e1be449af059f5735cd81, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: + - {fileID: -3646434626659933611, guid: 0000000000000000d000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: + - {fileID: -3080321147634112521, guid: 0000000000000000d000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: + - {fileID: -3976217546018649614, guid: 0000000000000000d000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Border: + m_Left: 0 + m_Right: 40 + m_Top: 0 + m_Bottom: 38 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 14 + m_FontStyle: 1 + m_Alignment: 5 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 3 + m_ContentOffset: {x: -44, y: -1} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 1 + - m_Name: FlatBackground + m_Normal: + m_Background: {fileID: 2800000, guid: 44efd0011d6a9bc4fb0b3a82753dac4e, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: + - {fileID: -3646434626659933611, guid: 0000000000000000d000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: + - {fileID: -3080321147634112521, guid: 0000000000000000d000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: + - {fileID: -3976217546018649614, guid: 0000000000000000d000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 11 + m_FontStyle: 1 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 3 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: DocumentationLink + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.29803923, g: 0.49019608, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 1004d06b4b28f5943abdf2313a22790a, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 1004d06b4b28f5943abdf2313a22790a, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7019608, g: 0.7019608, b: 0.7019608, a: 1} + m_Focused: + m_Background: {fileID: 2800000, guid: 1004d06b4b28f5943abdf2313a22790a, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.2985075, g: 0.4923412, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: 1004d06b4b28f5943abdf2313a22790a, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.2985075, g: 0.4923412, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: 1004d06b4b28f5943abdf2313a22790a, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.2985075, g: 0.4923412, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 2 + m_Bottom: 2 + m_Padding: + m_Left: 2 + m_Right: 2 + m_Top: 1 + m_Bottom: 2 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 9 + m_FontStyle: 0 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: GraphButtonIcon + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 2 + m_Right: 2 + m_Top: 2 + m_Bottom: 2 + m_Overflow: + m_Left: 2 + m_Right: 2 + m_Top: 2 + m_Bottom: 2 + m_Font: {fileID: 0} + m_FontSize: 10 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: GraphButton + m_Normal: + m_Background: {fileID: 2800000, guid: 2b3b7485f95e8a44dab3fa9610f56cbb, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: dd3411e8d9927d3429d5872dbdbd752b, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 3 + m_Right: 3 + m_Top: 3 + m_Bottom: 3 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 4 + m_Right: 4 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 1 + m_Right: 1 + m_Top: 1 + m_Bottom: 1 + m_Font: {fileID: 0} + m_FontSize: 10 + m_FontStyle: 0 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: NodeWindowOffSquare + m_Normal: + m_Background: {fileID: 2800000, guid: d179c8744f837da49ab92aae04d1ae1c, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 1 + m_Right: 1 + m_Top: 1 + m_Bottom: 1 + m_Font: {fileID: 0} + m_FontSize: 13 + m_FontStyle: 1 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: -18} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: NodeHeaderSquare + m_Normal: + m_Background: {fileID: 2800000, guid: b16188b8a3dee8146bd9cb0bde234a24, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 1 + m_Right: 1 + m_Top: 1 + m_Bottom: 1 + m_Font: {fileID: 0} + m_FontSize: 13 + m_FontStyle: 1 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: NodeWindowOnSquare + m_Normal: + m_Background: {fileID: 2800000, guid: 080a030f87555fe419ecc1fb9f509118, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 6 + m_Right: 6 + m_Top: 6 + m_Bottom: 6 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 2 + m_Right: 2 + m_Top: 2 + m_Bottom: 2 + m_Font: {fileID: 0} + m_FontSize: 6 + m_FontStyle: 1 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: ConsoleLogMessage + m_Normal: + m_Background: {fileID: 2800000, guid: c560c5d8ca4c353409caf2ec204f3a19, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 8 + m_Right: 8 + m_Top: 8 + m_Bottom: 8 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 10 + m_FontStyle: 0 + m_Alignment: 8 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: ConsoleLogCircle + m_Normal: + m_Background: {fileID: 2800000, guid: c560c5d8ca4c353409caf2ec204f3a19, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_Hover: + m_Background: {fileID: 2800000, guid: c560c5d8ca4c353409caf2ec204f3a19, type: 3} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 8 + m_Right: 8 + m_Top: 8 + m_Bottom: 8 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 10 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 0 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + m_Settings: + m_DoubleClickSelectsWord: 0 + m_TripleClickSelectsLine: 0 + m_CursorColor: {r: 1, g: 1, b: 1, a: 1} + m_CursorFlashSpeed: -1 + m_SelectionColor: {r: 1, g: 0.38403907, b: 0, a: 0.7} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin.meta new file mode 100644 index 00000000..95b1e650 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 57482289c346f104a8162a3a79aaff9d +timeCreated: 1481127067 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes.meta new file mode 100644 index 00000000..09c8ef6f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 74a246631cfb81b4eb720dba241ad84c +folderAsset: yes +timeCreated: 1481126944 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png new file mode 100644 index 00000000..58ba3398 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:417a067f8ad86f2dce83102b7badac0b0fdca5617cdea8146f3efc27ca5530b9 +size 174 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png.meta new file mode 100644 index 00000000..a5da5792 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png.meta @@ -0,0 +1,66 @@ +fileFormatVersion: 2 +guid: 06e687f68dd96f0448c6d8217bbcf608 +timeCreated: 1481126972 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: 16 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 5 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png new file mode 100644 index 00000000..59db4b5f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bb3758006768252a70e8de2fc9e752956f63b95884169911e9742215811ba44 +size 19742 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png.meta new file mode 100644 index 00000000..c3776115 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png.meta @@ -0,0 +1,65 @@ +fileFormatVersion: 2 +guid: 486c7766baaf21b46afb63c1121ef03e +timeCreated: 1481126990 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 1 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png new file mode 100644 index 00000000..8eceefec --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27cc2d7758ed3d3f039b05d1eaf26660d08e3de47297a82791917a0ae36e2d6d +size 20254 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png.meta new file mode 100644 index 00000000..df31fe94 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png.meta @@ -0,0 +1,65 @@ +fileFormatVersion: 2 +guid: 4b0c2926cc71c5846ae2a29652d54fb6 +timeCreated: 1481126990 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png new file mode 100644 index 00000000..76929fdf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9cc83080df132f033c2a074d5bc7424ed9e3bdeeed76e9be36883ddd51fee9ff +size 18334 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png.meta new file mode 100644 index 00000000..ee057362 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 7cabe27e9427ef346a6b6557106353fd +timeCreated: 1481126999 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png new file mode 100644 index 00000000..6acdf96f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f5948f7f6523ce1db7e23670965637c337affecbbdf0dad81207aeedb344036 +size 23236 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png.meta new file mode 100644 index 00000000..88cd06c8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png.meta @@ -0,0 +1,65 @@ +fileFormatVersion: 2 +guid: 712aee08d999c16438e2d694f42428e8 +timeCreated: 1481126996 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png new file mode 100644 index 00000000..58cb8f93 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a875696c13664ed3805159f4a1a66f04a85c4380056ae3ca625298f661d902c9 +size 23337 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png.meta new file mode 100644 index 00000000..c14c8ca4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png.meta @@ -0,0 +1,65 @@ +fileFormatVersion: 2 +guid: 26c64fcee91024a49980ea2ee9d1a2fb +timeCreated: 1481126983 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png new file mode 100644 index 00000000..1c09383a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:91d849f6c5815f0e6e4794d929fe0238b01b05c3d0a0c277191785981e453ee8 +size 788 diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources/hbao_urp.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png.meta similarity index 86% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources/hbao_urp.png.meta rename to Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png.meta index d1eb3e9c..22b12be1 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources/hbao_urp.png.meta +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png.meta @@ -1,14 +1,14 @@ fileFormatVersion: 2 -guid: ef156e8079ba9474aa9c13a37223ef49 +guid: f9bd85ea2601b824c87556c13e852933 TextureImporter: internalIDToNameTable: [] externalObjects: {} - serializedVersion: 10 + serializedVersion: 11 mipmaps: mipMapMode: 0 enableMipMap: 0 sRGBTexture: 1 - linearTexture: 0 + linearTexture: 1 fadeOut: 0 borderMipMap: 0 mipMapsPreserveCoverage: 0 @@ -27,16 +27,16 @@ TextureImporter: generateCubemap: 6 cubemapConvolution: 0 seamlessCubemap: 0 - textureFormat: 1 + textureFormat: -1 maxTextureSize: 2048 textureSettings: serializedVersion: 2 - filterMode: -1 + filterMode: 1 aniso: 1 - mipBias: -100 + mipBias: 0 wrapU: 1 wrapV: 1 - wrapW: -1 + wrapW: 1 nPOTScale: 0 lightmap: 0 compressionQuality: 50 @@ -57,6 +57,7 @@ TextureImporter: maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 + applyGammaDecoding: 1 platformSettings: - serializedVersion: 3 buildTarget: DefaultTexturePlatform @@ -113,3 +114,10 @@ TextureImporter: userData: assetBundleName: assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews.meta new file mode 100644 index 00000000..5bdab963 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 461082514f2c69d4a9cc883cd0fe7891 +folderAsset: yes +timeCreated: 1488289754 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr new file mode 100644 index 00000000..25473e58 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b11611f62053b78b02ffd9a165cf1870272876afa70fa88d4eed48bd05728af +size 164430 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr.meta new file mode 100644 index 00000000..c6ad9e69 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: ef7513b54a0670140b9b967af7620563 +timeCreated: 1512052044 +licenseType: Store +TextureImporter: + fileIDToRecycleName: + 8900000: generatedCubemap + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 1 + seamlessCubemap: 1 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: 0 + mipBias: 0 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 2 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 100 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader new file mode 100644 index 00000000..899203d2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader @@ -0,0 +1,233 @@ +Shader "Hidden/LinearMaterial" +{ + Properties + { + _MainTex( "Texture", any ) = "" {} + _BackGround( "Back", 2D) = "white" {} + } + + SubShader + { + Lighting Off + Blend SrcAlpha OneMinusSrcAlpha + Cull Off + ZWrite Off + ZTest Always + + CGINCLUDE + uniform float4x4 unity_GUIClipTextureMatrix; + sampler2D _GUIClipTexture; + + Texture2D _MainTex; + SamplerState sampler_MainTex; + uniform float4 _MainTex_ST; + + SamplerState my_linear_clamp_sampler; + + uniform bool _ManualTex2SRGB; + + ENDCG + + + Pass { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 2.0 + + #include "UnityCG.cginc" + + float4 _Mask; + + + struct appdata_t { + float4 vertex : POSITION; + float2 texcoord : TEXCOORD0; + }; + + struct v2f { + float4 vertex : SV_POSITION; + float2 texcoord : TEXCOORD0; + float2 clipUV : TEXCOORD1; + }; + + v2f vert( appdata_t v ) + { + v2f o; + o.vertex = UnityObjectToClipPos( v.vertex ); + o.texcoord = TRANSFORM_TEX( v.texcoord.xy, _MainTex ); + float3 eyePos = UnityObjectToViewPos( v.vertex ); + o.clipUV = mul( unity_GUIClipTextureMatrix, float4( eyePos.xy, 0, 1.0 ) ); + return o; + } + + float4 frag( v2f i ) : SV_Target + { + float4 c = _MainTex.Sample( my_linear_clamp_sampler, i.texcoord ); + if (_ManualTex2SRGB) c.rgb = LinearToGammaSpace(c.rgb); + c.rgb *= _Mask.rgb; + + c.a = tex2D( _GUIClipTexture, i.clipUV ).a; + return c; + } + ENDCG + } + + Pass { // sphere preview = true, alpha mask = false + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 2.0 + + #include "UnityCG.cginc" + + float _InvertedZoom; + float4 _Mask; + + struct appdata_t { + float4 vertex : POSITION; + float2 texcoord : TEXCOORD0; + }; + + struct v2f { + float4 vertex : SV_POSITION; + float2 texcoord : TEXCOORD0; + float2 clipUV : TEXCOORD1; + }; + + v2f vert( appdata_t v ) + { + v2f o; + o.vertex = UnityObjectToClipPos( v.vertex ); + o.texcoord = TRANSFORM_TEX( v.texcoord.xy, _MainTex ); + float3 eyePos = UnityObjectToViewPos( v.vertex ); + o.clipUV = mul( unity_GUIClipTextureMatrix, float4( eyePos.xy, 0, 1.0 ) ); + return o; + } + + float4 frag( v2f i ) : SV_Target + { + float2 p = 2 * i.texcoord - 1; + float r = sqrt( dot( p,p ) ); + + float alpha = saturate( ( 1 - r )*( 45 * _InvertedZoom + 5 ) ); + + float4 c = _MainTex.Sample( sampler_MainTex, i.texcoord ); + if (_ManualTex2SRGB) c.rgb = LinearToGammaSpace(c.rgb); + + c.rgb *= _Mask.rgb; + c.rgb *= alpha; + + c.a = tex2D( _GUIClipTexture, i.clipUV ).a; + return c; + } + ENDCG + } + + Pass { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 2.0 + + #include "UnityCG.cginc" + + sampler2D _BackGround; + uniform float4 _BackGround_ST; + float _InvertedZoom; + float4 _Mask; + + + struct appdata_t { + float4 vertex : POSITION; + float2 texcoord : TEXCOORD0; + }; + + struct v2f { + float4 vertex : SV_POSITION; + float2 texcoord : TEXCOORD0; + float2 clipUV : TEXCOORD1; + }; + + v2f vert( appdata_t v ) + { + v2f o; + o.vertex = UnityObjectToClipPos( v.vertex ); + o.texcoord = TRANSFORM_TEX( v.texcoord.xy, _MainTex ); + float3 eyePos = UnityObjectToViewPos( v.vertex ); + o.clipUV = mul( unity_GUIClipTextureMatrix, float4( eyePos.xy, 0, 1.0 ) ); + return o; + } + + float4 frag( v2f i ) : SV_Target + { + float3 back = tex2D( _BackGround, ( i.texcoord * 2 - 1 ) * _InvertedZoom).b; + + float4 c = _MainTex.Sample( sampler_MainTex, i.texcoord ); + if (_ManualTex2SRGB) c.rgb = LinearToGammaSpace(c.rgb); + + c.rgb *= _Mask.rgb; + c.rgb = lerp( back, c.rgb, c.a ); + + c.a = tex2D( _GUIClipTexture, i.clipUV ).a; + return c; + } + ENDCG + } + + Pass { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 2.0 + + #include "UnityCG.cginc" + + sampler2D _BackGround; + uniform float4 _BackGround_ST; + float _InvertedZoom; + float4 _Mask; + + struct appdata_t { + float4 vertex : POSITION; + float2 texcoord : TEXCOORD0; + }; + + struct v2f { + float4 vertex : SV_POSITION; + float2 texcoord : TEXCOORD0; + float2 clipUV : TEXCOORD1; + }; + + v2f vert( appdata_t v ) + { + v2f o; + o.vertex = UnityObjectToClipPos( v.vertex ); + o.texcoord = TRANSFORM_TEX( v.texcoord.xy, _MainTex ); + float3 eyePos = UnityObjectToViewPos( v.vertex ); + o.clipUV = mul( unity_GUIClipTextureMatrix, float4( eyePos.xy, 0, 1.0 ) ); + return o; + } + + float4 frag( v2f i ) : SV_Target + { + float2 p = 2 * i.texcoord - 1; + float3 back = tex2D( _BackGround, p * _InvertedZoom).b; + float r = sqrt( dot( p,p ) ); + + float alpha = saturate( ( 1 - r )*( 45 * _InvertedZoom + 5 ) ); + + float4 c = 0; + c = _MainTex.Sample( sampler_MainTex, i.texcoord ); + if (_ManualTex2SRGB) c.rgb = LinearToGammaSpace(c.rgb); + c.rgb *= _Mask.rgb; + c.rgb = lerp( back, c.rgb, c.a * alpha); + + c.a = tex2D( _GUIClipTexture, i.clipUV ).a; + return c; + } + ENDCG + } + } + Fallback Off +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader.meta new file mode 100644 index 00000000..74b835e3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: e90ef6ea05743b84baf9549874c52e47 +timeCreated: 1489078120 +licenseType: Store +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _BackGround: {fileID: 2800000, guid: 750b1bd7ba8bd28489650de6d0a95cc5, type: 3} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview.cginc b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview.cginc new file mode 100644 index 00000000..6255cc0e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview.cginc @@ -0,0 +1,121 @@ + +#ifndef PREVIEW_INCLUDED +#define PREVIEW_INCLUDED + +#include "UnityCG.cginc" + +float3 preview_WorldSpaceCameraPos; +float4x4 preview_WorldToObject; +float4x4 preview_ObjectToWorld; +float4x4 preview_MatrixV; +float4x4 preview_MatrixInvV; + +inline float3 PreviewFragmentPositionOS( float2 uv ) +{ + float2 xy = 2 * uv - 1; + float z = -sqrt( 1 - saturate( dot( xy, xy ) ) ); + return float3( xy, z ); +} + +inline float3 PreviewFragmentNormalOS( float2 uv, bool normalized = true ) +{ + float3 positionOS = PreviewFragmentPositionOS( uv ); + float3 normalOS = positionOS; + if ( normalized ) + { + normalOS = normalize( normalOS ); + } + return normalOS; +} + +inline float3 PreviewFragmentTangentOS( float2 uv, bool normalized = true ) +{ + float3 positionOS = PreviewFragmentPositionOS( uv ); + float3 tangentOS = float3( -positionOS.z, positionOS.y * 0.01, positionOS.x ); + if ( normalized ) + { + tangentOS = normalize( tangentOS ); + } + return tangentOS; +} + +inline float3 PreviewWorldSpaceViewDir( in float3 worldPos, bool normalized ) +{ + float3 vec = preview_WorldSpaceCameraPos.xyz - worldPos; + if ( normalized ) + { + vec = normalize( vec ); + } + return vec; +} + +inline float3 PreviewWorldToObjectDir( in float3 dir, const bool normalized ) +{ + float3 vec = mul( ( float3x3 )preview_WorldToObject, dir ); + if ( normalized ) + { + vec = normalize( vec ); + } + return vec; +} + +inline float3 PreviewObjectToWorldDir( in float3 dir, const bool normalized ) +{ + float3 vec = mul( ( float3x3 )preview_ObjectToWorld, dir ); + if ( normalized ) + { + vec = normalize( vec ); + } + return vec; +} + +inline float3 PreviewWorldToViewDir( in float3 dir, const bool normalized ) +{ + float3 vec = mul( ( float3x3 )preview_MatrixV, dir ); + if ( normalized ) + { + vec = normalize( vec ); + } + return vec; +} + +inline float3 PreviewViewToWorldDir( in float3 dir, const bool normalized ) +{ + float3 vec = mul( ( float3x3 )preview_MatrixInvV, dir ); + if ( normalized ) + { + vec = normalize( vec ); + } + return vec; +} + +float3 PreviewFragmentTangentToWorldDir( in float2 uv, in float3 normalTS, const bool normalized ) +{ + float3 vertexPos = PreviewFragmentPositionOS( uv ); + float3 tangent = PreviewFragmentTangentOS( uv ); + float3 worldPos = mul( unity_ObjectToWorld, float4( vertexPos, 1 ) ).xyz; + float3 normal = PreviewFragmentNormalOS( uv ); + float3 worldNormal = UnityObjectToWorldNormal( normal ); + float3 worldTangent = UnityObjectToWorldDir( tangent ); + + const float tangentSign = -1; + float3 worldBinormal = normalize( cross( worldNormal, worldTangent ) * tangentSign ); + float4 tSpace0 = float4( worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x ); + float4 tSpace1 = float4( worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y ); + float4 tSpace2 = float4( worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z ); + + float3 vec = float3( dot( tSpace0.xyz, normalTS ), dot( tSpace1.xyz, normalTS ), dot( tSpace2.xyz, normalTS ) ); + if ( normalized ) + { + vec = normalize( vec ); + } + return vec; +} + +float2 PreviewFragmentSphericalUV( in float2 uv ) +{ + float3 vertexPos = PreviewFragmentPositionOS( uv ); + return float2( atan2( vertexPos.x, -vertexPos.z ) / UNITY_PI + 0.5, uv.y ); +} + +#endif // PREVIEW_INCLUDED \ No newline at end of file diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview.cginc.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview.cginc.meta new file mode 100644 index 00000000..e77ecb04 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview.cginc.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: d3c16dbb74ccd7a4c9a78b6abd7fe261 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview.cginc + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader new file mode 100644 index 00000000..6a680899 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/ACosOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return acos(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader.meta new file mode 100644 index 00000000..c14e139e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 710f3c0bbd7ba0c4aada6d7dfadd49c2 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader new file mode 100644 index 00000000..b92a3a5d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/ASinOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return asin(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader.meta new file mode 100644 index 00000000..c866b1c8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 2b016c135284add4cb3364d4a0bd0638 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader new file mode 100644 index 00000000..9a4846c2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/ATan2OpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + return atan2(a, b); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader.meta new file mode 100644 index 00000000..8153937a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 02e3ff61784e38840af6313936b6a730 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader new file mode 100644 index 00000000..a0ca115b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/ATanOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return atan(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader.meta new file mode 100644 index 00000000..e9c2b7d2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 7d7f3331a98831241b017364e80625ea +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader new file mode 100644 index 00000000..642cfbd4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/AbsOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return abs(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader.meta new file mode 100644 index 00000000..11e8ed04 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: cd6d6dfa3df214a479f68a490e177db6 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AllNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AllNode.shader new file mode 100644 index 00000000..ab91bc4e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AllNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/AllNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return all( tex2D(_A, i.uv) ) ? 1 : 0; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AllNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AllNode.shader.meta new file mode 100644 index 00000000..50ff679b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AllNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: c33c751fb9fd7ad4e9fdc18d1f3a28d3 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AllNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AnyNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AnyNode.shader new file mode 100644 index 00000000..d16b8d4f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AnyNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/AnyNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return any( tex2D(_A, i.uv) ) ? 1 : 0; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AnyNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AnyNode.shader.meta new file mode 100644 index 00000000..b202d2c1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AnyNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: a1e114ebddab3b347a7c5753c1cdb9cb +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AnyNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader new file mode 100644 index 00000000..6c54ae6a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader @@ -0,0 +1,37 @@ +Shader "Hidden/AppendNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_C", 2D) = "white" {} + _D ("_D", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + + float4 frag(v2f_img i) : SV_Target + { + float x = tex2D(_A, i.uv).x; + float y = tex2D(_B, i.uv).y; + float z = tex2D(_C, i.uv).z; + float w = tex2D(_D, i.uv).w; + + return float4(x,y,z,w); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader.meta new file mode 100644 index 00000000..a70e5f8e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: d80ac81aabf643848a4eaa76f2f88d65 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader new file mode 100644 index 00000000..6002a093 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader @@ -0,0 +1,83 @@ +Shader "Hidden/BlendNormalsNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_C", 2D) = "white" {} + } + SubShader + { + CGINCLUDE + #pragma vertex vert_img + #pragma fragment frag + #pragma target 3.0 + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "UnityStandardUtils.cginc" + + float3 BlendNormalWorldspaceRNM(float3 n1, float3 n2, float3 vtxNormal) + { + float4 q = float4(cross(vtxNormal, n2), dot(vtxNormal, n2) + 1.0) / sqrt(2.0 * (dot(vtxNormal, n2) + 1)); + return n1 * (q.w * q.w - dot(q.xyz, q.xyz)) + 2 * q.xyz * dot(q.xyz, n1) + 2 * q.w * cross(q.xyz, n1); + } + + float3 BlendNormalRNM(float3 n1, float3 n2) + { + float3 t = n1.xyz + float3(0.0, 0.0, 1.0); + float3 u = n2.xyz * float3(-1.0, -1.0, 1.0); + float3 r = (t / t.z) * dot(t, u) - u; + return r; + } + ENDCG + Pass + { + CGPROGRAM + + sampler2D _A; + sampler2D _B; + + float4 frag(v2f_img i) : SV_Target + { + float3 a = tex2D( _A, i.uv ).rgb; + float3 b = tex2D( _B, i.uv ).rgb; + return float4(BlendNormals(a, b), 0); + } + ENDCG + } + + Pass + { + CGPROGRAM + + sampler2D _A; + sampler2D _B; + + float4 frag(v2f_img i) : SV_Target + { + float3 a = tex2D(_A, i.uv).rgb; + float3 b = tex2D(_B, i.uv).rgb; + return float4(BlendNormalRNM(a, b), 0); + } + ENDCG + } + + Pass + { + CGPROGRAM + + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float4 frag(v2f_img i) : SV_Target + { + float3 a = tex2D(_A, i.uv).rgb; + float3 b = tex2D(_B, i.uv).rgb; + float3 c = tex2D(_C, i.uv).rgb; + return float4(BlendNormalWorldspaceRNM(a,b,c), 0); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader.meta new file mode 100644 index 00000000..128f98cd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: bcdf750ff5f70444f98b8a3efa50dc6f +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader new file mode 100644 index 00000000..6c984f49 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader @@ -0,0 +1,620 @@ +Shader "Hidden/BlendOpsNode" +{ + Properties + { + _A ("_Source", 2D) = "white" {} + _B ("_Destiny", 2D) = "white" {} + _C ("_Alpha", 2D) = "white" {} + } + SubShader + { + Pass //colorburn + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( ( 1.0 - ( ( 1.0 - des) / max( src,0.00001)) ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp(des, c, alpha); + } + + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //colordodge + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( ( des/ max( 1.0 - src,0.00001 ) ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //darken + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( min( src , des ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //divide + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( ( des / max( src,0.00001) ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //difference + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( abs( src - des ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //exclusion + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( ( 0.5 - 2.0 * ( src - 0.5 ) * ( des - 0.5 ) ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //softlight + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( 2.0f*src*des + des*des*(1.0f - 2.0f*src) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //hardlight + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( ( src > 0.5 ? ( 1.0 - ( 1.0 - 2.0 * ( src - 0.5 ) ) * ( 1.0 - des ) ) : ( 2.0 * src * des ) ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //hardmix + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( round( 0.5 * ( src + des ) ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //lighten + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( max( src, des ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //linearburn + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( ( src + des - 1.0 ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //lineardodge + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( ( src + des ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //linearlight + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( ( src > 0.5 ? ( des + 2.0 * src - 1.0 ) : ( des + 2.0 * ( src - 0.5 ) ) ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //multiply + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( ( src * des ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //overlay + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( ( des > 0.5 ? ( 1.0 - 2.0 * ( 1.0 - des ) * ( 1.0 - src ) ) : ( 2.0 * des * src ) ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //pinlight + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( ( src > 0.5 ? max( des, 2.0 * ( src - 0.5 ) ) : min( des, 2.0 * src ) ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //subtract + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( ( des - src ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //screen + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( ( 1.0 - ( 1.0 - src ) * ( 1.0 - des ) ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + + Pass //vividlight + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + int _Sat; + int _Lerp; + + float4 frag(v2f_img i) : SV_Target + { + float4 src = tex2D( _A, i.uv ); + float4 des = tex2D( _B, i.uv ); + + float4 c = ( ( src > 0.5 ? ( des / max( ( 1.0 - src ) * 2.0 ,0.00001) ) : ( 1.0 - ( ( ( 1.0 - des ) * 0.5 ) / max(src,0.00001) ) ) ) ); + if (_Lerp == 1) + { + float alpha = tex2D (_C, i.uv).r; + c = lerp (des, c, alpha); + } + if( _Sat == 1 ) + c = saturate( c ); + return c; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader.meta new file mode 100644 index 00000000..8116b491 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6d6b3518705b3ba49acdc6e18e480257 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader new file mode 100644 index 00000000..c82eb5f1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader @@ -0,0 +1,77 @@ +Shader "Hidden/BreakToComponentsNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return tex2D( _A, i.uv ).x; + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return tex2D( _A, i.uv ).y; + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return tex2D( _A, i.uv ).z; + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return tex2D( _A, i.uv ).w; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader.meta new file mode 100644 index 00000000..dc4b6d57 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 5f58f74a202ba804daddec838b75207d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader new file mode 100644 index 00000000..604f2985 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/CeilOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return ceil(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader.meta new file mode 100644 index 00000000..e92aae3f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: ce0588227a766a245a85291977c1f222 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader new file mode 100644 index 00000000..d2b26792 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader @@ -0,0 +1,34 @@ +Shader "Hidden/ClampOpNode" +{ + Properties + { + _A ("_Value", 2D) = "white" {} + _B ("_Min", 2D) = "white" {} + _C ("_Max", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float4 frag(v2f_img i) : SV_Target + { + float4 value = tex2D( _A, i.uv ); + float4 min = tex2D( _B, i.uv ); + float4 max = tex2D( _C, i.uv ); + + return clamp(value, min, max); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader.meta new file mode 100644 index 00000000..9b559c99 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: ab6163c4b10bfc84da8e3c486520490a +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader new file mode 100644 index 00000000..84d0527b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader @@ -0,0 +1,36 @@ +Shader "Hidden/Clip" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_C", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + float4 c = tex2D( _C, i.uv ); + + clip(b - c); + + return a; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader.meta new file mode 100644 index 00000000..5fafdbc1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 1fca7774f364aee4d8c64e8634ef4be4 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader new file mode 100644 index 00000000..9bad62e8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader @@ -0,0 +1,26 @@ +Shader "Hidden/ClipPlanes" +{ + Properties + { + _PlaneId ("_PlaneId", Int) = 0 + } + + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + int _PlaneId; + float4 frag( v2f_img i ) : SV_Target + { + return unity_CameraWorldClipPlanes[_PlaneId]; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader.meta new file mode 100644 index 00000000..026b2209 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6afe5a4ad7bbd0e4ab352c758f543a09 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader new file mode 100644 index 00000000..7ce90b11 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader @@ -0,0 +1,25 @@ +Shader "Hidden/ColorNode" +{ + Properties { + _InputColor ("_InputColor", Color) = (0,0,0,0) + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 _InputColor; + + float4 frag( v2f_img i ) : SV_Target + { + return _InputColor; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader.meta new file mode 100644 index 00000000..9a88bd1b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6cf365ccc7ae776488ae8960d6d134c3 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader new file mode 100644 index 00000000..84f6622b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader @@ -0,0 +1,20 @@ +Shader "Hidden/ColorSpaceDouble" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + return unity_ColorSpaceDouble; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader.meta new file mode 100644 index 00000000..68f51f8c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: ac680a8772bb97c46851a7f075fd04e3 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader new file mode 100644 index 00000000..3ea60f43 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader @@ -0,0 +1,49 @@ +Shader "Hidden/TFHCCompareEqual" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_True", 2D) = "white" {} + _D ( "_False", 2D ) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + int _Operator; + + float4 frag(v2f_img i) : SV_Target + { + float A = tex2D( _A, i.uv ).x; + float B = tex2D( _B, i.uv ).x; + float4 True = tex2D( _C, i.uv ); + float4 False = tex2D ( _D, i.uv ); + + if( _Operator == 0 ) + return ( ( A == B ) ? True : False ); + else if( _Operator == 1 ) + return ( ( A != B ) ? True : False ); + else if( _Operator == 2 ) + return ( ( A > B ) ? True : False ); + else if( _Operator == 3 ) + return ( ( A >= B ) ? True : False ); + else if( _Operator == 4 ) + return ( ( A < B ) ? True : False ); + else + return ( ( A <= B ) ? True : False ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader.meta new file mode 100644 index 00000000..eaf910f5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 381937898f0c15747af1da09a751890c +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader new file mode 100644 index 00000000..74301180 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader @@ -0,0 +1,63 @@ +Shader "Hidden/ComponentMaskNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + float _Singular; + float4 _Order; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 r = 0; + if(_Singular == 0) + r = a.x; + else if(_Singular == 1) + r = a.y; + else if(_Singular == 2) + r = a.z; + else if(_Singular == 3) + r = a.w; + + if ( _Order.x == 0 ) + r.x = a.x; + else if(_Order.y == 0) + r.x = a.y; + else if(_Order.z == 0) + r.x = a.z; + else if(_Order.w == 0) + r.x = a.w; + + if(_Order.y == 1) + r.y = a.y; + else if(_Order.z == 1) + r.y = a.z; + else if(_Order.w == 1) + r.y = a.w; + + if(_Order.z == 2) + r.z = a.z; + else if(_Order.w == 2) + r.z = a.w; + + if(_Order.w == 3) + r.w = a.w; + + return r; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader.meta new file mode 100644 index 00000000..7725fe13 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: b78e2b295c265cd439c80d218fb3e88e +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader new file mode 100644 index 00000000..13b9ceb8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader @@ -0,0 +1,49 @@ +Shader "Hidden/ComputeScreenPos" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 screenPos = ComputeScreenPos(a); + return screenPos; + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag (v2f_img i) : SV_Target + { + float4 a = tex2D(_A, i.uv); + float4 screenPos = ComputeScreenPos(a); + screenPos = screenPos / screenPos.w; + screenPos.z = (UNITY_NEAR_CLIP_VALUE >= 0) ? screenPos.z : screenPos.z* 0.5 + 0.5; + return screenPos; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader.meta new file mode 100644 index 00000000..79a2c2aa --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 97bd4895d847d764eb21d2bf7aa13671 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader new file mode 100644 index 00000000..a4d66083 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader @@ -0,0 +1,48 @@ +Shader "Hidden/Preview_ConditionalIfNode" +{ + Properties + { + _A ( "_A", 2D) = "white" {} + _B ( "_B", 2D ) = "white" {} + _C ( "_AGreaterThanB", 2D ) = "white" {} + _D ( "_AEqualToB", 2D ) = "white" {} + _E ( "_ALessThanB", 2D ) = "white" {} + } + + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + uniform sampler2D _A; + uniform sampler2D _B; + uniform sampler2D _C; + uniform sampler2D _D; + uniform sampler2D _E; + + float4 frag ( v2f_img i ) : SV_Target + { + float aVal = tex2D ( _A, i.uv ).r; + float bVal = tex2D ( _B, i.uv ).r; + float4 aGreaterbVal = tex2D ( _C, i.uv ); + float4 aEqualbVal = tex2D ( _D, i.uv ); + float4 aLessbVal = tex2D ( _E, i.uv ); + + if ( aVal > bVal ) + return aGreaterbVal; + + if ( aVal == bVal ) + return aEqualbVal; + + return aLessbVal; + + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader.meta new file mode 100644 index 00000000..3014d154 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: f6fb4d46bddf29e45a8a3ddfed75d0c0 +timeCreated: 1515424552 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader new file mode 100644 index 00000000..c085accf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/CosOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return cos(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader.meta new file mode 100644 index 00000000..84a2535d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 3dde9e80389196f459eb94137268de4a +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader new file mode 100644 index 00000000..55b2427f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader @@ -0,0 +1,26 @@ +Shader "Hidden/CosTime" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float _EditorTime; + + float4 frag( v2f_img i ) : SV_Target + { + float4 t = _EditorTime; + t.x = _EditorTime / 8; + t.y = _EditorTime / 4; + t.z = _EditorTime / 2; + return cos(t); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader.meta new file mode 100644 index 00000000..824e9a27 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 3093999b42c3c0940a71799511d7781c +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader new file mode 100644 index 00000000..be771187 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/CoshOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return cosh(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader.meta new file mode 100644 index 00000000..33aa84c1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 154a4c85fe88657489a54a02416402c0 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader new file mode 100644 index 00000000..645d3824 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/CrossProductOpNode" +{ + Properties + { + _A ("_Lhs", 2D) = "white" {} + _B ("_Rhs", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + return float4(cross(a.rgb, b.rgb),0); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader.meta new file mode 100644 index 00000000..c59cd0ab --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 65a9be5cc7037654db8e148d669f03ee +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader new file mode 100644 index 00000000..a9ea6d68 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/DdxOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return ddx(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader.meta new file mode 100644 index 00000000..aa76aa40 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: b54ea73d5568b3540977557813eb9c3c +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader new file mode 100644 index 00000000..44053465 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/DdyOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return ddy(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader.meta new file mode 100644 index 00000000..680d9303 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 197dcc7f05339da47b6b0e681c475c5e +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader new file mode 100644 index 00000000..9331302f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader @@ -0,0 +1,31 @@ +Shader "Hidden/DecodeDepthNormalNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float depthValue = 0; + float3 normalValue = 0; + DecodeDepthNormal( a , depthValue, normalValue ); + return float4( depthValue,normalValue ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader.meta new file mode 100644 index 00000000..45b11d18 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: dbf37c4d3ce0f0b41822584d6c9ba203 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader new file mode 100644 index 00000000..10a4dc43 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader @@ -0,0 +1,28 @@ +Shader "Hidden/DecodeFloatRGBAHlpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + return DecodeFloatRGBA( a ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader.meta new file mode 100644 index 00000000..a845d991 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: f71b31b15ff3f2042bafbed40acd29f4 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader new file mode 100644 index 00000000..04a77e9c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader @@ -0,0 +1,28 @@ +Shader "Hidden/DecodeFloatRGHlpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + + float4 frag( v2f_img i ) : SV_Target + { + float2 a = tex2D( _A, i.uv ).rg; + return DecodeFloatRG( a ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader.meta new file mode 100644 index 00000000..15a53875 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 1fb3121b1c8febb4dbcc2a507a2df2db +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader new file mode 100644 index 00000000..37769021 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader @@ -0,0 +1,27 @@ +Shader "Hidden/DecodeLighmapHlpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + return float4(DecodeLightmap ( a ),0); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader.meta new file mode 100644 index 00000000..ae5ac7f2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: c2d3bee1aee183343b31b9208cb402e9 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader new file mode 100644 index 00000000..5ebe0731 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader @@ -0,0 +1,28 @@ +Shader "Hidden/DecodeViewNormalStereoHlpNode" +{ + Properties + { + _A ( "_A", 2D ) = "white" {} + } + + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag ( v2f_img i ) : SV_Target + { + float4 a = tex2D ( _A, i.uv ); + return float4( DecodeViewNormalStereo ( a ),0 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader.meta new file mode 100644 index 00000000..86d92a3e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: e996db1cc4510c84185cb9f933f916bb +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader new file mode 100644 index 00000000..5bf8f414 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/DegreesOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return degrees(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader.meta new file mode 100644 index 00000000..c3f50a72 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 2a8eebb5566830c4a9d7c4b9021bb743 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader new file mode 100644 index 00000000..8e5db1d8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader @@ -0,0 +1,27 @@ +Shader "Hidden/DeltaTime" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float _EditorDeltaTime; + + float4 frag( v2f_img i ) : SV_Target + { + float4 t = _EditorDeltaTime; + t.y = 1 / _EditorDeltaTime; + t.z = _EditorDeltaTime; + t.w = 1 / _EditorDeltaTime; + return cos(t); + } + ENDCG + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader.meta new file mode 100644 index 00000000..30ca5a60 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 9d69a693042c443498f96d6da60535eb +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader new file mode 100644 index 00000000..fb2ff830 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader @@ -0,0 +1,35 @@ +Shader "Hidden/DesaturateNode" +{ + Properties + { + _A ( "_RBG", 2D ) = "white" {} + _B ( "_Fraction", 2D ) = "white" {} + } + + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + uniform sampler2D _A; + uniform sampler2D _B; + + float4 frag ( v2f_img i ) : SV_Target + { + float3 rgb = tex2D ( _A, i.uv ).rgb; + float fraction = tex2D ( _B, i.uv ).r; + + float dotResult = dot ( rgb, float3( 0.299, 0.587, 0.114 ) ); + float3 finalColor = lerp ( rgb, dotResult.xxx, fraction ); + + return float4( finalColor, 1 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader.meta new file mode 100644 index 00000000..d95ffa35 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: faabe9efdf44b9648a523f1742abdfd3 +timeCreated: 1515421907 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader new file mode 100644 index 00000000..11d354e1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader @@ -0,0 +1,46 @@ +Shader "Hidden/DiffuseAndSpecularFromMetallicNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "UnityStandardUtils.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float3 ComputeDiffuseAndFresnel0( float3 baseColor, float metallic, out float3 specularColor, out float oneMinusReflectivity ) + { + #if defined( UNITY_COLORSPACE_GAMMA ) + const float dielectricF0 = 0.220916301; + #else + const float dielectricF0 = 0.04; + #endif + specularColor = lerp( dielectricF0.xxx, baseColor, metallic ); + oneMinusReflectivity = 1.0 - metallic; + return baseColor * oneMinusReflectivity; + } + + float4 frag( v2f_img i ) : SV_Target + { + float4 baseColor = tex2D( _A, i.uv ); + float metallic = tex2D( _B, i.uv ).r; + float3 specularColor = 0; + float oneMinusReflectivity = 0; + float3 diffuseColor = ComputeDiffuseAndFresnel0( baseColor, metallic, specularColor, oneMinusReflectivity ); + return float4( diffuseColor, 1 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader.meta new file mode 100644 index 00000000..4e62e69d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: c7c4485750948a045b5dab0985896e17 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader new file mode 100644 index 00000000..ff04605b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/DistanceOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + return distance( a, b ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader.meta new file mode 100644 index 00000000..861e5c9b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 3be9a95031c0cb740ae982e465dfc242 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader new file mode 100644 index 00000000..f99a3670 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader @@ -0,0 +1,40 @@ +Shader "Hidden/DotProductOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + int _Type_PID; + + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D(_A, i.uv); + float4 b = tex2D(_B, i.uv); + + float result; + switch ( _Type_PID ) + { + case 1: result = dot( a.x, b.x ); break; + case 2: result = dot( a.xy, b.xy ); break; + case 3: result = dot( a.xyz, b.xyz ); break; + default: result = dot( a.xyzw, b.xyzw ); break; + } + return result; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader.meta new file mode 100644 index 00000000..a3504ede --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 85f11fd5cb9bb954c8615a45c57a3784 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader new file mode 100644 index 00000000..400bf868 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader @@ -0,0 +1,136 @@ +Shader "Hidden/DynamicAppendNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_C", 2D) = "white" {} + _D ("_D", 2D) = "white" {} + _Mask("_Mask", Vector) = (0,0,0,0) + } + SubShader + { + CGINCLUDE + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + + float4 _Mask; + ENDCG + + Pass //0 + { + Name "1111" + CGPROGRAM + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D(_A, i.uv); + float4 b = tex2D(_B, i.uv); + float4 c = tex2D(_C, i.uv); + float4 d = tex2D(_D, i.uv); + return float4(a.x,b.x,c.x,d.x)*_Mask; + } + ENDCG + } + + Pass //1 + { + Name "1120" + CGPROGRAM + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D(_A, i.uv); + float4 b = tex2D(_B, i.uv); + float4 c = tex2D(_C, i.uv); + + return float4(a.x,b.x,c.xy)*_Mask; + } + ENDCG + } + + Pass //2 + { + Name "1201" + CGPROGRAM + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D(_A, i.uv); + float4 b = tex2D(_B, i.uv); + float4 d = tex2D(_D, i.uv); + return float4(a.x,b.xy,d.x)*_Mask; + } + ENDCG + } + + Pass //3 + { + Name "1300" + CGPROGRAM + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D(_A, i.uv); + float4 b = tex2D(_B, i.uv); + return float4(a.x,b.xyz)*_Mask; + } + ENDCG + } + + Pass //4 + { + Name "2011" + CGPROGRAM + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D(_A, i.uv); + float4 c = tex2D(_C, i.uv); + float4 d = tex2D(_D, i.uv); + return float4(a.xy,c.x,d.x)*_Mask; + } + ENDCG + } + + Pass //5 + { + Name "2020" + CGPROGRAM + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D(_A, i.uv); + float4 c = tex2D(_C, i.uv); + return float4(a.xy,c.xy)*_Mask; + } + ENDCG + } + + Pass //6 + { + Name "3001" + CGPROGRAM + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D(_A, i.uv); + float4 d = tex2D(_D, i.uv); + return float4(a.xyz,d.x)*_Mask; + } + ENDCG + } + + Pass //7 + { + Name "4000" + CGPROGRAM + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D(_A, i.uv); + return a*_Mask; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader.meta new file mode 100644 index 00000000..c645049e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: bfcd2919fe75bbf428fbbe583f463a9e +timeCreated: 1510580676 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader new file mode 100644 index 00000000..7a153a15 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader @@ -0,0 +1,28 @@ +Shader "Hidden/EncodeFloatRGBAHlpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + + float4 frag( v2f_img i ) : SV_Target + { + float a = tex2D( _A, i.uv ).r; + return EncodeFloatRGBA( a ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader.meta new file mode 100644 index 00000000..c8acfa79 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: c21569bf5b9371b4ca13c0c00abd5562 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader new file mode 100644 index 00000000..62528542 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader @@ -0,0 +1,28 @@ +Shader "Hidden/EncodeFloatRGNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + + float4 frag( v2f_img i ) : SV_Target + { + float a = tex2D( _A, i.uv ).r; + return float4( EncodeFloatRG( a ), 0,0); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader.meta new file mode 100644 index 00000000..16f94992 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: a44b520baa5c39e41bc69a22ea46f24d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader new file mode 100644 index 00000000..0fc30e3f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader @@ -0,0 +1,28 @@ +Shader "Hidden/EncodeViewNormalStereoHlpNode" +{ + Properties + { + _A ( "_A", 2D ) = "white" {} + } + + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag ( v2f_img i ) : SV_Target + { + float3 a = tex2D ( _A, i.uv ).rgb; + return float4( EncodeViewNormalStereo( a ),0,0); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader.meta new file mode 100644 index 00000000..1c8a19d2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 3d0b3d482b7246c4cb60fa73e6ceac6c +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader new file mode 100644 index 00000000..51be5f4f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/Exp2OpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return exp2(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader.meta new file mode 100644 index 00000000..41876bf1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: ceb70ed5423a36647a504a41de7dbfe6 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader new file mode 100644 index 00000000..7c8f081f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/ExpOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return exp(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader.meta new file mode 100644 index 00000000..940a0dd2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6416ff506137d97479a7ebde790b45e5 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader new file mode 100644 index 00000000..8f8357b2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/FWidthOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return fwidth(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader.meta new file mode 100644 index 00000000..8260f8a9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 81ea481faaef9c8459a555479ba64df7 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader new file mode 100644 index 00000000..fc1d25ce --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader @@ -0,0 +1,20 @@ +Shader "Hidden/FaceVariableNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag( v2f_img i, half ase_vface : VFACE ) : SV_Target + { + return ase_vface; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader.meta new file mode 100644 index 00000000..30d084c0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 4b0b5b9f16353b840a5f5ad2baab3c3c +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FlipNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FlipNode.shader new file mode 100644 index 00000000..306523b0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FlipNode.shader @@ -0,0 +1,33 @@ +Shader "Hidden/FlipNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + float4 _Flip; + int _Count; + + float4 frag( v2f_img i ) : SV_Target + { + float4 output = 0; + output = ( _Flip.x * -2 + 1 ) * tex2D( _A, i.uv ).x; + output.y = ( _Count > 1 ) ? ( ( _Flip.y * -2 + 1 ) * tex2D( _A, i.uv ).y ) : output.y; + output.z = ( _Count > 2 ) ? ( ( _Flip.z * -2 + 1 ) * tex2D( _A, i.uv ).z ) : output.z; + output.w = ( _Count > 3 ) ? ( ( _Flip.w * -2 + 1 ) * tex2D( _A, i.uv ).w ) : output.w; + return output; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FlipNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FlipNode.shader.meta new file mode 100644 index 00000000..80bfa776 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FlipNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 99b235eb03070cd4ab7470cda5a77e2d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FlipNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader new file mode 100644 index 00000000..a134c883 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/FloorOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return floor(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader.meta new file mode 100644 index 00000000..206b3dde --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 46ae4a72a9a38de40a2d8f20cfccc67d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader new file mode 100644 index 00000000..01869127 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/FmodOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + return fmod(a, b); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader.meta new file mode 100644 index 00000000..6d2acc2f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 65083930f9d7812479fd6ff203ad2992 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader new file mode 100644 index 00000000..104f7cff --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader @@ -0,0 +1,80 @@ +Shader "Hidden/FogAndAmbientColors" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + return UNITY_LIGHTMODEL_AMBIENT; + } + ENDCG + } + + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag (v2f_img i) : SV_Target + { + return unity_AmbientSky; + } + ENDCG + } + + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag (v2f_img i) : SV_Target + { + return unity_AmbientEquator; + } + ENDCG + } + + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag (v2f_img i) : SV_Target + { + return unity_AmbientGround; + } + ENDCG + } + + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag (v2f_img i) : SV_Target + { + return unity_FogColor; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader.meta new file mode 100644 index 00000000..4e680e4c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 937c7bde062f0f942b600d9950d2ebb2 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader new file mode 100644 index 00000000..d074ec7f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader @@ -0,0 +1,20 @@ +Shader "Hidden/FogParams" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + return unity_FogParams; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader.meta new file mode 100644 index 00000000..d6de97aa --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 42abde3281b1848438c3b53443c91a1e +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader new file mode 100644 index 00000000..4cc276f1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/FractNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return frac(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader.meta new file mode 100644 index 00000000..d11c0375 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 53a335f8f18d4694b8d94e8aee21fdca +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader new file mode 100644 index 00000000..a83b8276 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader @@ -0,0 +1,358 @@ +Shader "Hidden/FresnelNode" +{ + Properties + { + _A ("_Normal", 2D) = "white" {} + _B ("_Bias", 2D) = "white" {} + _C ("_Scale", 2D) = "white" {} + _D ("_Power", 2D) = "white" {} + _E ("_View", 2D) = "white" {} + } + SubShader + { + Pass //not connected world + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + //sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + int _FresnelType; + + float4 frag(v2f_img i) : SV_Target + { + float b = tex2D( _B, i.uv ).r; + float s = tex2D( _C, i.uv ).r; + float pw = tex2D( _D, i.uv ).r; + + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 vertexNormal = PreviewFragmentNormalOS( i.uv ); + float3 worldNormal = UnityObjectToWorldNormal( vertexNormal ); + float3 worldViewDir = normalize(preview_WorldSpaceCameraPos - vertexPos); + + float fresnel = 0; + if(_FresnelType == 0) + fresnel = (b + s*pow(1 - dot( worldNormal, worldViewDir ) , pw)); + else if(_FresnelType == 1) + fresnel = (b + (1-b) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); + else if(_FresnelType == 2) + { + float f0 = pow((1-s)/(1+s),2); + fresnel = (f0 + (1-f0) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); + } + return fresnel; + } + ENDCG + } + + Pass //connected world + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + int _FresnelType; + + float4 frag(v2f_img i) : SV_Target + { + float b = tex2D( _B, i.uv ).r; + float s = tex2D( _C, i.uv ).r; + float pw = tex2D( _D, i.uv ).r; + + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 worldNormal = tex2D( _A, i.uv ); + float3 worldViewDir = normalize(preview_WorldSpaceCameraPos - vertexPos); + + float fresnel = 0; + if(_FresnelType == 0) + fresnel = (b + s*pow(1 - dot( worldNormal, worldViewDir ) , pw)); + else if(_FresnelType == 1) + fresnel = (b + (1-b) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); + else if(_FresnelType == 2) + { + float f0 = pow((1-s)/(1+s),2); + fresnel = (f0 + (1-f0) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); + } + return fresnel; + } + ENDCG + } + + Pass //connected tangent + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + int _FresnelType; + + float4 frag(v2f_img i) : SV_Target + { + float b = tex2D( _B, i.uv ).r; + float s = tex2D( _C, i.uv ).r; + float pw = tex2D( _D, i.uv ).r; + + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 vertexNormal = PreviewFragmentNormalOS( i.uv ); + float3 worldNormal = UnityObjectToWorldNormal( vertexNormal ); + + float3 tangent = PreviewFragmentTangentOS( i.uv ); + float3 worldPos = mul(unity_ObjectToWorld, float4(vertexPos,1)).xyz; + float3 worldTangent = UnityObjectToWorldDir(tangent); + float tangentSign = -1; + float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); + float4 tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); + float4 tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); + float4 tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); + + float2 sphereUVs = i.uv; + + sphereUVs.x = (atan2(vertexPos.x, -vertexPos.z) / (UNITY_PI) + 0.5); + float3 tangentNormal = tex2D(_A, sphereUVs).xyz; + + worldNormal = fixed3( dot( tSpace0.xyz, tangentNormal ), dot( tSpace1.xyz, tangentNormal ), dot( tSpace2.xyz, tangentNormal ) ); + + float3 worldViewDir = normalize(preview_WorldSpaceCameraPos - vertexPos); + + float fresnel = 0; + if(_FresnelType == 0) + fresnel = (b + s*pow(1 - dot( worldNormal, worldViewDir ) , pw)); + else if(_FresnelType == 1) + fresnel = (b + (1-b) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); + else if(_FresnelType == 2) + { + float f0 = pow((1-s)/(1+s),2); + fresnel = (f0 + (1-f0) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); + } + return fresnel; + } + ENDCG + } + + Pass //not connected half vector + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + //sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + int _FresnelType; + float4 _EditorWorldLightPos; + float4 frag(v2f_img i) : SV_Target + { + float b = tex2D( _B, i.uv ).r; + float s = tex2D( _C, i.uv ).r; + float pw = tex2D( _D, i.uv ).r; + + float2 xy = 2 * i.uv - 1; + float z = -sqrt(1-(dot(xy,xy))); + float3 vertexPos = normalize(float3(xy, z)); + float3 worldViewDir = normalize(preview_WorldSpaceCameraPos - vertexPos); + float3 lightDir = normalize( _EditorWorldLightPos.xyz ); + float3 halfVector = normalize(worldViewDir+lightDir); + + float fresnel = 0; + if(_FresnelType == 0) + fresnel = (b + s*pow(1 - dot( halfVector, worldViewDir ) , pw)); + else if(_FresnelType == 1) + fresnel = (b + (1-b) * pow(1 - dot( halfVector, worldViewDir ) , 5)); + else if(_FresnelType == 2) + { + float f0 = pow((1-s)/(1+s),2); + fresnel = (f0 + (1-f0) * pow(1 - dot( halfVector, worldViewDir ) , 5)); + } + return fresnel; + } + ENDCG + } + + Pass //connected both + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + int _FresnelType; + + float4 frag(v2f_img i) : SV_Target + { + float b = tex2D( _B, i.uv ).r; + float s = tex2D( _C, i.uv ).r; + float pw = tex2D( _D, i.uv ).r; + + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 worldNormal = tex2D( _A, i.uv ); + float3 worldViewDir = tex2D( _E, i.uv );; + + float fresnel = 0; + if(_FresnelType == 0) + fresnel = (b + s*pow(1 - dot( worldNormal, worldViewDir ) , pw)); + else if(_FresnelType == 1) + fresnel = (b + (1-b) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); + else if(_FresnelType == 2) + { + float f0 = pow((1-s)/(1+s),2); + fresnel = (f0 + (1-f0) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); + } + return fresnel; + } + ENDCG + } + + Pass //not connected world and light + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + //sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + int _FresnelType; + float4 _EditorWorldLightPos; + + float4 frag(v2f_img i) : SV_Target + { + float b = tex2D( _B, i.uv ).r; + float s = tex2D( _C, i.uv ).r; + float pw = tex2D( _D, i.uv ).r; + + float2 xy = 2 * i.uv - 1; + float z = -sqrt(1-(dot(xy,xy))); + float3 vertexPos = normalize(float3(xy, z)); + float3 normal = normalize(vertexPos); + float3 worldNormal = UnityObjectToWorldNormal(normal); + float3 lightDir = normalize( _EditorWorldLightPos.xyz ); + + float fresnel = 0; + if(_FresnelType == 0) + fresnel = (b + s*pow(1 - dot( worldNormal, lightDir ) , pw)); + else if(_FresnelType == 1) + fresnel = (b + (1-b) * pow(1 - dot( worldNormal, lightDir ) , 5)); + else if(_FresnelType == 2) + { + float f0 = pow((1-s)/(1+s),2); + fresnel = (f0 + (1-f0) * pow(1 - dot( worldNormal, lightDir ) , 5)); + } + return fresnel; + } + ENDCG + } + + Pass //connected view + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + int _FresnelType; + + float4 frag(v2f_img i) : SV_Target + { + float b = tex2D( _B, i.uv ).r; + float s = tex2D( _C, i.uv ).r; + float pw = tex2D( _D, i.uv ).r; + + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = normalize(vertexPos); + float3 worldNormal = UnityObjectToWorldNormal(normal); + float3 worldViewDir = tex2D( _E, i.uv ); + + float fresnel = 0; + if(_FresnelType == 0) + fresnel = (b + s*pow(1 - dot( worldNormal, worldViewDir ) , pw)); + else if(_FresnelType == 1) + fresnel = (b + (1-b) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); + else if(_FresnelType == 2) + { + float f0 = pow((1-s)/(1+s),2); + fresnel = (f0 + (1-f0) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); + } + return fresnel; + } + ENDCG + } + + Pass //not connected half vector with connected view + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + //sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + int _FresnelType; + float4 _EditorWorldLightPos; + float4 frag(v2f_img i) : SV_Target + { + float b = tex2D( _B, i.uv ).r; + float s = tex2D( _C, i.uv ).r; + float pw = tex2D( _D, i.uv ).r; + + float2 xy = 2 * i.uv - 1; + float z = -sqrt(1-(dot(xy,xy))); + float3 vertexPos = normalize(float3(xy, z)); + float3 worldViewDir = tex2D( _E, i.uv ); + float3 lightDir = normalize( _EditorWorldLightPos.xyz ); + float3 halfVector = normalize(worldViewDir+lightDir); + + float fresnel = 0; + if(_FresnelType == 0) + fresnel = (b + s*pow(1 - dot( halfVector, worldViewDir ) , pw)); + else if(_FresnelType == 1) + fresnel = (b + (1-b) * pow(1 - dot( halfVector, worldViewDir ) , 5)); + else if(_FresnelType == 2) + { + float f0 = pow((1-s)/(1+s),2); + fresnel = (f0 + (1-f0) * pow(1 - dot( halfVector, worldViewDir ) , 5)); + } + return fresnel; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader.meta new file mode 100644 index 00000000..613f53b4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 240145eb70cf79f428015012559f4e7d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader new file mode 100644 index 00000000..5d430c2d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader @@ -0,0 +1,40 @@ +Shader "Hidden/FunctionInputNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + int _Type; + + float4 frag(v2f_img i) : SV_Target + { + if( _Type == 1 ) + { + return tex2D( _A, i.uv ).r; + } else if( _Type == 2 ) + { + return float4(tex2D( _A, i.uv ).rg,0,0); + } else if( _Type == 3 ) + { + return float4(tex2D( _A, i.uv ).rgb,0); + } + else + { + return tex2D( _A, i.uv ); + } + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader.meta new file mode 100644 index 00000000..648a9110 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 04bc8e7b317dccb4d8da601680dd8140 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader new file mode 100644 index 00000000..69364c97 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/FunctionNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return tex2D( _A, i.uv ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader.meta new file mode 100644 index 00000000..afadafa0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: aca70c900c50c004e8ef0b47c4fac4d4 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader new file mode 100644 index 00000000..d27ed378 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/FunctionOutputNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return tex2D( _A, i.uv ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader.meta new file mode 100644 index 00000000..17ae4529 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: e6d5f64114b18e24f99dc65290c0fe98 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader new file mode 100644 index 00000000..540fe96a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader @@ -0,0 +1,28 @@ +Shader "Hidden/GammaToLinearNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + float4 c = tex2D( _A, i.uv ); + c.rgb = GammaToLinearSpace( c.rgb ); + return c; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader.meta new file mode 100644 index 00000000..c678b6e0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: e82a888a6ebdb1443823aafceaa051b9 +timeCreated: 1489078120 +licenseType: Store +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _BackGround: {fileID: 2800000, guid: 750b1bd7ba8bd28489650de6d0a95cc5, type: 3} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader new file mode 100644 index 00000000..c55b8660 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/GetLocalVarNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return tex2D( _A, i.uv ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader.meta new file mode 100644 index 00000000..5682b52f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: f21a6e44c7d7b8543afacd19751d24c6 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader new file mode 100644 index 00000000..384426d9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader @@ -0,0 +1,124 @@ +Shader "Hidden/GradientSample" +{ + Properties + { + _GTime( "_Time", 2D ) = "white" {} + _GType( "_GType", Int ) = 0 + _GColorNum( "_GColorNum", Int ) = 0 + _GAlphaNum( "_GAlphaNum", Int ) = 0 + _Col0( "_Col0", Vector ) = ( 0, 0, 0, 0 ) + _Col1( "_Col1", Vector ) = ( 0, 0, 0, 0 ) + _Col2( "_Col2", Vector ) = ( 0, 0, 0, 0 ) + _Col3( "_Col3", Vector ) = ( 0, 0, 0, 0 ) + _Col4( "_Col4", Vector ) = ( 0, 0, 0, 0 ) + _Col5( "_Col5", Vector ) = ( 0, 0, 0, 0 ) + _Col6( "_Col6", Vector ) = ( 0, 0, 0, 0 ) + _Col7( "_Col7", Vector ) = ( 0, 0, 0, 0 ) + _Alp0( "_Alp0", Vector ) = ( 0, 0, 0, 0 ) + _Alp1( "_Alp1", Vector ) = ( 0, 0, 0, 0 ) + _Alp2( "_Alp2", Vector ) = ( 0, 0, 0, 0 ) + _Alp3( "_Alp3", Vector ) = ( 0, 0, 0, 0 ) + _Alp4( "_Alp4", Vector ) = ( 0, 0, 0, 0 ) + _Alp5( "_Alp5", Vector ) = ( 0, 0, 0, 0 ) + _Alp6( "_Alp6", Vector ) = ( 0, 0, 0, 0 ) + _Alp7( "_Alp7", Vector ) = ( 0, 0, 0, 0 ) + } + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + sampler2D _GTime; + int _GType; + int _GColorNum; + int _GAlphaNum; + float4 _Col0; + float4 _Col1; + float4 _Col2; + float4 _Col3; + float4 _Col4; + float4 _Col5; + float4 _Col6; + float4 _Col7; + float4 _Alp0; + float4 _Alp1; + float4 _Alp2; + float4 _Alp3; + float4 _Alp4; + float4 _Alp5; + float4 _Alp6; + float4 _Alp7; + + struct Gradient + { + int type; + int colorsLength; + int alphasLength; + float4 colors[ 8 ]; + float2 alphas[ 8 ]; + }; + + Gradient NewGradient( int type, int colorsLength, int alphasLength, + float4 colors0, float4 colors1, float4 colors2, float4 colors3, float4 colors4, float4 colors5, float4 colors6, float4 colors7, + float2 alphas0, float2 alphas1, float2 alphas2, float2 alphas3, float2 alphas4, float2 alphas5, float2 alphas6, float2 alphas7 ) + { + Gradient g; + g.type = type; + g.colorsLength = colorsLength; + g.alphasLength = alphasLength; + g.colors[ 0 ] = colors0; + g.colors[ 1 ] = colors1; + g.colors[ 2 ] = colors2; + g.colors[ 3 ] = colors3; + g.colors[ 4 ] = colors4; + g.colors[ 5 ] = colors5; + g.colors[ 6 ] = colors6; + g.colors[ 7 ] = colors7; + g.alphas[ 0 ] = alphas0; + g.alphas[ 1 ] = alphas1; + g.alphas[ 2 ] = alphas2; + g.alphas[ 3 ] = alphas3; + g.alphas[ 4 ] = alphas4; + g.alphas[ 5 ] = alphas5; + g.alphas[ 6 ] = alphas6; + g.alphas[ 7 ] = alphas7; + return g; + } + + float4 SampleGradient( Gradient gradient, float time ) + { + float3 color = gradient.colors[ 0 ].rgb; + UNITY_UNROLL + for( int c = 1; c < 8; c++ ) + { + float colorPos = saturate( ( time - gradient.colors[ c - 1 ].w ) / ( gradient.colors[ c ].w - gradient.colors[ c - 1 ].w ) ) * step( c, (float)gradient.colorsLength - 1 ); + color = lerp( color, gradient.colors[ c ].rgb, lerp( colorPos, step( 0.01, colorPos ), gradient.type ) ); + } + #ifndef UNITY_COLORSPACE_GAMMA + color = GammaToLinearSpace( color ); + #endif + float alpha = gradient.alphas[ 0 ].x; + UNITY_UNROLL + for( int a = 1; a < 8; a++ ) + { + float alphaPos = saturate( ( time - gradient.alphas[ a - 1 ].y ) / ( gradient.alphas[ a ].y - gradient.alphas[ a - 1 ].y ) ) * step( a, (float)gradient.alphasLength - 1 ); + alpha = lerp( alpha, gradient.alphas[ a ].x, lerp( alphaPos, step( 0.01, alphaPos ), gradient.type ) ); + } + return float4( color, alpha ); + } + + float4 frag( v2f_img i ) : SV_Target + { + Gradient gradient = NewGradient( _GType, _GColorNum, _GAlphaNum, _Col0, _Col1, _Col2, _Col3, _Col4, _Col5, _Col6, _Col7, _Alp0.xy, _Alp1.xy, _Alp2.xy, _Alp3.xy, _Alp4.xy, _Alp5.xy, _Alp6.xy, _Alp7.xy ); + float time = tex2D( _GTime, i.uv ).r; + return SampleGradient( gradient, time ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader.meta new file mode 100644 index 00000000..0a83933c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 8a09124cd6e4aa54a996e7487ec16b90 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader new file mode 100644 index 00000000..8abb0bb9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader @@ -0,0 +1,65 @@ +Shader "Hidden/GrayscaleNode" +{ + Properties + { + _A ("_RGB", 2D) = "white" {} + } + SubShader + { + Pass //Luminance + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + float lum = Luminance( tex2D( _A, i.uv ) ); + return float4( lum.xxx, 1); + } + ENDCG + } + + Pass //Natural Classic + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag ( v2f_img i ) : SV_Target + { + float lum = dot ( tex2D ( _A, i.uv ), float3( 0.299,0.587,0.114 ) ); + return float4( lum.xxx, 1 ); + } + ENDCG + } + + Pass //Old School + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag ( v2f_img i ) : SV_Target + { + float3 rgbValue = tex2D ( _A, i.uv ).rgb; + float lum = ( rgbValue.r + rgbValue.g + rgbValue.b ) / 3; + return float4( lum.xxx, 1 ); + } + ENDCG + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader.meta new file mode 100644 index 00000000..dd73bb6e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 56781cd022be9124597f0f396a46a35f +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader new file mode 100644 index 00000000..c8522cdd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader @@ -0,0 +1,42 @@ +Shader "Hidden/HSVToRGBNode" +{ + Properties + { + _A ( "_Hue", 2D ) = "white" {} + _B ( "_Saturation", 2D ) = "white" {} + _C ( "_Value", 2D ) = "white" {} + } + + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + uniform sampler2D _A; + uniform sampler2D _B; + uniform sampler2D _C; + + float3 HSVToRGB( float3 c ) + { + float4 K = float4( 1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0 ); + float3 p = abs( frac( c.xxx + K.xyz ) * 6.0 - K.www ); + return c.z * lerp( K.xxx, saturate( p - K.xxx ), c.y ); + } + + float4 frag ( v2f_img i ) : SV_Target + { + float h = tex2D ( _A, i.uv ).r; + float s = tex2D ( _B, i.uv ).r; + float v = tex2D ( _C, i.uv ).r; + + return float4( HSVToRGB(float3(h,s,v)), 1 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader.meta new file mode 100644 index 00000000..7a55cf5f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: fab445eb945d63047822a7a6b81b959d +timeCreated: 1515421907 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader new file mode 100644 index 00000000..031a1b2f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader @@ -0,0 +1,34 @@ +Shader "Hidden/HeightMapTextureBlend" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_C", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float4 frag( v2f_img i ) : SV_Target + { + float heightmap = tex2D( _A, i.uv ).x; + float splatMask = tex2D( _B, i.uv ).x; + float blendStrength = tex2D( _C, i.uv ).x; + float result = saturate( pow((( heightmap*splatMask ) * 4 ) + ( splatMask * 2 ), blendStrength )); + return float4( result.x , 0, 0, 1 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader.meta new file mode 100644 index 00000000..95b11aea --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: b2ac23d6d5dcb334982b6f31c2e7a734 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader new file mode 100644 index 00000000..54c21fde --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader @@ -0,0 +1,102 @@ +Shader "Hidden/IndirectDiffuseLight" +{ + Properties + { + _Intensity ("Intensity", Float) = 1 + } + + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + float _Intensity; + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 worldPos = mul(unity_ObjectToWorld, float4(vertexPos,1)).xyz; + float4 back = lerp(float4(0.4117,0.3843,0.3647,1),float4(0.4117,0.5059,0.6470,1),worldPos.y * 0.5 + 0.5); + return float4(GammaToLinearSpace(back.rgb * _Intensity),1); + } + ENDCG + } + + Pass // connected tangent + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + float _Intensity; + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 worldNormal = UnityObjectToWorldNormal(normal); + + float3 tangent = PreviewFragmentTangentOS( i.uv ); + float3 worldPos = mul(unity_ObjectToWorld, float4(vertexPos,1)).xyz; + float3 worldTangent = UnityObjectToWorldDir(tangent); + float tangentSign = -1; + float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); + float4 tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); + float4 tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); + float4 tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); + + float2 sphereUVs = i.uv; + + sphereUVs.x = (atan2(vertexPos.x, -vertexPos.z) / (UNITY_PI) + 0.5); + // Needs further checking + //float3 tangentNormal = tex2Dlod(_A, float4(sphereUVs,0,0)).xyz; + float3 tangentNormal = tex2D(_A, sphereUVs).xyz; + + worldNormal = fixed3( dot( tSpace0.xyz, tangentNormal ), dot( tSpace1.xyz, tangentNormal ), dot( tSpace2.xyz, tangentNormal ) ); + + float4 back = lerp(float4(0.4117,0.3843,0.3647,1),float4(0.4117,0.5059,0.6470,1),worldNormal.y * 0.5 + 0.5); + + return float4(GammaToLinearSpace(back.rgb * _Intensity),1); + } + ENDCG + } + + Pass // connected world + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + float _Intensity; + sampler2D _A; + + float4 frag( v2f_img i ) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 worldNormal = tex2D( _A, i.uv ); + + float4 back = lerp( float4( 0.4117,0.3843,0.3647,1 ),float4( 0.4117,0.5059,0.6470,1 ),worldNormal.y * 0.5 + 0.5 ); + + return float4( GammaToLinearSpace( back.rgb * _Intensity ),1 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader.meta new file mode 100644 index 00000000..9ef12c1d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: b45d57fa606c1ea438fe9a2c08426bc7 +timeCreated: 1512043114 +licenseType: Store +ShaderImporter: + defaultTextures: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader new file mode 100644 index 00000000..3bf3d773 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader @@ -0,0 +1,104 @@ +Shader "Hidden/IndirectSpecularLight" +{ + Properties + { + _Skybox("_Skybox", CUBE) = "white" {} + _A ("Normal", 2D) = "white" {} + _B ("Smoothness", 2D) = "white" {} + _C ("Occlusion", 2D) = "white" {} + } + + SubShader + { + Pass // not connected + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + uniform samplerCUBE _Skybox; + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 worldNormal = UnityObjectToWorldNormal( normal ); + float3 worldViewDir = normalize( preview_WorldSpaceCameraPos - vertexPos ); + float3 worldRefl = normalize( reflect( -worldViewDir, worldNormal ) ); + + float3 sky = texCUBElod( _Skybox, float4( worldRefl, ( 1 - saturate( tex2D( _B, i.uv ).r ) ) * 6 ) ).rgb; + + return float4( sky * tex2D( _C, i.uv ).r, 1 ); + } + ENDCG + } + + Pass // connected tangent + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + uniform samplerCUBE _Skybox; + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 tangentNormal = tex2D( _A, PreviewFragmentSphericalUV( i.uv ) ).xyz; + float3 worldNormal = PreviewFragmentTangentToWorldDir( i.uv, tangentNormal, true ); + float3 worldViewDir = normalize( preview_WorldSpaceCameraPos - vertexPos ); + float3 worldRefl = reflect( -worldViewDir, worldNormal ); + + float3 sky = texCUBElod( _Skybox, float4( worldRefl, ( 1 - saturate( tex2D( _B, i.uv ).r ) ) * 6 ) ).rgb; + + return float4( sky * tex2D( _C, i.uv ).r, 1 ); + } + ENDCG + } + + Pass // connected world + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + uniform samplerCUBE _Skybox; + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 worldNormal = tex2D( _A, i.uv ); + float3 worldViewDir = normalize( preview_WorldSpaceCameraPos - vertexPos ); + float3 worldRefl = reflect( -worldViewDir, worldNormal ); + + float3 sky = texCUBElod( _Skybox, float4( worldRefl, ( 1 - saturate( tex2D( _B, i.uv ).r ) ) * 6 ) ).rgb; + + return float4( sky * tex2D( _C, i.uv ).r, 1 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader.meta new file mode 100644 index 00000000..41c60a91 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: d6e441d0a8608954c97fa347d3735e92 +timeCreated: 1512052132 +licenseType: Store +ShaderImporter: + defaultTextures: + - _Skybox: {fileID: 8900000, guid: ef7513b54a0670140b9b967af7620563, type: 3} + - _A: {instanceID: 0} + - _B: {instanceID: 0} + - _C: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader new file mode 100644 index 00000000..57384b2e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader @@ -0,0 +1,25 @@ +Shader "Hidden/InstanceIDNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag (v2f_img i) : SV_Target + { + uint currInstanceId = 0; + #ifdef UNITY_INSTANCING_ENABLED + currInstanceId = unity_InstanceID; + #endif + + return currInstanceId; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader.meta new file mode 100644 index 00000000..82b61875 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 03febce56a8cf354b90e7d5180c1dbd7 +timeCreated: 1542641929 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader new file mode 100644 index 00000000..0796ebff --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader @@ -0,0 +1,25 @@ +Shader "Hidden/IntNode" +{ + Properties { + _InputInt ("_InputInt", Int) = 0 + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + int _InputInt; + + float4 frag( v2f_img i ) : SV_Target + { + return _InputInt; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader.meta new file mode 100644 index 00000000..422e39dd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 0f64d695b6ffacc469f2dd31432a232a +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsInfinite.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsInfinite.shader new file mode 100644 index 00000000..b93dd751 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsInfinite.shader @@ -0,0 +1,26 @@ +Shader "Hidden/IsInfinite" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D_float _A; + + float4 frag(v2f_img i) : SV_Target + { + return isinf( tex2D(_A, i.uv) ) ? 1 : 0; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsInfinite.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsInfinite.shader.meta new file mode 100644 index 00000000..2174d499 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsInfinite.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6fd9c9300bf239b4487f397b5117de15 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsInfinite.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsNaN.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsNaN.shader new file mode 100644 index 00000000..90786556 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsNaN.shader @@ -0,0 +1,33 @@ +Shader "Hidden/IsNaN" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + bool4 IsNaN( float4 x ) + { + const float zero = float4( 0.0f, 0.0f, 0.0f, 0.0f ); + return !( x < zero || x > zero || x == zero ); + } + + float4 frag(v2f_img i) : SV_Target + { + // for some reason, isnan() wasn't working in preview shaders + return IsNaN( tex2D(_A, i.uv) ) ? 1 : 0; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsNaN.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsNaN.shader.meta new file mode 100644 index 00000000..b87ccd13 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsNaN.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 250e32a6bbf31e148b1d6c402bbba693 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IsNaN.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader new file mode 100644 index 00000000..cc162955 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader @@ -0,0 +1,20 @@ +Shader "Hidden/LODFadeNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + return unity_LODFade; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader.meta new file mode 100644 index 00000000..51d08d62 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: fcd4d93f57ffc51458d4ade10df2fdb4 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader new file mode 100644 index 00000000..a8f8ac51 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader @@ -0,0 +1,91 @@ +Shader "Hidden/LayeredBlendNode" +{ + Properties + { + _A ( "_Weights", 2D) = "white" {} + _B ( "_LayerBase", 2D) = "white" {} + _C ( "_Layer1", 2D) = "white" {} + _D ( "_Layer2", 2D ) = "white" {} + _E ( "_Layer3", 2D ) = "white" {} + _F ( "_Layer4", 2D ) = "white" {} + } + SubShader + { + + CGINCLUDE + + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + sampler2D _A; + sampler2D _B; + sampler2D _C; + + ENDCG + + Pass + { + CGPROGRAM + float4 frag(v2f_img i) : SV_Target + { + float4 Weights = tex2D( _A, i.uv ); + float4 LayerBase = tex2D( _B, i.uv ); + float4 Layer1 = tex2D( _C, i.uv ); + return lerp ( LayerBase, Layer1, Weights.x ); + } + ENDCG + } + + Pass + { + CGPROGRAM + sampler2D _D; + float4 frag ( v2f_img i ) : SV_Target + { + float4 Weights = tex2D ( _A, i.uv ); + float4 LayerBase = tex2D ( _B, i.uv ); + float4 Layer1 = tex2D ( _C, i.uv ); + float4 Layer2 = tex2D ( _D, i.uv ); + return lerp ( lerp ( LayerBase, Layer1, Weights.x ), Layer2, Weights.y ); + } + ENDCG + } + + Pass + { + CGPROGRAM + sampler2D _D; + sampler2D _E; + float4 frag ( v2f_img i ) : SV_Target + { + float4 Weights = tex2D ( _A, i.uv ); + float4 LayerBase = tex2D ( _B, i.uv ); + float4 Layer1 = tex2D ( _C, i.uv ); + float4 Layer2 = tex2D ( _D, i.uv ); + float4 Layer3 = tex2D ( _E, i.uv ); + return lerp ( lerp ( lerp ( LayerBase, Layer1, Weights.x ), Layer2, Weights.y ), Layer3, Weights.z ); + } + ENDCG + } + + Pass + { + CGPROGRAM + sampler2D _D; + sampler2D _E; + sampler2D _F; + float4 frag ( v2f_img i ) : SV_Target + { + float4 Weights = tex2D ( _A, i.uv ); + float4 LayerBase = tex2D ( _B, i.uv ); + float4 Layer1 = tex2D ( _C, i.uv ); + float4 Layer2 = tex2D ( _D, i.uv ); + float4 Layer3 = tex2D ( _E, i.uv ); + float4 Layer4 = tex2D ( _F, i.uv ); + return lerp ( lerp ( lerp ( lerp ( LayerBase, Layer1, Weights.x ), Layer2, Weights.y ), Layer3, Weights.z ), Layer4, Weights.w ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader.meta new file mode 100644 index 00000000..8a9b35b7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 48faca2f6506fc44c97adb1e2b79c37d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader new file mode 100644 index 00000000..ab8d48d9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader @@ -0,0 +1,77 @@ +Shader "Hidden/LengthOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag (v2f_img i) : SV_Target + { + return length( tex2D (_A, i.uv).x ); + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag (v2f_img i) : SV_Target + { + return length( tex2D(_A, i.uv).xy ); + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag (v2f_img i) : SV_Target + { + return length( tex2D(_A, i.uv).xyz ); + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag (v2f_img i) : SV_Target + { + return length( tex2D(_A, i.uv)); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader.meta new file mode 100644 index 00000000..9141f38f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 1c1f6d6512b758942a8b9dd1bea12f34 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader new file mode 100644 index 00000000..1710aa1b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader @@ -0,0 +1,33 @@ +Shader "Hidden/LerpOp" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_Alpha", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + float4 alpha = tex2D( _C, i.uv ); + return lerp(a,b,alpha); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader.meta new file mode 100644 index 00000000..d87b8ac6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 34d9c4cdcf1fadb49af2de3f90bbc57d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader new file mode 100644 index 00000000..606b12f2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader @@ -0,0 +1,27 @@ +Shader "Hidden/LightAttenuation" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "Lighting.cginc" + + float4 _EditorWorldLightPos; + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 worldNormal = UnityObjectToWorldNormal( normal ); + float3 lightDir = normalize( _EditorWorldLightPos.xyz ); + return saturate(dot(worldNormal ,lightDir) * 10 + 0.1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader.meta new file mode 100644 index 00000000..57cae23b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 4b12227498a5c8d46b6c44ea018e5b56 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader new file mode 100644 index 00000000..9c1a3ebb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader @@ -0,0 +1,59 @@ +Shader "Hidden/LightColorNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "Lighting.cginc" + + float4 _EditorLightColor; + + float4 frag(v2f_img i) : SV_Target + { + return _EditorLightColor; + } + ENDCG + } + + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "Lighting.cginc" + + float4 _EditorLightColor; + + float4 frag(v2f_img i) : SV_Target + { + return float4(_EditorLightColor.rgb, 0); + } + ENDCG + } + + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "Lighting.cginc" + + float4 _EditorLightColor; + + float4 frag(v2f_img i) : SV_Target + { + return _EditorLightColor.a; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader.meta new file mode 100644 index 00000000..beccd9c8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 43f5d3c033eb5044e9aeb40241358349 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader new file mode 100644 index 00000000..14a774b3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader @@ -0,0 +1,45 @@ +Shader "Hidden/LinearDepthNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + float depthValue = tex2D( _A, i.uv ).r; + return LinearEyeDepth( depthValue ); + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + float depthValue = tex2D( _A, i.uv ).r; + return Linear01Depth( depthValue ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader.meta new file mode 100644 index 00000000..8d8fad09 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 2b0785cc8b854974ab4e45419072705a +timeCreated: 1546440865 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader new file mode 100644 index 00000000..637988fb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader @@ -0,0 +1,28 @@ +Shader "Hidden/LinearToGammaNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + float4 c = tex2D( _A, i.uv ); + c.rgb = LinearToGammaSpace( c.rgb ); + return c; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader.meta new file mode 100644 index 00000000..32ce70de --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 9027c408b928c5c4d8b450712049d541 +timeCreated: 1489078120 +licenseType: Store +ShaderImporter: + defaultTextures: + - _MainTex: {instanceID: 0} + - _BackGround: {fileID: 2800000, guid: 750b1bd7ba8bd28489650de6d0a95cc5, type: 3} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader new file mode 100644 index 00000000..eeee5f9b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/Log10OpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return log10(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader.meta new file mode 100644 index 00000000..c59207e3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 9e7cfa357dd261f499d0ba8637ff2614 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader new file mode 100644 index 00000000..68432043 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/Log2OpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return log2(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader.meta new file mode 100644 index 00000000..3d8d5e7c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 5975a154432d4c64cacd78d015ed08ba +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader new file mode 100644 index 00000000..5f745ca2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/LogOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return log(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader.meta new file mode 100644 index 00000000..c8367f1c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: a3293e0a73834b24682775f5d8ee1e7c +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader new file mode 100644 index 00000000..292d520f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader @@ -0,0 +1,27 @@ +Shader "Hidden/LuminanceNode" +{ + Properties + { + _A ("_RGB", 2D) = "white" {} + } + SubShader + { + Pass //Luminance + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + float lum = Luminance( tex2D( _A, i.uv ) ); + return float4( lum.xxx, 1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader.meta new file mode 100644 index 00000000..9c4918ff --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 81e1d8ffeec8a4b4cabb1094bc981048 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NandNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NandNode.shader new file mode 100644 index 00000000..20e4fcbf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NandNode.shader @@ -0,0 +1,28 @@ +Shader "Hidden/AllNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag(v2f_img i) : SV_Target + { + return ( !tex2D(_A, i.uv) && !tex2D(_B, i.uv) ) ? ( 1 ).xxxx : ( 0 ).xxxx; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NandNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NandNode.shader.meta new file mode 100644 index 00000000..9e5f9413 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NandNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 04fb2bacb454a424d8cfeff7d95cca52 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NandNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader new file mode 100644 index 00000000..227d62b2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/NegateNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return -(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader.meta new file mode 100644 index 00000000..19d33e0d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: b035bc40da1ac7c4eafad4116382ec79 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader new file mode 100644 index 00000000..25d6c794 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader @@ -0,0 +1,59 @@ +Shader "Hidden/NodeMasking" +{ + Properties { + _Ports ("_Ports", Vector) = (0,0,0,0) + _MainTex("_MainTex", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _MainTex; + float4 _Ports; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _MainTex, i.uv ); + return a * _Ports; + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _MaskTex; + float _Port; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _MaskTex, i.uv ); + float4 c = 0; + if ( _Port == 1 ) + c = a.x; + else if ( _Port == 2 ) + c = a.y; + else if ( _Port == 3 ) + c = a.z; + else if ( _Port == 4 ) + c = a.w; + else if ( _Port == 5 ) + c = float4( a.xyz, 0 ); + + return c; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader.meta new file mode 100644 index 00000000..85305148 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 9c34f18ebe2be3e48b201b748c73dec0 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader new file mode 100644 index 00000000..534cfff1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader @@ -0,0 +1,272 @@ +Shader "Hidden/NoiseGeneratorNode" +{ + Properties + { + _A ("_RGB", 2D) = "white" {} + _B ("_RGB", 2D) = "white" {} + _To01Range ("_To01Range", Float) = 0 + } + + SubShader + { + CGINCLUDE + sampler2D _A; + sampler2D _B; + float _To01Range; + ENDCG + + Pass //Simplex2D + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + + float3 mod2D289 ( float3 x ) { return x - floor ( x * ( 1.0 / 289.0 ) ) * 289.0; } + float2 mod2D289 ( float2 x ) { return x - floor ( x * ( 1.0 / 289.0 ) ) * 289.0; } + float3 permute ( float3 x ) { return mod2D289 ( ( ( x * 34.0 ) + 1.0 ) * x ); } + + float snoise ( float2 v ) + { + const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 ); + float2 i = floor ( v + dot ( v, C.yy ) ); + float2 x0 = v - i + dot ( i, C.xx ); + float2 i1; + i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 ); + float4 x12 = x0.xyxy + C.xxzz; + x12.xy -= i1; + i = mod2D289 ( i ); + float3 p = permute ( permute ( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) ); + float3 m = max ( 0.5 - float3( dot ( x0, x0 ), dot ( x12.xy, x12.xy ), dot ( x12.zw, x12.zw ) ), 0.0 ); + m = m * m; + m = m * m; + float3 x = 2.0 * frac ( p * C.www ) - 1.0; + float3 h = abs ( x ) - 0.5; + float3 ox = floor ( x + 0.5 ); + float3 a0 = x - ox; + m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h ); + float3 g; + g.x = a0.x * x0.x + h.x * x0.y; + g.yz = a0.yz * x12.xz + h.yz * x12.yw; + return 130.0 * dot ( m, g ); + } + float4 frag(v2f_img i) : SV_Target + { + float2 size = tex2D( _A, i.uv ).rg; + float scale = tex2D (_B, i.uv).r; + float noiseVal = snoise ( size * scale ); + noiseVal = (_To01Range > 0) ? noiseVal * 0.5 + 0.5 : noiseVal; + return float4( noiseVal.xxx, 1); + } + ENDCG + } + + Pass //Simplex3D + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float3 mod3D289 ( float3 x ) { return x - floor ( x / 289.0 ) * 289.0; } + + float4 mod3D289 ( float4 x ) { return x - floor ( x / 289.0 ) * 289.0; } + + float4 permute ( float4 x ) { return mod3D289 ( ( x * 34.0 + 1.0 ) * x ); } + + float4 taylorInvSqrt ( float4 r ) { return 1.79284291400159 - r * 0.85373472095314; } + + float snoise ( float3 v ) + { + const float2 C = float2( 1.0 / 6.0, 1.0 / 3.0 ); + float3 i = floor ( v + dot ( v, C.yyy ) ); + float3 x0 = v - i + dot ( i, C.xxx ); + float3 g = step ( x0.yzx, x0.xyz ); + float3 l = 1.0 - g; + float3 i1 = min ( g.xyz, l.zxy ); + float3 i2 = max ( g.xyz, l.zxy ); + float3 x1 = x0 - i1 + C.xxx; + float3 x2 = x0 - i2 + C.yyy; + float3 x3 = x0 - 0.5; + i = mod3D289 ( i ); + float4 p = permute ( permute ( permute ( i.z + float4( 0.0, i1.z, i2.z, 1.0 ) ) + i.y + float4( 0.0, i1.y, i2.y, 1.0 ) ) + i.x + float4( 0.0, i1.x, i2.x, 1.0 ) ); + float4 j = p - 49.0 * floor ( p / 49.0 ); // mod(p,7*7) + float4 x_ = floor ( j / 7.0 ); + float4 y_ = floor ( j - 7.0 * x_ ); // mod(j,N) + float4 x = ( x_ * 2.0 + 0.5 ) / 7.0 - 1.0; + float4 y = ( y_ * 2.0 + 0.5 ) / 7.0 - 1.0; + float4 h = 1.0 - abs ( x ) - abs ( y ); + float4 b0 = float4( x.xy, y.xy ); + float4 b1 = float4( x.zw, y.zw ); + float4 s0 = floor ( b0 ) * 2.0 + 1.0; + float4 s1 = floor ( b1 ) * 2.0 + 1.0; + float4 sh = -step ( h, 0.0 ); + float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; + float4 a1 = b1.xzyw + s1.xzyw * sh.zzww; + float3 g0 = float3( a0.xy, h.x ); + float3 g1 = float3( a0.zw, h.y ); + float3 g2 = float3( a1.xy, h.z ); + float3 g3 = float3( a1.zw, h.w ); + float4 norm = taylorInvSqrt ( float4( dot ( g0, g0 ), dot ( g1, g1 ), dot ( g2, g2 ), dot ( g3, g3 ) ) ); + g0 *= norm.x; + g1 *= norm.y; + g2 *= norm.z; + g3 *= norm.w; + float4 m = max ( 0.6 - float4( dot ( x0, x0 ), dot ( x1, x1 ), dot ( x2, x2 ), dot ( x3, x3 ) ), 0.0 ); + m = m* m; + m = m* m; + float4 px = float4( dot ( x0, g0 ), dot ( x1, g1 ), dot ( x2, g2 ), dot ( x3, g3 ) ); + return 42.0 * dot ( m, px ); + } + + float4 frag ( v2f_img i ) : SV_Target + { + float3 size = tex2D ( _A, i.uv ).rgb; + float scale = tex2D (_B, i.uv).r; + float noiseVal = snoise ( size * scale ); + noiseVal = (_To01Range > 0) ? noiseVal * 0.5 + 0.5 : noiseVal; + return float4( noiseVal.xxx, 1 ); + } + ENDCG + } + + Pass // Gradient - Shader Toy + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + //https://www.shadertoy.com/view/XdXGW8 + float2 GradientNoiseDir (float2 x) + { + const float2 k = float2(0.3183099, 0.3678794); + x = x * k + k.yx; + return -1.0 + 2.0 * frac (16.0 * k * frac (x.x * x.y * (x.x + x.y))); + } + + float GradientNoise (float2 UV, float Scale) + { + float2 p = UV * Scale; + float2 i = floor (p); + float2 f = frac (p); + float2 u = f * f * (3.0 - 2.0 * f); + return lerp (lerp (dot (GradientNoiseDir (i + float2(0.0, 0.0)), f - float2(0.0, 0.0)), + dot (GradientNoiseDir (i + float2(1.0, 0.0)), f - float2(1.0, 0.0)), u.x), + lerp (dot (GradientNoiseDir (i + float2(0.0, 1.0)), f - float2(0.0, 1.0)), + dot (GradientNoiseDir (i + float2(1.0, 1.0)), f - float2(1.0, 1.0)), u.x), u.y); + } + + float4 frag (v2f_img i) : SV_Target + { + float3 size = tex2D (_A, i.uv).rgb; + float scale = tex2D (_B, i.uv).r; + float noiseVal = GradientNoise (size , scale); + noiseVal = (_To01Range > 0) ? noiseVal * 0.5 + 0.5 : noiseVal; + return float4(noiseVal.xxx, 1); + } + ENDCG + } + + Pass // Gradient - Unity + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float2 UnityGradientNoiseDir (float2 p) + { + p = fmod (p , 289); + float x = fmod ((34 * p.x + 1) * p.x , 289) + p.y; + x = fmod ((34 * x + 1) * x , 289); + x = frac (x / 41) * 2 - 1; + return normalize (float2(x - floor (x + 0.5), abs (x) - 0.5)); + } + + float UnityGradientNoise (float2 UV, float Scale) + { + float2 p = UV * Scale; + float2 ip = floor (p); + float2 fp = frac (p); + float d00 = dot (UnityGradientNoiseDir (ip), fp); + float d01 = dot (UnityGradientNoiseDir (ip + float2(0, 1)), fp - float2(0, 1)); + float d10 = dot (UnityGradientNoiseDir (ip + float2(1, 0)), fp - float2(1, 0)); + float d11 = dot (UnityGradientNoiseDir (ip + float2(1, 1)), fp - float2(1, 1)); + fp = fp * fp * fp * (fp * (fp * 6 - 15) + 10); + return lerp (lerp (d00, d01, fp.y), lerp (d10, d11, fp.y), fp.x) + 0.5; + } + + float4 frag (v2f_img i) : SV_Target + { + float3 size = tex2D (_A, i.uv).rgb; + float scale = tex2D (_B, i.uv).r; + float noiseVal = UnityGradientNoise(size , scale); + noiseVal = (_To01Range > 0) ? noiseVal * 0.5 + 0.5 : noiseVal; + return float4(noiseVal.xxx, 1); + } + ENDCG + } + + Pass // Simple + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + inline float noise_randomValue (float2 uv) { return frac(sin(dot(uv, float2(12.9898, 78.233)))*43758.5453); } + inline float noise_interpolate (float a, float b, float t) { return (1.0-t)*a + (t*b); } + inline float valueNoise (float2 uv) + { + float2 i = floor(uv); + float2 f = frac( uv ); + f = f* f * (3.0 - 2.0 * f); + uv = abs( frac(uv) - 0.5); + float2 c0 = i + float2( 0.0, 0.0 ); + float2 c1 = i + float2( 1.0, 0.0 ); + float2 c2 = i + float2( 0.0, 1.0 ); + float2 c3 = i + float2( 1.0, 1.0 ); + float r0 = noise_randomValue( c0 ); + float r1 = noise_randomValue( c1 ); + float r2 = noise_randomValue( c2 ); + float r3 = noise_randomValue( c3 ); + float bottomOfGrid = noise_interpolate( r0, r1, f.x ); + float topOfGrid = noise_interpolate( r2, r3, f.x ); + float t = noise_interpolate( bottomOfGrid, topOfGrid, f.y ); + return t; + } + + float SimpleNoise(float2 UV) + { + float t = 0.0; + float freq = pow( 2.0, float( 0 ) ); + float amp = pow( 0.5, float( 3 - 0 ) ); + t += valueNoise( UV/freq )*amp; + freq = pow(2.0, float(1)); + amp = pow(0.5, float(3-1)); + t += valueNoise( UV/freq )*amp; + freq = pow(2.0, float(2)); + amp = pow(0.5, float(3-2)); + t += valueNoise( UV/freq )*amp; + return t; + } + + float4 frag (v2f_img i) : SV_Target + { + float3 size = tex2D (_A, i.uv).rgb; + float scale = tex2D (_B, i.uv).r; + float noiseVal = SimpleNoise(size * scale); + noiseVal = (_To01Range == 0) ? noiseVal * 2 - 1 : noiseVal; + return float4(noiseVal.xxx, 1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader.meta new file mode 100644 index 00000000..8e275dd8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: cd2d37ef5da190b42a91a5a690ba2a7d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader new file mode 100644 index 00000000..ff911407 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader @@ -0,0 +1,21 @@ +Shader "Hidden/NormalVertexDataNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag(v2f_img i) : SV_Target + { + float3 normal = PreviewFragmentNormalOS( i.uv ); + return float4(normal, 1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader.meta new file mode 100644 index 00000000..f5f136a0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6b24b06c33f9fe84c8a2393f13ab5406 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader new file mode 100644 index 00000000..a407db40 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/NormalizeNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return normalize(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader.meta new file mode 100644 index 00000000..4ed156af --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: a51b11dfb6b32884e930595e5f9defa8 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NotNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NotNode.shader new file mode 100644 index 00000000..c08acab3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NotNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/NotNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return ( !tex2D(_A, i.uv) ) ? ( 1 ).xxxx : ( 0 ).xxxx; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NotNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NotNode.shader.meta new file mode 100644 index 00000000..129faae3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NotNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 53b1c286459bd074ea26bad298660f98 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NotNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader new file mode 100644 index 00000000..ddbf4800 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader @@ -0,0 +1,23 @@ +Shader "Hidden/ObjSpaceLightDirHlpNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 _EditorWorldLightPos; + + float4 frag( v2f_img i ) : SV_Target + { + float3 lightDir = mul(unity_WorldToObject, normalize( _EditorWorldLightPos.xyz ) ); + return float4 ( lightDir, 1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader.meta new file mode 100644 index 00000000..283e64d0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: c7852de24cec4a744b5358921e23feee +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader new file mode 100644 index 00000000..6bd37efa --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/ObjSpaceViewDirHlpNode" +{ +Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + sampler2D _A; + + float4 frag( v2f_img i ) : SV_Target + { + return float4(ObjSpaceViewDir(tex2D( _A, i.uv )),0); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader.meta new file mode 100644 index 00000000..11058156 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: b6b985e165d0dd44c96a05b46e267e64 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectPositionNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectPositionNode.shader new file mode 100644 index 00000000..93ba1457 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectPositionNode.shader @@ -0,0 +1,22 @@ +Shader "Hidden/ObjectPositionNode" +{ + SubShader + { + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag(v2f_img i) : SV_Target + { + float3 objectScale = UNITY_MATRIX_M._m03_m13_m23; + return float4(objectScale, 1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectPositionNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectPositionNode.shader.meta new file mode 100644 index 00000000..d9b5be8e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectPositionNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: e95171394c12a0646b8e9ec9c3f87d56 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectPositionNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader new file mode 100644 index 00000000..80df585a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader @@ -0,0 +1,38 @@ +Shader "Hidden/ObjectScaleNode" +{ + SubShader + { + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag(v2f_img i) : SV_Target + { + float3 objectScale = float3( length( unity_ObjectToWorld[ 0 ].xyz ), length( unity_ObjectToWorld[ 1 ].xyz ), length( unity_ObjectToWorld[ 2 ].xyz ) ); + return float4(objectScale, 1); + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag (v2f_img i) : SV_Target + { + float3 objectScale = 1.0 / float3(length (unity_WorldToObject[0].xyz), length (unity_WorldToObject[1].xyz), length (unity_WorldToObject[2].xyz)); + return float4(objectScale, 1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader.meta new file mode 100644 index 00000000..6377ccc6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 5540033c6c52f51468938c1a42bd2730 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader new file mode 100644 index 00000000..50c28d30 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader @@ -0,0 +1,29 @@ +Shader "Hidden/ObjectToClipPos" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag( v2f_img i ) : SV_Target + { + float3 pos = tex2D( _A, i.uv ).xyz; + return UnityObjectToClipPos(pos); + } + ENDCG + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader.meta new file mode 100644 index 00000000..d646ab7c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 14ec765a147a53340877b489e73f1c9f +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader new file mode 100644 index 00000000..04df6669 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader @@ -0,0 +1,30 @@ +Shader "Hidden/ObjectToViewPos" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag( v2f_img i ) : SV_Target + { + float3 pos = tex2D( _A, i.uv ).xyz; + float3 result = UnityObjectToViewPos(pos); + return float4(result, 1.0); + } + ENDCG + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader.meta new file mode 100644 index 00000000..bd012c0c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: b790bc1d468a51840a9facef372b4729 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader new file mode 100644 index 00000000..c9943b1b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/ObjectToWorldTransfNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return mul(unity_ObjectToWorld, tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader.meta new file mode 100644 index 00000000..62ca5696 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: a4044ee165813654486d0cecd0de478c +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader new file mode 100644 index 00000000..17ddee35 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/OneMinusNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return 1-tex2D(_A, i.uv); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader.meta new file mode 100644 index 00000000..08fe74ae --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: bed5300b92e7bb0419d0f4accb853312 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader new file mode 100644 index 00000000..f12ff0a8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader @@ -0,0 +1,20 @@ +Shader "Hidden/OrthoParams" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + return unity_OrthoParams; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader.meta new file mode 100644 index 00000000..de13e7d7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 88a910ece3dce224793e669bb1bc158d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader new file mode 100644 index 00000000..e8eeab08 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader @@ -0,0 +1,41 @@ +Shader "Hidden/PannerNode" +{ + Properties + { + _A ("_UVs", 2D) = "white" {} + _B ("_PanTime", 2D) = "white" {} + _C ("_PanSpeed", 2D ) = "white" {} + } + SubShader + { + Pass + { + Name "Panner" // 14 - UV panner node + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float _UsingEditor; + float _EditorTime; + + float4 frag(v2f_img i) : SV_Target + { + float multiplier = tex2D ( _B, i.uv ).r; + float time = _EditorTime*multiplier; + if ( _UsingEditor == 0 ) + { + time = multiplier; + } + float2 speed = tex2D ( _C, i.uv ).rg; + return tex2D( _A, i.uv) + time * float4( speed, 0, 0 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader.meta new file mode 100644 index 00000000..ca7b823f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6f89a5d96bdad114b9bbd0c236cac622 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader new file mode 100644 index 00000000..c85ca977 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader @@ -0,0 +1,45 @@ +Shader "Hidden/ParallaxMappingNode" +{ + Properties + { + _A ("_UV", 2D) = "white" {} + _B ("_Height", 2D) = "white" {} + _C ("_Scale", 2D) = "white" {} + _D ("_ViewDirTan", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + float _ParallaxType; + + float4 frag(v2f_img i) : SV_Target + { + float2 uv = tex2D( _A, i.uv ).rg; + float h = tex2D( _B, i.uv ).r; + float s = tex2D( _C, i.uv ).r; + float3 vt = tex2D( _D, i.uv ).xyz; + float2 parallaxed = uv; + if ( _ParallaxType == 1 ) { + parallaxed = ( ( h - 1 )*( vt.xy / vt.z ) * s ) + uv; + } + else { + parallaxed = ( ( h - 1 )*( vt.xy ) * s ) + uv; + } + + return float4(parallaxed, 0 , 0); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader.meta new file mode 100644 index 00000000..fc804e23 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 589f12f68e00ac74286815aa56053fcc +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader new file mode 100644 index 00000000..215a4a36 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader @@ -0,0 +1,36 @@ +Shader "Hidden/ParallaxOffset" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_C", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float4 frag( v2f_img i ) : SV_Target + { + float h = tex2D( _A, i.uv ).x; + float height = tex2D( _B, i.uv ).x; + float3 viewDir = tex2D( _C, i.uv ).xyz; + float2 result = ParallaxOffset (h, height, viewDir); + return float4(result, 0, 1); + + } + ENDCG + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader.meta new file mode 100644 index 00000000..18c014c8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6085f804c6fbf354eac039c11feaa7cc +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader new file mode 100644 index 00000000..62e7f8eb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader @@ -0,0 +1,22 @@ +Shader "Hidden/PiNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return tex2D( _A, i.uv ).r * UNITY_PI; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader.meta new file mode 100644 index 00000000..07c7371d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: bf4a65726dab3d445a69fb1d0945c33e +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader new file mode 100644 index 00000000..e81ad15c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader @@ -0,0 +1,21 @@ +Shader "Hidden/PosVertexDataNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + return float4(vertexPos, 1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader.meta new file mode 100644 index 00000000..d35411c3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: a5c14f759dd021b4b8d4b6eeb85ac227 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PositionNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PositionNode.shader new file mode 100644 index 00000000..c8651083 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PositionNode.shader @@ -0,0 +1,64 @@ +Shader "Hidden/WorldPosInputsNode" +{ + CGINCLUDE + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + ENDCG + + SubShader + { + // Object + Pass + { + CGPROGRAM + float4 frag( v2f_img i ) : SV_Target + { + float3 positionOS = PreviewFragmentPositionOS( i.uv ); + return float4( positionOS, 1 ); + } + ENDCG + } + + // World + Pass + { + CGPROGRAM + float4 frag( v2f_img i ) : SV_Target + { + float3 positionOS = PreviewFragmentPositionOS( i.uv ); + float3 positionWS = mul( unity_ObjectToWorld, positionOS ); + return float4( positionWS, 1 ); + } + ENDCG + } + + // Relative World + Pass + { + CGPROGRAM + float4 frag( v2f_img i ) : SV_Target + { + float3 positionOS = PreviewFragmentPositionOS( i.uv ); + float3 positionWS = mul( unity_ObjectToWorld, positionOS ); + float3 positionRWS = positionWS - preview_WorldSpaceCameraPos.xyz; + return float4( positionRWS, 1 ); + } + ENDCG + } + + // View + Pass + { + CGPROGRAM + float4 frag( v2f_img i ) : SV_Target + { + float3 positionOS = PreviewFragmentPositionOS( i.uv ); + float3 positionVS = UnityObjectToViewPos( positionOS ); + return float4( positionVS, 1 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PositionNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PositionNode.shader.meta new file mode 100644 index 00000000..6a19352c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PositionNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 62a28fcb1f1dd5640a572771eb121a3b +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PositionNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader new file mode 100644 index 00000000..5161a3dd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader @@ -0,0 +1,36 @@ +Shader "Hidden/PosterizeNode" +{ + Properties + { + _A ( "_RGBA", 2D ) = "white" {} + _B ( "_Power", 2D ) = "white" {} + } + + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + uniform sampler2D _A; + uniform sampler2D _B; + + float4 frag ( v2f_img i ) : SV_Target + { + float4 rgba = tex2D ( _B, i.uv ); + float power = tex2D ( _A, i.uv ).r; + if ( power < 1 ) + return float4(0,0,0,0); + float divideOp = 256.0 / float ( (int)power ); + float4 finalColor = ( floor ( rgba * divideOp ) / divideOp ); + + return finalColor; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader.meta new file mode 100644 index 00000000..c6b6b20a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: ecb3048ef0eec1645bad1d72a98d8279 +timeCreated: 1515421907 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader new file mode 100644 index 00000000..5d903121 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/PowerNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + return pow(a, b); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader.meta new file mode 100644 index 00000000..3260be75 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 758cc2f8b537b4e4b93d9833075d138c +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader new file mode 100644 index 00000000..d3e6262f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader @@ -0,0 +1,20 @@ +Shader "Hidden/PrimitiveIDVariableNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag( v2f_img i, uint ase_primitiveId : SV_PrimitiveID ) : SV_Target + { + return ase_primitiveId; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader.meta new file mode 100644 index 00000000..f9549f2f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 92c1b588d7658594cb219696f593f64b +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader new file mode 100644 index 00000000..eefc0d63 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader @@ -0,0 +1,20 @@ +Shader "Hidden/ProjectionParams" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + return _ProjectionParams; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader.meta new file mode 100644 index 00000000..27be6c3b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 97ae846cb0a6b044388fad3bc03bb4c2 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader new file mode 100644 index 00000000..29ba880f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader @@ -0,0 +1,38 @@ +Shader "Hidden/RGBToHSVNode" +{ + Properties + { + _A ( "_RGB", 2D ) = "white" {} + } + + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + uniform sampler2D _A; + + float3 RGBToHSV(float3 c) + { + float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + float4 p = lerp( float4( c.bg, K.wz ), float4( c.gb, K.xy ), step( c.b, c.g ) ); + float4 q = lerp( float4( p.xyw, c.r ), float4( c.r, p.yzx ), step( p.x, c.r ) ); + float d = q.x - min( q.w, q.y ); + float e = 1.0e-10; + return float3( abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); + } + + float4 frag ( v2f_img i ) : SV_Target + { + float3 rgb = tex2D ( _A, i.uv ).rgb; + return float4( RGBToHSV(rgb), 1 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader.meta new file mode 100644 index 00000000..42738541 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 0f2f09b49bf4954428aafa2dfe1a9a09 +timeCreated: 1515423140 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader new file mode 100644 index 00000000..9561bd26 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/RadiansOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return radians(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader.meta new file mode 100644 index 00000000..d4a0a095 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: d27d189eaf6eeb04fae9913d9617ece5 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader new file mode 100644 index 00000000..a96b42b1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader @@ -0,0 +1,25 @@ +Shader "Hidden/RangedFloatNode" +{ + Properties { + _InputFloat ("_InputFloat", Float) = 0 + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float _InputFloat; + + float4 frag( v2f_img i ) : SV_Target + { + return _InputFloat; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader.meta new file mode 100644 index 00000000..6a8b0c91 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: d9ca47581ac157145bff6f72ac5dd73e +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReciprocalNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReciprocalNode.shader new file mode 100644 index 00000000..533ca739 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReciprocalNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/ReciprocalNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + #if ( SHADER_TARGET >= 50 ) + return rcp( tex2D( _A, i.uv ) ); + #else + return 1.0 / tex2D( _A, i.uv ); + #endif + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReciprocalNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReciprocalNode.shader.meta new file mode 100644 index 00000000..8eb5431c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReciprocalNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 51c79938d491c8244a633fe407c49327 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReciprocalNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader new file mode 100644 index 00000000..d820805a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/ReflectOpNode" +{ + Properties + { + _A ("_Incident", 2D) = "white" {} + _B ("_Normal", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + return reflect(a, b); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader.meta new file mode 100644 index 00000000..bdc96ce7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: fb520f2145c0fa0409320a9e6d720758 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectionProbe.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectionProbe.shader new file mode 100644 index 00000000..b03b29cd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectionProbe.shader @@ -0,0 +1,68 @@ +Shader "Hidden/IndirectSpecularLight" +{ + Properties + { + _Skybox("_Skybox", CUBE) = "white" {} + _A ("View Dir OS", 2D) = "white" {} + _B ("Normal OS", 2D) = "white" {} + _C ("LOD", 2D) = "white" {} + } + + SubShader + { + Pass // not connected + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + uniform samplerCUBE _Skybox; + sampler2D _A; + sampler2D _B; + sampler2D _C; + + uint viewDirInput; + uint normalInput; + uint lodInput; + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 worldNormal = UnityObjectToWorldNormal( normal ); + float3 worldViewDir = normalize( preview_WorldSpaceCameraPos - vertexPos ); + float lod = 0; + + float2 sphereUV = PreviewFragmentSphericalUV( i.uv ); + + if ( viewDirInput != 0 ) + { + float3 viewDirOS = tex2D( _A, sphereUV ); + worldViewDir = UnityObjectToWorldDir( viewDirOS ); + } + + if ( normalInput != 0 ) + { + float3 normalOS = tex2D( _B, i.uv ); + worldNormal = UnityObjectToWorldNormal( normalOS ); + } + + if ( lodInput != 0 ) + { + lod = tex2D( _C, i.uv ); + } + + float3 worldRefl = normalize( reflect( -worldViewDir, worldNormal ) ); + + float3 sky = texCUBElod( _Skybox, float4( worldRefl, lod ) ).rgb; + + return float4( sky, 1 ); +} + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectionProbe.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectionProbe.shader.meta new file mode 100644 index 00000000..cca960fe --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectionProbe.shader.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: f7d3fa6f91f1f184f89060feb01051a1 +timeCreated: 1512052132 +licenseType: Store +ShaderImporter: + defaultTextures: + - _Skybox: {fileID: 8900000, guid: ef7513b54a0670140b9b967af7620563, type: 3} + - _A: {instanceID: 0} + - _B: {instanceID: 0} + - _C: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectionProbe.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader new file mode 100644 index 00000000..ba4a05ee --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader @@ -0,0 +1,33 @@ +Shader "Hidden/RefractOpVec" +{ + Properties + { + _A ("_Incident", 2D) = "white" {} + _B ("_Normal", 2D) = "white" {} + _C ("_Eta", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float4 frag(v2f_img i) : SV_Target + { + float4 inc = tex2D( _A, i.uv ); + float4 nor = tex2D( _B, i.uv ); + float4 eta = tex2D( _C, i.uv ); + return refract( inc, nor, eta ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader.meta new file mode 100644 index 00000000..458dc983 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 5ab44ca484bed8b4884b03b1c00fdc3d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader new file mode 100644 index 00000000..98eb5e00 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/RegisterLocalVarNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return tex2D( _A, i.uv ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader.meta new file mode 100644 index 00000000..b8214b6a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 5aaa1d3ea9e1fa64781647e035a82334 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader new file mode 100644 index 00000000..0263512f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/RelayNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return tex2D( _A, i.uv ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader.meta new file mode 100644 index 00000000..7d73d032 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 74e4d859fbdb2c0468de3612145f4929 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader new file mode 100644 index 00000000..82a5a446 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader @@ -0,0 +1,44 @@ +Shader "Hidden/RotatorNode" +{ + Properties + { + _A ("_UVs", 2D) = "white" {} + _B ("_Anchor", 2D) = "white" {} + _C ("_RotTimeTex", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + sampler2D _A; + sampler2D _B; + sampler2D _C; + float _UsingEditor; + float _EditorTime; + + float4 frag(v2f_img i) : SV_Target + { + float multiplier = tex2D ( _C, i.uv ).r; + float time = _EditorTime*multiplier; + + if ( _UsingEditor == 0 ) + { + time = multiplier; + } + + float cosT = cos( time ); + float sinT = sin( time ); + + float2 a = tex2D( _B, i.uv ).rg; + return float4( mul( tex2D( _A, i.uv ).xy - a, float2x2( cosT, -sinT, sinT, cosT ) ) + a, 0, 1 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader.meta new file mode 100644 index 00000000..b5b42bec --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: e21408a1c7f12f14bbc2652f69bce1fc +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader new file mode 100644 index 00000000..3606862a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/RoundOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return round(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader.meta new file mode 100644 index 00000000..3f51153a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 554d561417b207c4bb3cd4a0c86b6907 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader new file mode 100644 index 00000000..245567ac --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/RSqrtOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return rsqrt(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader.meta new file mode 100644 index 00000000..ebf695be --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: c58c17cb1f7f6e6429a2c7a6cdaef87d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader new file mode 100644 index 00000000..cd0eae44 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader @@ -0,0 +1,139 @@ +Shader "Hidden/SamplerNode" +{ + Properties + { + _B ("_UVs", 2D) = "white" {} + _C ("_Level", 2D) = "white" {} + _F ("_NormalScale", 2D) = "white" {} + _G ("Index", 2D) = "white" {} + _CustomUVs ("_CustomUVs", Int) = 0 + _Unpack ("_Unpack", Int) = 0 + _LodType ("_LodType", Int) = 0 + + _Sampler ("_Sampler", 2D) = "white" {} + _Sampler3D ("_Sampler3D", 3D) = "white" {} + _Array ("_Array", 2DArray) = "white" {} + _Cube( "_Cube", CUBE) = "white" {} + _Default ("_Default", Int) = 0 + _Type ("_Type", Int) = 0 + } + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #pragma target 3.5 + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "UnityStandardUtils.cginc" + + sampler2D _F; + int _CustomUVs; + int _Unpack; + int _Default; + + float4 frag( v2f_img i ) : SV_Target + { + const float3 white = float3( 1, 1, 1 ); + const float3 black = float3( 0, 0, 0 ); + const float3 grey = GammaToLinearSpace( 127.0 / 255.0 ).xxx; + const float3 bump = float3( 0.5, 0.5, 1 ); + const float3 linearGrey = ( 127.0 / 255.0 ).xxx; + const float3 red = float3( 1, 0, 0 ); + + float4 result = float4( 0, 0, 0, 1 ); + switch ( _Default ) + { + case 1: result.rgb = white; break; + case 2: result.rgb = black; break; + case 3: result.rgb = grey; break; + case 4: result.rgb = ( _Unpack == 1 ) ? UnpackScaleNormal( bump.xxyy, tex2D( _F, i.uv ).r ) : bump; break; + case 5: result.rgb = linearGrey; break; + case 6: result.rgb = red; break; + } + return result; + } + ENDCG + } + + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #pragma target 3.5 + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "UnityStandardUtils.cginc" + + sampler2D _B; + sampler2D _C; + sampler2D _F; + sampler2D _G; + int _CustomUVs; + int _Unpack; + int _LodType; + + UNITY_DECLARE_TEX2DARRAY (_Array); + samplerCUBE _Cube; + sampler2D _Sampler; + sampler3D _Sampler3D; + int _Type; + + float4 frag (v2f_img i) : SV_Target + { + if (_Type == 4) + { + return UNITY_SAMPLE_TEX2DARRAY ( _Array, float3(i.uv, tex2D( _G, i.uv ).r ) ); + } + else if (_Type == 3) + { + float3 uvs = float3(i.uv,0); + + if (_CustomUVs == 1) + uvs = tex2D (_B, i.uv).xyz; + + return texCUBE (_Cube, uvs); + } + else if (_Type == 2) + { + return tex3D (_Sampler3D, float3(i.uv,0)); + } + else + { + float2 uvs = i.uv; + float4 c = 0; + + if (_CustomUVs == 1) + uvs = tex2D (_B, i.uv).xy; + + if (_LodType == 1) + { + float lod = tex2D (_C, i.uv).r; + c = tex2Dlod (_Sampler, float4(uvs,0,lod)); + } + else if (_LodType == 2) + { + float bias = tex2D (_C, i.uv).r; + c = tex2Dbias (_Sampler, float4(uvs,0,bias)); + } + else + { + c = tex2D (_Sampler, uvs); + } + + if (_Unpack == 1) + { + float nscale = tex2D (_F, i.uv).r; + c.rgb = UnpackScaleNormal (c, nscale); + } + + return c; + } + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader.meta new file mode 100644 index 00000000..db58774b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 7b4e86a89b70ae64993bf422eb406422 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader new file mode 100644 index 00000000..6dd778e8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/SaturateNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return saturate(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader.meta new file mode 100644 index 00000000..9d1cfa54 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: d9e53418dc8b9d34fb395e3ea3c75985 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader new file mode 100644 index 00000000..dca2092b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader @@ -0,0 +1,34 @@ +Shader "Hidden/ScaleAndOffsetNode" +{ + Properties + { + _A ("_Value", 2D) = "white" {} + _B ("_Scale", 2D) = "white" {} + _C ("_Offset", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float4 frag(v2f_img i) : SV_Target + { + float4 v = tex2D( _A, i.uv ); + float4 s = tex2D( _B, i.uv ); + float4 o = tex2D( _C, i.uv ); + + return v * s + o; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader.meta new file mode 100644 index 00000000..f4cabf4b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: a1f1053d4d9c3be439e0382038b74771 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader new file mode 100644 index 00000000..6e9b736e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader @@ -0,0 +1,28 @@ +Shader "Hidden/ScaleNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + float _ScaleFloat; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + return a * _ScaleFloat; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader.meta new file mode 100644 index 00000000..d711e3a2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6d8ec9d9dab62c44aa2dcc0e3987760d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader new file mode 100644 index 00000000..2a9d9527 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader @@ -0,0 +1,20 @@ +Shader "Hidden/ScreenParams" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + return _ScreenParams; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader.meta new file mode 100644 index 00000000..fe70d260 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 78173633b803de4419206191fed3d61e +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader new file mode 100644 index 00000000..08c17372 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader @@ -0,0 +1,92 @@ +Shader "Hidden/ScreenPosInputsNode" +{ + SubShader + { + CGINCLUDE + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + uniform float4 _ASEPreviewSize; + + inline float4 CalculateScreenPos( float2 uv, bool norm = true, float z = 0.01 ) + { + float2 xy = 2 * uv - 1; + float3 vertexPos = float3( xy, z ); + float4x4 P = float4x4( 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ); //UNITY_MATRIX_P + float4x4 V = UNITY_MATRIX_V; //float4x4(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1); //UNITY_MATRIX_V + float4x4 M = unity_ObjectToWorld; //float4x4(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1); //unity_ObjectToWorld + float4x4 VPmatrix = mul( P, V ); + float4 clipPos = mul( VPmatrix, mul( M, float4( vertexPos, 1.0 ) ) ); //same as object to clip pos + float4 screenPos = ComputeScreenPos( clipPos ); + screenPos = norm ? screenPos / screenPos.w : screenPos; + return screenPos; + } + ENDCG + + // Normalized + Pass + { + CGPROGRAM + float4 frag( v2f_img i ) : SV_Target + { + return CalculateScreenPos( i.uv ); + } + ENDCG + } + + // Raw + Pass + { + CGPROGRAM + float4 frag( v2f_img i ) : SV_Target + { + return CalculateScreenPos( i.uv, false, 0.99 ); + } + ENDCG + } + + // Center + Pass + { + CGPROGRAM + float4 frag( v2f_img i ) : SV_Target + { + float4 screenPos = CalculateScreenPos( i.uv ); + return float4( screenPos.xy * 2 - 1, 0, 0 ); + } + ENDCG + } + + // Tiled + Pass + { + CGPROGRAM + float4 frag( v2f_img i ) : SV_Target + { + float4 screenPos = CalculateScreenPos( i.uv ); + return frac( float4( ( screenPos.x * 2 - 1 ) * _ASEPreviewSize.x / _ASEPreviewSize.y, screenPos.y * 2 - 1, 0, 0 ) ); + } + ENDCG + } + + // Screen + Pass + { + CGPROGRAM + float4 frag( v2f_img i ) : SV_Target + { + float4 screenPos = CalculateScreenPos( i.uv ); + screenPos.xy *= _ASEPreviewSize.xy; + #if UNITY_UV_STARTS_AT_TOP + screenPos.xy = float2( screenPos.x, ( _ProjectionParams.x < 0 ) ? _ASEPreviewSize.y - screenPos.y : screenPos.y ); + #else + screenPos.xy = float2( screenPos.x, ( _ProjectionParams.x > 0 ) ? _ASEPreviewSize.y - screenPos.y : screenPos.y ); + #endif + return float4( screenPos.xy, 0, 0 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader.meta new file mode 100644 index 00000000..7dd9c94a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: a5e7295278a404175b732f1516fb68a6 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader new file mode 100644 index 00000000..3dfb6212 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader @@ -0,0 +1,35 @@ +Shader "Hidden/ShadeVertexLights" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _LightCount( "_LightCount", Int ) = 4 + _IsSpotlight ("_IsSpotlight", Int) = 0 + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + int _LightCount; + int _IsSpotlight; + + float4 frag( v2f_img i ) : SV_Target + { + float4 vertexPosition = tex2D( _A, i.uv ); + float3 vertexNormal = tex2D( _B, i.uv ).xyz; + float3 result = ShadeVertexLightsFull (vertexPosition, vertexNormal, _LightCount, (_IsSpotlight > 0)); + return float4(result, 1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader.meta new file mode 100644 index 00000000..f552488f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 3b6075034a85ad047be2d31dd213fb4f +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader new file mode 100644 index 00000000..4b08ff8f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/SignOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return sign(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader.meta new file mode 100644 index 00000000..c8ff6a5f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 3aca80b49aadf5046b7133730818e18f +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader new file mode 100644 index 00000000..eed64722 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader @@ -0,0 +1,67 @@ +Shader "Hidden/SimpleAddOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_C", 2D) = "white" {} + _D ("_D", 2D) = "white" {} + _E ("_E", 2D) = "white" {} + _F ("_F", 2D) = "white" {} + _G ("_G", 2D) = "white" {} + _H ("_H", 2D) = "white" {} + _I ("_I", 2D) = "white" {} + _J ("_J", 2D) = "white" {} + _Count ("_Count", Int) = 0 + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + sampler2D _F; + sampler2D _G; + sampler2D _H; + sampler2D _I; + sampler2D _J; + int _Count; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + float4 final = a + b; + + if( _Count > 2 ) + final += tex2D( _C, i.uv ); + if( _Count > 3 ) + final += tex2D( _D, i.uv ); + if( _Count > 4 ) + final += tex2D( _E, i.uv ); + if( _Count > 5 ) + final += tex2D( _F, i.uv ); + if( _Count > 6 ) + final += tex2D( _G, i.uv ); + if( _Count > 7 ) + final += tex2D( _H, i.uv ); + if( _Count > 8 ) + final += tex2D( _I, i.uv ); + if( _Count > 9 ) + final += tex2D( _J, i.uv ); + + return final; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader.meta new file mode 100644 index 00000000..430c72b1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 9eb150cbc752cbc458a0a37984b9934a +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader new file mode 100644 index 00000000..89638464 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader @@ -0,0 +1,40 @@ +Shader "Hidden/SimpleContrastNode" +{ + Properties + { + _A ( "_RBG", 2D ) = "white" {} + _B ( "_Fraction", 2D ) = "white" {} + } + + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + uniform sampler2D _A; + uniform sampler2D _B; + + float4 CalculateContrast ( float contrastValue, float4 colorTarget ) + { + float t = 0.5 * ( 1.0 - contrastValue ); + return mul ( float4x4( contrastValue, 0, 0, t, 0, contrastValue, 0, t, 0, 0, contrastValue, t, 0, 0, 0, 1 ), colorTarget ); + } + + float4 frag ( v2f_img i ) : SV_Target + { + float4 rgba = tex2D ( _B, i.uv ); + float value = tex2D ( _A, i.uv ).r; + + float4 finalColor = CalculateContrast( value , rgba ); + + return finalColor; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader.meta new file mode 100644 index 00000000..a2ab2b1e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 8d76799413f9f0547ac9b1de7ba798f1 +timeCreated: 1515421907 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader new file mode 100644 index 00000000..abe429c8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/SimpleDivideOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + return a / b; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader.meta new file mode 100644 index 00000000..decdf461 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 409f06d00d1094849b0834c52791fa72 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader new file mode 100644 index 00000000..f77d17c6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader @@ -0,0 +1,30 @@ +Shader "Hidden/SimpleMaxOp" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + return max( a, b ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader.meta new file mode 100644 index 00000000..a21bd9a2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 79d7f2a11092ac84a95ef6823b34adf2 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader new file mode 100644 index 00000000..26cb58b0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/SimpleMinNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + return min( a, b ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader.meta new file mode 100644 index 00000000..698a0f07 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: d6033298044f0f14aa9932ca46e58ce6 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader new file mode 100644 index 00000000..f66032ac --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader @@ -0,0 +1,281 @@ +Shader "Hidden/SimpleMultiplyOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_C", 2D) = "white" {} + _D ("_D", 2D) = "white" {} + _E ("_E", 2D) = "white" {} + _F ("_F", 2D) = "white" {} + _G ("_G", 2D) = "white" {} + _H ("_H", 2D) = "white" {} + _I ("_I", 2D) = "white" {} + _J ("_J", 2D) = "white" {} + _Count ("_Count", Int) = 0 + } + + SubShader + { + Pass //2 + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + + return a * b; + } + ENDCG + } + + Pass //3 + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + float4 c = tex2D( _C, i.uv ); + + return a * b * c; + } + ENDCG + } + + Pass //4 + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + float4 c = tex2D( _C, i.uv ); + float4 d = tex2D( _D, i.uv ); + + return a * b * c * d; + } + ENDCG + } + + Pass //5 + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + float4 c = tex2D( _C, i.uv ); + float4 d = tex2D( _D, i.uv ); + float4 e = tex2D( _E, i.uv ); + + return a * b * c * d * e; + } + ENDCG + } + + Pass //6 + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + sampler2D _F; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + float4 c = tex2D( _C, i.uv ); + float4 d = tex2D( _D, i.uv ); + float4 e = tex2D( _E, i.uv ); + float4 f = tex2D( _F, i.uv ); + + return a * b * c * d * e * f; + } + ENDCG + } + + Pass //7 + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + sampler2D _F; + sampler2D _G; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + float4 c = tex2D( _C, i.uv ); + float4 d = tex2D( _D, i.uv ); + float4 e = tex2D( _E, i.uv ); + float4 f = tex2D( _F, i.uv ); + float4 g = tex2D( _G, i.uv ); + + return a * b * c * d * e * f * g; + } + ENDCG + } + + Pass //8 + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + sampler2D _F; + sampler2D _G; + sampler2D _H; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + float4 c = tex2D( _C, i.uv ); + float4 d = tex2D( _D, i.uv ); + float4 e = tex2D( _E, i.uv ); + float4 f = tex2D( _F, i.uv ); + float4 g = tex2D( _G, i.uv ); + float4 h = tex2D( _H, i.uv ); + + return a * b * c * d * e * f * g * h; + } + ENDCG + } + + Pass //9 + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + sampler2D _F; + sampler2D _G; + sampler2D _H; + sampler2D _I; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + float4 c = tex2D( _C, i.uv ); + float4 d = tex2D( _D, i.uv ); + float4 e = tex2D( _E, i.uv ); + float4 f = tex2D( _F, i.uv ); + float4 g = tex2D( _G, i.uv ); + float4 h = tex2D( _H, i.uv ); + float4 is = tex2D( _I, i.uv ); + + return a * b * c * d * e * f * g * h * is; + } + ENDCG + } + + Pass //10 + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + sampler2D _F; + sampler2D _G; + sampler2D _H; + sampler2D _I; + sampler2D _J; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + float4 c = tex2D( _C, i.uv ); + float4 d = tex2D( _D, i.uv ); + float4 e = tex2D( _E, i.uv ); + float4 f = tex2D( _F, i.uv ); + float4 g = tex2D( _G, i.uv ); + float4 h = tex2D( _H, i.uv ); + float4 is = tex2D( _I, i.uv ); + float4 j = tex2D( _J, i.uv ); + + return a * b * c * d * e * f * g * h * is * j; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader.meta new file mode 100644 index 00000000..a3c1607c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 1ba1e43e86415ff4bbdf4d81dfcf035b +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader new file mode 100644 index 00000000..32dcc872 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/SimpleRemainderNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + return a % b; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader.meta new file mode 100644 index 00000000..de83328d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 8fdfc429d6b191c4985c9531364c1a95 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader new file mode 100644 index 00000000..aa6b0874 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/SimpleSubtractOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + return a - b; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader.meta new file mode 100644 index 00000000..50a5407c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 5725e8300be208449973f771ab6682f2 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader new file mode 100644 index 00000000..3cec584c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/SimpleTimeNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _Count ("_Count", Int) = 0 + } + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + sampler2D _A; + float _EditorTime; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 t = _EditorTime; + return t * a.x; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader.meta new file mode 100644 index 00000000..4916d890 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 45b7107d5d11f124fad92bcb1fa53661 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader new file mode 100644 index 00000000..12bc57f1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/SimplifiedFModOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + return frac( a / b ) * b; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader.meta new file mode 100644 index 00000000..72b060a4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 2688236fb4f37ce47b81cc818c53321d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader new file mode 100644 index 00000000..dedcbf66 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/SinOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return sin(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader.meta new file mode 100644 index 00000000..7bf30ca1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: bcd9f8749ddd3ac4f94f4c2071c1d0d4 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader new file mode 100644 index 00000000..a0ad101d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/SinTimeNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float _EditorTime; + + float4 frag( v2f_img i ) : SV_Target + { + float4 t = _EditorTime; + t.x = _EditorTime / 8; + t.y = _EditorTime / 4; + t.z = _EditorTime / 2; + return sin(t); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader.meta new file mode 100644 index 00000000..a46a68a1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: e4ba809e0badeb94994170b2cbbbba10 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader new file mode 100644 index 00000000..8bec94dd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/SinhOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return sinh(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader.meta new file mode 100644 index 00000000..52f1ad03 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 4e9c00e6dceb4024f80d4e3d7786abad +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader new file mode 100644 index 00000000..3de229f4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader @@ -0,0 +1,33 @@ +Shader "Hidden/SmoothstepOpNode" +{ + Properties + { + _A ("_Alpha", 2D) = "white" {} + _B ("_Min", 2D) = "white" {} + _C ("_Max", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float4 frag(v2f_img i) : SV_Target + { + float4 alpha = tex2D( _A, i.uv ); + float4 min = tex2D( _B, i.uv ); + float4 max = tex2D( _C, i.uv ); + return smoothstep(min, max, alpha); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader.meta new file mode 100644 index 00000000..6daf871f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 954cdd40a7a528344a0a4d3ff1db5176 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader new file mode 100644 index 00000000..ae15602b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/SqrtOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return sqrt(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader.meta new file mode 100644 index 00000000..5ed4a497 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 1791e2fbf36af084da7ecfc289e89b6e +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader new file mode 100644 index 00000000..204aed58 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader @@ -0,0 +1,60 @@ +Shader "Hidden/StaticSwitchNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_C", 2D) = "white" {} + _D ("_D", 2D) = "white" {} + _E ("_E", 2D) = "white" {} + _F ("_F", 2D) = "white" {} + _G ("_G", 2D) = "white" {} + _H ("_H", 2D) = "white" {} + _I ("_I", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + sampler2D _F; + sampler2D _G; + sampler2D _H; + sampler2D _I; + int _Condition; + + float4 frag( v2f_img i ) : SV_Target + { + if( _Condition == 0) + return tex2D( _B, i.uv ); // A nd B are switched + else if( _Condition == 1 ) + return tex2D( _A, i.uv ); + else if( _Condition == 2 ) + return tex2D( _C, i.uv ); + else if( _Condition == 3 ) + return tex2D( _D, i.uv ); + else if( _Condition == 4 ) + return tex2D( _E, i.uv ); + else if( _Condition == 5 ) + return tex2D( _F, i.uv ); + else if( _Condition == 6 ) + return tex2D( _G, i.uv ); + else if( _Condition == 7 ) + return tex2D( _H, i.uv ); + else + return tex2D( _I, i.uv ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader.meta new file mode 100644 index 00000000..9debd369 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 0b708c11c68e6a9478ac97fe3643eab1 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader new file mode 100644 index 00000000..8ce53fe5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/StepOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + return step(a, b); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader.meta new file mode 100644 index 00000000..05bf446d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 2c757add7f97ecd4abd9ce6ec4659697 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader new file mode 100644 index 00000000..7efdc7c6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader @@ -0,0 +1,86 @@ +Shader "Hidden/SummedBlendNode" +{ + Properties + { + _A ( "_Weights", 2D) = "white" {} + _B ( "_Layer1", 2D) = "white" {} + _C ( "_Layer2", 2D ) = "white" {} + _D ( "_Layer3", 2D ) = "white" {} + _E ( "_Layer4", 2D ) = "white" {} + } + + SubShader + { + + CGINCLUDE + + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + sampler2D _A; + sampler2D _B; + + ENDCG + + Pass + { + CGPROGRAM + float4 frag(v2f_img i) : SV_Target + { + float4 Weights = tex2D ( _A, i.uv ); + float4 Layer1 = tex2D( _B, i.uv ); + return Weights*Layer1; + } + ENDCG + } + + Pass + { + CGPROGRAM + sampler2D _C; + float4 frag ( v2f_img i ) : SV_Target + { + float4 Weights = tex2D ( _A, i.uv ); + float4 Layer1 = tex2D ( _B, i.uv ); + float4 Layer2 = tex2D ( _C, i.uv ); + return ( Weights.x*Layer1 + Weights.y*Layer2 ); + } + ENDCG + } + + Pass + { + CGPROGRAM + sampler2D _C; + sampler2D _D; + float4 frag ( v2f_img i ) : SV_Target + { + float4 Weights = tex2D( _A, i.uv ); + float4 Layer1 = tex2D( _B, i.uv ); + float4 Layer2 = tex2D( _C, i.uv ); + float4 Layer3 = tex2D( _D, i.uv ); + return ( Weights.x*Layer1 + Weights.y*Layer2 + Weights.z*Layer3 ); + } + ENDCG + } + + Pass + { + CGPROGRAM + sampler2D _C; + sampler2D _D; + sampler2D _E; + float4 frag ( v2f_img i ) : SV_Target + { + float4 Weights = tex2D ( _A, i.uv ); + float4 Layer1 = tex2D ( _B, i.uv ); + float4 Layer2 = tex2D ( _C, i.uv ); + float4 Layer3 = tex2D ( _D, i.uv ); + float4 Layer4 = tex2D ( _E, i.uv ); + return ( Weights.x*Layer1 + Weights.y*Layer2 + Weights.z*Layer3 + Weights.w*Layer4 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader.meta new file mode 100644 index 00000000..006e4be5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: eda18b96e13f78b49bbdaa4da3fead19 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader new file mode 100644 index 00000000..39672770 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/SwitchByFaceNode" +{ + Properties + { + _A ("_Front", 2D) = "white" {} + _B ("_Back", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag( v2f_img i, half ase_vface : VFACE ) : SV_Target + { + float4 front = tex2D( _A, i.uv ); + float4 back = tex2D( _B, i.uv ); + return ( ( ase_vface > 0 ) ? ( front ) : ( back ) ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader.meta new file mode 100644 index 00000000..470140f9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: f4edf6febb54dc743b25bd5b56facea8 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchBySRPVersionNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchBySRPVersionNode.shader new file mode 100644 index 00000000..5e8f91ee --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchBySRPVersionNode.shader @@ -0,0 +1,51 @@ +Shader "Hidden/SwitchBySRPVersion" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_C", 2D) = "white" {} + _D ("_D", 2D) = "white" {} + _E ("_E", 2D) = "white" {} + _F ("_F", 2D) = "white" {} + _G ("_G", 2D) = "white" {} + _H( "_H", 2D ) = "white" {} + _Condition( "_Condition", Int ) = 0 + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + sampler2D _F; + sampler2D _G; + sampler2D _H; + int _Condition; + + float4 frag(v2f_img i) : SV_Target + { + switch ( _Condition ) + { + case 1: return tex2D( _B, i.uv ); + case 2: return tex2D( _C, i.uv ); + case 3: return tex2D( _D, i.uv ); + case 4: return tex2D( _E, i.uv ); + case 5: return tex2D( _F, i.uv ); + case 6: return tex2D( _G, i.uv ); + } + return tex2D( _A, i.uv ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchBySRPVersionNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchBySRPVersionNode.shader.meta new file mode 100644 index 00000000..588b6d23 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchBySRPVersionNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 63c0b9ddc2c9d0c4b871af8347b2d5c9 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchBySRPVersionNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader new file mode 100644 index 00000000..d3823591 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader @@ -0,0 +1,60 @@ +Shader "Hidden/SwitchNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_C", 2D) = "white" {} + _D ("_D", 2D) = "white" {} + _E ("_E", 2D) = "white" {} + _F ("_F", 2D) = "white" {} + _G ("_G", 2D) = "white" {} + _H ("_H", 2D) = "white" {} + _I ("_I", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + sampler2D _F; + sampler2D _G; + sampler2D _H; + sampler2D _I; + float _Current; + + float4 frag( v2f_img i ) : SV_Target + { + if( _Current == 0 ) + return tex2D( _A, i.uv ); + else if( _Current == 1 ) + return tex2D( _B, i.uv ); + else if( _Current == 2 ) + return tex2D( _C, i.uv ); + else if( _Current == 3 ) + return tex2D( _D, i.uv ); + else if( _Current == 4 ) + return tex2D( _E, i.uv ); + else if( _Current == 5 ) + return tex2D( _F, i.uv ); + else if( _Current == 6 ) + return tex2D( _G, i.uv ); + else if( _Current == 7 ) + return tex2D( _H, i.uv ); + else + return tex2D( _I, i.uv ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader.meta new file mode 100644 index 00000000..ddc7ba30 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: a58e46feaa5e3d14383bfeac24d008bc +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader new file mode 100644 index 00000000..f211c817 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader @@ -0,0 +1,28 @@ +Shader "Hidden/SwizzleNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _Mask("_Mask", Vector) = (0,0,0,0) + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + int4 _Mask; + float4 frag(v2f_img i) : SV_Target + { + float4 a = tex2D(_A, i.uv); + return float4( a[ _Mask.x ], a[ _Mask.y ], a[ _Mask.z ], a[ _Mask.w ] ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader.meta new file mode 100644 index 00000000..cf6d17c7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: d20531704ce28b14bafb296f291f6608 +timeCreated: 1510580676 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader new file mode 100644 index 00000000..497f1550 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader @@ -0,0 +1,36 @@ +Shader "Hidden/TFHCCompareEqual" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_True", 2D) = "white" {} + _D ( "_False", 2D ) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + + float4 frag(v2f_img i) : SV_Target + { + float A = tex2D( _A, i.uv ).x; + float B = tex2D( _B, i.uv ).x; + float4 True = tex2D( _C, i.uv ); + float4 False = tex2D ( _D, i.uv ); + return ( ( A == B ) ? True : False ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader.meta new file mode 100644 index 00000000..83c74524 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6904de6cf8c08e7439672390b425ab50 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader new file mode 100644 index 00000000..cb3b12eb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader @@ -0,0 +1,36 @@ +Shader "Hidden/TFHCCompareGreater" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_True", 2D) = "white" {} + _D ( "_False", 2D ) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + + float4 frag(v2f_img i) : SV_Target + { + float A = tex2D( _A, i.uv ).x; + float B = tex2D( _B, i.uv ).x; + float4 True = tex2D( _C, i.uv ); + float4 False = tex2D ( _D, i.uv ); + return ( ( A > B ) ? True : False ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader.meta new file mode 100644 index 00000000..64e2bbe4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 363192dbd019ad2478f2fe6c277b7e48 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader new file mode 100644 index 00000000..782a7055 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader @@ -0,0 +1,36 @@ +Shader "Hidden/TFHCCompareGreaterEqual" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_True", 2D) = "white" {} + _D ( "_False", 2D ) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + + float4 frag(v2f_img i) : SV_Target + { + float A = tex2D( _A, i.uv ).x; + float B = tex2D( _B, i.uv ).x; + float4 True = tex2D( _C, i.uv ); + float4 False = tex2D ( _D, i.uv ); + return ( ( A >= B ) ? True : False ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader.meta new file mode 100644 index 00000000..85289cd7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: f4ff76282a117c2429a1bcd8ba3a9112 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader new file mode 100644 index 00000000..84a5512b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader @@ -0,0 +1,36 @@ +Shader "Hidden/TFHCCompareLess" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_True", 2D) = "white" {} + _D ( "_False", 2D ) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + + float4 frag(v2f_img i) : SV_Target + { + float A = tex2D( _A, i.uv ).x; + float B = tex2D( _B, i.uv ).x; + float4 True = tex2D( _C, i.uv ); + float4 False = tex2D ( _D, i.uv ); + return ( ( A < B ) ? True : False ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader.meta new file mode 100644 index 00000000..3bc81c82 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 8024509244392ed44b37c28473e66a8a +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader new file mode 100644 index 00000000..83ed59f5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader @@ -0,0 +1,36 @@ +Shader "Hidden/TFHCCompareLessEqual" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_True", 2D) = "white" {} + _D ( "_False", 2D ) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + + float4 frag(v2f_img i) : SV_Target + { + float A = tex2D( _A, i.uv ).x; + float B = tex2D( _B, i.uv ).x; + float4 True = tex2D( _C, i.uv ); + float4 False = tex2D ( _D, i.uv ); + return ( ( A <= B ) ? True : False ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader.meta new file mode 100644 index 00000000..cab3780b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 9a3e17508793b9d42b1efaaf5bcd2554 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader new file mode 100644 index 00000000..fd52f26b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader @@ -0,0 +1,36 @@ +Shader "Hidden/TFHCCompareNotEqual" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_True", 2D) = "white" {} + _D ( "_False", 2D ) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + + float4 frag(v2f_img i) : SV_Target + { + float A = tex2D( _A, i.uv ).x; + float B = tex2D( _B, i.uv ).x; + float4 True = tex2D( _C, i.uv ); + float4 False = tex2D ( _D, i.uv ); + return ( ( A != B ) ? True : False ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader.meta new file mode 100644 index 00000000..f69be248 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 75f433376eef1ad4a881d99124e08008 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader new file mode 100644 index 00000000..c10bca47 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader @@ -0,0 +1,39 @@ +Shader "Hidden/TFHCCompareWithRange" +{ + Properties + { + _A ("_Value", 2D) = "white" {} + _B ("_RangeMin", 2D) = "white" {} + _C ("_RangeMax", 2D) = "white" {} + _D ( "_True", 2D ) = "white" {} + _E ( "_False", 2D ) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + + float4 frag(v2f_img i) : SV_Target + { + float4 Value = tex2D( _A, i.uv ).x; + float4 RangeMin = tex2D( _B, i.uv ).x; + float4 RangeMax = tex2D( _C, i.uv ); + float4 True = tex2D ( _D, i.uv ); + float4 False = tex2D ( _E, i.uv ); + return ( ( Value >= RangeMin && Value <= RangeMax ) ? True : False ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader.meta new file mode 100644 index 00000000..8dc12334 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 127d114eed178d7409f900134a6c00d1 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader new file mode 100644 index 00000000..93e89fba --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader @@ -0,0 +1,95 @@ +Shader "Hidden/TFHCFlipBookUVAnimation" +{ + Properties + { + _A ("_UV", 2D) = "white" {} + _B ("_Columns", 2D) = "white" {} + _C ("_Rows", 2D) = "white" {} + _D ("_Speed", 2D) = "white" {} + _E ("_StartFrame", 2D) = "white" {} + _F ("_Speed", 2D) = "white" {} + _G( "_MaxFrame", 2D ) = "white" {} + } + SubShader + { + CGINCLUDE + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + sampler2D _F; + sampler2D _G; + float _EditorTime; + ENDCG + + //Time port disconnected + Pass + { + CGPROGRAM + float4 frag(v2f_img i) : SV_Target + { + float2 uv = tex2D( _A, i.uv ).rg; + float col = tex2D( _B, i.uv ).r; + float row = tex2D( _C, i.uv ).r; + float spd = tex2D( _D, i.uv ).r; + float str = tex2D( _E, i.uv ).r; + float maxframe = tex2D( _G, i.uv ).r; + float numframes = col * row; + float fbtotaltiles = ( maxframe < 0 ) ? numframes : min( numframes, maxframe + 1 ); + float fbcolsoffset = 1.0f / col; + float fbrowsoffset = 1.0f / row; + float fbspeed = _EditorTime * spd; + float2 fbtiling = float2(fbcolsoffset, fbrowsoffset); + float fbcurrenttileindex = floor( fmod( fbspeed + str, fbtotaltiles) ); + fbcurrenttileindex += ( fbcurrenttileindex < 0) ? fbtotaltiles : 0; + float fblinearindextox = round ( fmod ( fbcurrenttileindex, col ) ); + float fboffsetx = fblinearindextox * fbcolsoffset; + float fblinearindextoy = round( fmod( ( fbcurrenttileindex - fblinearindextox ) / col, row ) ); + fblinearindextoy = (int)(row-1) - fblinearindextoy; + float fboffsety = fblinearindextoy * fbrowsoffset; + float2 fboffset = float2(fboffsetx, fboffsety); + float2 fbuv = float4( uv, 0.0 , 0.0 ) * fbtiling + fboffset; + return float4(fbuv, 0 , 0); + } + ENDCG + } + + //Time port connected + Pass + { + CGPROGRAM + float4 frag(v2f_img i) : SV_Target + { + float2 uv = tex2D( _A, i.uv ).rg; + float col = tex2D( _B, i.uv ).r; + float row = tex2D( _C, i.uv ).r; + float spd = tex2D( _D, i.uv ).r; + float str = tex2D( _E, i.uv ).r; + float time = tex2D( _F, i.uv ).r; + float maxframe = tex2D( _G, i.uv ).r; + float numframes = col * row; + float fbtotaltiles = ( maxframe < 0 ) ? numframes : min( numframes, maxframe + 1 ); + float fbcolsoffset = 1.0f / col; + float fbrowsoffset = 1.0f / row; + float fbspeed = time * spd; + float2 fbtiling = float2(fbcolsoffset, fbrowsoffset); + float fbcurrenttileindex = floor( fmod( fbspeed + str, fbtotaltiles) ); + fbcurrenttileindex += ( fbcurrenttileindex < 0) ? fbtotaltiles : 0; + float fblinearindextox = round ( fmod ( fbcurrenttileindex, col ) ); + float fboffsetx = fblinearindextox * fbcolsoffset; + float fblinearindextoy = round( fmod( ( fbcurrenttileindex - fblinearindextox ) / col, row ) ); + fblinearindextoy = (int)(row-1) - fblinearindextoy; + float fboffsety = fblinearindextoy * fbrowsoffset; + float2 fboffset = float2(fboffsetx, fboffsety); + float2 fbuv = float4( uv, 0.0 , 0.0 ) * fbtiling + fboffset; + return float4(fbuv, 0 , 0); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader.meta new file mode 100644 index 00000000..9b9989b0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 04fe24be792bfd5428b92132d7cf0f7d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader new file mode 100644 index 00000000..dccca41a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader @@ -0,0 +1,42 @@ +Shader "Hidden/TFHCIf" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + _C ("_AGreaterB", 2D) = "white" {} + _D ( "_AEqualsB", 2D ) = "white" {} + _E ( "_ALessB", 2D ) = "white" {} + _F ( "_EqualThreshold", 2D ) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + sampler2D _F; + + float4 frag(v2f_img i) : SV_Target + { + float4 A = tex2D( _A, i.uv ).x; + float4 B = tex2D( _B, i.uv ).x; + float4 AGreaterB = tex2D( _C, i.uv ); + float4 AEqualsB = tex2D ( _D, i.uv ); + float4 ALessB = tex2D ( _E, i.uv ); + float4 EqualThreshold = tex2D ( _F, i.uv ); + return ( A - EqualThreshold > B ? AGreaterB : A - EqualThreshold <= B && A + EqualThreshold >= B ? AEqualsB : ALessB ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader.meta new file mode 100644 index 00000000..f10e0027 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 5c7bc7e3cab81da499e4864ace0d86c5 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader new file mode 100644 index 00000000..fb2f9161 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader @@ -0,0 +1,36 @@ +Shader "Hidden/TFHCPixelateUV" +{ + Properties + { + _A ("_UV", 2D) = "white" {} + _B ("_PixelX", 2D) = "white" {} + _C ("_PixelY", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + + float4 frag(v2f_img i) : SV_Target + { + float2 uv = tex2D( _A, i.uv ).rg; + float pix = tex2D( _B, i.uv ).r; + float piy = tex2D( _C, i.uv ).r; + + float2 steppedPixel = float2( pix, piy ); + float2 pixelatedUV = floor( uv * steppedPixel ) / steppedPixel; + return float4(pixelatedUV, 0 , 0); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader.meta new file mode 100644 index 00000000..4236dfb9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: e2f7e3c513ed18340868b8cbd0d85cfb +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader new file mode 100644 index 00000000..8c64cada --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader @@ -0,0 +1,50 @@ +Shader "Hidden/TFHCRemap" +{ + Properties + { + _A ("_Value", 2D) = "white" {} + _B ("_MinOld", 2D) = "white" {} + _C ("_MaxOld", 2D) = "white" {} + _D ("_MinNew", 2D) = "white" {} + _E ("_MaxNew", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + + float4 frag(v2f_img i) : SV_Target + { + float4 value = tex2D( _A, i.uv ); + float4 minold = tex2D( _B, i.uv ); + float4 maxold = tex2D( _C, i.uv ); + float4 minnew = tex2D( _D, i.uv ); + float4 maxnew = tex2D( _E, i.uv ); + + float4 denom = maxold - minold; + if(denom.x == 0) + denom.x = 0.000001; + if(denom.y == 0) + denom.y = 0.000001; + if(denom.z == 0) + denom.z = 0.000001; + if(denom.w == 0) + denom.w = 0.000001; + + return (minnew + (value - minold) * (maxnew - minnew) / denom); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader.meta new file mode 100644 index 00000000..1c7aa8a3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 72dd1cbea889fa047b929d5191e360c0 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader new file mode 100644 index 00000000..ad6e91cf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/TanOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return tan(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader.meta new file mode 100644 index 00000000..d3b2a0c0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 312e291832cac5749a3626547dfc8607 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader new file mode 100644 index 00000000..70ae1fb0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader @@ -0,0 +1,32 @@ +Shader "Hidden/TangentVertexDataNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + //float2 tp = 2 * i.uv - 1; + //float tr = sqrt( dot(tp,tp) ); + //tr = saturate( tr ); + + //float2 tuvs; + //float f = ( 1 - sqrt( 1 - tr ) ) / tr; + + //float3 tangent = normalize(float3( (1-f)*2, tp.y*0.01, tp.x )); + + //float4((tangent), 1); + + //TODO: needs revision at some point + return -1; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader.meta new file mode 100644 index 00000000..7824aca2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: f5466d126f4bb1f49917eac88b1cb6af +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader new file mode 100644 index 00000000..a7abe259 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader @@ -0,0 +1,22 @@ +Shader "Hidden/TangentVertexDataNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 tangent = normalize(float3( -normal.z, normal.y*0.01, normal.x )); + return float4((tangent), 1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader.meta new file mode 100644 index 00000000..5288297c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 0a44bb521d06d6143a4acbc3602037f8 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader new file mode 100644 index 00000000..67f3d2f0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/TanhOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return tanh(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader.meta new file mode 100644 index 00000000..62ba8324 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 52f78d3a1c66d1c489cd63b0a9300b38 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader new file mode 100644 index 00000000..99341bf0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader @@ -0,0 +1,20 @@ +Shader "Hidden/TauNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag(v2f_img i) : SV_Target + { + return UNITY_PI * 2; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader.meta new file mode 100644 index 00000000..6e0d4c12 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 701bc295c0d75d8429eabcf45e8e008d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader new file mode 100644 index 00000000..2dca7518 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader @@ -0,0 +1,48 @@ +Shader "Hidden/TemplateShaderProperty" +{ + Properties + { + [HideFromInspector]_IntData ( "_IntData", Int ) = 0 + [HideFromInspector]_FloatData ( "_FloatData", Float ) = 0 + [HideFromInspector]_VectorData ( "_VectorData", Vector ) = ( 0,0,0,0 ) + [HideFromInspector]_Sampler2DData ( "_Sampler2DData", 2D ) = "white" {} + [HideFromInspector]_Sampler3DData ( "_Sampler3DData", 3D ) = "white" {} + [HideFromInspector]_SamplerCubeData ( "_SamplerCubeData", Cube ) = "white" {} + } + + CGINCLUDE + #include "UnityCG.cginc" + #include "Preview.cginc" + uniform int _IntData; + uniform float _FloatData; + uniform float4 _VectorData; + uniform sampler2D _Sampler2DData; + uniform sampler3D _Sampler3DData; + uniform samplerCUBE _SamplerCubeData; + + #pragma vertex vert_img + #pragma fragment frag + + float4 CalculatePreviewColor ( v2f_img i, const int dataType ) + { + /*Int*/ if ( dataType == 0 ) return float4( _IntData.xxx,1); + /*Float*/ if ( dataType == 1 ) return float4( _FloatData.xxx, 1 ); + /*Vector4/Color*/ if ( dataType == 2 ) return _VectorData; + /*Sampler 2D*/ if ( dataType == 3 ) return tex2D ( _Sampler2DData, i.uv ); + /*Sampler 3D*/ if ( dataType == 4 ) return tex3D ( _Sampler3DData, float3( i.uv, 0.0 ) ); + /*Sampler Cube*/ if ( dataType == 5 ) return texCUBE ( _SamplerCubeData, float3( i.uv, 0.0 ) ); + return (0).xxxx; + } + + ENDCG + + SubShader + { + Pass{ CGPROGRAM float4 frag ( v2f_img i ) : SV_Target { return CalculatePreviewColor(i,0); } ENDCG } + Pass{ CGPROGRAM float4 frag ( v2f_img i ) : SV_Target { return CalculatePreviewColor(i,1); } ENDCG } + Pass{ CGPROGRAM float4 frag ( v2f_img i ) : SV_Target { return CalculatePreviewColor(i,2); } ENDCG } + Pass{ CGPROGRAM float4 frag ( v2f_img i ) : SV_Target { return CalculatePreviewColor(i,3); } ENDCG } + Pass{ CGPROGRAM float4 frag ( v2f_img i ) : SV_Target { return CalculatePreviewColor(i,4); } ENDCG } + Pass{ CGPROGRAM float4 frag ( v2f_img i ) : SV_Target { return CalculatePreviewColor(i,5); } ENDCG } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader.meta new file mode 100644 index 00000000..c44b7aeb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 4feb2016be0ece148b8bf234508f6aa4 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader new file mode 100644 index 00000000..ed5a3038 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader @@ -0,0 +1,20 @@ +Shader "Hidden/TexCoordVertexDataNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag( v2f_img i ) : SV_Target + { + return float4( i.uv, 0, 0 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader.meta new file mode 100644 index 00000000..3cf23ff4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6c1bee77276896041bbb73b1b9e7f8ac +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader new file mode 100644 index 00000000..370780b7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader @@ -0,0 +1,84 @@ +Shader "Hidden/TexelSize" +{ + Properties + { + _Sampler ("_Sampler", 2D) = "white" {} + _Sampler3D ("_Sampler3D", 3D) = "white" {} + _Array ("_Array", 2DArray) = "white" {} + _Cube ("_Cube", CUBE) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _Sampler; + float4 _Sampler_TexelSize; + + float4 frag( v2f_img i ) : SV_Target + { + return _Sampler_TexelSize; + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler3D _Sampler3D; + float4 _Sampler3D_TexelSize; + + float4 frag (v2f_img i) : SV_Target + { + return _Sampler3D_TexelSize; + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + UNITY_DECLARE_TEX2DARRAY (_Array); + float4 _Array_TexelSize; + + float4 frag (v2f_img i) : SV_Target + { + return _Array_TexelSize; + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + samplerCUBE _Cube; + float4 _Cube_TexelSize; + + float4 frag (v2f_img i) : SV_Target + { + return _Cube_TexelSize; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader.meta new file mode 100644 index 00000000..66c3ef86 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6b20226576a059443b58aa2d0b942276 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader new file mode 100644 index 00000000..e8057c3a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader @@ -0,0 +1,20 @@ +Shader "Hidden/Texture2D" +{ + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag( v2f_img i ) : SV_Target + { + return 0; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader.meta new file mode 100644 index 00000000..0477b944 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 13bd295c44d04e1419f20f792d331e33 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader new file mode 100644 index 00000000..265e9b7f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader @@ -0,0 +1,64 @@ +Shader "Hidden/TextureArrayNode" +{ + Properties + { + _A ("_UVs", 2D) = "white" {} + _B ("_Index", 2D) = "white" {} + _C ("_Lod", 2D) = "white" {} + _D ("_NormalScale", 2D) = "white" {} + _G ("_Tex", 2D) = "white" {} + _TexConnected ("_TexConnected", Int) = 0 + } + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #pragma target 3.5 + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "UnityStandardUtils.cginc" + + uniform UNITY_DECLARE_TEX2DARRAY( _Sampler ); + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _G; + float _CustomUVs; + float _LodType; + float _Unpack; + int _TexConnected; + + float4 frag( v2f_img i ) : SV_Target + { + float2 uvs = i.uv; + if ( _CustomUVs == 1 ) + uvs = tex2D( _A, i.uv ).xy; + + float n = tex2D( _D, i.uv ).r; + float4 c = 0; + if ( _LodType == 1 ) { + float lod = tex2D( _C, i.uv ).r; + c = UNITY_SAMPLE_TEX2DARRAY_LOD( _Sampler, float3( uvs, tex2D( _B, i.uv ).r ), lod ); + } + else if( _TexConnected == 0) { + c = UNITY_SAMPLE_TEX2DARRAY( _Sampler, float3( uvs, tex2D( _B, i.uv ).r ) ); + } + else { + c = tex2D( _G, uvs ); + } + + if ( _Unpack == 1 ) + { + c.rgb = UnpackScaleNormal(c, n); + } + + return c; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader.meta new file mode 100644 index 00000000..48a6c102 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 2e6d093df2d289f47b827b36efb31a81 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader new file mode 100644 index 00000000..4c902bea --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/TextureCoordinatesNode" +{ + Properties + { + _A ("_Tilling", 2D) = "white" {} + _B ("_Offset", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + + float4 frag( v2f_img i ) : SV_Target + { + float4 t = tex2D( _A, i.uv ); + float4 o = tex2D( _B, i.uv ); + return float4( i.uv * t.xy + o.xy, 0, 0 ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader.meta new file mode 100644 index 00000000..26a95657 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 085e462b2de441a42949be0e666cf5d2 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader new file mode 100644 index 00000000..95c9244d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader @@ -0,0 +1,84 @@ +Shader "Hidden/TexturePropertyNode" +{ + Properties + { + _Sampler ("_Sampler", 2D) = "white" {} + _Sampler3D ("_Sampler3D", 3D) = "white" {} + _Array ("_Array", 2DArray) = "white" {} + _Cube( "_Cube", CUBE) = "white" {} + _Default ("_Default", Int) = 0 + _Type ("_Type", Int) = 0 + } + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #pragma target 3.5 + #include "UnityCG.cginc" + #include "Preview.cginc" + int _Default; + float4 frag( v2f_img i ) : SV_Target + { + if(_Default == 1) + { + return 1; + } + else if(_Default == 2) + { + return 0; + } + else if(_Default == 3) + { + return 0.5f; + } + else if(_Default == 4) + { + return float4(0.5,0.5,1,1); + } + + return 1; + } + ENDCG + } + + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #pragma target 3.5 + #include "UnityCG.cginc" + #include "Preview.cginc" + + UNITY_DECLARE_TEX2DARRAY (_Array); + samplerCUBE _Cube; + sampler2D _Sampler; + sampler3D _Sampler3D; + int _Type; + + float4 frag (v2f_img i) : SV_Target + { + if (_Type == 4) + { + return UNITY_SAMPLE_TEX2DARRAY (_Array, float3(i.uv, 0)); + } + else if (_Type == 3) + { + return texCUBE (_Cube, float3(i.uv,0)); + } + else if (_Type == 2) + { + return tex3D (_Sampler3D, float3(i.uv,0)); + } + else + { + return tex2D (_Sampler, i.uv); + } + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader.meta new file mode 100644 index 00000000..1b1eb224 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: e53988745ec6e034694ee2640cd3d372 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader new file mode 100644 index 00000000..f0f40b49 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader @@ -0,0 +1,91 @@ +Shader "Hidden/TextureTransform" +{ + Properties + { + _Sampler ("_Sampler", 2D) = "white" {} + _Sampler3D ("_Sampler3D", 3D) = "white" {} + _Array ("_Array", 2DArray) = "white" {} + _Cube ("_Cube", CUBE) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + int _PreviewID = 0; + sampler2D _Sampler; + float4 _Sampler_ST; + + float4 frag( v2f_img i ) : SV_Target + { + return _PreviewID == 0?float4(_Sampler_ST.xy,0,0): float4(_Sampler_ST.zw,0,0); + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + int _PreviewID = 0; + sampler3D _Sampler3D; + float4 _Sampler3D_ST; + + float4 frag (v2f_img i) : SV_Target + { + return _Sampler3D_ST; + return _PreviewID == 0 ? float4(_Sampler3D_ST.xy, 0, 0) : float4(_Sampler3D_ST.zw, 0, 0); + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + int _PreviewID = 0; + UNITY_DECLARE_TEX2DARRAY (_Array); + float4 _Array_ST; + + float4 frag (v2f_img i) : SV_Target + { + return _Array_ST; + return _PreviewID == 0 ? float4(_Array_ST.xy, 0, 0) : float4(_Array_ST.zw, 0, 0); + } + ENDCG + } + + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + int _PreviewID = 0; + samplerCUBE _Cube; + float4 _Cube_ST; + + float4 frag (v2f_img i) : SV_Target + { + return _Cube_ST; + return _PreviewID == 0 ? float4(_Cube_ST.xy, 0, 0) : float4(_Cube_ST.zw, 0, 0); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader.meta new file mode 100644 index 00000000..de01bc8f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 25ba2903568b00343ae06788994cab54 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader new file mode 100644 index 00000000..d3490cac --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/TimeNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float _EditorTime; + + float4 frag( v2f_img i ) : SV_Target + { + float4 t = _EditorTime; + t.x = _EditorTime / 20; + t.z = _EditorTime * 2; + t.w = _EditorTime * 3; + return t; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader.meta new file mode 100644 index 00000000..b5d39d0f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 73abc10c8d1399444827a7eeb9c24c2a +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader new file mode 100644 index 00000000..54ad014d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader @@ -0,0 +1,31 @@ +Shader "Hidden/ToggleSwitchNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + _B ("_B", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + sampler2D _B; + float _Current; + + float4 frag( v2f_img i ) : SV_Target + { + float4 a = tex2D( _A, i.uv ); + float4 b = tex2D( _B, i.uv ); + return lerp(a,b,_Current); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader.meta new file mode 100644 index 00000000..21b5b87e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: beeb138daeb592a4887454f81dba2b3f +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader new file mode 100644 index 00000000..562fe129 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader @@ -0,0 +1,104 @@ +Shader "Hidden/TriplanarNode" +{ + Properties + { + _A ("_TopTex", 2D) = "white" {} + _B ("_MidTex", 2D) = "white" {} + _C ("_BotTex", 2D) = "white" {} + _D ("_Tilling", 2D) = "white" {} + _E ("_Falloff", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #pragma target 3.0 + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "UnityStandardUtils.cginc" + + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + sampler2D _E; + float _IsNormal; + float _IsTangent; + float _IsSpherical; + + inline float3 TriplanarSamplingCNF( sampler2D topTexMap, sampler2D midTexMap, sampler2D botTexMap, float3 worldPos, float3 worldNormal, float falloff, float tilling ) + { + float3 projNormal = ( pow( abs( worldNormal ), falloff ) ); + projNormal /= projNormal.x + projNormal.y + projNormal.z; + float3 nsign = sign( worldNormal ); + float negProjNormalY = max( 0, projNormal.y * -nsign.y ); + projNormal.y = max( 0, projNormal.y * nsign.y ); + half4 xNorm; half4 yNorm; half4 yNormN; half4 zNorm; + xNorm = ( tex2D( midTexMap, tilling * worldPos.zy * float2( nsign.x, 1.0 ) ) ); + yNorm = ( tex2D( topTexMap, tilling * worldPos.xz * float2( nsign.y, 1.0 ) ) ); + yNormN = ( tex2D( botTexMap, tilling * worldPos.xz * float2( nsign.y, 1.0 ) ) ); + zNorm = ( tex2D( midTexMap, tilling * worldPos.xy * float2( -nsign.z, 1.0 ) ) ); + xNorm.xyz = half3( UnpackNormal( xNorm ).xy * float2( nsign.x, 1.0 ) + worldNormal.zy, worldNormal.x ).zyx; + yNorm.xyz = half3( UnpackNormal( yNorm ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy; + zNorm.xyz = half3( UnpackNormal( zNorm ).xy * float2( -nsign.z, 1.0 ) + worldNormal.xy, worldNormal.z ).xyz; + yNormN.xyz = half3( UnpackNormal( yNormN ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy; + return normalize( xNorm.xyz * projNormal.x + yNorm.xyz * projNormal.y + yNormN.xyz * negProjNormalY + zNorm.xyz * projNormal.z ); + } + + inline float4 TriplanarSamplingCF( sampler2D topTexMap, sampler2D midTexMap, sampler2D botTexMap, float3 worldPos, float3 worldNormal, float falloff, float tilling ) + { + float3 projNormal = ( pow( abs( worldNormal ), falloff ) ); + projNormal /= projNormal.x + projNormal.y + projNormal.z; + float3 nsign = sign( worldNormal ); + float negProjNormalY = max( 0, projNormal.y * -nsign.y ); + projNormal.y = max( 0, projNormal.y * nsign.y ); + half4 xNorm; half4 yNorm; half4 yNormN; half4 zNorm; + xNorm = ( tex2D( midTexMap, tilling * worldPos.zy * float2( nsign.x, 1.0 ) ) ); + yNorm = ( tex2D( topTexMap, tilling * worldPos.xz * float2( nsign.y, 1.0 ) ) ); + yNormN = ( tex2D( botTexMap, tilling * worldPos.xz * float2( nsign.y, 1.0 ) ) ); + zNorm = ( tex2D( midTexMap, tilling * worldPos.xy * float2( -nsign.z, 1.0 ) ) ); + return xNorm * projNormal.x + yNorm * projNormal.y + yNormN * negProjNormalY + zNorm * projNormal.z; + } + + float4 frag( v2f_img i ) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 worldNormal = UnityObjectToWorldNormal(normal); + float3 worldPos = mul(unity_ObjectToWorld, vertexPos).xyz; + + float falloff = tex2D( _E, vertexPos.xy ).r; + float tilling = tex2D( _D, vertexPos.xy ).r * 0.625; + float4 triplanar = 1; + + if ( _IsNormal == 1 ) { + float3 tangent = PreviewFragmentTangentOS( i.uv ); + float3 worldTangent = UnityObjectToWorldDir(tangent); + float tangentSign = -1; + float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); + float3x3 worldToTangent = float3x3( worldTangent, worldBinormal, worldNormal ); + if ( _IsSpherical == 1 ) + triplanar.xyz = TriplanarSamplingCNF( _A, _A, _A, worldPos, worldNormal, falloff, tilling ); + else + triplanar.xyz = TriplanarSamplingCNF( _A, _B, _C, worldPos, worldNormal, falloff, tilling ); + + if( _IsTangent == 1 ) + triplanar.xyz = mul( worldToTangent, triplanar.xyz ); + } + else + { + if ( _IsSpherical == 1 ) + triplanar = TriplanarSamplingCF( _A, _A, _A, worldPos, worldNormal, falloff, tilling ); + else + triplanar = TriplanarSamplingCF( _A, _B, _C, worldPos, worldNormal, falloff, tilling ); + } + + return triplanar; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader.meta new file mode 100644 index 00000000..2158fe44 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 8723015ec59743143aadfbe480e34391 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader new file mode 100644 index 00000000..136ff466 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/TruncOpNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return trunc(tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader.meta new file mode 100644 index 00000000..b6ce84e7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: c717aaa68f4ac9e469b15763e82933e1 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TwoSidedSignNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TwoSidedSignNode.shader new file mode 100644 index 00000000..33a55acd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TwoSidedSignNode.shader @@ -0,0 +1,20 @@ +Shader "Hidden/TwoSidedSignNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag( v2f_img i, half ase_vface : VFACE ) : SV_Target + { + return ase_vface != 0 ? +1 : -1; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TwoSidedSignNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TwoSidedSignNode.shader.meta new file mode 100644 index 00000000..8943daeb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TwoSidedSignNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 42ebc30515b5460499b689a1dc3308f3 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TwoSidedSignNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader new file mode 100644 index 00000000..3a319e3a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader @@ -0,0 +1,34 @@ +Shader "Hidden/UnpackScaleNormalNode" +{ + Properties + { + _A ("_Value", 2D) = "white" {} + _B ("_NormalScale", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #pragma target 3.0 + #include "UnityCG.cginc" + #include "Preview.cginc" + #include "UnityStandardUtils.cginc" + + sampler2D _A; + sampler2D _B; + + float4 frag( v2f_img i ) : SV_Target + { + float4 c = tex2D( _A, i.uv ); + float n = tex2D( _B, i.uv ).r; + c.rgb = UnpackScaleNormal( c, n ); + + return float4(c.rgb, 0); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader.meta new file mode 100644 index 00000000..be92b01d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 8b0ae05e25d280c45af81ded56f8012e +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader new file mode 100644 index 00000000..17824d44 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader @@ -0,0 +1,25 @@ +Shader "Hidden/Vector2Node" +{ + Properties { + _InputVector ("_InputVector", Vector) = (0,0,0,0) + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 _InputVector; + + float4 frag( v2f_img i ) : SV_Target + { + return float4(_InputVector.x,_InputVector.y,0,0); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader.meta new file mode 100644 index 00000000..69ab979f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 88b4191eb06084d4da85d1dd2f984085 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader new file mode 100644 index 00000000..be072d3c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader @@ -0,0 +1,25 @@ +Shader "Hidden/Vector3Node" +{ + Properties { + _InputVector ("_InputVector", Vector) = (0,0,0,0) + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 _InputVector; + + float4 frag( v2f_img i ) : SV_Target + { + return float4(_InputVector.x,_InputVector.y,_InputVector.z,0); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader.meta new file mode 100644 index 00000000..90edbf4f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 8a44d38f06246bf48944b3f314bc7920 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader new file mode 100644 index 00000000..1c9f9c7b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader @@ -0,0 +1,25 @@ +Shader "Hidden/Vector4Node" +{ + Properties { + _InputVector ("_InputVector", Vector) = (0,0,0,0) + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 _InputVector; + + float4 frag( v2f_img i ) : SV_Target + { + return _InputVector; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader.meta new file mode 100644 index 00000000..c9eb0e7f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: aac241d0e47a5a84fbd2edcd640788dc +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader new file mode 100644 index 00000000..993002cf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader @@ -0,0 +1,30 @@ +Shader "Hidden/VertexBinormalNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 worldNormal = UnityObjectToWorldNormal(normal); + + float3 tangent = PreviewFragmentTangentOS( i.uv ); + float3 worldPos = mul(unity_ObjectToWorld, vertexPos).xyz; + float3 worldTangent = UnityObjectToWorldDir(tangent); + float tangentSign = -1; + float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); + + return float4(worldBinormal, 1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader.meta new file mode 100644 index 00000000..59628faf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 76873532ab67d2947beaf07151383cbe +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader new file mode 100644 index 00000000..8c45ce7c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader @@ -0,0 +1,20 @@ +Shader "Hidden/VertexColorNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + return 1; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader.meta new file mode 100644 index 00000000..7ed03862 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: ca1d22db6470c5f4d9f93a9873b4f5bc +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader new file mode 100644 index 00000000..c9a10134 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader @@ -0,0 +1,40 @@ +Shader "Hidden/VertexIdVariableNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert + #pragma fragment frag + + struct appdata_custom + { + float4 vertex : POSITION; + uint vertexId : SV_VertexID; + }; + + struct v2f_custom + { + float4 pos : SV_POSITION; + half vertexId : TEXCOORD0; + }; + + v2f_custom vert( appdata_custom v ) + { + v2f_custom o; + o.pos = UnityObjectToClipPos (v.vertex); + o.vertexId = v.vertexId; + return o; + } + + float4 frag( v2f_custom i ) : SV_Target + { + return i.vertexId; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader.meta new file mode 100644 index 00000000..ca74c146 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 5934bf2c10b127a459177a3b622cea65 +timeCreated: 1542641929 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader new file mode 100644 index 00000000..007cbd43 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader @@ -0,0 +1,32 @@ +Shader "Hidden/VertexTangentNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + float2 tp = 2 * i.uv - 1; + float tr = sqrt( dot(tp,tp) ); + tr = saturate( tr ); + //if ( tr < 1 ) { + float2 tuvs; + float f = ( 1 - sqrt( 1 - tr ) ) / tr; + + float3 tangent = normalize(float3( (1-f)*2, tp.y*0.01, tp.x )); + return float4((tangent), 1); + //} + //else { + // return 0; + //} + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader.meta new file mode 100644 index 00000000..40dee147 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 61f0b80493c9b404d8c7bf56d59c3f81 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader new file mode 100644 index 00000000..18eb6071 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader @@ -0,0 +1,101 @@ +Shader "Hidden/ViewDir" +{ + CGINCLUDE + #include "Preview.cginc" + ENDCG + + SubShader + { + + Pass // 0 => Tangent Space + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 worldViewDir = normalize(preview_WorldSpaceCameraPos - vertexPos); + + float3 normal = normalize(vertexPos); + float3 worldNormal = UnityObjectToWorldNormal(normal); + + float3 tangent = PreviewFragmentTangentOS( i.uv ); + float3 worldPos = mul(unity_ObjectToWorld, float4(vertexPos,1)).xyz; + float3 worldTangent = UnityObjectToWorldDir(tangent); + float tangentSign = -1; + float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); + float4 tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); + float4 tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); + float4 tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); + + fixed3 viewDirTan = tSpace0.xyz * worldViewDir.x + tSpace1.xyz * worldViewDir.y + tSpace2.xyz * worldViewDir.z; + + return float4(viewDirTan, 1); + } + ENDCG + } + + Pass // 1 => World Space + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 worldViewDir = PreviewWorldSpaceViewDir( vertexPos, true ); + + return float4(worldViewDir, 1); + } + ENDCG + } + + Pass // 2 => Object Space + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 worldViewDir = PreviewWorldSpaceViewDir( vertexPos, false ); + float3 objViewDir = PreviewWorldToObjectDir( worldViewDir, true ); + + return float4(objViewDir, 1); + } + ENDCG + } + + Pass // 3 => View Space + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 worldViewDir = PreviewWorldSpaceViewDir( vertexPos, false ); + float3 viewViewDir = PreviewWorldToViewDir( worldViewDir, true ); + + return float4(viewViewDir, 1); + } + ENDCG + } + + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader.meta new file mode 100644 index 00000000..5a1748fb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 07b57d9823df4bd4d8fe6dcb29fca36a +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewVector.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewVector.shader new file mode 100644 index 00000000..e90ca0ee --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewVector.shader @@ -0,0 +1,101 @@ +Shader "Hidden/ViewVector" +{ + CGINCLUDE + #include "Preview.cginc" + ENDCG + + SubShader + { + + Pass // 0 => Tangent Space + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 worldViewDir = normalize(preview_WorldSpaceCameraPos - vertexPos); + + float3 normal = normalize(vertexPos); + float3 worldNormal = UnityObjectToWorldNormal(normal); + + float3 tangent = PreviewFragmentTangentOS( i.uv ); + float3 worldPos = mul(unity_ObjectToWorld, float4(vertexPos,1)).xyz; + float3 worldTangent = UnityObjectToWorldDir(tangent); + float tangentSign = -1; + float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); + float4 tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); + float4 tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); + float4 tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); + + fixed3 viewDirTan = tSpace0.xyz * worldViewDir.x + tSpace1.xyz * worldViewDir.y + tSpace2.xyz * worldViewDir.z; + + return float4(viewDirTan, 1); + } + ENDCG + } + + Pass // 1 => World Space + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 worldViewDir = PreviewWorldSpaceViewDir( vertexPos, false ); + + return float4(worldViewDir, 1); + } + ENDCG + } + + Pass // 2 => Object Space + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 worldViewDir = PreviewWorldSpaceViewDir( vertexPos, false ); + float3 objViewDir = PreviewWorldToObjectDir( worldViewDir, false ); + + return float4(objViewDir, 1); + } + ENDCG + } + + Pass // 3 => View Space + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 worldViewDir = PreviewWorldSpaceViewDir( vertexPos, false ); + float3 viewViewDir = PreviewWorldToViewDir( worldViewDir, false ); + + return float4(viewViewDir, 1); + } + ENDCG + } + + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewVector.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewVector.shader.meta new file mode 100644 index 00000000..14e51c30 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewVector.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 30c17cf801c339f489ed656ff9d66a5b +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewVector.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader new file mode 100644 index 00000000..84f0e413 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader @@ -0,0 +1,265 @@ +Shader "Hidden/VoronoiNode" +{ + Properties + { + _A("_RGB", 2D) = "white" {} + _B("_RGB", 2D) = "white" {} + _C("_RGB", 2D) = "white" {} + _D ("_RGB", 2D) = "white" {} + _UseTileScale("_UseTileScale", Float) = 0 + _TileScale ("_TileScale", Int) = 1 + _MinkowskiPower("_MinkowskiPower", Float) = 0 + _DistFunc("_DistFunc", Int) = 0 + _MethodType("_MethodType", Int) = 0 + _SearchQuality("_SearchQuality", Int) = 1 + _Octaves("_Octaves", Int) = 1 + _UseSmoothness("_UseSmoothness", Int ) = 0 + } + SubShader + { + Tags { "RenderType"="Opaque" } + CGINCLUDE + sampler2D _A; + sampler2D _B; + sampler2D _C; + sampler2D _D; + float _UseTileScale = 0; + int _TileScale = 1; + float _MinkowskiPower = 1; + int _DistFunc = 0; + int _MethodType = 0; + int _SearchQuality = 0; + int _Octaves = 1; + int _PreviewID = 0; + int _UseSmoothness = 0; + int _CustomUVs; + + float2 VoronoiHash( float2 p ) + { + p = lerp( p, p - _TileScale * floor (p / _TileScale), _UseTileScale ); + p = float2(dot (p, float2(127.1, 311.7)), dot (p, float2(269.5, 183.3))); + return frac (sin (p) *43758.5453); + } + + float Voronoi( float2 v, float time, inout float2 id, inout float2 mr, float smoothness ) + { + float2 n = floor(v); + float2 f = frac(v); + float F1 = 8.0; + float F2 = 8.0; + float2 mg = 0; + for (int j = -_SearchQuality; j <= _SearchQuality; j++) + { + for (int i = -_SearchQuality; i <= _SearchQuality; i++) + { + float2 g = float2(i, j); + float2 o = VoronoiHash (n + g); + o = (sin (time + o * 6.2831) * 0.5 + 0.5); float2 r = f - g - o; + float d = 0; + //Euclidean^2 + if (_DistFunc == 0) + { + d = 0.5 * dot (r, r); + } + //Euclidean + else if (_DistFunc == 1) + { + d = 0.707 * sqrt (dot (r, r)); + } + //Manhattan + else if (_DistFunc == 2) + { + d = 0.5 * (abs (r.x) + abs (r.y)); + } + //Chebyshev + else if (_DistFunc == 3) + { + d = max (abs (r.x), abs (r.y)); + } + //Minkowski + else if (_DistFunc == 4) + { + d = (1 / pow(2, 1 / _MinkowskiPower)) * pow( ( pow( abs( r.x ), _MinkowskiPower) + pow( abs( r.y ), _MinkowskiPower) ), (1 / _MinkowskiPower)); + } + + if (_MethodType == 0 && _UseSmoothness == 1) + { + float h = smoothstep (0.0, 1.0, 0.5 + 0.5 * (F1 - d) / smoothness); + F1 = lerp (F1, d, h) - smoothness * h * (1.0 - h); + mg = g; mr = r; id = o; + } + else + { + if (d < F1) + { + F2 = F1; + F1 = d; mg = g; mr = r; id = o; + } + else if (d < F2) + { + F2 = d; + } + + } + + } + } + + //Cells + if(_MethodType == 0) + { + return F1; + } + //Crystal + else if (_MethodType == 1) + { + return F2; + } + //Glass + else if (_MethodType == 2) + { + return F2 - F1; + } + //Caustic + else if (_MethodType == 3) + { + return (F2 + F1) * 0.5; + } + //Distance + else if (_MethodType == 4) + { + F1 = 8.0; + for (int j = -2; j <= 2; j++) + { + for (int i = -2; i <= 2; i++) + { + float2 g = mg + float2(i, j); + float2 o = VoronoiHash (n + g); + o = ( sin (time + o * 6.2831) * 0.5 + 0.5); + float2 r = f - g - o; + float d = dot (0.5 * (mr + r), normalize (r - mr)); + F1 = min (F1, d); + } + } + return F1; + } + else + return F1; + } + + + ENDCG + + Pass // Voronoi - Unity + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + inline float2 UnityVoronoiRandomVector (float2 UV, float offset) + { + float2x2 m = float2x2(15.27, 47.63, 99.41, 89.98); + UV = frac (sin (mul (UV, m)) * 46839.32); + return float2(sin (UV.y* +offset) * 0.5 + 0.5, cos (UV.x* offset) * 0.5 + 0.5); + } + + //x - Out y - Cells + float3 UnityVoronoi (float2 UV, float AngleOffset, float CellDensity, inout float2 mr) + { + float2 g = floor (UV * CellDensity); + float2 f = frac (UV * CellDensity); + float t = 8.0; + float3 res = float3(8.0, 0.0, 0.0); + + for (int y = -1; y <= 1; y++) + { + for (int x = -1; x <= 1; x++) + { + float2 lattice = float2(x, y); + float2 offset = UnityVoronoiRandomVector (lattice + g, AngleOffset); + float d = distance (lattice + offset, f); + if (d < res.x) + { + mr = f - lattice - offset; + res = float3(d, offset.x, offset.y); + } + } + } + return res; + } + + float4 frag (v2f_img i) : SV_Target + { + float2 uvValue = i.uv; + if (_CustomUVs == 1) + uvValue = tex2D(_A, i.uv).rg; + float angleOffset = tex2D(_B, i.uv).r; + float cellDensity = tex2D(_C, i.uv).r; + float2 uv = 0; + float3 voronoiVal = UnityVoronoi( uvValue, angleOffset , cellDensity, uv ); + if( _PreviewID == 2) + return float4( uv, 0, 1 ); + else if( _PreviewID == 1) + return float4( voronoiVal.yz, 0, 1 ); + else + return float4( voronoiVal.xxx, 1); + } + ENDCG + } + + Pass // Voronoi - ASE + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag (v2f_img i) : SV_Target + { + float2 uvValue = i.uv; + if (_CustomUVs == 1) + uvValue = tex2D(_A, i.uv).rg; + float time = tex2D (_B, i.uv).r; + float scale = tex2D (_C, i.uv).r; + float smoothness = tex2D (_D, i.uv).r; + + float2 id = 0; + float2 uv = 0; + float voronoiVal = Voronoi( uvValue*scale,time, id, uv, smoothness ); + if (_Octaves == 1) + { + if( _PreviewID == 2) + return float4( uv, 0, 1 ); + else if( _PreviewID == 1) + return float4( id, 0, 1 ); + else + return float4(voronoiVal.xxx, 1); + } + else + { + float fade = 0.5; + float voroi = 0; + float rest = 0; + for (int it = 0; it < _Octaves; it++) + { + voroi += fade * Voronoi( uvValue*scale, time, id, uv, smoothness); + rest += fade; + uvValue *= 2; + fade *= 0.5; + } + voroi /= rest; + if( _PreviewID == 2) + return float4( uv, 0, 1 ); + else if( _PreviewID == 1) + return float4( id, 0, 1 ); + else + return float4(voroi.xxx, 1); + } + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader.meta new file mode 100644 index 00000000..2b66b192 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: bc1498ccdade442479038b24982fc946 +timeCreated: 1566905239 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader new file mode 100644 index 00000000..dd2ce29b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader @@ -0,0 +1,85 @@ +Shader "Hidden/WeightedBlendNode" +{ + Properties + { + _A ( "_Weights", 2D) = "white" {} + _B ( "_Layer1", 2D) = "white" {} + _C ( "_Layer2", 2D ) = "white" {} + _D ( "_Layer3", 2D ) = "white" {} + _E ( "_Layer4", 2D ) = "white" {} + } + + SubShader + { + + CGINCLUDE + + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + sampler2D _A; + sampler2D _B; + + ENDCG + + Pass + { + CGPROGRAM + float4 frag(v2f_img i) : SV_Target + { + float4 Layer1 = tex2D( _B, i.uv ); + return Layer1; + } + ENDCG + } + + Pass + { + CGPROGRAM + sampler2D _C; + float4 frag ( v2f_img i ) : SV_Target + { + float4 Weights = tex2D ( _A, i.uv ); + float4 Layer1 = tex2D ( _B, i.uv ); + float4 Layer2 = tex2D ( _C, i.uv ); + return ( Weights.x*Layer1 + Weights.y*Layer2 ) / ( Weights.x + Weights.y ); + } + ENDCG + } + + Pass + { + CGPROGRAM + sampler2D _C; + sampler2D _D; + float4 frag ( v2f_img i ) : SV_Target + { + float4 Weights = tex2D( _A, i.uv ); + float4 Layer1 = tex2D( _B, i.uv ); + float4 Layer2 = tex2D( _C, i.uv ); + float4 Layer3 = tex2D( _D, i.uv ); + return ( Weights.x*Layer1 + Weights.y*Layer2 + Weights.z*Layer3 ) / ( Weights.x + Weights.y + Weights.z ); + } + ENDCG + } + + Pass + { + CGPROGRAM + sampler2D _C; + sampler2D _D; + sampler2D _E; + float4 frag ( v2f_img i ) : SV_Target + { + float4 Weights = tex2D ( _A, i.uv ); + float4 Layer1 = tex2D ( _B, i.uv ); + float4 Layer2 = tex2D ( _C, i.uv ); + float4 Layer3 = tex2D ( _D, i.uv ); + float4 Layer4 = tex2D ( _E, i.uv ); + return ( Weights.x*Layer1 + Weights.y*Layer2 + Weights.z*Layer3 + Weights.w*Layer4 ) / ( Weights.x + Weights.y + Weights.z + Weights.w ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader.meta new file mode 100644 index 00000000..0daf7c1a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6076cbeaa41ebb14c85ff81b58df7d88 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader new file mode 100644 index 00000000..9e0ea606 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/WireNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return tex2D( _A, i.uv ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader.meta new file mode 100644 index 00000000..fd4c18ce --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: fa1e3e404e6b3c243b5527b82739d682 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader new file mode 100644 index 00000000..518a8800 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader @@ -0,0 +1,66 @@ +Shader "Hidden/WorldNormalVector" +{ + Properties + { + _A ("_WorldNormal", 2D) = "white" {} + } + SubShader + { + Pass //not connected + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 worldNormal = UnityObjectToWorldNormal(normal); + return float4(worldNormal, 1); + } + ENDCG + } + + Pass //connected + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 worldNormal = UnityObjectToWorldNormal(normal); + + float3 tangent = PreviewFragmentTangentOS( i.uv ); + float3 worldPos = mul(unity_ObjectToWorld, float4(vertexPos,1)).xyz; + float3 worldTangent = UnityObjectToWorldDir(tangent); + float tangentSign = -1; + float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); + float4 tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); + float4 tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); + float4 tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); + + float2 sphereUVs = i.uv; + + sphereUVs.x = (atan2(vertexPos.x, -vertexPos.z) / (UNITY_PI) + 0.5); + // Needs further checking + //float3 tangentNormal = tex2Dlod(_A, float4(sphereUVs,0,0)).xyz; + float3 tangentNormal = tex2D(_A, sphereUVs).xyz; + + worldNormal = fixed3( dot( tSpace0.xyz, tangentNormal ), dot( tSpace1.xyz, tangentNormal ), dot( tSpace2.xyz, tangentNormal ) ); + + return float4(worldNormal, 1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader.meta new file mode 100644 index 00000000..5e7c3bcd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 5f55f4841abb61e45967957788593a9d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader new file mode 100644 index 00000000..55d13e3d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader @@ -0,0 +1,22 @@ +Shader "Hidden/WorldPosInputsNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float4 worldPos = mul(unity_ObjectToWorld, vertexPos); + return float4 (worldPos.xyz, 1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader.meta new file mode 100644 index 00000000..20156398 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 70d5405009b31a349a4d8285f30cf5d9 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader new file mode 100644 index 00000000..3af02489 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader @@ -0,0 +1,75 @@ +Shader "Hidden/WorldReflectionVector" +{ + Properties + { + _A ("_TangentNormal", 2D) = "white" {} + } + SubShader + { + Pass //not connected + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 worldNormal = UnityObjectToWorldNormal( normal ); + + float3 worldViewDir = normalize(preview_WorldSpaceCameraPos - vertexPos); + float3 worldRefl = -worldViewDir; + worldRefl = reflect( worldRefl, worldNormal ); + + return float4((worldRefl), 1); + } + ENDCG + } + + Pass //connected + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + float3 vertexPos = PreviewFragmentPositionOS( i.uv ); + float3 normal = PreviewFragmentNormalOS( i.uv ); + float3 worldNormal = UnityObjectToWorldNormal( normal ); + + float3 tangent = PreviewFragmentTangentOS( i.uv ); + float3 worldPos = mul(unity_ObjectToWorld, float4(vertexPos,1)).xyz; + float3 worldViewDir = normalize(preview_WorldSpaceCameraPos - vertexPos); + + float3 worldTangent = UnityObjectToWorldDir(tangent); + float tangentSign = -1; + float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); + float4 tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); + float4 tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); + float4 tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); + + float3 worldRefl = -worldViewDir; + + float2 sphereUVs = i.uv; + sphereUVs.x = atan2(vertexPos.x, -vertexPos.z) / (UNITY_PI) + 0.5; + + // Needs further checking + //float3 tangentNormal = tex2Dlod(_A, float4(sphereUVs,0,0)).xyz; + float3 tangentNormal = tex2D(_A, sphereUVs).xyz; + + worldRefl = reflect( worldRefl, half3( dot( tSpace0.xyz, tangentNormal ), dot( tSpace1.xyz, tangentNormal ), dot( tSpace2.xyz, tangentNormal ) ) ); + + return float4((worldRefl), 1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader.meta new file mode 100644 index 00000000..86b6992c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 8e267e9aa545eeb418585a730f50273e +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader new file mode 100644 index 00000000..b0dc46e5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader @@ -0,0 +1,21 @@ +Shader "Hidden/WorldSpaceCameraPos" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + //_WorldSpaceCameraPos + return float4(preview_WorldSpaceCameraPos,0); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader.meta new file mode 100644 index 00000000..b4ecbf92 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6b0c78411043dd24dac1152c84bb63ba +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader new file mode 100644 index 00000000..3d7feeb4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader @@ -0,0 +1,23 @@ +Shader "Hidden/WorldSpaceLightDirHlpNode" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 _EditorWorldLightPos; + + float4 frag( v2f_img i ) : SV_Target + { + float3 lightDir = normalize( _EditorWorldLightPos.xyz ); + return float4 ( lightDir, 1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader.meta new file mode 100644 index 00000000..5e0b40db --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 2e8dc46eb6fb2124d9f0007caf9567e3 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader new file mode 100644 index 00000000..31e1ff37 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader @@ -0,0 +1,34 @@ +Shader "Hidden/WorldSpaceLightPosNode" +{ + SubShader + { + CGINCLUDE + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + ENDCG + + Pass + { + CGPROGRAM + float4 _EditorWorldLightPos; + float4 frag( v2f_img i ) : SV_Target + { + float3 lightDir = normalize( _EditorWorldLightPos.xyz ); + return float4 ( lightDir, 0); + } + ENDCG + } + + Pass + { + CGPROGRAM + float4 frag( v2f_img i ) : SV_Target + { + return (0).xxxx; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader.meta new file mode 100644 index 00000000..c66d0876 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 2292a614672283c41a367b22cdde4620 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader new file mode 100644 index 00000000..1c7e8619 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/WorldSpaceViewDirHlpNode" +{ +Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + sampler2D _A; + + float4 frag( v2f_img i ) : SV_Target + { + return float4( float3( 0,0,-5 ) - tex2D( _A, i.uv ).rgb,1); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader.meta new file mode 100644 index 00000000..4719d047 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: fe0e09756a8a0ba408015b43e66cb8a6 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader new file mode 100644 index 00000000..13d84512 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader @@ -0,0 +1,26 @@ +Shader "Hidden/WorldToObjectTransfNode" +{ + Properties + { + _A ("_A", 2D) = "white" {} + } + SubShader + { + Pass + { + CGPROGRAM + #include "UnityCG.cginc" + #include "Preview.cginc" + #pragma vertex vert_img + #pragma fragment frag + + sampler2D _A; + + float4 frag(v2f_img i) : SV_Target + { + return mul(unity_WorldToObject, tex2D( _A, i.uv )); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader.meta new file mode 100644 index 00000000..a0271b38 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 79a5efd1e3309f54d8ba3e7fdf5e459b +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader new file mode 100644 index 00000000..35438240 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader @@ -0,0 +1,21 @@ +Shader "Hidden/WorldTransformParams" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + return unity_WorldTransformParams; + } + ENDCG + } + + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader.meta new file mode 100644 index 00000000..b2a00113 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 5a2642605f085da458d6e03ade47b87a +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader new file mode 100644 index 00000000..15270b5f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader @@ -0,0 +1,20 @@ +Shader "Hidden/ZBufferParams" +{ + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + #include "Preview.cginc" + + float4 frag( v2f_img i ) : SV_Target + { + return _ZBufferParams; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader.meta new file mode 100644 index 00000000..0516e146 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 56c42c106bcb497439187f5bb6b6f94d +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader new file mode 100644 index 00000000..408050d1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader @@ -0,0 +1,30 @@ +Shader "Hidden/TextureArrayEditor" +{ + Properties + { + _MainTex ("_MainTex", 2DArray) = "white" {} + _Index ("_Index", Int) = 0 + } + SubShader + { + Pass + { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #pragma target 3.5 + #include "UnityCG.cginc" + #include "UnityStandardUtils.cginc" + + uniform UNITY_DECLARE_TEX2DARRAY( _MainTex ); + int _Index; + + float4 frag( v2f_img i ) : SV_Target + { + //return UNITY_SAMPLE_TEX2DARRAY_LOD( _MainTex, float3( i.uv, _Index), 0 ); + return UNITY_SAMPLE_TEX2DARRAY( _MainTex, float3( i.uv, _Index) ); + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader.meta new file mode 100644 index 00000000..8ced9dea --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 610c24aad350fba4583068c6c22fa428 +timeCreated: 1488289785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions.meta new file mode 100644 index 00000000..96c839a5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e21dd05d276e6c8438cc722d4559a0c3 +folderAsset: yes +timeCreated: 1507301549 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Merge.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Merge.asset new file mode 100644 index 00000000..179c1e1f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Merge.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4dc0c324f9d54b063d6d75947b9ac1228aabece2e28976b45ebd5bc495d1fadb +size 1970 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Merge.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Merge.asset.meta new file mode 100644 index 00000000..61dc8602 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Merge.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: e0d79828992f19c4f90bfc29aa19b7a5 +timeCreated: 1589816062 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha + Merge.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Split.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Split.asset new file mode 100644 index 00000000..aa143cd5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Split.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16bde4f6b25813fbc3f20454aa241ebe57a9e5ec8a3ce4b5840be4f0784f20a6 +size 2057 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Split.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Split.asset.meta new file mode 100644 index 00000000..7741434a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha Split.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 07dab7960105b86429ac8eebd729ed6d +timeCreated: 1589816062 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Alpha + Split.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/And.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/And.asset new file mode 100644 index 00000000..a8282e5b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/And.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:758a2773159ffb259fd5acfd55af0b9bb66c8d5c92f05ba8443ef895318d283f +size 2026 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/And.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/And.asset.meta new file mode 100644 index 00000000..21547c64 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/And.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 50f923f3b90822e47953386ea346e02f +timeCreated: 1589816062 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/And.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria Smoothstep.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria Smoothstep.asset new file mode 100644 index 00000000..3ae68472 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria Smoothstep.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b268e28bc5818a5ce2c8398434212e78123b6617efcf9c77d1b3f80c753b9cf +size 3380 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria Smoothstep.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria Smoothstep.asset.meta new file mode 100644 index 00000000..482f5e9a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria Smoothstep.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: d36a59c7990768542a8760d627324096 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria + Smoothstep.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset new file mode 100644 index 00000000..e3ed38fb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5664d047005e1bfff12e4d861eadf2eb9e928241246b98da2a4ed6260c84d88c +size 8593 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset.meta new file mode 100644 index 00000000..fc440b58 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c4b8e21d0aca1b04d843e80ebaf2ba67 +timeCreated: 1586867844 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Precompute.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Precompute.asset new file mode 100644 index 00000000..750b2e0d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Precompute.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:729819d86365db448c2647100c6bd4e2a23cb11c3bd056ea6b39f1b2c22eeb0e +size 3562 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Precompute.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Precompute.asset.meta new file mode 100644 index 00000000..47ec9068 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Precompute.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 818835145cc522e4da1f9915d8b8a984 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic + Precompute.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Sample.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Sample.asset new file mode 100644 index 00000000..442133fc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Sample.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:686f8ca493be33e11908548798e01489b8982f7fba7d53823cc315b51fda41a6 +size 35276 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Sample.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Sample.asset.meta new file mode 100644 index 00000000..92874220 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic Sample.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: ce0e14d5ad5eac645b2e5892ab3506ff +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bicubic + Sample.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional Parallax Mapping.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional Parallax Mapping.asset new file mode 100644 index 00000000..6fd6da80 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional Parallax Mapping.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c7e7183641f774fa2a909920d642f49ff639bc246a3b1949702588ed1e46afb +size 5259 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional Parallax Mapping.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional Parallax Mapping.asset.meta new file mode 100644 index 00000000..692675f9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional Parallax Mapping.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: ab457a4ccb6d8f745b63ef50e1417242 +timeCreated: 1507301651 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional + Parallax Mapping.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blackbody.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blackbody.asset new file mode 100644 index 00000000..02ee9adc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blackbody.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:784712ea1fee4844226526227a836bc134d9d890080546ac56bd21d9c98c9d56 +size 2415 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blackbody.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blackbody.asset.meta new file mode 100644 index 00000000..a8335e12 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blackbody.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e2cbc0474cd946f4ea11e89cfd2c903a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blackbody.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Half Vector.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Half Vector.asset new file mode 100644 index 00000000..4e2b716b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Half Vector.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82e36fd98e654eef12b0cd359fc878c721ef5555eaa18f1a8ae9a111ab3f32ff +size 2158 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Half Vector.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Half Vector.asset.meta new file mode 100644 index 00000000..3f548034 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Half Vector.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 91a149ac9d615be429126c95e20753ce +timeCreated: 1509361778 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong + Half Vector.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Light.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Light.asset new file mode 100644 index 00000000..210ec993 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Light.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0f8ea0066635816944d0767a4eed9e4b03b348ab0dd6903e5d837fe1062fe6f +size 7186 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Light.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Light.asset.meta new file mode 100644 index 00000000..36b6173e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Light.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: cf814dba44d007a4e958d2ddd5813da6 +timeCreated: 1510331168 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong + Light.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset new file mode 100644 index 00000000..c54bb69c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb022475ed56318be50183d67f6b6d6886c41126bc75b6949924db72688b0c3b +size 11468 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset.meta new file mode 100644 index 00000000..d79c43b3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 139fed909c1bc1a42a96c42d8cf09006 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset new file mode 100644 index 00000000..b87d9c21 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75a690b378ce3324278bb550c5b35dc6c7edfb7d21fc3fa1a97824286b194025 +size 3176 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset.meta new file mode 100644 index 00000000..a0a1bd62 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 9dce4093ad5a42b4aa255f0153c4f209 +timeCreated: 1516621733 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks Pattern.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks Pattern.asset new file mode 100644 index 00000000..751ba1cd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks Pattern.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:86e57635cc49822fb5e3a8dca257c83981b938c78b1e0bedd1adabcd581e05a8 +size 6539 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks Pattern.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks Pattern.asset.meta new file mode 100644 index 00000000..53b48b29 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks Pattern.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 7d219d3a79fd53a48987a86fa91d6bac +timeCreated: 1586861586 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks + Pattern.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset new file mode 100644 index 00000000..456aebbe --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:961431bcc929f5c1e8013b64c81b43674e8d1c3af9bba22c34bdd46a1c9ff5b8 +size 12078 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset.meta new file mode 100644 index 00000000..42b1bb22 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 43dad715d66e03a4c8ad5f9564018081 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color Mask.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color Mask.asset new file mode 100644 index 00000000..d9cc4eb6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color Mask.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0bcff55beb4c6fbdf8fbc9ece3f913f427780db0f02d56a44241d122d3da346d +size 3114 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color Mask.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color Mask.asset.meta new file mode 100644 index 00000000..01cae6e8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color Mask.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: eec747d987850564c95bde0e5a6d1867 +timeCreated: 1529242750 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color + Mask.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Compute Mip Level.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Compute Mip Level.asset new file mode 100644 index 00000000..a0475704 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Compute Mip Level.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c6375bb45f30e92530ecd72d6ea0f3744717cd15cc6d9f9a791f61a62b7d47b +size 3759 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Compute Mip Level.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Compute Mip Level.asset.meta new file mode 100644 index 00000000..c49d78e7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Compute Mip Level.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6a522eddcfa3e1c4dade9b2b3a33a8a3 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Compute + Mip Level.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset new file mode 100644 index 00000000..c0009d06 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c6076c8193190d45fd0d9d301c17fcca1c54a5c85445f3a779141f9e986f9c9 +size 2576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset.meta new file mode 100644 index 00000000..5b5dfdc0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 326bea850683cca44ae7af083d880d70 +timeCreated: 1512498793 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset new file mode 100644 index 00000000..2b687f1e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53ef5d4f310f411e3cc3f2f5b11d2c6ba78b16b6271b81c70d3fd8d691e5e343 +size 2205 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset.meta new file mode 100644 index 00000000..c033bf9c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 63208df05c83e8e49a48ffbdce2e43a0 +timeCreated: 1519302963 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset new file mode 100644 index 00000000..9e4bb756 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c9f677187a46d717c97e82c132c1c3a5eb670a53a30876bd792711023f114bee +size 3022 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset.meta new file mode 100644 index 00000000..e39d34bc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 62ce0f00f1417804bb4f2b38501ba0d0 +timeCreated: 1522316215 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create Orthogonal Vector.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create Orthogonal Vector.asset new file mode 100644 index 00000000..6173b81a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create Orthogonal Vector.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2d474a7a436812bb340d633f8e59ea09bd19aa533684d58201a73814c7540f1c +size 3017 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create Orthogonal Vector.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create Orthogonal Vector.asset.meta new file mode 100644 index 00000000..72660019 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create Orthogonal Vector.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 83358ef05db30f04ba825a1be5f469d8 +timeCreated: 1518189974 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create + Orthogonal Vector.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Custom Screen Position.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Custom Screen Position.asset new file mode 100644 index 00000000..bc44ec91 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Custom Screen Position.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81b36053f7e289f66fe6fc7e1ffbadbe9990045bb1434f13e626050feae94d28 +size 4269 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Custom Screen Position.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Custom Screen Position.asset.meta new file mode 100644 index 00000000..8e4e0d9f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Custom Screen Position.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 35530643343074e4bb5fb02a7011bd50 +timeCreated: 1629466119 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Custom + Screen Position.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode Directional Lighmap.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode Directional Lighmap.asset new file mode 100644 index 00000000..5190eb77 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode Directional Lighmap.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:928594ec91961d8de30a8f7325cab5d1663e2774bdbecbee56890de6c6a3da81 +size 5021 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode Directional Lighmap.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode Directional Lighmap.asset.meta new file mode 100644 index 00000000..326e8298 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode Directional Lighmap.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 8132441d5c7c63f479ea1c42855420a8 +timeCreated: 1550589461 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode + Directional Lighmap.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/DepthMaskedRefraction.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/DepthMaskedRefraction.asset new file mode 100644 index 00000000..3f3420d6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/DepthMaskedRefraction.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:70190739bd87bd41e8c3449a692f77c7ec3deb6ac1592f7d65e37a6f94bbd679 +size 7730 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/DepthMaskedRefraction.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/DepthMaskedRefraction.asset.meta new file mode 100644 index 00000000..4b7b8b7f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/DepthMaskedRefraction.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c805f061214177c42bca056464193f81 +timeCreated: 1600098425 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/DepthMaskedRefraction.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive Tangent Basis.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive Tangent Basis.asset new file mode 100644 index 00000000..597ed698 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive Tangent Basis.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:410ea4394d52c6fd5e6fbff5646f72478478b33ca71de243b0e0bc36f39a7c8f +size 4225 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive Tangent Basis.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive Tangent Basis.asset.meta new file mode 100644 index 00000000..19a33e10 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive Tangent Basis.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: fee816718ad753c4f9b25822c0d67438 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive + Tangent Basis.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail Albedo.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail Albedo.asset new file mode 100644 index 00000000..c1ebaa2b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail Albedo.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f1836e68ea12cc5a4aae670dde83303627f62ea1e982cff1a538c040bc9f33a +size 5016 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail Albedo.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail Albedo.asset.meta new file mode 100644 index 00000000..ee996b30 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail Albedo.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 29e5a290b15a7884983e27c8f1afaa8c +timeCreated: 1527501568 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail + Albedo.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Device Depth.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Device Depth.asset new file mode 100644 index 00000000..5010e6f5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Device Depth.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb2c066a2dd206a49fc896291dcb330ed4efec0608a5f8457521bf30b4999351 +size 1701 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Device Depth.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Device Depth.asset.meta new file mode 100644 index 00000000..5b3caac5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Device Depth.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 406db1e975d44e5438890badc39ee7cf +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Device + Depth.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dielectric Specular.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dielectric Specular.asset new file mode 100644 index 00000000..1aa9340a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dielectric Specular.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d70e063cb16030970dc11d8b5619ef5a903f3519c87f781b40813c3fff614f46 +size 4335 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dielectric Specular.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dielectric Specular.asset.meta new file mode 100644 index 00000000..6a267e2c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dielectric Specular.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: cf90616a2350c5c4cba1069366c98fa1 +timeCreated: 1632734570 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dielectric + Specular.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots Pattern.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots Pattern.asset new file mode 100644 index 00000000..7df5aced --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots Pattern.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9fe54e517a6f76736efa298e16968139ad34372047c7b64b0294bb7008728421 +size 4860 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots Pattern.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots Pattern.asset.meta new file mode 100644 index 00000000..75172ba7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots Pattern.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 7d8d5e315fd9002418fb41741d3a59cb +timeCreated: 1586787388 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots + Pattern.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset new file mode 100644 index 00000000..72f81318 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0325ed946ec0136d56214849ddcf70e536ffacbf1620fc156295806e817836a1 +size 3536 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset.meta new file mode 100644 index 00000000..4b14f874 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3ba94b7b3cfd5f447befde8107c04d52 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Fade Transition.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Fade Transition.asset new file mode 100644 index 00000000..a5edbfa8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Fade Transition.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c56520b1c2cba11eed5d6816d556a9300ef607b5aea7379a687f972004a89c2 +size 3601 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Fade Transition.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Fade Transition.asset.meta new file mode 100644 index 00000000..6766fc53 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Fade Transition.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 91b7dc5bc9671b648a53c97bce206898 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Fade + Transition.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset new file mode 100644 index 00000000..7ed2ee4e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50f9cfb205f3f857ee270c314b762e5af84ff9d37be1de39d1d851f55fc71f9e +size 2694 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset.meta new file mode 100644 index 00000000..ba86465d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e17d5b1cd6898394dbe1f30e05022025 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset new file mode 100644 index 00000000..83b3308d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6203b1ed17dc18d944ff81baebe330ea673bace7d8ed31fe6598c8cae534077 +size 7582 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset.meta new file mode 100644 index 00000000..c4ae74f3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 43de3d4ae59f645418fdd020d1b8e78e +timeCreated: 1528994083 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset new file mode 100644 index 00000000..df70397a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:76724c5c564ed36e2396ac0ce1ad642ed6235805642e93f055832f3b48da2852 +size 8824 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset.meta new file mode 100644 index 00000000..dd74e0b6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 53c2488c220f6564ca6c90721ee16673 +timeCreated: 1515152873 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset new file mode 100644 index 00000000..712c4f79 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8f16e98e20d1208d85bbc198b8bbb6e634066b5a9feb09cf543ef0759d96978f +size 8773 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset.meta new file mode 100644 index 00000000..61b339fd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: acad10cc8145e1f4eb8042bebe2d9a42 +timeCreated: 1575558674 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four Splats First Pass Terrain.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four Splats First Pass Terrain.asset new file mode 100644 index 00000000..21d12a28 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four Splats First Pass Terrain.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27f6e3ffe0cd2e9339d901287c73f2503b06b34d4df0d07c7bd9b72847f22bec +size 48508 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four Splats First Pass Terrain.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four Splats First Pass Terrain.asset.meta new file mode 100644 index 00000000..ad1b962b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four Splats First Pass Terrain.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 37452fdfb732e1443b7e39720d05b708 +timeCreated: 1513337564 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four + Splats First Pass Terrain.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset new file mode 100644 index 00000000..81664028 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:03ea2b4fbb31e900babe6852eedd9fc46028de00998c14c75b7277cc54141aa2 +size 2544 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset.meta new file mode 100644 index 00000000..c347bd7d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a9240ca2be7e49e4f9fa3de380c0dbe9 +timeCreated: 1586860862 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/HDRP Decal UVs.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/HDRP Decal UVs.asset new file mode 100644 index 00000000..f87887ce --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/HDRP Decal UVs.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b661edf1f55eda67e0e56a862bf62891a5ec33c66cba2f475e2775a1542b881c +size 5827 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/HDRP Decal UVs.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/HDRP Decal UVs.asset.meta new file mode 100644 index 00000000..a5a6aff9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/HDRP Decal UVs.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 5e2643b1c5c9c214d8c438e23555b8af +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/HDRP + Decal UVs.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half Lambert Term.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half Lambert Term.asset new file mode 100644 index 00000000..81fac71d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half Lambert Term.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:913828947c6815521b463467ac8aa73501fa83499db864842dd99f80e1e8de9a +size 2598 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half Lambert Term.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half Lambert Term.asset.meta new file mode 100644 index 00000000..acc0aa91 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half Lambert Term.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 86299dc21373a954aa5772333626c9c1 +timeCreated: 1510234721 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half + Lambert Term.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based Blending.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based Blending.asset new file mode 100644 index 00000000..5b2de5d1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based Blending.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d7fad132fabe1c9e6acb6b625fb51cfb52be0ad9000f2a1125b4ce264cb0a44 +size 3929 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based Blending.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based Blending.asset.meta new file mode 100644 index 00000000..f5d13447 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based Blending.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 31c0084e26e17dc4c963d2f60261c022 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based + Blending.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset new file mode 100644 index 00000000..ca0b30af --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e982d3b67af2d1aaa246730838148544bed134d1d0e81bfa9247c3d7dc35c70d +size 7022 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset.meta new file mode 100644 index 00000000..2da35fd8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: dbdb22f3b40ddf6459baf32842f7168a +timeCreated: 1586866005 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex Lattice.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex Lattice.asset new file mode 100644 index 00000000..32ccf47a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex Lattice.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e75f7347caffe7967a07e2d1d774300d1ebb5eab1fdf958ba6d9830bfae5b33 +size 5257 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex Lattice.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex Lattice.asset.meta new file mode 100644 index 00000000..16921873 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex Lattice.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 56d977fb137832a498dced8436cf6708 +timeCreated: 1586863236 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex + Lattice.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset new file mode 100644 index 00000000..c48bd794 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be1c566df96949a0b5752f60526947038da30bef51bc5d5f326b36d5072fbe2a +size 4263 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset.meta new file mode 100644 index 00000000..c75f33df --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 179b3e2dbd7f5a247afe15a7315e0707 +timeCreated: 1586788750 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse Lerp.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse Lerp.asset new file mode 100644 index 00000000..01cbf572 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse Lerp.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5258b2f435ab78effd154b063f480684fdf253890d69afe08377d08e1f2ce804 +size 2554 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse Lerp.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse Lerp.asset.meta new file mode 100644 index 00000000..b023fd5e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse Lerp.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 09cbe79402f023141a4dc1fddd4c9511 +timeCreated: 1582898085 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse + Lerp.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lambert Light.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lambert Light.asset new file mode 100644 index 00000000..cc2542f8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lambert Light.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c922b1c4b07a0aa1f91432d3b851dd3ebb686d61864c4426b03116efce9ce3c +size 4969 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lambert Light.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lambert Light.asset.meta new file mode 100644 index 00000000..f9fc724e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lambert Light.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 9be9b95d80559e74dac059ac0a4060cf +timeCreated: 1510331168 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lambert + Light.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp White To.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp White To.asset new file mode 100644 index 00000000..0e90aa2b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp White To.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:721c4a8968c808ecfc1c06154490c6bf7359603e61ec85629bc4509816976fec +size 2393 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp White To.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp White To.asset.meta new file mode 100644 index 00000000..dcbe59f7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp White To.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 047d7c189c36a62438973bad9d37b1c2 +timeCreated: 1527498692 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp + White To.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lightmap UV.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lightmap UV.asset new file mode 100644 index 00000000..db75f03a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lightmap UV.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f7394965ceaf56603bd07eda385c86e34a625b91e3fb2f76498a96f999b62fa9 +size 4007 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lightmap UV.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lightmap UV.asset.meta new file mode 100644 index 00000000..463aa45f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lightmap UV.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 1940f027d0458684eb0ad486f669d7d5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lightmap + UV.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Metal Reflectance.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Metal Reflectance.asset new file mode 100644 index 00000000..be8d2d5c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Metal Reflectance.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:393f008d1af883885892bf1bf32433ae7d76b9d66b67958df38aaccc62af8408 +size 10177 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Metal Reflectance.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Metal Reflectance.asset.meta new file mode 100644 index 00000000..75f386a8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Metal Reflectance.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 55ea54ba7a9d52c4a8bf7b3e01e6ae77 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Metal + Reflectance.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones Control.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones Control.asset new file mode 100644 index 00000000..8c08065f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones Control.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c74ed32e79ba56e3583fd35b842298b73a38a19af72f503ced290ad06524ac55 +size 6135 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones Control.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones Control.asset.meta new file mode 100644 index 00000000..c7f1db4f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones Control.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 1862d12003a80d24ab048da83dc4e4d5 +timeCreated: 1516025195 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones + Control.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise Sine Wave.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise Sine Wave.asset new file mode 100644 index 00000000..641cbaf3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise Sine Wave.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dc1f653be511cb8c360c572471e58309f7a0641c362c19130e85fa1376dbc85e +size 4660 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise Sine Wave.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise Sine Wave.asset.meta new file mode 100644 index 00000000..fc75135b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise Sine Wave.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: a6eff29f739ced848846e3b648af87bd +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise + Sine Wave.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non Stereo Screen Pos.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non Stereo Screen Pos.asset new file mode 100644 index 00000000..2a18bab4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non Stereo Screen Pos.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5337054e01dfeb8cf3081bf650eb748a82e80fabde5b2dae7878fc2508baa56 +size 2220 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non Stereo Screen Pos.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non Stereo Screen Pos.asset.meta new file mode 100644 index 00000000..4c54648d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non Stereo Screen Pos.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 1731ee083b93c104880efc701e11b49b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non + Stereo Screen Pos.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Face.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Face.asset new file mode 100644 index 00000000..ac706edd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Face.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3991ecf6032da311d96f5f1281aac69e3dca96b2ae93712fa9f2f49c8ba44890 +size 5362 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Face.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Face.asset.meta new file mode 100644 index 00000000..aa642b58 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Face.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: f4725843c667a994e8a7e4987db394b2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal + Face.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Height.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Height.asset new file mode 100644 index 00000000..7beb9075 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Height.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5790ef313a8ddd0010db11eca633c7ce8bff5d51f304ef80e7172f5dece610b8 +size 3440 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Height.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Height.asset.meta new file mode 100644 index 00000000..6b0e836c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Height.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 1942fe2c5f1a1f94881a33d532e4afeb +timeCreated: 1575458539 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal + From Height.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Texture.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Texture.asset new file mode 100644 index 00000000..3c30cfcf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Texture.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a432652a68f96ad721897cf611786e842693f594b42329678c08335f4d2665d2 +size 27773 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Texture.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Texture.asset.meta new file mode 100644 index 00000000..b380190d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Texture.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 9728ee98a55193249b513caf9a0f1676 +timeCreated: 1575458539 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal + From Texture.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Reconstruct Z.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Reconstruct Z.asset new file mode 100644 index 00000000..0e26e71e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Reconstruct Z.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15908509a36ae53742c13d5d827abcebc8e270f9f356d95dd5298900867466e6 +size 3210 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Reconstruct Z.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Reconstruct Z.asset.meta new file mode 100644 index 00000000..0f25e466 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal Reconstruct Z.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 63ba85b764ae0c84ab3d698b86364ae9 +timeCreated: 1638270059 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal + Reconstruct Z.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset new file mode 100644 index 00000000..6eedfc34 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:097960bcfd0ce9c571d91b6f3bac985f06a7a22a9adfa195de505cc7a34021d0 +size 6611 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset.meta new file mode 100644 index 00000000..ee7788b7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e12f7ae19d416b942820e3932b56220f +timeCreated: 1520619538 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Or.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Or.asset new file mode 100644 index 00000000..6761cca8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Or.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9494fa4ca1af9bc52f361b22b3a9f7d5e28efb70264d7c463941a86e98969e03 +size 2035 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Or.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Or.asset.meta new file mode 100644 index 00000000..db7895a3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Or.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: dcfde22f80031984b87bcc46a052ad1f +timeCreated: 1589816062 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Or.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset new file mode 100644 index 00000000..4d511fa1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb78140f2a8dcc7173b18a1fa53fbb4aaf4edcf3c6c8c5257108969dfd1c1ebf +size 3716 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset.meta new file mode 100644 index 00000000..81e15510 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c8b64dd82fb09f542943a895dffb6c06 +timeCreated: 1522256219 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset new file mode 100644 index 00000000..661b4e11 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf357161654cfa50861ddbb180dd1f2289d6883502c5710b10027df5e7be66c0 +size 5660 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset.meta new file mode 100644 index 00000000..b2ffdaa3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 45dff16e78a0685469fed8b5b46e4d96 +timeCreated: 1542724676 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar Coordinates.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar Coordinates.asset new file mode 100644 index 00000000..fc902042 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar Coordinates.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:346e04aad57eececef2fd6204427333f20d5576aa49b329d3e4195c5ed7292ec +size 7311 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar Coordinates.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar Coordinates.asset.meta new file mode 100644 index 00000000..3a6432d8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar Coordinates.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 7dab8e02884cf104ebefaa2e788e4162 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar + Coordinates.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset new file mode 100644 index 00000000..bcb21aeb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6cdff426c99a16fb2247648b5c02fb593f2b4c42fd12fd178eeb21fefe3f641a +size 8719 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset.meta new file mode 100644 index 00000000..f17a89ce --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6906ef7087298c94c853d6753e182169 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset new file mode 100644 index 00000000..fbf54175 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb7041b00433b2598cf20d737384592cccc0c5202fbfd4bc72211b7c5beb02a2 +size 3592 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset.meta new file mode 100644 index 00000000..8718ed19 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ce0790c3228f3654b818a19dd51453a4 +timeCreated: 1542716511 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Procedural Sample.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Procedural Sample.asset new file mode 100644 index 00000000..2d4ba32c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Procedural Sample.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ee9e0e31b958471e032a87499cba27357a998bdd0bdb9fd70a9211cdea36622 +size 68676 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Procedural Sample.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Procedural Sample.asset.meta new file mode 100644 index 00000000..c2983cf6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Procedural Sample.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: f5379ff72769e2b4495e5ce2f004d8d4 +timeCreated: 1602845933 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Procedural + Sample.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Projection.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Projection.asset new file mode 100644 index 00000000..e9ae7072 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Projection.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5b4bb82c0aaf0ca84d07c805171fc3b54f8cdba0cd5fbb9e33d19a7397d8323 +size 2502 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Projection.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Projection.asset.meta new file mode 100644 index 00000000..7bf311cc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Projection.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3249e2c8638c9ef4bbd1902a2d38a67c +timeCreated: 1589968069 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Projection.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial Shear.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial Shear.asset new file mode 100644 index 00000000..a1fcc9f9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial Shear.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e215396301d2bdfd7e09c83079887bd797ece60be03aadea6023ddb234101fc3 +size 4514 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial Shear.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial Shear.asset.meta new file mode 100644 index 00000000..9207a4ee --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial Shear.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: c6dc9fc7fa9b08c4d95138f2ae88b526 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial + Shear.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset new file mode 100644 index 00000000..9f256871 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62f0c95b912301c3aeefb009e885e341de25e092698b6784d54cd15885234c66 +size 11018 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset.meta new file mode 100644 index 00000000..59e9997a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 051d65e7699b41a4c800363fd0e822b2 +timeCreated: 1510748744 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random Range.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random Range.asset new file mode 100644 index 00000000..07f5f8eb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random Range.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:458b402ce60716c6bcc230ea0ba1272435f1ded41fdb46c3634c6f7876cf2cce +size 3044 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random Range.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random Range.asset.meta new file mode 100644 index 00000000..a7a38fdd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random Range.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 7b754edb8aebbfb4a9ace907af661cfc +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random + Range.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct World Position From Depth.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct World Position From Depth.asset new file mode 100644 index 00000000..142e9c65 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct World Position From Depth.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff4d670c7448fb0804769f9cf900dad89913087a453bcda95beddc4a63195548 +size 6579 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct World Position From Depth.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct World Position From Depth.asset.meta new file mode 100644 index 00000000..4276e050 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct World Position From Depth.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: e7094bcbcc80eb140b2a3dbe6a861de8 +timeCreated: 1507625018 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct + World Position From Depth.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset new file mode 100644 index 00000000..7fd31d21 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0033dc6c24ff75c49c0c5b15f1d2e93ac7f85ffc810442cff02f3308a42c2453 +size 4164 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset.meta new file mode 100644 index 00000000..91a177c4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6b23e0c975270fb4084c354b2c83366a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rejection.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rejection.asset new file mode 100644 index 00000000..49d4cfbd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rejection.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c84252994bb5b2edbba03653ab87f86f2ae78066a4dc716ad0d9510a1a55d580 +size 2392 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rejection.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rejection.asset.meta new file mode 100644 index 00000000..6610c7b8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rejection.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ea6ca936e02c9e74fae837451ff893c3 +timeCreated: 1589968229 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rejection.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace Color.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace Color.asset new file mode 100644 index 00000000..1ac36406 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace Color.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c48987762253b316247d42bf5e81a95d3e49ae32eb93de2f6f48503e97f73692 +size 5332 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace Color.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace Color.asset.meta new file mode 100644 index 00000000..284fe1bf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace Color.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 896dccb3016c847439def376a728b869 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace + Color.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Polygon.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Polygon.asset new file mode 100644 index 00000000..dfaa123c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Polygon.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07eb0eb7a592b56d78f21576d950f1cc1ad00447635a8dde59eaa907cb89adc3 +size 19345 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Polygon.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Polygon.asset.meta new file mode 100644 index 00000000..de89ccf4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Polygon.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: fecbb830e021088498d67321a21209fa +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded + Polygon.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Rectangle.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Rectangle.asset new file mode 100644 index 00000000..e22624e8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Rectangle.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a597359f381f81967f05b84224fa75c9000fceac00a0ec0f9eb08e09ab84d482 +size 7210 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Rectangle.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Rectangle.asset.meta new file mode 100644 index 00000000..d8b09e1e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Rectangle.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 8679f72f5be758f47babb3ba1d5f51d3 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded + Rectangle.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP Additional Light.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP Additional Light.asset new file mode 100644 index 00000000..48eec723 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP Additional Light.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c2227876ac9daf75563f8f13faa1f7783b60c54962dd5354ceb0027d4ce567e +size 40400 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP Additional Light.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP Additional Light.asset.meta new file mode 100644 index 00000000..87fb2f1a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP Additional Light.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6c86746ad131a0a408ca599df5f40861 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP + Additional Light.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sample Lightmap.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sample Lightmap.asset new file mode 100644 index 00000000..fbf275e4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sample Lightmap.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2d027f4974396b9e1e7026312e3e09f74e66ac66c8ec517b6dc7881caa938e1 +size 27708 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sample Lightmap.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sample Lightmap.asset.meta new file mode 100644 index 00000000..c3b688b9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sample Lightmap.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6976f0f966a01684ca0a6dde441141c2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sample + Lightmap.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Saturation.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Saturation.asset new file mode 100644 index 00000000..14fd5778 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Saturation.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4127b3074f8b08e584b5149fbe5703f74699c66174b233248ea2b38b339ebd9d +size 4125 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Saturation.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Saturation.asset.meta new file mode 100644 index 00000000..13a7f65a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Saturation.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4f383aa3b2a7ef640be83276d286e709 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Saturation.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth Wave.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth Wave.asset new file mode 100644 index 00000000..64f67b0c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth Wave.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a315c6a64e361bc716496ac945a36a802f8d3d2f07e579cf5fc83317b060ca5 +size 2338 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth Wave.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth Wave.asset.meta new file mode 100644 index 00000000..7c8d0441 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth Wave.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 289adb816c3ac6d489f255fc3caf5016 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth + Wave.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Shadow Mask.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Shadow Mask.asset new file mode 100644 index 00000000..691892c4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Shadow Mask.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e3b72b8c77b5cf18d6e63af732a77053432ce1b89704399f47faa979e81ae16 +size 2359 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Shadow Mask.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Shadow Mask.asset.meta new file mode 100644 index 00000000..1155502a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Shadow Mask.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: b50f5becdd6b8504a861ba5b9b861159 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Shadow + Mask.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple HUE.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple HUE.asset new file mode 100644 index 00000000..7e649f37 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple HUE.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81bf00291061056217505def2958274920a3d7bbbdddb5d4cbf2f0d0e4c9f54d +size 2447 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple HUE.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple HUE.asset.meta new file mode 100644 index 00000000..a2c4a865 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple HUE.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 32abb5f0db087604486c2db83a2e817a +timeCreated: 1497273339 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple + HUE.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth Wave.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth Wave.asset new file mode 100644 index 00000000..6d728e85 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth Wave.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:05604be20b6a59bef3567b23a3d324b68114da6e4f9f0f1c808b10d18266af77 +size 4822 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth Wave.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth Wave.asset.meta new file mode 100644 index 00000000..27f09c36 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth Wave.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 45d5b33902fbc0848a1166b32106db74 +timeCreated: 1586862423 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth + Wave.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset new file mode 100644 index 00000000..5cc70042 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9bb762bcef2df775ac342180781a412ac82e939d18cba0c5e20bfddbd60cb12 +size 2723 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset.meta new file mode 100644 index 00000000..96822392 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 988803ee12caf5f4690caee3c8c4a5bb +timeCreated: 1497273339 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset new file mode 100644 index 00000000..8db6568e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8b6d9a24ab83aef9dedb5f442603545a2e06c9fba4c41a203d8912009754958 +size 3805 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset.meta new file mode 100644 index 00000000..5ce6a67d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1488bb72d8899174ba0601b595d32b07 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset new file mode 100644 index 00000000..35086675 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:54a75cc81d6c38bf2a15727798e79f918e67832d55aa205ed593c89a35188ed0 +size 5927 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset.meta new file mode 100644 index 00000000..122c7339 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 310c5f1537fa4c44699ebaf10a65d8a2 +timeCreated: 1586860260 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square Wave.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square Wave.asset new file mode 100644 index 00000000..9615e3d8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square Wave.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec426a0a7f7fe7910a4d83469d454da76fbaca6935bc66c8185e51f3986c5fc7 +size 2275 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square Wave.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square Wave.asset.meta new file mode 100644 index 00000000..c2353836 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square Wave.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 6f8df4c09ccca5d42b0d3d422aad9cbd +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square + Wave.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square.asset new file mode 100644 index 00000000..6df7cc40 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd8d74e623cb79a10c65d2386de0b9eca3e17aa90d84ab7f287023b659132572 +size 1808 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square.asset.meta new file mode 100644 index 00000000..590d8821 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fea980a1f68019543b2cd91d506986e8 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step Antialiasing.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step Antialiasing.asset new file mode 100644 index 00000000..d8800ed8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step Antialiasing.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46bc66007c22e4260a814e8ffef2fdd70b258d2d70b0e6c11773fe871efc85c1 +size 2337 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step Antialiasing.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step Antialiasing.asset.meta new file mode 100644 index 00000000..6fd0825d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step Antialiasing.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 2a825e80dfb3290468194f83380797bd +timeCreated: 1517571460 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step + Antialiasing.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stereo Screen Pos.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stereo Screen Pos.asset new file mode 100644 index 00000000..cce0a236 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stereo Screen Pos.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98e07ad548f69a4ccb4fe01fb76a3084dd82ea679c08c58539806ac9bb49190f +size 2408 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stereo Screen Pos.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stereo Screen Pos.asset.meta new file mode 100644 index 00000000..ebe962ce --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stereo Screen Pos.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 855e05b95c44ab9408194955b1347bed +timeCreated: 1613491445 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stereo + Screen Pos.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset new file mode 100644 index 00000000..a1c0f9a7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:761e98624641b154026f97fe4073ad67c09991aef0534e0986776589ad7c4900 +size 3286 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset.meta new file mode 100644 index 00000000..3548a951 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8e73a71cdf24db740864b4c3f3357e7f +timeCreated: 1586859731 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Animate Vertex.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Animate Vertex.asset new file mode 100644 index 00000000..6b76e465 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Animate Vertex.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:24d4c9f47b89601aec2c9d33d794a72042ea511581c3e91fa54e185429c2c296 +size 2878 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Animate Vertex.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Animate Vertex.asset.meta new file mode 100644 index 00000000..dde755d2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Animate Vertex.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 3bc81bd4568a7094daabf2ccd6a7e125 +timeCreated: 1544624630 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain + Wind Animate Vertex.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Value.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Value.asset new file mode 100644 index 00000000..b3b6c08f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Value.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d68d714c15b80246bedd59bd3ceeb4edb2c5839c822ab1e2d53593e0d91626ca +size 1837 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Value.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Value.asset.meta new file mode 100644 index 00000000..686e217f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Value.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: c7f50c5b53423ac408959a9a25532d8c +timeCreated: 1544624092 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain + Wind Value.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle Wave.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle Wave.asset new file mode 100644 index 00000000..db765fee --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle Wave.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:49f7c160eb9e0a04c56dcd31554afe86a936f7e80936ef5ee83b5dacd2ae1198 +size 2903 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle Wave.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle Wave.asset.meta new file mode 100644 index 00000000..6dee4f66 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle Wave.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 51ec3c8d117f3ec4fa3742c3e00d535b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle + Wave.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset new file mode 100644 index 00000000..ed08e664 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37eff14c2d0f62deca12e474f70f3ae03eacac36b705e47a14ce2b37a6922ffd +size 5955 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset.meta new file mode 100644 index 00000000..64f9544c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 600b4e63537aa56498ba8983340930ed +timeCreated: 1586859036 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset new file mode 100644 index 00000000..23588491 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26fd3dbfe418d6e4af6d2c814176ec28095c2ac59e71fcdacce55e9e8872ccc8 +size 9150 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset.meta new file mode 100644 index 00000000..7433c864 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 90936742ac32db8449cd21ab6dd337c8 +timeCreated: 1575562904 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite Effect Layer.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite Effect Layer.asset new file mode 100644 index 00000000..a49feb37 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite Effect Layer.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b2d8ff83fea4c9130b47a6f3d488182074360bbe6ab4cd77e35b224da7b6e2b +size 25659 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite Effect Layer.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite Effect Layer.asset.meta new file mode 100644 index 00000000..43360cc8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite Effect Layer.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 789bf62641c5cfe4ab7126850acc22b8 +timeCreated: 1516025397 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite + Effect Layer.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/URP Tangent To World Normal.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/URP Tangent To World Normal.asset new file mode 100644 index 00000000..3279e78c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/URP Tangent To World Normal.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2e88ce967b4a99846e984f1fc8f50c8956d92b033372c46aa351d5625f41a7a +size 4802 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/URP Tangent To World Normal.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/URP Tangent To World Normal.asset.meta new file mode 100644 index 00000000..a8baa479 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/URP Tangent To World Normal.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: e73075222d6e6944aa84a1f1cd458852 +timeCreated: 1629901742 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/URP + Tangent To World Normal.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset new file mode 100644 index 00000000..0573a57d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:143fe8efbfd583480d3e00cea560fba791ad4174a36f702f2e95c3951390ab69 +size 5552 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset.meta new file mode 100644 index 00000000..40a2b46d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7d75aee9e4d352a4299928ac98404afc +timeCreated: 1586858124 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/World Normal Face.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/World Normal Face.asset new file mode 100644 index 00000000..1f8c8d99 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/World Normal Face.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:134e04d974d107928f6f677b2b6d86bd0cb84beb8dd31bb20fdcdf24a4cdfd07 +size 3706 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/World Normal Face.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/World Normal Face.asset.meta new file mode 100644 index 00000000..1cba4ea7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/World Normal Face.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 8ad4248928242e14ab87cd99e6913c33 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/World + Normal Face.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig Zag.asset b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig Zag.asset new file mode 100644 index 00000000..605cc110 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig Zag.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:276109f9f7c4af02cc93c014b32abd99c65b8fa98dcf21d44476c24a7f53fe3d +size 5140 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig Zag.asset.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig Zag.asset.meta new file mode 100644 index 00000000..31a27a35 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig Zag.asset.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 8cd734fbcae021148a58931ed7d68679 +timeCreated: 1586786476 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig + Zag.asset + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary.meta new file mode 100644 index 00000000..11a87f3b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c7d59e8c9057675458e07a7d532c321b +folderAsset: yes +timeCreated: 1481126944 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt new file mode 100644 index 00000000..349e28a4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d1753e6662e95c52d6401e3eb0059ce89be2e73d1abe88b64cf5a22a12f7e86 +size 71 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt.meta new file mode 100644 index 00000000..c86ecea2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 608872e34785abb4aa0eafeb5515ec3b +timeCreated: 1481127071 +licenseType: Store +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt + uploadId: 723576 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders.meta similarity index 67% rename from Assets/External/Horizon Based Ambient Occlusion/Shaders.meta rename to Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders.meta index 29d3173e..5fce785d 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders.meta +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: a4a5705f6447808468fca071356bd185 +guid: dd999f0c55d995740a0376d84237f80c folderAsset: yes -timeCreated: 1455959813 +timeCreated: 1481126945 licenseType: Store DefaultImporter: userData: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader new file mode 100644 index 00000000..a0a93f4c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader @@ -0,0 +1,39 @@ +Shader "Hidden/ASESShaderSelectorUnlit" +{ + SubShader + { + Tags { "RenderType"="Opaque" } + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + }; + + struct v2f + { + float4 vertex : SV_POSITION; + }; + + uniform fixed4 _Color; + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + return o; + } + + fixed4 frag (v2f i) : SV_Target + { + return _Color; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader.meta new file mode 100644 index 00000000..2a164c8a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: b83de440f4e137948bdb40a67a2f6dbe +timeCreated: 1490375492 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader new file mode 100644 index 00000000..7638151f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader @@ -0,0 +1,165 @@ +Shader "Unlit/Colored Transparent" { + Properties { + _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {} + _SecondTex ("Second (RGB) Trans (A)", 2D) = "white" {} + _ThirdTex ("Third (RGB) Trans (A)", 2D) = "white" {} + _FourthTex ("Fourth (RGB) Trans (A)", 2D) = "white" {} + _Color ("Color", Color) = (1,1,1,1) + } + + SubShader { + Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"} + LOD 100 + + ZWrite Off + Blend SrcAlpha OneMinusSrcAlpha + + Pass { // SINGLE LINE + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 2.0 + #include "UnityCG.cginc" + + struct appdata_t { + float4 vertex : POSITION; + float4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f { + float4 vertex : SV_Position; + fixed4 color : COLOR; + half2 texcoord : TEXCOORD0; + float2 clipUV : TEXCOORD1; + }; + + sampler2D _MainTex; + float4 _MainTex_ST; + float4 _Color; + uniform float4x4 unity_GUIClipTextureMatrix; + sampler2D _GUIClipTexture; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.color = v.color * _Color; + o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); + float3 eyePos = UnityObjectToViewPos( v.vertex ); + o.clipUV = mul( unity_GUIClipTextureMatrix, float4( eyePos.xy, 0, 1.0 ) ); + return o; + } + + fixed4 frag( v2f i ) : SV_Target + { + float4 l1 = tex2D( _MainTex, i.texcoord); + float clipAlpha = tex2D( _GUIClipTexture, i.clipUV ).a; + l1.rgb *= i.color.rgb; + l1.a *= clipAlpha; + return l1; + } + ENDCG + } + + Pass { // MULTI LINE + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 2.0 + #include "UnityCG.cginc" + + struct appdata_t { + float4 vertex : POSITION; + float4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f { + float4 vertex : SV_Position; + fixed4 color : COLOR; + half2 texcoord : TEXCOORD0; + float2 clipUV : TEXCOORD1; + }; + + sampler2D _MainTex; + float4 _MainTex_ST; + sampler2D _SecondTex; + float4 _SecondTex_ST; + sampler2D _ThirdTex; + float4 _ThirdTex_ST; + sampler2D _FourthTex; + float4 _FourthTex_ST; + float4 _Color; + uniform float4x4 unity_GUIClipTextureMatrix; + sampler2D _GUIClipTexture; + float _InvertedZoom; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.color = v.color * _Color; + o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); + float3 eyePos = UnityObjectToViewPos( v.vertex ); + o.clipUV = mul( unity_GUIClipTextureMatrix, float4( eyePos.xy, 0, 1.0 ) ); + return o; + } + + fixed4 frag( v2f i ) : SV_Target + { + float4 l1 = tex2D( _MainTex, i.texcoord); + float clipAlpha = tex2D( _GUIClipTexture, i.clipUV ).a; + l1.rgb *= i.color.rgb; + l1.a *= clipAlpha; + + float4 l2 = tex2D( _SecondTex, i.texcoord); + float4 l3 = tex2D( _ThirdTex, i.texcoord); + float4 l4 = tex2D( _FourthTex, i.texcoord); + + float2 coords2 = i.texcoord; + coords2.y *= 2; + float4 m2 = tex2D( _MainTex, coords2 ); + m2 = pow( m2, 0.9 ); + + float2 coords3 = i.texcoord; + coords3.y *= 3; + float4 m3 = tex2D( _MainTex, coords3 ); + m3 = pow( m3, 0.8 ); + + float2 coords4 = i.texcoord; + coords4.y *= 4; + float4 m4 = tex2D( _MainTex, coords4 ); + m4 = pow( m4, 0.7 ); + + l2.rgb *= i.color.rgb; + l3.rgb *= i.color.rgb; + l4.rgb *= i.color.rgb; + + m2.rgb *= i.color.rgb; + m3.rgb *= i.color.rgb; + m4.rgb *= i.color.rgb; + + l2.a *= clipAlpha; + l3.a *= clipAlpha; + l4.a *= clipAlpha; + + m2.a *= clipAlpha; + m3.a *= clipAlpha; + m4.a *= clipAlpha; + + float zoomLerp = saturate( ( ( _InvertedZoom ) * 2 ) - 0.0 ); + + if ( i.color.a >= 1 ) + return lerp( l4, m4, zoomLerp ); + else if ( i.color.a >= 0.75 ) + return lerp( l3, m3, zoomLerp ); + else if ( i.color.a >= 0.5 ) + return lerp( l2, m2, zoomLerp ); + else + return l1; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader.meta new file mode 100644 index 00000000..1e7bee72 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: 50fc796413bac8b40aff70fb5a886273 +timeCreated: 1491397480 +licenseType: Store +ShaderImporter: + defaultTextures: + - _MainTex: {fileID: 2800000, guid: 02f71419854c0d845a930c9e0a0bf775, type: 3} + - _SecondTex: {fileID: 2800000, guid: 03a7d169469c1af41bb03241a7b7e23d, type: 3} + - _ThirdTex: {fileID: 2800000, guid: c3512c25766a40245ac94c6b1722d76e, type: 3} + - _FourthTex: {fileID: 2800000, guid: e0f922c44762291498cc62e0917609be, type: 3} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates.meta new file mode 100644 index 00000000..f5784b72 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 211faf49d0bea6c4081e4e1135d19686 +folderAsset: yes +timeCreated: 1481126944 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT.meta similarity index 77% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1.meta rename to Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT.meta index f5655e22..6fa1e173 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1.meta +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 58e53f1a24d7d1b4fa2db1ab8e051732 +guid: 8798b91ad37b8db43a0ff8a9afc5b4cd folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTInit.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTInit.shader new file mode 100644 index 00000000..a31000ff --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTInit.shader @@ -0,0 +1,62 @@ +Shader /*ase_name*/"Hidden/Templates/CustomRTInit"/*end*/ +{ + Properties + { + /*ase_props*/ + } + + SubShader + { + Tags { } + /*ase_all_modules*/ + /*ase_pass*/ + Pass + { + Name "Custom RT Init" + CGPROGRAM + #include "UnityCustomRenderTexture.cginc" + + #pragma vertex ASEInitCustomRenderTextureVertexShader + #pragma fragment frag + #pragma target 3.5 + /*ase_pragma*/ + + struct ase_appdata_init_customrendertexture + { + float4 vertex : POSITION; + float4 texcoord : TEXCOORD0; + /*ase_vdata:p=p;uv0=tc0*/ + }; + + // User facing vertex to fragment structure for initialization materials + struct ase_v2f_init_customrendertexture + { + float4 vertex : SV_POSITION; + float2 texcoord : TEXCOORD0; + float3 direction : TEXCOORD1; + /*ase_interp(2,):sp=sp.xyzw;uv0=tc0;uv1=tc1*/ + }; + + /*ase_globals*/ + + ase_v2f_init_customrendertexture ASEInitCustomRenderTextureVertexShader (ase_appdata_init_customrendertexture v /*ase_vert_input*/) + { + ase_v2f_init_customrendertexture o; + /*ase_vert_code:v=ase_appdata_init_customrendertexture;o=ase_v2f_init_customrendertexture*/ + o.vertex = UnityObjectToClipPos(v.vertex); + o.texcoord = float3(v.texcoord.xy, CustomRenderTexture3DTexcoordW); + o.direction = CustomRenderTextureComputeCubeDirection(v.texcoord.xy); + return o; + } + + float4 frag(ase_v2f_init_customrendertexture IN /*ase_frag_input*/) : COLOR + { + float4 finalColor; + /*ase_frag_code:IN=ase_v2f_init_customrendertexture*/ + finalColor = /*ase_frag_out:Frag Color;Float4*/float4(1,1,1,1)/*end*/; + return finalColor; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTInit.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTInit.shader.meta new file mode 100644 index 00000000..df3c06b4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTInit.shader.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6ce779933eb99f049b78d6163735e06f +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTInit.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTUpdate.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTUpdate.shader new file mode 100644 index 00000000..478c2a9b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTUpdate.shader @@ -0,0 +1,159 @@ +Shader /*ase_name*/"Hidden/Templates/CustomRTUpdate"/*end*/ +{ + Properties + { + /*ase_props*/ + } + + SubShader + { + Tags { } + /*ase_all_modules*/ + /*ase_pass*/ + Pass + { + Name "Custom RT Update" + CGPROGRAM + #include "UnityCustomRenderTexture.cginc" + #pragma vertex ASECustomRenderTextureVertexShader + #pragma fragment frag + #pragma target 3.5 + /*ase_pragma*/ + + struct ase_appdata_customrendertexture + { + uint vertexID : SV_VertexID; + /*ase_vdata:*/ + }; + + struct ase_v2f_customrendertexture + { + float4 vertex : SV_POSITION; + float3 localTexcoord : TEXCOORD0; // Texcoord local to the update zone (== globalTexcoord if no partial update zone is specified) + float3 globalTexcoord : TEXCOORD1; // Texcoord relative to the complete custom texture + uint primitiveID : TEXCOORD2; // Index of the update zone (correspond to the index in the updateZones of the Custom Texture) + float3 direction : TEXCOORD3; // For cube textures, direction of the pixel being rendered in the cubemap + /*ase_interp(4,):sp=sp.xyzw;uv0=tc0;uv1=tc1;uv2=tc2;uv3=tc3*/ + }; + + /*ase_globals*/ + + ase_v2f_customrendertexture ASECustomRenderTextureVertexShader(ase_appdata_customrendertexture IN /*ase_vert_input*/ ) + { + ase_v2f_customrendertexture OUT; + /*ase_vert_code:IN=ase_appdata_customrendertexture;OUT=ase_v2f_customrendertexture*/ + #if UNITY_UV_STARTS_AT_TOP + const float2 vertexPositions[6] = + { + { -1.0f, 1.0f }, + { -1.0f, -1.0f }, + { 1.0f, -1.0f }, + { 1.0f, 1.0f }, + { -1.0f, 1.0f }, + { 1.0f, -1.0f } + }; + + const float2 texCoords[6] = + { + { 0.0f, 0.0f }, + { 0.0f, 1.0f }, + { 1.0f, 1.0f }, + { 1.0f, 0.0f }, + { 0.0f, 0.0f }, + { 1.0f, 1.0f } + }; + #else + const float2 vertexPositions[6] = + { + { 1.0f, 1.0f }, + { -1.0f, -1.0f }, + { -1.0f, 1.0f }, + { -1.0f, -1.0f }, + { 1.0f, 1.0f }, + { 1.0f, -1.0f } + }; + + const float2 texCoords[6] = + { + { 1.0f, 1.0f }, + { 0.0f, 0.0f }, + { 0.0f, 1.0f }, + { 0.0f, 0.0f }, + { 1.0f, 1.0f }, + { 1.0f, 0.0f } + }; + #endif + + uint primitiveID = IN.vertexID / 6; + uint vertexID = IN.vertexID % 6; + float3 updateZoneCenter = CustomRenderTextureCenters[primitiveID].xyz; + float3 updateZoneSize = CustomRenderTextureSizesAndRotations[primitiveID].xyz; + float rotation = CustomRenderTextureSizesAndRotations[primitiveID].w * UNITY_PI / 180.0f; + + #if !UNITY_UV_STARTS_AT_TOP + rotation = -rotation; + #endif + + // Normalize rect if needed + if (CustomRenderTextureUpdateSpace > 0.0) // Pixel space + { + // Normalize xy because we need it in clip space. + updateZoneCenter.xy /= _CustomRenderTextureInfo.xy; + updateZoneSize.xy /= _CustomRenderTextureInfo.xy; + } + else // normalized space + { + // Un-normalize depth because we need actual slice index for culling + updateZoneCenter.z *= _CustomRenderTextureInfo.z; + updateZoneSize.z *= _CustomRenderTextureInfo.z; + } + + // Compute rotation + + // Compute quad vertex position + float2 clipSpaceCenter = updateZoneCenter.xy * 2.0 - 1.0; + float2 pos = vertexPositions[vertexID] * updateZoneSize.xy; + pos = CustomRenderTextureRotate2D(pos, rotation); + pos.x += clipSpaceCenter.x; + #if UNITY_UV_STARTS_AT_TOP + pos.y += clipSpaceCenter.y; + #else + pos.y -= clipSpaceCenter.y; + #endif + + // For 3D texture, cull quads outside of the update zone + // This is neeeded in additional to the preliminary minSlice/maxSlice done on the CPU because update zones can be disjointed. + // ie: slices [1..5] and [10..15] for two differents zones so we need to cull out slices 0 and [6..9] + if (CustomRenderTextureIs3D > 0.0) + { + int minSlice = (int)(updateZoneCenter.z - updateZoneSize.z * 0.5); + int maxSlice = minSlice + (int)updateZoneSize.z; + if (_CustomRenderTexture3DSlice < minSlice || _CustomRenderTexture3DSlice >= maxSlice) + { + pos.xy = float2(1000.0, 1000.0); // Vertex outside of ncs + } + } + + OUT.vertex = float4(pos, 0.0, 1.0); + OUT.primitiveID = asuint(CustomRenderTexturePrimitiveIDs[primitiveID]); + OUT.localTexcoord = float3(texCoords[vertexID], CustomRenderTexture3DTexcoordW); + OUT.globalTexcoord = float3(pos.xy * 0.5 + 0.5, CustomRenderTexture3DTexcoordW); + #if UNITY_UV_STARTS_AT_TOP + OUT.globalTexcoord.y = 1.0 - OUT.globalTexcoord.y; + #endif + OUT.direction = CustomRenderTextureComputeCubeDirection(OUT.globalTexcoord.xy); + + return OUT; + } + + float4 frag(ase_v2f_customrendertexture IN /*ase_frag_input*/) : COLOR + { + float4 finalColor; + /*ase_frag_code:IN=ase_v2f_customrendertexture*/ + finalColor = /*ase_frag_out:Frag Color;Float4*/float4(1,1,1,1)/*end*/; + return finalColor; + } + ENDCG + } + } +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTUpdate.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTUpdate.shader.meta new file mode 100644 index 00000000..6ee6d8dc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTUpdate.shader.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 32120270d1b3a8746af2aca8bc749736 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRT/CustomRTUpdate.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 10x.unitypackage b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 10x.unitypackage new file mode 100644 index 00000000..908fbf04 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 10x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2eff3c4d15939753f9d0d498db9a311e9a29b1a15fdfbefa5e0c4913764fad1 +size 81674 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 10x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 10x.unitypackage.meta new file mode 100644 index 00000000..05d8b33c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 10x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 2243c8b4e1ab6914995699133f67ab5a +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 10x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 12x.unitypackage b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 12x.unitypackage new file mode 100644 index 00000000..78cfc26a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 12x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d8ab1a0c8ee3f7f0ea8bde7aa8fe9181ebaa9d9fb450fce61bc0edf59ead6bb0 +size 102704 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 12x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 12x.unitypackage.meta new file mode 100644 index 00000000..a94bff61 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 12x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 9a5e61a8b3421b944863d0946e32da0a +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 12x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 14x.unitypackage b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 14x.unitypackage new file mode 100644 index 00000000..b2d5dc90 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 14x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42ea94e9d286b34d33e91dd2da641e3e2847f1bae4426f3d8da24b48c6b3d0a6 +size 102340 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 14x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 14x.unitypackage.meta new file mode 100644 index 00000000..1a74bff5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 14x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 89f0b84148d149d4d96b838d7ef60e92 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 14x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 15x.unitypackage b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 15x.unitypackage new file mode 100644 index 00000000..c22ed554 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 15x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb8f82ba93f1314392326a8b80b0aee134ea9f81bbec7bcb8a578ca232a60277 +size 103435 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 15x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 15x.unitypackage.meta new file mode 100644 index 00000000..19562cdc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 15x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 19939ee2cdb76e0489b1b8cd4bed7f3d +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 15x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 16x.unitypackage b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 16x.unitypackage new file mode 100644 index 00000000..7150b2b8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 16x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e2808260f8e477db85c96de4f26ab2ce2add3d147d33d4f9311e11f21e18b43 +size 103342 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 16x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 16x.unitypackage.meta new file mode 100644 index 00000000..71278615 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 16x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 70777e8ce9f3c8d4a8182ca2f965cdb2 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 16x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 17x.unitypackage b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 17x.unitypackage new file mode 100644 index 00000000..dcc11429 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 17x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ef01dc8732c68fb7e0d265388b0734eefaef322b9f6d85ed5d2de8dea84dd20 +size 104507 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 17x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 17x.unitypackage.meta new file mode 100644 index 00000000..28a77f41 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 17x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: daf511a6dae20e641a9d69d025f023e4 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDRP 17x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy.meta new file mode 100644 index 00000000..55a974ea --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6e848a1cd56b4c4489af03626db2de58 +folderAsset: yes +timeCreated: 1527085590 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Lit.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Lit.shader new file mode 100644 index 00000000..4e0dc523 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Lit.shader @@ -0,0 +1,2302 @@ +Shader /*ase_name*/ "Hidden/Legacy/Lit" /*end*/ +{ + Properties + { + /*ase_props*/ + //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 + //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1 + //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5 + //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2 + //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9 + //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1 + //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5 + //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 + //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 + //_TessMin( "Tess Min Distance", Float ) = 10 + //_TessMax( "Tess Max Distance", Float ) = 25 + //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 + //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 + //_SpecularHighlights("Specular Highlights", Float) = 1.0 + //_GlossyReflections("Reflections", Float) = 1.0 + } + + SubShader + { + /*ase_subshader_options:Name=Additional Options + Option:Workflow,InvertActionOnDeselection:Specular,Metallic:Metallic + Metallic:ShowPort:Metallic + Specular:ShowPort:Specular + Specular:SetDefine:_SPECULAR_SETUP 1 + Option:Surface:Opaque,Transparent:Opaque + Opaque:SetPropertyOnSubShader:RenderType,Opaque + Opaque:SetPropertyOnSubShader:RenderQueue,Geometry + Opaque:SetPropertyOnSubShader:ZWrite,On + Opaque:HideOption: Blend + Opaque:HideOption: Dither Shadows + Opaque:HideOption: Refraction Model + Transparent:SetPropertyOnSubShader:RenderType,Transparent + Transparent:SetPropertyOnSubShader:RenderQueue,Transparent + Transparent:SetPropertyOnSubShader:ZWrite,Off + Transparent:ShowOption: Blend + Transparent:ShowOption: Dither Shadows + Transparent:ShowOption: Refraction Model + Option: Blend:Alpha,Premultiply,Additive,Multiply,Translucent,Custom:Alpha + Alpha:SetPropertyOnPass:ForwardBase:BlendRGB,SrcAlpha,OneMinusSrcAlpha + Alpha:SetPropertyOnPass:ForwardAdd:BlendRGB,SrcAlpha,One + Alpha:SetDefine:_ALPHABLEND_ON 1 + Premultiply:SetPropertyOnPass:ForwardBase:BlendRGB,One,OneMinusSrcAlpha + disable,Premultiply,Additive,Multiply,Translucent,Custom:SetPropertyOnPass:ForwardAdd:BlendRGB,One,One + Premultiply:SetDefine:_ALPHAPREMULTIPLY_ON 1 + Additive:SetPropertyOnPass:ForwardBase:BlendRGB,One,One + Multiply:SetPropertyOnPass:ForwardBase:BlendRGB,DstColor,Zero + disable,Premultiply,Additive,Multiply,Translucent,Custom:RemoveDefine:_ALPHABLEND_ON 1 + disable,Alpha,Additive,Multiply,Translucent,Custom:RemoveDefine:_ALPHAPREMULTIPLY_ON 1 + disable,Translucent:SetPropertyOnPass:ForwardBase:BlendRGB,One,Zero + Option: Refraction Model:None:None + None,disable:HidePort:ForwardBase:Refraction Index + None,disable:HidePort:ForwardBase:Refraction Color + None,disable:RemoveDefine:ASE_REFRACTION 1 + None,disable:RemoveDefine:ASE_NEEDS_FRAG_SCREEN_POSITION + Legacy:ShowPort:ForwardBase:Refraction Index + Legacy:ShowPort:ForwardBase:Refraction Color + Legacy:SetDefine:ASE_REFRACTION 1 + Legacy:SetDefine:ASE_NEEDS_FRAG_SCREEN_POSITION + Option: Dither Shadows:false,true:true + true:SetDefine:UNITY_STANDARD_USE_DITHER_MASK 1 + false,disable:RemoveDefine:UNITY_STANDARD_USE_DITHER_MASK 1 + Option:Two Sided:On,Cull Back,Cull Front:Cull Back + On:SetPropertyOnSubShader:CullMode,Off + Cull Back:SetPropertyOnSubShader:CullMode,Back + Cull Front:SetPropertyOnSubShader:CullMode,Front + Option:Deferred Pass:false,true:true + true:IncludePass:Deferred + false:ExcludePass:Deferred + Option:Transmission:false,true:false + false:RemoveDefine:ASE_TRANSMISSION 1 + false:HidePort:ForwardBase:Transmission + false:HideOption: Transmission Shadow + true:SetDefine:ASE_TRANSMISSION 1 + true:ShowPort:ForwardBase:Transmission + true:ShowOption: Transmission Shadow + true:SetOption:Deferred Pass,0 + Field: Transmission Shadow:Float:0.5:0:1:_TransmissionShadow + Change:SetMaterialProperty:_TransmissionShadow + Change:SetShaderProperty:_TransmissionShadow,_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 + Inline,disable:SetShaderProperty:_TransmissionShadow,//_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 + Option:Translucency:false,true:false + false:RemoveDefine:ASE_TRANSLUCENCY 1 + false:HidePort:ForwardBase:Translucency + false:HideOption: Translucency Strength + false:HideOption: Normal Distortion + false:HideOption: Scattering + false:HideOption: Direct + false:HideOption: Ambient + false:HideOption: Shadow + true:SetDefine:ASE_TRANSLUCENCY 1 + true:ShowPort:ForwardBase:Translucency + true:ShowOption: Translucency Strength + true:ShowOption: Normal Distortion + true:ShowOption: Scattering + true:ShowOption: Direct + true:ShowOption: Ambient + true:ShowOption: Shadow + true:SetOption:Deferred Pass,0 + Field: Translucency Strength:Float:1:0:50:_TransStrength + Change:SetMaterialProperty:_TransStrength + Change:SetShaderProperty:_TransStrength,_TransStrength( "Strength", Range( 0, 50 ) ) = 1 + Inline,disable:SetShaderProperty:_TransStrength,//_TransStrength( "Strength", Range( 0, 50 ) ) = 1 + Field: Normal Distortion:Float:0.5:0:1:_TransNormal + Change:SetMaterialProperty:_TransNormal + Change:SetShaderProperty:_TransNormal,_TransNormal( "Normal Distortion", Range( 0, 1 ) ) = 0.5 + Inline,disable:SetShaderProperty:_TransNormal,//_TransNormal( "Normal Distortion", Range( 0, 1 ) ) = 0.5 + Field: Scattering:Float:2:1:50:_TransScattering + Change:SetMaterialProperty:_TransScattering + Change:SetShaderProperty:_TransScattering,_TransScattering( "Scattering", Range( 1, 50 ) ) = 2 + Inline,disable:SetShaderProperty:_TransScattering,//_TransScattering( "Scattering", Range( 1, 50 ) ) = 2 + Field: Direct:Float:0.9:0:1:_TransDirect + Change:SetMaterialProperty:_TransDirect + Change:SetShaderProperty:_TransDirect,_TransDirect( "Direct", Range( 0, 1 ) ) = 0.9 + Inline,disable:SetShaderProperty:_TransDirect,//_TransDirect( "Direct", Range( 0, 1 ) ) = 0.9 + Field: Ambient:Float:0.1:0:1:_TransAmbient + Change:SetMaterialProperty:_TransAmbient + Change:SetShaderProperty:_TransAmbient,_TransAmbient( "Ambient", Range( 0, 1 ) ) = 0.1 + Inline,disable:SetShaderProperty:_TransAmbient,//_TransAmbient( "Ambient", Range( 0, 1 ) ) = 0.1 + Field: Shadow:Float:0.5:0:1:_TransShadow + Change:SetMaterialProperty:_TransShadow + Change:SetShaderProperty:_TransShadow,_TransShadow( "Shadow", Range( 0, 1 ) ) = 0.5 + Inline,disable:SetShaderProperty:_TransShadow,//_TransShadow( "Shadow", Range( 0, 1 ) ) = 0.5 + Option:Cast Shadows:false,true:true + true:IncludePass:ShadowCaster + false,disable:ExcludePass:ShadowCaster + true:ShowOption: Use Shadow Threshold + false:HideOption: Use Shadow Threshold + Option: Use Shadow Threshold:false,true:false + true:ShowPort:ForwardBase:Alpha Clip Threshold Shadow + false,disable:HidePort:ForwardBase:Alpha Clip Threshold Shadow + Option:Receive Shadows:false,true:true + true:SetDefine:ASE_NEEDS_FRAG_SHADOWCOORDS + false:RemoveDefine:ASE_NEEDS_FRAG_SHADOWCOORDS + Option:GPU Instancing:false,true:true + true:SetDefine:pragma multi_compile_instancing + false:RemoveDefine:pragma multi_compile_instancing + Option:LOD CrossFade:false,true:true + true:SetDefine:pragma multi_compile __ LOD_FADE_CROSSFADE + false:RemoveDefine:pragma multi_compile __ LOD_FADE_CROSSFADE + Option:Built-in Fog:false,true:true + true:SetDefine:pragma multi_compile_fog + false:RemoveDefine:pragma multi_compile_fog + true:SetDefine:ASE_FOG 1 + false:RemoveDefine:ASE_FOG 1 + Option:Ambient Light:false,true:true + true:RemoveDefine:ASE_NO_AMBIENT 1 + false:SetDefine:ASE_NO_AMBIENT 1 + Option:Meta Pass:false,true:true + true:IncludePass:Meta + false,disable:ExcludePass:Meta + Option:Add Pass:false,true:true + true:IncludePass:ForwardAdd + false,disable:ExcludePass:ForwardAdd + Option:Override Baked GI:false,true:false + true:ShowPort:ForwardBase:Baked GI + false:HidePort:ForwardBase:Baked GI + true:SetDefine:ASE_BAKEDGI 1 + false:RemoveDefine:ASE_BAKEDGI 1 + Option:Extra Pre Pass:false,true:false + true:IncludePass:ExtraPrePass + false,disable:ExcludePass:ExtraPrePass + Option:Tessellation:false,true:false + true:SetDefine:ASE_TESSELLATION 1 + true:SetDefine:pragma require tessellation tessHW + true:SetDefine:pragma hull HullFunction + true:SetDefine:pragma domain DomainFunction + true:ShowOption: Phong + true:ShowOption: Type + false,disable:RemoveDefine:ASE_TESSELLATION 1 + false,disable:RemoveDefine:pragma require tessellation tessHW + false,disable:RemoveDefine:pragma hull HullFunction + false,disable:RemoveDefine:pragma domain DomainFunction + false,disable:HideOption: Phong + false,disable:HideOption: Type + Option: Phong:false,true:false + true:SetDefine:ASE_PHONG_TESSELLATION + false,disable:RemoveDefine:ASE_PHONG_TESSELLATION + true:ShowOption: Strength + false,disable:HideOption: Strength + Field: Strength:Float:0.5:0:1:_TessPhongStrength + Change:SetMaterialProperty:_TessPhongStrength + Change:SetShaderProperty:_TessPhongStrength,_TessPhongStrength( "Phong Tess Strength", Range( 0, 1 ) ) = 0.5 + Inline,disable:SetShaderProperty:_TessPhongStrength,//_TessPhongStrength( "Phong Tess Strength", Range( 0, 1 ) ) = 0.5 + Option: Type:Fixed,Distance Based,Edge Length,Edge Length Cull:Fixed + Fixed:SetDefine:ASE_FIXED_TESSELLATION + Fixed,Distance Based:ShowOption: Tess + Distance Based:SetDefine:ASE_DISTANCE_TESSELLATION + Distance Based:ShowOption: Min + Distance Based:ShowOption: Max + Edge Length:SetDefine:ASE_LENGTH_TESSELLATION + Edge Length,Edge Length Cull:ShowOption: Edge Length + Edge Length Cull:SetDefine:ASE_LENGTH_CULL_TESSELLATION + Edge Length Cull:ShowOption: Max Displacement + disable,Distance Based,Edge Length,Edge Length Cull:RemoveDefine:ASE_FIXED_TESSELLATION + disable,Fixed,Edge Length,Edge Length Cull:RemoveDefine:ASE_DISTANCE_TESSELLATION + disable,Fixed,Distance Based,Edge Length Cull:RemoveDefine:ASE_LENGTH_TESSELLATION + disable,Fixed,Distance Based,Edge Length:RemoveDefine:ASE_LENGTH_CULL_TESSELLATION + disable,Edge Length,Edge Length Cull:HideOption: Tess + disable,Fixed,Edge Length,Edge Length Cull:HideOption: Min + disable,Fixed,Edge Length,Edge Length Cull:HideOption: Max + disable,Fixed,Distance Based:HideOption: Edge Length + disable,Fixed,Distance Based,Edge Length:HideOption: Max Displacement + Field: Tess:Float:16:1:32:_TessValue + Change:SetMaterialProperty:_TessValue + Change:SetShaderProperty:_TessValue,_TessValue( "Max Tessellation", Range( 1, 32 ) ) = 16 + Inline,disable:SetShaderProperty:_TessValue,//_TessValue( "Max Tessellation", Range( 1, 32 ) ) = 16 + Field: Min:Float:10:_TessMin + Change:SetMaterialProperty:_TessMin + Change:SetShaderProperty:_TessMin,_TessMin( "Tess Min Distance", Float ) = 10 + Inline,disable:SetShaderProperty:_TessMin,//_TessMin( "Tess Min Distance", Float ) = 10 + Field: Max:Float:25:_TessMax + Change:SetMaterialProperty:_TessMax + Change:SetShaderProperty:_TessMax,_TessMax( "Tess Max Distance", Float ) = 25 + Inline,disable:SetShaderProperty:_TessMax,//_TessMax( "Tess Max Distance", Float ) = 25 + Field: Edge Length:Float:16:2:50:_TessEdgeLength + Change:SetMaterialProperty:_TessEdgeLength + Change:SetShaderProperty:_TessEdgeLength,_TessEdgeLength ( "Edge length", Range( 2, 50 ) ) = 16 + Inline,disable:SetShaderProperty:_TessEdgeLength,//_TessEdgeLength ( "Edge length", Range( 2, 50 ) ) = 16 + Field: Max Displacement:Float:25:_TessMaxDisp + Change:SetMaterialProperty:_TessMaxDisp + Change:SetShaderProperty:_TessMaxDisp,_TessMaxDisp( "Max Displacement", Float ) = 25 + Inline,disable:SetShaderProperty:_TessMaxDisp,//_TessMaxDisp( "Max Displacement", Float ) = 25 + Option:Fwd Specular Highlights Toggle:false,true:false + true:SetShaderProperty:_SpecularHighlights,[ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0 + false:SetShaderProperty:_SpecularHighlights,//[ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0 + true:SetDefine:pragma shader_feature _SPECULARHIGHLIGHTS_OFF + false:RemoveDefine:pragma shader_feature _SPECULARHIGHLIGHTS_OFF + Option:Fwd Reflections Toggle:false,true:false + true:SetShaderProperty:_GlossyReflections,[ToggleOff] _GlossyReflections("Reflections", Float) = 1.0 + false:SetShaderProperty:_GlossyReflections,//[ToggleOff] _GlossyReflections("Reflections", Float) = 1.0 + true:SetDefine:pragma shader_feature _GLOSSYREFLECTIONS_OFF + false:RemoveDefine:pragma shader_feature _GLOSSYREFLECTIONS_OFF + Option:Disable Batching:False,True,LOD Fading:False + False:SetPropertyOnSubShader:DisableBatching,False + True:SetPropertyOnSubShader:DisableBatching,True + LOD Fading:SetPropertyOnSubShader:DisableBatching,LODFading + Option:Vertex Position,InvertActionOnDeselection:Absolute,Relative:Relative + Absolute:SetDefine:ASE_ABSOLUTE_VERTEX_POS 1 + Absolute:SetPortName:ForwardBase:15,Vertex Position + Relative:SetPortName:ForwardBase:15,Vertex Offset + Absolute:SetPortName:ExtraPrePass:3,Vertex Position + Relative:SetPortName:ExtraPrePass:3,Vertex Offset + Port:ForwardBase:Alpha Clip Threshold + On:SetDefine:_ALPHATEST_ON 1 + Port:ForwardBase:Alpha Clip Threshold Shadow + On:SetDefine:_ALPHATEST_SHADOW_ON 1 + */ + Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+0" "DisableBatching" = "False" } + LOD 0 + + Cull Back + AlphaToMask Off + ZWrite On + ZTest LEqual + ColorMask RGBA + /*ase_stencil*/ + /*ase_all_modules*/ + + CGINCLUDE + #pragma target 3.5 + + float4 FixedTess( float tessValue ) + { + return tessValue; + } + + float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) + { + float3 wpos = mul(o2w,vertex).xyz; + float dist = distance (wpos, cameraPos); + float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; + return f; + } + + float4 CalcTriEdgeTessFactors (float3 triVertexFactors) + { + float4 tess; + tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); + tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); + tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); + tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; + return tess; + } + + float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) + { + float dist = distance (0.5 * (wpos0+wpos1), cameraPos); + float len = distance(wpos0, wpos1); + float f = max(len * scParams.y / (edgeLen * dist), 1.0); + return f; + } + + float DistanceFromPlane (float3 pos, float4 plane) + { + float d = dot (float4(pos,1.0f), plane); + return d; + } + + bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) + { + float4 planeTest; + planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); + return !all (planeTest); + } + + float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) + { + float3 f; + f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); + f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); + f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); + + return CalcTriEdgeTessFactors (f); + } + + float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + return tess; + } + + float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + + if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) + { + tess = 0.0f; + } + else + { + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + ENDCG + + /*ase_pass*/ + Pass + { + Name "ExtraPrePass" + Tags { "LightMode" = "ForwardBase" } + + Blend One Zero + Cull Back + ZWrite On + ZTest LEqual + Offset 0,0 + ColorMask RGBA + /*ase_stencil*/ + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_fwdbase + #ifndef UNITY_PASS_FORWARDBASE + #define UNITY_PASS_FORWARDBASE + #endif + #include "HLSLSupport.cginc" + #ifndef UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_LOD_FADE + #endif + #ifndef UNITY_INSTANCED_SH + #define UNITY_INSTANCED_SH + #endif + #ifndef UNITY_INSTANCED_LIGHTMAPSTS + #define UNITY_INSTANCED_LIGHTMAPSTS + #endif + #include "UnityShaderVariables.cginc" + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + + /*ase_pragma*/ + struct appdata { + float4 vertex : POSITION; + float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vdata:p=p;t=t;n=n;uv1=tc1.xyzw;uv2=tc2.xyzw*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f { + #if UNITY_VERSION >= 201810 + UNITY_POSITION(pos); + #else + float4 pos : SV_POSITION; + #endif + #if defined(UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS) && UNITY_VERSION >= 201810 && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + UNITY_LIGHTING_COORDS(2,3) + #elif defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if UNITY_VERSION >= 201710 + UNITY_SHADOW_COORDS(2) + #else + SHADOW_COORDS(2) + #endif + #endif + #ifdef ASE_FOG + UNITY_FOG_COORDS(4) + #endif + float4 tSpace0 : TEXCOORD5; + float4 tSpace1 : TEXCOORD6; + float4 tSpace2 : TEXCOORD7; + /*ase_interp(8,):sp=sp.xyzw;sc=tc2;wn.xyz=tc5.xyz;wt.xyz=tc6.xyz;wbt.xyz=tc7.xyz;wp.x=tc5.w;wp.y=tc6.w;wp.z=tc7.w*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + /*ase_globals*/ + + /*ase_funcs*/ + + v2f VertexFunction (appdata v /*ase_vert_input*/ ) { + UNITY_SETUP_INSTANCE_ID(v); + v2f o; + UNITY_INITIALIZE_OUTPUT(v2f,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + /*ase_vert_code:v=appdata;o=v2f*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;3;-1;_VertexP*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.vertex.w = 1; + v.normal = /*ase_vert_out:Vertex Normal;Float3;4;-1;_VertexNormalP*/v.normal/*end*/; + v.tangent = /*ase_vert_out:Vertex Tangent;Float4;5;-1;_VertexTangentP*/v.tangent/*end*/; + + o.pos = UnityObjectToClipPos(v.vertex); + float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz; + fixed3 worldNormal = UnityObjectToWorldNormal(v.normal); + fixed3 worldTangent = UnityObjectToWorldDir(v.tangent.xyz); + fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w; + fixed3 worldBinormal = cross(worldNormal, worldTangent) * tangentSign; + o.tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); + o.tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); + o.tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); + + #if UNITY_VERSION >= 201810 && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + UNITY_TRANSFER_LIGHTING(o, v.texcoord1.xy); + #elif defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if UNITY_VERSION >= 201710 + UNITY_TRANSFER_SHADOW(o, v.texcoord1.xy); + #else + TRANSFER_SHADOW(o); + #endif + #endif + + #ifdef ASE_FOG + UNITY_TRANSFER_FOG(o,o.pos); + #endif + return o; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( appdata v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.tangent = v.tangent; + o.normal = v.normal; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + /*ase_control_code:v=appdata;o=VertexControl*/ + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, UNITY_MATRIX_M, _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, UNITY_MATRIX_M, _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, UNITY_MATRIX_M, _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + v2f DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + appdata o = (appdata) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.tangent = patch[0].tangent * bary.x + patch[1].tangent * bary.y + patch[2].tangent * bary.z; + o.normal = patch[0].normal * bary.x + patch[1].normal * bary.y + patch[2].normal * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + /*ase_domain_code:patch=VertexControl;o=appdata;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].normal * (dot(o.vertex.xyz, patch[i].normal) - dot(patch[i].vertex.xyz, patch[i].normal)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + v2f vert ( appdata v ) + { + return VertexFunction( v ); + } + #endif + + fixed4 frag (v2f IN /*ase_frag_input*/ + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #ifdef LOD_FADE_CROSSFADE + UNITY_APPLY_DITHER_CROSSFADE(IN.pos.xy); + #endif + + #if defined(_SPECULAR_SETUP) + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #endif + /*ase_local_var:wt*/float3 WorldTangent = float3(IN.tSpace0.x,IN.tSpace1.x,IN.tSpace2.x); + /*ase_local_var:wbt*/float3 WorldBiTangent = float3(IN.tSpace0.y,IN.tSpace1.y,IN.tSpace2.y); + /*ase_local_var:wn*/float3 WorldNormal = float3(IN.tSpace0.z,IN.tSpace1.z,IN.tSpace2.z); + /*ase_local_var:wp*/float3 worldPos = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + /*ase_local_var:wvd*/float3 worldViewDir = normalize(UnityWorldSpaceViewDir(worldPos)); + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + UNITY_LIGHT_ATTENUATION(atten, IN, worldPos) + #else + /*ase_local_var:sc*/half atten = 1; + #endif + + /*ase_frag_code:IN=v2f*/ + float3 Color = /*ase_frag_out:Color;Float3;0;-1;_ColorP*/fixed3( 0, 0, 0 )/*end*/; + float Alpha = /*ase_frag_out:Alpha;Float;1;-1;_AlphaP*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;2;-1;_AlphaClipP*/0.5/*end*/; + + float4 c = float4( Color, Alpha ); + + #ifdef _ALPHATEST_ON + clip( Alpha - AlphaClipThreshold ); + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = IN.pos.z; + #endif + + #ifdef ASE_FOG + UNITY_APPLY_FOG(IN.fogCoord, c); + #endif + return c; + } + ENDCG + } + + /*ase_pass*/ + Pass + { + /*ase_main_pass*/ + Name "ForwardBase" + Tags { "LightMode" = "ForwardBase" } + + Blend One Zero + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_fwdbase + #ifndef UNITY_PASS_FORWARDBASE + #define UNITY_PASS_FORWARDBASE + #endif + #include "HLSLSupport.cginc" + #ifndef UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_LOD_FADE + #endif + #ifndef UNITY_INSTANCED_SH + #define UNITY_INSTANCED_SH + #endif + #ifndef UNITY_INSTANCED_LIGHTMAPSTS + #define UNITY_INSTANCED_LIGHTMAPSTS + #endif + #include "UnityShaderVariables.cginc" + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + + /*ase_pragma*/ + struct appdata { + float4 vertex : POSITION; + float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vdata:p=p;t=t;n=n;uv1=tc1.xyzw;uv2=tc2.xyzw*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f { + #if UNITY_VERSION >= 201810 + UNITY_POSITION(pos); + #else + float4 pos : SV_POSITION; + #endif + #if defined(LIGHTMAP_ON) || (!defined(LIGHTMAP_ON) && SHADER_TARGET >= 30) + float4 lmap : TEXCOORD0; + #endif + #if !defined(LIGHTMAP_ON) && UNITY_SHOULD_SAMPLE_SH + half3 sh : TEXCOORD1; + #endif + #if defined(UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS) && UNITY_VERSION >= 201810 && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + UNITY_LIGHTING_COORDS(2,3) + #elif defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if UNITY_VERSION >= 201710 + UNITY_SHADOW_COORDS(2) + #else + SHADOW_COORDS(2) + #endif + #endif + #ifdef ASE_FOG + UNITY_FOG_COORDS(4) + #endif + float4 tSpace0 : TEXCOORD5; + float4 tSpace1 : TEXCOORD6; + float4 tSpace2 : TEXCOORD7; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD8; + #endif + /*ase_interp(9,):sp=sp.xyzw;sc=tc2;wn.xyz=tc5.xyz;wt.xyz=tc6.xyz;wbt.xyz=tc7.xyz;wp.x=tc5.w;wp.y=tc6.w;wp.z=tc7.w;spu=tc8*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + /*ase_globals*/ + + /*ase_funcs*/ + + v2f VertexFunction (appdata v /*ase_vert_input*/ ) { + UNITY_SETUP_INSTANCE_ID(v); + v2f o; + UNITY_INITIALIZE_OUTPUT(v2f,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + /*ase_vert_code:v=appdata;o=v2f*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;15;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.vertex.w = 1; + v.normal = /*ase_vert_out:Vertex Normal;Float3;16;-1;_VertexNormal*/v.normal/*end*/; + v.tangent = /*ase_vert_out:Vertex Tangent;Float4;17;-1;_VertexTangent*/v.tangent/*end*/; + + o.pos = UnityObjectToClipPos(v.vertex); + float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz; + fixed3 worldNormal = UnityObjectToWorldNormal(v.normal); + fixed3 worldTangent = UnityObjectToWorldDir(v.tangent.xyz); + fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w; + fixed3 worldBinormal = cross(worldNormal, worldTangent) * tangentSign; + o.tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); + o.tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); + o.tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); + + #ifdef DYNAMICLIGHTMAP_ON + o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #ifdef LIGHTMAP_ON + o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + #ifndef LIGHTMAP_ON + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + o.sh = 0; + #ifdef VERTEXLIGHT_ON + o.sh += Shade4PointLights ( + unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0, + unity_LightColor[0].rgb, unity_LightColor[1].rgb, unity_LightColor[2].rgb, unity_LightColor[3].rgb, + unity_4LightAtten0, worldPos, worldNormal); + #endif + o.sh = ShadeSHPerVertex (worldNormal, o.sh); + #endif + #endif + + #if UNITY_VERSION >= 201810 && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + UNITY_TRANSFER_LIGHTING(o, v.texcoord1.xy); + #elif defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if UNITY_VERSION >= 201710 + UNITY_TRANSFER_SHADOW(o, v.texcoord1.xy); + #else + TRANSFER_SHADOW(o); + #endif + #endif + + #ifdef ASE_FOG + UNITY_TRANSFER_FOG(o,o.pos); + #endif + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(o.pos); + #endif + return o; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( appdata v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.tangent = v.tangent; + o.normal = v.normal; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + /*ase_control_code:v=appdata;o=VertexControl*/ + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, UNITY_MATRIX_M, _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, UNITY_MATRIX_M, _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, UNITY_MATRIX_M, _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + v2f DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + appdata o = (appdata) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.tangent = patch[0].tangent * bary.x + patch[1].tangent * bary.y + patch[2].tangent * bary.z; + o.normal = patch[0].normal * bary.x + patch[1].normal * bary.y + patch[2].normal * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + /*ase_domain_code:patch=VertexControl;o=appdata;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].normal * (dot(o.vertex.xyz, patch[i].normal) - dot(patch[i].vertex.xyz, patch[i].normal)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + v2f vert ( appdata v ) + { + return VertexFunction( v ); + } + #endif + + fixed4 frag (v2f IN /*ase_frag_input*/ + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #ifdef LOD_FADE_CROSSFADE + UNITY_APPLY_DITHER_CROSSFADE(IN.pos.xy); + #endif + + #if defined(_SPECULAR_SETUP) + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #endif + /*ase_local_var:wt*/float3 WorldTangent = float3(IN.tSpace0.x,IN.tSpace1.x,IN.tSpace2.x); + /*ase_local_var:wbt*/float3 WorldBiTangent = float3(IN.tSpace0.y,IN.tSpace1.y,IN.tSpace2.y); + /*ase_local_var:wn*/float3 WorldNormal = float3(IN.tSpace0.z,IN.tSpace1.z,IN.tSpace2.z); + /*ase_local_var:wp*/float3 worldPos = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + /*ase_local_var:wvd*/float3 worldViewDir = normalize(UnityWorldSpaceViewDir(worldPos)); + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + UNITY_LIGHT_ATTENUATION(atten, IN, worldPos) + #else + /*ase_local_var:sc*/half atten = 1; + #endif + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + /*ase_local_var:spu*/float4 ScreenPos = IN.screenPos; + #endif + + /*ase_frag_code:IN=v2f*/ + o.Albedo = /*ase_frag_out:Albedo;Float3;0;-1;_Albedo*/fixed3( 0.5, 0.5, 0.5 )/*end*/; + o.Normal = /*ase_frag_out:Normal;Float3;1;-1;_Normal*/fixed3( 0, 0, 1 )/*end*/; + o.Emission = /*ase_frag_out:Emission;Float3;2;-1;_Emission*/half3( 0, 0, 0 )/*end*/; + #if defined(_SPECULAR_SETUP) + o.Specular = /*ase_frag_out:Specular;Float3;3;-1;_Specular*/fixed3( 0, 0, 0 )/*end*/; + #else + o.Metallic = /*ase_frag_out:Metallic;Float;4;-1;_Metallic*/0/*end*/; + #endif + o.Smoothness = /*ase_frag_out:Smoothness;Float;5;-1;_Smoothness*/0/*end*/; + o.Occlusion = /*ase_frag_out:Occlusion;Float;6;-1;_Occlusion*/1/*end*/; + o.Alpha = /*ase_frag_out:Alpha;Float;7;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;8;-1;_AlphaClip*/0.5/*end*/; + float AlphaClipThresholdShadow = /*ase_frag_out:Alpha Clip Threshold Shadow;Float;9;-1;_AlphaClipShadow*/0.5/*end*/; + float3 BakedGI = /*ase_frag_out:Baked GI;Float3;10;-1;_BakedGI*/0/*end*/; + float3 RefractionColor = /*ase_frag_out:Refraction Color;Float3;11;-1;_RefractionColor*/1/*end*/; + float RefractionIndex = /*ase_frag_out:Refraction Index;Float;12;-1;_RefractionIndex*/1/*end*/; + float3 Transmission = /*ase_frag_out:Transmission;Float3;13;-1;_Transmission*/1/*end*/; + float3 Translucency = /*ase_frag_out:Translucency;Float3;14;-1;_Translucency*/1/*end*/; + + #ifdef _ALPHATEST_ON + clip( o.Alpha - AlphaClipThreshold ); + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = IN.pos.z; + #endif + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(worldPos)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + + fixed4 c = 0; + float3 worldN; + worldN.x = dot(IN.tSpace0.xyz, o.Normal); + worldN.y = dot(IN.tSpace1.xyz, o.Normal); + worldN.z = dot(IN.tSpace2.xyz, o.Normal); + worldN = normalize(worldN); + o.Normal = worldN; + + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = _LightColor0.rgb; + gi.light.dir = lightDir; + + UnityGIInput giInput; + UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); + giInput.light = gi.light; + giInput.worldPos = worldPos; + giInput.worldViewDir = worldViewDir; + giInput.atten = atten; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + giInput.lightmapUV = IN.lmap; + #else + giInput.lightmapUV = 0.0; + #endif + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + giInput.ambient = IN.sh; + #else + giInput.ambient.rgb = 0.0; + #endif + giInput.probeHDR[0] = unity_SpecCube0_HDR; + giInput.probeHDR[1] = unity_SpecCube1_HDR; + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + giInput.boxMin[0] = unity_SpecCube0_BoxMin; + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + giInput.boxMax[0] = unity_SpecCube0_BoxMax; + giInput.probePosition[0] = unity_SpecCube0_ProbePosition; + giInput.boxMax[1] = unity_SpecCube1_BoxMax; + giInput.boxMin[1] = unity_SpecCube1_BoxMin; + giInput.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + #if defined(_SPECULAR_SETUP) + LightingStandardSpecular_GI(o, giInput, gi); + #else + LightingStandard_GI( o, giInput, gi ); + #endif + + #ifdef ASE_BAKEDGI + gi.indirect.diffuse = BakedGI; + #endif + + #if UNITY_SHOULD_SAMPLE_SH && !defined(LIGHTMAP_ON) && defined(ASE_NO_AMBIENT) + gi.indirect.diffuse = 0; + #endif + + #if defined(_SPECULAR_SETUP) + c += LightingStandardSpecular (o, worldViewDir, gi); + #else + c += LightingStandard( o, worldViewDir, gi ); + #endif + + #ifdef ASE_TRANSMISSION + { + float shadow = /*ase_inline_begin*/_TransmissionShadow/*ase_inline_end*/; + #ifdef DIRECTIONAL + float3 lightAtten = lerp( _LightColor0.rgb, gi.light.color, shadow ); + #else + float3 lightAtten = gi.light.color; + #endif + half3 transmission = max(0 , -dot(o.Normal, gi.light.dir)) * lightAtten * Transmission; + c.rgb += o.Albedo * transmission; + } + #endif + + #ifdef ASE_TRANSLUCENCY + { + float shadow = /*ase_inline_begin*/_TransShadow/*ase_inline_end*/; + float normal = /*ase_inline_begin*/_TransNormal/*ase_inline_end*/; + float scattering = /*ase_inline_begin*/_TransScattering/*ase_inline_end*/; + float direct = /*ase_inline_begin*/_TransDirect/*ase_inline_end*/; + float ambient = /*ase_inline_begin*/_TransAmbient/*ase_inline_end*/; + float strength = /*ase_inline_begin*/_TransStrength/*ase_inline_end*/; + + #ifdef DIRECTIONAL + float3 lightAtten = lerp( _LightColor0.rgb, gi.light.color, shadow ); + #else + float3 lightAtten = gi.light.color; + #endif + half3 lightDir = gi.light.dir + o.Normal * normal; + half transVdotL = pow( saturate( dot( worldViewDir, -lightDir ) ), scattering ); + half3 translucency = lightAtten * (transVdotL * direct + gi.indirect.diffuse * ambient) * Translucency; + c.rgb += o.Albedo * translucency * strength; + } + #endif + + //#ifdef ASE_REFRACTION + // float4 projScreenPos = ScreenPos / ScreenPos.w; + // float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, WorldNormal ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) ); + // projScreenPos.xy += refractionOffset.xy; + // float3 refraction = UNITY_SAMPLE_SCREENSPACE_TEXTURE( _GrabTexture, projScreenPos ) * RefractionColor; + // color.rgb = lerp( refraction, color.rgb, color.a ); + // color.a = 1; + //#endif + + c.rgb += o.Emission; + + #ifdef ASE_FOG + UNITY_APPLY_FOG(IN.fogCoord, c); + #endif + return c; + } + ENDCG + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "ForwardAdd" + Tags { "LightMode"="ForwardAdd" } + ZWrite Off + Blend One One + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma skip_variants INSTANCING_ON + #pragma multi_compile_fwdadd_fullshadows + #ifndef UNITY_PASS_FORWARDADD + #define UNITY_PASS_FORWARDADD + #endif + #include "HLSLSupport.cginc" + #if !defined( UNITY_INSTANCED_LOD_FADE ) + #define UNITY_INSTANCED_LOD_FADE + #endif + #if !defined( UNITY_INSTANCED_SH ) + #define UNITY_INSTANCED_SH + #endif + #if !defined( UNITY_INSTANCED_LIGHTMAPSTS ) + #define UNITY_INSTANCED_LIGHTMAPSTS + #endif + #include "UnityShaderVariables.cginc" + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + + /*ase_pragma*/ + struct appdata { + float4 vertex : POSITION; + float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vdata:p=p;t=t;n=n;uv1=tc1.xyzw;uv2=tc2.xyzw*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + struct v2f { + #if UNITY_VERSION >= 201810 + UNITY_POSITION(pos); + #else + float4 pos : SV_POSITION; + #endif + #if UNITY_VERSION >= 201810 && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + UNITY_LIGHTING_COORDS(1,2) + #elif defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if UNITY_VERSION >= 201710 + UNITY_SHADOW_COORDS(1) + #else + SHADOW_COORDS(1) + #endif + #endif + #ifdef ASE_FOG + UNITY_FOG_COORDS(3) + #endif + float4 tSpace0 : TEXCOORD5; + float4 tSpace1 : TEXCOORD6; + float4 tSpace2 : TEXCOORD7; + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + float4 screenPos : TEXCOORD8; + #endif + /*ase_interp(9,):sp=sp.xyzw;sc=tc1;wn.xyz=tc5.xyz;wt.xyz=tc6.xyz;wbt.xyz=tc7.xyz;wp.x=tc5.w;wp.y=tc6.w;wp.z=tc7.w;spu=tc8*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + /*ase_globals*/ + + /*ase_funcs*/ + + v2f VertexFunction (appdata v /*ase_vert_input*/ ) { + UNITY_SETUP_INSTANCE_ID(v); + v2f o; + UNITY_INITIALIZE_OUTPUT(v2f,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + /*ase_vert_code:v=appdata;o=v2f*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;11;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.vertex.w = 1; + v.normal = /*ase_vert_out:Vertex Normal;Float3;12;-1;_VertexNormal*/v.normal/*end*/; + v.tangent = /*ase_vert_out:Vertex Tangent;Float4;13;-1;_VertexTangent*/v.tangent/*end*/; + + o.pos = UnityObjectToClipPos(v.vertex); + float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz; + fixed3 worldNormal = UnityObjectToWorldNormal(v.normal); + fixed3 worldTangent = UnityObjectToWorldDir(v.tangent.xyz); + fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w; + fixed3 worldBinormal = cross(worldNormal, worldTangent) * tangentSign; + o.tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); + o.tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); + o.tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); + + #if UNITY_VERSION >= 201810 && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + UNITY_TRANSFER_LIGHTING(o, v.texcoord1.xy); + #elif defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if UNITY_VERSION >= 201710 + UNITY_TRANSFER_SHADOW(o, v.texcoord1.xy); + #else + TRANSFER_SHADOW(o); + #endif + #endif + + #ifdef ASE_FOG + UNITY_TRANSFER_FOG(o,o.pos); + #endif + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + o.screenPos = ComputeScreenPos(o.pos); + #endif + return o; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( appdata v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.tangent = v.tangent; + o.normal = v.normal; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + /*ase_control_code:v=appdata;o=VertexControl*/ + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, UNITY_MATRIX_M, _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, UNITY_MATRIX_M, _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, UNITY_MATRIX_M, _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + v2f DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + appdata o = (appdata) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.tangent = patch[0].tangent * bary.x + patch[1].tangent * bary.y + patch[2].tangent * bary.z; + o.normal = patch[0].normal * bary.x + patch[1].normal * bary.y + patch[2].normal * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + /*ase_domain_code:patch=VertexControl;o=appdata;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].normal * (dot(o.vertex.xyz, patch[i].normal) - dot(patch[i].vertex.xyz, patch[i].normal)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + v2f vert ( appdata v ) + { + return VertexFunction( v ); + } + #endif + + fixed4 frag ( v2f IN /*ase_frag_input*/ + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #ifdef LOD_FADE_CROSSFADE + UNITY_APPLY_DITHER_CROSSFADE(IN.pos.xy); + #endif + + #if defined(_SPECULAR_SETUP) + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #endif + /*ase_local_var:wt*/float3 WorldTangent = float3(IN.tSpace0.x,IN.tSpace1.x,IN.tSpace2.x); + /*ase_local_var:wbt*/float3 WorldBiTangent = float3(IN.tSpace0.y,IN.tSpace1.y,IN.tSpace2.y); + /*ase_local_var:wn*/float3 WorldNormal = float3(IN.tSpace0.z,IN.tSpace1.z,IN.tSpace2.z); + /*ase_local_var:wp*/float3 worldPos = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + /*ase_local_var:wvd*/float3 worldViewDir = normalize(UnityWorldSpaceViewDir(worldPos)); + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + UNITY_LIGHT_ATTENUATION(atten, IN, worldPos) + #else + /*ase_local_var:sc*/half atten = 1; + #endif + #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION) + /*ase_local_var:spu*/float4 ScreenPos = IN.screenPos; + #endif + + + /*ase_frag_code:IN=v2f*/ + o.Albedo = /*ase_frag_out:Albedo;Float3;0;-1;_Albedo*/fixed3( 0.5, 0.5, 0.5 )/*end*/; + o.Normal = /*ase_frag_out:Normal;Float3;1;-1;_Normal*/fixed3( 0, 0, 1 )/*end*/; + o.Emission = /*ase_frag_out:Emission;Float3;2;-1;_Emission*/half3( 0, 0, 0 )/*end*/; + #if defined(_SPECULAR_SETUP) + o.Specular = /*ase_frag_out:Specular;Float3;3;-1;_Specular*/fixed3( 0, 0, 0 )/*end*/; + #else + o.Metallic = /*ase_frag_out:Metallic;Float;4;-1;_Metallic*/0/*end*/; + #endif + o.Smoothness = /*ase_frag_out:Smoothness;Float;5;-1;_Smoothness*/0/*end*/; + o.Occlusion = /*ase_frag_out:Occlusion;Float;6;-1;_Occlusion*/1/*end*/; + o.Alpha = /*ase_frag_out:Alpha;Float;7;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;8;-1;_AlphaClip*/0.5/*end*/; + float3 Transmission = /*ase_frag_out:Transmission;Float3;9;-1;_Transmission*/1/*end*/; + float3 Translucency = /*ase_frag_out:Translucency;Float3;10;-1;_Translucency*/1/*end*/; + + #ifdef _ALPHATEST_ON + clip( o.Alpha - AlphaClipThreshold ); + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = IN.pos.z; + #endif + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(worldPos)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + + fixed4 c = 0; + float3 worldN; + worldN.x = dot(IN.tSpace0.xyz, o.Normal); + worldN.y = dot(IN.tSpace1.xyz, o.Normal); + worldN.z = dot(IN.tSpace2.xyz, o.Normal); + worldN = normalize(worldN); + o.Normal = worldN; + + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = _LightColor0.rgb; + gi.light.dir = lightDir; + gi.light.color *= atten; + + #if defined(_SPECULAR_SETUP) + c += LightingStandardSpecular( o, worldViewDir, gi ); + #else + c += LightingStandard( o, worldViewDir, gi ); + #endif + + #ifdef ASE_TRANSMISSION + { + float shadow = /*ase_inline_begin*/_TransmissionShadow/*ase_inline_end*/; + #ifdef DIRECTIONAL + float3 lightAtten = lerp( _LightColor0.rgb, gi.light.color, shadow ); + #else + float3 lightAtten = gi.light.color; + #endif + half3 transmission = max(0 , -dot(o.Normal, gi.light.dir)) * lightAtten * Transmission; + c.rgb += o.Albedo * transmission; + } + #endif + + #ifdef ASE_TRANSLUCENCY + { + float shadow = /*ase_inline_begin*/_TransShadow/*ase_inline_end*/; + float normal = /*ase_inline_begin*/_TransNormal/*ase_inline_end*/; + float scattering = /*ase_inline_begin*/_TransScattering/*ase_inline_end*/; + float direct = /*ase_inline_begin*/_TransDirect/*ase_inline_end*/; + float ambient = /*ase_inline_begin*/_TransAmbient/*ase_inline_end*/; + float strength = /*ase_inline_begin*/_TransStrength/*ase_inline_end*/; + + #ifdef DIRECTIONAL + float3 lightAtten = lerp( _LightColor0.rgb, gi.light.color, shadow ); + #else + float3 lightAtten = gi.light.color; + #endif + half3 lightDir = gi.light.dir + o.Normal * normal; + half transVdotL = pow( saturate( dot( worldViewDir, -lightDir ) ), scattering ); + half3 translucency = lightAtten * (transVdotL * direct + gi.indirect.diffuse * ambient) * Translucency; + c.rgb += o.Albedo * translucency * strength; + } + #endif + + //#ifdef ASE_REFRACTION + // float4 projScreenPos = ScreenPos / ScreenPos.w; + // float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, WorldNormal ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) ); + // projScreenPos.xy += refractionOffset.xy; + // float3 refraction = UNITY_SAMPLE_SCREENSPACE_TEXTURE( _GrabTexture, projScreenPos ) * RefractionColor; + // color.rgb = lerp( refraction, color.rgb, color.a ); + // color.a = 1; + //#endif + + #ifdef ASE_FOG + UNITY_APPLY_FOG(IN.fogCoord, c); + #endif + return c; + } + ENDCG + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "Deferred" + Tags { "LightMode"="Deferred" } + + AlphaToMask Off + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 3.5 + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_prepassfinal + #ifndef UNITY_PASS_DEFERRED + #define UNITY_PASS_DEFERRED + #endif + #include "HLSLSupport.cginc" + #if !defined( UNITY_INSTANCED_LOD_FADE ) + #define UNITY_INSTANCED_LOD_FADE + #endif + #if !defined( UNITY_INSTANCED_SH ) + #define UNITY_INSTANCED_SH + #endif + #if !defined( UNITY_INSTANCED_LIGHTMAPSTS ) + #define UNITY_INSTANCED_LIGHTMAPSTS + #endif + #include "UnityShaderVariables.cginc" + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + /*ase_pragma*/ + struct appdata { + float4 vertex : POSITION; + float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vdata:p=p;t=t;n=n;uv1=tc1.xyzw;uv2=tc2.xyzw*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f { + #if UNITY_VERSION >= 201810 + UNITY_POSITION(pos); + #else + float4 pos : SV_POSITION; + #endif + float4 lmap : TEXCOORD2; + #ifndef LIGHTMAP_ON + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + half3 sh : TEXCOORD3; + #endif + #else + #ifdef DIRLIGHTMAP_OFF + float4 lmapFadePos : TEXCOORD4; + #endif + #endif + float4 tSpace0 : TEXCOORD5; + float4 tSpace1 : TEXCOORD6; + float4 tSpace2 : TEXCOORD7; + /*ase_interp(8,):sp=sp.xyzw;wn.xyz=tc5.xyz;wt.xyz=tc6.xyz;wbt.xyz=tc7.xyz;wp.x=tc5.w;wp.y=tc6.w;wp.z=tc7.w*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #ifdef LIGHTMAP_ON + float4 unity_LightmapFade; + #endif + fixed4 unity_Ambient; + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + /*ase_globals*/ + + /*ase_funcs*/ + + v2f VertexFunction (appdata v /*ase_vert_input*/ ) { + UNITY_SETUP_INSTANCE_ID(v); + v2f o; + UNITY_INITIALIZE_OUTPUT(v2f,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + /*ase_vert_code:v=appdata;o=v2f*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;10;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.vertex.w = 1; + v.normal = /*ase_vert_out:Vertex Normal;Float3;11;-1;_VertexNormal*/v.normal/*end*/; + v.tangent = /*ase_vert_out:Vertex Tangent;Float4;12;-1;_VertexTangent*/v.tangent/*end*/; + + o.pos = UnityObjectToClipPos(v.vertex); + float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz; + fixed3 worldNormal = UnityObjectToWorldNormal(v.normal); + fixed3 worldTangent = UnityObjectToWorldDir(v.tangent.xyz); + fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w; + fixed3 worldBinormal = cross(worldNormal, worldTangent) * tangentSign; + o.tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); + o.tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); + o.tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); + + #ifdef DYNAMICLIGHTMAP_ON + o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #else + o.lmap.zw = 0; + #endif + #ifdef LIGHTMAP_ON + o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #ifdef DIRLIGHTMAP_OFF + o.lmapFadePos.xyz = (mul(unity_ObjectToWorld, v.vertex).xyz - unity_ShadowFadeCenterAndType.xyz) * unity_ShadowFadeCenterAndType.w; + o.lmapFadePos.w = (-UnityObjectToViewPos(v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w); + #endif + #else + o.lmap.xy = 0; + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + o.sh = 0; + o.sh = ShadeSHPerVertex (worldNormal, o.sh); + #endif + #endif + return o; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( appdata v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.tangent = v.tangent; + o.normal = v.normal; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + /*ase_control_code:v=appdata;o=VertexControl*/ + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, UNITY_MATRIX_M, _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, UNITY_MATRIX_M, _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, UNITY_MATRIX_M, _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + v2f DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + appdata o = (appdata) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.tangent = patch[0].tangent * bary.x + patch[1].tangent * bary.y + patch[2].tangent * bary.z; + o.normal = patch[0].normal * bary.x + patch[1].normal * bary.y + patch[2].normal * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + /*ase_domain_code:patch=VertexControl;o=appdata;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].normal * (dot(o.vertex.xyz, patch[i].normal) - dot(patch[i].vertex.xyz, patch[i].normal)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + v2f vert ( appdata v ) + { + return VertexFunction( v ); + } + #endif + + void frag (v2f IN /*ase_frag_input*/ + , out half4 outGBuffer0 : SV_Target0 + , out half4 outGBuffer1 : SV_Target1 + , out half4 outGBuffer2 : SV_Target2 + , out half4 outEmission : SV_Target3 + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + , out half4 outShadowMask : SV_Target4 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + + #ifdef LOD_FADE_CROSSFADE + UNITY_APPLY_DITHER_CROSSFADE(IN.pos.xy); + #endif + + #if defined(_SPECULAR_SETUP) + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #endif + /*ase_local_var:wt*/float3 WorldTangent = float3(IN.tSpace0.x,IN.tSpace1.x,IN.tSpace2.x); + /*ase_local_var:wbt*/float3 WorldBiTangent = float3(IN.tSpace0.y,IN.tSpace1.y,IN.tSpace2.y); + /*ase_local_var:wn*/float3 WorldNormal = float3(IN.tSpace0.z,IN.tSpace1.z,IN.tSpace2.z); + /*ase_local_var:wp*/float3 worldPos = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w); + /*ase_local_var:wvd*/float3 worldViewDir = normalize(UnityWorldSpaceViewDir(worldPos)); + /*ase_local_var:sc*/half atten = 1; + + /*ase_frag_code:IN=v2f*/ + o.Albedo = /*ase_frag_out:Albedo;Float3;0;-1;_Albedo*/fixed3( 0.5, 0.5, 0.5 )/*end*/; + o.Normal = /*ase_frag_out:Normal;Float3;1;-1;_Normal*/fixed3( 0, 0, 1 )/*end*/; + o.Emission = /*ase_frag_out:Emission;Float3;2;-1;_Emission*/half3( 0, 0, 0 )/*end*/; + #if defined(_SPECULAR_SETUP) + o.Specular = /*ase_frag_out:Specular;Float3;3;-1;_Specular*/fixed3( 0, 0, 0 )/*end*/; + #else + o.Metallic = /*ase_frag_out:Metallic;Float;4;-1;_Metallic*/0/*end*/; + #endif + o.Smoothness = /*ase_frag_out:Smoothness;Float;5;-1;_Smoothness*/0/*end*/; + o.Occlusion = /*ase_frag_out:Occlusion;Float;6;-1;_Occlusion*/1/*end*/; + o.Alpha = /*ase_frag_out:Alpha;Float;7;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;8;-1;_AlphaClip*/0.5/*end*/; + float3 BakedGI = /*ase_frag_out:Baked GI;Float3;9;-1;_BakedGI*/0/*end*/; + + #ifdef _ALPHATEST_ON + clip( o.Alpha - AlphaClipThreshold ); + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = IN.pos.z; + #endif + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(worldPos)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + + float3 worldN; + worldN.x = dot(IN.tSpace0.xyz, o.Normal); + worldN.y = dot(IN.tSpace1.xyz, o.Normal); + worldN.z = dot(IN.tSpace2.xyz, o.Normal); + worldN = normalize(worldN); + o.Normal = worldN; + + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = 0; + gi.light.dir = half3(0,1,0); + + UnityGIInput giInput; + UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); + giInput.light = gi.light; + giInput.worldPos = worldPos; + giInput.worldViewDir = worldViewDir; + giInput.atten = atten; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + giInput.lightmapUV = IN.lmap; + #else + giInput.lightmapUV = 0.0; + #endif + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + giInput.ambient = IN.sh; + #else + giInput.ambient.rgb = 0.0; + #endif + giInput.probeHDR[0] = unity_SpecCube0_HDR; + giInput.probeHDR[1] = unity_SpecCube1_HDR; + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + giInput.boxMin[0] = unity_SpecCube0_BoxMin; + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + giInput.boxMax[0] = unity_SpecCube0_BoxMax; + giInput.probePosition[0] = unity_SpecCube0_ProbePosition; + giInput.boxMax[1] = unity_SpecCube1_BoxMax; + giInput.boxMin[1] = unity_SpecCube1_BoxMin; + giInput.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + #if defined(_SPECULAR_SETUP) + LightingStandardSpecular_GI( o, giInput, gi ); + #else + LightingStandard_GI( o, giInput, gi ); + #endif + + #ifdef ASE_BAKEDGI + gi.indirect.diffuse = BakedGI; + #endif + + #if UNITY_SHOULD_SAMPLE_SH && !defined(LIGHTMAP_ON) && defined(ASE_NO_AMBIENT) + gi.indirect.diffuse = 0; + #endif + + #if defined(_SPECULAR_SETUP) + outEmission = LightingStandardSpecular_Deferred( o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2 ); + #else + outEmission = LightingStandard_Deferred( o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2 ); + #endif + + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, float3(0, 0, 0)); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + } + ENDCG + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "Meta" + Tags { "LightMode"="Meta" } + Cull Off + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma shader_feature EDITOR_VISUALIZATION + #ifndef UNITY_PASS_META + #define UNITY_PASS_META + #endif + #include "HLSLSupport.cginc" + #if !defined( UNITY_INSTANCED_LOD_FADE ) + #define UNITY_INSTANCED_LOD_FADE + #endif + #if !defined( UNITY_INSTANCED_SH ) + #define UNITY_INSTANCED_SH + #endif + #if !defined( UNITY_INSTANCED_LIGHTMAPSTS ) + #define UNITY_INSTANCED_LIGHTMAPSTS + #endif + #include "UnityShaderVariables.cginc" + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "UnityMetaPass.cginc" + + /*ase_pragma*/ + struct appdata { + float4 vertex : POSITION; + float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vdata:p=p;t=t;n=n;uv0=tc0.xyzw;uv1=tc1.xyzw;uv2=tc2.xyzw*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + struct v2f { + #if UNITY_VERSION >= 201810 + UNITY_POSITION(pos); + #else + float4 pos : SV_POSITION; + #endif + #ifdef EDITOR_VISUALIZATION + float2 vizUV : TEXCOORD1; + float4 lightCoord : TEXCOORD2; + #endif + /*ase_interp(3,):sp=sp.xyzw*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + /*ase_globals*/ + + /*ase_funcs*/ + + v2f VertexFunction (appdata v /*ase_vert_input*/ ) { + UNITY_SETUP_INSTANCE_ID(v); + v2f o; + UNITY_INITIALIZE_OUTPUT(v2f,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + /*ase_vert_code:v=appdata;o=v2f*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;4;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.vertex.w = 1; + v.normal = /*ase_vert_out:Vertex Normal;Float3;5;-1;_VertexNormal*/v.normal/*end*/; + v.tangent = /*ase_vert_out:Vertex Tangent;Float4;6;-1;_VertexTangent*/v.tangent/*end*/; + + #ifdef EDITOR_VISUALIZATION + o.vizUV = 0; + o.lightCoord = 0; + if (unity_VisualizationMode == EDITORVIZ_TEXTURE) + o.vizUV = UnityMetaVizUV(unity_EditorViz_UVIndex, v.texcoord.xy, v.texcoord1.xy, v.texcoord2.xy, unity_EditorViz_Texture_ST); + else if (unity_VisualizationMode == EDITORVIZ_SHOWLIGHTMASK) + { + o.vizUV = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + o.lightCoord = mul(unity_EditorViz_WorldToLight, mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1))); + } + #endif + + o.pos = UnityMetaVertexPosition(v.vertex, v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + + return o; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( appdata v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.tangent = v.tangent; + o.normal = v.normal; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + /*ase_control_code:v=appdata;o=VertexControl*/ + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, UNITY_MATRIX_M, _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, UNITY_MATRIX_M, _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, UNITY_MATRIX_M, _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + v2f DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + appdata o = (appdata) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.tangent = patch[0].tangent * bary.x + patch[1].tangent * bary.y + patch[2].tangent * bary.z; + o.normal = patch[0].normal * bary.x + patch[1].normal * bary.y + patch[2].normal * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + /*ase_domain_code:patch=VertexControl;o=appdata;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].normal * (dot(o.vertex.xyz, patch[i].normal) - dot(patch[i].vertex.xyz, patch[i].normal)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + v2f vert ( appdata v ) + { + return VertexFunction( v ); + } + #endif + + fixed4 frag (v2f IN /*ase_frag_input*/ + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #ifdef LOD_FADE_CROSSFADE + UNITY_APPLY_DITHER_CROSSFADE(IN.pos.xy); + #endif + + #if defined(_SPECULAR_SETUP) + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #endif + + /*ase_frag_code:IN=v2f*/ + o.Albedo = /*ase_frag_out:Albedo;Float3;0;-1;_Albedo*/fixed3( 0.5, 0.5, 0.5 )/*end*/; + o.Normal = fixed3( 0, 0, 1 ); + o.Emission = /*ase_frag_out:Emission;Float3;1;-1;_Emission*/half3( 0, 0, 0 )/*end*/; + o.Alpha = /*ase_frag_out:Alpha;Float;2;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;3;-1;_AlphaClip*/0.5/*end*/; + + #ifdef _ALPHATEST_ON + clip( o.Alpha - AlphaClipThreshold ); + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = IN.pos.z; + #endif + + UnityMetaInput metaIN; + UNITY_INITIALIZE_OUTPUT(UnityMetaInput, metaIN); + metaIN.Albedo = o.Albedo; + metaIN.Emission = o.Emission; + #ifdef EDITOR_VISUALIZATION + metaIN.VizUV = IN.vizUV; + metaIN.LightCoord = IN.lightCoord; + #endif + return UnityMetaFragment(metaIN); + } + ENDCG + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "ShadowCaster" + Tags { "LightMode"="ShadowCaster" } + ZWrite On + ZTest LEqual + AlphaToMask Off + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_shadowcaster + #ifndef UNITY_PASS_SHADOWCASTER + #define UNITY_PASS_SHADOWCASTER + #endif + #include "HLSLSupport.cginc" + #ifndef UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_LOD_FADE + #endif + #ifndef UNITY_INSTANCED_SH + #define UNITY_INSTANCED_SH + #endif + #ifndef UNITY_INSTANCED_LIGHTMAPSTS + #define UNITY_INSTANCED_LIGHTMAPSTS + #endif + #if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN ) + #define CAN_SKIP_VPOS + #endif + #include "UnityShaderVariables.cginc" + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + /*ase_pragma*/ + struct appdata { + float4 vertex : POSITION; + float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vdata:p=p;t=t;n=n;uv1=tc1.xyzw;uv2=tc2.xyzw*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f { + V2F_SHADOW_CASTER; + /*ase_interp(2,):sp=sp.xyzw*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #ifdef UNITY_STANDARD_USE_DITHER_MASK + sampler3D _DitherMaskLOD; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + /*ase_globals*/ + + /*ase_funcs*/ + + v2f VertexFunction (appdata v /*ase_vert_input*/ ) { + UNITY_SETUP_INSTANCE_ID(v); + v2f o; + UNITY_INITIALIZE_OUTPUT(v2f,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + /*ase_vert_code:v=appdata;o=v2f*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.vertex.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;3;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + v.vertex.w = 1; + v.normal = /*ase_vert_out:Vertex Normal;Float3;4;-1;_VertexNormal*/v.normal/*end*/; + v.tangent = /*ase_vert_out:Vertex Tangent;Float4;5;-1;_VertexTangent*/v.tangent/*end*/; + + TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) + return o; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 vertex : INTERNALTESSPOS; + float4 tangent : TANGENT; + float3 normal : NORMAL; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( appdata v ) + { + VertexControl o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + o.vertex = v.vertex; + o.tangent = v.tangent; + o.normal = v.normal; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + /*ase_control_code:v=appdata;o=VertexControl*/ + return o; + } + + TessellationFactors TessellationFunction (InputPatch v) + { + TessellationFactors o; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, UNITY_MATRIX_M, _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, UNITY_MATRIX_M, _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, UNITY_MATRIX_M, _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w; + return o; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + v2f DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + appdata o = (appdata) 0; + o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z; + o.tangent = patch[0].tangent * bary.x + patch[1].tangent * bary.y + patch[2].tangent * bary.z; + o.normal = patch[0].normal * bary.x + patch[1].normal * bary.y + patch[2].normal * bary.z; + o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + /*ase_domain_code:patch=VertexControl;o=appdata;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = o.vertex.xyz - patch[i].normal * (dot(o.vertex.xyz, patch[i].normal) - dot(patch[i].vertex.xyz, patch[i].normal)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], o); + return VertexFunction(o); + } + #else + v2f vert ( appdata v ) + { + return VertexFunction( v ); + } + #endif + + fixed4 frag (v2f IN /*ase_frag_input*/ + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if !defined( CAN_SKIP_VPOS ) + , UNITY_VPOS_TYPE vpos : VPOS + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #ifdef LOD_FADE_CROSSFADE + UNITY_APPLY_DITHER_CROSSFADE(IN.pos.xy); + #endif + + #if defined(_SPECULAR_SETUP) + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #endif + + /*ase_frag_code:IN=v2f*/ + o.Normal = fixed3( 0, 0, 1 ); + o.Occlusion = 1; + o.Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + float AlphaClipThresholdShadow = /*ase_frag_out:Alpha Clip Threshold Shadow;Float;2;-1;_AlphaClipShadow*/0.5/*end*/; + + #ifdef _ALPHATEST_SHADOW_ON + if (unity_LightShadowBias.z != 0.0) + clip(o.Alpha - AlphaClipThresholdShadow); + #ifdef _ALPHATEST_ON + else + clip(o.Alpha - AlphaClipThreshold); + #endif + #else + #ifdef _ALPHATEST_ON + clip(o.Alpha - AlphaClipThreshold); + #endif + #endif + + #if defined( CAN_SKIP_VPOS ) + float2 vpos = IN.pos; + #endif + + #ifdef UNITY_STANDARD_USE_DITHER_MASK + half alphaRef = tex3D(_DitherMaskLOD, float3(vpos.xy*0.25,o.Alpha*0.9375)).a; + clip(alphaRef - 0.01); + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = IN.pos.z; + #endif + + SHADOW_CASTER_FRAGMENT(IN) + } + ENDCG + } + /*ase_pass_end*/ + } + CustomEditor "AmplifyShaderEditor.MaterialInspector" +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Lit.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Lit.shader.meta new file mode 100644 index 00000000..1d2081ee --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Lit.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: ed95fe726fd7b4644bb42f4d1ddd2bcd +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Lit.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader new file mode 100644 index 00000000..0dc72142 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader @@ -0,0 +1,297 @@ +Shader /*ase_name*/ "Hidden/Templates/Legacy/Multi Pass Unlit" /*end*/ +{ + Properties + { + /*ase_props*/ + } + + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 100 + + Cull Off + CGINCLUDE + #pragma target 3.5 + ENDCG + + /*ase_pass*/ + Pass + { + /*ase_main_pass*/ + Name "ForwardBase" + Tags { "LightMode"="ForwardBase" } + + /*ase_all_modules*/ + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_fwdbase + #ifndef UNITY_PASS_FORWARDBASE + #define UNITY_PASS_FORWARDBASE + #endif + #include "UnityCG.cginc" + /*ase_pragma*/ + /*ase_globals*/ + + struct appdata + { + float4 vertex : POSITION; + float3 normal : NORMAL; + UNITY_VERTEX_INPUT_INSTANCE_ID + /*ase_vdata:p=p;n=n*/ + }; + + struct v2f + { + float4 pos : SV_POSITION; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + /*ase_interp(1,):sp=sp.xyzw*/ + }; + + v2f vert ( appdata v /*ase_vert_input*/) + { + v2f o; + UNITY_INITIALIZE_OUTPUT(v2f,o); + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_TRANSFER_INSTANCE_ID(v, o); + + /*ase_vert_code:v=appdata;o=v2f*/ + + v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3;_Vertex*/ float3(0,0,0) /*end*/; + o.pos = UnityObjectToClipPos(v.vertex); + #if ASE_SHADOWS + #if UNITY_VERSION >= 560 + UNITY_TRANSFER_SHADOW( o, v.texcoord ); + #else + TRANSFER_SHADOW( o ); + #endif + #endif + return o; + } + + float4 frag (v2f i /*ase_frag_input*/) : SV_Target + { + float3 outColor; + float outAlpha; + + /*ase_frag_code:i=v2f*/ + + outColor = /*ase_frag_out:Color;Float3;_Color*/float3(1,1,1)/*end*/; + outAlpha = /*ase_frag_out:Alpha;Float;_Alpha*/1/*end*/; + clip(outAlpha); + return float4(outColor,outAlpha); + } + ENDCG + } + + /*ase_pass*/ + Pass + { + Name "ForwardAdd" + Tags { "LightMode" = "ForwardAdd" } + ZWrite Off + Blend One One + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_fwdadd_fullshadows + #ifndef UNITY_PASS_FORWARDADD + #define UNITY_PASS_FORWARDADD + #endif + #include "UnityCG.cginc" + /*ase_pragma*/ + /*ase_globals*/ + + struct appdata + { + float4 vertex : POSITION; + float3 normal : NORMAL; + UNITY_VERTEX_INPUT_INSTANCE_ID + /*ase_vdata:p=p;n=n*/ + }; + + struct v2f + { + float4 pos : SV_POSITION; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + /*ase_interp(1,):sp=sp.xyzw*/ + }; + + v2f vert ( appdata v /*ase_vert_input*/) + { + v2f o; + UNITY_INITIALIZE_OUTPUT(v2f,o); + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_TRANSFER_INSTANCE_ID(v, o); + + /*ase_vert_code:v=appdata;o=v2f*/ + + v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3;_Vertex*/ float3(0,0,0) /*end*/; + o.pos = UnityObjectToClipPos(v.vertex); + #if ASE_SHADOWS + #if UNITY_VERSION >= 560 + UNITY_TRANSFER_SHADOW( o, v.texcoord ); + #else + TRANSFER_SHADOW( o ); + #endif + #endif + return o; + } + + float4 frag (v2f i /*ase_frag_input*/) : SV_Target + { + float3 outColor; + float outAlpha; + + /*ase_frag_code:i=v2f*/ + + outColor = /*ase_frag_out:Color;Float3;_Color*/float3(1,1,1)/*end*/; + outAlpha = /*ase_frag_out:Alpha;Float;_Alpha*/1/*end*/; + clip(outAlpha); + return float4(outColor,outAlpha); + } + ENDCG + } + + /*ase_pass*/ + Pass + { + Name "Deferred" + Tags { "LightMode" = "Deferred" } + + /*ase_all_modules*/ + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_prepassfinal + #ifndef UNITY_PASS_DEFERRED + #define UNITY_PASS_DEFERRED + #endif + #include "UnityCG.cginc" + /*ase_pragma*/ + /*ase_globals*/ + + struct appdata + { + float4 vertex : POSITION; + float3 normal : NORMAL; + UNITY_VERTEX_INPUT_INSTANCE_ID + /*ase_vdata:p=p;n=n*/ + }; + + struct v2f + { + float4 pos : SV_POSITION; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + /*ase_interp(1,):sp=sp.xyzw*/ + }; + + v2f vert ( appdata v /*ase_vert_input*/) + { + v2f o; + UNITY_INITIALIZE_OUTPUT(v2f,o); + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_TRANSFER_INSTANCE_ID(v, o); + + /*ase_vert_code:v=appdata;o=v2f*/ + + v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3;_Vertex*/ float3(0,0,0) /*end*/; + o.pos = UnityObjectToClipPos(v.vertex); + #if ASE_SHADOWS + #if UNITY_VERSION >= 560 + UNITY_TRANSFER_SHADOW( o, v.texcoord ); + #else + TRANSFER_SHADOW( o ); + #endif + #endif + return o; + } + + void frag (v2f i /*ase_frag_input*/, out half4 outGBuffer0 : SV_Target0, out half4 outGBuffer1 : SV_Target1, out half4 outGBuffer2 : SV_Target2, out half4 outGBuffer3 : SV_Target3) + { + /*ase_frag_code:i=v2f*/ + + outGBuffer0 = /*ase_frag_out:GBuffer0;Float4*/0/*end*/; + outGBuffer1 = /*ase_frag_out:GBuffer1;Float4*/0/*end*/; + outGBuffer2 = /*ase_frag_out:GBuffer2;Float4*/0/*end*/; + outGBuffer3 = /*ase_frag_out:GBuffer3;Float4*/0/*end*/; + } + ENDCG + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass:SyncP*/ + Name "ShadowCaster" + Tags { "LightMode"="ShadowCaster" } + ZWrite On + ZTest LEqual + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_shadowcaster + #ifndef UNITY_PASS_SHADOWCASTER + #define UNITY_PASS_SHADOWCASTER + #endif + #include "UnityCG.cginc" + /*ase_pragma*/ + /*ase_globals*/ + + struct appdata + { + float4 vertex : POSITION; + float3 normal : NORMAL; + UNITY_VERTEX_INPUT_INSTANCE_ID + /*ase_vdata:p=p;n=n*/ + }; + + struct v2f + { + V2F_SHADOW_CASTER; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + /*ase_interp(1,):sp=sp.xyzw*/ + }; + + + v2f vert ( appdata v /*ase_vert_input*/) + { + v2f o; + UNITY_INITIALIZE_OUTPUT(v2f,o); + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_TRANSFER_INSTANCE_ID(v, o); + + /*ase_vert_code:v=appdata;o=v2f*/ + + v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3;_Vertex*/ float3(0,0,0) /*end*/; + TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) + return o; + } + + float4 frag (v2f i /*ase_frag_input*/) : SV_Target + { + float3 outColor; + float outAlpha; + + /*ase_frag_code:i=v2f*/ + + outColor = /*ase_frag_out:Color;Float3;_Color*/float3(1,1,1)/*end*/; + outAlpha = /*ase_frag_out:Alpha;Float;_Alpha*/1/*end*/; + clip(outAlpha); + SHADOW_CASTER_FRAGMENT(i) + } + ENDCG + } + /*ase_pass_end*/ + } + CustomEditor "AmplifyShaderEditor.MaterialInspector" +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader.meta new file mode 100644 index 00000000..1df2026a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: e1de45c0d41f68c41b2cc20c8b9c05ef +timeCreated: 1496328687 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PPStack.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PPStack.shader new file mode 100644 index 00000000..13a4c62f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PPStack.shader @@ -0,0 +1,89 @@ +Shader /*ase_name*/ "Hidden/Templates/PostProcessStack" /*end*/ +{ + Properties + { + /*ase_props*/ + } + + SubShader + { + Cull Off + ZWrite Off + ZTest Always + /*ase_pass*/ + Pass + { + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + #pragma target 3.5 + + #include "UnityCG.cginc" + /*ase_pragma*/ + + struct ASEAttributesDefault + { + float3 vertex : POSITION; + float2 texcoord : TEXCOORD0; + /*ase_vdata:p=p;uv0=tc0*/ + }; + + struct ASEVaryingsDefault + { + float4 vertex : SV_POSITION; + float2 texcoord : TEXCOORD0; + float2 texcoordStereo : TEXCOORD1; + #if STEREO_INSTANCING_ENABLED + uint stereoTargetEyeIndex : SV_RenderTargetArrayIndex; + #endif + /*ase_interp(2,):sp=sp.xyzw;uv0=tc0.xy;uv1=tc1;uv2=tc2*/ + }; + + uniform sampler2D _MainTex; + uniform half4 _MainTex_TexelSize; + uniform half4 _MainTex_ST; + + /*ase_globals*/ + + /*ase_funcs*/ + + float2 TransformTriangleVertexToUV (float2 vertex) + { + float2 uv = (vertex + 1.0) * 0.5; + return uv; + } + + ASEVaryingsDefault Vert( ASEAttributesDefault v /*ase_vert_input*/ ) + { + ASEVaryingsDefault o; + o.vertex = float4(v.vertex.xy, 0.0, 1.0); + o.texcoord = TransformTriangleVertexToUV (v.vertex.xy); +#if UNITY_UV_STARTS_AT_TOP + o.texcoord = o.texcoord * float2(1.0, -1.0) + float2(0.0, 1.0); +#endif + o.texcoordStereo = TransformStereoScreenSpaceTex (o.texcoord, 1.0); + + v.texcoord = o.texcoordStereo; + /*ase_local_var:spn*/float4 ase_ppsScreenPosVertexNorm = float4(o.texcoordStereo,0,1); + + /*ase_vert_code:v=ASEAttributesDefault;o=ASEVaryingsDefault*/ + + return o; + } + + float4 Frag (ASEVaryingsDefault i /*ase_frag_input*/ ) : SV_Target + { + /*ase_local_var:spn*/float4 ase_ppsScreenPosFragNorm = float4(i.texcoordStereo,0,1); + + /*ase_frag_code:i=ASEVaryingsDefault*/ + + float4 color = /*ase_frag_out:Frag Color;Float4*/tex2D(_MainTex, i.texcoord )/*end*/; + + return color; + } + ENDCG + } + } + CustomEditor "AmplifyShaderEditor.MaterialInspector" +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PPStack.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PPStack.shader.meta new file mode 100644 index 00000000..65606bbc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PPStack.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 32139be9c1eb75640a847f011acf3bcf +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PPStack.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle Alpha Blend.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle Alpha Blend.shader new file mode 100644 index 00000000..34b46b6b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle Alpha Blend.shader @@ -0,0 +1,123 @@ +Shader /*ase_name*/ "Hidden/Templates/Legacy/Particles Alpha Blended" /*end*/ +{ + Properties + { + _TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5) + _MainTex ("Particle Texture", 2D) = "white" {} + _InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0 + /*ase_props*/ + } + + + Category + { + SubShader + { + Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" } + Blend SrcAlpha OneMinusSrcAlpha + ColorMask RGB + Cull Off + Lighting Off + ZWrite Off + ZTest LEqual + /*ase_pass*/ + Pass { + + CGPROGRAM + #ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX + #define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input) + #endif + + #pragma vertex vert + #pragma fragment frag + #pragma target 3.5 + #pragma multi_compile_instancing + #pragma multi_compile_particles + #pragma multi_compile_fog + /*ase_pragma*/ + + #include "UnityCG.cginc" + + struct appdata_t + { + float4 vertex : POSITION; + fixed4 color : COLOR; + float4 texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + /*ase_vdata:p=p;uv0=tc0;c=c*/ + }; + + struct v2f + { + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + float4 texcoord : TEXCOORD0; + UNITY_FOG_COORDS(1) + #ifdef SOFTPARTICLES_ON + float4 projPos : TEXCOORD2; + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + /*ase_interp(3,):sp=sp.xyzw;uv0=tc0;c=c*/ + }; + + + #if UNITY_VERSION >= 560 + UNITY_DECLARE_DEPTH_TEXTURE( _CameraDepthTexture ); + #else + uniform sampler2D_float _CameraDepthTexture; + #endif + + //Don't delete this comment + // uniform sampler2D_float _CameraDepthTexture; + + uniform sampler2D _MainTex; + uniform fixed4 _TintColor; + uniform float4 _MainTex_ST; + uniform float _InvFade; + /*ase_globals*/ + + v2f vert ( appdata_t v /*ase_vert_input*/ ) + { + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_TRANSFER_INSTANCE_ID(v, o); + /*ase_vert_code:v=appdata_t;o=v2f*/ + + v.vertex.xyz += /*ase_vert_out:Offset;Float3*/ float3( 0, 0, 0 ) /*end*/; + o.vertex = UnityObjectToClipPos(v.vertex); + #ifdef SOFTPARTICLES_ON + o.projPos = ComputeScreenPos (o.vertex); + COMPUTE_EYEDEPTH(o.projPos.z); + #endif + o.color = v.color; + o.texcoord = v.texcoord; + UNITY_TRANSFER_FOG(o,o.vertex); + return o; + } + + fixed4 frag ( v2f i /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( i ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( i ); + + #ifdef SOFTPARTICLES_ON + float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos))); + float partZ = i.projPos.z; + float fade = saturate (_InvFade * (sceneZ-partZ)); + i.color.a *= fade; + #endif + + /*ase_frag_code:i=v2f*/ + + fixed4 col = /*ase_frag_out:Color;Float4*/2.0f * i.color * _TintColor * tex2D(_MainTex, i.texcoord.xy*_MainTex_ST.xy + _MainTex_ST.zw )/*end*/; + UNITY_APPLY_FOG(i.fogCoord, col); + return col; + } + ENDCG + } + } + } + CustomEditor "AmplifyShaderEditor.MaterialInspector" +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle Alpha Blend.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle Alpha Blend.shader.meta new file mode 100644 index 00000000..afc6cf81 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle Alpha Blend.shader.meta @@ -0,0 +1,17 @@ +fileFormatVersion: 2 +guid: 0b6a9f8b4f707c74ca64c0be8e590de0 +timeCreated: 1496654572 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle + Alpha Blend.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader new file mode 100644 index 00000000..337dcfe7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader @@ -0,0 +1,94 @@ +Shader /*ase_name*/ "Hidden/Templates/Legacy/PostProcess" /*end*/ +{ + Properties + { + _MainTex ( "Screen", 2D ) = "black" {} + /*ase_props*/ + } + + SubShader + { + Tags{ } + + ZTest Always + Cull Off + ZWrite Off + + /*ase_pass*/ + Pass + { + CGPROGRAM + + #pragma vertex vert_img_custom + #pragma fragment frag + #pragma target 3.5 + #include "UnityCG.cginc" + /*ase_pragma*/ + + struct appdata_img_custom + { + float4 vertex : POSITION; + half2 texcoord : TEXCOORD0; + /*ase_vdata:p=p;uv0=tc0*/ + }; + + struct v2f_img_custom + { + float4 pos : SV_POSITION; + half2 uv : TEXCOORD0; + half2 stereoUV : TEXCOORD2; + #if UNITY_UV_STARTS_AT_TOP + half4 uv2 : TEXCOORD1; + half4 stereoUV2 : TEXCOORD3; + #endif + /*ase_interp(4,):sp=sp.xyzw;uv0=tc0.xy;uv1=tc1;uv2=tc2;uv3=tc3*/ + }; + + uniform sampler2D _MainTex; + uniform half4 _MainTex_TexelSize; + uniform half4 _MainTex_ST; + + /*ase_globals*/ + + v2f_img_custom vert_img_custom ( appdata_img_custom v /*ase_vert_input*/ ) + { + v2f_img_custom o; + /*ase_vert_code:v=appdata_img_custom;o=v2f_img_custom*/ + o.pos = UnityObjectToClipPos( v.vertex ); + o.uv = float4( v.texcoord.xy, 1, 1 ); + + #if UNITY_UV_STARTS_AT_TOP + o.uv2 = float4( v.texcoord.xy, 1, 1 ); + o.stereoUV2 = UnityStereoScreenSpaceUVAdjust ( o.uv2, _MainTex_ST ); + + if ( _MainTex_TexelSize.y < 0.0 ) + o.uv.y = 1.0 - o.uv.y; + #endif + o.stereoUV = UnityStereoScreenSpaceUVAdjust ( o.uv, _MainTex_ST ); + return o; + } + + half4 frag ( v2f_img_custom i /*ase_frag_input*/) : SV_Target + { + #ifdef UNITY_UV_STARTS_AT_TOP + half2 uv = i.uv2; + half2 stereoUV = i.stereoUV2; + #else + half2 uv = i.uv; + half2 stereoUV = i.stereoUV; + #endif + + half4 finalColor; + + // ase common template code + /*ase_frag_code:i=v2f_img_custom*/ + + finalColor = /*ase_frag_out:Frag Color;Float4*/half4( 1, 1, 1, 1 )/*end*/; + + return finalColor; + } + ENDCG + } + } + CustomEditor "AmplifyShaderEditor.MaterialInspector" +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader.meta new file mode 100644 index 00000000..b5ec4b67 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: c71b220b631b6344493ea3cf87110c93 +timeCreated: 1499337997 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader new file mode 100644 index 00000000..fc41e939 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader @@ -0,0 +1,114 @@ +Shader /*ase_name*/"Hidden/Templates/Legacy/Sprites Default"/*end*/ +{ + Properties + { + [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} + _Color ("Tint", Color) = (1,1,1,1) + [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 + [PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {} + /*ase_props*/ + } + + SubShader + { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + "PreviewType"="Plane" + "CanUseSpriteAtlas"="True" + } + + Cull Off + Lighting Off + ZWrite Off + Blend One OneMinusSrcAlpha + + /*ase_pass*/ + Pass + { + CGPROGRAM + #ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX + #define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input) + #endif + #pragma vertex vert + #pragma fragment frag + #pragma target 3.5 + #pragma multi_compile _ PIXELSNAP_ON + #pragma multi_compile _ ETC1_EXTERNAL_ALPHA + #include "UnityCG.cginc" + /*ase_pragma*/ + + struct appdata_t + { + float4 vertex : POSITION; + float4 color : COLOR; + float2 texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + /*ase_vdata:p=p;uv0=tc0.xy;c=c*/ + }; + + struct v2f + { + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + float2 texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + /*ase_interp(1,):sp=sp.xyzw;uv0=tc0.xy;c=c*/ + }; + + uniform fixed4 _Color; + uniform float _EnableExternalAlpha; + uniform sampler2D _MainTex; + uniform sampler2D _AlphaTex; + /*ase_globals*/ + + v2f vert( appdata_t IN /*ase_vert_input*/ ) + { + v2f OUT; + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT); + UNITY_TRANSFER_INSTANCE_ID(IN, OUT); + /*ase_vert_code:IN=appdata_t;OUT=v2f*/ + + IN.vertex.xyz += /*ase_vert_out:Offset;Float3*/ float3(0,0,0) /*end*/; + OUT.vertex = UnityObjectToClipPos(IN.vertex); + OUT.texcoord = IN.texcoord; + OUT.color = IN.color * _Color; + #ifdef PIXELSNAP_ON + OUT.vertex = UnityPixelSnap (OUT.vertex); + #endif + + return OUT; + } + + fixed4 SampleSpriteTexture (float2 uv) + { + fixed4 color = tex2D (_MainTex, uv); + +#if ETC1_EXTERNAL_ALPHA + // get the color from an external texture (usecase: Alpha support for ETC1 on android) + fixed4 alpha = tex2D (_AlphaTex, uv); + color.a = lerp (color.a, alpha.r, _EnableExternalAlpha); +#endif //ETC1_EXTERNAL_ALPHA + + return color; + } + + fixed4 frag(v2f IN /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( IN ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN ); + + /*ase_frag_code:IN=v2f*/ + fixed4 c = /*ase_frag_out:Color;Float4*/SampleSpriteTexture (IN.texcoord) * IN.color/*end*/; + c.rgb *= c.a; + return c; + } + ENDCG + } + } + CustomEditor "AmplifyShaderEditor.MaterialInspector" +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader.meta new file mode 100644 index 00000000..71a55400 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 0f8ba0101102bb14ebf021ddadce9b49 +timeCreated: 1500572363 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader new file mode 100644 index 00000000..472ad446 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader @@ -0,0 +1,103 @@ +Shader /*ase_name*/ "Hidden/Templates/Unlit" /*end*/ +{ + Properties + { + /*ase_props*/ + } + + SubShader + { + /*ase_subshader_options:Name=Additional Options + Option:Vertex Position,InvertActionOnDeselection:Absolute,Relative:Relative + Absolute:SetDefine:ASE_ABSOLUTE_VERTEX_POS 1 + Absolute:SetPortName:1,Vertex Position + Relative:SetPortName:1,Vertex Offset + */ + + Tags { "RenderType"="Opaque" } + LOD 100 + + /*ase_all_modules*/ + + /*ase_pass*/ + Pass + { + Name "Unlit" + + CGPROGRAM + + #ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX + //only defining to not throw compilation error over Unity 5.5 + #define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input) + #endif + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_instancing + #include "UnityCG.cginc" + /*ase_pragma*/ + + struct appdata + { + float4 vertex : POSITION; + float4 color : COLOR; + /*ase_vdata:p=p;c=c*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f + { + float4 vertex : SV_POSITION; + #ifdef ASE_NEEDS_FRAG_WORLD_POSITION + float3 worldPos : TEXCOORD0; + #endif + /*ase_interp(1,):sp=sp.xyzw;wp=tc0*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + /*ase_globals*/ + + v2f vert ( appdata v /*ase_vert_input*/) + { + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_TRANSFER_INSTANCE_ID(v, o); + + /*ase_vert_code:v=appdata;o=v2f*/ + float3 vertexValue = float3(0, 0, 0); + #if ASE_ABSOLUTE_VERTEX_POS + vertexValue = v.vertex.xyz; + #endif + vertexValue = /*ase_vert_out:Vertex Offset;Float3*/vertexValue/*end*/; + #if ASE_ABSOLUTE_VERTEX_POS + v.vertex.xyz = vertexValue; + #else + v.vertex.xyz += vertexValue; + #endif + o.vertex = UnityObjectToClipPos(v.vertex); + + #ifdef ASE_NEEDS_FRAG_WORLD_POSITION + o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz; + #endif + return o; + } + + fixed4 frag (v2f i /*ase_frag_input*/) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + fixed4 finalColor; + #ifdef ASE_NEEDS_FRAG_WORLD_POSITION + /*ase_local_var:wp*/float3 WorldPosition = i.worldPos; + #endif + /*ase_frag_code:i=v2f*/ + + finalColor = /*ase_frag_out:Frag Color;Float4*/fixed4(1,1,1,1)/*end*/; + return finalColor; + } + ENDCG + } + } + CustomEditor "AmplifyShaderEditor.MaterialInspector" +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader.meta new file mode 100644 index 00000000..581fbb46 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 0770190933193b94aaa3065e307002fa +timeCreated: 1496328687 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader new file mode 100644 index 00000000..1e3ae37b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader @@ -0,0 +1,127 @@ +Shader /*ase_name*/ "Hidden/Templates/Legacy/UnlitLightmap" /*end*/ +{ + Properties + { + /*ase_props*/ + } + + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 100 + /*ase_all_modules*/ + CGINCLUDE + #ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX + #define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input) + #endif + ENDCG + Pass + { + /*ase_main_pass*/ + Tags{ "LightMode" = "VertexLMRGBM" "RenderType" = "Opaque" } + Name "Unlit LM" + CGPROGRAM + #pragma target 3.5 + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + /*ase_pragma*/ + + struct appdata + { + float4 vertex : POSITION; + UNITY_VERTEX_INPUT_INSTANCE_ID + /*ase_vdata:p=p*/ + }; + + struct v2f + { + float4 vertex : SV_POSITION; + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + /*ase_interp(0,):sp=sp.xyzw*/ + }; + + /*ase_globals*/ + + v2f vert ( appdata v /*ase_vert_input*/) + { + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_TRANSFER_INSTANCE_ID(v, o); + /*ase_vert_code:v=appdata;o=v2f*/ + + v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3;_Vertex*/ float3(0,0,0) /*end*/; + o.vertex = UnityObjectToClipPos(v.vertex); + return o; + } + + fixed4 frag (v2f i /*ase_frag_input*/) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( i ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( i ); + fixed4 finalColor; + /*ase_frag_code:i=v2f*/ + + finalColor = /*ase_frag_out:Frag Color;Float4;_Color*/fixed4(1,1,1,1)/*end*/; + return finalColor; + } + ENDCG + } + + Pass + { + /*ase_hide_pass*/ + Tags{ "LightMode" = "VertexLM" "RenderType" = "Opaque" } + Name "Unlit LM Mobile" + CGPROGRAM + #pragma target 3.5 + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + /*ase_pragma*/ + + struct appdata + { + float4 vertex : POSITION; + UNITY_VERTEX_INPUT_INSTANCE_ID + /*ase_vdata:p=p*/ + }; + + struct v2f + { + float4 vertex : SV_POSITION; + UNITY_VERTEX_OUTPUT_STEREO + /*ase_interp(0,):sp=sp.xyzw*/ + }; + + /*ase_globals*/ + + v2f vert ( appdata v /*ase_vert_input*/) + { + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + /*ase_vert_code:v=appdata;o=v2f*/ + + v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3;_Vertex*/ float3(0,0,0) /*end*/; + o.vertex = UnityObjectToClipPos(v.vertex); + return o; + } + + fixed4 frag (v2f i /*ase_frag_input*/) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( i ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( i ); + fixed4 finalColor; + /*ase_frag_code:i=v2f*/ + + finalColor = /*ase_frag_out:Frag Color;Float4;_Color*/fixed4(1,1,1,1)/*end*/; + return finalColor; + } + ENDCG + } + } + CustomEditor "AmplifyShaderEditor.MaterialInspector" +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader.meta new file mode 100644 index 00000000..214a6820 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 899e609c083c74c4ca567477c39edef0 +timeCreated: 1528987785 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader + uploadId: 723576 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Editor.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/UI.meta similarity index 77% rename from Assets/External/Horizon Based Ambient Occlusion/Editor.meta rename to Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/UI.meta index 0c00a205..c823a232 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Editor.meta +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/UI.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 478a5a24ad1152f43ad164da3759717b +guid: 74496d3592f11304594460822c98f98c folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/UI/UI-Default.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/UI/UI-Default.shader new file mode 100644 index 00000000..177e103c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/UI/UI-Default.shader @@ -0,0 +1,151 @@ +Shader /*ase_name*/"Hidden/Templates/UI-Default"/*end*/ +{ + Properties + { + [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} + _Color ("Tint", Color) = (1,1,1,1) + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _ColorMask ("Color Mask", Float) = 15 + + [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0 + + /*ase_props*/ + } + + SubShader + { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + "PreviewType"="Plane" + "CanUseSpriteAtlas"="True" + } + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull Off + Lighting Off + ZWrite Off + ZTest [unity_GUIZTestMode] + Blend One OneMinusSrcAlpha + ColorMask [_ColorMask] + + /*ase_pass*/ + Pass + { + Name "Default" + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 3.5 + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + + #pragma multi_compile_local _ UNITY_UI_CLIP_RECT + #pragma multi_compile_local _ UNITY_UI_ALPHACLIP + + /*ase_pragma*/ + + struct appdata_t + { + float4 vertex : POSITION; + float4 color : COLOR; + float2 texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + /*ase_vdata:p=p;uv0=tc0.xy;c=c*/ + }; + + struct v2f + { + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + float2 texcoord : TEXCOORD0; + float4 worldPosition : TEXCOORD1; + float4 mask : TEXCOORD2; + UNITY_VERTEX_OUTPUT_STEREO + /*ase_interp(3,):sp=sp.xyzw;uv0=tc0.xy;c=c;uv1=tc1.xyzw*/ + }; + + sampler2D _MainTex; + fixed4 _Color; + fixed4 _TextureSampleAdd; + float4 _ClipRect; + float4 _MainTex_ST; + float _UIMaskSoftnessX; + float _UIMaskSoftnessY; + + /*ase_globals*/ + + v2f vert(appdata_t v /*ase_vert_input*/) + { + v2f OUT; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT); + + /*ase_vert_code:v=appdata_t;OUT=v2f*/ + + v.vertex.xyz += /*ase_vert_out:Offset;Float3*/ float3( 0, 0, 0 ) /*end*/; + + float4 vPosition = UnityObjectToClipPos(v.vertex); + OUT.worldPosition = v.vertex; + OUT.vertex = vPosition; + + float2 pixelSize = vPosition.w; + pixelSize /= float2(1, 1) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + float2 maskUV = (v.vertex.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + OUT.texcoord = v.texcoord; + OUT.mask = float4(v.vertex.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_UIMaskSoftnessX, _UIMaskSoftnessY) + abs(pixelSize.xy))); + + OUT.color = v.color * _Color; + return OUT; + } + + fixed4 frag(v2f IN /*ase_frag_input*/) : SV_Target + { + //Round up the alpha color coming from the interpolator (to 1.0/256.0 steps) + //The incoming alpha could have numerical instability, which makes it very sensible to + //HDR color transparency blend, when it blends with the world's texture. + const half alphaPrecision = half(0xff); + const half invAlphaPrecision = half(1.0/alphaPrecision); + IN.color.a = round(IN.color.a * alphaPrecision)*invAlphaPrecision; + + /*ase_frag_code:IN=v2f*/ + + half4 color = /*ase_frag_out:Color;Float4*/IN.color * (tex2D(_MainTex, TRANSFORM_TEX(IN.texcoord.xy, _MainTex)) + _TextureSampleAdd)/*end*/; + + #ifdef UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw); + color.a *= m.x * m.y; + #endif + + #ifdef UNITY_UI_ALPHACLIP + clip (color.a - 0.001); + #endif + + color.rgb *= color.a; + + return color; + } + ENDCG + } + } + CustomEditor "AmplifyShaderEditor.MaterialInspector" +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/UI/UI-Default.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/UI/UI-Default.shader.meta new file mode 100644 index 00000000..6fbe6c46 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/UI/UI-Default.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 5056123faa0c79b47ab6ad7e8bf059a4 +timeCreated: 1496313583 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/UI/UI-Default.shader + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 10x.unitypackage b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 10x.unitypackage new file mode 100644 index 00000000..dc42a2d9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 10x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5a624e385cb8eec47a29b814df31dadc3c6105b0cfdf80ee4d3e686b36fa1c7 +size 21751 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 10x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 10x.unitypackage.meta new file mode 100644 index 00000000..14116e95 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 10x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: b460b52e6c1feae45b70b7ddc2c45bd6 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 10x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 12x.unitypackage b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 12x.unitypackage new file mode 100644 index 00000000..16e1ff88 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 12x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1813172636ac039694344358689ac29f5d294b3b959cb316d1ada3a983ceca9b +size 37358 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 12x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 12x.unitypackage.meta new file mode 100644 index 00000000..8001daf5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 12x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 57fcea0ed8b5eb347923c4c21fa31b57 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 12x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 14x.unitypackage b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 14x.unitypackage new file mode 100644 index 00000000..88bf5176 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 14x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4a38e1a209d6683ec3afe5b49f6dbf6a2f7b513e6ba787e70c90eb218c01de9 +size 40885 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 14x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 14x.unitypackage.meta new file mode 100644 index 00000000..af83f3c9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 14x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 2e9da72e7e3196146bf7d27450013734 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 14x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 15x.unitypackage b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 15x.unitypackage new file mode 100644 index 00000000..d228f7c7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 15x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f97e9cafbc6e8e190c45553bdf0b4e2a2df06c3e732187cc4d24c38b9d3eea60 +size 39883 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 15x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 15x.unitypackage.meta new file mode 100644 index 00000000..b127c337 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 15x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 0904cdf24ddcd5042b024326476220d5 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 15x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 16x.unitypackage b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 16x.unitypackage new file mode 100644 index 00000000..fee0cc1f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 16x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af7d0d67dae8905c802088e0d8d10d74c10e9ded5cc4f2febfb212d629e432a1 +size 40751 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 16x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 16x.unitypackage.meta new file mode 100644 index 00000000..25fa9a55 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 16x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 929783250050f8a448821b6ca1f2c578 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 16x.unitypackage + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 17x.unitypackage b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 17x.unitypackage new file mode 100644 index 00000000..6dceb6c3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 17x.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:387f8a3a9bff746690ec7275fd3d655d72ff4820e6741573add870fbca66a40e +size 42723 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 17x.unitypackage.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 17x.unitypackage.meta new file mode 100644 index 00000000..a91ec619 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 17x.unitypackage.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 89da50d95d149b744bf10bd27babcf79 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP 17x.unitypackage + uploadId: 723576 diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP.meta similarity index 77% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP.meta rename to Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP.meta index 6f6ed417..6de8e2d6 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP.meta +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4c2f710d028e8644b9e7012d3657c785 +guid: c9e076ae7fba5664dbd278734bf6f8e3 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DCustomLit.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DCustomLit.shader new file mode 100644 index 00000000..cd87ac21 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DCustomLit.shader @@ -0,0 +1,768 @@ +Shader /*ase_name*/ "Hidden/Universal/2D Custom Lit" /*end*/ +{ + Properties + { + /*ase_props*/ + [HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + + SubShader + { + /*ase_subshader_options:Name=Additional Options + Option:Vertex Position:Absolute,Relative:Relative + Absolute:SetDefine:ASE_ABSOLUTE_VERTEX_POS 1 + Absolute:SetPortName:Sprite Lit:4,Vertex Position + Relative:RemoveDefine:ASE_ABSOLUTE_VERTEX_POS 1 + Relative:SetPortName:Sprite Lit:4,Vertex Offset + Option:Debug Display:false,true:false + true:SetDefine:pragma multi_compile _ DEBUG_DISPLAY + false,disable:RemoveDefine:pragma multi_compile _ DEBUG_DISPLAY + */ + + Tags + { + "RenderPipeline"="UniversalPipeline" + "RenderType"="Transparent" + "UniversalMaterialType" = "Lit" + "Queue"="Transparent" + "ShaderGraphShader"="true" + "ShaderGraphTargetId"="" + } + + Cull Off + Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha + ZTest LEqual + ZWrite Off + Offset 0,0 + ColorMask RGBA + /*ase_stencil*/ + + HLSLINCLUDE + #pragma target 2.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d9 // ensure rendering platforms toggle list is visible + + ENDHLSL + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "Sprite Lit" + Tags + { + "LightMode" = "Universal2D" + } + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ DEBUG_DISPLAY SKINNED_SPRITE + + #define _SURFACE_TYPE_TRANSPARENT 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_COLOR + #define FEATURES_GRAPH_VERTEX_NORMAL_OUTPUT + #define FEATURES_GRAPH_VERTEX_TANGENT_OUTPUT + #define VARYINGS_NEED_POSITION_WS + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_COLOR + #define VARYINGS_NEED_SCREENPOSITION + #define FEATURES_GRAPH_VERTEX + + #define SHADERPASS SHADERPASS_SPRITELIT + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl" + + /*ase_pragma*/ + + struct VertexInput + { + float3 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 uv0 : TEXCOORD0; + float4 color : COLOR; + /*ase_vdata:p=p;n=n;t=t;c=c;uv0=tc0*/ + UNITY_SKINNED_VERTEX_INPUTS + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 positionCS : SV_POSITION; + float4 texCoord0 : TEXCOORD0; + float3 positionWS : TEXCOORD1; + float4 color : TEXCOORD2; + float4 screenPosition : TEXCOORD3; + /*ase_interp(4,):sp=sp;uv0=tc0;wp=tc1;c=tc2;spn=tc3*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct SurfaceDescription + { + float3 BaseColor; + float Alpha; + }; + + /*ase_globals*/ + + /*ase_funcs*/ + + VertexOutput vert( VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_SKINNED_VERTEX_COMPUTE(v); + + v.positionOS = UnityFlipSprite( v.positionOS, unity_SpriteProps.xy ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.positionOS; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.positionOS = vertexValue; + #else + v.positionOS += vertexValue; + #endif + v.normal = /*ase_vert_out:Vertex Normal;Float3;3;-1;_VNormal*/v.normal/*end*/; + v.tangent.xyz = /*ase_vert_out:Vertex Tangent;Float3;4;-1;_VTangent*/v.tangent.xyz/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS); + + o.positionCS = vertexInput.positionCS; + o.positionWS.xyz = vertexInput.positionWS; + o.texCoord0.xyzw = v.uv0; + o.color.xyzw = v.color; + o.screenPosition.xyzw = vertexInput.positionNDC; + + return o; + } + + half4 frag( VertexOutput IN /*ase_frag_input*/ ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + /*ase_local_var:sp*/float4 positionCS = IN.positionCS; + /*ase_local_var:wp*/float3 positionWS = IN.positionWS; + + /*ase_frag_code:IN=VertexOutput*/ + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + surfaceDescription.BaseColor = /*ase_frag_out:Color;Float3;0;-1;_Color*/IsGammaSpace() ? float3(0.5, 0.5, 0.5) : SRGBToLinear(float3(0.5, 0.5, 0.5))/*end*/; + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;1;-1;_Alpha*/1/*end*/; + + half4 color = half4(surfaceDescription.BaseColor, surfaceDescription.Alpha); + + #if defined(DEBUG_DISPLAY) + SurfaceData2D surfaceData; + InitializeSurfaceData(color.rgb, color.a, surfaceData); + InputData2D inputData; + InitializeInputData(positionWS.xy, half2(IN.texCoord0.xy), inputData); + half4 debugColor = 0; + + SETUP_DEBUG_DATA_2D(inputData, positionWS, positionCS); + + if (CanDebugOverrideOutputColor(surfaceData, inputData, debugColor)) + { + return debugColor; + } + #endif + + color *= IN.color * unity_SpriteColor; + return color; + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "Sprite Normal" + Tags + { + "LightMode" = "NormalsRendering" + } + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ SKINNED_SPRITE + + #define _SURFACE_TYPE_TRANSPARENT 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define FEATURES_GRAPH_VERTEX_NORMAL_OUTPUT + #define FEATURES_GRAPH_VERTEX_TANGENT_OUTPUT + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_TANGENT_WS + #define FEATURES_GRAPH_VERTEX + + #define SHADERPASS SHADERPASS_SPRITENORMAL + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/NormalsRenderingShared.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + /*ase_pragma*/ + + /*ase_globals*/ + + struct VertexInput + { + float3 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + /*ase_vdata:p=p;n=n;t=t*/ + UNITY_SKINNED_VERTEX_INPUTS + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 positionCS : SV_POSITION; + float3 normalWS : TEXCOORD0; + float4 tangentWS : TEXCOORD1; + /*ase_interp(2,):sp=sp;wn=tc0;wt=tc1*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct SurfaceDescription + { + float3 NormalTS; + float Alpha; + }; + + /*ase_funcs*/ + + VertexOutput vert( VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_SKINNED_VERTEX_COMPUTE(v); + + v.positionOS = UnityFlipSprite( v.positionOS, unity_SpriteProps.xy ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.positionOS; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.positionOS = vertexValue; + #else + v.positionOS += vertexValue; + #endif + v.normal = /*ase_vert_out:Vertex Normal;Float3;3;-1;_VNormal*/v.normal/*end*/; + v.tangent.xyz = /*ase_vert_out:Vertex Tangent;Float3;4;-1;_VTangent*/v.tangent.xyz/*end*/; + + float3 positionWS = TransformObjectToWorld(v.positionOS); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + o.positionCS = TransformWorldToHClip(positionWS); + o.normalWS.xyz = -GetViewForwardDir(); + o.tangentWS.xyzw = tangentWS; + return o; + } + + half4 frag( VertexOutput IN /*ase_frag_input*/ ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + /*ase_frag_code:IN=VertexOutput*/ + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + surfaceDescription.NormalTS = /*ase_frag_out:Normal;Float3;0;-1;_Normal*/float3(0.0f, 0.0f, 1.0f)/*end*/; + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;1;-1;_Alpha*/1/*end*/; + + half crossSign = (IN.tangentWS.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale(); + half3 bitangent = crossSign * cross(IN.normalWS.xyz, IN.tangentWS.xyz); + half4 color = half4(1.0,1.0,1.0, surfaceDescription.Alpha); + + return NormalsRenderingShared(color, surfaceDescription.NormalTS, IN.tangentWS.xyz, bitangent, IN.normalWS); + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "SceneSelectionPass" + Tags + { + "LightMode" = "SceneSelectionPass" + } + + Cull Off + Blend Off + ZTest LEqual + ZWrite On + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ DEBUG_DISPLAY SKINNED_SPRITE + + #define _SURFACE_TYPE_TRANSPARENT 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define FEATURES_GRAPH_VERTEX_NORMAL_OUTPUT + #define FEATURES_GRAPH_VERTEX_TANGENT_OUTPUT + #define FEATURES_GRAPH_VERTEX + + #define SHADERPASS SHADERPASS_DEPTHONLY + #define SCENESELECTIONPASS 1 + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + /*ase_pragma*/ + + /*ase_globals*/ + + struct VertexInput + { + float3 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + /*ase_vdata:p=p;n=n;t=t*/ + UNITY_SKINNED_VERTEX_INPUTS + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 positionCS : SV_POSITION; + /*ase_interp(0,):sp=sp*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + int _ObjectId; + int _PassValue; + + struct SurfaceDescription + { + float Alpha; + }; + + /*ase_funcs*/ + + VertexOutput vert(VertexInput v /*ase_vert_input*/) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + UNITY_SKINNED_VERTEX_COMPUTE(v); + + v.positionOS = UnityFlipSprite( v.positionOS, unity_SpriteProps.xy ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.positionOS; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;1;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.positionOS = vertexValue; + #else + v.positionOS += vertexValue; + #endif + + float3 positionWS = TransformObjectToWorld(v.positionOS); + o.positionCS = TransformWorldToHClip(positionWS); + + return o; + } + + half4 frag(VertexOutput IN/*ase_frag_input*/) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + /*ase_frag_code:IN=VertexOutput*/ + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + return outColor; + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + Cull Off + Blend Off + ZTest LEqual + ZWrite On + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ DEBUG_DISPLAY SKINNED_SPRITE + + #define _SURFACE_TYPE_TRANSPARENT 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define FEATURES_GRAPH_VERTEX_NORMAL_OUTPUT + #define FEATURES_GRAPH_VERTEX_TANGENT_OUTPUT + #define FEATURES_GRAPH_VERTEX + + #define SHADERPASS SHADERPASS_DEPTHONLY + #define SCENEPICKINGPASS 1 + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + /*ase_pragma*/ + + /*ase_globals*/ + + struct VertexInput + { + float3 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + /*ase_vdata:p=p;n=n;t=t*/ + UNITY_SKINNED_VERTEX_INPUTS + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 positionCS : SV_POSITION; + /*ase_interp(0,):sp=sp*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + float4 _SelectionID; + + struct SurfaceDescription + { + float Alpha; + }; + + /*ase_funcs*/ + + VertexOutput vert(VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_SKINNED_VERTEX_COMPUTE(v); + + v.positionOS = UnityFlipSprite( v.positionOS, unity_SpriteProps.xy ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.positionOS; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;1;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.positionOS = vertexValue; + #else + v.positionOS += vertexValue; + #endif + + float3 positionWS = TransformObjectToWorld(v.positionOS); + o.positionCS = TransformWorldToHClip(positionWS); + + return o; + } + + half4 frag(VertexOutput IN /*ase_frag_input*/) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + /*ase_frag_code:IN=VertexOutput*/ + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = _SelectionID; + return outColor; + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_main_pass*/ + Name "Sprite Forward" + Tags + { + "LightMode" = "UniversalForward" + } + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ SKINNED_SPRITE + + #define _SURFACE_TYPE_TRANSPARENT 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_COLOR + #define FEATURES_GRAPH_VERTEX_NORMAL_OUTPUT + #define FEATURES_GRAPH_VERTEX_TANGENT_OUTPUT + #define VARYINGS_NEED_POSITION_WS + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_COLOR + #define FEATURES_GRAPH_VERTEX + + #define SHADERPASS SHADERPASS_SPRITEFORWARD + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl" + + /*ase_pragma*/ + + /*ase_globals*/ + + struct VertexInput + { + float3 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 uv0 : TEXCOORD0; + float4 color : COLOR; + /*ase_vdata:p=p;n=n;t=t;c=c;uv0=tc0*/ + UNITY_SKINNED_VERTEX_INPUTS + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 positionCS : SV_POSITION; + float4 texCoord0 : TEXCOORD0; + float3 positionWS : TEXCOORD1; + float4 color : TEXCOORD2; + /*ase_interp(3,):sp=sp;uv0=tc0;wp=tc1;c=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct SurfaceDescription + { + float3 BaseColor; + float Alpha; + float3 NormalTS; + }; + + /*ase_funcs*/ + + VertexOutput vert( VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o; + ZERO_INITIALIZE(VertexOutput, o); + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_SKINNED_VERTEX_COMPUTE(v); + + v.positionOS = UnityFlipSprite( v.positionOS, unity_SpriteProps.xy ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.positionOS; + #else + float3 defaultVertexValue = float3( 0, 0, 0 ); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;3;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.positionOS = vertexValue; + #else + v.positionOS += vertexValue; + #endif + v.normal = /*ase_vert_out:Vertex Normal;Float3;4;-1;_VNormal*/v.normal/*end*/; + v.tangent.xyz = /*ase_vert_out:Vertex Tangent;Float3;5;-1;_VTangent*/v.tangent.xyz/*end*/; + + float3 positionWS = TransformObjectToWorld(v.positionOS); + + o.positionCS = TransformWorldToHClip(positionWS); + o.positionWS.xyz = positionWS; + o.texCoord0.xyzw = v.uv0; + o.color.xyzw = v.color; + + return o; + } + + half4 frag( VertexOutput IN /*ase_frag_input*/ ) : SV_TARGET + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + /*ase_local_var:sp*/float4 positionCS = IN.positionCS; + /*ase_local_var:wp*/float3 positionWS = IN.positionWS; + + /*ase_frag_code:IN=VertexOutput*/ + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + surfaceDescription.BaseColor = /*ase_frag_out:Color;Float3;0;-1;_Color*/IsGammaSpace() ? float3(0.5, 0.5, 0.5) : SRGBToLinear(float3(0.5, 0.5, 0.5))/*end*/; + surfaceDescription.NormalTS = /*ase_frag_out:Normal;Float3;1;-1;_Normal*/float3(0.0f, 0.0f, 1.0f)/*end*/; + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;2;-1;_Alpha*/1/*end*/; + + + half4 color = half4(surfaceDescription.BaseColor, surfaceDescription.Alpha); + + #if defined(DEBUG_DISPLAY) + SurfaceData2D surfaceData; + InitializeSurfaceData(color.rgb, color.a, surfaceData); + InputData2D inputData; + InitializeInputData(positionWS.xy, half2(IN.texCoord0.xy), inputData); + half4 debugColor = 0; + + SETUP_DEBUG_DATA_2D(inputData, positionWS, positionCS); + + if (CanDebugOverrideOutputColor(surfaceData, inputData, debugColor)) + { + return debugColor; + } + #endif + + color *= IN.color; + return color; + } + + ENDHLSL + } + /*ase_pass_end*/ + } + CustomEditor "UnityEditor.ShaderGraph.GenericShaderGraphMaterialGUI" + FallBack "Hidden/Shader Graph/FallbackError" +} diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DCustomLit.shader.meta similarity index 58% rename from Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO.shader.meta rename to Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DCustomLit.shader.meta index c6811917..fcbee904 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO.shader.meta +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DCustomLit.shader.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 7b834eafaedd0d842bb05a969d9d14bd -timeCreated: 1453645791 -licenseType: Store +guid: ece0159bad6633944bf6b818f4dd296c +timeCreated: 1639679966 +licenseType: Pro ShaderImporter: defaultTextures: [] userData: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DLit.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DLit.shader new file mode 100644 index 00000000..6a901a03 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DLit.shader @@ -0,0 +1,752 @@ +Shader /*ase_name*/ "Hidden/Universal/2D Lit" /*end*/ +{ + Properties + { + /*ase_props*/ + [HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + + SubShader + { + /*ase_subshader_options:Name=Additional Options + Option:Vertex Position:Absolute,Relative:Relative + Absolute:SetDefine:ASE_ABSOLUTE_VERTEX_POS 1 + Absolute:SetPortName:Sprite Lit:4,Vertex Position + Relative:RemoveDefine:ASE_ABSOLUTE_VERTEX_POS 1 + Relative:SetPortName:Sprite Lit:4,Vertex Offset + Option:Debug Display:false,true:false + true:SetDefine:pragma multi_compile _ DEBUG_DISPLAY + false,disable:RemoveDefine:pragma multi_compile _ DEBUG_DISPLAY + Option:External Alpha:false,true:false + true:SetDefine:pragma multi_compile _ ETC1_EXTERNAL_ALPHA + false,disable:RemoveDefine:pragma multi_compile _ ETC1_EXTERNAL_ALPHA + */ + + Tags + { + "RenderPipeline" = "UniversalPipeline" + "RenderType" = "Transparent" + "Queue" = "Transparent+0" + "UniversalMaterialType" = "Lit" + "ShaderGraphShader"="true" + "ShaderGraphTargetId"="" + } + + Cull Off + + HLSLINCLUDE + #pragma target 2.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d9 // ensure rendering platforms toggle list is visible + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl" + + ENDHLSL + + /*ase_pass*/ + Pass + { + Name "Sprite Lit" + Tags + { + "LightMode" = "Universal2D" + } + + Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha + ZTest LEqual + ZWrite Off + Offset 0,0 + ColorMask RGBA + /*ase_stencil*/ + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ DEBUG_DISPLAY SKINNED_SPRITE + + #pragma multi_compile _ USE_SHAPE_LIGHT_TYPE_0 + #pragma multi_compile _ USE_SHAPE_LIGHT_TYPE_1 + #pragma multi_compile _ USE_SHAPE_LIGHT_TYPE_2 + #pragma multi_compile _ USE_SHAPE_LIGHT_TYPE_3 + + #define _SURFACE_TYPE_TRANSPARENT 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_COLOR + #define FEATURES_GRAPH_VERTEX_NORMAL_OUTPUT + #define FEATURES_GRAPH_VERTEX_TANGENT_OUTPUT + #define VARYINGS_NEED_POSITION_WS + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_COLOR + #define VARYINGS_NEED_SCREENPOSITION + #define FEATURES_GRAPH_VERTEX + + #define SHADERPASS SHADERPASS_SPRITELIT + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl" + + #if USE_SHAPE_LIGHT_TYPE_0 + SHAPE_LIGHT(0) + #endif + + #if USE_SHAPE_LIGHT_TYPE_1 + SHAPE_LIGHT(1) + #endif + + #if USE_SHAPE_LIGHT_TYPE_2 + SHAPE_LIGHT(2) + #endif + + #if USE_SHAPE_LIGHT_TYPE_3 + SHAPE_LIGHT(3) + #endif + + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/CombinedShapeLightShared.hlsl" + + /*ase_pragma*/ + + /*ase_globals*/ + + struct VertexInput + { + float3 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 uv0 : TEXCOORD0; + float4 color : COLOR; + /*ase_vdata:p=p;n=n;t=t;c=c;uv0=tc0*/ + UNITY_SKINNED_VERTEX_INPUTS + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 positionCS : SV_POSITION; + float4 texCoord0 : TEXCOORD0; + float4 color : TEXCOORD1; + float4 screenPosition : TEXCOORD2; + float3 positionWS : TEXCOORD3; + /*ase_interp(4,):sp=sp;uv0=tc0;*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #if ETC1_EXTERNAL_ALPHA + TEXTURE2D(_AlphaTex); SAMPLER(sampler_AlphaTex); + float _EnableAlphaTexture; + #endif + + /*ase_funcs*/ + + VertexOutput vert( VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o = (VertexOutput)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_SKINNED_VERTEX_COMPUTE(v); + + v.positionOS = UnityFlipSprite( v.positionOS, unity_SpriteProps.xy ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.positionOS; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;4;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.positionOS = vertexValue; + #else + v.positionOS += vertexValue; + #endif + v.normal = /*ase_vert_out:Vertex Normal;Float3;5;-1;_VNormal*/v.normal/*end*/; + v.tangent.xyz = /*ase_vert_out:Vertex Tangent;Float3;6;-1;_VTangent*/v.tangent.xyz/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS); + + o.positionCS = vertexInput.positionCS; + o.positionWS = vertexInput.positionWS; + o.texCoord0 = v.uv0; + o.color = v.color; + o.screenPosition = vertexInput.positionNDC; + return o; + } + + half4 frag( VertexOutput IN /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + /*ase_local_var:sp*/float4 positionCS = IN.positionCS; + /*ase_local_var:wp*/float3 positionWS = IN.positionWS; + + /*ase_frag_code:IN=VertexOutput*/ + float4 Color = /*ase_frag_out:Color;Float4;1;-1;_Color*/float4( 1, 1, 1, 1 )/*end*/; + float4 Mask = /*ase_frag_out:Mask;Float4;2;-1;_Mask*/float4(1,1,1,1)/*end*/; + float3 Normal = /*ase_frag_out:Normal;Float3;3;-1;_Normal*/float3( 0, 0, 1 )/*end*/; + + #if ETC1_EXTERNAL_ALPHA + float4 alpha = SAMPLE_TEXTURE2D(_AlphaTex, sampler_AlphaTex, IN.texCoord0.xy); + Color.a = lerp( Color.a, alpha.r, _EnableAlphaTexture); + #endif + + SurfaceData2D surfaceData; + InitializeSurfaceData(Color.rgb, Color.a, Mask, surfaceData); + InputData2D inputData; + InitializeInputData(IN.texCoord0.xy, half2(IN.screenPosition.xy / IN.screenPosition.w), inputData); + SETUP_DEBUG_DATA_2D(inputData, positionWS, positionCS); + return CombinedShapeLightShared(surfaceData, inputData); + + Color *= IN.color; + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass:SyncP*/ + Name "Sprite Normal" + Tags + { + "LightMode" = "NormalsRendering" + } + + Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha + ZTest LEqual + ZWrite Off + Offset 0,0 + ColorMask RGBA + /*ase_stencil*/ + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ SKINNED_SPRITE + + #define _SURFACE_TYPE_TRANSPARENT 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define FEATURES_GRAPH_VERTEX_NORMAL_OUTPUT + #define FEATURES_GRAPH_VERTEX_TANGENT_OUTPUT + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_TANGENT_WS + #define FEATURES_GRAPH_VERTEX + + #define SHADERPASS SHADERPASS_SPRITENORMAL + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/NormalsRenderingShared.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + /*ase_pragma*/ + + /*ase_globals*/ + + struct VertexInput + { + float3 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 uv0 : TEXCOORD0; + float4 color : COLOR; + /*ase_vdata:p=p;n=n;t=t;c=c;uv0=tc0*/ + UNITY_SKINNED_VERTEX_INPUTS + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 positionCS : SV_POSITION; + float4 texCoord0 : TEXCOORD0; + float4 color : TEXCOORD1; + float3 normalWS : TEXCOORD2; + float4 tangentWS : TEXCOORD3; + float3 bitangentWS : TEXCOORD4; + /*ase_interp(5,):sp=sp;uv0=tc0;c=tc1;wn=tc2;wt=tc3;wbt=tc4*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + /*ase_funcs*/ + + VertexOutput vert( VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o = (VertexOutput)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_SKINNED_VERTEX_COMPUTE(v); + + v.positionOS = UnityFlipSprite( v.positionOS, unity_SpriteProps.xy ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.positionOS; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;3;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.positionOS = vertexValue; + #else + v.positionOS += vertexValue; + #endif + v.normal = /*ase_vert_out:Vertex Normal;Float3;4;-1;_VNormal*/v.normal/*end*/; + v.tangent.xyz = /*ase_vert_out:Vertex Tangent;Float3;5;-1;_VTangent*/v.tangent.xyz/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS); + + o.texCoord0 = v.uv0; + o.color = v.color; + o.positionCS = vertexInput.positionCS; + + float3 normalWS = TransformObjectToWorldNormal(v.normal); + o.normalWS = -GetViewForwardDir(); + float4 tangentWS = float4( TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + o.tangentWS = normalize(tangentWS); + half crossSign = (tangentWS.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale(); + o.bitangentWS = crossSign * cross(normalWS, tangentWS.xyz) * tangentWS.w; + return o; + } + + half4 frag( VertexOutput IN /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + /*ase_frag_code:IN=VertexOutput*/ + float4 Color = /*ase_frag_out:Color;Float4;1;-1;_Color*/float4( 1, 1, 1, 1 )/*end*/; + float3 Normal = /*ase_frag_out:Normal;Float3;2;-1;_Normal*/float3( 0, 0, 1 )/*end*/; + + Color *= IN.color; + + return NormalsRenderingShared(Color, Normal, IN.tangentWS.xyz, IN.bitangentWS, IN.normalWS); + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass:SyncP*/ + Name "Sprite Forward" + Tags + { + "LightMode" = "UniversalForward" + } + + Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha + ZTest LEqual + ZWrite Off + Offset 0,0 + ColorMask RGBA + /*ase_stencil*/ + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ SKINNED_SPRITE + + #define _SURFACE_TYPE_TRANSPARENT 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_COLOR + #define FEATURES_GRAPH_VERTEX_NORMAL_OUTPUT + #define FEATURES_GRAPH_VERTEX_TANGENT_OUTPUT + #define VARYINGS_NEED_POSITION_WS + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_COLOR + #define FEATURES_GRAPH_VERTEX + + #define SHADERPASS SHADERPASS_SPRITEFORWARD + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl" + + /*ase_pragma*/ + + /*ase_globals*/ + + struct VertexInput + { + float3 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 uv0 : TEXCOORD0; + float4 color : COLOR; + /*ase_vdata:p=p;n=n;t=t;c=c;uv0=tc0*/ + UNITY_SKINNED_VERTEX_INPUTS + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 positionCS : SV_POSITION; + float4 texCoord0 : TEXCOORD0; + float4 color : TEXCOORD1; + float3 positionWS : TEXCOORD2; + /*ase_interp(3,):sp=sp;uv0=tc0;c=tc1*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #if ETC1_EXTERNAL_ALPHA + TEXTURE2D( _AlphaTex ); SAMPLER( sampler_AlphaTex ); + float _EnableAlphaTexture; + #endif + + /*ase_funcs*/ + + VertexOutput vert( VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_SKINNED_VERTEX_COMPUTE( v ); + + v.positionOS = UnityFlipSprite( v.positionOS, unity_SpriteProps.xy ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.positionOS; + #else + float3 defaultVertexValue = float3( 0, 0, 0 ); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;3;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.positionOS = vertexValue; + #else + v.positionOS += vertexValue; + #endif + v.normal = /*ase_vert_out:Vertex Normal;Float3;4;-1;_VNormal*/v.normal/*end*/; + v.tangent.xyz = /*ase_vert_out:Vertex Tangent;Float3;5;-1;_VTangent*/v.tangent.xyz/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS); + + o.positionCS = vertexInput.positionCS; + o.positionWS = vertexInput.positionWS; + o.texCoord0 = v.uv0; + o.color = v.color; + + return o; + } + + half4 frag( VertexOutput IN /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + /*ase_local_var:sp*/float4 positionCS = IN.positionCS; + /*ase_local_var:wp*/float3 positionWS = IN.positionWS; + + /*ase_frag_code:IN=VertexOutput*/ + float4 Color = /*ase_frag_out:Color;Float4;1;-1;_Color*/float4( 1, 1, 1, 1 )/*end*/; + + #if defined(DEBUG_DISPLAY) + SurfaceData2D surfaceData; + InitializeSurfaceData(Color.rgb, Color.a, surfaceData); + InputData2D inputData; + InitializeInputData(positionWS.xy, half2(IN.texCoord0.xy), inputData); + half4 debugColor = 0; + + SETUP_DEBUG_DATA_2D(inputData, positionWS, positionCS); + + if (CanDebugOverrideOutputColor(surfaceData, inputData, debugColor)) + { + return debugColor; + } + #endif + + #if ETC1_EXTERNAL_ALPHA + float4 alpha = SAMPLE_TEXTURE2D( _AlphaTex, sampler_AlphaTex, IN.texCoord0.xy ); + Color.a = lerp( Color.a, alpha.r, _EnableAlphaTexture ); + #endif + + Color *= IN.color; + return Color; + } + + ENDHLSL + } + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "SceneSelectionPass" + Tags + { + "LightMode" = "SceneSelectionPass" + } + + Cull Off + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ DEBUG_DISPLAY SKINNED_SPRITE + + #define _SURFACE_TYPE_TRANSPARENT 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define FEATURES_GRAPH_VERTEX_NORMAL_OUTPUT + #define FEATURES_GRAPH_VERTEX_TANGENT_OUTPUT + #define FEATURES_GRAPH_VERTEX + + #define SHADERPASS SHADERPASS_DEPTHONLY + #define SCENESELECTIONPASS 1 + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + /*ase_pragma*/ + + /*ase_globals*/ + + struct VertexInput + { + float3 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + /*ase_vdata:p=p;n=n;t=t*/ + UNITY_SKINNED_VERTEX_INPUTS + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 positionCS : SV_POSITION; + /*ase_interp(0,):sp=sp*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + int _ObjectId; + int _PassValue; + + /*ase_funcs*/ + + VertexOutput vert(VertexInput v /*ase_vert_input*/) + { + VertexOutput o = (VertexOutput)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_SKINNED_VERTEX_COMPUTE(v); + + v.positionOS = UnityFlipSprite( v.positionOS, unity_SpriteProps.xy ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.positionOS; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;1;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.positionOS = vertexValue; + #else + v.positionOS += vertexValue; + #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS); + float3 positionWS = TransformObjectToWorld(v.positionOS); + o.positionCS = TransformWorldToHClip(positionWS); + + return o; + } + + half4 frag(VertexOutput IN/*ase_frag_input*/) : SV_TARGET + { + /*ase_frag_code:IN=VertexOutput*/ + float4 Color = /*ase_frag_out:Color;Float4;0;-1;_Color*/float4( 1, 1, 1, 1 )/*end*/; + + half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + return outColor; + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + Cull Off + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ DEBUG_DISPLAY SKINNED_SPRITE + + #define _SURFACE_TYPE_TRANSPARENT 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define FEATURES_GRAPH_VERTEX_NORMAL_OUTPUT + #define FEATURES_GRAPH_VERTEX_TANGENT_OUTPUT + #define FEATURES_GRAPH_VERTEX + + #define SHADERPASS SHADERPASS_DEPTHONLY + #define SCENEPICKINGPASS 1 + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + /*ase_pragma*/ + + /*ase_globals*/ + + struct VertexInput + { + float3 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + /*ase_vdata:p=p;n=n;t=t*/ + UNITY_SKINNED_VERTEX_INPUTS + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 positionCS : SV_POSITION; + /*ase_interp(0,):sp=sp*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + float4 _SelectionID; + + /*ase_funcs*/ + + VertexOutput vert(VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o = (VertexOutput)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_SKINNED_VERTEX_COMPUTE(v); + + v.positionOS = UnityFlipSprite( v.positionOS, unity_SpriteProps.xy ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.positionOS; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;1;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.positionOS = vertexValue; + #else + v.positionOS += vertexValue; + #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS); + float3 positionWS = TransformObjectToWorld(v.positionOS); + o.positionCS = TransformWorldToHClip(positionWS); + + return o; + } + + half4 frag(VertexOutput IN /*ase_frag_input*/) : SV_TARGET + { + /*ase_frag_code:IN=VertexOutput*/ + float4 Color = /*ase_frag_out:Color;Float4;0;-1;_Color*/float4( 1, 1, 1, 1 )/*end*/; + half4 outColor = _SelectionID; + return outColor; + } + + ENDHLSL + } + /*ase_pass_end*/ + } + CustomEditor "UnityEditor.ShaderGraph.GenericShaderGraphMaterialGUI" + FallBack "Hidden/Shader Graph/FallbackError" +} diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Blur.cginc.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DLit.shader.meta similarity index 58% rename from Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Blur.cginc.meta rename to Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DLit.shader.meta index c1a18e69..6bf2a5c1 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Blur.cginc.meta +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DLit.shader.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 6fd3fc8e7b174414084ef2a2f3ce7cc0 -timeCreated: 1453540070 -licenseType: Store +guid: 199187dac283dbe4a8cb1ea611d70c58 +timeCreated: 1568647145 +licenseType: Pro ShaderImporter: defaultTextures: [] userData: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DUnlit.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DUnlit.shader new file mode 100644 index 00000000..66762e2d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DUnlit.shader @@ -0,0 +1,592 @@ +Shader /*ase_name*/ "Hidden/Universal/2D Unlit" /*end*/ +{ + Properties + { + /*ase_props*/ + [HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + + SubShader + { + /*ase_subshader_options:Name=Additional Options + Option:Vertex Position:Absolute,Relative:Relative + Absolute:SetDefine:ASE_ABSOLUTE_VERTEX_POS 1 + Absolute:SetPortName:Sprite Unlit:3,Vertex Position + Relative:RemoveDefine:ASE_ABSOLUTE_VERTEX_POS 1 + Relative:SetPortName:Sprite Unlit:3,Vertex Offset + Option:Debug Display:false,true:false + true:SetDefine:pragma multi_compile _ DEBUG_DISPLAY + false,disable:RemoveDefine:pragma multi_compile _ DEBUG_DISPLAY + Option:External Alpha:false,true:false + true:SetDefine:pragma multi_compile _ ETC1_EXTERNAL_ALPHA + false,disable:RemoveDefine:pragma multi_compile _ ETC1_EXTERNAL_ALPHA + */ + + Tags + { + "RenderPipeline" = "UniversalPipeline" + "RenderType" = "Transparent" + "Queue" = "Transparent+0" + } + + Cull Off + + HLSLINCLUDE + #pragma target 2.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d9 // ensure rendering platforms toggle list is visible + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl" + + ENDHLSL + + /*ase_pass*/ + Pass + { + Name "Sprite Unlit" + Tags + { + "LightMode" = "Universal2D" + } + + Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha + ZTest LEqual + ZWrite Off + Offset 0,0 + ColorMask RGBA + /*ase_stencil*/ + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ DEBUG_DISPLAY SKINNED_SPRITE + + #define _SURFACE_TYPE_TRANSPARENT 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_COLOR + #define FEATURES_GRAPH_VERTEX_NORMAL_OUTPUT + #define FEATURES_GRAPH_VERTEX_TANGENT_OUTPUT + #define VARYINGS_NEED_POSITION_WS + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_COLOR + #define FEATURES_GRAPH_VERTEX + + #define SHADERPASS SHADERPASS_SPRITEUNLIT + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl" + + /*ase_pragma*/ + + /*ase_globals*/ + + struct VertexInput + { + float3 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 uv0 : TEXCOORD0; + float4 color : COLOR; + /*ase_vdata:p=p;n=n;t=t;c=c;uv0=tc0*/ + UNITY_SKINNED_VERTEX_INPUTS + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 positionCS : SV_POSITION; + float4 texCoord0 : TEXCOORD0; + float4 color : TEXCOORD1; + float3 positionWS : TEXCOORD2; + /*ase_interp(3,):sp=sp;uv0=tc0;c=tc1*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #if ETC1_EXTERNAL_ALPHA + TEXTURE2D(_AlphaTex); SAMPLER(sampler_AlphaTex); + float _EnableAlphaTexture; + #endif + + /*ase_funcs*/ + + VertexOutput vert( VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o = (VertexOutput)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_SKINNED_VERTEX_COMPUTE( v ); + + v.positionOS = UnityFlipSprite( v.positionOS, unity_SpriteProps.xy ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.positionOS; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;3;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.positionOS = vertexValue; + #else + v.positionOS += vertexValue; + #endif + v.normal = /*ase_vert_out:Vertex Normal;Float3;4;-1;_VNormal*/v.normal/*end*/; + v.tangent.xyz = /*ase_vert_out:Vertex Tangent;Float3;5;-1;_VTangent*/v.tangent.xyz/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS); + + o.positionCS = vertexInput.positionCS; + o.positionWS = vertexInput.positionWS; + o.texCoord0 = v.uv0; + o.color = v.color; + return o; + } + + half4 frag( VertexOutput IN /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + /*ase_local_var:sp*/float4 positionCS = IN.positionCS; + /*ase_local_var:wp*/float3 positionWS = IN.positionWS; + + /*ase_frag_code:IN=VertexOutput*/ + float4 Color = /*ase_frag_out:Color;Float4;1;-1;_Color*/float4( 1, 1, 1, 1 )/*end*/; + + #if ETC1_EXTERNAL_ALPHA + float4 alpha = SAMPLE_TEXTURE2D(_AlphaTex, sampler_AlphaTex, IN.texCoord0.xy); + Color.a = lerp( Color.a, alpha.r, _EnableAlphaTexture); + #endif + + #if defined(DEBUG_DISPLAY) + SurfaceData2D surfaceData; + InitializeSurfaceData(Color.rgb, Color.a, surfaceData); + InputData2D inputData; + InitializeInputData(positionWS.xy, half2(IN.texCoord0.xy), inputData); + half4 debugColor = 0; + + SETUP_DEBUG_DATA_2D(inputData, positionWS, positionCS); + + if (CanDebugOverrideOutputColor(surfaceData, inputData, debugColor)) + { + return debugColor; + } + #endif + + Color *= IN.color * unity_SpriteColor; + return Color; + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass:SyncP*/ + Name "Sprite Unlit Forward" + Tags + { + "LightMode" = "UniversalForward" + } + + Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha + ZTest LEqual + ZWrite Off + Offset 0,0 + ColorMask RGBA + /*ase_stencil*/ + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ DEBUG_DISPLAY SKINNED_SPRITE + + #define _SURFACE_TYPE_TRANSPARENT 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_COLOR + #define FEATURES_GRAPH_VERTEX_NORMAL_OUTPUT + #define FEATURES_GRAPH_VERTEX_TANGENT_OUTPUT + #define VARYINGS_NEED_POSITION_WS + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_COLOR + #define FEATURES_GRAPH_VERTEX + + #define SHADERPASS SHADERPASS_SPRITEFORWARD + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl" + + /*ase_pragma*/ + + /*ase_globals*/ + + struct VertexInput + { + float3 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 uv0 : TEXCOORD0; + float4 color : COLOR; + /*ase_vdata:p=p;n=n;t=t;c=c;uv0=tc0*/ + UNITY_SKINNED_VERTEX_INPUTS + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 positionCS : SV_POSITION; + float4 texCoord0 : TEXCOORD0; + float4 color : TEXCOORD1; + float3 positionWS : TEXCOORD2; + /*ase_interp(3,):sp=sp;uv0=tc0;c=tc1*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #if ETC1_EXTERNAL_ALPHA + TEXTURE2D( _AlphaTex ); SAMPLER( sampler_AlphaTex ); + float _EnableAlphaTexture; + #endif + + /*ase_funcs*/ + + VertexOutput vert( VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o = (VertexOutput)0; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_SKINNED_VERTEX_COMPUTE( v ); + + v.positionOS = UnityFlipSprite( v.positionOS, unity_SpriteProps.xy ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.positionOS; + #else + float3 defaultVertexValue = float3( 0, 0, 0 ); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;3;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.positionOS = vertexValue; + #else + v.positionOS += vertexValue; + #endif + v.normal = /*ase_vert_out:Vertex Normal;Float3;4;-1;_VNormal*/v.normal/*end*/; + v.tangent.xyz = /*ase_vert_out:Vertex Tangent;Float3;5;-1;_VTangent*/v.tangent.xyz/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS); + + o.positionCS = vertexInput.positionCS; + o.positionWS = vertexInput.positionWS; + o.texCoord0 = v.uv0; + o.color = v.color; + + return o; + } + + half4 frag( VertexOutput IN /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + /*ase_local_var:sp*/float4 positionCS = IN.positionCS; + /*ase_local_var:wp*/float3 positionWS = IN.positionWS; + + /*ase_frag_code:IN=VertexOutput*/ + float4 Color = /*ase_frag_out:Color;Float4;1;-1;_Color*/float4( 1, 1, 1, 1 )/*end*/; + + #if ETC1_EXTERNAL_ALPHA + float4 alpha = SAMPLE_TEXTURE2D( _AlphaTex, sampler_AlphaTex, IN.texCoord0.xy ); + Color.a = lerp( Color.a, alpha.r, _EnableAlphaTexture ); + #endif + + + #if defined(DEBUG_DISPLAY) + SurfaceData2D surfaceData; + InitializeSurfaceData(Color.rgb, Color.a, surfaceData); + InputData2D inputData; + InitializeInputData(positionWS.xy, half2(IN.texCoord0.xy), inputData); + half4 debugColor = 0; + + SETUP_DEBUG_DATA_2D(inputData, positionWS, positionCS); + + if (CanDebugOverrideOutputColor(surfaceData, inputData, debugColor)) + { + return debugColor; + } + #endif + + Color *= IN.color * unity_SpriteColor; + return Color; + } + + ENDHLSL + } + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "SceneSelectionPass" + Tags + { + "LightMode" = "SceneSelectionPass" + } + + Cull Off + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ DEBUG_DISPLAY SKINNED_SPRITE + + #define _SURFACE_TYPE_TRANSPARENT 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define FEATURES_GRAPH_VERTEX_NORMAL_OUTPUT + #define FEATURES_GRAPH_VERTEX_TANGENT_OUTPUT + #define FEATURES_GRAPH_VERTEX + + #define SHADERPASS SHADERPASS_DEPTHONLY + #define SCENESELECTIONPASS 1 + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + /*ase_pragma*/ + + /*ase_globals*/ + + struct VertexInput + { + float3 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + /*ase_vdata:p=p;n=n;t=t*/ + UNITY_SKINNED_VERTEX_INPUTS + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 positionCS : SV_POSITION; + /*ase_interp(0,):sp=sp*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + int _ObjectId; + int _PassValue; + + /*ase_funcs*/ + + VertexOutput vert(VertexInput v /*ase_vert_input*/) + { + VertexOutput o = (VertexOutput)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_SKINNED_VERTEX_COMPUTE(v); + + v.positionOS = UnityFlipSprite( v.positionOS, unity_SpriteProps.xy ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.positionOS; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;1;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.positionOS = vertexValue; + #else + v.positionOS += vertexValue; + #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS); + float3 positionWS = TransformObjectToWorld(v.positionOS); + o.positionCS = TransformWorldToHClip(positionWS); + + return o; + } + + half4 frag(VertexOutput IN/*ase_frag_input*/) : SV_TARGET + { + /*ase_frag_code:IN=VertexOutput*/ + float4 Color = /*ase_frag_out:Color;Float4;0;-1;_Color*/float4( 1, 1, 1, 1 )/*end*/; + + half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + return outColor; + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + Cull Off + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile _ DEBUG_DISPLAY SKINNED_SPRITE + + #define _SURFACE_TYPE_TRANSPARENT 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define FEATURES_GRAPH_VERTEX_NORMAL_OUTPUT + #define FEATURES_GRAPH_VERTEX_TANGENT_OUTPUT + #define FEATURES_GRAPH_VERTEX + + #define SHADERPASS SHADERPASS_DEPTHONLY + #define SCENEPICKINGPASS 1 + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + /*ase_pragma*/ + + /*ase_globals*/ + + struct VertexInput + { + float3 positionOS : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + /*ase_vdata:p=p;n=n;t=t*/ + UNITY_SKINNED_VERTEX_INPUTS + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct VertexOutput + { + float4 positionCS : SV_POSITION; + /*ase_interp(0,):sp=sp*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + float4 _SelectionID; + + /*ase_funcs*/ + + VertexOutput vert(VertexInput v /*ase_vert_input*/ ) + { + VertexOutput o = (VertexOutput)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + UNITY_SKINNED_VERTEX_COMPUTE(v); + + v.positionOS = UnityFlipSprite( v.positionOS, unity_SpriteProps.xy ); + + /*ase_vert_code:v=VertexInput;o=VertexOutput*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = v.positionOS; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;1;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + v.positionOS = vertexValue; + #else + v.positionOS += vertexValue; + #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS); + float3 positionWS = TransformObjectToWorld(v.positionOS); + o.positionCS = TransformWorldToHClip(positionWS); + + return o; + } + + half4 frag(VertexOutput IN /*ase_frag_input*/) : SV_TARGET + { + /*ase_frag_code:IN=VertexOutput*/ + float4 Color = /*ase_frag_out:Color;Float4;0;-1;_Color*/float4( 1, 1, 1, 1 )/*end*/; + half4 outColor = _SelectionID; + return outColor; + } + + ENDHLSL + } + /*ase_pass_end*/ + } + CustomEditor "UnityEditor.ShaderGraph.GenericShaderGraphMaterialGUI" + FallBack "Hidden/Shader Graph/FallbackError" +} diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Deinterleaving.cginc.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DUnlit.shader.meta similarity index 58% rename from Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Deinterleaving.cginc.meta rename to Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DUnlit.shader.meta index cd16cfa0..a75a12c4 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Deinterleaving.cginc.meta +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DUnlit.shader.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 87df896bfe60ae541ae6565690473297 -timeCreated: 1467102228 -licenseType: Store +guid: cf964e524c8e69742b1d21fbe2ebcc4a +timeCreated: 1568647145 +licenseType: Pro ShaderImporter: defaultTextures: [] userData: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Decal.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Decal.shader new file mode 100644 index 00000000..273ffa6d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Decal.shader @@ -0,0 +1,3609 @@ +Shader /*ase_name*/"Hidden/Universal/Decal"/*end*/ +{ + Properties + { + /*ase_props*/ + + [HideInInspector] _DrawOrder("Draw Order", Range(-50, 50)) = 0 + [HideInInspector][Enum(Depth Bias, 0, View Bias, 1)] _DecalMeshBiasType("DecalMesh BiasType", Float) = 0 + + [HideInInspector] _DecalMeshDepthBias("DecalMesh DepthBias", Float) = 0 + [HideInInspector] _DecalMeshViewBias("DecalMesh ViewBias", Float) = 0 + + [HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + + //_DecalAngleFadeSupported("Decal Angle Fade Supported", Float) = 1 + } + + SubShader + { + /*ase_subshader_options:Name=Additional Options + Option:Affect BaseColor:false,true:true + true:SetDefine:_MATERIAL_AFFECTS_ALBEDO 1 + false:RemoveDefine:_MATERIAL_AFFECTS_ALBEDO 1 + Option:Affect Normal:false,true:true + true:SetDefine:_MATERIAL_AFFECTS_NORMAL 1 + true:SetPropertyOnPass:DBufferProjector:ColorMask1,true,true,true,true + true:SetPropertyOnPass:DecalGBufferProjector:ColorMask2,true,true,true,false + true:SetPropertyOnPass:DBufferMesh:ColorMask1,true,true,true,true + true:SetPropertyOnPass:DecalGBufferMesh:ColorMask2,true,true,true,false + false:RemoveDefine:_MATERIAL_AFFECTS_NORMAL 1 + false:SetPropertyOnPass:DBufferProjector:ColorMask1,false,false,false,false + false:SetPropertyOnPass:DecalGBufferProjector:ColorMask2,false,false,false,false + false:SetPropertyOnPass:DBufferMesh:ColorMask1,false,false,false,false + false:SetPropertyOnPass:DecalGBufferMesh:ColorMask2,false,false,false,false + Option:Blend:false,true:true + true:SetDefine:_MATERIAL_AFFECTS_NORMAL_BLEND 1 + false:RemoveDefine:_MATERIAL_AFFECTS_NORMAL_BLEND 1 + Option:Affect MAOS:false,true:false + true:SetDefine: _MATERIAL_AFFECTS_MAOS 1 + true:ShowPort:DecalScreenSpaceProjector:Metallic + true:ShowPort:DecalScreenSpaceProjector:Occlusion + true:ShowPort:DecalScreenSpaceProjector:Smoothness + true:ShowPort:DecalScreenSpaceProjector:MAOS Alpha + false:RemoveDefine: _MATERIAL_AFFECTS_MAOS 1 + false:HidePort:DecalScreenSpaceProjector:Metallic + false:HidePort:DecalScreenSpaceProjector:Occlusion + false:HidePort:DecalScreenSpaceProjector:Smoothness + false:HidePort:DecalScreenSpaceProjector:MAOS Alpha + Option:Affect Emission:false,true:false + true:SetDefine:_MATERIAL_AFFECTS_EMISSION 1 + true:IncludePass:DecalProjectorForwardEmissive + true:IncludePass:DecalMeshForwardEmissive + true:ShowPort:DecalScreenSpaceProjector:Emission + false:RemoveDefine:_MATERIAL_AFFECTS_EMISSION 1 + false:ExcludePass:DecalProjectorForwardEmissive + false:ExcludePass:DecalMeshForwardEmissive + false:HidePort:DecalScreenSpaceProjector:Emission + Option:Support LOD CrossFade:false,true:false + true:SetDefine:DBufferMesh:USE_UNITY_CROSSFADE 1 + true:SetDefine:DecalScreenSpaceMesh:USE_UNITY_CROSSFADE 1 + true:SetDefine:DecalProjectorForwardEmissive:USE_UNITY_CROSSFADE 1 + true:SetDefine:DecalGBufferMesh:USE_UNITY_CROSSFADE 1 + true:SetDefine:DBufferMesh:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + true:SetDefine:DecalScreenSpaceMesh:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + true:SetDefine:DecalProjectorForwardEmissive:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + true:SetDefine:DecalGBufferMesh:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + false:RemoveDefine:DBufferMesh:USE_UNITY_CROSSFADE 1 + false:RemoveDefine:DecalScreenSpaceMesh:USE_UNITY_CROSSFADE 1 + false:RemoveDefine:DecalProjectorForwardEmissive:USE_UNITY_CROSSFADE 1 + false:RemoveDefine:DecalGBufferMesh:USE_UNITY_CROSSFADE 1 + false:RemoveDefine:DBufferMesh:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + false:RemoveDefine:DecalScreenSpaceMesh:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + false:RemoveDefine:DecalProjectorForwardEmissive:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + false:RemoveDefine:DecalGBufferMesh:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + Option:Angle Fade:false,true:true + true:SetDefine:DBufferProjector:DECAL_ANGLE_FADE 1 + true:SetDefine:DecalScreenSpaceProjector:DECAL_ANGLE_FADE 1 + true:SetDefine:DecalProjectorForwardEmissive:DECAL_ANGLE_FADE 1 + true:SetDefine:DecalGBufferProjector:DECAL_ANGLE_FADE 1 + true:SetDefine:DBufferProjector:DECAL_ANGLE_FADE 1 + false:RemoveDefine:DBufferProjector:DECAL_ANGLE_FADE 1 + false:RemoveDefine:DecalScreenSpaceProjector:DECAL_ANGLE_FADE 1 + false:RemoveDefine:DecalProjectorForwardEmissive:DECAL_ANGLE_FADE 1 + false:RemoveDefine:DecalGBufferProjector:DECAL_ANGLE_FADE 1 + false:RemoveDefine:DBufferProjector:DECAL_ANGLE_FADE 1 + true:SetShaderProperty:_DecalAngleFadeSupported,[HideInInspector] _DecalAngleFadeSupported("Decal Angle Fade Supported", Float) = 1 + false:SetShaderProperty:_DecalAngleFadeSupported,//[HideInInspector] _DecalAngleFadeSupported("Decal Angle Fade Supported", Float) = 1 + */ + + Tags + { + "RenderPipeline"="UniversalPipeline" + "PreviewType"="Plane" + "DisableBatching" = "LODFading" + "ShaderGraphShader"="true" + "ShaderGraphTargetId" = "UniversalDecalSubTarget" + } + + HLSLINCLUDE + #pragma target 3.5 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d9 // ensure rendering platforms toggle list is visible + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl" + ENDHLSL + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "DBufferProjector" + Tags + { + "LightMode" = "DBufferProjector" + } + + Cull Front + Blend 0 SrcAlpha OneMinusSrcAlpha, Zero OneMinusSrcAlpha + Blend 1 SrcAlpha OneMinusSrcAlpha, Zero OneMinusSrcAlpha + Blend 2 SrcAlpha OneMinusSrcAlpha, Zero OneMinusSrcAlpha + ZTest Greater + ZWrite Off + ColorMask RGBA + ColorMask RGBA 1 + ColorMask RGBA 2 + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma exclude_renderers gles gles3 glcore + #pragma multi_compile_instancing + #pragma editor_sync_compilation + + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ _DECAL_LAYERS + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + + #define HAVE_MESH_MODIFICATION + #define SHADERPASS SHADERPASS_DBUFFER_PROJECTOR + + #if _RENDER_PASS_ENABLED + #define GBUFFER3 0 + #define GBUFFER4 1 + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); + #endif + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + struct SurfaceDescription + { + float3 BaseColor; + float Alpha; + float3 NormalTS; + float NormalAlpha; + float Metallic; + float Occlusion; + float Smoothness; + float MAOSAlpha; + }; + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + /*ase_vdata:p=p;n=n;t=t*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + /*ase_interp(0,):sp=sp*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float _DrawOrder; + float _DecalMeshBiasType; + float _DecalMeshDepthBias; + float _DecalMeshViewBias; + #if defined(DECAL_ANGLE_FADE) + float _DecalAngleFadeSupported; + #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + void GetSurfaceData(SurfaceDescription surfaceDescription, float angleFadeFactor, out DecalSurfaceData surfaceData) + { + half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld); + half fadeFactor = clamp(normalToWorld[0][3], 0.0f, 1.0f) * angleFadeFactor; + float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]); + float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]); + + ZERO_INITIALIZE(DecalSurfaceData, surfaceData); + surfaceData.occlusion = half(1.0); + surfaceData.smoothness = half(0); + + #ifdef _MATERIAL_AFFECTS_NORMAL + surfaceData.normalWS.w = half(1.0); + #else + surfaceData.normalWS.w = half(0.0); + #endif + + surfaceData.baseColor.xyz = half3(surfaceDescription.BaseColor); + surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor); + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #if defined(_MATERIAL_AFFECTS_NORMAL) + surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz)); + #else + surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz); + #endif + #elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #if defined(_MATERIAL_AFFECTS_NORMAL) + float sgn = input.tangentWS.w; + float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz); + half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz); + + surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld)); + #else + surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); + #endif + #endif + + surfaceData.normalWS.w = surfaceDescription.NormalAlpha * fadeFactor; + + #if defined( _MATERIAL_AFFECTS_MAOS ) + surfaceData.metallic = half(surfaceDescription.Metallic); + surfaceData.occlusion = half(surfaceDescription.Occlusion); + surfaceData.smoothness = half(surfaceDescription.Smoothness); + surfaceData.MAOSAlpha = half(surfaceDescription.MAOSAlpha * fadeFactor); + #endif + } + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #define DECAL_PROJECTOR + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_MESH + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DBUFFER_MESH) + #define DECAL_DBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) + #define DECAL_SCREEN_SPACE + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_GBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) + #define DECAL_FORWARD_EMISSIVE + #endif + + #if ((!defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_ALBEDO)) || (defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_NORMAL_BLEND))) && (defined(DECAL_SCREEN_SPACE) || defined(DECAL_GBUFFER)) + #define DECAL_RECONSTRUCT_NORMAL + #elif defined(DECAL_ANGLE_FADE) + #define DECAL_LOAD_NORMAL + #endif + + #ifdef _DECAL_LAYERS + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareRenderingLayerTexture.hlsl" + #endif + + #if defined(DECAL_LOAD_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + #if defined(DECAL_PROJECTOR) || defined(DECAL_RECONSTRUCT_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" + #endif + + #ifdef DECAL_MESH + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DecalMeshBiasTypeEnum.cs.hlsl" + #endif + + #ifdef DECAL_RECONSTRUCT_NORMAL + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl" + #endif + + PackedVaryings Vert(Attributes inputMesh /*ase_vert_input*/ ) + { + PackedVaryings packedOutput; + ZERO_INITIALIZE(PackedVaryings, packedOutput); + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, packedOutput); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(packedOutput); + + inputMesh.tangentOS = float4( 1, 0, 0, -1 ); + inputMesh.normalOS = float3( 0, 1, 0 ); + + /*ase_vert_code:inputMesh=Attributes;packedOutput=PackedVaryings*/ + + VertexPositionInputs vertexInput = GetVertexPositionInputs(inputMesh.positionOS.xyz); + + float3 positionWS = TransformObjectToWorld(inputMesh.positionOS); + packedOutput.positionCS = TransformWorldToHClip(positionWS); + + return packedOutput; + } + + void Frag(PackedVaryings packedInput, + OUTPUT_DBUFFER(outDBuffer) + /*ase_frag_input*/ + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + UNITY_SETUP_INSTANCE_ID(packedInput); + + half angleFadeFactor = 1.0; + + #ifdef _DECAL_LAYERS + #ifdef _RENDER_PASS_ENABLED + uint surfaceRenderingLayer = DecodeMeshRenderingLayer(LOAD_FRAMEBUFFER_INPUT(GBUFFER4, packedInput.positionCS.xy).r); + #else + uint surfaceRenderingLayer = LoadSceneRenderingLayer(packedInput.positionCS.xy); + #endif + uint projectorRenderingLayer = uint(UNITY_ACCESS_INSTANCED_PROP(Decal, _DecalLayerMaskFromDecal)); + clip((surfaceRenderingLayer & projectorRenderingLayer) - 0.1); + #endif + + #if defined(DECAL_PROJECTOR) + #if UNITY_REVERSED_Z + #if _RENDER_PASS_ENABLED + float depth = LOAD_FRAMEBUFFER_X_INPUT(GBUFFER3, packedInput.positionCS.xy).x; + #else + float depth = LoadSceneDepth(packedInput.positionCS.xy); + #endif + #else + #if _RENDER_PASS_ENABLED + float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LOAD_FRAMEBUFFER_X_INPUT(GBUFFER3, packedInput.positionCS.xy)); + #else + float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LoadSceneDepth(packedInput.positionCS.xy)); + #endif + #endif + #endif + + #if defined(DECAL_RECONSTRUCT_NORMAL) + #if defined(_DECAL_NORMAL_BLEND_HIGH) + half3 normalWS = half3(ReconstructNormalTap9(packedInput.positionCS.xy)); + #elif defined(_DECAL_NORMAL_BLEND_MEDIUM) + half3 normalWS = half3(ReconstructNormalTap5(packedInput.positionCS.xy)); + #else + half3 normalWS = half3(ReconstructNormalDerivative(packedInput.positionCS.xy)); + #endif + #elif defined(DECAL_LOAD_NORMAL) + half3 normalWS = half3(LoadSceneNormals(packedInput.positionCS.xy)); + #endif + + float2 positionSS = FoveatedRemapNonUniformToLinearCS(packedInput.positionCS.xy) * _ScreenSize.zw; + + /*ase_local_var:sp*/float4 positionCS = ComputeClipSpacePosition( positionSS, depth ); + float4 hpositionVS = mul( UNITY_MATRIX_I_P, positionCS ); + /*ase_local_var:rwp*/float3 positionRWS = mul( ( float3x3 )UNITY_MATRIX_I_V, hpositionVS.xyz / hpositionVS.w ); + /*ase_local_var:wp*/float3 positionWS = positionRWS + _WorldSpaceCameraPos; + /*ase_local_var:op*/float3 positionOS = TransformWorldToObject( positionWS ); + /*ase_local_var:vp*/float3 positionVS = TransformWorldToView( positionWS ); + + float3 positionDS = TransformWorldToObject(positionWS); + positionDS = positionDS * float3(1.0, -1.0, 1.0); + + float clipValue = 0.5 - Max3(abs(positionDS).x, abs(positionDS).y, abs(positionDS).z); + clip(clipValue); + + float2 texCoord = positionDS.xz + float2(0.5, 0.5); + + float4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld); + float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]); + float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]); + texCoord.xy = texCoord.xy * scale + offset; + + /*ase_local_var:uv0*/float2 texCoord0 = texCoord; + /*ase_local_var:uv1*/float2 texCoord1 = texCoord; + /*ase_local_var:uv2*/float2 texCoord2 = texCoord; + /*ase_local_var:uv3*/float2 texCoord3 = texCoord; + + /*ase_local_var:wt*/float3 worldTangent = TransformObjectToWorldDir(float3(1, 0, 0)); + /*ase_local_var:wn*/float3 worldNormal = TransformObjectToWorldDir(float3(0, 1, 0)); + /*ase_local_var:wbt*/float3 worldBitangent = TransformObjectToWorldDir(float3(0, 0, 1)); + + #ifdef DECAL_ANGLE_FADE + half2 angleFade = half2(normalToWorld[1][3], normalToWorld[2][3]); + + if (angleFade.y < 0.0f) + { + half3 decalNormal = half3(normalToWorld[0].z, normalToWorld[1].z, normalToWorld[2].z); + half dotAngle = dot(normalWS, decalNormal); + angleFadeFactor = saturate(angleFade.x + angleFade.y * (dotAngle * (dotAngle - 2.0))); + } + #endif + + half3 viewDirectionWS = half3(1.0, 1.0, 1.0); + DecalSurfaceData surfaceData; + + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + /*ase_frag_code:packedInput=PackedVaryings*/ + + surfaceDescription.BaseColor = /*ase_frag_out:Base Color;Float3;0;-1;_BaseColor*/IsGammaSpace() ? float3(0.5, 0.5, 0.5) : SRGBToLinear(float3(0.5, 0.5, 0.5))/*end*/; + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;1;-1;_Alpha*/1/*end*/; + surfaceDescription.NormalTS = /*ase_frag_out:Normal;Float3;2;-1;_NormalTS*/float3(0.0f, 0.0f, 1.0f)/*end*/; + surfaceDescription.NormalAlpha = /*ase_frag_out:Normal Alpha;Float;3;-1;_NormalAlpha*/1/*end*/; + + #if defined( _MATERIAL_AFFECTS_MAOS ) + surfaceDescription.Metallic = /*ase_frag_out:Metallic;Float;4;-1;_Metallic*/0/*end*/; + surfaceDescription.Occlusion = /*ase_frag_out:Occlusion;Float;5;-1;_Occlusion*/1/*end*/; + surfaceDescription.Smoothness =/*ase_frag_out:Smoothness;Float;6;-1;_Smoothness*/ 0.5/*end*/; + surfaceDescription.MAOSAlpha = /*ase_frag_out:MAOS Alpha;Float;7;-1;_MAOSAlpha*/1/*end*/; + #endif + + GetSurfaceData(surfaceDescription, angleFadeFactor, surfaceData); + ENCODE_INTO_DBUFFER(surfaceData, outDBuffer); + + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "DecalProjectorForwardEmissive" + Tags + { + "LightMode" = "DecalProjectorForwardEmissive" + } + + Cull Front + Blend 0 SrcAlpha One + ZTest Greater + ZWrite Off + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + #pragma multi_compile_instancing + #pragma editor_sync_compilation + + #pragma multi_compile _ _DECAL_LAYERS + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + + #define HAVE_MESH_MODIFICATION + + #define SHADERPASS SHADERPASS_FORWARD_EMISSIVE_PROJECTOR + + #if _RENDER_PASS_ENABLED + #define GBUFFER3 0 + #define GBUFFER4 1 + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); + #endif + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + struct SurfaceDescription + { + float Alpha; + float3 Emission; + }; + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + /*ase_vdata:p=p;n=n;t=t*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + /*ase_interp(0,):sp=sp*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float _DrawOrder; + float _DecalMeshBiasType; + float _DecalMeshDepthBias; + float _DecalMeshViewBias; + #if defined(DECAL_ANGLE_FADE) + float _DecalAngleFadeSupported; + #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + void GetSurfaceData(SurfaceDescription surfaceDescription, float angleFadeFactor, out DecalSurfaceData surfaceData) + { + half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld); + half fadeFactor = clamp(normalToWorld[0][3], 0.0f, 1.0f) * angleFadeFactor; + float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]); + float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]); + + ZERO_INITIALIZE(DecalSurfaceData, surfaceData); + surfaceData.occlusion = half(1.0); + surfaceData.smoothness = half(0); + + #ifdef _MATERIAL_AFFECTS_NORMAL + surfaceData.normalWS.w = half(1.0); + #else + surfaceData.normalWS.w = half(0.0); + #endif + + #if defined( _MATERIAL_AFFECTS_EMISSION ) + surfaceData.emissive.rgb = half3(surfaceDescription.Emission.rgb * fadeFactor); + #endif + + surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor); + } + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #define DECAL_PROJECTOR + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_MESH + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DBUFFER_MESH) + #define DECAL_DBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) + #define DECAL_SCREEN_SPACE + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_GBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) + #define DECAL_FORWARD_EMISSIVE + #endif + + #if ((!defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_ALBEDO)) || (defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_NORMAL_BLEND))) && (defined(DECAL_SCREEN_SPACE) || defined(DECAL_GBUFFER)) + #define DECAL_RECONSTRUCT_NORMAL + #elif defined(DECAL_ANGLE_FADE) + #define DECAL_LOAD_NORMAL + #endif + + #ifdef _DECAL_LAYERS + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareRenderingLayerTexture.hlsl" + #endif + + #if defined(DECAL_LOAD_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + #if defined(DECAL_PROJECTOR) || defined(DECAL_RECONSTRUCT_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" + #endif + + #ifdef DECAL_MESH + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DecalMeshBiasTypeEnum.cs.hlsl" + #endif + + #ifdef DECAL_RECONSTRUCT_NORMAL + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl" + #endif + + PackedVaryings Vert(Attributes inputMesh /*ase_vert_input*/ ) + { + PackedVaryings packedOutput; + ZERO_INITIALIZE(PackedVaryings, packedOutput); + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, packedOutput); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(packedOutput); + + inputMesh.tangentOS = float4( 1, 0, 0, -1 ); + inputMesh.normalOS = float3( 0, 1, 0 ); + + /*ase_vert_code:inputMesh=Attributes;packedOutput=PackedVaryings*/ + + VertexPositionInputs vertexInput = GetVertexPositionInputs(inputMesh.positionOS.xyz); + float3 positionWS = TransformObjectToWorld(inputMesh.positionOS); + packedOutput.positionCS = TransformWorldToHClip(positionWS); + + return packedOutput; + } + + void Frag(PackedVaryings packedInput, + out half4 outEmissive : SV_Target0 + /*ase_frag_input*/ + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + UNITY_SETUP_INSTANCE_ID(packedInput); + + half angleFadeFactor = 1.0; + + #ifdef _DECAL_LAYERS + #ifdef _RENDER_PASS_ENABLED + uint surfaceRenderingLayer = DecodeMeshRenderingLayer(LOAD_FRAMEBUFFER_INPUT(GBUFFER4, packedInput.positionCS.xy).r); + #else + uint surfaceRenderingLayer = LoadSceneRenderingLayer(packedInput.positionCS.xy); + #endif + uint projectorRenderingLayer = uint(UNITY_ACCESS_INSTANCED_PROP(Decal, _DecalLayerMaskFromDecal)); + clip((surfaceRenderingLayer & projectorRenderingLayer) - 0.1); + #endif + + #if defined(DECAL_PROJECTOR) + #if UNITY_REVERSED_Z + #if _RENDER_PASS_ENABLED + float depth = LOAD_FRAMEBUFFER_X_INPUT(GBUFFER3, packedInput.positionCS.xy).x; + #else + float depth = LoadSceneDepth(packedInput.positionCS.xy); + #endif + #else + #if _RENDER_PASS_ENABLED + float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LOAD_FRAMEBUFFER_X_INPUT(GBUFFER3, packedInput.positionCS.xy)); + #else + float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LoadSceneDepth(packedInput.positionCS.xy)); + #endif + #endif + #endif + + #if defined(DECAL_RECONSTRUCT_NORMAL) + #if defined(_DECAL_NORMAL_BLEND_HIGH) + half3 normalWS = half3(ReconstructNormalTap9(packedInput.positionCS.xy)); + #elif defined(_DECAL_NORMAL_BLEND_MEDIUM) + half3 normalWS = half3(ReconstructNormalTap5(packedInput.positionCS.xy)); + #else + half3 normalWS = half3(ReconstructNormalDerivative(packedInput.positionCS.xy)); + #endif + #elif defined(DECAL_LOAD_NORMAL) + half3 normalWS = half3(LoadSceneNormals(packedInput.positionCS.xy)); + #endif + + float2 positionSS = FoveatedRemapNonUniformToLinearCS(packedInput.positionCS.xy) * _ScreenSize.zw; + + /*ase_local_var:sp*/float4 positionCS = ComputeClipSpacePosition( positionSS, depth ); + float4 hpositionVS = mul( UNITY_MATRIX_I_P, positionCS ); + /*ase_local_var:rwp*/float3 positionRWS = mul( ( float3x3 )UNITY_MATRIX_I_V, hpositionVS.xyz / hpositionVS.w ); + /*ase_local_var:wp*/float3 positionWS = positionRWS + _WorldSpaceCameraPos; + /*ase_local_var:op*/float3 positionOS = TransformWorldToObject( positionWS ); + /*ase_local_var:vp*/float3 positionVS = TransformWorldToView( positionWS ); + + float3 positionDS = TransformWorldToObject(positionWS); + positionDS = positionDS * float3(1.0, -1.0, 1.0); + + float clipValue = 0.5 - Max3(abs(positionDS).x, abs(positionDS).y, abs(positionDS).z); + clip(clipValue); + + float2 texCoord = positionDS.xz + float2(0.5, 0.5); + + float4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld); + float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]); + float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]); + texCoord.xy = texCoord.xy * scale + offset; + + #ifdef DECAL_ANGLE_FADE + half2 angleFade = half2(normalToWorld[1][3], normalToWorld[2][3]); + + if (angleFade.y < 0.0f) + { + half3 decalNormal = half3(normalToWorld[0].z, normalToWorld[1].z, normalToWorld[2].z); + half dotAngle = dot(normalWS, decalNormal); + angleFadeFactor = saturate(angleFade.x + angleFade.y * (dotAngle * (dotAngle - 2.0))); + } + #endif + + half3 viewDirectionWS = half3(1.0, 1.0, 1.0); + DecalSurfaceData surfaceData; + + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + /*ase_local_var:uv0*/float2 texCoord0 = texCoord; + /*ase_local_var:uv1*/float2 texCoord1 = texCoord; + /*ase_local_var:uv2*/float2 texCoord2 = texCoord; + /*ase_local_var:uv3*/float2 texCoord3 = texCoord; + + /*ase_local_var:wt*/float3 worldTangent = TransformObjectToWorldDir(float3(1, 0, 0)); + /*ase_local_var:wn*/float3 worldNormal = TransformObjectToWorldDir(float3(0, 1, 0)); + /*ase_local_var:wbt*/float3 worldBitangent = TransformObjectToWorldDir(float3(0, 0, 1)); + + /*ase_frag_code:packedInput=PackedVaryings*/ + + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + + #if defined( _MATERIAL_AFFECTS_EMISSION ) + surfaceDescription.Emission = /*ase_frag_out:Emission;Float3;1;-1;_Emission*/float3(0, 0, 0)/*end*/; + #endif + + GetSurfaceData( surfaceDescription, angleFadeFactor, surfaceData); + + outEmissive.rgb = surfaceData.emissive * GetCurrentExposureMultiplier(); + outEmissive.a = surfaceData.baseColor.a; + + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_main_pass*/ + Name "DecalScreenSpaceProjector" + Tags + { + "LightMode" = "DecalScreenSpaceProjector" + } + + Cull Front + Blend SrcAlpha OneMinusSrcAlpha + ZTest Greater + ZWrite Off + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma editor_sync_compilation + + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH + #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile _DECAL_NORMAL_BLEND_LOW _DECAL_NORMAL_BLEND_MEDIUM _DECAL_NORMAL_BLEND_HIGH + #pragma multi_compile _ _DECAL_LAYERS + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TEXCOORD0 + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_VIEWDIRECTION_WS + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define VARYINGS_NEED_SH + #define VARYINGS_NEED_STATIC_LIGHTMAP_UV + #define VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV + + #define HAVE_MESH_MODIFICATION + + #define SHADERPASS SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR + + #if _RENDER_PASS_ENABLED + #define GBUFFER3 0 + #define GBUFFER4 1 + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); + #endif + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + struct SurfaceDescription + { + float3 BaseColor; + float Alpha; + float3 NormalTS; + float NormalAlpha; + float Metallic; + float Occlusion; + float Smoothness; + float MAOSAlpha; + float3 Emission; + }; + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + /*ase_vdata:p=p;n=n;t=t*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float3 normalWS : TEXCOORD0; + float3 viewDirectionWS : TEXCOORD1; + float4 lightmapUVs : TEXCOORD2; // @diogo: packs both static (xy) and dynamic (zw) + float3 sh : TEXCOORD3; + float4 fogFactorAndVertexLight : TEXCOORD4; + #ifdef USE_APV_PROBE_OCCLUSION + float4 probeOcclusion : TEXCOORD5; + #endif + /*ase_interp(6,):sp=sp;wn=tc0;wvd=tc1*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float _DrawOrder; + float _DecalMeshBiasType; + float _DecalMeshDepthBias; + float _DecalMeshViewBias; + #if defined(DECAL_ANGLE_FADE) + float _DecalAngleFadeSupported; + #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + void GetSurfaceData(SurfaceDescription surfaceDescription, float angleFadeFactor, out DecalSurfaceData surfaceData) + { + half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld); + half fadeFactor = clamp(normalToWorld[0][3], 0.0f, 1.0f) * angleFadeFactor; + float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]); + float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]); + + ZERO_INITIALIZE(DecalSurfaceData, surfaceData); + surfaceData.occlusion = half(1.0); + surfaceData.smoothness = half(0); + + #ifdef _MATERIAL_AFFECTS_NORMAL + surfaceData.normalWS.w = half(1.0); + #else + surfaceData.normalWS.w = half(0.0); + #endif + + #if defined( _MATERIAL_AFFECTS_EMISSION ) + surfaceData.emissive.rgb = half3(surfaceDescription.Emission.rgb * fadeFactor); + #endif + + surfaceData.baseColor.xyz = half3(surfaceDescription.BaseColor); + surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor); + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #if defined(_MATERIAL_AFFECTS_NORMAL) + surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz)); + #else + surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz); + #endif + #elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #if defined(_MATERIAL_AFFECTS_NORMAL) + float sgn = input.tangentWS.w; + float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz); + half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz); + + surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld)); + #else + surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); + #endif + #endif + + surfaceData.normalWS.w = surfaceDescription.NormalAlpha * fadeFactor; + + #if defined( _MATERIAL_AFFECTS_MAOS ) + surfaceData.metallic = half(surfaceDescription.Metallic); + surfaceData.occlusion = half(surfaceDescription.Occlusion); + surfaceData.smoothness = half(surfaceDescription.Smoothness); + surfaceData.MAOSAlpha = half(surfaceDescription.MAOSAlpha * fadeFactor); + #endif + } + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #define DECAL_PROJECTOR + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_MESH + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DBUFFER_MESH) + #define DECAL_DBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) + #define DECAL_SCREEN_SPACE + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_GBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) + #define DECAL_FORWARD_EMISSIVE + #endif + + #if ((!defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_ALBEDO)) || (defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_NORMAL_BLEND))) && (defined(DECAL_SCREEN_SPACE) || defined(DECAL_GBUFFER)) + #define DECAL_RECONSTRUCT_NORMAL + #elif defined(DECAL_ANGLE_FADE) + #define DECAL_LOAD_NORMAL + #endif + + #ifdef _DECAL_LAYERS + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareRenderingLayerTexture.hlsl" + #endif + + #if defined(DECAL_LOAD_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + #if defined(DECAL_PROJECTOR) || defined(DECAL_RECONSTRUCT_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" + #endif + + #ifdef DECAL_MESH + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DecalMeshBiasTypeEnum.cs.hlsl" + #endif + + #ifdef DECAL_RECONSTRUCT_NORMAL + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl" + #endif + + void InitializeInputData(PackedVaryings input, float3 positionWS, half3 normalWS, half3 viewDirectionWS, out InputData inputData) + { + inputData = (InputData)0; + + inputData.positionWS = positionWS; + inputData.normalWS = normalWS; + inputData.viewDirectionWS = viewDirectionWS; + inputData.shadowCoord = float4(0, 0, 0, 0); + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + inputData.fogCoord = InitializeInputDataFog(float4(positionWS, 1.0), input.fogFactorAndVertexLight.x); + inputData.vertexLighting = input.fogFactorAndVertexLight.yzw; + #endif + + #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV.xy, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #elif defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + #if !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) + inputData.bakedGI = SAMPLE_GI(input.sh, + GetAbsolutePositionWS(inputData.positionWS), + inputData.normalWS, + inputData.viewDirectionWS, + input.positionCS.xy, + input.probeOcclusion, + inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #endif + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy; + #endif + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) && defined(LIGHTMAP_ON) + inputData.staticLightmapUV = input.staticLightmapUV + #elif defined(VARYINGS_NEED_SH) + inputData.vertexSH = input.sh; + #endif + #if defined(USE_APV_PROBE_OCCLUSION) + inputData.probeOcclusion = input.probeOcclusion; + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); + } + + void GetSurface(DecalSurfaceData decalSurfaceData, inout SurfaceData surfaceData) + { + surfaceData.albedo = decalSurfaceData.baseColor.rgb; + surfaceData.metallic = saturate(decalSurfaceData.metallic); + surfaceData.specular = 0; + surfaceData.smoothness = saturate(decalSurfaceData.smoothness); + surfaceData.occlusion = decalSurfaceData.occlusion; + surfaceData.emission = decalSurfaceData.emissive; + surfaceData.alpha = saturate(decalSurfaceData.baseColor.w); + surfaceData.clearCoatMask = 0; + surfaceData.clearCoatSmoothness = 1; + } + + PackedVaryings Vert(Attributes inputMesh /*ase_vert_input*/ ) + { + PackedVaryings packedOutput; + ZERO_INITIALIZE(PackedVaryings, packedOutput); + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, packedOutput); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(packedOutput); + + inputMesh.tangentOS = float4( 1, 0, 0, -1 ); + inputMesh.normalOS = float3( 0, 1, 0 ); + + /*ase_vert_code:inputMesh=Attributes;packedOutput=PackedVaryings*/ + + VertexPositionInputs vertexInput = GetVertexPositionInputs(inputMesh.positionOS.xyz); + float3 positionWS = TransformObjectToWorld(inputMesh.positionOS); + + float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS); + + packedOutput.positionCS = TransformWorldToHClip(positionWS); + + half fogFactor = 0; + #if !defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(packedOutput.positionCS.z); + #endif + half3 vertexLight = VertexLighting(positionWS, normalWS); + packedOutput.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + packedOutput.normalWS.xyz = normalWS; + packedOutput.viewDirectionWS.xyz = GetWorldSpaceViewDir(positionWS); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV(inputMesh.uv1, unity_LightmapST, packedOutput.staticLightmapUV); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + packedOutput.dynamicLightmapUV.xy = inputMesh.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + #if !defined(LIGHTMAP_ON) + packedOutput.sh.xyz = float3(SampleSHVertex(half3(normalWS))); + #endif + + return packedOutput; + } + + void Frag(PackedVaryings packedInput, + out half4 outColor : SV_Target0 + /*ase_frag_input*/ + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + UNITY_SETUP_INSTANCE_ID(packedInput); + + half angleFadeFactor = 1.0; + + #ifdef _DECAL_LAYERS + #ifdef _RENDER_PASS_ENABLED + uint surfaceRenderingLayer = DecodeMeshRenderingLayer(LOAD_FRAMEBUFFER_INPUT(GBUFFER4, packedInput.positionCS.xy).r); + #else + uint surfaceRenderingLayer = LoadSceneRenderingLayer(packedInput.positionCS.xy); + #endif + uint projectorRenderingLayer = uint(UNITY_ACCESS_INSTANCED_PROP(Decal, _DecalLayerMaskFromDecal)); + clip((surfaceRenderingLayer & projectorRenderingLayer) - 0.1); + #endif + + #if defined(DECAL_PROJECTOR) + #if UNITY_REVERSED_Z + #if _RENDER_PASS_ENABLED + float depth = LOAD_FRAMEBUFFER_X_INPUT(GBUFFER3, packedInput.positionCS.xy).x; + #else + float depth = LoadSceneDepth(packedInput.positionCS.xy); + #endif + #else + #if _RENDER_PASS_ENABLED + float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LOAD_FRAMEBUFFER_X_INPUT(GBUFFER3, packedInput.positionCS.xy)); + #else + float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LoadSceneDepth(packedInput.positionCS.xy)); + #endif + #endif + #endif + + #if defined(DECAL_RECONSTRUCT_NORMAL) + #if defined(_DECAL_NORMAL_BLEND_HIGH) + half3 normalWS = half3(ReconstructNormalTap9(packedInput.positionCS.xy)); + #elif defined(_DECAL_NORMAL_BLEND_MEDIUM) + half3 normalWS = half3(ReconstructNormalTap5(packedInput.positionCS.xy)); + #else + half3 normalWS = half3(ReconstructNormalDerivative(packedInput.positionCS.xy)); + #endif + #elif defined(DECAL_LOAD_NORMAL) + half3 normalWS = half3(LoadSceneNormals(packedInput.positionCS.xy)); + #endif + + float2 positionSS = FoveatedRemapNonUniformToLinearCS(packedInput.positionCS.xy) * _ScreenSize.zw; + + /*ase_local_var:sp*/float4 positionCS = ComputeClipSpacePosition( positionSS, depth ); + float4 hpositionVS = mul( UNITY_MATRIX_I_P, positionCS ); + /*ase_local_var:rwp*/float3 positionRWS = mul( ( float3x3 )UNITY_MATRIX_I_V, hpositionVS.xyz / hpositionVS.w ); + /*ase_local_var:wp*/float3 positionWS = positionRWS + _WorldSpaceCameraPos; + /*ase_local_var:op*/float3 positionOS = TransformWorldToObject( positionWS ); + /*ase_local_var:vp*/float3 positionVS = TransformWorldToView( positionWS ); + + float3 positionDS = TransformWorldToObject(positionWS); + positionDS = positionDS * float3(1.0, -1.0, 1.0); + + float clipValue = 0.5 - Max3(abs(positionDS).x, abs(positionDS).y, abs(positionDS).z); + clip(clipValue); + + float2 texCoord = positionDS.xz + float2(0.5, 0.5); + + float4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld); + float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]); + float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]); + texCoord.xy = texCoord.xy * scale + offset; + + /*ase_local_var:uv0*/float2 texCoord0 = texCoord; + /*ase_local_var:uv1*/float2 texCoord1 = texCoord; + /*ase_local_var:uv2*/float2 texCoord2 = texCoord; + /*ase_local_var:uv3*/float2 texCoord3 = texCoord; + + /*ase_local_var:wt*/float3 worldTangent = TransformObjectToWorldDir(float3(1, 0, 0)); + /*ase_local_var:wn*/float3 worldNormal = TransformObjectToWorldDir(float3(0, 1, 0)); + /*ase_local_var:wbt*/float3 worldBitangent = TransformObjectToWorldDir(float3(0, 0, 1)); + + #ifdef DECAL_ANGLE_FADE + half2 angleFade = half2(normalToWorld[1][3], normalToWorld[2][3]); + + if (angleFade.y < 0.0f) + { + half3 decalNormal = half3(normalToWorld[0].z, normalToWorld[1].z, normalToWorld[2].z); + half dotAngle = dot(normalWS, decalNormal); + angleFadeFactor = saturate(angleFade.x + angleFade.y * (dotAngle * (dotAngle - 2.0))); + } + #endif + + half3 viewDirectionWS = half3(packedInput.viewDirectionWS); + + DecalSurfaceData surfaceData; + + /*ase_frag_code:packedInput=PackedVaryings*/ + + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + surfaceDescription.BaseColor = /*ase_frag_out:Base Color;Float3;0;-1;_BaseColor*/IsGammaSpace() ? float3(0.5, 0.5, 0.5) : SRGBToLinear(float3(0.5, 0.5, 0.5))/*end*/; + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;1;-1;_Alpha*/1/*end*/; + surfaceDescription.NormalTS = /*ase_frag_out:Normal;Float3;2;-1;_NormalTS*/float3(0.0f, 0.0f, 1.0f)/*end*/; + surfaceDescription.NormalAlpha = /*ase_frag_out:Normal Alpha;Float;3;-1;_NormalAlpha*/1/*end*/; + #if defined( _MATERIAL_AFFECTS_MAOS ) + surfaceDescription.Metallic = /*ase_frag_out:Metallic;Float;4;-1;_Metallic*/0/*end*/; + surfaceDescription.Occlusion = /*ase_frag_out:Occlusion;Float;5;-1;_Occlusion*/1/*end*/; + surfaceDescription.Smoothness = /*ase_frag_out:Smoothness;Float;6;-1;_Smoothness*/0.5/*end*/; + surfaceDescription.MAOSAlpha = /*ase_frag_out:MAOS Alpha;Float;7;-1;_MAOSAlpha*/1/*end*/; + #endif + + #if defined( _MATERIAL_AFFECTS_EMISSION ) + surfaceDescription.Emission = /*ase_frag_out:Emission;Float3;8;-1;_Emission*/float3(0, 0, 0)/*end*/; + #endif + + GetSurfaceData( surfaceDescription, angleFadeFactor, surfaceData); + + half3 normalToPack = surfaceData.normalWS.xyz; + #ifdef DECAL_RECONSTRUCT_NORMAL + surfaceData.normalWS.xyz = normalize(lerp(normalWS.xyz, surfaceData.normalWS.xyz, surfaceData.normalWS.w)); + #endif + + InputData inputData; + InitializeInputData( packedInput, positionWS, surfaceData.normalWS.xyz, viewDirectionWS, inputData); + + SurfaceData surface = (SurfaceData)0; + GetSurface(surfaceData, surface); + + half4 color = UniversalFragmentPBR(inputData, surface); + color.rgb = MixFog(color.rgb, inputData.fogCoord); + outColor = color; + + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "DecalGBufferProjector" + Tags + { + "LightMode" = "DecalGBufferProjector" + } + + Cull Front + Blend 0 SrcAlpha OneMinusSrcAlpha + Blend 1 SrcAlpha OneMinusSrcAlpha + Blend 2 SrcAlpha OneMinusSrcAlpha + Blend 3 SrcAlpha OneMinusSrcAlpha + ZTest Greater + ZWrite Off + ColorMask RGB + ColorMask 0 1 + ColorMask RGB 2 + ColorMask RGB 3 + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma editor_sync_compilation + + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH + #pragma multi_compile _DECAL_NORMAL_BLEND_LOW _DECAL_NORMAL_BLEND_MEDIUM _DECAL_NORMAL_BLEND_HIGH + #pragma multi_compile _ _DECAL_LAYERS + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TEXCOORD0 + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_VIEWDIRECTION_WS + #define VARYINGS_NEED_SH + #define VARYINGS_NEED_STATIC_LIGHTMAP_UV + #define VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV + + #define HAVE_MESH_MODIFICATION + + #define SHADERPASS SHADERPASS_DECAL_GBUFFER_PROJECTOR + + #if _RENDER_PASS_ENABLED + #define GBUFFER3 0 + #define GBUFFER4 1 + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); + #endif + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + struct SurfaceDescription + { + float3 BaseColor; + float Alpha; + float3 NormalTS; + float NormalAlpha; + float Metallic; + float Occlusion; + float Smoothness; + float MAOSAlpha; + float3 Emission; + }; + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + /*ase_vdata:p=p;n=n;t=t*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float3 normalWS : TEXCOORD0; + float3 viewDirectionWS : TEXCOORD1; + float4 lightmapUVs : TEXCOORD2; // @diogo: packs both static (xy) and dynamic (zw) + float3 sh : TEXCOORD3; + #ifdef USE_APV_PROBE_OCCLUSION + float4 probeOcclusion : TEXCOORD4; + #endif + /*ase_interp(5,):sp=sp;wn=tc0;wvd=tc1*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float _DrawOrder; + float _DecalMeshBiasType; + float _DecalMeshDepthBias; + float _DecalMeshViewBias; + #if defined(DECAL_ANGLE_FADE) + float _DecalAngleFadeSupported; + #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + void GetSurfaceData(SurfaceDescription surfaceDescription, float angleFadeFactor, out DecalSurfaceData surfaceData) + { + half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld); + half fadeFactor = clamp(normalToWorld[0][3], 0.0f, 1.0f) * angleFadeFactor; + float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]); + float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]); + + ZERO_INITIALIZE(DecalSurfaceData, surfaceData); + surfaceData.occlusion = half(1.0); + surfaceData.smoothness = half(0); + + #ifdef _MATERIAL_AFFECTS_NORMAL + surfaceData.normalWS.w = half(1.0); + #else + surfaceData.normalWS.w = half(0.0); + #endif + + #if defined( _MATERIAL_AFFECTS_EMISSION ) + surfaceData.emissive.rgb = half3(surfaceDescription.Emission.rgb * fadeFactor); + #endif + + surfaceData.baseColor.xyz = half3(surfaceDescription.BaseColor); + surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor); + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #if defined(_MATERIAL_AFFECTS_NORMAL) + surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz)); + #else + surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz); + #endif + #elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #if defined(_MATERIAL_AFFECTS_NORMAL) + float sgn = input.tangentWS.w; + float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz); + half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz); + + surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld)); + #else + surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); + #endif + #endif + + surfaceData.normalWS.w = surfaceDescription.NormalAlpha * fadeFactor; + + #if defined( _MATERIAL_AFFECTS_MAOS ) + surfaceData.metallic = half(surfaceDescription.Metallic); + surfaceData.occlusion = half(surfaceDescription.Occlusion); + surfaceData.smoothness = half(surfaceDescription.Smoothness); + surfaceData.MAOSAlpha = half(surfaceDescription.MAOSAlpha * fadeFactor); + #endif + } + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #define DECAL_PROJECTOR + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_MESH + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DBUFFER_MESH) + #define DECAL_DBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) + #define DECAL_SCREEN_SPACE + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_GBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) + #define DECAL_FORWARD_EMISSIVE + #endif + + #if ((!defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_ALBEDO)) || (defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_NORMAL_BLEND))) && (defined(DECAL_SCREEN_SPACE) || defined(DECAL_GBUFFER)) + #define DECAL_RECONSTRUCT_NORMAL + #elif defined(DECAL_ANGLE_FADE) + #define DECAL_LOAD_NORMAL + #endif + + #ifdef _DECAL_LAYERS + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareRenderingLayerTexture.hlsl" + #endif + + #if defined(DECAL_LOAD_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + #if defined(DECAL_PROJECTOR) || defined(DECAL_RECONSTRUCT_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" + #endif + + #ifdef DECAL_MESH + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DecalMeshBiasTypeEnum.cs.hlsl" + #endif + + #ifdef DECAL_RECONSTRUCT_NORMAL + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl" + #endif + + void InitializeInputData(PackedVaryings input, float3 positionWS, half3 normalWS, half3 viewDirectionWS, out InputData inputData) + { + inputData = (InputData)0; + + inputData.positionWS = positionWS; + inputData.normalWS = normalWS; + inputData.viewDirectionWS = viewDirectionWS; + inputData.shadowCoord = float4(0, 0, 0, 0); + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + inputData.fogCoord = InitializeInputDataFog(float4(positionWS, 1.0), input.fogFactorAndVertexLight.x); + inputData.vertexLighting = input.fogFactorAndVertexLight.yzw; + #endif + + #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV.xy, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #elif defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + #if !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) + inputData.bakedGI = SAMPLE_GI(input.sh, + GetAbsolutePositionWS(inputData.positionWS), + inputData.normalWS, + inputData.viewDirectionWS, + input.positionCS.xy, + input.probeOcclusion, + inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #endif + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy; + #endif + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) && defined(LIGHTMAP_ON) + inputData.staticLightmapUV = input.staticLightmapUV + #elif defined(VARYINGS_NEED_SH) + inputData.vertexSH = input.sh; + #endif + #if defined(USE_APV_PROBE_OCCLUSION) + inputData.probeOcclusion = input.probeOcclusion; + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); + } + + void GetSurface(DecalSurfaceData decalSurfaceData, inout SurfaceData surfaceData) + { + surfaceData.albedo = decalSurfaceData.baseColor.rgb; + surfaceData.metallic = saturate(decalSurfaceData.metallic); + surfaceData.specular = 0; + surfaceData.smoothness = saturate(decalSurfaceData.smoothness); + surfaceData.occlusion = decalSurfaceData.occlusion; + surfaceData.emission = decalSurfaceData.emissive; + surfaceData.alpha = saturate(decalSurfaceData.baseColor.w); + surfaceData.clearCoatMask = 0; + surfaceData.clearCoatSmoothness = 1; + } + + PackedVaryings Vert(Attributes inputMesh /*ase_vert_input*/ ) + { + PackedVaryings packedOutput; + ZERO_INITIALIZE(PackedVaryings, packedOutput); + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, packedOutput); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(packedOutput); + + inputMesh.tangentOS = float4( 1, 0, 0, -1 ); + inputMesh.normalOS = float3( 0, 1, 0 ); + + /*ase_vert_code:inputMesh=Attributes;packedOutput=PackedVaryings*/ + + float3 positionWS = TransformObjectToWorld(inputMesh.positionOS); + float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS); + + packedOutput.positionCS = TransformWorldToHClip(positionWS); + packedOutput.normalWS.xyz = normalWS; + packedOutput.viewDirectionWS.xyz = GetWorldSpaceViewDir(positionWS); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV(inputMesh.uv1, unity_LightmapST, packedOutput.staticLightmapUV); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + packedOutput.dynamicLightmapUV.xy = inputMesh.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + #if !defined(LIGHTMAP_ON) + packedOutput.sh = float3(SampleSHVertex(half3(normalWS))); + #endif + + return packedOutput; + } + + void Frag(PackedVaryings packedInput, + out FragmentOutput fragmentOutput + /*ase_frag_input*/ + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + UNITY_SETUP_INSTANCE_ID(packedInput); + + half angleFadeFactor = 1.0; + + #ifdef _DECAL_LAYERS + #ifdef _RENDER_PASS_ENABLED + uint surfaceRenderingLayer = DecodeMeshRenderingLayer(LOAD_FRAMEBUFFER_INPUT(GBUFFER4, packedInput.positionCS.xy).r); + #else + uint surfaceRenderingLayer = LoadSceneRenderingLayer(packedInput.positionCS.xy); + #endif + uint projectorRenderingLayer = uint(UNITY_ACCESS_INSTANCED_PROP(Decal, _DecalLayerMaskFromDecal)); + clip((surfaceRenderingLayer & projectorRenderingLayer) - 0.1); + #endif + + #if defined(DECAL_PROJECTOR) + #if UNITY_REVERSED_Z + #if _RENDER_PASS_ENABLED + float depth = LOAD_FRAMEBUFFER_X_INPUT(GBUFFER3, packedInput.positionCS.xy).x; + #else + float depth = LoadSceneDepth(packedInput.positionCS.xy); + #endif + #else + #if _RENDER_PASS_ENABLED + float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LOAD_FRAMEBUFFER_X_INPUT(GBUFFER3, packedInput.positionCS.xy)); + #else + float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LoadSceneDepth(packedInput.positionCS.xy)); + #endif + #endif + #endif + + #if defined(DECAL_RECONSTRUCT_NORMAL) + #if defined(_DECAL_NORMAL_BLEND_HIGH) + half3 normalWS = half3(ReconstructNormalTap9(packedInput.positionCS.xy)); + #elif defined(_DECAL_NORMAL_BLEND_MEDIUM) + half3 normalWS = half3(ReconstructNormalTap5(packedInput.positionCS.xy)); + #else + half3 normalWS = half3(ReconstructNormalDerivative(packedInput.positionCS.xy)); + #endif + #elif defined(DECAL_LOAD_NORMAL) + half3 normalWS = half3(LoadSceneNormals(packedInput.positionCS.xy)); + #endif + + float2 positionSS = FoveatedRemapNonUniformToLinearCS(packedInput.positionCS.xy) * _ScreenSize.zw; + + /*ase_local_var:sp*/float4 positionCS = ComputeClipSpacePosition( positionSS, depth ); + float4 hpositionVS = mul( UNITY_MATRIX_I_P, positionCS ); + /*ase_local_var:rwp*/float3 positionRWS = mul( ( float3x3 )UNITY_MATRIX_I_V, hpositionVS.xyz / hpositionVS.w ); + /*ase_local_var:wp*/float3 positionWS = positionRWS + _WorldSpaceCameraPos; + /*ase_local_var:op*/float3 positionOS = TransformWorldToObject( positionWS ); + /*ase_local_var:vp*/float3 positionVS = TransformWorldToView( positionWS ); + + float3 positionDS = TransformWorldToObject(positionWS); + positionDS = positionDS * float3(1.0, -1.0, 1.0); + + float clipValue = 0.5 - Max3(abs(positionDS).x, abs(positionDS).y, abs(positionDS).z); + clip(clipValue); + + float2 texCoord = positionDS.xz + float2(0.5, 0.5); + + float4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld); + float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]); + float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]); + texCoord.xy = texCoord.xy * scale + offset; + + /*ase_local_var:uv0*/float2 texCoord0 = texCoord; + /*ase_local_var:uv1*/float2 texCoord1 = texCoord; + /*ase_local_var:uv2*/float2 texCoord2 = texCoord; + /*ase_local_var:uv3*/float2 texCoord3 = texCoord; + + /*ase_local_var:wt*/float3 worldTangent = TransformObjectToWorldDir(float3(1, 0, 0)); + /*ase_local_var:wn*/float3 worldNormal = TransformObjectToWorldDir(float3(0, 1, 0)); + /*ase_local_var:wbt*/float3 worldBitangent = TransformObjectToWorldDir(float3(0, 0, 1)); + + #ifdef DECAL_ANGLE_FADE + half2 angleFade = half2(normalToWorld[1][3], normalToWorld[2][3]); + + if (angleFade.y < 0.0f) + { + half3 decalNormal = half3(normalToWorld[0].z, normalToWorld[1].z, normalToWorld[2].z); + half dotAngle = dot(normalWS, decalNormal); + angleFadeFactor = saturate(angleFade.x + angleFade.y * (dotAngle * (dotAngle - 2.0))); + } + #endif + + half3 viewDirectionWS = half3(packedInput.viewDirectionWS); + DecalSurfaceData surfaceData; + + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + /*ase_frag_code:packedInput=PackedVaryings*/ + + surfaceDescription.BaseColor = /*ase_frag_out:Base Color;Float3;0;-1;_BaseColor*/IsGammaSpace() ? float3(0.5, 0.5, 0.5) : SRGBToLinear(float3(0.5, 0.5, 0.5))/*end*/; + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;1;-1;_Alpha*/1/*end*/; + surfaceDescription.NormalTS = /*ase_frag_out:Normal;Float3;2;-1;_NormalTS*/float3(0.0f, 0.0f, 1.0f)/*end*/; + surfaceDescription.NormalAlpha = /*ase_frag_out:Normal Alpha;Float;3;-1;_NormalAlpha*/1/*end*/; + + #if defined( _MATERIAL_AFFECTS_MAOS ) + surfaceDescription.Metallic = /*ase_frag_out:Metallic;Float;4;-1;_Metallic*/0/*end*/; + surfaceDescription.Occlusion =/*ase_frag_out:Occlusion;Float;5;-1;_Occlusion*/1/*end*/; + surfaceDescription.Smoothness = /*ase_frag_out:Smoothness;Float;6;-1;_Smoothness*/0.5/*end*/; + surfaceDescription.MAOSAlpha = /*ase_frag_out:MAOS Alpha;Float;7;-1;_MAOSAlpha*/1/*end*/; + #endif + + #if defined( _MATERIAL_AFFECTS_EMISSION ) + surfaceDescription.Emission = /*ase_frag_out:Emission;Float;8;-1;_Emission*/float3(0, 0, 0)/*end*/; + #endif + + GetSurfaceData(surfaceDescription, angleFadeFactor, surfaceData); + + half3 normalToPack = surfaceData.normalWS.xyz; + #ifdef DECAL_RECONSTRUCT_NORMAL + surfaceData.normalWS.xyz = normalize(lerp(normalWS.xyz, surfaceData.normalWS.xyz, surfaceData.normalWS.w)); + #endif + + InputData inputData; + InitializeInputData(packedInput, positionWS, surfaceData.normalWS.xyz, viewDirectionWS, inputData); + + SurfaceData surface = (SurfaceData)0; + GetSurface(surfaceData, surface); + + BRDFData brdfData; + InitializeBRDFData(surface.albedo, surface.metallic, 0, surface.smoothness, surface.alpha, brdfData); + + #ifdef _MATERIAL_AFFECTS_ALBEDO + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + MixRealtimeAndBakedGI(mainLight, surfaceData.normalWS.xyz, inputData.bakedGI, inputData.shadowMask); + half3 color = GlobalIllumination(brdfData, inputData.bakedGI, surface.occlusion, surfaceData.normalWS.xyz, inputData.viewDirectionWS); + #else + half3 color = 0; + #endif + + #pragma warning (disable : 3578) // The output value isn't completely initialized. + half3 packedNormalWS = PackNormal(normalToPack); + fragmentOutput.GBuffer0 = half4(surfaceData.baseColor.rgb, surfaceData.baseColor.a); + fragmentOutput.GBuffer1 = 0; + fragmentOutput.GBuffer2 = half4(packedNormalWS, surfaceData.normalWS.a); + fragmentOutput.GBuffer3 = half4(surfaceData.emissive + color, surfaceData.baseColor.a); + #if OUTPUT_SHADOWMASK + fragmentOutput.GBuffer4 = inputData.shadowMask; // will have unity_ProbesOcclusion value if subtractive lighting is used (baked) + #endif + #pragma warning (default : 3578) // Restore output value isn't completely initialized. + + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "DBufferMesh" + Tags + { + "LightMode" = "DBufferMesh" + } + + Blend 0 SrcAlpha OneMinusSrcAlpha, Zero OneMinusSrcAlpha + Blend 1 SrcAlpha OneMinusSrcAlpha, Zero OneMinusSrcAlpha + Blend 2 SrcAlpha OneMinusSrcAlpha, Zero OneMinusSrcAlpha + ZTest LEqual + ZWrite Off + ColorMask RGBA + ColorMask RGBA 1 + ColorMask RGBA 2 + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + #pragma multi_compile_instancing + #pragma editor_sync_compilation + + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ _DECAL_LAYERS + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_TEXCOORD1 + #define ATTRIBUTES_NEED_TEXCOORD2 + #define VARYINGS_NEED_POSITION_WS + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_TANGENT_WS + #define VARYINGS_NEED_TEXCOORD0 + + #define HAVE_MESH_MODIFICATION + + #define SHADERPASS SHADERPASS_DBUFFER_MESH + + #if _RENDER_PASS_ENABLED + #define GBUFFER3 0 + #define GBUFFER4 1 + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); + #endif + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + struct SurfaceDescription + { + float3 BaseColor; + float Alpha; + float3 NormalTS; + float NormalAlpha; + float Metallic; + float Occlusion; + float Smoothness; + float MAOSAlpha; + }; + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 uv0 : TEXCOORD0; + float4 uv1 : TEXCOORD1; + float4 uv2 : TEXCOORD2; + /*ase_vdata:p=p;n=n;t=t;uv0=tc0;uv1=tc1;uv2=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float3 positionWS : TEXCOORD0; + float3 normalWS : TEXCOORD1; + float4 tangentWS : TEXCOORD2; + float4 texCoord0 : TEXCOORD3; + /*ase_interp(4,):sp=sp;wp=tc0;wn=tc1;wt=tc2;uv0=tc3*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float _DrawOrder; + float _DecalMeshBiasType; + float _DecalMeshDepthBias; + float _DecalMeshViewBias; + #if defined(DECAL_ANGLE_FADE) + float _DecalAngleFadeSupported; + #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + void GetSurfaceData(PackedVaryings input, SurfaceDescription surfaceDescription, out DecalSurfaceData surfaceData) + { + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + half fadeFactor = half(1.0); + + ZERO_INITIALIZE(DecalSurfaceData, surfaceData); + surfaceData.occlusion = half(1.0); + surfaceData.smoothness = half(0); + + #ifdef _MATERIAL_AFFECTS_NORMAL + surfaceData.normalWS.w = half(1.0); + #else + surfaceData.normalWS.w = half(0.0); + #endif + + surfaceData.baseColor.xyz = half3(surfaceDescription.BaseColor); + surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor); + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #if defined(_MATERIAL_AFFECTS_NORMAL) + surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz)); + #else + surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz); + #endif + #elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #if defined(_MATERIAL_AFFECTS_NORMAL) + float sgn = input.tangentWS.w; + float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz); + half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz); + + surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld)); + #else + surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); + #endif + #endif + + surfaceData.normalWS.w = surfaceDescription.NormalAlpha * fadeFactor; + + #if defined( _MATERIAL_AFFECTS_MAOS ) + surfaceData.metallic = half(surfaceDescription.Metallic); + surfaceData.occlusion = half(surfaceDescription.Occlusion); + surfaceData.smoothness = half(surfaceDescription.Smoothness); + surfaceData.MAOSAlpha = half(surfaceDescription.MAOSAlpha * fadeFactor); + #endif + } + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #define DECAL_PROJECTOR + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_MESH + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DBUFFER_MESH) + #define DECAL_DBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) + #define DECAL_SCREEN_SPACE + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_GBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) + #define DECAL_FORWARD_EMISSIVE + #endif + + #if ((!defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_ALBEDO)) || (defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_NORMAL_BLEND))) && (defined(DECAL_SCREEN_SPACE) || defined(DECAL_GBUFFER)) + #define DECAL_RECONSTRUCT_NORMAL + #elif defined(DECAL_ANGLE_FADE) + #define DECAL_LOAD_NORMAL + #endif + + #ifdef _DECAL_LAYERS + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareRenderingLayerTexture.hlsl" + #endif + + #if defined(DECAL_LOAD_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + #if defined(DECAL_PROJECTOR) || defined(DECAL_RECONSTRUCT_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" + #endif + + #ifdef DECAL_MESH + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DecalMeshBiasTypeEnum.cs.hlsl" + #endif + + #ifdef DECAL_RECONSTRUCT_NORMAL + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl" + #endif + + void MeshDecalsPositionZBias(inout PackedVaryings input) + { + #if UNITY_REVERSED_Z + input.positionCS.z -= _DecalMeshDepthBias; + #else + input.positionCS.z += _DecalMeshDepthBias; + #endif + } + + PackedVaryings Vert(Attributes inputMesh /*ase_vert_input*/ ) + { + if (_DecalMeshBiasType == DECALMESHDEPTHBIASTYPE_VIEW_BIAS) + { + float3 viewDirectionOS = GetObjectSpaceNormalizeViewDir(inputMesh.positionOS); + inputMesh.positionOS += viewDirectionOS * (_DecalMeshViewBias); + } + + PackedVaryings packedOutput; + ZERO_INITIALIZE(PackedVaryings, packedOutput); + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, packedOutput); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(packedOutput); + + inputMesh.tangentOS = float4( 1, 0, 0, -1 ); + inputMesh.normalOS = float3( 0, 1, 0 ); + + /*ase_vert_code:inputMesh=Attributes;packedOutput=PackedVaryings*/ + + VertexPositionInputs vertexInput = GetVertexPositionInputs(inputMesh.positionOS.xyz); + + float3 positionWS = TransformObjectToWorld(inputMesh.positionOS); + + float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS); + float4 tangentWS = float4(TransformObjectToWorldDir(inputMesh.tangentOS.xyz), inputMesh.tangentOS.w); + + packedOutput.positionWS.xyz = positionWS; + packedOutput.normalWS.xyz = normalWS; + packedOutput.tangentWS.xyzw = tangentWS; + packedOutput.texCoord0.xyzw = inputMesh.uv0; + packedOutput.positionCS = TransformWorldToHClip(positionWS); + + if (_DecalMeshBiasType == DECALMESHDEPTHBIASTYPE_DEPTH_BIAS) + { + MeshDecalsPositionZBias(packedOutput); + } + + return packedOutput; + } + + void Frag(PackedVaryings packedInput, + OUTPUT_DBUFFER(outDBuffer) + /*ase_frag_input*/ + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + UNITY_SETUP_INSTANCE_ID(packedInput); + + half angleFadeFactor = 1.0; + + #ifdef _DECAL_LAYERS + #ifdef _RENDER_PASS_ENABLED + uint surfaceRenderingLayer = DecodeMeshRenderingLayer(LOAD_FRAMEBUFFER_INPUT(GBUFFER4, packedInput.positionCS.xy).r); + #else + uint surfaceRenderingLayer = LoadSceneRenderingLayer(packedInput.positionCS.xy); + #endif + uint projectorRenderingLayer = uint(UNITY_ACCESS_INSTANCED_PROP(Decal, _DecalLayerMaskFromDecal)); + clip((surfaceRenderingLayer & projectorRenderingLayer) - 0.1); + #endif + + #if defined(DECAL_RECONSTRUCT_NORMAL) + #if defined(_DECAL_NORMAL_BLEND_HIGH) + half3 normalWS = half3(ReconstructNormalTap9(packedInput.positionCS.xy)); + #elif defined(_DECAL_NORMAL_BLEND_MEDIUM) + half3 normalWS = half3(ReconstructNormalTap5(packedInput.positionCS.xy)); + #else + half3 normalWS = half3(ReconstructNormalDerivative(packedInput.positionCS.xy)); + #endif + #elif defined(DECAL_LOAD_NORMAL) + half3 normalWS = half3(LoadSceneNormals(packedInput.positionCS.xy)); + #endif + + float2 positionSS = FoveatedRemapNonUniformToLinearCS(packedInput.positionCS.xy) * _ScreenSize.zw; + + float3 positionWS = packedInput.positionWS.xyz; + half3 viewDirectionWS = half3(1.0, 1.0, 1.0); + + DecalSurfaceData surfaceData; + SurfaceDescription surfaceDescription; + + /*ase_frag_code:packedInput=PackedVaryings*/ + + surfaceDescription.BaseColor = /*ase_frag_out:Base Color;Float3;0;-1;_BaseColor*/IsGammaSpace() ? float3(0.5, 0.5, 0.5) : SRGBToLinear(float3(0.5, 0.5, 0.5))/*end*/; + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;1;-1;_Alpha*/1/*end*/; + surfaceDescription.NormalTS = /*ase_frag_out:Normal;Float3;2;-1;_NormalTS*/float3(0.0f, 0.0f, 1.0f)/*end*/; + surfaceDescription.NormalAlpha = /*ase_frag_out:Normal Alpha;Float;3;-1;_NormalAlpha*/1/*end*/; + + #if defined( _MATERIAL_AFFECTS_MAOS ) + surfaceDescription.Metallic = /*ase_frag_out:Metallic;Float;4;-1;_Metallic*/0/*end*/; + surfaceDescription.Occlusion = /*ase_frag_out:Occlusion;Float;5;-1;_Occlusion*/1/*end*/; + surfaceDescription.Smoothness = /*ase_frag_out:Smoothness;Float;6;-1;_Smoothness*/0.5/*end*/; + surfaceDescription.MAOSAlpha = /*ase_frag_out:MAOS Alpha;Float;7;-1;_MAOSAlpha*/1/*end*/; + #endif + + GetSurfaceData(packedInput, surfaceDescription, surfaceData); + ENCODE_INTO_DBUFFER(surfaceData, outDBuffer); + + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "DecalMeshForwardEmissive" + Tags + { + "LightMode" = "DecalMeshForwardEmissive" + } + + Blend 0 SrcAlpha One + ZTest LEqual + ZWrite Off + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + #pragma multi_compile_instancing + #pragma editor_sync_compilation + + #pragma multi_compile _ _DECAL_LAYERS + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_TEXCOORD1 + #define ATTRIBUTES_NEED_TEXCOORD2 + #define VARYINGS_NEED_POSITION_WS + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_TANGENT_WS + #define VARYINGS_NEED_TEXCOORD0 + + #define HAVE_MESH_MODIFICATION + + #define SHADERPASS SHADERPASS_FORWARD_EMISSIVE_MESH + + #if _RENDER_PASS_ENABLED + #define GBUFFER3 0 + #define GBUFFER4 1 + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); + #endif + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + struct SurfaceDescription + { + float3 BaseColor; + float Alpha; + float3 NormalTS; + float NormalAlpha; + float Metallic; + float Occlusion; + float Smoothness; + float MAOSAlpha; + float3 Emission; + }; + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 uv0 : TEXCOORD0; + float4 uv1 : TEXCOORD1; + float4 uv2 : TEXCOORD2; + /*ase_vdata:p=p;n=n;t=t;uv0=tc0;uv1=tc1;uv2=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float3 positionWS : TEXCOORD0; + float3 normalWS : TEXCOORD1; + float4 tangentWS : TEXCOORD2; + float4 texCoord0 : TEXCOORD3; + /*ase_interp(4,):sp=sp;wp=tc0;wn=tc1;wt=tc2;uv0=tc3*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float _DrawOrder; + float _DecalMeshBiasType; + float _DecalMeshDepthBias; + float _DecalMeshViewBias; + #if defined(DECAL_ANGLE_FADE) + float _DecalAngleFadeSupported; + #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + void GetSurfaceData(SurfaceDescription surfaceDescription, float4 positionCS, out DecalSurfaceData surfaceData) + { + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + half fadeFactor = half(1.0); + + ZERO_INITIALIZE(DecalSurfaceData, surfaceData); + surfaceData.occlusion = half(1.0); + surfaceData.smoothness = half(0); + + #ifdef _MATERIAL_AFFECTS_NORMAL + surfaceData.normalWS.w = half(1.0); + #else + surfaceData.normalWS.w = half(0.0); + #endif + + #if defined( _MATERIAL_AFFECTS_EMISSION ) + surfaceData.emissive.rgb = half3(surfaceDescription.Emission.rgb * fadeFactor); + #endif + + surfaceData.baseColor.xyz = half3(surfaceDescription.BaseColor); + surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor); + + surfaceData.normalWS.w = surfaceDescription.NormalAlpha * fadeFactor; + + #if defined( _MATERIAL_AFFECTS_MAOS ) + surfaceData.metallic = half(surfaceDescription.Metallic); + surfaceData.occlusion = half(surfaceDescription.Occlusion); + surfaceData.smoothness = half(surfaceDescription.Smoothness); + surfaceData.MAOSAlpha = half(surfaceDescription.MAOSAlpha * fadeFactor); + #endif + } + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #define DECAL_PROJECTOR + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_MESH + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DBUFFER_MESH) + #define DECAL_DBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) + #define DECAL_SCREEN_SPACE + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_GBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) + #define DECAL_FORWARD_EMISSIVE + #endif + + #if ((!defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_ALBEDO)) || (defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_NORMAL_BLEND))) && (defined(DECAL_SCREEN_SPACE) || defined(DECAL_GBUFFER)) + #define DECAL_RECONSTRUCT_NORMAL + #elif defined(DECAL_ANGLE_FADE) + #define DECAL_LOAD_NORMAL + #endif + + #ifdef _DECAL_LAYERS + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareRenderingLayerTexture.hlsl" + #endif + + #if defined(DECAL_LOAD_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + #if defined(DECAL_PROJECTOR) || defined(DECAL_RECONSTRUCT_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" + #endif + + #ifdef DECAL_MESH + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DecalMeshBiasTypeEnum.cs.hlsl" + #endif + + #ifdef DECAL_RECONSTRUCT_NORMAL + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl" + #endif + + void MeshDecalsPositionZBias(inout PackedVaryings input) + { + #if UNITY_REVERSED_Z + input.positionCS.z -= _DecalMeshDepthBias; + #else + input.positionCS.z += _DecalMeshDepthBias; + #endif + } + + PackedVaryings Vert(Attributes inputMesh /*ase_vert_input*/ ) + { + if (_DecalMeshBiasType == DECALMESHDEPTHBIASTYPE_VIEW_BIAS) + { + float3 viewDirectionOS = GetObjectSpaceNormalizeViewDir(inputMesh.positionOS); + inputMesh.positionOS += viewDirectionOS * (_DecalMeshViewBias); + } + + PackedVaryings packedOutput; + ZERO_INITIALIZE(PackedVaryings, packedOutput); + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, packedOutput); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(packedOutput); + + inputMesh.tangentOS = float4( 1, 0, 0, -1 ); + inputMesh.normalOS = float3( 0, 1, 0 ); + + /*ase_vert_code:inputMesh=Attributes;packedOutput=PackedVaryings*/ + + VertexPositionInputs vertexInput = GetVertexPositionInputs(inputMesh.positionOS.xyz); + + float3 positionWS = TransformObjectToWorld(inputMesh.positionOS); + float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS); + float4 tangentWS = float4(TransformObjectToWorldDir(inputMesh.tangentOS.xyz), inputMesh.tangentOS.w); + + packedOutput.positionCS = TransformWorldToHClip(positionWS); + + if (_DecalMeshBiasType == DECALMESHDEPTHBIASTYPE_DEPTH_BIAS) + { + MeshDecalsPositionZBias(packedOutput); + } + + packedOutput.positionWS.xyz = positionWS; + packedOutput.normalWS.xyz = normalWS; + packedOutput.tangentWS.xyzw = tangentWS; + packedOutput.texCoord0.xyzw = inputMesh.uv0; + + return packedOutput; + } + + void Frag(PackedVaryings packedInput, + out half4 outEmissive : SV_Target0 + /*ase_frag_input*/ + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + UNITY_SETUP_INSTANCE_ID(packedInput); + + half angleFadeFactor = 1.0; + + #ifdef _DECAL_LAYERS + #ifdef _RENDER_PASS_ENABLED + uint surfaceRenderingLayer = DecodeMeshRenderingLayer(LOAD_FRAMEBUFFER_INPUT(GBUFFER4, packedInput.positionCS.xy).r); + #else + uint surfaceRenderingLayer = LoadSceneRenderingLayer(packedInput.positionCS.xy); + #endif + uint projectorRenderingLayer = uint(UNITY_ACCESS_INSTANCED_PROP(Decal, _DecalLayerMaskFromDecal)); + clip((surfaceRenderingLayer & projectorRenderingLayer) - 0.1); + #endif + + #if defined(DECAL_RECONSTRUCT_NORMAL) + #if defined(_DECAL_NORMAL_BLEND_HIGH) + half3 normalWS = half3(ReconstructNormalTap9(packedInput.positionCS.xy)); + #elif defined(_DECAL_NORMAL_BLEND_MEDIUM) + half3 normalWS = half3(ReconstructNormalTap5(packedInput.positionCS.xy)); + #else + half3 normalWS = half3(ReconstructNormalDerivative(packedInput.positionCS.xy)); + #endif + #elif defined(DECAL_LOAD_NORMAL) + half3 normalWS = half3(LoadSceneNormals(packedInput.positionCS.xy)); + #endif + + float2 positionSS = FoveatedRemapNonUniformToLinearCS(packedInput.positionCS.xy) * _ScreenSize.zw; + + float3 positionWS = packedInput.positionWS.xyz; + half3 viewDirectionWS = half3(1.0, 1.0, 1.0); + + DecalSurfaceData surfaceData; + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + /*ase_frag_code:packedInput=PackedVaryings*/ + + surfaceDescription.BaseColor = /*ase_frag_out:Base Color;Float3;0;-1;_BaseColor*/IsGammaSpace() ? float3(0.5, 0.5, 0.5) : SRGBToLinear(float3(0.5, 0.5, 0.5))/*end*/; + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;1;-1;_Alpha*/1/*end*/; + surfaceDescription.NormalTS = /*ase_frag_out:Normal;Float3;2;-1;_NormalTS*/float3(0.0f, 0.0f, 1.0f)/*end*/; + surfaceDescription.NormalAlpha = /*ase_frag_out:Normal Alpha;Float;3;-1;_NormalAlpha*/1/*end*/; + + #if defined( _MATERIAL_AFFECTS_MAOS ) + surfaceDescription.Metallic = /*ase_frag_out:Metallic;Float;4;-1;_Metallic*/0/*end*/; + surfaceDescription.Occlusion = /*ase_frag_out:Occlusion;Float;5;-1;_Occlusion*/1/*end*/; + surfaceDescription.Smoothness = /*ase_frag_out:Smoothness;Float;6;-1;_Smoothness*/0.5/*end*/; + surfaceDescription.MAOSAlpha = /*ase_frag_out:MAOS Alpha;Float;7;-1;_MAOSAlpha*/1/*end*/; + #endif + + #if defined( _MATERIAL_AFFECTS_EMISSION ) + surfaceDescription.Emission = /*ase_frag_out:Emission;Float3;8;-1;_Emission*/float3(0, 0, 0)/*end*/; + #endif + + GetSurfaceData(surfaceDescription, packedInput.positionCS, surfaceData); + + outEmissive.rgb = surfaceData.emissive * GetCurrentExposureMultiplier(); + outEmissive.a = surfaceData.baseColor.a; + + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "DecalScreenSpaceMesh" + Tags + { + "LightMode" = "DecalScreenSpaceMesh" + } + + Blend SrcAlpha OneMinusSrcAlpha + ZTest LEqual + ZWrite Off + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma editor_sync_compilation + + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile _DECAL_NORMAL_BLEND_LOW _DECAL_NORMAL_BLEND_MEDIUM _DECAL_NORMAL_BLEND_HIGH + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile _ _DECAL_LAYERS + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_TEXCOORD1 + #define ATTRIBUTES_NEED_TEXCOORD2 + #define VARYINGS_NEED_POSITION_WS + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_VIEWDIRECTION_WS + #define VARYINGS_NEED_TANGENT_WS + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define VARYINGS_NEED_SH + #define VARYINGS_NEED_STATIC_LIGHTMAP_UV + #define VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV + + #define HAVE_MESH_MODIFICATION + + #define SHADERPASS SHADERPASS_DECAL_SCREEN_SPACE_MESH + + #if _RENDER_PASS_ENABLED + #define GBUFFER3 0 + #define GBUFFER4 1 + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); + #endif + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + struct SurfaceDescription + { + float3 BaseColor; + float Alpha; + float3 NormalTS; + float NormalAlpha; + float Metallic; + float Occlusion; + float Smoothness; + float MAOSAlpha; + float3 Emission; + }; + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 uv0 : TEXCOORD0; + float4 uv1 : TEXCOORD1; + float4 uv2 : TEXCOORD2; + /*ase_vdata:p=p;n=n;t=t;uv0=tc0;uv1=tc1;uv2=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float3 positionWS : TEXCOORD0; + float3 normalWS : TEXCOORD1; + float4 tangentWS : TEXCOORD2; + float4 texCoord0 : TEXCOORD3; + float3 viewDirectionWS : TEXCOORD4; + float4 lightmapUVs : TEXCOORD5; // @diogo: packs both static (xy) and dynamic (zw) + float3 sh : TEXCOORD6; + float4 fogFactorAndVertexLight : TEXCOORD7; + #ifdef USE_APV_PROBE_OCCLUSION + float4 probeOcclusion : TEXCOORD8; + #endif + /*ase_interp(9,):sp=sp;wp=tc0;wn=tc1;wt=tc2;uv0=tc3;wvd=tc4*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float _DrawOrder; + float _DecalMeshBiasType; + float _DecalMeshDepthBias; + float _DecalMeshViewBias; + #if defined(DECAL_ANGLE_FADE) + float _DecalAngleFadeSupported; + #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + void GetSurfaceData(PackedVaryings input, SurfaceDescription surfaceDescription, out DecalSurfaceData surfaceData) + { + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + half fadeFactor = half(1.0); + + ZERO_INITIALIZE(DecalSurfaceData, surfaceData); + surfaceData.occlusion = half(1.0); + surfaceData.smoothness = half(0); + + #ifdef _MATERIAL_AFFECTS_NORMAL + surfaceData.normalWS.w = half(1.0); + #else + surfaceData.normalWS.w = half(0.0); + #endif + + #if defined( _MATERIAL_AFFECTS_EMISSION ) + surfaceData.emissive.rgb = half3(surfaceDescription.Emission.rgb * fadeFactor); + #endif + + surfaceData.baseColor.xyz = half3(surfaceDescription.BaseColor); + surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor); + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #if defined(_MATERIAL_AFFECTS_NORMAL) + surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz)); + #else + surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz); + #endif + #elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #if defined(_MATERIAL_AFFECTS_NORMAL) + float sgn = input.tangentWS.w; + float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz); + half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz); + + surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld)); + #else + surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); + #endif + #endif + + surfaceData.normalWS.w = surfaceDescription.NormalAlpha * fadeFactor; + + #if defined( _MATERIAL_AFFECTS_MAOS ) + surfaceData.metallic = half(surfaceDescription.Metallic); + surfaceData.occlusion = half(surfaceDescription.Occlusion); + surfaceData.smoothness = half(surfaceDescription.Smoothness); + surfaceData.MAOSAlpha = half(surfaceDescription.MAOSAlpha * fadeFactor); + #endif + } + + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #define DECAL_PROJECTOR + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_MESH + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DBUFFER_MESH) + #define DECAL_DBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) + #define DECAL_SCREEN_SPACE + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_GBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) + #define DECAL_FORWARD_EMISSIVE + #endif + + #if ((!defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_ALBEDO)) || (defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_NORMAL_BLEND))) && (defined(DECAL_SCREEN_SPACE) || defined(DECAL_GBUFFER)) + #define DECAL_RECONSTRUCT_NORMAL + #elif defined(DECAL_ANGLE_FADE) + #define DECAL_LOAD_NORMAL + #endif + + #ifdef _DECAL_LAYERS + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareRenderingLayerTexture.hlsl" + #endif + + #if defined(DECAL_LOAD_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + #if defined(DECAL_PROJECTOR) || defined(DECAL_RECONSTRUCT_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" + #endif + + #ifdef DECAL_MESH + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DecalMeshBiasTypeEnum.cs.hlsl" + #endif + + #ifdef DECAL_RECONSTRUCT_NORMAL + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl" + #endif + + void MeshDecalsPositionZBias(inout PackedVaryings input) + { + #if UNITY_REVERSED_Z + input.positionCS.z -= _DecalMeshDepthBias; + #else + input.positionCS.z += _DecalMeshDepthBias; + #endif + } + + void InitializeInputData(PackedVaryings input, float3 positionWS, half3 normalWS, half3 viewDirectionWS, out InputData inputData) + { + inputData = (InputData)0; + + inputData.positionWS = positionWS; + inputData.normalWS = normalWS; + inputData.viewDirectionWS = viewDirectionWS; + inputData.shadowCoord = float4(0, 0, 0, 0); + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + inputData.fogCoord = InitializeInputDataFog(float4(positionWS, 1.0), input.fogFactorAndVertexLight.x); + inputData.vertexLighting = input.fogFactorAndVertexLight.yzw; + #endif + + #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV.xy, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #elif defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + #if !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) + inputData.bakedGI = SAMPLE_GI(input.sh, + GetAbsolutePositionWS(inputData.positionWS), + inputData.normalWS, + inputData.viewDirectionWS, + input.positionCS.xy, + input.probeOcclusion, + inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #endif + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy; + #endif + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) && defined(LIGHTMAP_ON) + inputData.staticLightmapUV = input.staticLightmapUV + #elif defined(VARYINGS_NEED_SH) + inputData.vertexSH = input.sh; + #endif + #if defined(USE_APV_PROBE_OCCLUSION) + inputData.probeOcclusion = input.probeOcclusion; + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); + } + + void GetSurface(DecalSurfaceData decalSurfaceData, inout SurfaceData surfaceData) + { + surfaceData.albedo = decalSurfaceData.baseColor.rgb; + surfaceData.metallic = saturate(decalSurfaceData.metallic); + surfaceData.specular = 0; + surfaceData.smoothness = saturate(decalSurfaceData.smoothness); + surfaceData.occlusion = decalSurfaceData.occlusion; + surfaceData.emission = decalSurfaceData.emissive; + surfaceData.alpha = saturate(decalSurfaceData.baseColor.w); + surfaceData.clearCoatMask = 0; + surfaceData.clearCoatSmoothness = 1; + } + + PackedVaryings Vert(Attributes inputMesh /*ase_vert_input*/ ) + { + if (_DecalMeshBiasType == DECALMESHDEPTHBIASTYPE_VIEW_BIAS) + { + float3 viewDirectionOS = GetObjectSpaceNormalizeViewDir(inputMesh.positionOS); + inputMesh.positionOS += viewDirectionOS * (_DecalMeshViewBias); + } + + PackedVaryings packedOutput; + ZERO_INITIALIZE(PackedVaryings, packedOutput); + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, packedOutput); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(packedOutput); + + inputMesh.tangentOS = float4( 1, 0, 0, -1 ); + inputMesh.normalOS = float3( 0, 1, 0 ); + + /*ase_vert_code:inputMesh=Attributes;packedOutput=PackedVaryings*/ + + VertexPositionInputs vertexInput = GetVertexPositionInputs(inputMesh.positionOS.xyz); + float3 positionWS = TransformObjectToWorld(inputMesh.positionOS); + float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS); + float4 tangentWS = float4(TransformObjectToWorldDir(inputMesh.tangentOS.xyz), inputMesh.tangentOS.w); + + packedOutput.positionCS = TransformWorldToHClip(positionWS); + + half fogFactor = 0; + #if !defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(packedOutput.positionCS.z); + #endif + + half3 vertexLight = VertexLighting(positionWS, normalWS); + packedOutput.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + if (_DecalMeshBiasType == DECALMESHDEPTHBIASTYPE_DEPTH_BIAS) + { + MeshDecalsPositionZBias(packedOutput); + } + + packedOutput.positionWS.xyz = positionWS; + packedOutput.normalWS.xyz = normalWS; + packedOutput.tangentWS.xyzw = tangentWS; + packedOutput.texCoord0.xyzw = inputMesh.uv0; + packedOutput.viewDirectionWS.xyz = GetWorldSpaceViewDir(positionWS); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV(inputMesh.uv1, unity_LightmapST, packedOutput.staticLightmapUV); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + packedOutput.dynamicLightmapUV.xy = inputMesh.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + #if !defined(LIGHTMAP_ON) + packedOutput.sh = float3(SampleSHVertex(half3(normalWS))); + #endif + + return packedOutput; + } + + void Frag(PackedVaryings packedInput, + out half4 outColor : SV_Target0 + /*ase_frag_input*/ + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + UNITY_SETUP_INSTANCE_ID(packedInput); + + half angleFadeFactor = 1.0; + + #ifdef _DECAL_LAYERS + #ifdef _RENDER_PASS_ENABLED + uint surfaceRenderingLayer = DecodeMeshRenderingLayer(LOAD_FRAMEBUFFER_INPUT(GBUFFER4, packedInput.positionCS.xy).r); + #else + uint surfaceRenderingLayer = LoadSceneRenderingLayer(packedInput.positionCS.xy); + #endif + uint projectorRenderingLayer = uint(UNITY_ACCESS_INSTANCED_PROP(Decal, _DecalLayerMaskFromDecal)); + clip((surfaceRenderingLayer & projectorRenderingLayer) - 0.1); + #endif + + #if defined(DECAL_RECONSTRUCT_NORMAL) + #if defined(_DECAL_NORMAL_BLEND_HIGH) + half3 normalWS = half3(ReconstructNormalTap9(packedInput.positionCS.xy)); + #elif defined(_DECAL_NORMAL_BLEND_MEDIUM) + half3 normalWS = half3(ReconstructNormalTap5(packedInput.positionCS.xy)); + #else + half3 normalWS = half3(ReconstructNormalDerivative(packedInput.positionCS.xy)); + #endif + #elif defined(DECAL_LOAD_NORMAL) + half3 normalWS = half3(LoadSceneNormals(packedInput.positionCS.xy)); + #endif + + float2 positionSS = FoveatedRemapNonUniformToLinearCS(packedInput.positionCS.xy) * _ScreenSize.zw; + + float3 positionWS = packedInput.positionWS.xyz; + half3 viewDirectionWS = half3(packedInput.viewDirectionWS); + + DecalSurfaceData surfaceData; + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + /*ase_frag_code:packedInput=PackedVaryings*/ + + surfaceDescription.BaseColor = /*ase_frag_out:Base Color;Float3;0;-1;_BaseColor*/IsGammaSpace() ? float3(0.5, 0.5, 0.5) : SRGBToLinear(float3(0.5, 0.5, 0.5))/*end*/; + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;1;-1;_Alpha*/1/*end*/; + surfaceDescription.NormalTS = /*ase_frag_out:Normal;Float3;2;-1;_NormalTS*/float3(0.0f, 0.0f, 1.0f)/*end*/; + surfaceDescription.NormalAlpha = /*ase_frag_out:Normal Alpha;Float;3;-1;_NormalAlpha*/1/*end*/; + + #if defined( _MATERIAL_AFFECTS_MAOS ) + surfaceDescription.Metallic = /*ase_frag_out:Metallic;Float;4;-1;_Metallic*/0/*end*/; + surfaceDescription.Occlusion = /*ase_frag_out:Occlusion;Float;5;-1;_Occlusion*/1/*end*/; + surfaceDescription.Smoothness = /*ase_frag_out:Smoothness;Float;6;-1;_Smoothness*/0.5/*end*/; + surfaceDescription.MAOSAlpha = /*ase_frag_out:MAOS Alpha;Float;7;-1;_MAOSAlpha*/1/*end*/; + #endif + + #if defined( _MATERIAL_AFFECTS_EMISSION ) + surfaceDescription.Emission = /*ase_frag_out:Emission;Float3;8;-1;_Emission*/float3(0, 0, 0)/*end*/; + #endif + + GetSurfaceData(packedInput, surfaceDescription, surfaceData); + + half3 normalToPack = surfaceData.normalWS.xyz; + #ifdef DECAL_RECONSTRUCT_NORMAL + surfaceData.normalWS.xyz = normalize(lerp(normalWS.xyz, surfaceData.normalWS.xyz, surfaceData.normalWS.w)); + #endif + + InputData inputData; + InitializeInputData(packedInput, positionWS, surfaceData.normalWS.xyz, viewDirectionWS, inputData); + + SurfaceData surface = (SurfaceData)0; + GetSurface(surfaceData, surface); + + half4 color = UniversalFragmentPBR(inputData, surface); + color.rgb = MixFog(color.rgb, inputData.fogCoord); + outColor = color; + + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "DecalGBufferMesh" + Tags + { + "LightMode" = "DecalGBufferMesh" + } + + Blend 0 SrcAlpha OneMinusSrcAlpha + Blend 1 SrcAlpha OneMinusSrcAlpha + Blend 2 SrcAlpha OneMinusSrcAlpha + Blend 3 SrcAlpha OneMinusSrcAlpha + ZWrite Off + ColorMask RGB + ColorMask 0 1 + ColorMask RGB 2 + ColorMask RGB 3 + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma editor_sync_compilation + + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE + #pragma multi_compile _DECAL_NORMAL_BLEND_LOW _DECAL_NORMAL_BLEND_MEDIUM _DECAL_NORMAL_BLEND_HIGH + #pragma multi_compile _ _DECAL_LAYERS + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD0 + #define ATTRIBUTES_NEED_TEXCOORD1 + #define ATTRIBUTES_NEED_TEXCOORD2 + #define VARYINGS_NEED_POSITION_WS + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_VIEWDIRECTION_WS + #define VARYINGS_NEED_TANGENT_WS + #define VARYINGS_NEED_TEXCOORD0 + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define VARYINGS_NEED_SH + #define VARYINGS_NEED_STATIC_LIGHTMAP_UV + #define VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV + + #define HAVE_MESH_MODIFICATION + + #define SHADERPASS SHADERPASS_DECAL_GBUFFER_MESH + + #if _RENDER_PASS_ENABLED + #define GBUFFER3 0 + #define GBUFFER4 1 + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); + #endif + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + struct SurfaceDescription + { + float3 BaseColor; + float Alpha; + float3 NormalTS; + float NormalAlpha; + float Metallic; + float Occlusion; + float Smoothness; + float MAOSAlpha; + float3 Emission; + }; + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 uv0 : TEXCOORD0; + float4 uv1 : TEXCOORD1; + float4 uv2 : TEXCOORD2; + /*ase_vdata:p=p;n=n;t=t;uv0=tc0;uv1=tc1;uv2=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float3 positionWS : TEXCOORD0; + float3 normalWS : TEXCOORD1; + float4 tangentWS : TEXCOORD2; + float4 texCoord0 : TEXCOORD3; + float3 viewDirectionWS : TEXCOORD4; + float4 lightmapUVs : TEXCOORD5; // @diogo: packs both static (xy) and dynamic (zw) + float3 sh : TEXCOORD6; + float4 fogFactorAndVertexLight : TEXCOORD7; + #ifdef USE_APV_PROBE_OCCLUSION + float4 probeOcclusion : TEXCOORD10; + #endif + /*ase_interp(9,):sp=sp;wp=tc0;wn=tc1;wt=tc2;uv0=tc3;wvd=tc4*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float _DrawOrder; + float _DecalMeshBiasType; + float _DecalMeshDepthBias; + float _DecalMeshViewBias; + #if defined(DECAL_ANGLE_FADE) + float _DecalAngleFadeSupported; + #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + void GetSurfaceData(PackedVaryings input, SurfaceDescription surfaceDescription, out DecalSurfaceData surfaceData) + { + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + half fadeFactor = half(1.0); + + ZERO_INITIALIZE(DecalSurfaceData, surfaceData); + surfaceData.occlusion = half(1.0); + surfaceData.smoothness = half(0); + + #ifdef _MATERIAL_AFFECTS_NORMAL + surfaceData.normalWS.w = half(1.0); + #else + surfaceData.normalWS.w = half(0.0); + #endif + + #if defined( _MATERIAL_AFFECTS_EMISSION ) + surfaceData.emissive.rgb = half3(surfaceDescription.Emission.rgb * fadeFactor); + #endif + + surfaceData.baseColor.xyz = half3(surfaceDescription.BaseColor); + surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor); + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #if defined(_MATERIAL_AFFECTS_NORMAL) + surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz)); + #else + surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz); + #endif + #elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #if defined(_MATERIAL_AFFECTS_NORMAL) + float sgn = input.tangentWS.w; + float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz); + half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz); + + surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld)); + #else + surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); + #endif + #endif + + surfaceData.normalWS.w = surfaceDescription.NormalAlpha * fadeFactor; + + #if defined( _MATERIAL_AFFECTS_MAOS ) + surfaceData.metallic = half(surfaceDescription.Metallic); + surfaceData.occlusion = half(surfaceDescription.Occlusion); + surfaceData.smoothness = half(surfaceDescription.Smoothness); + surfaceData.MAOSAlpha = half(surfaceDescription.MAOSAlpha * fadeFactor); + #endif + } + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #define DECAL_PROJECTOR + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_MESH + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DBUFFER_MESH) + #define DECAL_DBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) + #define DECAL_SCREEN_SPACE + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_GBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) + #define DECAL_FORWARD_EMISSIVE + #endif + + #if ((!defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_ALBEDO)) || (defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_NORMAL_BLEND))) && (defined(DECAL_SCREEN_SPACE) || defined(DECAL_GBUFFER)) + #define DECAL_RECONSTRUCT_NORMAL + #elif defined(DECAL_ANGLE_FADE) + #define DECAL_LOAD_NORMAL + #endif + + #ifdef _DECAL_LAYERS + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareRenderingLayerTexture.hlsl" + #endif + + #if defined(DECAL_LOAD_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + #if defined(DECAL_PROJECTOR) || defined(DECAL_RECONSTRUCT_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" + #endif + + #ifdef DECAL_MESH + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DecalMeshBiasTypeEnum.cs.hlsl" + #endif + + #ifdef DECAL_RECONSTRUCT_NORMAL + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl" + #endif + + void MeshDecalsPositionZBias(inout PackedVaryings input) + { + #if UNITY_REVERSED_Z + input.positionCS.z -= _DecalMeshDepthBias; + #else + input.positionCS.z += _DecalMeshDepthBias; + #endif + } + + void InitializeInputData(PackedVaryings input, float3 positionWS, half3 normalWS, half3 viewDirectionWS, out InputData inputData) + { + inputData = (InputData)0; + + inputData.positionWS = positionWS; + inputData.normalWS = normalWS; + inputData.viewDirectionWS = viewDirectionWS; + inputData.shadowCoord = float4(0, 0, 0, 0); + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + inputData.fogCoord = InitializeInputDataFog(float4(positionWS, 1.0), input.fogFactorAndVertexLight.x); + inputData.vertexLighting = input.fogFactorAndVertexLight.yzw; + #endif + + #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV.xy, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #elif defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + #if !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) + inputData.bakedGI = SAMPLE_GI(input.sh, + GetAbsolutePositionWS(inputData.positionWS), + inputData.normalWS, + inputData.viewDirectionWS, + input.positionCS.xy, + input.probeOcclusion, + inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #endif + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy; + #endif + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) && defined(LIGHTMAP_ON) + inputData.staticLightmapUV = input.staticLightmapUV + #elif defined(VARYINGS_NEED_SH) + inputData.vertexSH = input.sh; + #endif + #if defined(USE_APV_PROBE_OCCLUSION) + inputData.probeOcclusion = input.probeOcclusion; + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); + } + + void GetSurface(DecalSurfaceData decalSurfaceData, inout SurfaceData surfaceData) + { + surfaceData.albedo = decalSurfaceData.baseColor.rgb; + surfaceData.metallic = saturate(decalSurfaceData.metallic); + surfaceData.specular = 0; + surfaceData.smoothness = saturate(decalSurfaceData.smoothness); + surfaceData.occlusion = decalSurfaceData.occlusion; + surfaceData.emission = decalSurfaceData.emissive; + surfaceData.alpha = saturate(decalSurfaceData.baseColor.w); + surfaceData.clearCoatMask = 0; + surfaceData.clearCoatSmoothness = 1; + } + + PackedVaryings Vert(Attributes inputMesh /*ase_vert_input*/ ) + { + if (_DecalMeshBiasType == DECALMESHDEPTHBIASTYPE_VIEW_BIAS) + { + float3 viewDirectionOS = GetObjectSpaceNormalizeViewDir(inputMesh.positionOS); + inputMesh.positionOS += viewDirectionOS * (_DecalMeshViewBias); + } + + PackedVaryings packedOutput; + ZERO_INITIALIZE(PackedVaryings, packedOutput); + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, packedOutput); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(packedOutput); + + inputMesh.tangentOS = float4( 1, 0, 0, -1 ); + inputMesh.normalOS = float3( 0, 1, 0 ); + + /*ase_vert_code:inputMesh=Attributes;packedOutput=PackedVaryings*/ + + VertexPositionInputs vertexInput = GetVertexPositionInputs(inputMesh.positionOS.xyz); + + float3 positionWS = TransformObjectToWorld(inputMesh.positionOS); + float3 normalWS = TransformObjectToWorldNormal(inputMesh.normalOS); + float4 tangentWS = float4(TransformObjectToWorldDir(inputMesh.tangentOS.xyz), inputMesh.tangentOS.w); + + packedOutput.positionCS = TransformWorldToHClip(positionWS); + + if (_DecalMeshBiasType == DECALMESHDEPTHBIASTYPE_DEPTH_BIAS) + { + MeshDecalsPositionZBias(packedOutput); + } + + packedOutput.positionWS.xyz = positionWS; + packedOutput.normalWS.xyz = normalWS; + packedOutput.tangentWS.xyzw = tangentWS; + packedOutput.texCoord0.xyzw = inputMesh.uv0; + packedOutput.viewDirectionWS.xyz = GetWorldSpaceViewDir(positionWS); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV(inputMesh.uv1, unity_LightmapST, packedOutput.staticLightmapUV); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + packedOutput.dynamicLightmapUV.xy = inputMesh.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + #if !defined(LIGHTMAP_ON) + packedOutput.sh.xyz = float3(SampleSHVertex(half3(normalWS))); + #endif + + half fogFactor = 0; + #if !defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(packedOutput.positionCS.z); + #endif + + half3 vertexLight = VertexLighting(positionWS, normalWS); + packedOutput.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + + return packedOutput; + } + + void Frag(PackedVaryings packedInput, + out FragmentOutput fragmentOutput + /*ase_frag_input*/ + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + UNITY_SETUP_INSTANCE_ID(packedInput); + + half angleFadeFactor = 1.0; + + #ifdef _DECAL_LAYERS + #ifdef _RENDER_PASS_ENABLED + uint surfaceRenderingLayer = DecodeMeshRenderingLayer(LOAD_FRAMEBUFFER_INPUT(GBUFFER4, packedInput.positionCS.xy).r); + #else + uint surfaceRenderingLayer = LoadSceneRenderingLayer(packedInput.positionCS.xy); + #endif + uint projectorRenderingLayer = uint(UNITY_ACCESS_INSTANCED_PROP(Decal, _DecalLayerMaskFromDecal)); + clip((surfaceRenderingLayer & projectorRenderingLayer) - 0.1); + #endif + + #if defined(DECAL_RECONSTRUCT_NORMAL) + #if defined(_DECAL_NORMAL_BLEND_HIGH) + half3 normalWS = half3(ReconstructNormalTap9(packedInput.positionCS.xy)); + #elif defined(_DECAL_NORMAL_BLEND_MEDIUM) + half3 normalWS = half3(ReconstructNormalTap5(packedInput.positionCS.xy)); + #else + half3 normalWS = half3(ReconstructNormalDerivative(packedInput.positionCS.xy)); + #endif + #elif defined(DECAL_LOAD_NORMAL) + half3 normalWS = half3(LoadSceneNormals(packedInput.positionCS.xy)); + #endif + + float2 positionSS = FoveatedRemapNonUniformToLinearCS(packedInput.positionCS.xy) * _ScreenSize.zw; + + float3 positionWS = packedInput.positionWS.xyz; + half3 viewDirectionWS = half3(packedInput.viewDirectionWS); + + DecalSurfaceData surfaceData; + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + /*ase_frag_code:packedInput=PackedVaryings*/ + + surfaceDescription.BaseColor = /*ase_frag_out:Base Color;Float3;0;-1;_BaseColor*/IsGammaSpace() ? float3(0.5, 0.5, 0.5) : SRGBToLinear(float3(0.5, 0.5, 0.5))/*end*/; + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;1;-1;_Alpha*/1/*end*/; + surfaceDescription.NormalTS = /*ase_frag_out:Normal;Float3;2;-1;_NormalTS*/float3(0.0f, 0.0f, 1.0f)/*end*/; + surfaceDescription.NormalAlpha = /*ase_frag_out:Normal Alpha;Float;3;-1;_NormalAlpha*/1/*end*/; + + #if defined( _MATERIAL_AFFECTS_MAOS ) + surfaceDescription.Metallic = /*ase_frag_out:Metallic;Float;4;-1;_Metallic*/0/*end*/; + surfaceDescription.Occlusion = /*ase_frag_out:Occlusion;Float;5;-1;_Occlusion*/1/*end*/; + surfaceDescription.Smoothness = /*ase_frag_out:Smoothness;Float;6;-1;_Smoothness*/0.5/*end*/; + surfaceDescription.MAOSAlpha = /*ase_frag_out:MAOS Alpha;Float;7;-1;_ColorP*/1/*end*/; + #endif + + #if defined( _MATERIAL_AFFECTS_EMISSION ) + surfaceDescription.Emission = /*ase_frag_out:Emission;Float3;8;-1;_Emission*/float3(0, 0, 0)/*end*/; + #endif + + GetSurfaceData(packedInput, surfaceDescription, surfaceData); + + half3 normalToPack = surfaceData.normalWS.xyz; + #ifdef DECAL_RECONSTRUCT_NORMAL + surfaceData.normalWS.xyz = normalize(lerp(normalWS.xyz, surfaceData.normalWS.xyz, surfaceData.normalWS.w)); + #endif + + InputData inputData; + InitializeInputData(packedInput, positionWS, surfaceData.normalWS.xyz, viewDirectionWS, inputData); + + SurfaceData surface = (SurfaceData)0; + GetSurface(surfaceData, surface); + + BRDFData brdfData; + InitializeBRDFData(surface.albedo, surface.metallic, 0, surface.smoothness, surface.alpha, brdfData); + + #ifdef _MATERIAL_AFFECTS_ALBEDO + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + MixRealtimeAndBakedGI(mainLight, surfaceData.normalWS.xyz, inputData.bakedGI, inputData.shadowMask); + half3 color = GlobalIllumination(brdfData, inputData.bakedGI, surface.occlusion, surfaceData.normalWS.xyz, inputData.viewDirectionWS); + #else + half3 color = 0; + #endif + + #pragma warning (disable : 3578) // The output value isn't completely initialized. + half3 packedNormalWS = PackNormal(normalToPack); + fragmentOutput.GBuffer0 = half4(surfaceData.baseColor.rgb, surfaceData.baseColor.a); + fragmentOutput.GBuffer1 = 0; + fragmentOutput.GBuffer2 = half4(packedNormalWS, surfaceData.normalWS.a); + fragmentOutput.GBuffer3 = half4(surfaceData.emissive + color, surfaceData.baseColor.a); + #if OUTPUT_SHADOWMASK + fragmentOutput.GBuffer4 = inputData.shadowMask; // will have unity_ProbesOcclusion value if subtractive lighting is used (baked) + #endif + #pragma warning (default : 3578) // Restore output value isn't completely initialized. + + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + Cull Back + + HLSLPROGRAM + + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma vertex Vert + #pragma fragment Frag + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + + #define HAVE_MESH_MODIFICATION + + #define SHADERPASS SHADERPASS_DEPTHONLY + #define SCENEPICKINGPASS 1 + + #if _RENDER_PASS_ENABLED + #define GBUFFER3 0 + #define GBUFFER4 1 + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl" + + /*ase_pragma*/ + + struct Attributes + { + float3 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + /*ase_vdata:p=p;n=n;t=t*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + /*ase_interp(0,):sp=sp*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + float _DrawOrder; + float _DecalMeshBiasType; + float _DecalMeshDepthBias; + float _DecalMeshViewBias; + #if defined(DECAL_ANGLE_FADE) + float _DecalAngleFadeSupported; + #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) + #define DECAL_PROJECTOR + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_MESH + #endif + + #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DBUFFER_MESH) + #define DECAL_DBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) + #define DECAL_SCREEN_SPACE + #endif + + #if (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) + #define DECAL_GBUFFER + #endif + + #if (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) + #define DECAL_FORWARD_EMISSIVE + #endif + + #if ((!defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_ALBEDO)) || (defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_NORMAL_BLEND))) && (defined(DECAL_SCREEN_SPACE) || defined(DECAL_GBUFFER)) + #define DECAL_RECONSTRUCT_NORMAL + #elif defined(DECAL_ANGLE_FADE) + #define DECAL_LOAD_NORMAL + #endif + + #ifdef _DECAL_LAYERS + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareRenderingLayerTexture.hlsl" + #endif + + #if defined(DECAL_LOAD_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + #if defined(DECAL_PROJECTOR) || defined(DECAL_RECONSTRUCT_NORMAL) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" + #endif + + #ifdef DECAL_MESH + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DecalMeshBiasTypeEnum.cs.hlsl" + #endif + + #ifdef DECAL_RECONSTRUCT_NORMAL + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl" + #endif + + PackedVaryings Vert(Attributes inputMesh /*ase_vert_input*/ ) + { + PackedVaryings packedOutput; + ZERO_INITIALIZE(PackedVaryings, packedOutput); + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, packedOutput); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(packedOutput); + + inputMesh.tangentOS = float4( 1, 0, 0, -1 ); + inputMesh.normalOS = float3( 0, 1, 0 ); + + /*ase_vert_code:inputMesh=Attributes;packedOutput=PackedVaryings*/ + + float3 positionWS = TransformObjectToWorld(inputMesh.positionOS); + packedOutput.positionCS = TransformWorldToHClip(positionWS); + + return packedOutput; + } + + void Frag(PackedVaryings packedInput, + out float4 outColor : SV_Target0 + /*ase_frag_input*/ + ) + { + /*ase_frag_code:packedInput=PackedVaryings*/ + + float3 BaseColor = /*ase_frag_out:Base Color;Float3;0;-1;_BaseColor*/IsGammaSpace() ? float3(0.5, 0.5, 0.5) : SRGBToLinear(float3(0.5, 0.5, 0.5))/*end*/; + + outColor = _SelectionID; + } + ENDHLSL + } + } + CustomEditor "UnityEditor.Rendering.Universal.DecalShaderGraphGUI" + FallBack "Hidden/Shader Graph/FallbackError" +} diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_TemporalFilter.cginc.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Decal.shader.meta similarity index 58% rename from Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_TemporalFilter.cginc.meta rename to Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Decal.shader.meta index bfbeff83..cb9e5525 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_TemporalFilter.cginc.meta +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Decal.shader.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 5fb134650ee52e041b4eb742f0f5e6fc -timeCreated: 1583930399 -licenseType: Store +guid: c2a467ab6d5391a4ea692226d82ffefd +timeCreated: 1635876295 +licenseType: Pro ShaderImporter: defaultTextures: [] userData: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Lit.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Lit.shader new file mode 100644 index 00000000..b8fced2d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Lit.shader @@ -0,0 +1,3981 @@ +Shader /*ase_name*/ "Hidden/Universal/Lit" /*end*/ +{ + Properties + { + /*ase_props*/ + + //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 + //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1 + //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5 + //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2 + //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9 + //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1 + //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5 + //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 + //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 + //_TessMin( "Tess Min Distance", Float ) = 10 + //_TessMax( "Tess Max Distance", Float ) = 25 + //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 + //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 + + [HideInInspector][ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0 + [HideInInspector][ToggleOff] _EnvironmentReflections("Environment Reflections", Float) = 1.0 + [HideInInspector][ToggleOff] _ReceiveShadows("Receive Shadows", Float) = 1.0 + + [HideInInspector] _QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector] _QueueControl("_QueueControl", Float) = -1 + + [HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + + [HideInInspector][ToggleUI] _AddPrecomputedVelocity("Add Precomputed Velocity", Float) = 1 + } + + SubShader + { + /*ase_subshader_options:Name=Additional Options + Option:Lighting Model:PBR,Simple:PBR + PBR:SetPropertyOnSubShader:ChangeTagValue,UniversalMaterialType,Lit + PBR:SetShaderProperty:_SpecularHighlights,1 + PBR:SetShaderProperty:_EnvironmentReflections,1 + PBR:RemoveDefine:_ASE_LIGHTING_SIMPLE + Simple:SetOption:Workflow,0 + Simple:SetDefine:_ASE_LIGHTING_SIMPLE + Simple:SetPropertyOnSubShader:ChangeTagValue,UniversalMaterialType,SimpleLit + Simple:SetShaderProperty:_SpecularHighlights,0 + Simple:SetShaderProperty:_EnvironmentReflections,0 + Option:Workflow:Specular,Metallic:Metallic + Specular:SetDefine:_SPECULAR_SETUP 1 + Specular:ShowPort:Forward:Specular + Specular:HidePort:Forward:Metallic + Specular:SetDefine:Forward:pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF + Specular:SetDefine:GBuffer:pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF + Specular:SetDefine:Forward:pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF + Specular:SetDefine:GBuffer:pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF + Metallic:SetOption:Lighting Model,0 + Metallic:RemoveDefine:_SPECULAR_SETUP 1 + Metallic:ShowPort:Forward:Metallic + Metallic:HidePort:Forward:Specular + Metallic:RemoveDefine:Forward:pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF + Metallic:RemoveDefine:GBuffer:pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF + Metallic:RemoveDefine:Forward:pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF + Metallic:RemoveDefine:GBuffer:pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF + Option:Surface:Opaque,Transparent:Opaque + Opaque:SetPropertyOnSubShader:RenderType,Opaque + Opaque:SetPropertyOnSubShader:RenderQueue,Geometry + Opaque:SetPropertyOnSubShader:ZWrite,On + Opaque:HideOption: Refraction Model + Opaque:HideOption: Blend + Opaque:RemoveDefine:_SURFACE_TYPE_TRANSPARENT 1 + Opaque:HidePort:Forward:Alpha + Opaque:RefreshOption:Alpha Clipping + Transparent:SetPropertyOnSubShader:RenderType,Transparent + Transparent:SetPropertyOnSubShader:RenderQueue,Transparent + Transparent:SetPropertyOnSubShader:ZWrite,Off + Transparent:ShowOption: Refraction Model + Transparent:ShowOption: Blend + Transparent:SetDefine:_SURFACE_TYPE_TRANSPARENT 1 + Transparent:ShowPort:Forward:Alpha + Option: Refraction Model:None,Legacy:None + None,disable:HidePort:Forward:Refraction Index + None,disable:HidePort:Forward:Refraction Color + None,disable:RemoveDefine:ASE_REFRACTION 1 + None,disable:RemoveDefine:REQUIRE_OPAQUE_TEXTURE 1 + Legacy:ShowPort:Forward:Refraction Index + Legacy:ShowPort:Forward:Refraction Color + Legacy:SetDefine:ASE_REFRACTION 1 + Legacy:SetDefine:REQUIRE_OPAQUE_TEXTURE 1 + Option: Blend:Alpha,Premultiply,Additive,Multiply:Alpha + Alpha:SetPropertyOnPass:Forward:BlendRGB,SrcAlpha,OneMinusSrcAlpha + Premultiply:SetPropertyOnPass:Forward:BlendRGB,One,OneMinusSrcAlpha + Additive:SetPropertyOnPass:Forward:BlendRGB,One,One + Multiply:SetPropertyOnPass:Forward:BlendRGB,DstColor,Zero + Alpha,Premultiply,Additive:SetPropertyOnPass:Forward:BlendAlpha,One,OneMinusSrcAlpha + Multiply:SetPropertyOnPass:Forward:BlendAlpha,One,Zero + disable:SetPropertyOnPass:Forward:BlendRGB,One,Zero + disable:SetPropertyOnPass:Forward:BlendAlpha,One,Zero + Option:Two Sided:On,Cull Back,Cull Front:Cull Back + On:SetPropertyOnSubShader:CullMode,Off + Cull Back:SetPropertyOnSubShader:CullMode,Back + Cull Front:SetPropertyOnSubShader:CullMode,Front + Option:Alpha Clipping:false,true:true + true:ShowPort:Forward:Alpha + true:ShowPort:Forward:Alpha Clip Threshold + true?Cast Shadows=true:ShowOption: Use Shadow Threshold + true?Surface=Opaque:SetPropertyOnSubShader:RenderType,TransparentCutout + true?Surface=Opaque:SetPropertyOnSubShader:RenderQueue,AlphaTest + true:SetDefine:Forward:pragma multi_compile_fragment _ALPHATEST_ON + true:SetDefine:GBuffer:pragma multi_compile_fragment _ALPHATEST_ON + true:SetDefine:Meta:pragma multi_compile_fragment _ALPHATEST_ON + true:SetDefine:Universal2D:pragma multi_compile_fragment _ALPHATEST_ON + true:SetDefine:ShadowCaster:pragma multi_compile _ALPHATEST_ON + true:SetDefine:DepthOnly:pragma multi_compile _ALPHATEST_ON + true:SetDefine:DepthNormals:pragma multi_compile _ALPHATEST_ON + true:SetDefine:MotionVectors:pragma multi_compile _ALPHATEST_ON + false:HidePort:Forward:Alpha Clip Threshold + false:SetOption: Use Shadow Threshold,0 + false:HideOption: Use Shadow Threshold + false:RefreshOption:Surface + false:RemoveDefine:Forward:pragma multi_compile_fragment _ALPHATEST_ON + false:RemoveDefine:GBuffer:pragma multi_compile_fragment _ALPHATEST_ON + false:RemoveDefine:Meta:pragma multi_compile_fragment _ALPHATEST_ON + false:RemoveDefine:Universal2D:pragma multi_compile_fragment _ALPHATEST_ON + false:RemoveDefine:ShadowCaster:pragma multi_compile _ALPHATEST_ON + false:RemoveDefine:DepthOnly:pragma multi_compile _ALPHATEST_ON + false:RemoveDefine:DepthNormals:pragma multi_compile _ALPHATEST_ON + false:RemoveDefine:MotionVectors:pragma multi_compile _ALPHATEST_ON + Option: Use Shadow Threshold:false,true:false + true:ShowPort:Forward:Alpha Clip Threshold Shadow + true:SetDefine:_ALPHATEST_SHADOW_ON 1 + false,disable:RemoveDefine:_ALPHATEST_SHADOW_ON 1 + false,disable:HidePort:Forward:Alpha Clip Threshold Shadow + Option:Fragment Normal Space,InvertActionOnDeselection:Tangent,Object,World:Tangent + Tangent:SetDefine:_NORMAL_DROPOFF_TS 1 + Tangent:SetPortName:Forward:1,Normal + Object:SetDefine:_NORMAL_DROPOFF_OS 1 + Object:SetPortName:Forward:1,Object Normal + World:SetDefine:_NORMAL_DROPOFF_WS 1 + World:SetPortName:Forward:1,World Normal + Option:Forward Only:false,true:false + false,disable:SetPropertyOnPass:Forward:ChangeTagValue,LightMode,UniversalForward + false,disable:SetPropertyOnPass:DepthNormals:ChangeTagValue,LightMode,DepthNormals + false,disable:IncludePass:GBuffer + true:SetPropertyOnPass:Forward:ChangeTagValue,LightMode,UniversalForwardOnly + true:SetPropertyOnPass:DepthNormals:ChangeTagValue,LightMode,DepthNormalsOnly + true:ExcludePass:GBuffer + Option:Transmission:false,true:false + true:SetOption:Forward Only,1 + true:ExcludePass:GBuffer + false,disable:IncludePass:GBuffer + false:RemoveDefine:ASE_TRANSMISSION 1 + false:HidePort:Forward:Transmission + false:HideOption: Transmission Shadow + true:SetDefine:ASE_TRANSMISSION 1 + true:ShowPort:Forward:Transmission + true:ShowOption: Transmission Shadow + Field: Transmission Shadow:Float:0.5:0:1:_TransmissionShadow + Change:SetMaterialProperty:_TransmissionShadow + Change:SetShaderProperty:_TransmissionShadow,_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 + Inline,disable:SetShaderProperty:_TransmissionShadow,//_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5 + Option:Translucency:false,true:false + true:SetOption:Forward Only,1 + true:ExcludePass:GBuffer + false,disable:IncludePass:GBuffer + false:RemoveDefine:ASE_TRANSLUCENCY 1 + false:HidePort:Forward:Translucency + false:HideOption: Translucency Strength + false:HideOption: Normal Distortion + false:HideOption: Scattering + false:HideOption: Direct + false:HideOption: Ambient + false:HideOption: Shadow + true:SetDefine:ASE_TRANSLUCENCY 1 + true:ShowPort:Forward:Translucency + true:ShowOption: Translucency Strength + true:ShowOption: Normal Distortion + true:ShowOption: Scattering + true:ShowOption: Direct + true:ShowOption: Ambient + true:ShowOption: Shadow + Field: Translucency Strength:Float:1:0:50:_TransStrength + Change:SetMaterialProperty:_TransStrength + Change:SetShaderProperty:_TransStrength,_TransStrength( "Strength", Range( 0, 50 ) ) = 1 + Inline,disable:SetShaderProperty:_TransStrength,//_TransStrength( "Strength", Range( 0, 50 ) ) = 1 + Field: Normal Distortion:Float:0.5:0:1:_TransNormal + Change:SetMaterialProperty:_TransNormal + Change:SetShaderProperty:_TransNormal,_TransNormal( "Normal Distortion", Range( 0, 1 ) ) = 0.5 + Inline,disable:SetShaderProperty:_TransNormal,//_TransNormal( "Normal Distortion", Range( 0, 1 ) ) = 0.5 + Field: Scattering:Float:2:1:50:_TransScattering + Change:SetMaterialProperty:_TransScattering + Change:SetShaderProperty:_TransScattering,_TransScattering( "Scattering", Range( 1, 50 ) ) = 2 + Inline,disable:SetShaderProperty:_TransScattering,//_TransScattering( "Scattering", Range( 1, 50 ) ) = 2 + Field: Direct:Float:0.9:0:1:_TransDirect + Change:SetMaterialProperty:_TransDirect + Change:SetShaderProperty:_TransDirect,_TransDirect( "Direct", Range( 0, 1 ) ) = 0.9 + Inline,disable:SetShaderProperty:_TransDirect,//_TransDirect( "Direct", Range( 0, 1 ) ) = 0.9 + Field: Ambient:Float:0.1:0:1:_TransAmbient + Change:SetMaterialProperty:_TransAmbient + Change:SetShaderProperty:_TransAmbient,_TransAmbient( "Ambient", Range( 0, 1 ) ) = 0.1 + Inline,disable:SetShaderProperty:_TransAmbient,//_TransAmbient( "Ambient", Range( 0, 1 ) ) = 0.1 + Field: Shadow:Float:0.5:0:1:_TransShadow + Change:SetMaterialProperty:_TransShadow + Change:SetShaderProperty:_TransShadow,_TransShadow( "Shadow", Range( 0, 1 ) ) = 0.5 + Inline,disable:SetShaderProperty:_TransShadow,//_TransShadow( "Shadow", Range( 0, 1 ) ) = 0.5 + Option:Cast Shadows:false,true:true + true:IncludePass:ShadowCaster + false,disable:ExcludePass:ShadowCaster + true?Alpha Clipping=true:ShowOption: Use Shadow Threshold + false:HideOption: Use Shadow Threshold + Option:Receive Shadows:false,true:true + true:SetDefine:Forward:pragma shader_feature_local _RECEIVE_SHADOWS_OFF + true:SetDefine:GBuffer:pragma shader_feature_local _RECEIVE_SHADOWS_OFF + false:RemoveDefine:Forward:pragma shader_feature_local _RECEIVE_SHADOWS_OFF + false:RemoveDefine:GBuffer:pragma shader_feature_local _RECEIVE_SHADOWS_OFF + Option:Receive SSAO:false,true:true + true:SetDefine:Forward:pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + false:RemoveDefine:Forward:pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + Option:Motion Vectors:false,true:true + true:ShowOption: Add Precomputed Velocity + false:HideOption: Add Precomputed Velocity + true:IncludePass:MotionVectors + false:ExcludePass:MotionVectors + true:SetOption:Tessellation,0 + Option: Add Precomputed Velocity:false,true:false + true:SetShaderProperty:_AddPrecomputedVelocity,[HideInInspector][ToggleUI] _AddPrecomputedVelocity("Add Precomputed Velocity", Float) = 1 + false:SetShaderProperty:_AddPrecomputedVelocity,//[HideInInspector][ToggleUI] _AddPrecomputedVelocity("Add Precomputed Velocity", Float) = 1 + true:SetShaderProperty:_AddPrecomputedVelocity,1 + true:SetDefine:MotionVectors:pragma shader_feature_local_vertex _ADD_PRECOMPUTED_VELOCITY + false:RemoveDefine:MotionVectors:pragma shader_feature_local_vertex _ADD_PRECOMPUTED_VELOCITY + Option:GPU Instancing:false,true:true + true:SetDefine:Forward:pragma multi_compile_instancing + true:SetDefine:GBuffer:pragma multi_compile_instancing + true:SetDefine:ShadowCaster:pragma multi_compile_instancing + true:SetDefine:MotionVectors:pragma multi_compile_instancing + true:SetDefine:DepthOnly:pragma multi_compile_instancing + true:SetDefine:DepthNormals:pragma multi_compile_instancing + false:RemoveDefine:Forward:pragma multi_compile_instancing + false:RemoveDefine:GBuffer:pragma multi_compile_instancing + false:RemoveDefine:ShadowCaster:pragma multi_compile_instancing + false:RemoveDefine:MotionVectors:pragma multi_compile_instancing + false:RemoveDefine:DepthOnly:pragma multi_compile_instancing + false:RemoveDefine:DepthNormals:pragma multi_compile_instancing + true:SetDefine:Forward:pragma instancing_options renderinglayer + true:SetDefine:GBuffer:pragma instancing_options renderinglayer + false:RemoveDefine:Forward:pragma instancing_options renderinglayer + false:RemoveDefine:GBuffer:pragma instancing_options renderinglayer + Option:LOD CrossFade:false,true:true + true:SetDefine:Forward:pragma multi_compile _ LOD_FADE_CROSSFADE + true:SetDefine:GBuffer:pragma multi_compile _ LOD_FADE_CROSSFADE + true:SetDefine:ShadowCaster:pragma multi_compile _ LOD_FADE_CROSSFADE + true:SetDefine:DepthOnly:pragma multi_compile _ LOD_FADE_CROSSFADE + true:SetDefine:DepthNormals:pragma multi_compile _ LOD_FADE_CROSSFADE + true:SetDefine:MotionVectors:pragma multi_compile _ LOD_FADE_CROSSFADE + false:RemoveDefine:Forward:pragma multi_compile _ LOD_FADE_CROSSFADE + false:RemoveDefine:GBuffer:pragma multi_compile _ LOD_FADE_CROSSFADE + false:RemoveDefine:ShadowCaster:pragma multi_compile _ LOD_FADE_CROSSFADE + false:RemoveDefine:DepthOnly:pragma multi_compile _ LOD_FADE_CROSSFADE + false:RemoveDefine:DepthNormals:pragma multi_compile _ LOD_FADE_CROSSFADE + false:RemoveDefine:MotionVectors:pragma multi_compile _ LOD_FADE_CROSSFADE + Option:Built-in Fog:false,true:true + true:SetDefine:Forward:pragma multi_compile_fog + true:SetDefine:GBuffer:pragma multi_compile_fog + false:RemoveDefine:Forward:pragma multi_compile_fog + false:RemoveDefine:GBuffer:pragma multi_compile_fog + true:SetDefine:ASE_FOG 1 + false:RemoveDefine:ASE_FOG 1 + Option,_FinalColorxAlpha:Final Color x Alpha:true,false:false + true:SetDefine:ASE_FINAL_COLOR_ALPHA_MULTIPLY 1 + false:RemoveDefine:ASE_FINAL_COLOR_ALPHA_MULTIPLY 1 + Option:Meta Pass:false,true:true + true:IncludePass:Meta + false,disable:ExcludePass:Meta + Option:Override Baked GI:false,true:false + true:ShowPort:Forward:Baked GI + false:HidePort:Forward:Baked GI + Option:Extra Pre Pass:false,true:false + true:IncludePass:ExtraPrePass + false,disable:ExcludePass:ExtraPrePass + Option:Tessellation:false,true:false + true:SetDefine:ASE_TESSELLATION 1 + true:SetDefine:pragma require tessellation tessHW + true:SetDefine:pragma hull HullFunction + true:SetDefine:pragma domain DomainFunction + true:ShowOption: Phong + true:ShowOption: Type + false,disable:RemoveDefine:ASE_TESSELLATION 1 + false,disable:RemoveDefine:pragma require tessellation tessHW + false,disable:RemoveDefine:pragma hull HullFunction + false,disable:RemoveDefine:pragma domain DomainFunction + false,disable:HideOption: Phong + false,disable:HideOption: Type + true:SetOption:Motion Vectors,0 + Option: Phong:false,true:false + true:SetDefine:ASE_PHONG_TESSELLATION + false,disable:RemoveDefine:ASE_PHONG_TESSELLATION + true:ShowOption: Strength + false,disable:HideOption: Strength + Field: Strength:Float:0.5:0:1:_TessPhongStrength + Change:SetMaterialProperty:_TessPhongStrength + Change:SetShaderProperty:_TessPhongStrength,_TessPhongStrength( "Phong Tess Strength", Range( 0, 1 ) ) = 0.5 + Inline,disable:SetShaderProperty:_TessPhongStrength,//_TessPhongStrength( "Phong Tess Strength", Range( 0, 1 ) ) = 0.5 + Option: Type:Fixed,Distance Based,Edge Length,Edge Length Cull:Fixed + Fixed:SetDefine:ASE_FIXED_TESSELLATION + Fixed,Distance Based:ShowOption: Tess + Distance Based:SetDefine:ASE_DISTANCE_TESSELLATION + Distance Based:ShowOption: Min + Distance Based:ShowOption: Max + Edge Length:SetDefine:ASE_LENGTH_TESSELLATION + Edge Length,Edge Length Cull:ShowOption: Edge Length + Edge Length Cull:SetDefine:ASE_LENGTH_CULL_TESSELLATION + Edge Length Cull:ShowOption: Max Displacement + disable,Distance Based,Edge Length,Edge Length Cull:RemoveDefine:ASE_FIXED_TESSELLATION + disable,Fixed,Edge Length,Edge Length Cull:RemoveDefine:ASE_DISTANCE_TESSELLATION + disable,Fixed,Distance Based,Edge Length Cull:RemoveDefine:ASE_LENGTH_TESSELLATION + disable,Fixed,Distance Based,Edge Length:RemoveDefine:ASE_LENGTH_CULL_TESSELLATION + disable,Edge Length,Edge Length Cull:HideOption: Tess + disable,Fixed,Edge Length,Edge Length Cull:HideOption: Min + disable,Fixed,Edge Length,Edge Length Cull:HideOption: Max + disable,Fixed,Distance Based:HideOption: Edge Length + disable,Fixed,Distance Based,Edge Length:HideOption: Max Displacement + Field: Tess:Float:16:1:32:_TessValue + Change:SetMaterialProperty:_TessValue + Change:SetShaderProperty:_TessValue,_TessValue( "Max Tessellation", Range( 1, 32 ) ) = 16 + Inline,disable:SetShaderProperty:_TessValue,//_TessValue( "Max Tessellation", Range( 1, 32 ) ) = 16 + Field: Min:Float:10:_TessMin + Change:SetMaterialProperty:_TessMin + Change:SetShaderProperty:_TessMin,_TessMin( "Tess Min Distance", Float ) = 10 + Inline,disable:SetShaderProperty:_TessMin,//_TessMin( "Tess Min Distance", Float ) = 10 + Field: Max:Float:25:_TessMax + Change:SetMaterialProperty:_TessMax + Change:SetShaderProperty:_TessMax,_TessMax( "Tess Max Distance", Float ) = 25 + Inline,disable:SetShaderProperty:_TessMax,//_TessMax( "Tess Max Distance", Float ) = 25 + Field: Edge Length:Float:16:2:50:_TessEdgeLength + Change:SetMaterialProperty:_TessEdgeLength + Change:SetShaderProperty:_TessEdgeLength,_TessEdgeLength ( "Edge length", Range( 2, 50 ) ) = 16 + Inline,disable:SetShaderProperty:_TessEdgeLength,//_TessEdgeLength ( "Edge length", Range( 2, 50 ) ) = 16 + Field: Max Displacement:Float:25:_TessMaxDisp + Change:SetMaterialProperty:_TessMaxDisp + Change:SetShaderProperty:_TessMaxDisp,_TessMaxDisp( "Max Displacement", Float ) = 25 + Inline,disable:SetShaderProperty:_TessMaxDisp,//_TessMaxDisp( "Max Displacement", Float ) = 25 + Option:Write Depth:false,true:false + true:SetDefine:ASE_DEPTH_WRITE_ON + true:ShowOption: Early Z + true:ShowPort:Forward:Depth Value + false,disable:RemoveDefine:ASE_DEPTH_WRITE_ON + false,disable:HideOption: Early Z + false,disable:HidePort:Forward:Depth Value + Option: Early Z:false,true:false + true:SetDefine:ASE_EARLY_Z_DEPTH_OPTIMIZE + false,disable:RemoveDefine:ASE_EARLY_Z_DEPTH_OPTIMIZE + Option:Vertex Position,InvertActionOnDeselection:Absolute,Relative:Relative + Absolute:SetDefine:ASE_ABSOLUTE_VERTEX_POS 1 + Absolute:SetPortName:Forward:8,Vertex Position + Relative:SetPortName:Forward:8,Vertex Offset + Absolute:SetPortName:ExtraPrePass:3,Vertex Position + Relative:SetPortName:ExtraPrePass:3,Vertex Offset + Option:Debug Display:false,true:false + true:SetDefine:pragma multi_compile_fragment _ DEBUG_DISPLAY + false,disable:RemoveDefine:pragma multi_compile_fragment _ DEBUG_DISPLAY + Option:Clear Coat:false,true:false + true:ShowPort:Forward:Coat Mask + true:ShowPort:Forward:Coat Smoothness + true:SetDefine:Forward:shader_feature_local_fragment _ _CLEARCOAT + true:SetDefine:Forward:_CLEARCOAT 1 + true:SetOption:Forward Only,1 + true:ExcludePass:GBuffer + false,disable:HidePort:Forward:Coat Mask + false,disable:HidePort:Forward:Coat Smoothness + false:RemoveDefine:Forward:shader_feature_local_fragment _ _CLEARCOAT + false:RemoveDefine:Forward:_CLEARCOAT 1 + false,disable:IncludePass:GBuffer + Port:Forward:Emission + On:SetDefine:_EMISSION + Port:Forward:Baked GI + On:SetDefine:ASE_BAKEDGI 1 + Port:Forward:Normal + On:SetDefine:_NORMALMAP 1 + */ + + Tags + { + "RenderPipeline" = "UniversalPipeline" + "RenderType"="Opaque" + "Queue"="Geometry+0" + "UniversalMaterialType"="Lit" + } + + Cull Back + ZWrite On + ZTest LEqual + Offset 0,0 + AlphaToMask Off + + /*ase_stencil*/ + + HLSLINCLUDE + #pragma target 4.5 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d9 // ensure rendering platforms toggle list is visible + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl" + + #ifndef ASE_TESS_FUNCS + #define ASE_TESS_FUNCS + float4 FixedTess( float tessValue ) + { + return tessValue; + } + + float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) + { + float3 wpos = mul(o2w,vertex).xyz; + float dist = distance (wpos, cameraPos); + float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; + return f; + } + + float4 CalcTriEdgeTessFactors (float3 triVertexFactors) + { + float4 tess; + tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); + tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); + tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); + tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; + return tess; + } + + float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) + { + float dist = distance (0.5 * (wpos0+wpos1), cameraPos); + float len = distance(wpos0, wpos1); + float f = max(len * scParams.y / (edgeLen * dist), 1.0); + return f; + } + + float DistanceFromPlane (float3 pos, float4 plane) + { + float d = dot (float4(pos,1.0f), plane); + return d; + } + + bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) + { + float4 planeTest; + planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); + return !all (planeTest); + } + + float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) + { + float3 f; + f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); + f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); + f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); + + return CalcTriEdgeTessFactors (f); + } + + float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + return tess; + } + + float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + + if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) + { + tess = 0.0f; + } + else + { + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + #endif //ASE_TESS_FUNCS + ENDHLSL + + /*ase_pass*/ + Pass + { + Name "ExtraPrePass" + Tags{ } + + Blend One Zero + Cull Back + ZWrite On + ZTest LEqual + Offset 0,0 + ColorMask RGBA + + /*ase_stencil*/ + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE) + #define _SPECULAR_COLOR 1 + #endif + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + /*ase_vdata:p=p;n=n;t=t*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float4 clipPosV : TEXCOORD0; + float3 positionWS : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD2; + #endif + #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX) + half4 fogFactorAndVertexLight : TEXCOORD3; + #endif + /*ase_interp(4,):sp=sp;wp=tc1;sc=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output = (PackedVaryings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;3;-1;_VertexP*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;4;-1;_NormalP*/input.normalOS/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); + VertexNormalInputs normalInput = GetVertexNormalInputs( input.normalOS, input.tangentOS ); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + output.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX) + output.fogFactorAndVertexLight = 0; + #if defined(ASE_FOG) && !defined(_FOG_FRAGMENT) + output.fogFactorAndVertexLight.x = ComputeFogFactor(vertexInput.positionCS.z); + #endif + #ifdef _ADDITIONAL_LIGHTS_VERTEX + half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS ); + output.fogFactorAndVertexLight.yzw = vertexLight; + #endif + #endif + + output.positionCS = vertexInput.positionCS; + output.clipPosV = vertexInput.positionCS; + output.positionWS = vertexInput.positionWS; + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag ( PackedVaryings input /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( input ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); + + /*ase_local_var:wp*/float3 WorldPosition = input.positionWS; + /*ase_local_var:wvd*/float3 WorldViewDirection = GetWorldSpaceNormalizeViewDir( WorldPosition ); + /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 ); + /*ase_local_var:sp*/float4 ClipPos = input.clipPosV; + /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.positionCS = input.positionCS; + inputData.viewDirectionWS = WorldViewDirection; + + #ifdef ASE_FOG + inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactorAndVertexLight.x); + #endif + #ifdef _ADDITIONAL_LIGHTS_VERTEX + inputData.vertexLighting = input.fogFactorAndVertexLight.yzw; + #endif + + /*ase_frag_code:input=PackedVaryings*/ + + float3 Color = /*ase_frag_out:Color;Float3;0;-1;_ColorP*/float3( 0, 0, 0 )/*end*/; + float Alpha = /*ase_frag_out:Alpha;Float;1;-1;_AlphaP*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;2;-1;_AlphaClipP*/0.5/*end*/; + + #ifdef _ALPHATEST_ON + clip( Alpha - AlphaClipThreshold ); + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + Color.rgb = MixFogColor(Color.rgb, half3(0,0,0), inputData.fogCoord); + #else + Color.rgb = MixFog(Color.rgb, inputData.fogCoord); + #endif + #endif + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + return half4( Color, Alpha ); + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_main_pass*/ + Name "Forward" + Tags + { + "LightMode" = "UniversalForward" + } + + Blend One Zero + ZWrite On + ZTest LEqual + Offset 0,0 + ColorMask RGBA + + /*ase_stencil*/ + + HLSLPROGRAM + + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ _FORWARD_PLUS + + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS + + #pragma vertex vert + #pragma fragment frag + + #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE) + #define _SPECULAR_COLOR 1 + #endif + + #define SHADERPASS SHADERPASS_FORWARD + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + /*ase_pragma*/ + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) + #define ASE_SV_DEPTH SV_DepthLessEqual + #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid + #else + #define ASE_SV_DEPTH SV_Depth + #define ASE_SV_POSITION_QUALIFIERS + #endif + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vdata:p=p;n=n;t=t;uv0=tc0;uv1=tc1;uv2=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; + float4 clipPosV : TEXCOORD0; + float4 lightmapUVOrVertexSH : TEXCOORD1; + #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX) + half4 fogFactorAndVertexLight : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + #if defined(USE_APV_PROBE_OCCLUSION) + float4 probeOcclusion : TEXCOORD8; + #endif + /*ase_interp(9,):sp=sp;wn.xyz=tc3.xyz;wt.xyz=tc4.xyz;wbt.xyz=tc5.xyz;wp.x=tc3.w;wp.y=tc4.w;wp.z=tc5.w;sc=tc6*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output = (PackedVaryings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;8;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;10;-1;_Normal*/input.normalOS/*end*/; + input.tangentOS = /*ase_vert_out:Vertex Tangent;Float4;30;-1;_Tangent*/input.tangentOS/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); + VertexNormalInputs normalInput = GetVertexNormalInputs( input.normalOS, input.tangentOS ); + + output.tSpace0 = float4( normalInput.normalWS, vertexInput.positionWS.x ); + output.tSpace1 = float4( normalInput.tangentWS, vertexInput.positionWS.y ); + output.tSpace2 = float4( normalInput.bitangentWS, vertexInput.positionWS.z ); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV(input.texcoord1, unity_LightmapST, output.lightmapUVOrVertexSH.xy); + #else + OUTPUT_SH(normalInput.normalWS.xyz, output.lightmapUVOrVertexSH.xyz); + #endif + #if defined(DYNAMICLIGHTMAP_ON) + output.dynamicLightmapUV.xy = input.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + OUTPUT_SH4( vertexInput.positionWS, normalInput.normalWS.xyz, GetWorldSpaceNormalizeViewDir( vertexInput.positionWS ), output.lightmapUVOrVertexSH.xyz, output.probeOcclusion ); + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + output.lightmapUVOrVertexSH.zw = input.texcoord.xy; + output.lightmapUVOrVertexSH.xy = input.texcoord.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX) + output.fogFactorAndVertexLight = 0; + #if defined(ASE_FOG) && !defined(_FOG_FRAGMENT) + output.fogFactorAndVertexLight.x = ComputeFogFactor(vertexInput.positionCS.z); + #endif + #ifdef _ADDITIONAL_LIGHTS_VERTEX + half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS ); + output.fogFactorAndVertexLight.yzw = vertexLight; + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + output.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + output.positionCS = vertexInput.positionCS; + output.clipPosV = vertexInput.positionCS; + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + output.tangentOS = input.tangentOS; + output.texcoord = input.texcoord; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; + output.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag ( PackedVaryings input + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (input.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + /*ase_local_var:wn*/float3 WorldNormal = normalize( input.tSpace0.xyz ); + /*ase_local_var:wt*/float3 WorldTangent = input.tSpace1.xyz; + /*ase_local_var:wbt*/float3 WorldBiTangent = input.tSpace2.xyz; + #endif + + /*ase_local_var:wp*/float3 WorldPosition = float3(input.tSpace0.w,input.tSpace1.w,input.tSpace2.w); + /*ase_local_var:wvd*/float3 WorldViewDirection = GetWorldSpaceNormalizeViewDir( WorldPosition ); + /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 ); + /*ase_local_var:sp*/float4 ClipPos = input.clipPosV; + /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV ); + + float2 NormalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + /*ase_frag_code:input=PackedVaryings*/ + + float3 BaseColor = /*ase_frag_out:Base Color;Float3;0;-1;_BaseColor*/float3(0.5, 0.5, 0.5)/*end*/; + float3 Normal = /*ase_frag_out:Normal;Float3;1;-1;_FragNormal*/float3(0, 0, 1)/*end*/; + float3 Emission = /*ase_frag_out:Emission;Float3;2;-1;_Emission*/0/*end*/; + float3 Specular = /*ase_frag_out:Specular;Float3;9;-1;_Specular*/0.5/*end*/; + float Metallic = /*ase_frag_out:Metallic;Float;3;-1;_Metallic*/0/*end*/; + float Smoothness = /*ase_frag_out:Smoothness;Float;4;-1;_Smoothness*/0.5/*end*/; + float Occlusion = /*ase_frag_out:Occlusion;Float;5;-1;_Occlusion*/1/*end*/; + float Alpha = /*ase_frag_out:Alpha;Float;6;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;7;-1;_AlphaClip*/0.5/*end*/; + float AlphaClipThresholdShadow = /*ase_frag_out:Alpha Clip Threshold Shadow;Float;16;-1;_AlphaClipShadow*/0.5/*end*/; + float3 BakedGI = /*ase_frag_out:Baked GI;Float3;11;-1;_BakedGI*/0/*end*/; + float3 RefractionColor = /*ase_frag_out:Refraction Color;Float3;12;-1;_RefractionColor*/1/*end*/; + float RefractionIndex = /*ase_frag_out:Refraction Index;Float;13;-1;_RefractionIndex*/1/*end*/; + float3 Transmission = /*ase_frag_out:Transmission;Float3;14;-1;_Transmission*/1/*end*/; + float3 Translucency = /*ase_frag_out:Translucency;Float3;15;-1;_Translucency*/1/*end*/; + + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/input.positionCS.z/*end*/; + #endif + + #ifdef _CLEARCOAT + float CoatMask = /*ase_frag_out:Coat Mask;Float;18;-1;_CoatMask*/0/*end*/; + float CoatSmoothness = /*ase_frag_out:Coat Smoothness;Float;20;-1;_clearCoatSmoothness*/0/*end*/; + #endif + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.positionCS = input.positionCS; + inputData.viewDirectionWS = WorldViewDirection; + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent, WorldBiTangent, WorldNormal)); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + #else + inputData.normalWS = WorldNormal; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = ShadowCoords; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + #ifdef ASE_FOG + inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactorAndVertexLight.x); + #endif + #ifdef _ADDITIONAL_LIGHTS_VERTEX + inputData.vertexLighting = input.fogFactorAndVertexLight.yzw; + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = input.lightmapUVOrVertexSH.xyz; + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, input.dynamicLightmapUV.xy, SH, inputData.normalWS); + inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy); + #elif !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) + inputData.bakedGI = SAMPLE_GI( SH, GetAbsolutePositionWS(inputData.positionWS), + inputData.normalWS, + inputData.viewDirectionWS, + input.positionCS.xy, + input.probeOcclusion, + inputData.shadowMask ); + #else + inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, SH, inputData.normalWS); + inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy); + #endif + + #ifdef ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #endif + + inputData.normalizedScreenSpaceUV = NormalizedScreenSpaceUV; + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = input.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #if defined(USE_APV_PROBE_OCCLUSION) + inputData.probeOcclusion = input.probeOcclusion; + #endif + #endif + + SurfaceData surfaceData; + surfaceData.albedo = BaseColor; + surfaceData.metallic = saturate(Metallic); + surfaceData.specular = Specular; + surfaceData.smoothness = saturate(Smoothness), + surfaceData.occlusion = Occlusion, + surfaceData.emission = Emission, + surfaceData.alpha = saturate(Alpha); + surfaceData.normalTS = Normal; + surfaceData.clearCoatMask = 0; + surfaceData.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surfaceData.clearCoatMask = saturate(CoatMask); + surfaceData.clearCoatSmoothness = saturate(CoatSmoothness); + #endif + + #ifdef _DBUFFER + ApplyDecalToSurfaceData(input.positionCS, surfaceData, inputData); + #endif + + #ifdef _ASE_LIGHTING_SIMPLE + half4 color = UniversalFragmentBlinnPhong( inputData, surfaceData); + #else + half4 color = UniversalFragmentPBR( inputData, surfaceData); + #endif + + #ifdef ASE_TRANSMISSION + { + float shadow = /*ase_inline_begin*/_TransmissionShadow/*ase_inline_end*/; + + #define SUM_LIGHT_TRANSMISSION(Light)\ + float3 atten = Light.color * Light.distanceAttenuation;\ + atten = lerp( atten, atten * Light.shadowAttenuation, shadow );\ + half3 transmission = max( 0, -dot( inputData.normalWS, Light.direction ) ) * atten * Transmission;\ + color.rgb += BaseColor * transmission; + + SUM_LIGHT_TRANSMISSION( GetMainLight( inputData.shadowCoord ) ); + + #if defined(_ADDITIONAL_LIGHTS) + uint meshRenderingLayers = GetMeshRenderingLayer(); + uint pixelLightCount = GetAdditionalLightsCount(); + #if USE_FORWARD_PLUS + [loop] for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++) + { + FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK + + Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask); + #ifdef _LIGHT_LAYERS + if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) + #endif + { + SUM_LIGHT_TRANSMISSION( light ); + } + } + #endif + LIGHT_LOOP_BEGIN( pixelLightCount ) + Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask); + #ifdef _LIGHT_LAYERS + if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) + #endif + { + SUM_LIGHT_TRANSMISSION( light ); + } + LIGHT_LOOP_END + #endif + } + #endif + + #ifdef ASE_TRANSLUCENCY + { + float shadow = /*ase_inline_begin*/_TransShadow/*ase_inline_end*/; + float normal = /*ase_inline_begin*/_TransNormal/*ase_inline_end*/; + float scattering = /*ase_inline_begin*/_TransScattering/*ase_inline_end*/; + float direct = /*ase_inline_begin*/_TransDirect/*ase_inline_end*/; + float ambient = /*ase_inline_begin*/_TransAmbient/*ase_inline_end*/; + float strength = /*ase_inline_begin*/_TransStrength/*ase_inline_end*/; + + #define SUM_LIGHT_TRANSLUCENCY(Light)\ + float3 atten = Light.color * Light.distanceAttenuation;\ + atten = lerp( atten, atten * Light.shadowAttenuation, shadow );\ + half3 lightDir = Light.direction + inputData.normalWS * normal;\ + half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering );\ + half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency;\ + color.rgb += BaseColor * translucency * strength; + + SUM_LIGHT_TRANSLUCENCY( GetMainLight( inputData.shadowCoord ) ); + + #if defined(_ADDITIONAL_LIGHTS) + uint meshRenderingLayers = GetMeshRenderingLayer(); + uint pixelLightCount = GetAdditionalLightsCount(); + #if USE_FORWARD_PLUS + [loop] for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++) + { + FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK + + Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask); + #ifdef _LIGHT_LAYERS + if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) + #endif + { + SUM_LIGHT_TRANSLUCENCY( light ); + } + } + #endif + LIGHT_LOOP_BEGIN( pixelLightCount ) + Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask); + #ifdef _LIGHT_LAYERS + if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) + #endif + { + SUM_LIGHT_TRANSLUCENCY( light ); + } + LIGHT_LOOP_END + #endif + } + #endif + + #ifdef ASE_REFRACTION + float4 projScreenPos = ScreenPos / ScreenPos.w; + float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) ); + projScreenPos.xy += refractionOffset.xy; + float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor; + color.rgb = lerp( refraction, color.rgb, color.a ); + color.a = 1; + #endif + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + color.rgb = MixFogColor(color.rgb, half3(0,0,0), inputData.fogCoord); + #else + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4( EncodeMeshRenderingLayer( renderingLayers ), 0, 0, 0 ); + #endif + + return color; + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + ZWrite On + ZTest LEqual + AlphaToMask Off + ColorMask 0 + + HLSLPROGRAM + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + #pragma vertex vert + #pragma fragment frag + + #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE) + #define _SPECULAR_COLOR 1 + #endif + + #define SHADERPASS SHADERPASS_SHADOWCASTER + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) + #define ASE_SV_DEPTH SV_DepthLessEqual + #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid + #else + #define ASE_SV_DEPTH SV_Depth + #define ASE_SV_POSITION_QUALIFIERS + #endif + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; + float4 clipPosV : TEXCOORD0; + float3 positionWS : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD2; + #endif + /*ase_interp(3,):sp=sp;wp=tc1;sc=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + float3 _LightDirection; + float3 _LightPosition; + + PackedVaryings VertexFunction( Attributes input/*ase_vert_input*/ ) + { + PackedVaryings output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( output ); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/; + + float3 positionWS = TransformObjectToWorld( input.positionOS.xyz ); + float3 normalWS = TransformObjectToWorldDir(input.normalOS); + + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - positionWS); + #else + float3 lightDirectionWS = _LightDirection; + #endif + + float4 positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS)); + + //code for UNITY_REVERSED_Z is moved into Shadows.hlsl from 6000.0.22 and or higher + positionCS = ApplyShadowClamping(positionCS); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + output.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + output.positionCS = positionCS; + output.clipPosV = positionCS; + output.positionWS = positionWS; + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag( PackedVaryings input + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( input ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); + + /*ase_local_var:wp*/float3 WorldPosition = input.positionWS; + /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 ); + /*ase_local_var:sp*/float4 ClipPos = input.clipPosV; + /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + /*ase_frag_code:input=PackedVaryings*/ + + float Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + float AlphaClipThresholdShadow = /*ase_frag_out:Alpha Clip Threshold Shadow;Float;4;-1;_AlphaClipShadow*/0.5/*end*/; + + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/input.positionCS.z/*end*/; + #endif + + #ifdef _ALPHATEST_ON + #ifdef _ALPHATEST_SHADOW_ON + clip(Alpha - AlphaClipThresholdShadow); + #else + clip(Alpha - AlphaClipThreshold); + #endif + #endif + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return 0; + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "DepthOnly" + Tags + { + "LightMode" = "DepthOnly" + } + + ZWrite On + ColorMask R + AlphaToMask Off + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE) + #define _SPECULAR_COLOR 1 + #endif + + #define SHADERPASS SHADERPASS_DEPTHONLY + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) + #define ASE_SV_DEPTH SV_DepthLessEqual + #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid + #else + #define ASE_SV_DEPTH SV_Depth + #define ASE_SV_POSITION_QUALIFIERS + #endif + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; + float4 clipPosV : TEXCOORD0; + float3 positionWS : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD2; + #endif + /*ase_interp(3,):sp=sp;wp=tc1;sc=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output = (PackedVaryings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + output.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + output.positionCS = vertexInput.positionCS; + output.clipPosV = vertexInput.positionCS; + output.positionWS = vertexInput.positionWS; + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag( PackedVaryings input + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); + + /*ase_local_var:wp*/float3 WorldPosition = input.positionWS; + /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 ); + /*ase_local_var:sp*/float4 ClipPos = input.clipPosV; + /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + /*ase_frag_code:input=PackedVaryings*/ + + float Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/input.positionCS.z/*end*/; + #endif + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return 0; + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "Meta" + Tags + { + "LightMode" = "Meta" + } + + Cull Off + + HLSLPROGRAM + #pragma shader_feature EDITOR_VISUALIZATION + + #pragma vertex vert + #pragma fragment frag + + #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE) + #define _SPECULAR_COLOR 1 + #endif + + #define SHADERPASS SHADERPASS_META + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + /*ase_pragma*/ + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vdata:p=p;n=n;uv0=tc0;uv1=tc1;uv2=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 positionWS : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + #ifdef EDITOR_VISUALIZATION + float4 VizUV : TEXCOORD2; + float4 LightCoord : TEXCOORD3; + #endif + /*ase_interp(4,):sp=sp;wp=tc0;sc=tc1*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output = (PackedVaryings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;4;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;5;-1;_Normal*/input.normalOS/*end*/; + + float3 positionWS = TransformObjectToWorld( input.positionOS.xyz ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + output.positionWS = positionWS; + #endif + + output.positionCS = MetaVertexPosition( input.positionOS, input.texcoord1.xy, input.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST ); + + #ifdef EDITOR_VISUALIZATION + float2 VizUV = 0; + float4 LightCoord = 0; + UnityEditorVizData(input.positionOS.xyz, input.texcoord0.xy, input.texcoord1.xy, input.texcoord2.xy, VizUV, LightCoord); + output.VizUV = float4(VizUV, 0, 0); + output.LightCoord = LightCoord; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = output.positionCS; + output.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + output.texcoord0 = patch[0].texcoord0 * bary.x + patch[1].texcoord0 * bary.y + patch[2].texcoord0 * bary.z; + output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag(PackedVaryings input /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + /*ase_local_var:wp*/float3 WorldPosition = input.positionWS; + #endif + + /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + /*ase_frag_code:input=PackedVaryings*/ + + float3 BaseColor = /*ase_frag_out:Base Color;Float3;0;-1;_BaseColor*/float3(0.5, 0.5, 0.5)/*end*/; + float3 Emission = /*ase_frag_out:Emission;Float3;1;-1;_Emission*/0/*end*/; + float Alpha = /*ase_frag_out:Alpha;Float;2;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;3;-1;_AlphaClip*/0.5/*end*/; + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = BaseColor; + metaInput.Emission = Emission; + #ifdef EDITOR_VISUALIZATION + metaInput.VizUV = input.VizUV.xy; + metaInput.LightCoord = input.LightCoord; + #endif + + return UnityMetaFragment(metaInput); + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass:SyncP*/ + Name "Universal2D" + Tags + { + "LightMode" = "Universal2D" + } + + Blend One Zero + ZWrite On + ZTest LEqual + Offset 0,0 + ColorMask RGBA + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE) + #define _SPECULAR_COLOR 1 + #endif + + #define SHADERPASS SHADERPASS_2D + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + /*ase_pragma*/ + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 positionWS : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + /*ase_interp(2,):sp=sp;wp=tc0;sc=tc1*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output = (PackedVaryings)0; + UNITY_SETUP_INSTANCE_ID( input ); + UNITY_TRANSFER_INSTANCE_ID( input, output ); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( output ); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;3;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;4;-1;_Normal*/input.normalOS/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + output.positionWS = vertexInput.positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + output.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + output.positionCS = vertexInput.positionCS; + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag(PackedVaryings input /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( input ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + /*ase_local_var:wp*/float3 WorldPosition = input.positionWS; + #endif + + /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + /*ase_frag_code:input=PackedVaryings*/ + + float3 BaseColor = /*ase_frag_out:Base Color;Float3;0;-1;_BaseColor*/float3(0.5, 0.5, 0.5)/*end*/; + float Alpha = /*ase_frag_out:Alpha;Float;1;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;2;-1;_AlphaClip*/0.5/*end*/; + + half4 color = half4(BaseColor, Alpha ); + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + return color; + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "DepthNormals" + Tags + { + "LightMode" = "DepthNormals" + } + + ZWrite On + Blend One Zero + ZTest LEqual + ZWrite On + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE) + #define _SPECULAR_COLOR 1 + #endif + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + //#define SHADERPASS SHADERPASS_DEPTHNORMALS + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) + #define ASE_SV_DEPTH SV_DepthLessEqual + #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid + #else + #define ASE_SV_DEPTH SV_Depth + #define ASE_SV_POSITION_QUALIFIERS + #endif + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + /*ase_vdata:p=p;n=n;t=t*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; + float4 clipPosV : TEXCOORD0; + float3 positionWS : TEXCOORD1; + float3 normalWS : TEXCOORD2; + float4 tangentWS : TEXCOORD3; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD4; + #endif + /*ase_interp(5,):sp=sp;wp=tc1;wn=tc2;wt=tc3;sc=tc4*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output = (PackedVaryings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/; + input.tangentOS = /*ase_vert_out:Vertex Tangent;Float4;30;-1;_Tangent*/input.tangentOS/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); + + float3 normalWS = TransformObjectToWorldNormal( input.normalOS ); + float4 tangentWS = float4( TransformObjectToWorldDir( input.tangentOS.xyz ), input.tangentOS.w ); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + output.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + output.positionCS = vertexInput.positionCS; + output.clipPosV = vertexInput.positionCS; + output.positionWS = vertexInput.positionWS; + output.normalWS = normalWS; + output.tangentWS = tangentWS; + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + output.tangentOS = input.tangentOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + void frag( PackedVaryings input + , out half4 outNormalWS : SV_Target0 + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + /*ase_frag_input*/ ) + { + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); + + /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 ); + /*ase_local_var:wn*/float3 WorldNormal = input.normalWS; + /*ase_local_var:wt*/float4 WorldTangent = input.tangentWS; + /*ase_local_var:wp*/float3 WorldPosition = input.positionWS; + /*ase_local_var:sp*/float4 ClipPos = input.clipPosV; + /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + /*ase_frag_code:input=PackedVaryings*/ + + float3 Normal = /*ase_frag_out:Normal;Float3;5;-1;_FragNormal*/float3(0, 0, 1)/*end*/; + float Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/input.positionCS.z/*end*/; + #endif + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float2 octNormalWS = PackNormalOctQuadEncode(WorldNormal); + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); + outNormalWS = half4(packedNormalWS, 0.0); + #else + #if defined(_NORMALMAP) + #if _NORMAL_DROPOFF_TS + float crossSign = (WorldTangent.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale(); + float3 bitangent = crossSign * cross(WorldNormal.xyz, WorldTangent.xyz); + float3 normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent.xyz, bitangent, WorldNormal.xyz)); + #elif _NORMAL_DROPOFF_OS + float3 normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + float3 normalWS = Normal; + #endif + #else + float3 normalWS = WorldNormal; + #endif + outNormalWS = half4(NormalizeNormalPerPixel(normalWS), 0.0); + #endif + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass:SyncP*/ + Name "GBuffer" + Tags + { + "LightMode" = "UniversalGBuffer" + } + + Blend One Zero + ZWrite On + ZTest LEqual + Offset 0,0 + ColorMask RGBA + /*ase_stencil*/ + + HLSLPROGRAM + + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + + #pragma vertex vert + #pragma fragment frag + + #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE) + #define _SPECULAR_COLOR 1 + #endif + + #define SHADERPASS SHADERPASS_GBUFFER + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL) + #define ENABLE_TERRAIN_PERPIXEL_NORMAL + #endif + + /*ase_pragma*/ + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) + #define ASE_SV_DEPTH SV_DepthLessEqual + #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid + #else + #define ASE_SV_DEPTH SV_Depth + #define ASE_SV_POSITION_QUALIFIERS + #endif + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vdata:p=p;n=n;t=t;uv0=tc0;uv1=tc1;uv2=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; + float4 clipPosV : TEXCOORD0; + float4 lightmapUVOrVertexSH : TEXCOORD1; + #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX) + half4 fogFactorAndVertexLight : TEXCOORD2; + #endif + float4 tSpace0 : TEXCOORD3; + float4 tSpace1 : TEXCOORD4; + float4 tSpace2 : TEXCOORD5; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD6; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD7; + #endif + #if defined(USE_APV_PROBE_OCCLUSION) + float4 probeOcclusion : TEXCOORD8; + #endif + /*ase_interp(9,):sp=sp;wn.xyz=tc3.xyz;wt.xyz=tc4.xyz;wbt.xyz=tc5.xyz;wp.x=tc3.w;wp.y=tc4.w;wp.z=tc5.w;sc=tc6*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + /*ase_funcs*/ + + PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output = (PackedVaryings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;8;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;10;-1;_Normal*/input.normalOS/*end*/; + input.tangentOS = /*ase_vert_out:Vertex Tangent;Float4;30;-1;_Tangent*/input.tangentOS/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); + VertexNormalInputs normalInput = GetVertexNormalInputs( input.normalOS, input.tangentOS ); + + output.tSpace0 = float4( normalInput.normalWS, vertexInput.positionWS.x); + output.tSpace1 = float4( normalInput.tangentWS, vertexInput.positionWS.y); + output.tSpace2 = float4( normalInput.bitangentWS, vertexInput.positionWS.z); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV(input.texcoord1, unity_LightmapST, output.lightmapUVOrVertexSH.xy); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + output.dynamicLightmapUV.xy = input.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + OUTPUT_SH4( vertexInput.positionWS, normalInput.normalWS.xyz, GetWorldSpaceNormalizeViewDir( vertexInput.positionWS ), output.lightmapUVOrVertexSH.xyz, output.probeOcclusion ); + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + output.lightmapUVOrVertexSH.zw = input.texcoord.xy; + output.lightmapUVOrVertexSH.xy = input.texcoord.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX) + output.fogFactorAndVertexLight = 0; + #if defined(ASE_FOG) && !defined(_FOG_FRAGMENT) + // @diogo: no fog applied in GBuffer + #endif + #ifdef _ADDITIONAL_LIGHTS_VERTEX + half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS ); + output.fogFactorAndVertexLight.yzw = vertexLight; + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + output.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + output.positionCS = vertexInput.positionCS; + output.clipPosV = vertexInput.positionCS; + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + float4 tangentOS : TANGENT; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + output.tangentOS = input.tangentOS; + output.texcoord = input.texcoord; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z; + output.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z; + output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + FragmentOutput frag ( PackedVaryings input + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + /*ase_frag_input*/ ) + { + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float2 sampleCoords = (input.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy; + float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1)); + float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal); + float3 WorldBiTangent = cross(WorldNormal, -WorldTangent); + #else + /*ase_local_var:wn*/float3 WorldNormal = normalize( input.tSpace0.xyz ); + /*ase_local_var:wt*/float3 WorldTangent = input.tSpace1.xyz; + /*ase_local_var:wbt*/float3 WorldBiTangent = input.tSpace2.xyz; + #endif + + /*ase_local_var:wp*/float3 WorldPosition = float3(input.tSpace0.w,input.tSpace1.w,input.tSpace2.w); + /*ase_local_var:wvd*/float3 WorldViewDirection = GetWorldSpaceNormalizeViewDir( WorldPosition ); + /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 ); + /*ase_local_var:sp*/float4 ClipPos = input.clipPosV; + /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV ); + + float2 NormalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #else + ShadowCoords = float4(0, 0, 0, 0); + #endif + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + /*ase_frag_code:input=PackedVaryings*/ + + float3 BaseColor = /*ase_frag_out:Base Color;Float3;0;-1;_BaseColor*/float3(0.5, 0.5, 0.5)/*end*/; + float3 Normal = /*ase_frag_out:Normal;Float3;1;-1;_FragNormal*/float3(0, 0, 1)/*end*/; + float3 Emission = /*ase_frag_out:Emission;Float3;2;-1;_Emission*/0/*end*/; + float3 Specular = /*ase_frag_out:Specular;Float3;9;-1;_Specular*/0.5/*end*/; + float Metallic = /*ase_frag_out:Metallic;Float;3;-1;_Metallic*/0/*end*/; + float Smoothness = /*ase_frag_out:Smoothness;Float;4;-1;_Smoothness*/0.5/*end*/; + float Occlusion = /*ase_frag_out:Occlusion;Float;5;-1;_Occlusion*/1/*end*/; + float Alpha = /*ase_frag_out:Alpha;Float;6;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;7;-1;_AlphaClip*/0.5/*end*/; + float AlphaClipThresholdShadow = /*ase_frag_out:Alpha Clip Threshold Shadow;Float;16;-1;_AlphaClipShadow*/0.5/*end*/; + float3 BakedGI = /*ase_frag_out:Baked GI;Float3;11;-1;_BakedGI*/0/*end*/; + float3 RefractionColor = /*ase_frag_out:Refraction Color;Float3;12;-1;_RefractionColor*/1/*end*/; + float RefractionIndex = /*ase_frag_out:Refraction Index;Float;13;-1;_RefractionIndex*/1/*end*/; + float3 Transmission = /*ase_frag_out:Transmission;Float3;14;-1;_Transmission*/1/*end*/; + float3 Translucency = /*ase_frag_out:Translucency;Float3;15;-1;_Translucency*/1/*end*/; + + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/input.positionCS.z/*end*/; + #endif + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.positionCS = input.positionCS; + inputData.shadowCoord = ShadowCoords; + + #ifdef _NORMALMAP + #if _NORMAL_DROPOFF_TS + inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal )); + #elif _NORMAL_DROPOFF_OS + inputData.normalWS = TransformObjectToWorldNormal(Normal); + #elif _NORMAL_DROPOFF_WS + inputData.normalWS = Normal; + #endif + #else + inputData.normalWS = WorldNormal; + #endif + + inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); + inputData.viewDirectionWS = SafeNormalize( WorldViewDirection ); + + #ifdef ASE_FOG + // @diogo: no fog applied in GBuffer + #endif + #ifdef _ADDITIONAL_LIGHTS_VERTEX + inputData.vertexLighting = input.fogFactorAndVertexLight.yzw; + #endif + + #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL) + float3 SH = SampleSH(inputData.normalWS.xyz); + #else + float3 SH = input.lightmapUVOrVertexSH.xyz; + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, input.dynamicLightmapUV.xy, SH, inputData.normalWS); + inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy); + #elif !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) + inputData.bakedGI = SAMPLE_GI( SH, GetAbsolutePositionWS(inputData.positionWS), + inputData.normalWS, + inputData.viewDirectionWS, + input.positionCS.xy, + input.probeOcclusion, + inputData.shadowMask ); + #else + inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, SH, inputData.normalWS); + inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy); + #endif + + #ifdef ASE_BAKEDGI + inputData.bakedGI = BakedGI; + #endif + + inputData.normalizedScreenSpaceUV = NormalizedScreenSpaceUV; + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = input.lightmapUVOrVertexSH.xy; + #else + inputData.vertexSH = SH; + #endif + #if defined(USE_APV_PROBE_OCCLUSION) + inputData.probeOcclusion = input.probeOcclusion; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(input.positionCS, + BaseColor, + Specular, + inputData.normalWS, + Metallic, + Occlusion, + Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData + (BaseColor, Metallic, Specular, Smoothness, Alpha, brdfData); + + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + half4 color; + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + color.a = Alpha; + + #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY + color.rgb *= color.a; + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb, Occlusion); + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "SceneSelectionPass" + Tags + { + "LightMode" = "SceneSelectionPass" + } + + Cull Off + AlphaToMask Off + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE) + #define _SPECULAR_COLOR 1 + #endif + + #define SCENESELECTIONPASS 1 + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + /*ase_pragma*/ + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + /*ase_interp(0,):sp=sp*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + PackedVaryings VertexFunction(Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output; + ZERO_INITIALIZE(PackedVaryings, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/; + + float3 positionWS = TransformObjectToWorld( input.positionOS.xyz ); + + output.positionCS = TransformWorldToHClip(positionWS); + + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag(PackedVaryings input /*ase_frag_input*/) : SV_Target + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + /*ase_frag_code:input=PackedVaryings*/ + + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + surfaceDescription.AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = 0; + + #ifdef SCENESELECTIONPASS + outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #endif + + return outColor; + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + AlphaToMask Off + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE) + #define _SPECULAR_COLOR 1 + #endif + + #define SCENEPICKINGPASS 1 + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + /*ase_pragma*/ + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + /*ase_interp(0,):sp=sp*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + PackedVaryings VertexFunction(Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output; + ZERO_INITIALIZE(PackedVaryings, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/; + + float3 positionWS = TransformObjectToWorld( input.positionOS.xyz ); + output.positionCS = TransformWorldToHClip(positionWS); + + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag(PackedVaryings input /*ase_frag_input*/) : SV_Target + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + /*ase_frag_code:input=PackedVaryings*/ + + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + surfaceDescription.AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = 0; + + #ifdef SCENESELECTIONPASS + outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #endif + + return outColor; + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + ColorMask RG + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE) + #define _SPECULAR_COLOR 1 + #endif + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MotionVectorsCommon.hlsl" + + /*ase_pragma*/ + + struct Attributes + { + float4 positionOS : POSITION; + float3 positionOld : TEXCOORD4; + #if _ADD_PRECOMPUTED_VELOCITY + float3 alembicMotionVector : TEXCOORD5; + #endif + /*ase_vdata:p=p;uv4=tc4;uv5=tc5*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float4 positionCSNoJitter : TEXCOORD0; + float4 previousPositionCSNoJitter : TEXCOORD1; + /*ase_interp(2,):sp=sp.xyzw*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output = (PackedVaryings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); + + #if defined(APLICATION_SPACE_WARP_MOTION) + // We do not need jittered position in ASW + output.positionCSNoJitter = mul(_NonJitteredViewProjMatrix, mul(UNITY_MATRIX_M, input.positionOS));; + output.positionCS = output.positionCSNoJitter; + #else + // Jittered. Match the frame. + output.positionCS = vertexInput.positionCS; + output.positionCSNoJitter = mul( _NonJitteredViewProjMatrix, mul( UNITY_MATRIX_M, input.positionOS)); + #endif + + float4 prevPos = ( unity_MotionVectorsParams.x == 1 ) ? float4( input.positionOld, 1 ) : input.positionOS; + + #if _ADD_PRECOMPUTED_VELOCITY + prevPos = prevPos - float4(input.alembicMotionVector, 0); + #endif + + output.previousPositionCSNoJitter = mul( _PrevViewProjMatrix, mul( UNITY_PREV_MATRIX_M, prevPos ) ); + // removed in ObjectMotionVectors.hlsl found in unity 6000.0.23 and higher + //ApplyMotionVectorZBias( output.positionCS ); + return output; + } + + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + + half4 frag( PackedVaryings input /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); + + /*ase_frag_code:input=PackedVaryings*/ + + float Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + #if defined(APLICATION_SPACE_WARP_MOTION) + return float4( CalcAswNdcMotionVectorFromCsPositions( input.positionCSNoJitter, input.previousPositionCSNoJitter ), 1 ); + #else + return float4( CalcNdcMotionVectorFromCsPositions( input.positionCSNoJitter, input.previousPositionCSNoJitter ), 0, 0 ); + #endif + } + ENDHLSL + } + /*ase_pass_end*/ + } + /*ase_lod*/ + CustomEditor "UnityEditor.ShaderGraphLitGUI" + FallBack "Hidden/Shader Graph/FallbackError" +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Lit.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Lit.shader.meta new file mode 100644 index 00000000..59adc083 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Lit.shader.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 94348b07e5e8bab40bd6c8a1e3df54cd +ShaderImporter: + externalObjects: {} + defaultTextures: + - unity_Lightmaps: {instanceID: 0} + - unity_LightmapsInd: {instanceID: 0} + - unity_ShadowMasks: {instanceID: 0} + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Unlit.shader b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Unlit.shader new file mode 100644 index 00000000..7685e8e6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Unlit.shader @@ -0,0 +1,2966 @@ +Shader /*ase_name*/ "Hidden/Universal/Unlit" /*end*/ +{ + Properties + { + /*ase_props*/ + + //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5 + //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16 + //_TessMin( "Tess Min Distance", Float ) = 10 + //_TessMax( "Tess Max Distance", Float ) = 25 + //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16 + //_TessMaxDisp( "Tess Max Displacement", Float ) = 25 + + [HideInInspector] _QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector] _QueueControl("_QueueControl", Float) = -1 + + [HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + + [HideInInspector][ToggleUI] _AddPrecomputedVelocity("Add Precomputed Velocity", Float) = 1 + [HideInInspector][ToggleOff] _ReceiveShadows("Receive Shadows", Float) = 1.0 + } + + SubShader + { + /*ase_subshader_options:Name=Additional Options + Option:Surface:Opaque,Transparent:Opaque + Opaque:SetPropertyOnSubShader:RenderType,Opaque + Opaque:SetPropertyOnSubShader:RenderQueue,Geometry + Opaque:SetPropertyOnPass:Forward:ZWrite,On + Opaque:HideOption: Blend + Opaque:RemoveDefine:_SURFACE_TYPE_TRANSPARENT 1 + Opaque:HidePort:Forward:Alpha + Opaque:RefreshOption:Alpha Clipping + Opaque:ExcludePass:Universal2D + Opaque:ExcludePass:DepthNormalsOnly + Transparent:SetPropertyOnSubShader:RenderType,Transparent + Transparent:SetPropertyOnSubShader:RenderQueue,Transparent + Transparent:SetPropertyOnPass:Forward:ZWrite,Off + Transparent:ShowOption: Blend + Transparent:SetDefine:_SURFACE_TYPE_TRANSPARENT 1 + Transparent:ShowPort:Forward:Alpha + Transparent:ExcludePass:Universal2D + Transparent:ExcludePass:DepthNormalsOnly + Option: Blend:Alpha,Premultiply,Additive,Multiply:Alpha + Alpha:SetPropertyOnPass:Forward:BlendRGB,SrcAlpha,OneMinusSrcAlpha + Premultiply:SetPropertyOnPass:Forward:BlendRGB,One,OneMinusSrcAlpha + Additive:SetPropertyOnPass:Forward:BlendRGB,One,One + Multiply:SetPropertyOnPass:Forward:BlendRGB,DstColor,Zero + Alpha,Premultiply,Additive:SetPropertyOnPass:Forward:BlendAlpha,One,OneMinusSrcAlpha + Multiply:SetPropertyOnPass:Forward:BlendAlpha,One,Zero + disable:SetPropertyOnPass:Forward:BlendRGB,One,Zero + disable:SetPropertyOnPass:Forward:BlendAlpha,One,Zero + Option:Two Sided:On,Cull Back,Cull Front:Cull Back + On:SetPropertyOnSubShader:CullMode,Off + Cull Back:SetPropertyOnSubShader:CullMode,Back + Cull Front:SetPropertyOnSubShader:CullMode,Front + Option:Alpha Clipping:false,true:true + true:ShowPort:Forward:Alpha + true:ShowPort:Forward:Alpha Clip Threshold + true?Cast Shadows=true:ShowOption: Use Shadow Threshold + true?Surface=Opaque:SetPropertyOnSubShader:RenderType,TransparentCutout + true?Surface=Opaque:SetPropertyOnSubShader:RenderQueue,AlphaTest + true:SetDefine:Forward:pragma multi_compile_fragment _ALPHATEST_ON + true:SetDefine:Meta:pragma multi_compile_fragment _ALPHATEST_ON + true:SetDefine:Universal2D:pragma multi_compile_fragment _ALPHATEST_ON + true:SetDefine:ShadowCaster:pragma multi_compile _ALPHATEST_ON + true:SetDefine:DepthOnly:pragma multi_compile _ALPHATEST_ON + true:SetDefine:DepthNormals:pragma multi_compile _ALPHATEST_ON + true:SetDefine:MotionVectors:pragma multi_compile _ALPHATEST_ON + false:HidePort:Forward:Alpha Clip Threshold + false:SetOption: Use Shadow Threshold,0 + false:HideOption: Use Shadow Threshold + false:RefreshOption:Surface + false:RemoveDefine:Forward:pragma multi_compile_fragment _ALPHATEST_ON + false:RemoveDefine:Meta:pragma multi_compile_fragment _ALPHATEST_ON + false:RemoveDefine:Universal2D:pragma multi_compile_fragment _ALPHATEST_ON + false:RemoveDefine:ShadowCaster:pragma multi_compile _ALPHATEST_ON + false:RemoveDefine:DepthOnly:pragma multi_compile _ALPHATEST_ON + false:RemoveDefine:DepthNormals:pragma multi_compile _ALPHATEST_ON + false:RemoveDefine:MotionVectors:pragma multi_compile _ALPHATEST_ON + Option: Use Shadow Threshold:false,true:false + true:ShowPort:Forward:Alpha Clip Threshold Shadow + true:SetDefine:_ALPHATEST_SHADOW_ON 1 + false,disable:RemoveDefine:_ALPHATEST_SHADOW_ON 1 + false,disable:HidePort:Forward:Alpha Clip Threshold Shadow + Option:Forward Only:false,true:false + false,disable:SetPropertyOnPass:Forward:ChangeTagValue,LightMode,UniversalForward + false,disable:SetPropertyOnPass:DepthNormals:ChangeTagValue,LightMode,DepthNormals + true:SetPropertyOnPass:Forward:ChangeTagValue,LightMode,UniversalForwardOnly + true:SetPropertyOnPass:DepthNormals:ChangeTagValue,LightMode,DepthNormalsOnly + Option:Cast Shadows:false,true:true + true:IncludePass:ShadowCaster + false,disable:ExcludePass:ShadowCaster + true?Alpha Clipping=true:ShowOption: Use Shadow Threshold + false:HideOption: Use Shadow Threshold + Option:Receive Shadows:false,true:true + true:SetDefine:Forward:pragma shader_feature_local _RECEIVE_SHADOWS_OFF + false:RemoveDefine:Forward:pragma shader_feature_local _RECEIVE_SHADOWS_OFF + Option:Motion Vectors:false,true:true + true:ShowOption: Add Precomputed Velocity + false:HideOption: Add Precomputed Velocity + true:IncludePass:MotionVectors + false:ExcludePass:MotionVectors + true:SetOption:Tessellation,0 + Option: Add Precomputed Velocity:false,true:false + true:SetShaderProperty:_AddPrecomputedVelocity,[HideInInspector][ToggleUI] _AddPrecomputedVelocity("Add Precomputed Velocity", Float) = 1 + false:SetShaderProperty:_AddPrecomputedVelocity,//[HideInInspector][ToggleUI] _AddPrecomputedVelocity("Add Precomputed Velocity", Float) = 1 + true:SetShaderProperty:_AddPrecomputedVelocity,1 + true:SetDefine:MotionVectors:pragma shader_feature_local_vertex _ADD_PRECOMPUTED_VELOCITY + false:RemoveDefine:MotionVectors:pragma shader_feature_local_vertex _ADD_PRECOMPUTED_VELOCITY + Option:GPU Instancing:false,true:true + true:SetDefine:Forward:pragma multi_compile_instancing + true:SetDefine:ShadowCaster:pragma multi_compile_instancing + true:SetDefine:MotionVectors:pragma multi_compile_instancing + true:SetDefine:DepthOnly:pragma multi_compile_instancing + true:SetDefine:DepthNormals:pragma multi_compile_instancing + false:RemoveDefine:Forward:pragma multi_compile_instancing + false:RemoveDefine:ShadowCaster:pragma multi_compile_instancing + false:RemoveDefine:MotionVectors:pragma multi_compile_instancing + false:RemoveDefine:DepthOnly:pragma multi_compile_instancing + false:RemoveDefine:DepthNormals:pragma multi_compile_instancing + true:SetDefine:Forward:pragma instancing_options renderinglayer + false:RemoveDefine:Forward:pragma instancing_options renderinglayer + Option:LOD CrossFade:false,true:true + true:SetDefine:Forward:pragma multi_compile _ LOD_FADE_CROSSFADE + true:SetDefine:ShadowCaster:pragma multi_compile _ LOD_FADE_CROSSFADE + true:SetDefine:MotionVectors:pragma multi_compile _ LOD_FADE_CROSSFADE + true:SetDefine:DepthOnly:pragma multi_compile _ LOD_FADE_CROSSFADE + true:SetDefine:DepthNormals:pragma multi_compile _ LOD_FADE_CROSSFADE + false:RemoveDefine:Forward:pragma multi_compile _ LOD_FADE_CROSSFADE + false:RemoveDefine:ShadowCaster:pragma multi_compile _ LOD_FADE_CROSSFADE + false:RemoveDefine:MotionVectors:pragma multi_compile _ LOD_FADE_CROSSFADE + false:RemoveDefine:DepthOnly:pragma multi_compile _ LOD_FADE_CROSSFADE + false:RemoveDefine:DepthNormals:pragma multi_compile _ LOD_FADE_CROSSFADE + Option:Built-in Fog:false,true:true + true:SetDefine:Forward:pragma multi_compile_fog + false:RemoveDefine:Forward:pragma multi_compile_fog + true:SetDefine:ASE_FOG 1 + false:RemoveDefine:ASE_FOG 1 + Option:Meta Pass:false,true:false + true:IncludePass:Meta + true:ShowPort:Forward:Baked Albedo + true:ShowPort:Forward:Baked Emission + false,disable:ExcludePass:Meta + false:HidePort:Forward:Baked Albedo + false:HidePort:Forward:Baked Emission + Option:Extra Pre Pass:false,true:false + true:IncludePass:ExtraPrePass + false,disable:ExcludePass:ExtraPrePass + Option:Tessellation:false,true:false + true:SetDefine:ASE_TESSELLATION 1 + true:SetDefine:pragma require tessellation tessHW + true:SetDefine:pragma hull HullFunction + true:SetDefine:pragma domain DomainFunction + true:ShowOption: Phong + true:ShowOption: Type + false,disable:RemoveDefine:ASE_TESSELLATION 1 + false,disable:RemoveDefine:pragma require tessellation tessHW + false,disable:RemoveDefine:pragma hull HullFunction + false,disable:RemoveDefine:pragma domain DomainFunction + false,disable:HideOption: Phong + false,disable:HideOption: Type + true:SetOption:Motion Vectors,0 + Option: Phong:false,true:false + true:SetDefine:ASE_PHONG_TESSELLATION + false,disable:RemoveDefine:ASE_PHONG_TESSELLATION + true:ShowOption: Strength + false,disable:HideOption: Strength + Field: Strength:Float:0.5:0:1:_TessPhongStrength + Change:SetMaterialProperty:_TessPhongStrength + Change:SetShaderProperty:_TessPhongStrength,_TessPhongStrength( "Phong Tess Strength", Range( 0, 1 ) ) = 0.5 + Inline,disable:SetShaderProperty:_TessPhongStrength,//_TessPhongStrength( "Phong Tess Strength", Range( 0, 1 ) ) = 0.5 + Option: Type:Fixed,Distance Based,Edge Length,Edge Length Cull:Fixed + Fixed:SetDefine:ASE_FIXED_TESSELLATION + Fixed,Distance Based:ShowOption: Tess + Distance Based:SetDefine:ASE_DISTANCE_TESSELLATION + Distance Based:ShowOption: Min + Distance Based:ShowOption: Max + Edge Length:SetDefine:ASE_LENGTH_TESSELLATION + Edge Length,Edge Length Cull:ShowOption: Edge Length + Edge Length Cull:SetDefine:ASE_LENGTH_CULL_TESSELLATION + Edge Length Cull:ShowOption: Max Displacement + disable,Distance Based,Edge Length,Edge Length Cull:RemoveDefine:ASE_FIXED_TESSELLATION + disable,Fixed,Edge Length,Edge Length Cull:RemoveDefine:ASE_DISTANCE_TESSELLATION + disable,Fixed,Distance Based,Edge Length Cull:RemoveDefine:ASE_LENGTH_TESSELLATION + disable,Fixed,Distance Based,Edge Length:RemoveDefine:ASE_LENGTH_CULL_TESSELLATION + disable,Edge Length,Edge Length Cull:HideOption: Tess + disable,Fixed,Edge Length,Edge Length Cull:HideOption: Min + disable,Fixed,Edge Length,Edge Length Cull:HideOption: Max + disable,Fixed,Distance Based:HideOption: Edge Length + disable,Fixed,Distance Based,Edge Length:HideOption: Max Displacement + Field: Tess:Float:16:1:32:_TessValue + Change:SetMaterialProperty:_TessValue + Change:SetShaderProperty:_TessValue,_TessValue( "Max Tessellation", Range( 1, 32 ) ) = 16 + Inline,disable:SetShaderProperty:_TessValue,//_TessValue( "Max Tessellation", Range( 1, 32 ) ) = 16 + Field: Min:Float:10:_TessMin + Change:SetMaterialProperty:_TessMin + Change:SetShaderProperty:_TessMin,_TessMin( "Tess Min Distance", Float ) = 10 + Inline,disable:SetShaderProperty:_TessMin,//_TessMin( "Tess Min Distance", Float ) = 10 + Field: Max:Float:25:_TessMax + Change:SetMaterialProperty:_TessMax + Change:SetShaderProperty:_TessMax,_TessMax( "Tess Max Distance", Float ) = 25 + Inline,disable:SetShaderProperty:_TessMax,//_TessMax( "Tess Max Distance", Float ) = 25 + Field: Edge Length:Float:16:2:50:_TessEdgeLength + Change:SetMaterialProperty:_TessEdgeLength + Change:SetShaderProperty:_TessEdgeLength,_TessEdgeLength ( "Edge length", Range( 2, 50 ) ) = 16 + Inline,disable:SetShaderProperty:_TessEdgeLength,//_TessEdgeLength ( "Edge length", Range( 2, 50 ) ) = 16 + Field: Max Displacement:Float:25:_TessMaxDisp + Change:SetMaterialProperty:_TessMaxDisp + Change:SetShaderProperty:_TessMaxDisp,_TessMaxDisp( "Max Displacement", Float ) = 25 + Inline,disable:SetShaderProperty:_TessMaxDisp,//_TessMaxDisp( "Max Displacement", Float ) = 25 + Option:Write Depth:false,true:false + true:SetDefine:ASE_DEPTH_WRITE_ON + true:ShowOption: Early Z + true:ShowPort:Forward:Depth Value + false,disable:RemoveDefine:ASE_DEPTH_WRITE_ON + false,disable:HideOption: Early Z + false,disable:HidePort:Forward:Depth Value + Option: Early Z:false,true:false + true:SetDefine:ASE_EARLY_Z_DEPTH_OPTIMIZE + false,disable:RemoveDefine:ASE_EARLY_Z_DEPTH_OPTIMIZE + Option:Vertex Position,InvertActionOnDeselection:Absolute,Relative:Relative + Absolute:SetDefine:ASE_ABSOLUTE_VERTEX_POS 1 + Absolute:SetPortName:Forward:5,Vertex Position + Relative:SetPortName:Forward:5,Vertex Offset + Absolute:SetPortName:ExtraPrePass:3,Vertex Position + Relative:SetPortName:ExtraPrePass:3,Vertex Offset + */ + + Tags + { + "RenderPipeline" = "UniversalPipeline" + "RenderType"="Opaque" + "Queue"="Geometry+0" + "UniversalMaterialType"="Unlit" + } + + Cull Back + AlphaToMask Off + + /*ase_stencil*/ + + HLSLINCLUDE + #pragma target 4.5 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d9 // ensure rendering platforms toggle list is visible + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl" + + #ifndef ASE_TESS_FUNCS + #define ASE_TESS_FUNCS + float4 FixedTess( float tessValue ) + { + return tessValue; + } + + float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos ) + { + float3 wpos = mul(o2w,vertex).xyz; + float dist = distance (wpos, cameraPos); + float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess; + return f; + } + + float4 CalcTriEdgeTessFactors (float3 triVertexFactors) + { + float4 tess; + tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z); + tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z); + tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y); + tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f; + return tess; + } + + float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams ) + { + float dist = distance (0.5 * (wpos0+wpos1), cameraPos); + float len = distance(wpos0, wpos1); + float f = max(len * scParams.y / (edgeLen * dist), 1.0); + return f; + } + + float DistanceFromPlane (float3 pos, float4 plane) + { + float d = dot (float4(pos,1.0f), plane); + return d; + } + + bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] ) + { + float4 planeTest; + planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f ); + planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) + + (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f ); + return !all (planeTest); + } + + float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos ) + { + float3 f; + f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos); + f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos); + f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos); + + return CalcTriEdgeTessFactors (f); + } + + float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + return tess; + } + + float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] ) + { + float3 pos0 = mul(o2w,v0).xyz; + float3 pos1 = mul(o2w,v1).xyz; + float3 pos2 = mul(o2w,v2).xyz; + float4 tess; + + if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes)) + { + tess = 0.0f; + } + else + { + tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams); + tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams); + tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams); + tess.w = (tess.x + tess.y + tess.z) / 3.0f; + } + return tess; + } + #endif //ASE_TESS_FUNCS + ENDHLSL + + /*ase_pass*/ + Pass + { + Name "ExtraPrePass" + Tags{ } + + Blend One Zero + Cull Back + ZWrite On + ZTest LEqual + Offset 0,0 + ColorMask RGBA + + /*ase_stencil*/ + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float4 clipPosV : TEXCOORD0; + float3 positionWS : TEXCOORD1; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD2; + #endif + #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX) + half4 fogFactorAndVertexLight : TEXCOORD3; + #endif + /*ase_interp(4,):sp=sp;wp=tc1;sc=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output = (PackedVaryings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;3;-1;_VertexP*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;4;-1;_NormalP*/input.normalOS/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + output.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX) + output.fogFactorAndVertexLight = 0; + #if defined(ASE_FOG) && !defined(_FOG_FRAGMENT) + output.fogFactorAndVertexLight.x = ComputeFogFactor(vertexInput.positionCS.z); + #endif + #ifdef _ADDITIONAL_LIGHTS_VERTEX + half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS ); + output.fogFactorAndVertexLight.yzw = vertexLight; + #endif + #endif + + output.positionCS = vertexInput.positionCS; + output.clipPosV = vertexInput.positionCS; + output.positionWS = vertexInput.positionWS; + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag ( PackedVaryings input /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( input ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); + + /*ase_local_var:wp*/float3 WorldPosition = input.positionWS; + /*ase_local_var:wvd*/float3 WorldViewDirection = GetWorldSpaceNormalizeViewDir( WorldPosition ); + /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 ); + /*ase_local_var:sp*/float4 ClipPos = input.clipPosV; + /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.viewDirectionWS = WorldViewDirection; + + #ifdef ASE_FOG + inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactorAndVertexLight.x); + #endif + #ifdef _ADDITIONAL_LIGHTS_VERTEX + inputData.vertexLighting = input.fogFactorAndVertexLight.yzw; + #endif + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + /*ase_frag_code:input=PackedVaryings*/ + + float3 Color = /*ase_frag_out:Color;Float3;0;-1;_ColorP*/float3( 0, 0, 0 )/*end*/; + float Alpha = /*ase_frag_out:Alpha;Float;1;-1;_AlphaP*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;2;-1;_AlphaClipP*/0.5/*end*/; + + #ifdef _ALPHATEST_ON + clip( Alpha - AlphaClipThreshold ); + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + Color.rgb = MixFogColor(Color.rgb, half3(0,0,0), inputData.fogCoord); + #else + Color.rgb = MixFog(Color.rgb, inputData.fogCoord); + #endif + #endif + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + return half4( Color, Alpha ); + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_main_pass*/ + Name "Forward" + Tags + { + "LightMode" = "UniversalForwardOnly" + } + + Blend One Zero + ZWrite On + ZTest LEqual + Offset 0,0 + ColorMask RGBA + + /*ase_stencil*/ + + HLSLPROGRAM + + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ DEBUG_DISPLAY + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_UNLIT + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging3D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceData.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) + #define ASE_SV_DEPTH SV_DepthLessEqual + #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid + #else + #define ASE_SV_DEPTH SV_Depth + #define ASE_SV_POSITION_QUALIFIERS + #endif + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vdata:p=p;n=n;uv0=tc0;uv1=tc1;uv2=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; + float4 clipPosV : TEXCOORD0; + float3 positionWS : TEXCOORD1; + #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX) + half4 fogFactorAndVertexLight : TEXCOORD2; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD3; + #endif + #if defined(LIGHTMAP_ON) + float4 lightmapUVOrVertexSH : TEXCOORD4; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD5; + #endif + /*ase_interp(6,):sp=sp;wp=tc1;sc=tc3*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output = (PackedVaryings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;5;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;6;-1;_Normal*/input.normalOS/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); + + #if defined(LIGHTMAP_ON) + OUTPUT_LIGHTMAP_UV(input.texcoord1, unity_LightmapST, output.lightmapUVOrVertexSH.xy); + #endif + #if defined(DYNAMICLIGHTMAP_ON) + output.dynamicLightmapUV.xy = input.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + + #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX) + output.fogFactorAndVertexLight = 0; + #if defined(ASE_FOG) && !defined(_FOG_FRAGMENT) + output.fogFactorAndVertexLight.x = ComputeFogFactor(vertexInput.positionCS.z); + #endif + #ifdef _ADDITIONAL_LIGHTS_VERTEX + half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS ); + output.fogFactorAndVertexLight.yzw = vertexLight; + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + output.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + output.positionCS = vertexInput.positionCS; + output.clipPosV = vertexInput.positionCS; + output.positionWS = vertexInput.positionWS; + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag ( PackedVaryings input + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + /*ase_local_var:wp*/float3 WorldPosition = input.positionWS; + /*ase_local_var:wvd*/float3 WorldViewDirection = GetWorldSpaceNormalizeViewDir( WorldPosition ); + /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 ); + /*ase_local_var:sp*/float4 ClipPos = input.clipPosV; + /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV ); + + float2 NormalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + WorldViewDirection = SafeNormalize( WorldViewDirection ); + + /*ase_frag_code:input=PackedVaryings*/ + float3 BakedAlbedo = /*ase_frag_out:Baked Albedo;Float3;0;-1;_Albedo*/0/*end*/; + float3 BakedEmission = /*ase_frag_out:Baked Emission;Float3;1;-1;_Emission*/0/*end*/; + float3 Color = /*ase_frag_out:Color;Float3;2;-1;_Color*/float3(0.5, 0.5, 0.5)/*end*/; + float Alpha = /*ase_frag_out:Alpha;Float;3;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;4;-1;_AlphaClip*/0.5/*end*/; + float AlphaClipThresholdShadow = /*ase_frag_out:Alpha Clip Threshold Shadow;Float;7;-1;_AlphaClipShadow*/0.5/*end*/; + + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/input.positionCS.z/*end*/; + #endif + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + InputData inputData = (InputData)0; + inputData.positionWS = WorldPosition; + inputData.viewDirectionWS = WorldViewDirection; + + #ifdef ASE_FOG + inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactorAndVertexLight.x); + #endif + #ifdef _ADDITIONAL_LIGHTS_VERTEX + inputData.vertexLighting = input.fogFactorAndVertexLight.yzw; + #endif + + inputData.normalizedScreenSpaceUV = NormalizedScreenSpaceUV; + + #if defined(_DBUFFER) + ApplyDecalToBaseColor(input.positionCS, Color); + #endif + + #ifdef ASE_FOG + #ifdef TERRAIN_SPLAT_ADDPASS + Color.rgb = MixFogColor(Color.rgb, half3(0,0,0), inputData.fogCoord); + #else + Color.rgb = MixFog(Color.rgb, inputData.fogCoord); + #endif + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4( EncodeMeshRenderingLayer( renderingLayers ), 0, 0, 0 ); + #endif + + return half4( Color, Alpha ); + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + ZWrite On + ZTest LEqual + AlphaToMask Off + ColorMask 0 + + HLSLPROGRAM + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_SHADOWCASTER + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) + #define ASE_SV_DEPTH SV_DepthLessEqual + #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid + #else + #define ASE_SV_DEPTH SV_Depth + #define ASE_SV_POSITION_QUALIFIERS + #endif + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; + float4 clipPosV : TEXCOORD0; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 positionWS : TEXCOORD1; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD2; + #endif + /*ase_interp(3,):sp=sp;wp=tc1;sc=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + float3 _LightDirection; + float3 _LightPosition; + + PackedVaryings VertexFunction( Attributes input/*ase_vert_input*/ ) + { + PackedVaryings output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( output ); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/; + + float3 positionWS = TransformObjectToWorld( input.positionOS.xyz ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + output.positionWS = positionWS; + #endif + + float3 normalWS = TransformObjectToWorldDir(input.normalOS); + + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - positionWS); + #else + float3 lightDirectionWS = _LightDirection; + #endif + + float4 positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS)); + + //code for UNITY_REVERSED_Z is moved into Shadows.hlsl from 6000.0.22 and or higher + positionCS = ApplyShadowClamping(positionCS); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + output.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + output.positionCS = positionCS; + output.clipPosV = positionCS; + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag(PackedVaryings input + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( input ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + /*ase_local_var:wp*/float3 WorldPosition = input.positionWS; + #endif + + /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 ); + /*ase_local_var:sp*/float4 ClipPos = input.clipPosV; + /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + /*ase_frag_code:input=PackedVaryings*/ + + float Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + float AlphaClipThresholdShadow = /*ase_frag_out:Alpha Clip Threshold Shadow;Float;4;-1;_AlphaClipShadow*/0.5/*end*/; + + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/input.positionCS.z/*end*/; + #endif + + #ifdef _ALPHATEST_ON + #ifdef _ALPHATEST_SHADOW_ON + clip(Alpha - AlphaClipThresholdShadow); + #else + clip(Alpha - AlphaClipThreshold); + #endif + #endif + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return 0; + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "DepthOnly" + Tags + { + "LightMode" = "DepthOnly" + } + + ZWrite On + ColorMask 0 + AlphaToMask Off + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) + #define ASE_SV_DEPTH SV_DepthLessEqual + #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid + #else + #define ASE_SV_DEPTH SV_Depth + #define ASE_SV_POSITION_QUALIFIERS + #endif + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; + float4 clipPosV : TEXCOORD0; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 positionWS : TEXCOORD1; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD2; + #endif + /*ase_interp(3,):sp=sp;wp=tc1;sc=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output = (PackedVaryings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + output.positionWS = vertexInput.positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + output.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + output.positionCS = vertexInput.positionCS; + output.clipPosV = vertexInput.positionCS; + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag(PackedVaryings input + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + /*ase_local_var:wp*/float3 WorldPosition = input.positionWS; + #endif + + /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 ); + /*ase_local_var:sp*/float4 ClipPos = input.clipPosV; + /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + /*ase_frag_code:input=PackedVaryings*/ + + float Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/input.positionCS.z/*end*/; + #endif + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + return 0; + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "Meta" + Tags + { + "LightMode" = "Meta" + } + + Cull Off + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + + /*ase_pragma*/ + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vdata:p=p;n=n;uv1=tc1;uv2=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 positionWS : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + /*ase_interp(2,):sp=sp;wp=tc0;sc=tc1*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output = (PackedVaryings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;4;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;5;-1;_Normal*/input.normalOS/*end*/; + + float3 positionWS = TransformObjectToWorld( input.positionOS.xyz ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + output.positionWS = positionWS; + #endif + + output.positionCS = MetaVertexPosition( input.positionOS, input.texcoord1.xy, input.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST ); + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = output.positionCS; + output.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z; + output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag(PackedVaryings input /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + /*ase_local_var:wp*/float3 WorldPosition = input.positionWS; + #endif + + /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + /*ase_frag_code:input=PackedVaryings*/ + + float3 BakedAlbedo = /*ase_frag_out:Baked Albedo;Float3;0;-1;_Albedo*/0/*end*/; + float3 BakedEmission = /*ase_frag_out:Baked Emission;Float3;1;-1;_Emission*/0/*end*/; + float Alpha = /*ase_frag_out:Alpha;Float;2;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;3;-1;_AlphaClip*/0.5/*end*/; + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = BakedAlbedo; + metaInput.Emission = BakedEmission; + + return MetaFragment(metaInput); + } + ENDHLSL + } + + /*ase_pass*/ + Pass // -- DEPRECATED -- + { + /*ase_hide_pass:SyncP*/ + Name "Universal2D" + Tags + { + "LightMode" = "Universal2D" + } + + Blend One Zero + ZWrite On + ZTest LEqual + Offset 0,0 + ColorMask RGBA + + /*ase_stencil*/ + + HLSLPROGRAM + + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + #pragma multi_compile _ DEBUG_DISPLAY + + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_UNLIT + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging3D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceData.hlsl" + + /*ase_pragma*/ + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + float3 positionWS : TEXCOORD0; + #endif + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + float4 shadowCoord : TEXCOORD1; + #endif + #ifdef ASE_FOG + float fogFactor : TEXCOORD2; + #endif + /*ase_interp(3,):sp=sp;wp=tc0;sc=tc1*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + /*ase_globals*/ + + /*ase_funcs*/ + + PackedVaryings vert( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output = (PackedVaryings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;5;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;6;-1;_Normal*/input.normalOS/*end*/; + + float3 positionWS = TransformObjectToWorld( input.positionOS.xyz ); + float4 positionCS = TransformWorldToHClip( positionWS ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + output.positionWS = positionWS; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + VertexPositionInputs vertexInput = (VertexPositionInputs)0; + vertexInput.positionWS = positionWS; + vertexInput.positionCS = positionCS; + output.shadowCoord = GetShadowCoord( vertexInput ); + #endif + + #ifdef ASE_FOG + output.fogFactor = ComputeFogFactor( positionCS.z ); + + #endif + + output.positionCS = positionCS; + + return output; + } + + half4 frag ( PackedVaryings input /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID( input ); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); + + #if defined(ASE_NEEDS_FRAG_WORLD_POSITION) + /*ase_local_var:wp*/float3 WorldPosition = input.positionWS; + #endif + + /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 ); + + #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS) + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + ShadowCoords = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + ShadowCoords = TransformWorldToShadowCoord( WorldPosition ); + #endif + #endif + + /*ase_frag_code:input=PackedVaryings*/ + + float3 BakedAlbedo = /*ase_frag_out:Baked Albedo;Float3;0;-1;_Albedo*/0/*end*/; + float3 BakedEmission = /*ase_frag_out:Baked Emission;Float3;1;-1;_Emission*/0/*end*/; + float3 Color = /*ase_frag_out:Color;Float3;2;-1;_Color*/float3( 0.5, 0.5, 0.5 )/*end*/; + float Alpha = /*ase_frag_out:Alpha;Float;3;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;4;-1;_AlphaClip*/0.5/*end*/; + float AlphaClipThresholdShadow = /*ase_frag_out:Alpha Clip Threshold Shadow;Float;7;-1;_AlphaClipShadow*/0.5/*end*/; + + #ifdef _ALPHATEST_ON + clip( Alpha - AlphaClipThreshold ); + #endif + + #if defined(_DBUFFER) + ApplyDecalToBaseColor(input.positionCS, Color); + #endif + + #ifdef ASE_FOG + Color = MixFog( Color, input.fogFactor ); + #endif + + return half4( Color, Alpha ); + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "SceneSelectionPass" + Tags + { + "LightMode" = "SceneSelectionPass" + } + + Cull Off + AlphaToMask Off + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS SHADERPASS_DEPTHONLY + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + /*ase_pragma*/ + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + /*ase_interp(0,):sp=sp*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + int _ObjectId; + int _PassValue; + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + PackedVaryings VertexFunction(Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output; + ZERO_INITIALIZE(PackedVaryings, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/; + + float3 positionWS = TransformObjectToWorld( input.positionOS.xyz ); + + output.positionCS = TransformWorldToHClip(positionWS); + + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag(PackedVaryings input /*ase_frag_input*/) : SV_Target + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + /*ase_frag_code:input=PackedVaryings*/ + + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + surfaceDescription.AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0); + return outColor; + } + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + AlphaToMask Off + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + + #define SHADERPASS SHADERPASS_DEPTHONLY + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + /*ase_interp(0,):sp=sp*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + float4 _SelectionID; + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + PackedVaryings VertexFunction(Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output; + ZERO_INITIALIZE(PackedVaryings, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/; + + float3 positionWS = TransformObjectToWorld( input.positionOS.xyz ); + output.positionCS = TransformWorldToHClip(positionWS); + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag(PackedVaryings input /*ase_frag_input*/) : SV_Target + { + SurfaceDescription surfaceDescription = (SurfaceDescription)0; + + /*ase_frag_code:input=PackedVaryings*/ + + surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + surfaceDescription.AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + + #if _ALPHATEST_ON + float alphaClipThreshold = 0.01f; + #if ALPHA_CLIP_THRESHOLD + alphaClipThreshold = surfaceDescription.AlphaClipThreshold; + #endif + clip(surfaceDescription.Alpha - alphaClipThreshold); + #endif + + half4 outColor = 0; + outColor = _SelectionID; + + return outColor; + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "DepthNormals" + Tags + { + "LightMode" = "DepthNormalsOnly" + } + + ZTest LEqual + ZWrite On + + HLSLPROGRAM + + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define VARYINGS_NEED_NORMAL_WS + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45) + #define ASE_SV_DEPTH SV_DepthLessEqual + #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid + #else + #define ASE_SV_DEPTH SV_Depth + #define ASE_SV_POSITION_QUALIFIERS + #endif + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION; + float4 clipPosV : TEXCOORD0; + float3 positionWS : TEXCOORD1; + float3 normalWS : TEXCOORD2; + /*ase_interp(3,):sp=sp;wp=tc1;wn=tc2*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + /*ase_globals*/ + + /*ase_funcs*/ + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output; + ZERO_INITIALIZE(PackedVaryings, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); + + output.positionCS = vertexInput.positionCS; + output.clipPosV = vertexInput.positionCS; + output.positionWS = vertexInput.positionWS; + output.normalWS = TransformObjectToWorldNormal( input.normalOS ); + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + void frag(PackedVaryings input + , out half4 outNormalWS : SV_Target0 + #ifdef ASE_DEPTH_WRITE_ON + ,out float outputDepth : ASE_SV_DEPTH + #endif + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + /*ase_frag_input*/ ) + { + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); + /*ase_local_var:wp*/float3 WorldPosition = input.positionWS; + /*ase_local_var:wn*/float3 WorldNormal = input.normalWS; + /*ase_local_var:sp*/float4 ClipPos = input.clipPosV; + /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV ); + + /*ase_frag_code:input=PackedVaryings*/ + + float Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + + #ifdef ASE_DEPTH_WRITE_ON + float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/input.positionCS.z/*end*/; + #endif + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade( input.positionCS ); + #endif + + #ifdef ASE_DEPTH_WRITE_ON + outputDepth = DepthValue; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float3 normalWS = normalize(input.normalWS); + float2 octNormalWS = PackNormalOctQuadEncode(normalWS); + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); + outNormalWS = half4(packedNormalWS, 0.0); + #else + float3 normalWS = input.normalWS; + outNormalWS = half4(NormalizeNormalPerPixel(normalWS), 0.0); + #endif + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + } + ENDHLSL + } + + /*ase_pass*/ + Pass // -- DEPRECATED -- + { + /*ase_hide_pass*/ + Name "DepthNormalsOnly" + Tags + { + "LightMode" = "DepthNormalsOnly" + } + + ZTest LEqual + ZWrite On + + HLSLPROGRAM + #pragma exclude_renderers gles gles3 glcore + + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + + #pragma vertex vert + #pragma fragment frag + + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define ATTRIBUTES_NEED_TEXCOORD1 + #define VARYINGS_NEED_NORMAL_WS + #define VARYINGS_NEED_TANGENT_WS + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + /*ase_pragma*/ + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + /*ase_vdata:p=p;n=n*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float4 clipPosV : TEXCOORD0; + float3 normalWS : TEXCOORD1; + /*ase_interp(2,):sp=sp;wn=tc0*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + /*ase_globals*/ + + /*ase_funcs*/ + + struct SurfaceDescription + { + float Alpha; + float AlphaClipThreshold; + }; + + PackedVaryings VertexFunction(Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output; + ZERO_INITIALIZE(PackedVaryings, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/; + + VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); + + output.positionCS = vertexInput.positionCS; + output.clipPosV = vertexInput.positionCS; + output.normalWS = TransformObjectToWorldNormal( input.normalOS ); + return output; + } + + #if defined(ASE_TESSELLATION) + struct VertexControl + { + float4 positionOS : INTERNALTESSPOS; + float3 normalOS : NORMAL; + /*ase_vcontrol*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessellationFactors + { + float edge[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; + }; + + VertexControl vert ( Attributes input ) + { + VertexControl output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + output.positionOS = input.positionOS; + output.normalOS = input.normalOS; + /*ase_control_code:input=Attributes;output=VertexControl*/ + return output; + } + + TessellationFactors TessellationFunction (InputPatch input) + { + TessellationFactors output; + float4 tf = 1; + float tessValue = /*ase_inline_begin*/_TessValue/*ase_inline_end*/; float tessMin = /*ase_inline_begin*/_TessMin/*ase_inline_end*/; float tessMax = /*ase_inline_begin*/_TessMax/*ase_inline_end*/; + float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/; + #if defined(ASE_FIXED_TESSELLATION) + tf = FixedTess( tessValue ); + #elif defined(ASE_DISTANCE_TESSELLATION) + tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos ); + #elif defined(ASE_LENGTH_TESSELLATION) + tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams ); + #elif defined(ASE_LENGTH_CULL_TESSELLATION) + tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes ); + #endif + output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w; + return output; + } + + [domain("tri")] + [partitioning("fractional_odd")] + [outputtopology("triangle_cw")] + [patchconstantfunc("TessellationFunction")] + [outputcontrolpoints(3)] + VertexControl HullFunction(InputPatch patch, uint id : SV_OutputControlPointID) + { + return patch[id]; + } + + [domain("tri")] + PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch patch, float3 bary : SV_DomainLocation) + { + Attributes output = (Attributes) 0; + output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z; + output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z; + /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/ + #if defined(ASE_PHONG_TESSELLATION) + float3 pp[3]; + for (int i = 0; i < 3; ++i) + pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS)); + float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/; + output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz; + #endif + UNITY_TRANSFER_INSTANCE_ID(patch[0], output); + return VertexFunction(output); + } + #else + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + #endif + + half4 frag(PackedVaryings input /*ase_frag_input*/) : SV_Target + { + /*ase_local_var:sp*/float4 ClipPos = input.clipPosV; + /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV ); + + /*ase_frag_code:input=PackedVaryings*/ + + float Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + + #if _ALPHATEST_ON + clip( Alpha - AlphaClipThreshold ); + #endif + + return half4( NormalizeNormalPerPixel( input.normalWS ), 0.0 ); + } + + ENDHLSL + } + + /*ase_pass*/ + Pass + { + /*ase_hide_pass*/ + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + ColorMask RG + + HLSLPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #if defined(LOD_FADE_CROSSFADE) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MotionVectorsCommon.hlsl" + + /*ase_pragma*/ + + struct Attributes + { + float4 positionOS : POSITION; + float3 positionOld : TEXCOORD4; + #if _ADD_PRECOMPUTED_VELOCITY + float3 alembicMotionVector : TEXCOORD5; + #endif + /*ase_vdata:p=p;uv4=tc4;uv5=tc5*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct PackedVaryings + { + float4 positionCS : SV_POSITION; + float4 positionCSNoJitter : TEXCOORD0; + float4 previousPositionCSNoJitter : TEXCOORD1; + /*ase_interp(2,):sp=sp.xyzw*/ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + CBUFFER_START(UnityPerMaterial) + #ifdef ASE_TRANSMISSION + float _TransmissionShadow; + #endif + #ifdef ASE_TRANSLUCENCY + float _TransStrength; + float _TransNormal; + float _TransScattering; + float _TransDirect; + float _TransAmbient; + float _TransShadow; + #endif + #ifdef ASE_TESSELLATION + float _TessPhongStrength; + float _TessValue; + float _TessMin; + float _TessMax; + float _TessEdgeLength; + float _TessMaxDisp; + #endif + CBUFFER_END + + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + /*ase_globals*/ + + /*ase_funcs*/ + + PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ ) + { + PackedVaryings output = (PackedVaryings)0; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + /*ase_vert_code:input=Attributes;output=PackedVaryings*/ + + #ifdef ASE_ABSOLUTE_VERTEX_POS + float3 defaultVertexValue = input.positionOS.xyz; + #else + float3 defaultVertexValue = float3(0, 0, 0); + #endif + + float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/; + + #ifdef ASE_ABSOLUTE_VERTEX_POS + input.positionOS.xyz = vertexValue; + #else + input.positionOS.xyz += vertexValue; + #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz ); + + // Jittered. Match the frame. + output.positionCS = vertexInput.positionCS; + output.positionCSNoJitter = mul( _NonJitteredViewProjMatrix, mul( UNITY_MATRIX_M, input.positionOS ) ); + + float4 prevPos = ( unity_MotionVectorsParams.x == 1 ) ? float4( input.positionOld, 1 ) : input.positionOS; + + #if _ADD_PRECOMPUTED_VELOCITY + prevPos = prevPos - float4(input.alembicMotionVector, 0); + #endif + + output.previousPositionCSNoJitter = mul( _PrevViewProjMatrix, mul( UNITY_PREV_MATRIX_M, prevPos ) ); + + return output; + } + + PackedVaryings vert ( Attributes input ) + { + return VertexFunction( input ); + } + + half4 frag( PackedVaryings input /*ase_frag_input*/ ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input ); + + /*ase_frag_code:input=PackedVaryings*/ + + float Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/; + float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/; + + #ifdef _ALPHATEST_ON + clip(Alpha - AlphaClipThreshold); + #endif + + #ifdef LOD_FADE_CROSSFADE + LODFadeCrossFade( input.positionCS ); + #endif + + return float4( CalcNdcMotionVectorFromCsPositions( input.positionCSNoJitter, input.previousPositionCSNoJitter ), 0, 0 ); + } + ENDHLSL + } + /*ase_pass_end*/ + } + /*ase_lod*/ + CustomEditor "UnityEditor.ShaderGraphUnlitGUI" + FallBack "Hidden/Shader Graph/FallbackError" +} diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Unlit.shader.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Unlit.shader.meta new file mode 100644 index 00000000..588b7733 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/Unlit.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2992e84f91cbeb14eab234972e07ea9d +timeCreated: 1568647145 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures.meta new file mode 100644 index 00000000..f2b28c6b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c7eb84ba37e424945bd8c7221dc5b55a +folderAsset: yes +timeCreated: 1481126944 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png new file mode 100644 index 00000000..447f9a5e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9dd54be297046b50bb238ed0fa59fbd58f71ae23ee8a1a5d6e83e78bd97dd60b +size 57164 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png.meta new file mode 100644 index 00000000..db785cb9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 8aba6bb20faf8824d9d81946542f1ce1 +timeCreated: 1481127003 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png new file mode 100644 index 00000000..9d7f33f2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:599586b1686a4520e4b8fac59eef86f8bd3eac544c971acce32e2357f8322c9d +size 46810 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png.meta new file mode 100644 index 00000000..69e5f8bd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png.meta @@ -0,0 +1,89 @@ +fileFormatVersion: 2 +guid: 2c6536772776dd84f872779990273bfc +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 64 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 64 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: WebGL + maxTextureSize: 64 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png new file mode 100644 index 00000000..f8e2cdf8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5636b65aae790abad959b5b32b77abfff744b2d1a1b3a6b80fa3308e9b4f84f8 +size 150 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png.meta new file mode 100644 index 00000000..6248eda8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png.meta @@ -0,0 +1,66 @@ +fileFormatVersion: 2 +guid: 7a170cdb7cc88024cb628cfcdbb6705c +timeCreated: 1481126998 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png new file mode 100644 index 00000000..25af10bd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e54274e342602f43cf758aae8ec3f93cbdfc07282dc02f2c90ceafecae773a2 +size 158 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png.meta new file mode 100644 index 00000000..9f996993 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png.meta @@ -0,0 +1,66 @@ +fileFormatVersion: 2 +guid: 826f80ee0ad07444c8558af826a4df2e +timeCreated: 1481127000 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png new file mode 100644 index 00000000..0b706c4f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e62b1b55c526f70c6560971568e92bc16f934fa0a2d85a9aac790c28fc90de0 +size 158 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png.meta new file mode 100644 index 00000000..bc986feb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png.meta @@ -0,0 +1,66 @@ +fileFormatVersion: 2 +guid: 194a51ad3c0179644abea3f196c5ebe6 +timeCreated: 1481126977 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png new file mode 100644 index 00000000..975c2614 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4657be3ec6175e8c80b4b4fd0522ed74150ca3f43bdad629e295168a1daefee4 +size 156 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png.meta new file mode 100644 index 00000000..04832055 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png.meta @@ -0,0 +1,66 @@ +fileFormatVersion: 2 +guid: 352167e52fa3b0c43ac690f5e2debc2b +timeCreated: 1481126984 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png new file mode 100644 index 00000000..9f71f2d7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32105fd0fb726fb06bf2c210fdf84f3c03af99cf3a66b1c3668e076a0101b49a +size 158 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png.meta new file mode 100644 index 00000000..d203a67e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png.meta @@ -0,0 +1,66 @@ +fileFormatVersion: 2 +guid: 31d5a2d79390ab542a81a6699a999758 +timeCreated: 1481126984 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png new file mode 100644 index 00000000..d98d7254 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e664c93a83ab6e1d50d3ba44bf39909ae837e2af0a328bf7514559d7df236b0b +size 154 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png.meta new file mode 100644 index 00000000..d3784683 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png.meta @@ -0,0 +1,66 @@ +fileFormatVersion: 2 +guid: af5ab63a69b074347be0e4c17fb9dc1b +timeCreated: 1481127009 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png new file mode 100644 index 00000000..6509a978 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbf2f6a3ad6998af0a771ebaa24202683244d15eb9712e21267fc79d2c398d79 +size 158 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png.meta new file mode 100644 index 00000000..0dc129a4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png.meta @@ -0,0 +1,66 @@ +fileFormatVersion: 2 +guid: 37e6f91f3efb0954cbdce254638862ea +timeCreated: 1481126984 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI.meta new file mode 100644 index 00000000..a5bdca46 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b4971ff9c9d7bfd488d84e355318f683 +folderAsset: yes +timeCreated: 1481126944 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons.meta new file mode 100644 index 00000000..2652961c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f0f8f4a0c1ef2d14d975ace997712605 +folderAsset: yes +timeCreated: 1481126946 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png new file mode 100644 index 00000000..4ab9a96e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4f73a3c7c76d11a413ff985208afa40b2bb88e294ed0b75b96a71a680520dda +size 18832 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png.meta new file mode 100644 index 00000000..eabac2a3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: cccc116a6334dc1428687697c5a11d58 +timeCreated: 1481127016 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png new file mode 100644 index 00000000..e8d9faba --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc85c0112c82debe80653703eda4ffb5b2c3d2fff50f49622adb7fcd8e6e7245 +size 461 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png.meta new file mode 100644 index 00000000..9b6cba75 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: e9c4642eaa083a54ab91406d8449e6ac +timeCreated: 1506956323 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: 5 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png new file mode 100644 index 00000000..7536c98c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:39a1d3c071fbbd1aca35c083817781aac4c46eb1d352e181cda7ca338d858530 +size 157 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png.meta new file mode 100644 index 00000000..1ed0a11f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 1aaca50d084b0bb43854f075ce2f302b +timeCreated: 1526466929 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png new file mode 100644 index 00000000..4c61d4a6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f2598186820f59d9a5fbd4bafd7f12c016fd37bacb4fbb99de1bdf5f028dfd97 +size 189 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png.meta new file mode 100644 index 00000000..7a4d8bf1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: ac0860a6a77e29d4091ba790a17daa0f +timeCreated: 1526466092 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png new file mode 100644 index 00000000..148156b4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c12a9c075a8af1b272933cde54f4af52c4e47cc27acfaf2962d9e9ef3b63d2e7 +size 24764 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png.meta new file mode 100644 index 00000000..0f940f0d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: f62c0c3a5ddcd844e905fb2632fdcb15 +timeCreated: 1481127028 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png new file mode 100644 index 00000000..25d40574 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:031cd7059ad838e9d18982bca20ef1d6bb87fb5f498aaabe768d404bde948b58 +size 19719 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png.meta new file mode 100644 index 00000000..1b8395dc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: df0f2e2030492c14d9237317aef419cd +timeCreated: 1481127018 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png new file mode 100644 index 00000000..115454fc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec4da17c673556bd85d2c3f86cf76d9a297994d6a0793fefb5bd2c8d568e12ec +size 24813 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png.meta new file mode 100644 index 00000000..28069152 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 615d853995cf2344d8641fd19cb09b5d +timeCreated: 1481126993 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png new file mode 100644 index 00000000..49b1a86d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af7a645de3c8a96a6b54d2b0a2921c123239f8f11303efd5864552da511df15c +size 19776 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png.meta new file mode 100644 index 00000000..08664023 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: e86ba70d2363b9443beac28a6a370b87 +timeCreated: 1481127021 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png new file mode 100644 index 00000000..aa3d0378 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a3469922a20c1d77e3256ae00f97694cc8fb42fb56a9f6bd02bba11725a7b04e +size 373 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png.meta new file mode 100644 index 00000000..5d08a06d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 52bbe770f45f531419e44a69be67ccba +timeCreated: 1498144034 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png new file mode 100644 index 00000000..aa7da369 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:99020addf9d76fc4b57bad42d2362fac0a988d8d04c513a855df186fde3d074e +size 363 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png.meta new file mode 100644 index 00000000..39413dc2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 7eb057fdbf020504fb6c9c3c78031e5e +timeCreated: 1498144034 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png new file mode 100644 index 00000000..5383d58b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fcef01968ffd750db2b1e9a6f1fff00b823c29ccbf361b452433cfd572c9374f +size 366 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png.meta new file mode 100644 index 00000000..6928f0c6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 1ba096552f9cbbb418ee2286856bb352 +timeCreated: 1498144034 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png new file mode 100644 index 00000000..4bc89723 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7043e0cbca3c34daafa992104b5bf6d5d5e0e6c7f49ff66e8f86c8fcac5e8255 +size 329 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png.meta new file mode 100644 index 00000000..e5a1607e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 839cb1530f95ad14ab58762161a9cb06 +timeCreated: 1498144034 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png new file mode 100644 index 00000000..01bf3be6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0c5c27247e83d3f1a4ee663739ad40651eca8f0fc53e307b9a1f6aa7aacf4e0 +size 19122 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png.meta new file mode 100644 index 00000000..193f7204 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 1def740f2314c6b4691529cadeee2e9c +timeCreated: 1481126978 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png new file mode 100644 index 00000000..5ae8f435 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:41e795288c99d3b66a05bfc1ca33c5e67512a8da3fd746b77b4d1b74c204310d +size 18938 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png.meta new file mode 100644 index 00000000..0b8609a2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: da673e6179c67d346abb220a6935e359 +timeCreated: 1481127018 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png new file mode 100644 index 00000000..5819bce0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec230740f53d0a3f447f87a1d5fca106d1229689afdeb7948550893ace2ccbb6 +size 23168 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png.meta new file mode 100644 index 00000000..9b61d57e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 066674048bbb1e64e8cdcc6c3b4abbeb +timeCreated: 1481126971 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png new file mode 100644 index 00000000..2e1bcecb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0480ab201a67fe65e2eda9aa5349b9415f398166ad3f9567852edbf176d77783 +size 21750 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png.meta new file mode 100644 index 00000000..295d32e7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 77af20044e9766840a6be568806dc22e +timeCreated: 1488470300 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png new file mode 100644 index 00000000..1aad78b8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:afb88ad7e22eeab8ac03201e297cfd250888da4cf402b8c0559245893e58476b +size 22515 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png.meta new file mode 100644 index 00000000..22bac510 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 8b6b4ff52c49a2a43a602895465e107c +timeCreated: 1481127003 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png new file mode 100644 index 00000000..2b6eec0a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd9a8a94c14e7ec155171447944c91d8f197ee423e3ebe0d46f6be454b420892 +size 22640 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png.meta new file mode 100644 index 00000000..2492354a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: f4d31aa109c919d4595094f627510932 +timeCreated: 1481127025 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png new file mode 100644 index 00000000..58ee689e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d34ab9888c8bf00a9e4245c5cc6cb3a341172c31c7e850cd7751470ac06f81df +size 21851 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png.meta new file mode 100644 index 00000000..422e7775 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 9a81d7df8e62c044a9d1cada0c8a2131 +timeCreated: 1481127004 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png new file mode 100644 index 00000000..b896c280 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ffec5e7956af33593136e5526bda9c9ac2a5cc6ed5ce7286a2442dba23f44d7 +size 22523 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png.meta new file mode 100644 index 00000000..df0275ef --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: bb16faf366bcc6c4fbf0d7666b105354 +timeCreated: 1481127011 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png new file mode 100644 index 00000000..12bdc139 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5159e47e109c4fa1aa66763fe0a07de5c86fbe359b28af3c322dfb6faf44a191 +size 22677 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png.meta new file mode 100644 index 00000000..f786696c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 6a0ae1d7892333142aeb09585572202c +timeCreated: 1481126996 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png new file mode 100644 index 00000000..eb419074 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dac4607e6c38eef140190e4991072d3f4c3691e92b2bb6256e9df32f9b226d12 +size 22735 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png.meta new file mode 100644 index 00000000..5a9ba27b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: e3182200efb67114eb5050f8955e1746 +timeCreated: 1481127019 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png new file mode 100644 index 00000000..bb98d3ac --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4269248ea5424a647dfdf455fe0a66e9f4ddc00d732345aee56f22d2f752c11f +size 202 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png.meta new file mode 100644 index 00000000..4f2b3629 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 7a1fd3f5fef75b64385591e1890d1842 +timeCreated: 1481126998 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png new file mode 100644 index 00000000..e8235382 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ac36c53d01155ebbd981a739a829face3ac51982d1b5fc16473703e1c32348b +size 267 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png.meta new file mode 100644 index 00000000..b6113b55 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png.meta @@ -0,0 +1,70 @@ +fileFormatVersion: 2 +guid: 9f2d5e61dd9821b44a410f36519781d7 +timeCreated: 1489663385 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png new file mode 100644 index 00000000..3795d1c3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2797295de90b97ddced553ba7467179ba080ef73d7902c54dd647d248d7ef6ed +size 268 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png.meta new file mode 100644 index 00000000..65c6d77e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png.meta @@ -0,0 +1,70 @@ +fileFormatVersion: 2 +guid: 6f3901bfd2342774ba74e117e43d6db7 +timeCreated: 1489663938 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png new file mode 100644 index 00000000..ff451528 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:360832a2fad412dd858ea80b41f1bb223375e72a4abdeda694af999695741b80 +size 267 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png.meta new file mode 100644 index 00000000..2d304d33 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png.meta @@ -0,0 +1,70 @@ +fileFormatVersion: 2 +guid: 4c872bb553406fe44a9d0046a0ef9bc5 +timeCreated: 1489662998 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png new file mode 100644 index 00000000..e59fcfb2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d25954be58311c4a98e85ab091a2132cb677583e72218db396545e528c5ccc55 +size 259 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png.meta new file mode 100644 index 00000000..52541ccb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png.meta @@ -0,0 +1,70 @@ +fileFormatVersion: 2 +guid: 7ef06ce40d713d34790e78278ee82dea +timeCreated: 1489663938 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png new file mode 100644 index 00000000..ab95c9d2 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbd9ad20ba669f5c110b4d900af953023120983ea57f46e09879467fb73a93c6 +size 230 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png.meta new file mode 100644 index 00000000..acf689c7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png.meta @@ -0,0 +1,70 @@ +fileFormatVersion: 2 +guid: eaf512a569994074b9b268ff098b0f03 +timeCreated: 1489663385 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png new file mode 100644 index 00000000..41a02383 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50369b1f4355351c9675e9544b1bd95d15531f0de6f584f4ee35005325d9b1c9 +size 236 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png.meta new file mode 100644 index 00000000..6eedf7cb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png.meta @@ -0,0 +1,70 @@ +fileFormatVersion: 2 +guid: c86cb249299fb7249b5ee7fb27ef1951 +timeCreated: 1489663938 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png new file mode 100644 index 00000000..0b57c17e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8864a09e7be9447249a6490651a38725ec747b3041004f879e43a0e9b949295c +size 227 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png.meta new file mode 100644 index 00000000..cba16fc7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png.meta @@ -0,0 +1,70 @@ +fileFormatVersion: 2 +guid: 133e79bed45185d408f4c5410f89dded +timeCreated: 1489662998 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png new file mode 100644 index 00000000..23e6cb67 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55306c2e0b51a5ff2d3d47ee35c0f7bf7c79c0c27060f38630a9572696bff4b3 +size 222 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png.meta new file mode 100644 index 00000000..1148292a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png.meta @@ -0,0 +1,70 @@ +fileFormatVersion: 2 +guid: 542d7546736ddd244a145ef7103678fb +timeCreated: 1489663938 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png new file mode 100644 index 00000000..932ab3c4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f2dfc92f07e77c1b860dba03398ae848bdb794ab73e76053f64f053275347463 +size 269 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png.meta new file mode 100644 index 00000000..c210dc64 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png.meta @@ -0,0 +1,70 @@ +fileFormatVersion: 2 +guid: bfcecef29876cc54db85363cf2feebb2 +timeCreated: 1489663385 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png new file mode 100644 index 00000000..bd2aa59a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75aae057819a8e59a6483f28639f81360ccf74587324cef77410f31b75e87715 +size 283 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png.meta new file mode 100644 index 00000000..d7a5ca03 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png.meta @@ -0,0 +1,70 @@ +fileFormatVersion: 2 +guid: df6fb8448a382c743bd124cc0da55113 +timeCreated: 1489663604 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png new file mode 100644 index 00000000..d69c6871 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9852122d870b8a1b81942cb1ee6a4bfbeb62e4df43da2c030adee9957e39ee22 +size 260 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png.meta new file mode 100644 index 00000000..c42e546b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png.meta @@ -0,0 +1,70 @@ +fileFormatVersion: 2 +guid: 3821e905373e9fb4aac56ad254ba5769 +timeCreated: 1489662832 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png new file mode 100644 index 00000000..7c7d96c7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30d41423565f98a45926f6c7e4ba88aea2745c628c6829a39b8bad3d379d7109 +size 260 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png.meta new file mode 100644 index 00000000..e75b5d87 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png.meta @@ -0,0 +1,70 @@ +fileFormatVersion: 2 +guid: d3098ebd60a35494e9977bd96b923298 +timeCreated: 1489663938 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png new file mode 100644 index 00000000..fee153f3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d6023808714ab18143b6e80f2a6aac45bf283e8dc279e6da6466aea2b93f45a +size 204 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png.meta new file mode 100644 index 00000000..673396c0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 2aae9a02747d74d46bf98a15ac5c9b21 +timeCreated: 1481126984 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png new file mode 100644 index 00000000..801b13b1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:393e53679144526ac652ed8448eb720fe320d6816a2f13f6d2bc18a63cf64310 +size 21763 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png.meta new file mode 100644 index 00000000..10adce01 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 1bd93c39ca74ac041b79ae289e9b9f08 +timeCreated: 1481126977 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png new file mode 100644 index 00000000..52a782b4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8849f133787731a258f217e6b9c241c98cb60be9ffff6c437f914adeb43fabc6 +size 22139 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png.meta new file mode 100644 index 00000000..47bd9707 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: d8b538796c7980843b59d62dbcdebef5 +timeCreated: 1481127018 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png new file mode 100644 index 00000000..4773ab23 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4bffb75396d7ef80578ce9a8b037629bf66c312bf3a8bab28d0168a5eb5dc2d +size 18999 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png.meta new file mode 100644 index 00000000..2a37507a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: a66917730dccde947a01140dc04b9e59 +timeCreated: 1481127005 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG new file mode 100644 index 00000000..1f21bc11 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7446c72ff21fd34465713d4b18bbb4101514dbe95d00d1bd14e5715922bb6885 +size 29269 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG.meta new file mode 100644 index 00000000..f3fa73b6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: f7e8834b42791124095a8b7f2d4daac2 +timeCreated: 1481127028 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG new file mode 100644 index 00000000..3ece0aaf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2fad198bda24ff0e827651e8f0681505d502f020ed967fe672affedbd1abe98c +size 29267 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG.meta new file mode 100644 index 00000000..956482b8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 8b114792ff84f6546880c031eda42bc0 +timeCreated: 1481127003 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png new file mode 100644 index 00000000..e4e10aa8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a66d03840061b8aab0a5701448d1ac52940b7aeb404f4d80172b6dcb76aa9cc +size 22418 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png.meta new file mode 100644 index 00000000..b9e6a2f5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 36aa64354f0ba4844af761a937eea4df +timeCreated: 1481126984 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png new file mode 100644 index 00000000..772bc927 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac5442e2def74da089b6fc26c05f48e4c20ec17fbcb2ca50610bf1456ba1d982 +size 18698 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png.meta new file mode 100644 index 00000000..bc0af2ea --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 75f68506ba820564ea85b2620d78c097 +timeCreated: 1481126998 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png new file mode 100644 index 00000000..d4217522 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3879b511fb823dc46b0eac6918bba601a92359ced9b0b30f0a4b50537b036a7 +size 267 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png.meta new file mode 100644 index 00000000..c19d1b20 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: a51794475a883744db8d524cee84e5fc +timeCreated: 1481127005 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png new file mode 100644 index 00000000..b015479f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aedd43a7140a00bacc3f2c7ab18c7dd06b8966adf79d4481b7a4ed7072605576 +size 21808 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png.meta new file mode 100644 index 00000000..12e7dbbc --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 4e4a13447ac514c4ca21e7232bac5486 +timeCreated: 1481126990 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png new file mode 100644 index 00000000..cea9fef4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:803e530eccf3fd886f42193a49cc0dd5bcb9b4e2b15c35ed1ac936078d07fe90 +size 21907 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png.meta new file mode 100644 index 00000000..fd7002b3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 2c938a89586d41f4081284e4b25243c2 +timeCreated: 1481126984 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png new file mode 100644 index 00000000..475a695e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:787c400b5eda31a37dd340c4547bd98279d849c276a72f20f500d3ab57502691 +size 19030 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png.meta new file mode 100644 index 00000000..32cce002 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 8148796947da07d49906f1201f417a60 +timeCreated: 1481127000 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png new file mode 100644 index 00000000..4057c27d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbba0de35d1b6c50ada2e9e37b92a5c2b86afc89e2d5e8d375cb37ce1fe07131 +size 25602 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png.meta new file mode 100644 index 00000000..a7b9a34e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: ce7d95fa4e635f943a73ce1b19312cc5 +timeCreated: 1481127016 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png new file mode 100644 index 00000000..c51eb48f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:024fa6ca29273524bf16fa139ebaeee1c593f88967519b4d159976f9f1bf65f3 +size 25380 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png.meta new file mode 100644 index 00000000..9e67eb8c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: e737e4bfd0859a946b0c5feddb61d29f +timeCreated: 1481127019 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png new file mode 100644 index 00000000..53ad0573 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e008994e9c40a9e187fcecca6ed12c712464c3545f1cd4102d5578d3884c0257 +size 17818 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png.meta new file mode 100644 index 00000000..1adf7510 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: bc5bd469748466a459badfab23915cb0 +timeCreated: 1560784373 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png new file mode 100644 index 00000000..ac977956 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:214bcf8b6721511d935ec8652cbc1fc685525a4ab112fe2bf86f7e4513c40338 +size 232 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png.meta new file mode 100644 index 00000000..473bf129 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 4cabb2d6785b8aa4db0c0a34e1e00f04 +timeCreated: 1481126990 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png new file mode 100644 index 00000000..8b59209a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2048e8a26bfc04eb24c64180b6d605b7d3cdb960fbaf0f598d895d7835015249 +size 18141 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png.meta new file mode 100644 index 00000000..64465879 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 7587de2e3bec8bf4d973109524ccc6b1 +timeCreated: 1560359851 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png new file mode 100644 index 00000000..cbcccee3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f309b7c03d9cae63a9bedbee6ed655f3dbcdb194132943639344dead5f3b9710 +size 68 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/hbao.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png.meta similarity index 69% rename from Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/hbao.png.meta rename to Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png.meta index 4fbf7997..be2446b3 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/hbao.png.meta +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 363f071b5e3670a43ba62ba5322fc4d6 -timeCreated: 1463304735 +guid: 1004d06b4b28f5943abdf2313a22790a +timeCreated: 1496682298 licenseType: Store TextureImporter: fileIDToRecycleName: {} @@ -17,13 +17,13 @@ TextureImporter: bumpmap: convertToNormalMap: 0 externalNormalMap: 0 - heightScale: .25 + heightScale: 0.25 normalMapFilter: 0 isReadable: 0 grayScaleToAlpha: 0 generateCubemap: 0 cubemapConvolution: 0 - cubemapConvolutionSteps: 8 + cubemapConvolutionSteps: 7 cubemapConvolutionExponent: 1.5 seamlessCubemap: 0 textureFormat: -1 @@ -41,15 +41,25 @@ TextureImporter: spriteExtrude: 1 spriteMeshType: 1 alignment: 0 - spritePivot: {x: .5, y: .5} + spritePivot: {x: 0.5, y: 0.5} spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 alphaIsTransparency: 1 + spriteTessellationDetail: -1 textureType: 2 buildTargetSettings: [] spriteSheet: + serializedVersion: 2 sprites: [] + outline: [] spritePackingTag: userData: assetBundleName: assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png new file mode 100644 index 00000000..82963dfe --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b86fb94f601904b047b64af3fd71c7465b893f7c57b0db159a27c6c17de6553 +size 23051 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png.meta new file mode 100644 index 00000000..2d292914 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 99d70ac09b4db9742b404c3f92d8564b +timeCreated: 1481127004 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png new file mode 100644 index 00000000..93615fc5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fec3e5408717bfc074a2ef8f7c1a40c771c969d16bd7f3b3dd06f8eeca1c5fbe +size 23131 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png.meta new file mode 100644 index 00000000..76f790b3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: cce638be049286c41bcbd0a26c356b18 +timeCreated: 1481127016 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png new file mode 100644 index 00000000..867d233f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:036c62fa6a5b54561cfbe13a76e2744a33dc78cf8aeb4ee9ba32014d770cad6e +size 23084 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png.meta new file mode 100644 index 00000000..0280e92e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: ce30b12fbb3223746bcfef9ea82effe3 +timeCreated: 1481127016 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas.meta new file mode 100644 index 00000000..9cfcde5a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c956b1443ae5df54485c68a775928f3e +folderAsset: yes +timeCreated: 1481126946 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png new file mode 100644 index 00000000..b22a8dde --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7db2a5386ef585649ddf4b2f7cf2f1a72f145eb83bef294f1dce7168886578e +size 15526 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png.meta new file mode 100644 index 00000000..0b14f099 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: c560c5d8ca4c353409caf2ec204f3a19 +timeCreated: 1566998352 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png new file mode 100644 index 00000000..ba124246 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ade4982852cfc96db5115f239140fe1a6e7fced0bb7744119bf287c2f08f336 +size 26802 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png.meta new file mode 100644 index 00000000..ada08258 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 881c304491028ea48b5027ac6c62cf73 +timeCreated: 1481127003 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 4 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 2.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 2.png new file mode 100644 index 00000000..31e41d9e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8417785f28cf7d02eebe34f79d8f6ce56287e12b432e2409cdc287c9098e9de0 +size 198 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 2.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 2.png.meta new file mode 100644 index 00000000..672ab0b5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 2.png.meta @@ -0,0 +1,92 @@ +fileFormatVersion: 2 +guid: 03a7d169469c1af41bb03241a7b7e23d +timeCreated: 1486740437 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 1 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 0 + mipMapFadeDistanceEnd: 10 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 4 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: 5 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + - buildTarget: WebGL + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex + 2.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 3.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 3.png new file mode 100644 index 00000000..01ad441b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8f5abc2c7aacde7e8e86cc33711e92986b25fa5d650408f2b7b39c8a01761cae +size 199 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 3.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 3.png.meta new file mode 100644 index 00000000..e7f30a79 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 3.png.meta @@ -0,0 +1,92 @@ +fileFormatVersion: 2 +guid: c3512c25766a40245ac94c6b1722d76e +timeCreated: 1491391706 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 1 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 4 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: 5 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + - buildTarget: WebGL + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex + 3.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 4.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 4.png new file mode 100644 index 00000000..1fbb89ec --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d81d74c1d057eb653d2faa0fa443906edcb93cb3e6f644c4524c01062efbd3dd +size 214 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 4.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 4.png.meta new file mode 100644 index 00000000..758329f9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 4.png.meta @@ -0,0 +1,92 @@ +fileFormatVersion: 2 +guid: e0f922c44762291498cc62e0917609be +timeCreated: 1491397409 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 1 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 4 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: 5 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + - buildTarget: WebGL + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex + 4.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png new file mode 100644 index 00000000..4670d8b4 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed8205ebf87818316e08c443276b62bd3bc51714587f12e5080f61a46d4b3074 +size 470 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png.meta new file mode 100644 index 00000000..a6b2bef0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png.meta @@ -0,0 +1,91 @@ +fileFormatVersion: 2 +guid: 02f71419854c0d845a930c9e0a0bf775 +timeCreated: 1486740437 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 1 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 7 + mipMapFadeDistanceEnd: 10 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: 4 + mipBias: -1 + wrapMode: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: 5 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + - buildTarget: WebGL + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png new file mode 100644 index 00000000..1c48a57a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7bd567cdba141adfcce59cc760c3356205d63a9b640bd021e2c7eab98a532584 +size 201 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png.meta new file mode 100644 index 00000000..4527b52f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png.meta @@ -0,0 +1,103 @@ +fileFormatVersion: 2 +guid: bdb42c87b8801e94e886c5c0d60b3014 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 54 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png new file mode 100644 index 00000000..23db7c9f --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7713b2f7f5f38db19a284537e546a356622b12bb6c5c74cfcc8ee1c795f43326 +size 197 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png.meta new file mode 100644 index 00000000..a372805c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png.meta @@ -0,0 +1,103 @@ +fileFormatVersion: 2 +guid: 157b94751c138d84bbe1768c672b5168 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 54 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG new file mode 100644 index 00000000..b36b7bd8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63eba7be6e8bbdb36d67830380e38e97efa237c813ab37ae7c439ef49fe53cfc +size 23223 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG.meta new file mode 100644 index 00000000..7ea2e005 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 5725fa8ee04e1be449af059f5735cd81 +timeCreated: 1481126993 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png new file mode 100644 index 00000000..876e3d7a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22b4d5c7eca11b1e70b8d1379bac7ad98ea7cdfca2a3bb90b13e49dfae6456b0 +size 23047 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png.meta new file mode 100644 index 00000000..4b58ac2c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 7040748e1c49b9648aeeefef41c8a3d5 +timeCreated: 1481126996 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png new file mode 100644 index 00000000..73956798 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6bc8f4c78acc666286186e4dfeaf19c3a41b272a4c492685fd076dda860ee16f +size 15302 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png.meta new file mode 100644 index 00000000..b7644b87 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png.meta @@ -0,0 +1,103 @@ +fileFormatVersion: 2 +guid: a702c1245d15ddb48b8fba73bf951a65 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: 1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 54 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png new file mode 100644 index 00000000..6552705e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2cc73c5293bc256efa4ab09b39d0d02792b1f3647ca37ff110e04655b34d18f1 +size 197 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png.meta new file mode 100644 index 00000000..0f9fa90e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png.meta @@ -0,0 +1,103 @@ +fileFormatVersion: 2 +guid: 555b6a287b4121b479d412e6ea92bb2e +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 54 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png new file mode 100644 index 00000000..7910cfcf --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5575f79bdb76d1a1f939c0d6d3897d6a8fd2c32c20329da49dc885c778b45a94 +size 194 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png.meta new file mode 100644 index 00000000..418ef52b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png.meta @@ -0,0 +1,103 @@ +fileFormatVersion: 2 +guid: 94cd628d3d8e07d40a85d82b3fdad15d +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 54 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png new file mode 100644 index 00000000..8c3d2739 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:045cab1a74cefc29646a822217f67f595988b8216b7c52944c1eba0c03d05618 +size 4615 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png.meta new file mode 100644 index 00000000..06d35a8b --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png.meta @@ -0,0 +1,103 @@ +fileFormatVersion: 2 +guid: 50be8291f9514914aa55c66c49da67cf +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 5 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 54 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png new file mode 100644 index 00000000..fe30fc00 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7ced89fedaa6ffdd19c8c0e6becc8f6ba19e1b38fa92ff32f1ec9496c28954c +size 4051 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png.meta new file mode 100644 index 00000000..091ca275 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png.meta @@ -0,0 +1,103 @@ +fileFormatVersion: 2 +guid: 68897d376b60748438e0ae3474ebe558 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 54 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png new file mode 100644 index 00000000..f01119b6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:77a99ff9349c366a8bb503c6121d262c9f8dd60b073ca9df69fbf92b57b5d7a9 +size 3614 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png.meta new file mode 100644 index 00000000..aeb61788 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: ff637d399b504ac4999b770f24ef4d56 +timeCreated: 1494003400 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG new file mode 100644 index 00000000..750df501 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8048c25993bd3186b6475a5eab4e8af4493ab27d59217950ed205996c80576a6 +size 25967 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG.meta new file mode 100644 index 00000000..ee8b3084 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: f4ca92d9e50d06049b7ccec2c438754d +timeCreated: 1481127025 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png new file mode 100644 index 00000000..099a2585 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c866b123adc73eeae9c0979899be2190eb27341c898e95ae3bfd92dadbfdb01 +size 25875 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png.meta new file mode 100644 index 00000000..222f0530 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: df81b9531d8ef704f96072ce6910db68 +timeCreated: 1481127018 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png new file mode 100644 index 00000000..c0991875 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be76bb125099fb3f7e23e39c1b3985d0a069e07ade5b1282b1cce6be5516cef1 +size 927 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png.meta new file mode 100644 index 00000000..63858c9e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 6f410c15ce9be2741bae77a30a336748 +timeCreated: 1481126996 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png new file mode 100644 index 00000000..1dd4d048 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a97af770a132c605998590129edcf44f182fc2893badf21788e9b3d6edf60147 +size 180454 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png.meta new file mode 100644 index 00000000..3a00461e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png.meta @@ -0,0 +1,103 @@ +fileFormatVersion: 2 +guid: 8c4a7fca2884fab419769ccc0355c0c1 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 54 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes.meta new file mode 100644 index 00000000..bc11f3dd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2bec2ea1b48d47846930d3eedd9a80ca +folderAsset: yes +timeCreated: 1481126945 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png new file mode 100644 index 00000000..7c78be02 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3aced0667e6f00daa7a71ff1561597f41f198ba6533583ed835b52b5540ddf02 +size 438 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png.meta new file mode 100644 index 00000000..20547b86 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 60c283ffa9a758646ab70a2fe7ff5f71 +timeCreated: 1483554830 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png new file mode 100644 index 00000000..4866adcb --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ae7d919783afe480632dc1c227d6a6c479731ef74e6d8c01fc3e7dcd520f904 +size 283 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png.meta new file mode 100644 index 00000000..c3c8cfd1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 330fd0c8f074a3c4f8042114a61a73d9 +timeCreated: 1522611116 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: 4 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png new file mode 100644 index 00000000..345fc1fe --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca8a33e0e071ccdc269b4a87530f8ed2808a50271e381c3243256a4b934a992b +size 350 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png.meta new file mode 100644 index 00000000..230d774c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: d179c8744f837da49ab92aae04d1ae1c +timeCreated: 1520606221 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png new file mode 100644 index 00000000..312f8e15 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:535b75d66b0187cc2c7687032e29e03f9d5ea6152b752f63e50aecbb8f151309 +size 5052 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png.meta new file mode 100644 index 00000000..1a118cc3 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: bd910a1d744309b499b59062db7891ab +timeCreated: 1483555205 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png new file mode 100644 index 00000000..20fb39b0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f7cedf4baad2723ce7613fba3a67b7fc8a9ce302487700113b45a0360314c984 +size 338 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png.meta new file mode 100644 index 00000000..59bdcbc9 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: b57dd36838fb19c449fd4559efe3f800 +timeCreated: 1487608374 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: 5 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png new file mode 100644 index 00000000..3023e883 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:903187073952e54575ca385c6ce7b9888dfce0bc5f36d1561f5b85ce9b9619d8 +size 870 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png.meta new file mode 100644 index 00000000..c2014be8 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png.meta @@ -0,0 +1,103 @@ +fileFormatVersion: 2 +guid: b2be9c55e7e7ba447967677c82b2cb23 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 54 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png new file mode 100644 index 00000000..6020e8db --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d06256f3ec0a290353034a6d082ac65f8aa6c44ba15b0200f5c35b8cf3220557 +size 18758 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png.meta new file mode 100644 index 00000000..307d30fe --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 5321bd2b79632764286f28503db80815 +timeCreated: 1481126991 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 5 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png new file mode 100644 index 00000000..ba154ae7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b662f928cdd462f7d1faf721120e8df042d1b2a250993afae31ed8caac73220 +size 15089 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png.meta new file mode 100644 index 00000000..06250f9e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: b52bc320a2ff91446978a893ec738134 +timeCreated: 1481127009 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 5 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png new file mode 100644 index 00000000..6509a978 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbf2f6a3ad6998af0a771ebaa24202683244d15eb9712e21267fc79d2c398d79 +size 158 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png.meta new file mode 100644 index 00000000..1ffe513d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 44efd0011d6a9bc4fb0b3a82753dac4e +timeCreated: 1481126984 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png new file mode 100644 index 00000000..9af3c6cd --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:923d95347149ac26712962b9bc5f05e08a4e88032f82d612d79a1b1be6aa1f00 +size 383 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png.meta new file mode 100644 index 00000000..e07a4fd1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 2b3b7485f95e8a44dab3fa9610f56cbb +timeCreated: 1513873202 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png new file mode 100644 index 00000000..3d368ded --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b3cb66c47d9924c71d6f2bf8f924df2490ba48bdad8109c6a788170b2e99d717 +size 381 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png.meta new file mode 100644 index 00000000..30045c21 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: dd3411e8d9927d3429d5872dbdbd752b +timeCreated: 1513877265 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png new file mode 100644 index 00000000..e158540c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca042f99e7239436a8b233eb4d664f135661ae537e39fe28427259f3d0a645b3 +size 375 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png.meta new file mode 100644 index 00000000..1007d6b1 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 2ae607812d722ec46b48647c2a800779 +timeCreated: 1515435226 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png new file mode 100644 index 00000000..20114a3e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f21dd2212b58e8ca84bbedd29ac801c6edf88e27376fffc291fe314dd51a7f3 +size 5427 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png.meta new file mode 100644 index 00000000..1bbdbe7c --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 9e88b336bd16b1e4b99de75f486126c1 +timeCreated: 1481127004 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 5 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png new file mode 100644 index 00000000..ff0e8379 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cdc27517e919ecdaf3d9ab8a5a7ff2c3583cef6c14dfcaa3d77148c2b6992962 +size 5263 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png.meta new file mode 100644 index 00000000..44a34940 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: b16188b8a3dee8146bd9cb0bde234a24 +timeCreated: 1520606407 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png new file mode 100644 index 00000000..5b7e841a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:374e7694cc7dec01ea0d2308dfe6e8a128a6bdfd624d07885d7aaad5de1b2966 +size 386 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png.meta new file mode 100644 index 00000000..d698382a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 750b1bd7ba8bd28489650de6d0a95cc5 +timeCreated: 1487590795 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 1 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 0 + aniso: 1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: 3 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png new file mode 100644 index 00000000..a699f883 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b55b7add4fe27973fe002e0dd98a7749540cac1c68d4f21b0b5b3796c276866 +size 549 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png.meta new file mode 100644 index 00000000..f4d1a156 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 24fb767323009c143a4e744a2025a27e +timeCreated: 1481126983 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 5 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png new file mode 100644 index 00000000..79710455 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f14d02cf014eae21d4f5afa1e63bd01ab5848193a0fdaad9d19f88733af0310d +size 428 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png.meta new file mode 100644 index 00000000..e56346a7 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 080a030f87555fe419ecc1fb9f509118 +timeCreated: 1520612755 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png new file mode 100644 index 00000000..19f47f06 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6df674c722cd2fe7c3a2f07087d7f0fb2c1125ddf39830941904e0318f0d354a +size 206 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png.meta new file mode 100644 index 00000000..020fb391 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: c1912a55d2f211d468ddeb7b1386dd41 +timeCreated: 1487618370 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: 5 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png new file mode 100644 index 00000000..b3115c20 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81a7021b0f4c4f2b32a967ebe544c36fdb20edfc6c3e19e912914134e432fc77 +size 231 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png.meta new file mode 100644 index 00000000..b16a3448 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: d2384a227b4ac4943b73c8151393e502 +timeCreated: 1515513996 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png new file mode 100644 index 00000000..c58010f0 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19bfb322af7a5d408fffaee99031bf1e506df018ea4842169812bf3ec7d1b507 +size 243 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png.meta new file mode 100644 index 00000000..be40d7af --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 1f3a46793c375864ab816c0d78061e4e +timeCreated: 1486488219 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png new file mode 100644 index 00000000..4ca71f88 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3442a78d6c61e8bcad5e2c551e19d1dc0ceeb3f387962abddbb45519044fb615 +size 229 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png.meta new file mode 100644 index 00000000..86f9cce6 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: dae54b5aa457b474e8a1599de1073d26 +timeCreated: 1486488219 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png new file mode 100644 index 00000000..ffb48b47 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d861c6d5873ea644c4a2f839f1042242f2284e714a589623dd8e77549683f019 +size 180 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png.meta new file mode 100644 index 00000000..9c465113 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png.meta @@ -0,0 +1,83 @@ +fileFormatVersion: 2 +guid: 94816692c85001f4dab01ec3666943c0 +timeCreated: 1486470997 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 0 + mipMapFadeDistanceEnd: 10 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ShaderFunctionHeaderIcon.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ShaderFunctionHeaderIcon.png new file mode 100644 index 00000000..69f7b313 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ShaderFunctionHeaderIcon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:475222320cf9884afc67d6fcf5eb17977320331a7399b707570b36bd58b318c0 +size 4884 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ShaderFunctionHeaderIcon.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ShaderFunctionHeaderIcon.png.meta new file mode 100644 index 00000000..fd5575b5 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ShaderFunctionHeaderIcon.png.meta @@ -0,0 +1,131 @@ +fileFormatVersion: 2 +guid: 5b59dcde73b12b746af7ff7c47a1195d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 1 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ShaderFunctionHeaderIcon.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png new file mode 100644 index 00000000..9a688d51 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d569764d608a9c84ed25f1d1a94635c508bd89a208b45edd1f60a6d047da9531 +size 406 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png.meta new file mode 100644 index 00000000..17dcabac --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png.meta @@ -0,0 +1,65 @@ +fileFormatVersion: 2 +guid: dd563e33152bb6443b099b4139ceecb9 +timeCreated: 1501088039 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png new file mode 100644 index 00000000..c8456624 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b232559ebfd32093d3f0d992526067e13d3b6cc816c8320581e819417396464 +size 19719 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png.meta new file mode 100644 index 00000000..dd07e302 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png.meta @@ -0,0 +1,91 @@ +fileFormatVersion: 2 +guid: 56277f370fb77a448a152bcd2e3a9077 +timeCreated: 1481126991 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 1 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 1 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 5 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 4 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: WebGL + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png new file mode 100644 index 00000000..7da68f9e --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c7d2403f002559fa13d714184ac9ef33c607fe3bf36edf983f2ef325c0563d6 +size 19671 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png.meta new file mode 100644 index 00000000..2439448d --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png.meta @@ -0,0 +1,91 @@ +fileFormatVersion: 2 +guid: 8113366f9f7cec647878e3af2fb98922 +timeCreated: 1481127000 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 1 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 5 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 4 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: WebGL + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png new file mode 100644 index 00000000..e0e03fef --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c6152bb6f562b3e77f9068b48c001b78e8e4d8dc936c8612e5ef8d27d2e2956 +size 933 diff --git a/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png.meta b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png.meta new file mode 100644 index 00000000..b4f1e192 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png.meta @@ -0,0 +1,65 @@ +fileFormatVersion: 2 +guid: bfe0b03d5d60cea4f9d4b2d1d121e592 +timeCreated: 1504005445 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png + uploadId: 723576 diff --git a/Assets/External/AmplifyShaderEditor/Readme.txt b/Assets/External/AmplifyShaderEditor/Readme.txt new file mode 100644 index 00000000..d54ea177 --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Readme.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf657eea3954307adb87e3a09c969748924f3e741dce3ca35ade2d0a1e326c2c +size 3553 diff --git a/Assets/External/AmplifyShaderEditor/Readme.txt.meta b/Assets/External/AmplifyShaderEditor/Readme.txt.meta new file mode 100644 index 00000000..d427053a --- /dev/null +++ b/Assets/External/AmplifyShaderEditor/Readme.txt.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1b2d5cde00ee97c46b03020eb630dc2d +timeCreated: 1481127071 +licenseType: Store +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 68570 + packageName: Amplify Shader Editor + packageVersion: 1.9.8.1 + assetPath: Assets/AmplifyShaderEditor/Readme.txt + uploadId: 723576 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Demo.unity b/Assets/External/Horizon Based Ambient Occlusion/Demo/Demo.unity deleted file mode 100644 index b432d0be..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Demo.unity +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c6cd926f87d940d0d104bca5f66d3a406df0337d3d3b067a7a8234e3df87b779 -size 64105 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Demo.unity.meta b/Assets/External/Horizon Based Ambient Occlusion/Demo/Demo.unity.meta deleted file mode 100644 index feb01d31..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Demo.unity.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 241634a1ead4cbf4aa1750dbe7debbab -timeCreated: 1453576474 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures/Dragons.png b/Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures/Dragons.png deleted file mode 100644 index 729ad417..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures/Dragons.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6bb5d543d86a2b2df7c43ce820fa5e1528da74587df6b5bb8fa4efcc0dac8ef1 -size 5811266 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime.meta b/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime.meta deleted file mode 100644 index e79b530a..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 25eb19968142c7c40ae4ac3180eb03ab -folderAsset: yes -timeCreated: 1455959813 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAO.Demo.Runtime.asmdef b/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAO.Demo.Runtime.asmdef deleted file mode 100644 index 02ccd297..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAO.Demo.Runtime.asmdef +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "HBAO.Demo.Runtime", - "references": [ - "GUID:b83dc51897666cb44bdfbf9671f74e85" - ], - "optionalUnityReferences": [], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [ - "UNITY_2019_1_OR_NEWER" - ], - "versionDefines": [] -} \ No newline at end of file diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAOControl.cs b/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAOControl.cs deleted file mode 100644 index a40c13df..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAOControl.cs +++ /dev/null @@ -1,29 +0,0 @@ -using UnityEngine; - -namespace HorizonBasedAmbientOcclusion -{ - public class HBAOControl : MonoBehaviour - { - public HBAO hbao; - public UnityEngine.UI.Slider aoRadiusSlider; - - public void Start() - { - hbao.SetDebugMode(HBAO.DebugMode.Disabled); - hbao.SetAoRadius(aoRadiusSlider.value); - } - - public void ToggleShowAO() - { - if (hbao.generalSettings.debugMode != HBAO.DebugMode.Disabled) - hbao.SetDebugMode(HBAO.DebugMode.Disabled); - else - hbao.SetDebugMode(HBAO.DebugMode.AOOnly); - } - - public void UpdateAoRadius() - { - hbao.SetAoRadius(aoRadiusSlider.value); - } - } -} diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/RotateObject.cs b/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/RotateObject.cs deleted file mode 100644 index e05d53e9..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/RotateObject.cs +++ /dev/null @@ -1,19 +0,0 @@ -using UnityEngine; - -namespace HorizonBasedAmbientOcclusion -{ - public class RotateObject : MonoBehaviour - { - // Use this for initialization - void Start() - { - - } - - // Update is called once per frame - void Update() - { - transform.Rotate(Vector3.up * Time.deltaTime * 15.0f, Space.World); - } - } -} diff --git a/Assets/External/Horizon Based Ambient Occlusion/Documentation.meta b/Assets/External/Horizon Based Ambient Occlusion/Documentation.meta deleted file mode 100644 index 9361df75..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Documentation.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 9869ea90af1da7949848b63dddb25d26 -folderAsset: yes -timeCreated: 1467127598 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/Documentation/User Guide.pdf b/Assets/External/Horizon Based Ambient Occlusion/Documentation/User Guide.pdf deleted file mode 100644 index e2dbde06..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Documentation/User Guide.pdf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:722a40ec01a219ca7c16f51ffba6da0332e72aa8bfa0ebc2767dde5b3457fe31 -size 1405671 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Documentation/User Guide.pdf.meta b/Assets/External/Horizon Based Ambient Occlusion/Documentation/User Guide.pdf.meta deleted file mode 100644 index ff062116..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Documentation/User Guide.pdf.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 061da04314aaba248977f5671e799370 -timeCreated: 1467127598 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAO.Editor.asmdef.meta b/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAO.Editor.asmdef.meta deleted file mode 100644 index 78ca452a..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAO.Editor.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: bbd7cb83004dde543aac62cbce764d58 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOEditor.cs b/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOEditor.cs deleted file mode 100644 index d0fd722a..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOEditor.cs +++ /dev/null @@ -1,266 +0,0 @@ -using UnityEngine; -using UnityEditor; -using UnityEditor.Rendering; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace HorizonBasedAmbientOcclusion -{ - [CustomEditor(typeof(HBAO))] - public class HBAOEditor : Editor - { - private HBAO m_HBAO; - private Texture2D m_HBAOTex; - private GUIStyle m_SettingsGroupStyle; - private GUIStyle m_TitleLabelStyle; - private int m_SelectedPreset; - // settings group - private Dictionary> m_GroupFields = new Dictionary>(); - private readonly Dictionary m_Presets = new Dictionary() - { - { 0, HBAO.Preset.Normal }, - { 1, HBAO.Preset.FastPerformance }, - { 2, HBAO.Preset.FastestPerformance }, - { 3, HBAO.Preset.Custom }, - { 4, HBAO.Preset.HighQuality }, - { 5, HBAO.Preset.HighestQuality } - }; - - - void OnEnable() - { - m_HBAO = (HBAO)target; - m_HBAOTex = Resources.Load("hbao"); - - var settingsGroups = typeof(HBAO).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance) - .Where(x => x.GetCustomAttributes(typeof(HBAO.SettingsGroup), false).Any()); - foreach (var group in settingsGroups) - { - foreach (var setting in group.FieldType.GetFields(BindingFlags.Instance | BindingFlags.Public)) - { - if (!m_GroupFields.ContainsKey(group)) - m_GroupFields[group] = new List(); - - var property = serializedObject.FindProperty(group.Name + "." + setting.Name); - if (property != null) - m_GroupFields[group].Add(property); - } - } - - m_SelectedPreset = m_Presets.Values.ToList().IndexOf(m_HBAO.GetCurrentPreset()); - } - - public override void OnInspectorGUI() - { - serializedObject.Update(); - - SetStyles(); - - EditorGUILayout.BeginVertical(); - { - // header - GUILayout.Space(10.0f); - GUILayout.Label(m_HBAOTex, m_TitleLabelStyle, GUILayout.ExpandWidth(true)); - - //if (m_HBAO.GetComponents()[0] != m_HBAO) - //{ - //GUILayout.Space(6.0f); - //EditorGUILayout.HelpBox("This Post FX should be one of the first in your effect stack", MessageType.Info); - //} - - Event e = Event.current; - - // settings groups - foreach (var group in m_GroupFields) - { - var groupProperty = serializedObject.FindProperty(group.Key.Name); - if (groupProperty == null) - continue; - - GUILayout.Space(6.0f); - Rect rect = GUILayoutUtility.GetRect(16f, 22f, m_SettingsGroupStyle); - GUI.Box(rect, ObjectNames.NicifyVariableName(groupProperty.displayName), m_SettingsGroupStyle); - if (e.type == EventType.MouseDown && rect.Contains(e.mousePosition)) - { - groupProperty.isExpanded = !groupProperty.isExpanded; - e.Use(); - } - - if (!groupProperty.isExpanded) - continue; - - // presets is a special case - if (group.Key.FieldType == typeof(HBAO.Presets)) - { - GUILayout.Space(6.0f); - m_SelectedPreset = GUILayout.SelectionGrid(m_SelectedPreset, m_Presets.Values.Select(x => ObjectNames.NicifyVariableName(x.ToString())).ToArray(), 3); - GUILayout.Space(6.0f); - if (GUILayout.Button("Apply Preset")) - { - Undo.RecordObject(target, "Apply Preset"); - m_HBAO.ApplyPreset(m_Presets[m_SelectedPreset]); - EditorUtility.SetDirty(target); - if (!EditorApplication.isPlaying) - { - UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene()); - } - } - } - - foreach (var field in group.Value) - { - // hide real presets - if (group.Key.FieldType == typeof(HBAO.Presets)) - continue; - - // hide resolution when deinterleaved HBAO is on - if (group.Key.FieldType == typeof(HBAO.GeneralSettings) && field.name == "resolution") - { - if (m_HBAO.GetDeinterleaving() != HBAO.Deinterleaving.Disabled) - { - continue; - } - } - // warn about deinterleaving not supported with SPSR - else if (group.Key.FieldType == typeof(HBAO.GeneralSettings) && field.name == "debugMode") - { -#if UNITY_2019_3_OR_NEWER - if (m_HBAO.GetDeinterleaving() != HBAO.Deinterleaving.Disabled && - IsVrRunning() && PlayerSettings.stereoRenderingPath == StereoRenderingPath.SinglePass) - { - GUILayout.Space(6.0f); - EditorGUILayout.HelpBox("Deinterleaving is not supported with Single Pass Stereo Rendering...", MessageType.Warning); - } -#else - if (m_HBAO.GetDeinterleaving() != HBAO.Deinterleaving.Disabled && - PlayerSettings.virtualRealitySupported && PlayerSettings.stereoRenderingPath == StereoRenderingPath.SinglePass) - { - GUILayout.Space(6.0f); - EditorGUILayout.HelpBox("Deinterleaving is not supported with Single Pass Stereo Rendering...", MessageType.Warning); - } -#endif - } - // hide noise type when deinterleaved HBAO is on - else if (group.Key.FieldType == typeof(HBAO.GeneralSettings) && field.name == "noiseType") - { - if (m_HBAO.GetDeinterleaving() != HBAO.Deinterleaving.Disabled) - { - continue; - } - } - // hide useMultiBounce setting in BeforeReflections integration stage - else if (group.Key.FieldType == typeof(HBAO.AOSettings) && field.name == "useMultiBounce") - { - if (m_HBAO.GetPipelineStage() == HBAO.PipelineStage.BeforeReflections) - { - continue; - } - } - // hide multiBounceInfluence setting when not used - else if (group.Key.FieldType == typeof(HBAO.AOSettings) && field.name == "multiBounceInfluence") - { - if (m_HBAO.GetPipelineStage() == HBAO.PipelineStage.BeforeReflections || !m_HBAO.UseMultiBounce()) - { - continue; - } - } - // warn about distance falloff greater than max distance - else if (group.Key.FieldType == typeof(HBAO.AOSettings) && field.name == "perPixelNormals") - { - if (m_HBAO.GetAoDistanceFalloff() > m_HBAO.GetAoMaxDistance()) - { - GUILayout.Space(6.0f); - EditorGUILayout.HelpBox("Distance Falloff shoudn't be superior to Max Distance", MessageType.Warning); - } - } - // hide albedoMultiplier when not in deferred - else if (group.Key.FieldType == typeof(HBAO.ColorBleedingSettings) && field.name == "albedoMultiplier") - { - if (m_HBAO.GetPipelineStage() == HBAO.PipelineStage.BeforeImageEffectsOpaque) - continue; - } - - EditorGUILayout.BeginHorizontal(); - GUILayout.Space(12.0f); - EditorGUILayout.PropertyField(field); - EditorGUILayout.EndHorizontal(); - } - } - } - EditorGUILayout.EndVertical(); - - serializedObject.ApplyModifiedProperties(); - } - - private void SetStyles() - { - // set banner label style - m_TitleLabelStyle = new GUIStyle(GUI.skin.label); - m_TitleLabelStyle.alignment = TextAnchor.MiddleCenter; - m_TitleLabelStyle.contentOffset = new Vector2(0f, 0f); - - // get shuriken module title style - GUIStyle skurikenModuleTitleStyle = "ShurikenModuleTitle"; - - // clone it as to not interfere with the original, and adjust it - m_SettingsGroupStyle = new GUIStyle(skurikenModuleTitleStyle); - m_SettingsGroupStyle.font = (new GUIStyle("Label")).font; - m_SettingsGroupStyle.fontStyle = FontStyle.Bold; - m_SettingsGroupStyle.border = new RectOffset(15, 7, 4, 4); - m_SettingsGroupStyle.fixedHeight = 22; - m_SettingsGroupStyle.contentOffset = new Vector2(10f, -2f); - } - -#if UNITY_2019_3_OR_NEWER - List displaysDescs = new List(); - List displays = new List(); - - private bool IsVrRunning() - { - bool vrIsRunning = false; - displays.Clear(); - SubsystemManager.GetSubsystems(displays); - foreach (var displaySubsystem in displays) - { - if (displaySubsystem.running) - { - vrIsRunning = true; - break; - } - } - - return vrIsRunning; - } -#endif - - [CustomPropertyDrawer(typeof(HBAO.MinMaxSliderAttribute))] - public class MinMaxSliderDrawer : PropertyDrawer - { - - public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) - { - - if (property.propertyType == SerializedPropertyType.Vector2) - { - Vector2 range = property.vector2Value; - float min = range.x; - float max = range.y; - var attr = attribute as HBAO.MinMaxSliderAttribute; - EditorGUI.BeginChangeCheck(); - EditorGUI.MinMaxSlider(position, label, ref min, ref max, attr.min, attr.max); - if (EditorGUI.EndChangeCheck()) - { - range.x = min; - range.y = max; - property.vector2Value = range; - } - } - else - { - EditorGUI.LabelField(position, label, "Use only with Vector2"); - } - } - } - } -} diff --git a/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOGaiaExtension.cs b/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOGaiaExtension.cs deleted file mode 100644 index eb5f48c5..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOGaiaExtension.cs +++ /dev/null @@ -1,140 +0,0 @@ -#if GAIA_PRESENT && UNITY_EDITOR - -using HorizonBasedAmbientOcclusion; -using UnityEditor; -using UnityEngine; - -namespace Gaia.GX.MichaelJimenez -{ - public class HBAOGaiaExtension : MonoBehaviour - { -#region Generic informational methods - - /// - /// Returns the publisher name if provided. - /// This will override the publisher name in the namespace ie Gaia.GX.PublisherName - /// - /// Publisher name - public static string GetPublisherName() - { - return "Michael Jimenez"; - } - - /// - /// Returns the package name if provided - /// This will override the package name in the class name ie public class PackageName. - /// - /// Package name - public static string GetPackageName() - { - return "Horizon Based Ambient Occlusion"; - } - -#endregion - -#region Methods exposed by Gaia as buttons must be prefixed with GX_ - - public static void GX_About() - { - EditorUtility.DisplayDialog("About Horizon Based Ambient Occlusion ", "HBAO is a post processing image effect to use in order to add realism to your scenes. It helps accentuating small surface details and reproduce light attenuation due to occlusion.\n\nNote: This Post FX should be the first in your effect stack.", "OK"); - } - - public static void GX_Presets_FastestPerformance() - { - HBAO hbao = StackPostFXOnTop(); - if (hbao != null) - { - hbao.ApplyPreset(HBAO.Preset.FastestPerformance); - MarkDirty(hbao); - } - } - - public static void GX_Presets_FastPerformance() - { - HBAO hbao = StackPostFXOnTop(); - if (hbao != null) - { - hbao.ApplyPreset(HBAO.Preset.FastPerformance); - MarkDirty(hbao); - } - } - - public static void GX_Presets_Normal() - { - HBAO hbao = StackPostFXOnTop(); - if (hbao != null) - { - hbao.ApplyPreset(HBAO.Preset.Normal); - MarkDirty(hbao); - } - } - - public static void GX_Presets_HighQuality() - { - HBAO hbao = StackPostFXOnTop(); - if (hbao != null) - { - hbao.ApplyPreset(HBAO.Preset.HighQuality); - MarkDirty(hbao); - } - } - - - public static void GX_Presets_HighestQuality() - { - HBAO hbao = StackPostFXOnTop(); - if (hbao != null) - { - hbao.ApplyPreset(HBAO.Preset.HighestQuality); - MarkDirty(hbao); - } - } - -#endregion - -#region Helper methods - - private static HBAO StackPostFXOnTop() - { - Camera camera = Camera.main; - if (camera == null) - { - camera = FindObjectOfType(); - } - if (camera == null) - { - EditorUtility.DisplayDialog("OOPS!", "Could not find camera to add camera effects to. Please add a camera to your scene.", "OK"); - return null; - } - - // add HBAO to camera - HBAO hbao = camera.GetComponent(); - if (hbao != null) - { - DestroyImmediate(hbao); - } - hbao = camera.gameObject.AddComponent(); - - // stack it on top - while (camera.GetComponents()[0] != hbao) - { - UnityEditorInternal.ComponentUtility.MoveComponentUp(hbao); - } - - return hbao; - } - - private static void MarkDirty(HBAO hbao) - { - EditorUtility.SetDirty(hbao); - if (!EditorApplication.isPlaying) - { - UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene()); - } - } - -#endregion - } -} - -#endif diff --git a/Assets/External/Horizon Based Ambient Occlusion/Editor/Resources.meta b/Assets/External/Horizon Based Ambient Occlusion/Editor/Resources.meta deleted file mode 100644 index bf1922e1..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Editor/Resources.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: fff65aff3cee6c44183cf61a6df77cac -folderAsset: yes -timeCreated: 1463304680 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/hbao.png b/Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/hbao.png deleted file mode 100644 index ddcd86d0..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/hbao.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2c61855b2735564a800e507312fac5d6e1b9c2e1c6ee93c9012293480eda821e -size 8563 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/icon.png b/Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/icon.png deleted file mode 100644 index 241fb24b..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/icon.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:71bd1cd6e06c9c0aa61f1d68bd93d154318e7b0d8c532af7cdfbac445d44e4b9 -size 8823 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Readme.txt b/Assets/External/Horizon Based Ambient Occlusion/Readme.txt deleted file mode 100644 index 6545b23e..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f7b6f6e79d789f5eede2d00e3e606fd4213d3acbf782329be2ba3701f6e70a22 -size 8894 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Runtime.meta b/Assets/External/Horizon Based Ambient Occlusion/Runtime.meta deleted file mode 100644 index 9cbfbd7d..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Runtime.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6b4762034a7dbee44a7dfa37d2418bf2 -folderAsset: yes -timeCreated: 1455959812 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.Runtime.asmdef b/Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.Runtime.asmdef deleted file mode 100644 index 8d05cc71..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.Runtime.asmdef +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "HBAO.Runtime", - "references": [], - "optionalUnityReferences": [], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [ - "UNITY_2019_1_OR_NEWER" - ], - "versionDefines": [] -} \ No newline at end of file diff --git a/Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.Runtime.asmdef.meta b/Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.Runtime.asmdef.meta deleted file mode 100644 index 35f2493c..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.Runtime.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: b83dc51897666cb44bdfbf9671f74e85 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.cs b/Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.cs deleted file mode 100644 index 4a42a288..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.cs +++ /dev/null @@ -1,1776 +0,0 @@ -using UnityEngine; -using UnityEngine.Rendering; -#if ENABLE_VR -using XRSettings = UnityEngine.XR.XRSettings; -#endif -#if UNITY_EDITOR -using UnityEditor; -#endif -using System; -using System.Collections.Generic; - -namespace HorizonBasedAmbientOcclusion -{ - [ExecuteInEditMode, ImageEffectAllowedInSceneView, AddComponentMenu("Image Effects/HBAO")] - [RequireComponent(typeof(Camera))] - public class HBAO : MonoBehaviour - { - public enum Preset - { - FastestPerformance, - FastPerformance, - Normal, - HighQuality, - HighestQuality, - Custom - } - - public enum PipelineStage - { - BeforeImageEffectsOpaque, - AfterLighting, - BeforeReflections - } - - public enum Quality - { - Lowest, - Low, - Medium, - High, - Highest - } - - public enum Resolution - { - Full, - Half - } - - public enum NoiseType - { - Dither, - InterleavedGradientNoise, - SpatialDistribution - } - - public enum Deinterleaving - { - Disabled, - x4 - } - - public enum DebugMode - { - Disabled, - AOOnly, - ColorBleedingOnly, - SplitWithoutAOAndWithAO, - SplitWithAOAndAOOnly, - SplitWithoutAOAndAOOnly, - ViewNormals - } - - public enum BlurType - { - None, - Narrow, - Medium, - Wide, - ExtraWide - } - - public enum PerPixelNormals - { - GBuffer, - Camera, - Reconstruct - } - - public enum VarianceClipping - { - Disabled, - _4Tap, - _8Tap - } - - public Shader hbaoShader; - - [Serializable] - public struct Presets - { - public Preset preset; - - [SerializeField] - public static Presets defaults - { - get - { - return new Presets - { - preset = Preset.Normal - }; - } - } - } - - [Serializable] - public struct GeneralSettings - { - [Tooltip("The stage the AO is injected into the rendering pipeline.")] - [Space(6)] - public PipelineStage pipelineStage; - - [Tooltip("The quality of the AO.")] - [Space(10)] - public Quality quality; - - [Tooltip("The deinterleaving factor.")] - public Deinterleaving deinterleaving; - - [Tooltip("The resolution at which the AO is calculated.")] - public Resolution resolution; - - [Tooltip("The type of noise to use.")] - [Space(10)] - public NoiseType noiseType; - - [Tooltip("The debug mode actually displayed on screen.")] - [Space(10)] - public DebugMode debugMode; - - [SerializeField] - public static GeneralSettings defaults - { - get - { - return new GeneralSettings - { - pipelineStage = PipelineStage.BeforeImageEffectsOpaque, - quality = Quality.Medium, - deinterleaving = Deinterleaving.Disabled, - resolution = Resolution.Full, - noiseType = NoiseType.Dither, - debugMode = DebugMode.Disabled - }; - } - } - } - - [Serializable] - public struct AOSettings - { - [Tooltip("AO radius: this is the distance outside which occluders are ignored.")] - [Space(6), Range(0.25f, 5f)] - public float radius; - - [Tooltip("Maximum radius in pixels: this prevents the radius to grow too much with close-up " + - "object and impact on performances.")] - [Range(16, 256)] - public float maxRadiusPixels; - - [Tooltip("For low-tessellated geometry, occlusion variations tend to appear at creases and " + - "ridges, which betray the underlying tessellation. To remove these artifacts, we use " + - "an angle bias parameter which restricts the hemisphere.")] - [Range(0, 0.5f)] - public float bias; - - [Tooltip("This value allows to scale up the ambient occlusion values.")] - [Range(0, 4)] - public float intensity; - - [Tooltip("Enable/disable MultiBounce approximation.")] - public bool useMultiBounce; - - [Tooltip("MultiBounce approximation influence.")] - [Range(0, 1)] - public float multiBounceInfluence; - - [Tooltip("The amount of AO offscreen samples are contributing.")] - [Range(0, 1)] - public float offscreenSamplesContribution; - - [Tooltip("The max distance to display AO.")] - [Space(10)] - public float maxDistance; - - [Tooltip("The distance before max distance at which AO start to decrease.")] - public float distanceFalloff; - - [Tooltip("The type of per pixel normals to use.")] - [Space(10)] - public PerPixelNormals perPixelNormals; - - [Tooltip("This setting allow you to set the base color if the AO, the alpha channel value is unused.")] - [Space(10)] - public Color baseColor; - - [SerializeField] - public static AOSettings defaults - { - get - { - return new AOSettings - { - radius = 0.8f, - maxRadiusPixels = 128f, - bias = 0.05f, - intensity = 1f, - useMultiBounce = false, - multiBounceInfluence = 1f, - offscreenSamplesContribution = 0f, - maxDistance = 150f, - distanceFalloff = 50f, - perPixelNormals = PerPixelNormals.GBuffer, - baseColor = Color.black - }; - } - } - } - - [Serializable] - public struct TemporalFilterSettings - { - [Space(6)] - public bool enabled; - - [Tooltip("The type of variance clipping to use.")] - public VarianceClipping varianceClipping; - - [SerializeField] - public static TemporalFilterSettings defaults - { - get - { - return new TemporalFilterSettings - { - enabled = false, - varianceClipping = VarianceClipping._4Tap - }; - } - } - } - - [Serializable] - public struct BlurSettings - { - [Tooltip("The type of blur to use.")] - [Space(6)] - public BlurType type; - - [Tooltip("This parameter controls the depth-dependent weight of the bilateral filter, to " + - "avoid bleeding across edges. A zero sharpness is a pure Gaussian blur. Increasing " + - "the blur sharpness removes bleeding by using lower weights for samples with large " + - "depth delta from the current pixel.")] - [Space(10), Range(0, 16)] - public float sharpness; - - [SerializeField] - public static BlurSettings defaults - { - get - { - return new BlurSettings - { - type = BlurType.Medium, - sharpness = 8f - }; - } - } - } - - [Serializable] - public struct ColorBleedingSettings - { - [Space(6)] - public bool enabled; - - [Tooltip("This value allows to control the saturation of the color bleeding.")] - [Space(10), Range(0, 4)] - public float saturation; - - [Tooltip("This value allows to scale the contribution of the color bleeding samples.")] - [Range(0, 32)] - public float albedoMultiplier; - - [Tooltip("Use masking on emissive pixels")] - [Range(0, 1)] - public float brightnessMask; - - [Tooltip("Brightness level where masking starts/ends")] - [MinMaxSlider(0, 2)] - public Vector2 brightnessMaskRange; - - [SerializeField] - public static ColorBleedingSettings defaults - { - get - { - return new ColorBleedingSettings - { - enabled = false, - saturation = 1f, - albedoMultiplier = 4f, - brightnessMask = 1f, - brightnessMaskRange = new Vector2(0.0f, 0.5f) - }; - } - } - } - - [AttributeUsage(AttributeTargets.Field)] - public class SettingsGroup : Attribute { } - - [SerializeField, SettingsGroup] - private Presets m_Presets = Presets.defaults; - public Presets presets - { - get { return m_Presets; } - set { m_Presets = value; } - } - - [SerializeField, SettingsGroup] - private GeneralSettings m_GeneralSettings = GeneralSettings.defaults; - public GeneralSettings generalSettings - { - get { return m_GeneralSettings; } - set { m_GeneralSettings = value; } - } - - [SerializeField, SettingsGroup] - private AOSettings m_AOSettings = AOSettings.defaults; - public AOSettings aoSettings - { - get { return m_AOSettings; } - set { m_AOSettings = value; } - } - - [SerializeField, SettingsGroup] - private TemporalFilterSettings m_TemporalFilterSettings = TemporalFilterSettings.defaults; - public TemporalFilterSettings temporalFilterSettings - { - get { return m_TemporalFilterSettings; } - set { m_TemporalFilterSettings = value; } - } - - [SerializeField, SettingsGroup] - private BlurSettings m_BlurSettings = BlurSettings.defaults; - public BlurSettings blurSettings - { - get { return m_BlurSettings; } - set { m_BlurSettings = value; } - } - - [SerializeField, SettingsGroup] - private ColorBleedingSettings m_ColorBleedingSettings = ColorBleedingSettings.defaults; - public ColorBleedingSettings colorBleedingSettings - { - get { return m_ColorBleedingSettings; } - set { m_ColorBleedingSettings = value; } - } - - public class MinMaxSliderAttribute : PropertyAttribute - { - public readonly float max; - public readonly float min; - - public MinMaxSliderAttribute(float min, float max) - { - this.min = min; - this.max = max; - } - } - - public Preset GetCurrentPreset() - { - return m_Presets.preset; - } - - public void ApplyPreset(Preset preset) - { - if (preset == Preset.Custom) - { - m_Presets.preset = preset; - return; - } - - var debugMode = generalSettings.debugMode; - - m_GeneralSettings = GeneralSettings.defaults; - m_AOSettings = AOSettings.defaults; - m_ColorBleedingSettings = ColorBleedingSettings.defaults; - m_BlurSettings = BlurSettings.defaults; - - SetDebugMode(debugMode); - - switch (preset) - { - case Preset.FastestPerformance: - SetQuality(Quality.Lowest); - SetAoRadius(0.5f); - SetAoMaxRadiusPixels(64.0f); - SetBlurType(BlurType.ExtraWide); - break; - case Preset.FastPerformance: - SetQuality(Quality.Low); - SetAoRadius(0.5f); - SetAoMaxRadiusPixels(64.0f); - SetBlurType(BlurType.Wide); - break; - case Preset.HighQuality: - SetQuality(Quality.High); - SetAoRadius(1.0f); - break; - case Preset.HighestQuality: - SetQuality(Quality.Highest); - SetAoRadius(1.2f); - SetAoMaxRadiusPixels(256.0f); - SetBlurType(BlurType.Narrow); - break; - case Preset.Normal: - default: - break; - } - - m_Presets.preset = preset; - } - - public PipelineStage GetPipelineStage() - { - return m_GeneralSettings.pipelineStage; - } - - public void SetPipelineStage(PipelineStage pipelineStage) - { - m_GeneralSettings.pipelineStage = pipelineStage; - } - - public Quality GetQuality() - { - return m_GeneralSettings.quality; - } - - public void SetQuality(Quality quality) - { - m_GeneralSettings.quality = quality; - } - - public Deinterleaving GetDeinterleaving() - { - return m_GeneralSettings.deinterleaving; - } - - public void SetDeinterleaving(Deinterleaving deinterleaving) - { - m_GeneralSettings.deinterleaving = deinterleaving; - } - - public Resolution GetResolution() - { - return m_GeneralSettings.resolution; - } - - public void SetResolution(Resolution resolution) - { - m_GeneralSettings.resolution = resolution; - } - - public NoiseType GetNoiseType() - { - return m_GeneralSettings.noiseType; - } - - public void SetNoiseType(NoiseType noiseType) - { - m_GeneralSettings.noiseType = noiseType; - } - - public DebugMode GetDebugMode() - { - return m_GeneralSettings.debugMode; - } - - public void SetDebugMode(DebugMode debugMode) - { - m_GeneralSettings.debugMode = debugMode; - } - - public float GetAoRadius() - { - return m_AOSettings.radius; - } - - public void SetAoRadius(float radius) - { - m_AOSettings.radius = Mathf.Clamp(radius, 0.25f, 5); - } - - public float GetAoMaxRadiusPixels() - { - return m_AOSettings.maxRadiusPixels; - } - - public void SetAoMaxRadiusPixels(float maxRadiusPixels) - { - m_AOSettings.maxRadiusPixels = Mathf.Clamp(maxRadiusPixels, 16, 256); - } - - public float GetAoBias() - { - return m_AOSettings.bias; - } - - public void SetAoBias(float bias) - { - m_AOSettings.bias = Mathf.Clamp(bias, 0, 0.5f); - } - - public float GetAoOffscreenSamplesContribution() - { - return m_AOSettings.offscreenSamplesContribution; - } - - public void SetAoOffscreenSamplesContribution(float contribution) - { - m_AOSettings.offscreenSamplesContribution = Mathf.Clamp01(contribution); - } - - public float GetAoMaxDistance() - { - return m_AOSettings.maxDistance; - } - - public void SetAoMaxDistance(float maxDistance) - { - m_AOSettings.maxDistance = maxDistance; - } - - public float GetAoDistanceFalloff() - { - return m_AOSettings.distanceFalloff; - } - - public void SetAoDistanceFalloff(float distanceFalloff) - { - m_AOSettings.distanceFalloff = distanceFalloff; - } - - public PerPixelNormals GetAoPerPixelNormals() - { - return m_AOSettings.perPixelNormals; - } - - public void SetAoPerPixelNormals(PerPixelNormals perPixelNormals) - { - m_AOSettings.perPixelNormals = perPixelNormals; - } - - public Color GetAoColor() - { - return m_AOSettings.baseColor; - } - - public void SetAoColor(Color color) - { - m_AOSettings.baseColor = color; - } - - public float GetAoIntensity() - { - return m_AOSettings.intensity; - } - - public void SetAoIntensity(float intensity) - { - m_AOSettings.intensity = Mathf.Clamp(intensity, 0, 4); - } - - public bool UseMultiBounce() - { - return m_AOSettings.useMultiBounce; - } - - public void EnableMultiBounce(bool enabled = true) - { - m_AOSettings.useMultiBounce = enabled; - } - - public float GetAoMultiBounceInfluence() - { - return m_AOSettings.multiBounceInfluence; - } - - public void SetAoMultiBounceInfluence(float multiBounceInfluence) - { - m_AOSettings.multiBounceInfluence = Mathf.Clamp01(multiBounceInfluence); - } - - public bool IsTemporalFilterEnabled() - { - return m_TemporalFilterSettings.enabled; - } - - public void EnableTemporalFilter(bool enabled = true) - { - m_TemporalFilterSettings.enabled = enabled; - } - - public VarianceClipping GetTemporalFilterVarianceClipping() - { - return m_TemporalFilterSettings.varianceClipping; - } - - public void SetTemporalFilterVarianceClipping(VarianceClipping varianceClipping) - { - m_TemporalFilterSettings.varianceClipping = varianceClipping; - } - - public BlurType GetBlurType() - { - return m_BlurSettings.type; - } - - public void SetBlurType(BlurType blurType) - { - m_BlurSettings.type = blurType; - } - - public float GetBlurSharpness() - { - return m_BlurSettings.sharpness; - } - - public void SetBlurSharpness(float sharpness) - { - m_BlurSettings.sharpness = Mathf.Clamp(sharpness, 0, 16); - } - - public bool IsColorBleedingEnabled() - { - return m_ColorBleedingSettings.enabled; - } - - public void EnableColorBleeding(bool enabled = true) - { - m_ColorBleedingSettings.enabled = enabled; - } - - public float GetColorBleedingSaturation() - { - return m_ColorBleedingSettings.saturation; - } - - public void SetColorBleedingSaturation(float saturation) - { - m_ColorBleedingSettings.saturation = Mathf.Clamp(saturation, 0, 4); - } - - public float GetColorBleedingAlbedoMultiplier() - { - return m_ColorBleedingSettings.albedoMultiplier; - } - - public void SetColorBleedingAlbedoMultiplier(float albedoMultiplier) - { - m_ColorBleedingSettings.albedoMultiplier = Mathf.Clamp(albedoMultiplier, 0, 32); - } - - public float GetColorBleedingBrightnessMask() - { - return m_ColorBleedingSettings.brightnessMask; - } - - public void SetColorBleedingBrightnessMask(float brightnessMask) - { - m_ColorBleedingSettings.brightnessMask = Mathf.Clamp01(brightnessMask); - } - - public Vector2 GetColorBleedingBrightnessMaskRange() - { - return m_ColorBleedingSettings.brightnessMaskRange; - } - - public void SetColorBleedingBrightnessMaskRange(Vector2 brightnessMaskRange) - { - brightnessMaskRange.x = Mathf.Clamp(brightnessMaskRange.x, 0, 2); - brightnessMaskRange.y = Mathf.Clamp(brightnessMaskRange.y, 0, 2); - brightnessMaskRange.x = Mathf.Min(brightnessMaskRange.x, brightnessMaskRange.y); - m_ColorBleedingSettings.brightnessMaskRange = brightnessMaskRange; - } - - private static class Pass - { - public const int AO = 0; - public const int AO_Deinterleaved = 1; - - public const int Deinterleave_Depth = 2; - public const int Deinterleave_Normals = 3; - public const int Atlas_AO_Deinterleaved = 4; - public const int Reinterleave_AO = 5; - - public const int Blur = 6; - - public const int Temporal_Filter = 7; - - public const int Copy = 8; - - public const int Composite = 9; - public const int Composite_AfterLighting = 10; - public const int Composite_BeforeReflections = 11; - - public const int Debug_ViewNormals = 12; - } - - private static class ShaderProperties - { - public static int mainTex; - public static int hbaoTex; - public static int tempTex; - public static int tempTex2; - public static int noiseTex; - public static int depthTex; - public static int normalsTex; - public static int[] depthSliceTex; - public static int[] normalsSliceTex; - public static int[] aoSliceTex; - public static int[] deinterleaveOffset; - public static int atlasOffset; - public static int jitter; - public static int uvTransform; - public static int inputTexelSize; - public static int aoTexelSize; - public static int deinterleavedAOTexelSize; - public static int reinterleavedAOTexelSize; - public static int uvToView; - public static int worldToCameraMatrix; - public static int targetScale; - public static int radius; - public static int maxRadiusPixels; - public static int negInvRadius2; - public static int angleBias; - public static int aoMultiplier; - public static int intensity; - public static int multiBounceInfluence; - public static int offscreenSamplesContrib; - public static int maxDistance; - public static int distanceFalloff; - public static int baseColor; - public static int colorBleedSaturation; - public static int albedoMultiplier; - public static int colorBleedBrightnessMask; - public static int colorBleedBrightnessMaskRange; - public static int blurDeltaUV; - public static int blurSharpness; - public static int temporalParams; - - static ShaderProperties() - { - mainTex = Shader.PropertyToID("_MainTex"); - hbaoTex = Shader.PropertyToID("_HBAOTex"); - tempTex = Shader.PropertyToID("_TempTex"); - tempTex2 = Shader.PropertyToID("_TempTex2"); - noiseTex = Shader.PropertyToID("_NoiseTex"); - depthTex = Shader.PropertyToID("_DepthTex"); - normalsTex = Shader.PropertyToID("_NormalsTex"); - depthSliceTex = new int[4 * 4]; - normalsSliceTex = new int[4 * 4]; - aoSliceTex = new int[4 * 4]; - for (int i = 0; i < 4 * 4; i++) - { - depthSliceTex[i] = Shader.PropertyToID("_DepthSliceTex" + i); - normalsSliceTex[i] = Shader.PropertyToID("_NormalsSliceTex" + i); - aoSliceTex[i] = Shader.PropertyToID("_AOSliceTex" + i); - } - deinterleaveOffset = new int[] { - Shader.PropertyToID("_Deinterleave_Offset00"), - Shader.PropertyToID("_Deinterleave_Offset10"), - Shader.PropertyToID("_Deinterleave_Offset01"), - Shader.PropertyToID("_Deinterleave_Offset11") - }; - atlasOffset = Shader.PropertyToID("_AtlasOffset"); - jitter = Shader.PropertyToID("_Jitter"); - uvTransform = Shader.PropertyToID("_UVTransform"); - inputTexelSize = Shader.PropertyToID("_Input_TexelSize"); - aoTexelSize = Shader.PropertyToID("_AO_TexelSize"); - deinterleavedAOTexelSize = Shader.PropertyToID("_DeinterleavedAO_TexelSize"); - reinterleavedAOTexelSize = Shader.PropertyToID("_ReinterleavedAO_TexelSize"); - uvToView = Shader.PropertyToID("_UVToView"); - worldToCameraMatrix = Shader.PropertyToID("_WorldToCameraMatrix"); - targetScale = Shader.PropertyToID("_TargetScale"); - radius = Shader.PropertyToID("_Radius"); - maxRadiusPixels = Shader.PropertyToID("_MaxRadiusPixels"); - negInvRadius2 = Shader.PropertyToID("_NegInvRadius2"); - angleBias = Shader.PropertyToID("_AngleBias"); - aoMultiplier = Shader.PropertyToID("_AOmultiplier"); - intensity = Shader.PropertyToID("_Intensity"); - multiBounceInfluence = Shader.PropertyToID("_MultiBounceInfluence"); - offscreenSamplesContrib = Shader.PropertyToID("_OffscreenSamplesContrib"); - maxDistance = Shader.PropertyToID("_MaxDistance"); - distanceFalloff = Shader.PropertyToID("_DistanceFalloff"); - baseColor = Shader.PropertyToID("_BaseColor"); - colorBleedSaturation = Shader.PropertyToID("_ColorBleedSaturation"); - albedoMultiplier = Shader.PropertyToID("_AlbedoMultiplier"); - colorBleedBrightnessMask = Shader.PropertyToID("_ColorBleedBrightnessMask"); - colorBleedBrightnessMaskRange = Shader.PropertyToID("_ColorBleedBrightnessMaskRange"); - blurDeltaUV = Shader.PropertyToID("_BlurDeltaUV"); - blurSharpness = Shader.PropertyToID("_BlurSharpness"); - temporalParams = Shader.PropertyToID("_TemporalParams"); - } - - public static string GetOrthographicOrDeferredKeyword(bool orthographic, GeneralSettings settings) - { - // need to check that integrationStage is not BeforeImageEffectOpaque as Gbuffer0 is not available in this case - return orthographic ? "ORTHOGRAPHIC_PROJECTION" : settings.pipelineStage != PipelineStage.BeforeImageEffectsOpaque ? "DEFERRED_SHADING" : "__"; - } - - public static string GetQualityKeyword(GeneralSettings settings) - { - switch (settings.quality) - { - case Quality.Lowest: - return "QUALITY_LOWEST"; - case Quality.Low: - return "QUALITY_LOW"; - case Quality.Medium: - return "QUALITY_MEDIUM"; - case Quality.High: - return "QUALITY_HIGH"; - case Quality.Highest: - return "QUALITY_HIGHEST"; - default: - return "QUALITY_MEDIUM"; - } - } - - public static string GetNoiseKeyword(GeneralSettings settings) - { - switch (settings.noiseType) - { - case NoiseType.InterleavedGradientNoise: - return "INTERLEAVED_GRADIENT_NOISE"; - case NoiseType.Dither: - case NoiseType.SpatialDistribution: - default: - return "__"; - } - } - - public static string GetDeinterleavingKeyword(GeneralSettings settings) - { - switch (settings.deinterleaving) - { - case Deinterleaving.x4: - return "DEINTERLEAVED"; - case Deinterleaving.Disabled: - default: - return "__"; - } - } - - public static string GetDebugKeyword(GeneralSettings settings) - { - switch (settings.debugMode) - { - case DebugMode.AOOnly: - return "DEBUG_AO"; - case DebugMode.ColorBleedingOnly: - return "DEBUG_COLORBLEEDING"; - case DebugMode.SplitWithoutAOAndWithAO: - return "DEBUG_NOAO_AO"; - case DebugMode.SplitWithAOAndAOOnly: - return "DEBUG_AO_AOONLY"; - case DebugMode.SplitWithoutAOAndAOOnly: - return "DEBUG_NOAO_AOONLY"; - case DebugMode.Disabled: - default: - return "__"; - } - } - - public static string GetMultibounceKeyword(AOSettings settings) - { - return settings.useMultiBounce ? "MULTIBOUNCE" : "__"; - } - - public static string GetOffscreenSamplesContributionKeyword(AOSettings settings) - { - return settings.offscreenSamplesContribution > 0 ? "OFFSCREEN_SAMPLES_CONTRIBUTION" : "__"; - } - - public static string GetPerPixelNormalsKeyword(AOSettings settings) - { - switch (settings.perPixelNormals) - { - case PerPixelNormals.Camera: - return "NORMALS_CAMERA"; - case PerPixelNormals.Reconstruct: - return "NORMALS_RECONSTRUCT"; - case PerPixelNormals.GBuffer: - default: - return "__"; - } - } - - public static string GetBlurRadiusKeyword(BlurSettings settings) - { - switch (settings.type) - { - case BlurType.Narrow: - return "BLUR_RADIUS_2"; - case BlurType.Medium: - return "BLUR_RADIUS_3"; - case BlurType.Wide: - return "BLUR_RADIUS_4"; - case BlurType.ExtraWide: - return "BLUR_RADIUS_5"; - case BlurType.None: - default: - return "BLUR_RADIUS_3"; - } - } - - public static string GetVarianceClippingKeyword(TemporalFilterSettings settings) - { - switch (settings.varianceClipping) - { - case VarianceClipping._4Tap: - return "VARIANCE_CLIPPING_4TAP"; - case VarianceClipping._8Tap: - return "VARIANCE_CLIPPING_8TAP"; - case VarianceClipping.Disabled: - default: - return "__"; - } - } - - public static string GetColorBleedingKeyword(ColorBleedingSettings settings) - { - return settings.enabled ? "COLOR_BLEEDING" : "__"; - } - - public static string GetLightingLogEncodedKeyword(bool hdr) - { - return hdr ? "__" : "LIGHTING_LOG_ENCODED"; - } - } - - private static class MersenneTwister - { - // Mersenne-Twister random numbers in [0,1). - public static float[] Numbers = new float[] { - //0.463937f,0.340042f,0.223035f,0.468465f,0.322224f,0.979269f,0.031798f,0.973392f,0.778313f,0.456168f,0.258593f,0.330083f,0.387332f,0.380117f,0.179842f,0.910755f, - //0.511623f,0.092933f,0.180794f,0.620153f,0.101348f,0.556342f,0.642479f,0.442008f,0.215115f,0.475218f,0.157357f,0.568868f,0.501241f,0.629229f,0.699218f,0.707733f - 0.556725f,0.005520f,0.708315f,0.583199f,0.236644f,0.992380f,0.981091f,0.119804f,0.510866f,0.560499f,0.961497f,0.557862f,0.539955f,0.332871f,0.417807f,0.920779f, - 0.730747f,0.076690f,0.008562f,0.660104f,0.428921f,0.511342f,0.587871f,0.906406f,0.437980f,0.620309f,0.062196f,0.119485f,0.235646f,0.795892f,0.044437f,0.617311f - }; - } - - private static readonly Vector2[] s_jitter = new Vector2[4 * 4]; - private static readonly float[] s_temporalRotations = { 60.0f, 300.0f, 180.0f, 240.0f, 120.0f, 0.0f }; - private static readonly float[] s_temporalOffsets = { 0.0f, 0.5f, 0.25f, 0.75f }; - - private Material material { get; set; } - private Camera hbaoCamera { get; set; } - private CommandBuffer cmdBuffer { get; set; } - private int width { get; set; } - private int height { get; set; } - private bool stereoActive { get; set; } - private int numberOfEyes { get; set; } - private int xrActiveEye { get; set; } - private XRSettings.StereoRenderingMode stereoRenderingMode { get; set; } - private int screenWidth { get; set; } - private int screenHeight { get; set; } - private int aoWidth { get; set; } - private int aoHeight { get; set; } - private int reinterleavedAoWidth { get; set; } - private int reinterleavedAoHeight { get; set; } - private int deinterleavedAoWidth { get; set; } - private int deinterleavedAoHeight { get; set; } - private int frameCount { get; set; } - private bool motionVectorsSupported { get; set; } - private RenderTexture aoHistoryBuffer { get; set; } - private RenderTexture colorBleedingHistoryBuffer { get; set; } - private Texture2D noiseTex { get; set; } - - private Mesh fullscreenTriangle - { - get - { - if (m_FullscreenTriangle != null) - return m_FullscreenTriangle; - - m_FullscreenTriangle = new Mesh { name = "Fullscreen Triangle" }; - - // Because we have to support older platforms (GLES2/3, DX9 etc) we can't do all of - // this directly in the vertex shader using vertex ids :( - m_FullscreenTriangle.SetVertices(new List - { - new Vector3(-1f, -1f, 0f), - new Vector3(-1f, 3f, 0f), - new Vector3( 3f, -1f, 0f) - }); - m_FullscreenTriangle.SetIndices(new[] { 0, 1, 2 }, MeshTopology.Triangles, 0, false); - m_FullscreenTriangle.UploadMeshData(false); - - return m_FullscreenTriangle; - } - } - - private CameraEvent cameraEvent - { - get - { - // Forces BeforeImageEffectsOpaque as soon as normal display mode isn't used, - // the component still display its integration stage but we force it here to ensure - // all debug modes display correctly. - if (generalSettings.debugMode != DebugMode.Disabled) - return CameraEvent.BeforeImageEffectsOpaque; - - switch (generalSettings.pipelineStage) - { - case PipelineStage.BeforeReflections: - return CameraEvent.BeforeReflections; - case PipelineStage.AfterLighting: - return CameraEvent.AfterLighting; - case PipelineStage.BeforeImageEffectsOpaque: - default: - return CameraEvent.BeforeImageEffectsOpaque; - } - } - } - - private bool isCommandBufferDirty - { - get - { - if (m_IsCommandBufferDirty || m_PreviousPipelineStage != generalSettings.pipelineStage || m_PreviousResolution != generalSettings.resolution || - m_PreviousDebugMode != generalSettings.debugMode || m_PreviousAllowHDR != hbaoCamera.allowHDR || m_PreviousWidth != width || m_PreviousHeight != height || - m_PreviousDeinterleaving != generalSettings.deinterleaving || m_PreviousBlurAmount != blurSettings.type || - m_PreviousColorBleedingEnabled != colorBleedingSettings.enabled || m_PreviousTemporalFilterEnabled != temporalFilterSettings.enabled || - m_PreviousRenderingPath != hbaoCamera.actualRenderingPath) - { - m_PreviousPipelineStage = generalSettings.pipelineStage; - m_PreviousResolution = generalSettings.resolution; - m_PreviousDebugMode = generalSettings.debugMode; - m_PreviousAllowHDR = hbaoCamera.allowHDR; - m_PreviousWidth = width; - m_PreviousHeight = height; - m_PreviousDeinterleaving = generalSettings.deinterleaving; - m_PreviousBlurAmount = blurSettings.type; - m_PreviousColorBleedingEnabled = colorBleedingSettings.enabled; - m_PreviousTemporalFilterEnabled = temporalFilterSettings.enabled; - m_PreviousRenderingPath = hbaoCamera.actualRenderingPath; - - return true; - } - - return false; - } - set - { - m_IsCommandBufferDirty = value; - } - } - - private static RenderTextureFormat defaultHDRRenderTextureFormat - { - get - { -#if UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH || UNITY_EDITOR - RenderTextureFormat format = RenderTextureFormat.RGB111110Float; -#if UNITY_EDITOR - var target = EditorUserBuildSettings.activeBuildTarget; - if (target != BuildTarget.Android && target != BuildTarget.iOS && target != BuildTarget.tvOS && target != BuildTarget.Switch) - return RenderTextureFormat.DefaultHDR; -#endif // UNITY_EDITOR - if (SystemInfo.SupportsRenderTextureFormat(format)) - return format; -#endif // UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH || UNITY_EDITOR - return RenderTextureFormat.DefaultHDR; - } - } - - private RenderTextureFormat sourceFormat { get { return hbaoCamera.allowHDR ? defaultHDRRenderTextureFormat : RenderTextureFormat.Default; } } - //private static RenderTextureFormat colorFormat { get { return SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGB64) ? RenderTextureFormat.ARGB64 : RenderTextureFormat.ARGB32; } } - private static RenderTextureFormat colorFormat { get { return SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf) ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.Default; } } - private static RenderTextureFormat depthFormat { get { return SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RFloat) ? RenderTextureFormat.RFloat : RenderTextureFormat.RHalf; } } - private static RenderTextureFormat normalsFormat { get { return SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGB2101010) ? RenderTextureFormat.ARGB2101010 : RenderTextureFormat.Default; } } - private static bool isLinearColorSpace { get { return QualitySettings.activeColorSpace == ColorSpace.Linear; } } - private bool renderingInSceneView { get { return hbaoCamera.cameraType == CameraType.SceneView; } } - - private RenderTextureDescriptor m_sourceDescriptor; - private string[] m_ShaderKeywords; - private bool m_IsCommandBufferDirty; - private Mesh m_FullscreenTriangle; - private PipelineStage? m_PreviousPipelineStage; - private Resolution? m_PreviousResolution; - private Deinterleaving? m_PreviousDeinterleaving; - private DebugMode? m_PreviousDebugMode; - private NoiseType? m_PreviousNoiseType; - private BlurType? m_PreviousBlurAmount; - private int m_PreviousWidth; - private int m_PreviousHeight; - private bool m_PreviousAllowHDR; - private bool m_PreviousColorBleedingEnabled; - private bool m_PreviousTemporalFilterEnabled; - private RenderingPath m_PreviousRenderingPath; - - void OnEnable() - { - if (!SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth)) - { - Debug.LogWarning("HBAO shader is not supported on this platform."); - this.enabled = false; - return; - } - - if (hbaoShader == null) hbaoShader = Shader.Find("Hidden/HBAO"); - if (hbaoShader == null) - { - Debug.LogError("HBAO shader was not found..."); - return; - } - - if (!hbaoShader.isSupported) - { - Debug.LogWarning("HBAO shader is not supported on this platform."); - this.enabled = false; - return; - } - - Initialize(); - } - - void OnDisable() - { - ClearCommandBuffer(cmdBuffer); - - ReleaseHistoryBuffers(); - - if (material != null) - DestroyImmediate(material); - if (noiseTex != null) - DestroyImmediate(noiseTex); - if (fullscreenTriangle != null) - DestroyImmediate(fullscreenTriangle); - } - - void OnPreRender() - { - if (hbaoShader == null || hbaoCamera == null) return; - - FetchRenderParameters(); - CheckParameters(); - UpdateMaterialProperties(); - UpdateShaderKeywords(); - - if (isCommandBufferDirty) - { - ClearCommandBuffer(cmdBuffer); - BuildCommandBuffer(cmdBuffer, cameraEvent); - hbaoCamera.AddCommandBuffer(cameraEvent, cmdBuffer); - isCommandBufferDirty = false; - } - } - - void OnPostRender() - { - frameCount++; - } - - void OnValidate() - { - if (hbaoShader == null || hbaoCamera == null) return; - - CheckParameters(); - } - - private void Initialize() - { - m_sourceDescriptor = new RenderTextureDescriptor(0, 0); - - hbaoCamera = GetComponent(); - hbaoCamera.forceIntoRenderTexture = true; - - material = new Material(hbaoShader); - material.hideFlags = HideFlags.HideAndDontSave; - - // For platforms not supporting motion vectors texture - // https://docs.unity3d.com/ScriptReference/DepthTextureMode.MotionVectors.html - motionVectorsSupported = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGHalf); - - cmdBuffer = new CommandBuffer { name = "HBAO" }; - isCommandBufferDirty = true; - } - - private void FetchRenderParameters() - { -#if !UNITY_SWITCH && ENABLE_VR - if (hbaoCamera.stereoEnabled) - { - var xrDesc = XRSettings.eyeTextureDesc; - stereoRenderingMode = XRSettings.StereoRenderingMode.SinglePass; - numberOfEyes = 1; - - if (XRSettings.stereoRenderingMode == XRSettings.StereoRenderingMode.MultiPass) - stereoRenderingMode = XRSettings.StereoRenderingMode.MultiPass; - -#if UNITY_STANDALONE || UNITY_EDITOR || UNITY_PS4 - if (xrDesc.dimension == TextureDimension.Tex2DArray) - stereoRenderingMode = XRSettings.StereoRenderingMode.SinglePassInstanced; -#endif - - if (stereoRenderingMode == XRSettings.StereoRenderingMode.SinglePassInstanced) - numberOfEyes = 2; - - if (stereoRenderingMode == XRSettings.StereoRenderingMode.SinglePass) - { - numberOfEyes = 2; - //xrDesc.width /= 2; - xrDesc.vrUsage = VRTextureUsage.None; - } - - width = xrDesc.width; - height = xrDesc.height; - m_sourceDescriptor = xrDesc; - - if (hbaoCamera.stereoActiveEye == Camera.MonoOrStereoscopicEye.Right) - xrActiveEye = (int)Camera.StereoscopicEye.Right; - - screenWidth = XRSettings.eyeTextureWidth; - screenHeight = XRSettings.eyeTextureHeight; - - if (stereoRenderingMode == XRSettings.StereoRenderingMode.SinglePass) - screenWidth /= 2; - - stereoActive = true; - } - else -#endif - { - width = hbaoCamera.pixelWidth; - height = hbaoCamera.pixelHeight; - m_sourceDescriptor.width = width; - m_sourceDescriptor.height = height; - screenWidth = width; - screenHeight = height; - stereoActive = false; - numberOfEyes = 1; - } - - var downsamplingFactor = generalSettings.resolution == Resolution.Full ? 1 : generalSettings.deinterleaving == Deinterleaving.Disabled ? 2 : 1; - if (downsamplingFactor > 1) - { - aoWidth = (width + width % 2) / downsamplingFactor; - aoHeight = (height + height % 2) / downsamplingFactor; - } - else - { - aoWidth = width; - aoHeight = height; - } - - reinterleavedAoWidth = width + (width % 4 == 0 ? 0 : 4 - (width % 4)); - reinterleavedAoHeight = height + (height % 4 == 0 ? 0 : 4 - (height % 4)); - deinterleavedAoWidth = reinterleavedAoWidth / 4; - deinterleavedAoHeight = reinterleavedAoHeight / 4; - } - - private void AllocateHistoryBuffers() - { - ReleaseHistoryBuffers(); - - aoHistoryBuffer = GetScreenSpaceRT(widthOverride: aoWidth, heightOverride: aoHeight, colorFormat: colorFormat, readWrite: RenderTextureReadWrite.Linear); - if (colorBleedingSettings.enabled) - colorBleedingHistoryBuffer = GetScreenSpaceRT(widthOverride: aoWidth, heightOverride: aoHeight, colorFormat: colorFormat, readWrite: RenderTextureReadWrite.Linear); - - // Clear history buffers to default - var lastActive = RenderTexture.active; - RenderTexture.active = aoHistoryBuffer; - GL.Clear(false, true, Color.white); - if (colorBleedingSettings.enabled) - { - RenderTexture.active = colorBleedingHistoryBuffer; - GL.Clear(false, true, new Color(0, 0, 0, 1)); - } - RenderTexture.active = lastActive; - - frameCount = 0; - } - - private void ReleaseHistoryBuffers() - { - if (aoHistoryBuffer != null) - aoHistoryBuffer.Release(); - - if (colorBleedingHistoryBuffer != null) - colorBleedingHistoryBuffer.Release(); - } - - private void ClearCommandBuffer(CommandBuffer cmd) - { - if (cmd != null) - { - if (hbaoCamera != null) - { - hbaoCamera.RemoveCommandBuffer(CameraEvent.BeforeImageEffectsOpaque, cmd); - hbaoCamera.RemoveCommandBuffer(CameraEvent.AfterLighting, cmd); - hbaoCamera.RemoveCommandBuffer(CameraEvent.BeforeReflections, cmd); - } - cmd.Clear(); - } - } - - private void BuildCommandBuffer(CommandBuffer cmd, CameraEvent cameraEvent) - { - // AO - if (generalSettings.deinterleaving == Deinterleaving.Disabled) - { - GetScreenSpaceTemporaryRT(cmd, ShaderProperties.hbaoTex, widthOverride: aoWidth, heightOverride: aoHeight, colorFormat: colorFormat, readWrite: RenderTextureReadWrite.Linear); - AO(cmd); - } - else - { - GetScreenSpaceTemporaryRT(cmd, ShaderProperties.hbaoTex, widthOverride: reinterleavedAoWidth, heightOverride: reinterleavedAoHeight, colorFormat: colorFormat, readWrite: RenderTextureReadWrite.Linear); - DeinterleavedAO(cmd); - } - - // Blur - Blur(cmd); - - // Temporal Filter - TemporalFilter(cmd); - - // Composite - Composite(cmd, cameraEvent); - - ReleaseTemporaryRT(cmd, ShaderProperties.hbaoTex); - - //Debug.Log("CommandBuffer has been rebuilt"); - } - - private void AO(CommandBuffer cmd) - { - BlitFullscreenTriangleWithClear(cmd, BuiltinRenderTextureType.CameraTarget, ShaderProperties.hbaoTex, material, new Color(0, 0, 0, 1), Pass.AO); - } - - private void DeinterleavedAO(CommandBuffer cmd) - { - // Deinterleave depth & normals (4x4) - for (int i = 0; i < 4; i++) - { - var rtsDepth = new RenderTargetIdentifier[] { - ShaderProperties.depthSliceTex[(i << 2) + 0], - ShaderProperties.depthSliceTex[(i << 2) + 1], - ShaderProperties.depthSliceTex[(i << 2) + 2], - ShaderProperties.depthSliceTex[(i << 2) + 3] - }; - var rtsNormals = new RenderTargetIdentifier[] { - ShaderProperties.normalsSliceTex[(i << 2) + 0], - ShaderProperties.normalsSliceTex[(i << 2) + 1], - ShaderProperties.normalsSliceTex[(i << 2) + 2], - ShaderProperties.normalsSliceTex[(i << 2) + 3] - }; - - int offsetX = (i & 1) << 1; int offsetY = (i >> 1) << 1; - cmd.SetGlobalVector(ShaderProperties.deinterleaveOffset[0], new Vector2(offsetX + 0, offsetY + 0)); - cmd.SetGlobalVector(ShaderProperties.deinterleaveOffset[1], new Vector2(offsetX + 1, offsetY + 0)); - cmd.SetGlobalVector(ShaderProperties.deinterleaveOffset[2], new Vector2(offsetX + 0, offsetY + 1)); - cmd.SetGlobalVector(ShaderProperties.deinterleaveOffset[3], new Vector2(offsetX + 1, offsetY + 1)); - for (int j = 0; j < 4; j++) - { - GetScreenSpaceTemporaryRT(cmd, ShaderProperties.depthSliceTex[j + 4 * i], widthOverride: deinterleavedAoWidth, heightOverride: deinterleavedAoHeight, colorFormat: depthFormat, readWrite: RenderTextureReadWrite.Linear, filter: FilterMode.Point); - GetScreenSpaceTemporaryRT(cmd, ShaderProperties.normalsSliceTex[j + 4 * i], widthOverride: deinterleavedAoWidth, heightOverride: deinterleavedAoHeight, colorFormat: normalsFormat, readWrite: RenderTextureReadWrite.Linear, filter: FilterMode.Point); - } - BlitFullscreenTriangle(cmd, BuiltinRenderTextureType.CameraTarget, rtsDepth, material, Pass.Deinterleave_Depth); // outputs 4 render textures - BlitFullscreenTriangle(cmd, BuiltinRenderTextureType.CameraTarget, rtsNormals, material, Pass.Deinterleave_Normals); // outputs 4 render textures - } - - // AO on each layer - for (int i = 0; i < 4 * 4; i++) - { - cmd.SetGlobalTexture(ShaderProperties.depthTex, ShaderProperties.depthSliceTex[i]); - cmd.SetGlobalTexture(ShaderProperties.normalsTex, ShaderProperties.normalsSliceTex[i]); - cmd.SetGlobalVector(ShaderProperties.jitter, s_jitter[i]); - GetScreenSpaceTemporaryRT(cmd, ShaderProperties.aoSliceTex[i], widthOverride: deinterleavedAoWidth, heightOverride: deinterleavedAoHeight, colorFormat: colorFormat, readWrite: RenderTextureReadWrite.Linear, filter: FilterMode.Point); - BlitFullscreenTriangleWithClear(cmd, BuiltinRenderTextureType.CameraTarget, ShaderProperties.aoSliceTex[i], material, new Color(0, 0, 0, 1), Pass.AO_Deinterleaved); // ao - ReleaseTemporaryRT(cmd, ShaderProperties.depthSliceTex[i]); - ReleaseTemporaryRT(cmd, ShaderProperties.normalsSliceTex[i]); - } - - // Atlas Deinterleaved AO, 4x4 - GetScreenSpaceTemporaryRT(cmd, ShaderProperties.tempTex, widthOverride: reinterleavedAoWidth, heightOverride: reinterleavedAoHeight, colorFormat: colorFormat, readWrite: RenderTextureReadWrite.Linear); - for (int i = 0; i < 4 * 4; i++) - { - cmd.SetGlobalVector(ShaderProperties.atlasOffset, new Vector2(((i & 1) + (((i & 7) >> 2) << 1)) * deinterleavedAoWidth, (((i & 3) >> 1) + ((i >> 3) << 1)) * deinterleavedAoHeight)); - BlitFullscreenTriangle(cmd, ShaderProperties.aoSliceTex[i], ShaderProperties.tempTex, material, Pass.Atlas_AO_Deinterleaved); // atlassing - ReleaseTemporaryRT(cmd, ShaderProperties.aoSliceTex[i]); - } - - // Reinterleave AO - ApplyFlip(cmd); - BlitFullscreenTriangle(cmd, ShaderProperties.tempTex, ShaderProperties.hbaoTex, material, Pass.Reinterleave_AO); // reinterleave - ReleaseTemporaryRT(cmd, ShaderProperties.tempTex); - } - - private void Blur(CommandBuffer cmd) - { - if (blurSettings.type != BlurType.None) - { - GetScreenSpaceTemporaryRT(cmd, ShaderProperties.tempTex, widthOverride: aoWidth, heightOverride: aoHeight, colorFormat: colorFormat, readWrite: RenderTextureReadWrite.Linear); - cmd.SetGlobalVector(ShaderProperties.blurDeltaUV, new Vector2(1f / width, 0)); - BlitFullscreenTriangle(cmd, ShaderProperties.hbaoTex, ShaderProperties.tempTex, material, Pass.Blur); // blur X - cmd.SetGlobalVector(ShaderProperties.blurDeltaUV, new Vector2(0, 1f / height)); - BlitFullscreenTriangle(cmd, ShaderProperties.tempTex, ShaderProperties.hbaoTex, material, Pass.Blur); // blur Y - ReleaseTemporaryRT(cmd, ShaderProperties.tempTex); - } - } - - private void TemporalFilter(CommandBuffer cmd) - { - if (temporalFilterSettings.enabled && !renderingInSceneView) - { - AllocateHistoryBuffers(); - - if (colorBleedingSettings.enabled) - { - // For Color Bleeding we have 2 history buffers to fill so there are 2 render targets. - // AO is still contained in Color Bleeding history buffer (alpha channel) so that we - // can use it as a render texture for the composite pass. - var rts = new RenderTargetIdentifier[] { - aoHistoryBuffer, - colorBleedingHistoryBuffer - }; - GetScreenSpaceTemporaryRT(cmd, ShaderProperties.tempTex, widthOverride: aoWidth, heightOverride: aoHeight, colorFormat: colorFormat, readWrite: RenderTextureReadWrite.Linear); - GetScreenSpaceTemporaryRT(cmd, ShaderProperties.tempTex2, widthOverride: aoWidth, heightOverride: aoHeight, colorFormat: colorFormat, readWrite: RenderTextureReadWrite.Linear); - BlitFullscreenTriangle(cmd, aoHistoryBuffer, ShaderProperties.tempTex2, material, Pass.Copy); - BlitFullscreenTriangle(cmd, colorBleedingHistoryBuffer, ShaderProperties.tempTex, material, Pass.Copy); - BlitFullscreenTriangle(cmd, ShaderProperties.tempTex2, rts, material, Pass.Temporal_Filter); - ReleaseTemporaryRT(cmd, ShaderProperties.tempTex); - ReleaseTemporaryRT(cmd, ShaderProperties.tempTex2); - cmd.SetGlobalTexture(ShaderProperties.hbaoTex, colorBleedingHistoryBuffer); - } - else - { - // AO history buffer contains ao in aplha channel so we can just use history as - // a render texture for the composite pass. - GetScreenSpaceTemporaryRT(cmd, ShaderProperties.tempTex, widthOverride: aoWidth, heightOverride: aoHeight, colorFormat: colorFormat, readWrite: RenderTextureReadWrite.Linear); - BlitFullscreenTriangle(cmd, aoHistoryBuffer, ShaderProperties.tempTex, material, Pass.Copy); - BlitFullscreenTriangle(cmd, ShaderProperties.tempTex, aoHistoryBuffer, material, Pass.Temporal_Filter); - ReleaseTemporaryRT(cmd, ShaderProperties.tempTex); - cmd.SetGlobalTexture(ShaderProperties.hbaoTex, aoHistoryBuffer); - } - } - } - - private void Composite(CommandBuffer cmd, CameraEvent cameraEvent) - { - if (generalSettings.debugMode == DebugMode.Disabled) - { - if (cameraEvent == CameraEvent.BeforeReflections) - CompositeBeforeReflections(cmd); - else if (cameraEvent == CameraEvent.AfterLighting) - CompositeAfterLighting(cmd); - else // if (BeforeImageEffectsOpaque) - CompositeBeforeImageEffectsOpaque(cmd); - } - else // debug mode - CompositeBeforeImageEffectsOpaque(cmd, generalSettings.debugMode == DebugMode.ViewNormals ? Pass.Debug_ViewNormals : Pass.Composite); - } - - // Cases of BeforeReflections & AfterLighting - // If using HDR there’s no separate rendertarget being created for Emission+lighting buffer (RT3); - // instead the rendertarget that the Camera renders into (that is, the one that is passed to the image effects) is used as RT3. - // If non-HDR GBuffer3 texture is available. HDR uses ARGBHalf, non-HDR uses ARGB2101010 - // Emission + lighting buffer(RT3) is logarithmically encoded to provide greater dynamic range than is usually possible with - // an ARGB32 texture, when the Camera is not using HDR. - // https://docs.unity3d.com/Manual/RenderTech-DeferredShading.html - - private void CompositeBeforeReflections(CommandBuffer cmd) - { - var hdr = hbaoCamera.allowHDR; - var rts = new RenderTargetIdentifier[] { - BuiltinRenderTextureType.GBuffer0, // Albedo, Occ - hdr ? BuiltinRenderTextureType.CameraTarget : BuiltinRenderTextureType.GBuffer3 // Ambient - }; - GetScreenSpaceTemporaryRT(cmd, ShaderProperties.tempTex, colorFormat: RenderTextureFormat.ARGB32); - GetScreenSpaceTemporaryRT(cmd, ShaderProperties.tempTex2, colorFormat: hdr ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.ARGB2101010); - BlitFullscreenTriangle(cmd, rts[0], ShaderProperties.tempTex, material, Pass.Copy); - BlitFullscreenTriangle(cmd, rts[1], ShaderProperties.tempTex2, material, Pass.Copy); - BlitFullscreenTriangle(cmd, ShaderProperties.tempTex2, rts, material, Pass.Composite_BeforeReflections); - ReleaseTemporaryRT(cmd, ShaderProperties.tempTex); - ReleaseTemporaryRT(cmd, ShaderProperties.tempTex2); - } - - private void CompositeAfterLighting(CommandBuffer cmd) - { - var hdr = hbaoCamera.allowHDR; - var rt3 = hdr ? BuiltinRenderTextureType.CameraTarget : BuiltinRenderTextureType.GBuffer3; - GetScreenSpaceTemporaryRT(cmd, ShaderProperties.tempTex, colorFormat: hdr ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.ARGB2101010); - BlitFullscreenTriangle(cmd, rt3, ShaderProperties.tempTex, material, Pass.Copy); - BlitFullscreenTriangle(cmd, ShaderProperties.tempTex, rt3, material, Pass.Composite_AfterLighting); - ReleaseTemporaryRT(cmd, ShaderProperties.tempTex); - } - - private void CompositeBeforeImageEffectsOpaque(CommandBuffer cmd, int finalPassId = Pass.Composite) - { - // This pass can be used to display all debug mode as well - GetScreenSpaceTemporaryRT(cmd, ShaderProperties.tempTex, colorFormat: sourceFormat); - if (stereoActive && hbaoCamera.actualRenderingPath != RenderingPath.DeferredShading) - cmd.Blit(BuiltinRenderTextureType.CameraTarget, ShaderProperties.tempTex); - else - BlitFullscreenTriangle(cmd, BuiltinRenderTextureType.CameraTarget, ShaderProperties.tempTex, material, Pass.Copy); - ApplyFlip(cmd, SystemInfo.graphicsUVStartsAtTop); - BlitFullscreenTriangle(cmd, ShaderProperties.tempTex, BuiltinRenderTextureType.CameraTarget, material, finalPassId); - ReleaseTemporaryRT(cmd, ShaderProperties.tempTex); - } - - private void UpdateMaterialProperties() - { - //float tanHalfFovY = Mathf.Tan(0.5f * hbaoCamera.fieldOfView * Mathf.Deg2Rad); - //float invFocalLenX = 1.0f / (1.0f / tanHalfFovY * (screenHeight / (float)screenWidth)); - //float invFocalLenY = 1.0f / (1.0f / tanHalfFovY); - float invFocalLenX = 1.0f / hbaoCamera.projectionMatrix.m00; - float invFocalLenY = 1.0f / hbaoCamera.projectionMatrix.m11; - float maxRadInPixels = Mathf.Max(16, aoSettings.maxRadiusPixels * Mathf.Sqrt((screenWidth * numberOfEyes * screenHeight) / (1080.0f * 1920.0f))); - maxRadInPixels /= (generalSettings.deinterleaving == Deinterleaving.x4 ? 4 : 1); - - var targetScale = generalSettings.deinterleaving == Deinterleaving.x4 ? - new Vector4(reinterleavedAoWidth / (float)width, reinterleavedAoHeight / (float)height, 1.0f / (reinterleavedAoWidth / (float)width), 1.0f / (reinterleavedAoHeight / (float)height)) : - generalSettings.resolution == Resolution.Half /*&& aoSettings.perPixelNormals == PerPixelNormals.Reconstruct*/ ? - new Vector4((width + 0.5f) / width, (height + 0.5f) / height, 1f, 1f) : - Vector4.one; - - material.SetTexture(ShaderProperties.noiseTex, noiseTex); - material.SetVector(ShaderProperties.inputTexelSize, new Vector4(1f / width, 1f / height, width, height)); - material.SetVector(ShaderProperties.aoTexelSize, new Vector4(1f / aoWidth, 1f / aoHeight, aoWidth, aoHeight)); - material.SetVector(ShaderProperties.deinterleavedAOTexelSize, new Vector4(1.0f / deinterleavedAoWidth, 1.0f / deinterleavedAoHeight, deinterleavedAoWidth, deinterleavedAoHeight)); - material.SetVector(ShaderProperties.reinterleavedAOTexelSize, new Vector4(1f / reinterleavedAoWidth, 1f / reinterleavedAoHeight, reinterleavedAoWidth, reinterleavedAoHeight)); - material.SetVector(ShaderProperties.targetScale, targetScale); - material.SetVector(ShaderProperties.uvToView, new Vector4(2.0f * invFocalLenX, -2.0f * invFocalLenY, -1.0f * invFocalLenX, 1.0f * invFocalLenY)); - material.SetMatrix(ShaderProperties.worldToCameraMatrix, hbaoCamera.worldToCameraMatrix); - //material.SetFloat(ShaderProperties.radius, aoSettings.radius * 0.5f * ((screenHeight / (generalSettings.deinterleaving == Deinterleaving.x4 ? 4 : 1)) / (tanHalfFovY * 2.0f))); - material.SetFloat(ShaderProperties.radius, aoSettings.radius * 0.5f * ((screenHeight / (generalSettings.deinterleaving == Deinterleaving.x4 ? 4 : 1)) / (invFocalLenY * 2.0f))); - material.SetFloat(ShaderProperties.maxRadiusPixels, maxRadInPixels); - material.SetFloat(ShaderProperties.negInvRadius2, -1.0f / (aoSettings.radius * aoSettings.radius)); - material.SetFloat(ShaderProperties.angleBias, aoSettings.bias); - material.SetFloat(ShaderProperties.aoMultiplier, 2.0f * (1.0f / (1.0f - aoSettings.bias))); - material.SetFloat(ShaderProperties.intensity, isLinearColorSpace ? aoSettings.intensity : aoSettings.intensity * 0.454545454545455f); - material.SetColor(ShaderProperties.baseColor, aoSettings.baseColor); - material.SetFloat(ShaderProperties.multiBounceInfluence, aoSettings.multiBounceInfluence); - material.SetFloat(ShaderProperties.offscreenSamplesContrib, aoSettings.offscreenSamplesContribution); - material.SetFloat(ShaderProperties.maxDistance, aoSettings.maxDistance); - material.SetFloat(ShaderProperties.distanceFalloff, aoSettings.distanceFalloff); - material.SetFloat(ShaderProperties.blurSharpness, blurSettings.sharpness); - material.SetFloat(ShaderProperties.colorBleedSaturation, colorBleedingSettings.saturation); - material.SetFloat(ShaderProperties.albedoMultiplier, colorBleedingSettings.albedoMultiplier); - material.SetFloat(ShaderProperties.colorBleedBrightnessMask, colorBleedingSettings.brightnessMask); - material.SetVector(ShaderProperties.colorBleedBrightnessMaskRange, AdjustBrightnessMaskToGammaSpace(new Vector2(Mathf.Pow(colorBleedingSettings.brightnessMaskRange.x, 3), Mathf.Pow(colorBleedingSettings.brightnessMaskRange.y, 3)))); - material.SetVector(ShaderProperties.temporalParams, temporalFilterSettings.enabled && !renderingInSceneView ? new Vector2(s_temporalRotations[frameCount % 6] / 360.0f, s_temporalOffsets[frameCount % 4]) : Vector2.zero); - } - - private void UpdateShaderKeywords() - { - if (m_ShaderKeywords == null || m_ShaderKeywords.Length != 12) m_ShaderKeywords = new string[12]; - - m_ShaderKeywords[0] = ShaderProperties.GetOrthographicOrDeferredKeyword(hbaoCamera.orthographic, generalSettings); - m_ShaderKeywords[1] = ShaderProperties.GetQualityKeyword(generalSettings); - m_ShaderKeywords[2] = ShaderProperties.GetNoiseKeyword(generalSettings); - m_ShaderKeywords[3] = ShaderProperties.GetDeinterleavingKeyword(generalSettings); - m_ShaderKeywords[4] = ShaderProperties.GetDebugKeyword(generalSettings); - m_ShaderKeywords[5] = ShaderProperties.GetMultibounceKeyword(aoSettings); - m_ShaderKeywords[6] = ShaderProperties.GetOffscreenSamplesContributionKeyword(aoSettings); - m_ShaderKeywords[7] = ShaderProperties.GetPerPixelNormalsKeyword(aoSettings); - m_ShaderKeywords[8] = ShaderProperties.GetBlurRadiusKeyword(blurSettings); - m_ShaderKeywords[9] = ShaderProperties.GetVarianceClippingKeyword(temporalFilterSettings); - m_ShaderKeywords[10] = ShaderProperties.GetColorBleedingKeyword(colorBleedingSettings); - m_ShaderKeywords[11] = ShaderProperties.GetLightingLogEncodedKeyword(hbaoCamera.allowHDR); - - material.shaderKeywords = m_ShaderKeywords; - } - - private void CheckParameters() - { - // Camera textures - hbaoCamera.depthTextureMode |= DepthTextureMode.Depth; - if (aoSettings.perPixelNormals == PerPixelNormals.Camera) - hbaoCamera.depthTextureMode |= DepthTextureMode.DepthNormals; - if (temporalFilterSettings.enabled) - hbaoCamera.depthTextureMode |= DepthTextureMode.MotionVectors; - - // Settings to force - if (hbaoCamera.actualRenderingPath != RenderingPath.DeferredShading && aoSettings.perPixelNormals == PerPixelNormals.GBuffer) - SetAoPerPixelNormals(PerPixelNormals.Camera); - - if (generalSettings.deinterleaving != Deinterleaving.Disabled && SystemInfo.supportedRenderTargetCount < 4) - SetDeinterleaving(Deinterleaving.Disabled); - - if (generalSettings.pipelineStage != PipelineStage.BeforeImageEffectsOpaque && hbaoCamera.actualRenderingPath != RenderingPath.DeferredShading) - SetPipelineStage(PipelineStage.BeforeImageEffectsOpaque); - - if (generalSettings.pipelineStage != PipelineStage.BeforeImageEffectsOpaque && aoSettings.perPixelNormals == PerPixelNormals.Camera) - SetAoPerPixelNormals(PerPixelNormals.GBuffer); - - if (stereoActive && hbaoCamera.actualRenderingPath != RenderingPath.DeferredShading && aoSettings.perPixelNormals != PerPixelNormals.Reconstruct) - SetAoPerPixelNormals(PerPixelNormals.Reconstruct); - - if (temporalFilterSettings.enabled && !motionVectorsSupported) - EnableTemporalFilter(false); - - if (colorBleedingSettings.enabled && temporalFilterSettings.enabled && SystemInfo.supportedRenderTargetCount < 2) - EnableTemporalFilter(false); - - // Noise texture - if (noiseTex == null || m_PreviousNoiseType != generalSettings.noiseType) - { - if (noiseTex != null) DestroyImmediate(noiseTex); - - CreateNoiseTexture(); - - m_PreviousNoiseType = generalSettings.noiseType; - } - } - - private RenderTextureDescriptor GetDefaultDescriptor(int depthBufferBits = 0, RenderTextureFormat colorFormat = RenderTextureFormat.Default, RenderTextureReadWrite readWrite = RenderTextureReadWrite.Default) - { - var modifiedDesc = new RenderTextureDescriptor(m_sourceDescriptor.width, m_sourceDescriptor.height, - m_sourceDescriptor.colorFormat, depthBufferBits); - modifiedDesc.dimension = m_sourceDescriptor.dimension; - modifiedDesc.volumeDepth = m_sourceDescriptor.volumeDepth; - modifiedDesc.vrUsage = m_sourceDescriptor.vrUsage; - modifiedDesc.msaaSamples = m_sourceDescriptor.msaaSamples; - modifiedDesc.memoryless = m_sourceDescriptor.memoryless; - - modifiedDesc.useMipMap = m_sourceDescriptor.useMipMap; - modifiedDesc.autoGenerateMips = m_sourceDescriptor.autoGenerateMips; - modifiedDesc.enableRandomWrite = m_sourceDescriptor.enableRandomWrite; - modifiedDesc.shadowSamplingMode = m_sourceDescriptor.shadowSamplingMode; - - if (hbaoCamera.allowDynamicResolution) - modifiedDesc.useDynamicScale = true; - - if (colorFormat != RenderTextureFormat.Default) - modifiedDesc.colorFormat = colorFormat; - - if (readWrite == RenderTextureReadWrite.sRGB) - modifiedDesc.sRGB = true; - else if (readWrite == RenderTextureReadWrite.Linear) - modifiedDesc.sRGB = false; - else if (readWrite == RenderTextureReadWrite.Default) - modifiedDesc.sRGB = isLinearColorSpace; - - return modifiedDesc; - } - - private RenderTexture GetScreenSpaceRT(int depthBufferBits = 0, RenderTextureFormat colorFormat = RenderTextureFormat.Default, RenderTextureReadWrite readWrite = RenderTextureReadWrite.Default, - FilterMode filter = FilterMode.Bilinear, int widthOverride = 0, int heightOverride = 0) - { - var desc = GetDefaultDescriptor(depthBufferBits, colorFormat, readWrite); - if (widthOverride > 0) - desc.width = widthOverride; - if (heightOverride > 0) - desc.height = heightOverride; - - //intermediates in VR are unchanged - if (stereoActive && desc.dimension == TextureDimension.Tex2DArray) - desc.dimension = TextureDimension.Tex2D; - - var rt = new RenderTexture(desc); - rt.filterMode = filter; - return rt; - } - - private void GetScreenSpaceTemporaryRT(CommandBuffer cmd, int nameID, - int depthBufferBits = 0, RenderTextureFormat colorFormat = RenderTextureFormat.Default, RenderTextureReadWrite readWrite = RenderTextureReadWrite.Default, - FilterMode filter = FilterMode.Bilinear, int widthOverride = 0, int heightOverride = 0) - { - var desc = GetDefaultDescriptor(depthBufferBits, colorFormat, readWrite); - if (widthOverride > 0) - desc.width = widthOverride; - if (heightOverride > 0) - desc.height = heightOverride; - - //intermediates in VR are unchanged - if (stereoActive && desc.dimension == TextureDimension.Tex2DArray) - desc.dimension = TextureDimension.Tex2D; - - cmd.GetTemporaryRT(nameID, desc, filter); - } - - private void ReleaseTemporaryRT(CommandBuffer cmd, int nameID) - { - cmd.ReleaseTemporaryRT(nameID); - } - - private void BlitFullscreenTriangle(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier destination, Material material, int pass = 0) - { - cmd.SetGlobalTexture(ShaderProperties.mainTex, source); - cmd.SetRenderTarget(destination); - cmd.DrawMesh(fullscreenTriangle, Matrix4x4.identity, material, 0, pass); - } - - private void BlitFullscreenTriangle(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier[] destinations, Material material, int pass = 0) - { - cmd.SetGlobalTexture(ShaderProperties.mainTex, source); - cmd.SetRenderTarget(destinations, destinations[0]); - cmd.DrawMesh(fullscreenTriangle, Matrix4x4.identity, material, 0, pass); - } - - private void BlitFullscreenTriangleWithClear(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier destination, Material material, Color clearColor, int pass = 0) - { - cmd.SetGlobalTexture(ShaderProperties.mainTex, source); - cmd.SetRenderTarget(destination); - cmd.ClearRenderTarget(false, true, clearColor); - cmd.DrawMesh(fullscreenTriangle, Matrix4x4.identity, material, 0, pass); - } - - private static void ApplyFlip(CommandBuffer cmd, bool flip = true) - { - if (flip) - cmd.SetGlobalVector(ShaderProperties.uvTransform, new Vector4(1f, -1f, 0f, 1f)); - else - cmd.SetGlobalVector(ShaderProperties.uvTransform, new Vector4(1f, 1f, 0f, 0f)); - } - - private static Vector2 AdjustBrightnessMaskToGammaSpace(Vector2 v) - { - return isLinearColorSpace ? v : ToGammaSpace(v); - } - - private static float ToGammaSpace(float v) - { - return Mathf.Pow(v, 0.454545454545455f); - } - - private static Vector2 ToGammaSpace(Vector2 v) - { - return new Vector2(ToGammaSpace(v.x), ToGammaSpace(v.y)); - } - - private void CreateNoiseTexture() - { - noiseTex = new Texture2D(4, 4, SystemInfo.SupportsTextureFormat(TextureFormat.RGHalf) ? TextureFormat.RGHalf : TextureFormat.RGB24, false, true); - noiseTex.filterMode = FilterMode.Point; - noiseTex.wrapMode = TextureWrapMode.Repeat; - int z = 0; - for (int x = 0; x < 4; ++x) - { - for (int y = 0; y < 4; ++y) - { - float r1 = generalSettings.noiseType != NoiseType.Dither ? 0.25f * (0.0625f * ((x + y & 3) << 2) + (x & 3)) : MersenneTwister.Numbers[z++]; - float r2 = generalSettings.noiseType != NoiseType.Dither ? 0.25f * ((y - x) & 3) : MersenneTwister.Numbers[z++]; - Color color = new Color(r1, r2, 0); - noiseTex.SetPixel(x, y, color); - } - } - noiseTex.Apply(); - - for (int i = 0, j = 0; i < s_jitter.Length; ++i) - { - float r1 = MersenneTwister.Numbers[j++]; - float r2 = MersenneTwister.Numbers[j++]; - s_jitter[i] = new Vector2(r1, r2); - } - } - } -} diff --git a/Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.cs.meta b/Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.cs.meta deleted file mode 100644 index 06c586eb..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.cs.meta +++ /dev/null @@ -1,14 +0,0 @@ -fileFormatVersion: 2 -guid: e1580e32f765c994b86a57bb3c49fe75 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: - - noiseTex: {instanceID: 0} - - quadMesh: {instanceID: 0} - - hbaoShader: {fileID: 4800000, guid: 7b834eafaedd0d842bb05a969d9d14bd, type: 3} - executionOrder: 0 - icon: {fileID: 2800000, guid: 6daa87e2aaa1bb04d930ca4b4bc926a7, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo.meta b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo.meta deleted file mode 100644 index 35e82c6a..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 77627965239b49c4db3d57d344cb7b8f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Demo.unity b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Demo.unity deleted file mode 100644 index 47a3f3dd..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Demo.unity +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:248402325ecf6bdfbfb816b410e0c18b5995f80d1b9e0690f777a468431886cf -size 62217 diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Post Process Volume Profile.asset b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Post Process Volume Profile.asset deleted file mode 100644 index 8caf89cf..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Post Process Volume Profile.asset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3c817e20a7adfd3dcd9d5b8335551b214a8b7b563bccd47ddb7e5417fbd04421 -size 5284 diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs.meta b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs.meta deleted file mode 100644 index 5e60da98..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: bcc72c6af57f7c143aa431b0886b0937 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs/Dragons Candle.prefab b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs/Dragons Candle.prefab deleted file mode 100644 index 956f19a8..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs/Dragons Candle.prefab +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9092d30789090db3e4131c759053118e94fc2c33a20d3be5cf1111816ce16e4b -size 2814 diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime.meta b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime.meta deleted file mode 100644 index 914c0699..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9953f3228182b364e8eb030d0c44cd09 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAO.Demo.Universal.Runtime.asmdef b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAO.Demo.Universal.Runtime.asmdef deleted file mode 100644 index ce087aca..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAO.Demo.Universal.Runtime.asmdef +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "HBAO.Demo.Universal.Runtime", - "references": [ - "GUID:09d385cb911270749b709e1bb48e9ea1", - "GUID:df380645f10b7bc4b97d4f5eb6303d95" - ], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [ - "UNITY_2019_3_OR_NEWER" - ], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAO.Demo.Universal.Runtime.asmdef.meta b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAO.Demo.Universal.Runtime.asmdef.meta deleted file mode 100644 index f8365442..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAO.Demo.Universal.Runtime.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 611af4d5a827be644a4876b4cb89fb6b -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAOControl.cs b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAOControl.cs deleted file mode 100644 index 49fb9a1d..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAOControl.cs +++ /dev/null @@ -1,61 +0,0 @@ -using UnityEngine; -using UnityEngine.Rendering; - -namespace HorizonBasedAmbientOcclusion.Universal -{ - public class HBAOControl : MonoBehaviour - { - public VolumeProfile postProcessProfile; - public UnityEngine.UI.Slider aoRadiusSlider; - - private bool m_HbaoDisplayed = true; - - public void Start() - { - HBAO hbao; - postProcessProfile.TryGet(out hbao); - - if (hbao != null) - { - hbao.EnableHBAO(true); - hbao.SetDebugMode(HBAO.DebugMode.Disabled); - hbao.SetAoRadius(aoRadiusSlider.value); - } - } - - public void ToggleHBAO() - { - HBAO hbao; - postProcessProfile.TryGet(out hbao); - - if (hbao != null) - { - m_HbaoDisplayed = !m_HbaoDisplayed; - hbao.EnableHBAO(m_HbaoDisplayed); - } - } - - public void ToggleShowAO() - { - HBAO hbao; - postProcessProfile.TryGet(out hbao); - - if (hbao != null) - { - if (hbao.GetDebugMode() != HBAO.DebugMode.Disabled) - hbao.SetDebugMode(HBAO.DebugMode.Disabled); - else - hbao.SetDebugMode(HBAO.DebugMode.AOOnly); - } - } - - public void UpdateAoRadius() - { - HBAO hbao; - postProcessProfile.TryGet(out hbao); - - if (hbao != null) - hbao.SetAoRadius(aoRadiusSlider.value); - } - } -} diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/RotateObject.cs b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/RotateObject.cs deleted file mode 100644 index 1f95f66c..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/RotateObject.cs +++ /dev/null @@ -1,19 +0,0 @@ -using UnityEngine; - -namespace HorizonBasedAmbientOcclusion.Universal -{ - public class RotateObject : MonoBehaviour - { - // Use this for initialization - void Start() - { - - } - - // Update is called once per frame - void Update() - { - transform.Rotate(Vector3.up * Time.deltaTime * 15.0f, Space.World); - } - } -} diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAO.Universal.Editor.asmdef b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAO.Universal.Editor.asmdef deleted file mode 100644 index b42e6502..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAO.Universal.Editor.asmdef +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "HBAO.Universal.Editor", - "rootNamespace": "", - "references": [ - "GUID:09d385cb911270749b709e1bb48e9ea1", - "GUID:df380645f10b7bc4b97d4f5eb6303d95", - "GUID:3eae0364be2026648bf74846acb8a731" - ], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [ - { - "name": "com.unity.render-pipelines.universal", - "expression": "10.0.0-preview", - "define": "URP_10_0_0_OR_NEWER" - } - ], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAO.Universal.Editor.asmdef.meta b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAO.Universal.Editor.asmdef.meta deleted file mode 100644 index a0d56946..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAO.Universal.Editor.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: f352a4e1c986a0b4e8661cfff9c14881 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAOEditor.cs b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAOEditor.cs deleted file mode 100644 index 556c2b61..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAOEditor.cs +++ /dev/null @@ -1,336 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using UnityEditor; -using UnityEditor.Rendering; -using UnityEngine; -using UnityEngine.Rendering; - -namespace HorizonBasedAmbientOcclusion.Universal -{ - [VolumeComponentEditor(typeof(HBAO))] - public class HBAOEditor : VolumeComponentEditor - { - private HBAO m_HBAO; - private Texture2D m_HBAOTex; - private GUIStyle m_SettingsGroupStyle; - private GUIStyle m_TitleLabelStyle; - private int m_SelectedPreset; - private PropertyFetcher m_PropertyFetcher; - - // settings group - private Dictionary> m_GroupFields = new Dictionary>(); - private readonly Dictionary m_Presets = new Dictionary() - { - { 0, HBAO.Preset.Normal }, - { 1, HBAO.Preset.FastPerformance }, - { 2, HBAO.Preset.FastestPerformance }, - { 3, HBAO.Preset.Custom }, - { 4, HBAO.Preset.HighQuality }, - { 5, HBAO.Preset.HighestQuality } - }; - -#if UNITY_2021_2_OR_NEWER - public override bool hasAdditionalProperties => false; -#else - public override bool hasAdvancedMode => false; -#endif - - public override void OnEnable() - { - base.OnEnable(); - - m_HBAO = (HBAO)target; - m_HBAOTex = Resources.Load("hbao_urp"); - - //var o = new PropertyFetcher(serializedObject); - m_PropertyFetcher = new PropertyFetcher(serializedObject); - - - var settings = m_HBAO.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance) - .Where(t => t.FieldType.IsSubclassOf(typeof(VolumeParameter))) - .Where(t => (t.IsPublic && t.GetCustomAttributes(typeof(NonSerializedAttribute), false).Length == 0) || - (t.GetCustomAttributes(typeof(SerializeField), false).Length > 0)) - .Where(t => t.GetCustomAttributes(typeof(HideInInspector), false).Length == 0) - .Where(t => t.GetCustomAttributes(typeof(HBAO.SettingsGroup), false).Any()); - foreach (var setting in settings) - { - //Debug.Log("setting name: " + setting.Name); - - foreach (var attr in setting.GetCustomAttributes(typeof(HBAO.SettingsGroup)) as IEnumerable) - { - if (!m_GroupFields.ContainsKey(attr)) - m_GroupFields[attr] = new List(); - - m_GroupFields[attr].Add(setting); - } - } - - m_SelectedPreset = m_Presets.Values.ToList().IndexOf(m_HBAO.GetCurrentPreset()); - } - - public override void OnInspectorGUI() - { - serializedObject.Update(); - - SetStyles(); - - EditorGUILayout.BeginVertical(); - { - // header - GUILayout.Space(10.0f); - GUILayout.Label(m_HBAOTex, m_TitleLabelStyle, GUILayout.ExpandWidth(true)); - - //if (m_HBAO.GetComponents()[0] != m_HBAO) - //{ - //GUILayout.Space(6.0f); - //EditorGUILayout.HelpBox("This Post FX should be one of the first in your effect stack", MessageType.Info); - //} - - Event e = Event.current; - - // settings groups - foreach (var group in m_GroupFields) - { - GUILayout.Space(6.0f); - Rect rect = GUILayoutUtility.GetRect(16f, 22f, m_SettingsGroupStyle); - GUI.Box(rect, ObjectNames.NicifyVariableName(group.Key.GetType().Name), m_SettingsGroupStyle); - if (e.type == EventType.MouseDown && rect.Contains(e.mousePosition)) - { - group.Key.isExpanded = !group.Key.isExpanded; - e.Use(); - } - - if (!group.Key.isExpanded) - continue; - - // presets is a special case - if (group.Key.GetType() == typeof(HBAO.Presets)) - { - GUILayout.Space(6.0f); - m_SelectedPreset = GUILayout.SelectionGrid(m_SelectedPreset, m_Presets.Values.Select(x => ObjectNames.NicifyVariableName(x.ToString())).ToArray(), 3); - GUILayout.Space(6.0f); - if (GUILayout.Button("Apply Preset")) - { - Undo.RecordObject(target, "Apply Preset"); - m_HBAO.ApplyPreset(m_Presets[m_SelectedPreset]); - EditorUtility.SetDirty(target); - /*if (!EditorApplication.isPlaying) - { - UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene()); - }*/ - } - - continue; - } - - foreach (var field in group.Value) - { - // warn about URP10+ required when mode is LitAO - if (group.Key.GetType() == typeof(HBAO.GeneralSettings) && field.Name == "renderingPath") - { - if (m_HBAO.mode.overrideState && m_HBAO.mode.value == HBAO.Mode.LitAO) - { -#if !URP_10_0_0_OR_NEWER - GUILayout.Space(6.0f); - EditorGUILayout.HelpBox("LitAO mode requires URP 10 or newer!", MessageType.Warning); -#endif - } -#if UNITY_2021_2_OR_NEWER - else continue; // hides rendering path settings when not LitAO -#else - continue; // hides rendering path before URP12 -#endif - } - - // hide resolution when deinterleaved HBAO is on - if (group.Key.GetType() == typeof(HBAO.GeneralSettings) && field.Name == "resolution") - { - if (m_HBAO.deinterleaving.overrideState && m_HBAO.GetDeinterleaving() != HBAO.Deinterleaving.Disabled) - { - continue; - } - } - // warn about deinterleaving not supported with SPSR - /*else if (group.Key.GetType() == typeof(HBAO.GeneralSettings) && field.Name == "debugMode") - { - if (m_HBAO.GetDeinterleaving() != HBAO.Deinterleaving.Disabled && - IsVrRunning() && PlayerSettings.stereoRenderingPath == StereoRenderingPath.SinglePass) - { - GUILayout.Space(6.0f); - EditorGUILayout.HelpBox("Deinterleaving is not supported with Single Pass Stereo Rendering...", MessageType.Warning); - } - }*/ - // hide noise type when deinterleaved HBAO is on - else if (group.Key.GetType() == typeof(HBAO.GeneralSettings) && field.Name == "noiseType") - { - if (m_HBAO.deinterleaving.overrideState && m_HBAO.GetDeinterleaving() != HBAO.Deinterleaving.Disabled) - { - continue; - } - } - // warn about HBAO being disabled by default - else if (group.Key.GetType() == typeof(HBAO.AOSettings) && field.Name == "radius") - { - if (m_HBAO.intensity.overrideState == false) - { - GUILayout.Space(6.0f); - EditorGUILayout.HelpBox("The effect is disabled by default, you need to override intensity value in order to enable HBAO.", MessageType.Warning); - } - } - // hide useMultiBounce setting when mode is LitAO - else if (group.Key.GetType() == typeof(HBAO.AOSettings) && field.Name == "useMultiBounce") - { - if (m_HBAO.mode.overrideState && m_HBAO.mode.value == HBAO.Mode.LitAO) - { - continue; - } - } - // hide multiBounceInfluence setting when not used or when mode is LitAO - else if (group.Key.GetType() == typeof(HBAO.AOSettings) && field.Name == "multiBounceInfluence") - { - if (!m_HBAO.useMultiBounce.overrideState || !m_HBAO.UseMultiBounce() || - (m_HBAO.mode.overrideState && m_HBAO.mode.value == HBAO.Mode.LitAO)) - { - continue; - } - } - // hide directLightingStrength setting when mode is normal - else if (group.Key.GetType() == typeof(HBAO.AOSettings) && field.Name == "directLightingStrength") - { - if (!m_HBAO.mode.overrideState || m_HBAO.mode.value == HBAO.Mode.Normal) - { - continue; - } - } - // warn about distance falloff greater than max distance - else if (group.Key.GetType() == typeof(HBAO.AOSettings) && field.Name == "perPixelNormals") - { - if ((m_HBAO.distanceFalloff.overrideState || m_HBAO.maxDistance.overrideState) && m_HBAO.GetAoDistanceFalloff() > m_HBAO.GetAoMaxDistance()) - { - GUILayout.Space(6.0f); - EditorGUILayout.HelpBox("Distance Falloff shoudn't be superior to Max Distance", MessageType.Warning); - } - } - // warn about distance falloff greater than max distance - /*else if (group.Key.GetType() == typeof(HBAO.AOSettings) && field.Name == "baseColor") - { - if (m_HBAO.perPixelNormals.overrideState && m_HBAO.GetAoPerPixelNormals() == HBAO.PerPixelNormals.Camera) - { - GUILayout.Space(6.0f); - EditorGUILayout.HelpBox("Currently Universal Render Pipeline does not generate camera normals, awaiting support...", MessageType.Warning); - } - }*/ -#if !UNITY_2021_2_OR_NEWER - else if (group.Key.GetType() == typeof(HBAO.TemporalFilterSettings) && field.Name == "temporalFilterEnabled") - { - GUILayout.Space(6.0f); - EditorGUILayout.HelpBox("Requires motion vectors support available in 2021.2+", MessageType.Warning); - - if (m_HBAO.IsTemporalFilterEnabled()) - m_HBAO.EnableTemporalFilter(false); - } -#endif - else if (group.Key.GetType() == typeof(HBAO.ColorBleedingSettings) && field.Name == "colorBleedingEnabled") - { - if (m_HBAO.mode.overrideState && m_HBAO.mode.value == HBAO.Mode.LitAO) - { - GUILayout.Space(6.0f); - EditorGUILayout.HelpBox("Color bleeding can't be used in LitAO mode as AO is being injected into the lighting.", MessageType.Warning); - - if (m_HBAO.IsColorBleedingEnabled()) - m_HBAO.EnableColorBleeding(false); - } - } - - var parameter = Unpack(m_PropertyFetcher.Find(field.Name)); - var displayName = parameter.displayName; - var hasDisplayName = field.GetCustomAttributes(typeof(HBAO.ParameterDisplayName)).Any(); - if (hasDisplayName) - { - var displayNameAttribute = field.GetCustomAttributes(typeof(HBAO.ParameterDisplayName)).First() as HBAO.ParameterDisplayName; - displayName = displayNameAttribute.name; - } - - PropertyField(parameter, new GUIContent(displayName)); - } - - GUILayout.Space(6.0f); - } - } - EditorGUILayout.EndVertical(); - - serializedObject.ApplyModifiedProperties(); - } - - private void SetStyles() - { - // set banner label style - m_TitleLabelStyle = new GUIStyle(GUI.skin.label); - m_TitleLabelStyle.alignment = TextAnchor.MiddleCenter; - m_TitleLabelStyle.contentOffset = new Vector2(0f, 0f); - - // get shuriken module title style - GUIStyle skurikenModuleTitleStyle = "ShurikenModuleTitle"; - - // clone it as to not interfere with the original, and adjust it - m_SettingsGroupStyle = new GUIStyle(skurikenModuleTitleStyle); - m_SettingsGroupStyle.font = (new GUIStyle("Label")).font; - m_SettingsGroupStyle.fontStyle = FontStyle.Bold; - m_SettingsGroupStyle.border = new RectOffset(15, 7, 4, 4); - m_SettingsGroupStyle.fixedHeight = 22; - m_SettingsGroupStyle.contentOffset = new Vector2(10f, -2f); - } - - List displaysDescs = new List(); - List displays = new List(); - - private bool IsVrRunning() - { - bool vrIsRunning = false; - displays.Clear(); - SubsystemManager.GetSubsystems(displays); - foreach (var displaySubsystem in displays) - { - if (displaySubsystem.running) - { - vrIsRunning = true; - break; - } - } - - return vrIsRunning; - } - - [VolumeParameterDrawer(typeof(HBAO.MinMaxFloatParameter))] - public class MaxFloatParameterDrawer : VolumeParameterDrawer - { - public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) - { - if (parameter.value.propertyType == SerializedPropertyType.Vector2) - { - var o = parameter.GetObjectRef(); - var range = o.value; - float x = range.x; - float y = range.y; - - EditorGUI.BeginChangeCheck(); - EditorGUILayout.MinMaxSlider(title, ref x, ref y, o.min, o.max); - if (EditorGUI.EndChangeCheck()) - { - range.x = x; - range.y = y; - o.SetValue(new HBAO.MinMaxFloatParameter(range, o.min, o.max)); - } - return true; - } - else - { - EditorGUILayout.LabelField(title, "Use only with Vector2"); - return false; - } - } - } - } -} diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources/hbao_urp.png b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources/hbao_urp.png deleted file mode 100644 index b939917c..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources/hbao_urp.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d959bb0d5fdf2696a8841515e51a9d68214601cd40f70407bfe69c92667ab7dc -size 8881 diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime.meta b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime.meta deleted file mode 100644 index 9686f3fd..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1f906a4e3c3820d4a9e15a21943c91ed -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.Universal.Runtime.asmdef b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.Universal.Runtime.asmdef deleted file mode 100644 index ec06d0f2..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.Universal.Runtime.asmdef +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "HBAO.Universal.Runtime", - "references": [ - "GUID:df380645f10b7bc4b97d4f5eb6303d95", - "GUID:15fc0a57446b3144c949da3e2b9737a9" - ], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [ - "UNITY_2019_3_OR_NEWER" - ], - "versionDefines": [ - { - "name": "com.unity.render-pipelines.universal", - "expression": "10.0.0-preview", - "define": "URP_10_0_0_OR_NEWER" - } - ], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.Universal.Runtime.asmdef.meta b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.Universal.Runtime.asmdef.meta deleted file mode 100644 index 9df0d616..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.Universal.Runtime.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 09d385cb911270749b709e1bb48e9ea1 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.cs b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.cs deleted file mode 100644 index 2a56c790..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.cs +++ /dev/null @@ -1,631 +0,0 @@ -using System; -using UnityEngine; -using UnityEngine.Rendering; -using UnityEngine.Rendering.Universal; - -namespace HorizonBasedAmbientOcclusion.Universal -{ - [ExecuteInEditMode, VolumeComponentMenu("Lighting/HBAO")] - public class HBAO : VolumeComponent, IPostProcessComponent - { - public enum Preset - { - FastestPerformance, - FastPerformance, - Normal, - HighQuality, - HighestQuality, - Custom - } - - public enum Mode - { - Normal, - LitAO - } - - public enum RenderingPath - { - Forward, - Deferred - } - - public enum Quality - { - Lowest, - Low, - Medium, - High, - Highest - } - - public enum Resolution - { - Full, - Half - } - - public enum NoiseType - { - Dither, - InterleavedGradientNoise, - SpatialDistribution - } - - public enum Deinterleaving - { - Disabled, - x4 - } - - public enum DebugMode - { - Disabled, - AOOnly, - ColorBleedingOnly, - SplitWithoutAOAndWithAO, - SplitWithAOAndAOOnly, - SplitWithoutAOAndAOOnly, - ViewNormals - } - - public enum BlurType - { - None, - Narrow, - Medium, - Wide, - ExtraWide - } - - public enum PerPixelNormals - { - Reconstruct2Samples, - Reconstruct4Samples, - Camera - } - - public enum VarianceClipping - { - Disabled, - _4Tap, - _8Tap - } - - [Serializable] - public sealed class PresetParameter : VolumeParameter - { - public PresetParameter(Preset value, bool overrideState = false) - : base(value, overrideState) { } - } - - [Serializable] - public sealed class ModeParameter : VolumeParameter - { - public ModeParameter(Mode value, bool overrideState = false) - : base(value, overrideState) { } - } - - [Serializable] - public sealed class RenderingPathParameter : VolumeParameter - { - public RenderingPathParameter(RenderingPath value, bool overrideState = false) - : base(value, overrideState) { } - } - - [Serializable] - public sealed class QualityParameter : VolumeParameter - { - public QualityParameter(Quality value, bool overrideState = false) - : base(value, overrideState) { } - } - - [Serializable] - public sealed class DeinterleavingParameter : VolumeParameter - { - public DeinterleavingParameter(Deinterleaving value, bool overrideState = false) - : base(value, overrideState) { } - } - - [Serializable] - public sealed class ResolutionParameter : VolumeParameter - { - public ResolutionParameter(Resolution value, bool overrideState = false) - : base(value, overrideState) { } - } - - [Serializable] - public sealed class NoiseTypeParameter : VolumeParameter - { - public NoiseTypeParameter(NoiseType value, bool overrideState = false) - : base(value, overrideState) { } - } - - [Serializable] - public sealed class DebugModeParameter : VolumeParameter - { - public DebugModeParameter(DebugMode value, bool overrideState = false) - : base(value, overrideState) { } - } - - [Serializable] - public sealed class PerPixelNormalsParameter : VolumeParameter - { - public PerPixelNormalsParameter(PerPixelNormals value, bool overrideState = false) - : base(value, overrideState) { } - } - - [Serializable] - public sealed class VarianceClippingParameter : VolumeParameter - { - public VarianceClippingParameter(VarianceClipping value, bool overrideState = false) - : base(value, overrideState) { } - } - - [Serializable] - public sealed class BlurTypeParameter : VolumeParameter - { - public BlurTypeParameter(BlurType value, bool overrideState = false) - : base(value, overrideState) { } - } - - [Serializable] - public sealed class MinMaxFloatParameter : VolumeParameter - { - public float min; - public float max; - - public MinMaxFloatParameter(Vector2 value, float min, float max, bool overrideState = false) - : base(value, overrideState) - { - this.min = min; - this.max = max; - } - } - - [AttributeUsage(AttributeTargets.Field)] - public class SettingsGroup : Attribute - { - public bool isExpanded = true; - } - - [AttributeUsage(AttributeTargets.Field)] - public class ParameterDisplayName : Attribute - { - public string name; - - public ParameterDisplayName(string name) - { - this.name = name; - } - } - - public class Presets : SettingsGroup { } - public class GeneralSettings : SettingsGroup { } - public class AOSettings : SettingsGroup { } - public class TemporalFilterSettings : SettingsGroup { } - public class BlurSettings : SettingsGroup { } - public class ColorBleedingSettings : SettingsGroup { } - - [Presets] - public PresetParameter preset = new PresetParameter(Preset.Normal); - - [Tooltip("The mode of the AO.")] - [GeneralSettings, Space(6)] - public ModeParameter mode = new ModeParameter(Mode.Normal); - [Tooltip("The rendering path used for AO. Temporary settings as for now rendering path is internal to renderer settings.")] - [GeneralSettings, Space(6)] - public RenderingPathParameter renderingPath = new RenderingPathParameter(RenderingPath.Forward); - [Tooltip("The quality of the AO.")] - [GeneralSettings, Space(6)] - public QualityParameter quality = new QualityParameter(Quality.Medium); - [Tooltip("The deinterleaving factor.")] - [GeneralSettings] - public DeinterleavingParameter deinterleaving = new DeinterleavingParameter(Deinterleaving.Disabled); - [Tooltip("The resolution at which the AO is calculated.")] - [GeneralSettings] - public ResolutionParameter resolution = new ResolutionParameter(Resolution.Full); - [Tooltip("The type of noise to use.")] - [GeneralSettings, Space(10)] - public NoiseTypeParameter noiseType = new NoiseTypeParameter(NoiseType.Dither); - [Tooltip("The debug mode actually displayed on screen.")] - [GeneralSettings, Space(10)] - public DebugModeParameter debugMode = new DebugModeParameter(DebugMode.Disabled); - - [Tooltip("AO radius: this is the distance outside which occluders are ignored.")] - [AOSettings, Space(6)] - public ClampedFloatParameter radius = new ClampedFloatParameter(0.8f, 0.25f, 5f); - [Tooltip("Maximum radius in pixels: this prevents the radius to grow too much with close-up " + - "object and impact on performances.")] - [AOSettings] - public ClampedFloatParameter maxRadiusPixels = new ClampedFloatParameter(128f, 16f, 256f); - [Tooltip("For low-tessellated geometry, occlusion variations tend to appear at creases and " + - "ridges, which betray the underlying tessellation. To remove these artifacts, we use " + - "an angle bias parameter which restricts the hemisphere.")] - [AOSettings] - public ClampedFloatParameter bias = new ClampedFloatParameter(0.05f, 0f, 0.5f); - [Tooltip("This value allows to scale up the ambient occlusion values.")] - [AOSettings] - public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0, 4f); - [Tooltip("Enable/disable MultiBounce approximation.")] - [AOSettings] - public BoolParameter useMultiBounce = new BoolParameter(false); - [Tooltip("MultiBounce approximation influence.")] - [AOSettings] - public ClampedFloatParameter multiBounceInfluence = new ClampedFloatParameter(1f, 0f, 1f); - [Tooltip("How much AO affect direct lighting.")] - [AOSettings] - public ClampedFloatParameter directLightingStrength = new ClampedFloatParameter(0.25f, 0, 1f); - [Tooltip("The amount of AO offscreen samples are contributing.")] - [AOSettings] - public ClampedFloatParameter offscreenSamplesContribution = new ClampedFloatParameter(0f, 0f, 1f); - [Tooltip("The max distance to display AO.")] - [AOSettings, Space(10)] - public FloatParameter maxDistance = new FloatParameter(150f); - [Tooltip("The distance before max distance at which AO start to decrease.")] - [AOSettings] - public FloatParameter distanceFalloff = new FloatParameter(50f); - [Tooltip("The type of per pixel normals to use.")] - [AOSettings, Space(10)] -#if URP_10_0_0_OR_NEWER - public PerPixelNormalsParameter perPixelNormals = new PerPixelNormalsParameter(PerPixelNormals.Camera); -#else - public PerPixelNormalsParameter perPixelNormals = new PerPixelNormalsParameter(PerPixelNormals.Reconstruct4Samples); -#endif - [Tooltip("This setting allow you to set the base color if the AO, the alpha channel value is unused.")] - [AOSettings, Space(10)] - public ColorParameter baseColor = new ColorParameter(Color.black); - - [TemporalFilterSettings, ParameterDisplayName("Enabled"), Space(6)] - public BoolParameter temporalFilterEnabled = new BoolParameter(false); - [Tooltip("The type of variance clipping to use.")] - [TemporalFilterSettings] - public VarianceClippingParameter varianceClipping = new VarianceClippingParameter(VarianceClipping._4Tap); - - [Tooltip("The type of blur to use.")] - [BlurSettings, ParameterDisplayName("Type"), Space(6)] - public BlurTypeParameter blurType = new BlurTypeParameter(BlurType.Medium); - - [Tooltip("This parameter controls the depth-dependent weight of the bilateral filter, to " + - "avoid bleeding across edges. A zero sharpness is a pure Gaussian blur. Increasing " + - "the blur sharpness removes bleeding by using lower weights for samples with large " + - "depth delta from the current pixel.")] - [BlurSettings, Space(10)] - public ClampedFloatParameter sharpness = new ClampedFloatParameter(8f, 0f, 16f); - - [ColorBleedingSettings, ParameterDisplayName("Enabled"), Space(6)] - public BoolParameter colorBleedingEnabled = new BoolParameter(false); - [Tooltip("This value allows to control the saturation of the color bleeding.")] - [ColorBleedingSettings, Space(10)] - public ClampedFloatParameter saturation = new ClampedFloatParameter(1f, 0f, 4f); - [Tooltip("Use masking on emissive pixels")] - [ColorBleedingSettings] - public ClampedFloatParameter brightnessMask = new ClampedFloatParameter(1f, 0f, 1f); - [Tooltip("Brightness level where masking starts/ends")] - [ColorBleedingSettings] - public MinMaxFloatParameter brightnessMaskRange = new MinMaxFloatParameter(new Vector2(0f, 0.5f), 0f, 2f); - - public void EnableHBAO(bool enable) - { - intensity.overrideState = enable; - } - - public Preset GetCurrentPreset() - { - return preset.value; - } - - public void ApplyPreset(Preset preset) - { - if (preset == Preset.Custom) - { - this.preset.Override(preset); - return; - } - - var actualDebugMode = debugMode.value; - var actualDebugModeOverride = debugMode.overrideState; - SetAllOverridesTo(false); - debugMode.overrideState = actualDebugModeOverride; - debugMode.value = actualDebugMode; - - switch (preset) - { - case Preset.FastestPerformance: - SetQuality(Quality.Lowest); - SetAoRadius(0.5f); - SetAoMaxRadiusPixels(64.0f); - SetBlurType(BlurType.ExtraWide); - break; - case Preset.FastPerformance: - SetQuality(Quality.Low); - SetAoRadius(0.5f); - SetAoMaxRadiusPixels(64.0f); - SetBlurType(BlurType.Wide); - break; - case Preset.HighQuality: - SetQuality(Quality.High); - SetAoRadius(1.0f); - break; - case Preset.HighestQuality: - SetQuality(Quality.Highest); - SetAoRadius(1.2f); - SetAoMaxRadiusPixels(256.0f); - SetBlurType(BlurType.Narrow); - break; - case Preset.Normal: - default: - break; - } - - this.preset.Override(preset); - } - - public Mode GetMode() - { - return mode.value; - } - - public void SetMode(Mode mode) - { - this.mode.Override(mode); - } - - public RenderingPath GetRenderingPath() - { - return renderingPath.value; - } - - public void SetRenderingPath(RenderingPath renderingPath) - { - this.renderingPath.Override(renderingPath); - } - - public Quality GetQuality() - { - return quality.value; - } - - public void SetQuality(Quality quality) - { - this.quality.Override(quality); - } - - public Deinterleaving GetDeinterleaving() - { - return deinterleaving.value; - } - - public void SetDeinterleaving(Deinterleaving deinterleaving) - { - this.deinterleaving.Override(deinterleaving); - } - - public Resolution GetResolution() - { - return resolution.value; - } - - public void SetResolution(Resolution resolution) - { - this.resolution.Override(resolution); - } - - public NoiseType GetNoiseType() - { - return noiseType.value; - } - - public void SetNoiseType(NoiseType noiseType) - { - this.noiseType.Override(noiseType); - } - - public DebugMode GetDebugMode() - { - return debugMode.value; - } - - public void SetDebugMode(DebugMode debugMode) - { - this.debugMode.Override(debugMode); - } - - public float GetAoRadius() - { - return radius.value; - } - - public void SetAoRadius(float radius) - { - this.radius.Override(Mathf.Clamp(radius, this.radius.min, this.radius.max)); - } - - public float GetAoMaxRadiusPixels() - { - return maxRadiusPixels.value; - } - - public void SetAoMaxRadiusPixels(float maxRadiusPixels) - { - this.maxRadiusPixels.Override(Mathf.Clamp(maxRadiusPixels, this.maxRadiusPixels.min, this.maxRadiusPixels.max)); - } - - public float GetAoBias() - { - return bias.value; - } - - public void SetAoBias(float bias) - { - this.bias.Override(Mathf.Clamp(bias, this.bias.min, this.bias.max)); - } - - public float GetAoOffscreenSamplesContribution() - { - return offscreenSamplesContribution.value; - } - - public void SetAoOffscreenSamplesContribution(float offscreenSamplesContribution) - { - this.offscreenSamplesContribution.Override(Mathf.Clamp(offscreenSamplesContribution, this.offscreenSamplesContribution.min, this.offscreenSamplesContribution.max)); - } - - public float GetAoMaxDistance() - { - return maxDistance.value; - } - - public void SetAoMaxDistance(float maxDistance) - { - this.maxDistance.Override(maxDistance); - } - - public float GetAoDistanceFalloff() - { - return distanceFalloff.value; - } - - public void SetAoDistanceFalloff(float distanceFalloff) - { - this.distanceFalloff.Override(distanceFalloff); - } - - public PerPixelNormals GetAoPerPixelNormals() - { - return perPixelNormals.value; - } - - public void SetAoPerPixelNormals(PerPixelNormals perPixelNormals) - { - this.perPixelNormals.Override(perPixelNormals); - } - - public Color GetAoColor() - { - return baseColor.value; - } - - public void SetAoColor(Color baseColor) - { - this.baseColor.Override(baseColor); - } - - public float GetAoIntensity() - { - return intensity.value; - } - - public void SetAoIntensity(float intensity) - { - this.intensity.Override(Mathf.Clamp(intensity, this.intensity.min, this.intensity.max)); - } - - public bool UseMultiBounce() - { - return useMultiBounce.value; - } - - public void EnableMultiBounce(bool enabled = true) - { - useMultiBounce.Override(enabled); - } - - public float GetAoMultiBounceInfluence() - { - return multiBounceInfluence.value; - } - - public void SetAoMultiBounceInfluence(float multiBounceInfluence) - { - this.multiBounceInfluence.Override(Mathf.Clamp(multiBounceInfluence, this.multiBounceInfluence.min, this.multiBounceInfluence.max)); - } - - public bool IsTemporalFilterEnabled() - { - return temporalFilterEnabled.value; - } - - public void EnableTemporalFilter(bool enabled = true) - { - temporalFilterEnabled.Override(enabled); - } - - public VarianceClipping GetTemporalFilterVarianceClipping() - { - return varianceClipping.value; - } - - public void SetTemporalFilterVarianceClipping(VarianceClipping varianceClipping) - { - this.varianceClipping.Override(varianceClipping); - } - - public BlurType GetBlurType() - { - return blurType.value; - } - - public void SetBlurType(BlurType blurType) - { - this.blurType.Override(blurType); - } - - public float GetBlurSharpness() - { - return sharpness.value; - } - - public void SetBlurSharpness(float sharpness) - { - this.sharpness.Override(Mathf.Clamp(sharpness, this.sharpness.min, this.sharpness.max)); - } - - public bool IsColorBleedingEnabled() - { - return colorBleedingEnabled.value; - } - - public void EnableColorBleeding(bool enabled = true) - { - colorBleedingEnabled.Override(enabled); - } - - public float GetColorBleedingSaturation() - { - return saturation.value; - } - - public void SetColorBleedingSaturation(float saturation) - { - this.saturation.Override(Mathf.Clamp(saturation, this.saturation.min, this.saturation.max)); - } - - public float GetColorBleedingBrightnessMask() - { - return brightnessMask.value; - } - - public void SetColorBleedingBrightnessMask(float brightnessMask) - { - this.brightnessMask.Override(Mathf.Clamp(brightnessMask, this.brightnessMask.min, this.brightnessMask.max)); - } - - public Vector2 GetColorBleedingBrightnessMaskRange() - { - return brightnessMaskRange.value; - } - - public void SetColorBleedingBrightnessMaskRange(Vector2 brightnessMaskRange) - { - brightnessMaskRange.x = Mathf.Clamp(brightnessMaskRange.x, this.brightnessMaskRange.min, this.brightnessMaskRange.max); - brightnessMaskRange.y = Mathf.Clamp(brightnessMaskRange.y, this.brightnessMaskRange.min, this.brightnessMaskRange.max); - brightnessMaskRange.x = Mathf.Min(brightnessMaskRange.x, brightnessMaskRange.y); - this.brightnessMaskRange.Override(brightnessMaskRange); - } - - public bool IsActive() => intensity.overrideState && intensity.value > 0; - - public bool IsTileCompatible() => true; - } -} diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAORendererFeature.cs b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAORendererFeature.cs deleted file mode 100644 index 42627424..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAORendererFeature.cs +++ /dev/null @@ -1,1003 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Experimental.Rendering; -using UnityEngine.Rendering; -using UnityEngine.Rendering.Universal; -using UnityEngine.XR; - -namespace HorizonBasedAmbientOcclusion.Universal -{ - public class HBAORendererFeature : ScriptableRendererFeature - { - private class HBAORenderPass : ScriptableRenderPass - { - public HBAO hbao; - - private static class Pass - { - public const int AO = 0; - public const int AO_Deinterleaved = 1; - - public const int Deinterleave_Depth = 2; - public const int Deinterleave_Normals = 3; - public const int Atlas_AO_Deinterleaved = 4; - public const int Reinterleave_AO = 5; - - public const int Blur = 6; - - public const int Temporal_Filter = 7; - - public const int Copy = 8; - - public const int Composite = 9; - - public const int Debug_ViewNormals = 10; - } - - private static class ShaderProperties - { - public static int mainTex; - public static int inputTex; - public static int hbaoTex; - public static int tempTex; - public static int tempTex2; - public static int noiseTex; - public static int depthTex; - public static int normalsTex; - public static int ssaoTex; - public static int[] depthSliceTex; - public static int[] normalsSliceTex; - public static int[] aoSliceTex; - public static int[] deinterleaveOffset; - public static int atlasOffset; - public static int jitter; - public static int uvTransform; - public static int inputTexelSize; - public static int aoTexelSize; - public static int deinterleavedAOTexelSize; - public static int reinterleavedAOTexelSize; - public static int uvToView; - public static int worldToCameraMatrix; - public static int targetScale; - public static int radius; - public static int maxRadiusPixels; - public static int negInvRadius2; - public static int angleBias; - public static int aoMultiplier; - public static int intensity; - public static int multiBounceInfluence; - public static int offscreenSamplesContrib; - public static int maxDistance; - public static int distanceFalloff; - public static int baseColor; - public static int colorBleedSaturation; - public static int albedoMultiplier; - public static int colorBleedBrightnessMask; - public static int colorBleedBrightnessMaskRange; - public static int blurDeltaUV; - public static int blurSharpness; - public static int temporalParams; - public static int historyBufferRTHandleScale; - - static ShaderProperties() - { - mainTex = Shader.PropertyToID("_MainTex"); - inputTex = Shader.PropertyToID("_InputTex"); - hbaoTex = Shader.PropertyToID("_HBAOTex"); - tempTex = Shader.PropertyToID("_TempTex"); - tempTex2 = Shader.PropertyToID("_TempTex2"); - noiseTex = Shader.PropertyToID("_NoiseTex"); - depthTex = Shader.PropertyToID("_DepthTex"); - normalsTex = Shader.PropertyToID("_NormalsTex"); - ssaoTex = Shader.PropertyToID("_SSAOTex"); - depthSliceTex = new int[4 * 4]; - normalsSliceTex = new int[4 * 4]; - aoSliceTex = new int[4 * 4]; - for (int i = 0; i < 4 * 4; i++) - { - depthSliceTex[i] = Shader.PropertyToID("_DepthSliceTex" + i); - normalsSliceTex[i] = Shader.PropertyToID("_NormalsSliceTex" + i); - aoSliceTex[i] = Shader.PropertyToID("_AOSliceTex" + i); - } - deinterleaveOffset = new int[] { - Shader.PropertyToID("_Deinterleave_Offset00"), - Shader.PropertyToID("_Deinterleave_Offset10"), - Shader.PropertyToID("_Deinterleave_Offset01"), - Shader.PropertyToID("_Deinterleave_Offset11") - }; - atlasOffset = Shader.PropertyToID("_AtlasOffset"); - jitter = Shader.PropertyToID("_Jitter"); - uvTransform = Shader.PropertyToID("_UVTransform"); - inputTexelSize = Shader.PropertyToID("_Input_TexelSize"); - aoTexelSize = Shader.PropertyToID("_AO_TexelSize"); - deinterleavedAOTexelSize = Shader.PropertyToID("_DeinterleavedAO_TexelSize"); - reinterleavedAOTexelSize = Shader.PropertyToID("_ReinterleavedAO_TexelSize"); - uvToView = Shader.PropertyToID("_UVToView"); - worldToCameraMatrix = Shader.PropertyToID("_WorldToCameraMatrix"); - targetScale = Shader.PropertyToID("_TargetScale"); - radius = Shader.PropertyToID("_Radius"); - maxRadiusPixels = Shader.PropertyToID("_MaxRadiusPixels"); - negInvRadius2 = Shader.PropertyToID("_NegInvRadius2"); - angleBias = Shader.PropertyToID("_AngleBias"); - aoMultiplier = Shader.PropertyToID("_AOmultiplier"); - intensity = Shader.PropertyToID("_Intensity"); - multiBounceInfluence = Shader.PropertyToID("_MultiBounceInfluence"); - offscreenSamplesContrib = Shader.PropertyToID("_OffscreenSamplesContrib"); - maxDistance = Shader.PropertyToID("_MaxDistance"); - distanceFalloff = Shader.PropertyToID("_DistanceFalloff"); - baseColor = Shader.PropertyToID("_BaseColor"); - colorBleedSaturation = Shader.PropertyToID("_ColorBleedSaturation"); - albedoMultiplier = Shader.PropertyToID("_AlbedoMultiplier"); - colorBleedBrightnessMask = Shader.PropertyToID("_ColorBleedBrightnessMask"); - colorBleedBrightnessMaskRange = Shader.PropertyToID("_ColorBleedBrightnessMaskRange"); - blurDeltaUV = Shader.PropertyToID("_BlurDeltaUV"); - blurSharpness = Shader.PropertyToID("_BlurSharpness"); - temporalParams = Shader.PropertyToID("_TemporalParams"); - historyBufferRTHandleScale = Shader.PropertyToID("_HistoryBuffer_RTHandleScale"); - } - - public static string GetOrthographicProjectionKeyword(bool orthographic) - { - return orthographic ? "ORTHOGRAPHIC_PROJECTION" : "__"; - } - - public static string GetQualityKeyword(HBAO.Quality quality) - { - switch (quality) - { - case HBAO.Quality.Lowest: - return "QUALITY_LOWEST"; - case HBAO.Quality.Low: - return "QUALITY_LOW"; - case HBAO.Quality.Medium: - return "QUALITY_MEDIUM"; - case HBAO.Quality.High: - return "QUALITY_HIGH"; - case HBAO.Quality.Highest: - return "QUALITY_HIGHEST"; - default: - return "QUALITY_MEDIUM"; - } - } - - public static string GetNoiseKeyword(HBAO.NoiseType noiseType) - { - switch (noiseType) - { - case HBAO.NoiseType.InterleavedGradientNoise: - return "INTERLEAVED_GRADIENT_NOISE"; - case HBAO.NoiseType.Dither: - case HBAO.NoiseType.SpatialDistribution: - default: - return "__"; - } - } - - public static string GetDeinterleavingKeyword(HBAO.Deinterleaving deinterleaving) - { - switch (deinterleaving) - { - case HBAO.Deinterleaving.x4: - return "DEINTERLEAVED"; - case HBAO.Deinterleaving.Disabled: - default: - return "__"; - } - } - - public static string GetDebugKeyword(HBAO.DebugMode debugMode) - { - switch (debugMode) - { - case HBAO.DebugMode.AOOnly: - return "DEBUG_AO"; - case HBAO.DebugMode.ColorBleedingOnly: - return "DEBUG_COLORBLEEDING"; - case HBAO.DebugMode.SplitWithoutAOAndWithAO: - return "DEBUG_NOAO_AO"; - case HBAO.DebugMode.SplitWithAOAndAOOnly: - return "DEBUG_AO_AOONLY"; - case HBAO.DebugMode.SplitWithoutAOAndAOOnly: - return "DEBUG_NOAO_AOONLY"; - case HBAO.DebugMode.Disabled: - default: - return "__"; - } - } - - public static string GetMultibounceKeyword(bool useMultiBounce, bool litAoModeEnabled) - { - return useMultiBounce && !litAoModeEnabled ? "MULTIBOUNCE" : "__"; - } - - public static string GetOffscreenSamplesContributionKeyword(float offscreenSamplesContribution) - { - return offscreenSamplesContribution > 0 ? "OFFSCREEN_SAMPLES_CONTRIBUTION" : "__"; - } - - public static string GetPerPixelNormalsKeyword(HBAO.PerPixelNormals perPixelNormals) - { - switch (perPixelNormals) - { - case HBAO.PerPixelNormals.Reconstruct4Samples: - return "NORMALS_RECONSTRUCT4"; - case HBAO.PerPixelNormals.Reconstruct2Samples: - return "NORMALS_RECONSTRUCT2"; - case HBAO.PerPixelNormals.Camera: - default: - return "__"; - } - } - - public static string GetBlurRadiusKeyword(HBAO.BlurType blurType) - { - switch (blurType) - { - case HBAO.BlurType.Narrow: - return "BLUR_RADIUS_2"; - case HBAO.BlurType.Medium: - return "BLUR_RADIUS_3"; - case HBAO.BlurType.Wide: - return "BLUR_RADIUS_4"; - case HBAO.BlurType.ExtraWide: - return "BLUR_RADIUS_5"; - case HBAO.BlurType.None: - default: - return "BLUR_RADIUS_3"; - } - } - - public static string GetVarianceClippingKeyword(HBAO.VarianceClipping varianceClipping) - { - switch (varianceClipping) - { - case HBAO.VarianceClipping._4Tap: - return "VARIANCE_CLIPPING_4TAP"; - case HBAO.VarianceClipping._8Tap: - return "VARIANCE_CLIPPING_8TAP"; - case HBAO.VarianceClipping.Disabled: - default: - return "__"; - } - } - - public static string GetColorBleedingKeyword(bool colorBleedingEnabled, bool litAoModeEnabled) - { - return colorBleedingEnabled && !litAoModeEnabled ? "COLOR_BLEEDING" : "__"; - } - - public static string GetModeKeyword(HBAO.Mode mode) - { - return mode == HBAO.Mode.LitAO ? "LIT_AO" : "__"; - } - } - - private static class MersenneTwister - { - // Mersenne-Twister random numbers in [0,1). - public static float[] Numbers = new float[] { - //0.463937f,0.340042f,0.223035f,0.468465f,0.322224f,0.979269f,0.031798f,0.973392f,0.778313f,0.456168f,0.258593f,0.330083f,0.387332f,0.380117f,0.179842f,0.910755f, - //0.511623f,0.092933f,0.180794f,0.620153f,0.101348f,0.556342f,0.642479f,0.442008f,0.215115f,0.475218f,0.157357f,0.568868f,0.501241f,0.629229f,0.699218f,0.707733f - 0.556725f,0.005520f,0.708315f,0.583199f,0.236644f,0.992380f,0.981091f,0.119804f,0.510866f,0.560499f,0.961497f,0.557862f,0.539955f,0.332871f,0.417807f,0.920779f, - 0.730747f,0.076690f,0.008562f,0.660104f,0.428921f,0.511342f,0.587871f,0.906406f,0.437980f,0.620309f,0.062196f,0.119485f,0.235646f,0.795892f,0.044437f,0.617311f - }; - } - - private class CameraHistoryBuffers - { - public CameraData cameraData { get; set; } - public BufferedRTHandleSystem historyRTSystem { get; set; } - public int frameCount { get; set; } - public int lastRenderedFrame { get; set; } - } - - private enum HistoryBufferType - { - AmbientOcclusion, - ColorBleeding - } - - private static readonly Vector2[] s_jitter = new Vector2[4 * 4]; - private static readonly float[] s_temporalRotations = { 60.0f, 300.0f, 180.0f, 240.0f, 120.0f, 0.0f }; - private static readonly float[] s_temporalOffsets = { 0.0f, 0.5f, 0.25f, 0.75f }; - - private Material material { get; set; } - private RenderTargetIdentifier source { get; set; } - private CameraData cameraData { get; set; } - private RenderTextureDescriptor sourceDesc { get; set; } - private RenderTextureDescriptor aoDesc { get; set; } - private RenderTextureDescriptor deinterleavedDepthDesc { get; set; } - private RenderTextureDescriptor deinterleavedNormalsDesc { get; set; } - private RenderTextureDescriptor deinterleavedAoDesc { get; set; } - private RenderTextureDescriptor reinterleavedAoDesc { get; set; } - private RenderTextureFormat colorFormat { get; set; } - private GraphicsFormat graphicsColorFormat { get; set; } - private RenderTextureFormat depthFormat { get; set; } - private RenderTextureFormat normalsFormat { get; set; } - private bool motionVectorsSupported { get; set; } - private Texture2D noiseTex { get; set; } - private int numberOfEyes { get; set; } - private static bool isLinearColorSpace { get { return QualitySettings.activeColorSpace == ColorSpace.Linear; } } - private bool renderingInSceneView { get { return cameraData.camera.cameraType == CameraType.SceneView; } } - - private HBAO.Resolution? m_PreviousResolution; - private HBAO.NoiseType? m_PreviousNoiseType; - private bool m_PreviousColorBleedingEnabled; - private string[] m_ShaderKeywords; - private RenderTargetIdentifier[] m_RtsDepth = new RenderTargetIdentifier[4]; - private RenderTargetIdentifier[] m_RtsNormals = new RenderTargetIdentifier[4]; - private List m_CameraHistoryBuffers = new List(); - - public void FillSupportedRenderTextureFormats() - { - colorFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf) ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.Default; - graphicsColorFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf) ? GraphicsFormat.R16G16B16A16_SFloat : GraphicsFormat.R8G8B8A8_SRGB; - depthFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RFloat) ? RenderTextureFormat.RFloat : RenderTextureFormat.RHalf; - normalsFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGB2101010) ? RenderTextureFormat.ARGB2101010 : RenderTextureFormat.Default; - motionVectorsSupported = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGHalf); - } - - public void Setup(Shader shader, ScriptableRenderer renderer, RenderingData renderingData) - { - if (material == null) material = CoreUtils.CreateEngineMaterial(shader); - -#if !URP_10_0_0_OR_NEWER - source = renderer.cameraColorTarget; - cameraData = renderingData.cameraData; - - // Configures where the render pass should be injected. - FetchVolumeComponent(); - renderPassEvent = hbao.debugMode.value == HBAO.DebugMode.Disabled ? - RenderPassEvent.BeforeRenderingTransparents : - RenderPassEvent.AfterRenderingTransparents; -#endif - } - -#if URP_10_0_0_OR_NEWER - public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData) - { - source = renderingData.cameraData.renderer.cameraColorTargetHandle; - cameraData = renderingData.cameraData; - - FetchVolumeComponent(); - - var passInput = ScriptableRenderPassInput.Depth; - if (hbao.perPixelNormals.value == HBAO.PerPixelNormals.Camera) - passInput |= ScriptableRenderPassInput.Normal; -#if UNITY_2021_2_OR_NEWER - if (hbao.temporalFilterEnabled.value) - passInput |= ScriptableRenderPassInput.Motion; -#endif - ConfigureInput(passInput); - -#if UNITY_2021_2_OR_NEWER - ConfigureColorStoreAction(RenderBufferStoreAction.DontCare); - - // 렌더링 순서를 투명 오브젝트 이후로 변경 - renderPassEvent = hbao.debugMode.value == HBAO.DebugMode.Disabled ? - hbao.mode.value == HBAO.Mode.LitAO ? - hbao.renderingPath.value == HBAO.RenderingPath.Deferred ? RenderPassEvent.AfterRenderingGbuffer : RenderPassEvent.AfterRenderingTransparents + 1 : - RenderPassEvent.AfterRenderingTransparents + 1 : RenderPassEvent.AfterRenderingTransparents; -#else - // 렌더링 순서를 투명 오브젝트 이후로 변경 - renderPassEvent = hbao.debugMode.value == HBAO.DebugMode.Disabled ? - hbao.mode.value == HBAO.Mode.LitAO ? RenderPassEvent.AfterRenderingTransparents + 1 : RenderPassEvent.AfterRenderingTransparents + 1 : - RenderPassEvent.AfterRenderingTransparents; -#endif - } -#endif - - // This method is called before executing the render pass. - // It can be used to configure render targets and their clear state. Also to create temporary render target textures. - // When empty this render pass will render to the active camera render target. - // You should never call CommandBuffer.SetRenderTarget. Instead call ConfigureTarget and ConfigureClear. - // The render pipeline will ensure target setup and clearing happens in an performance manner. - public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) - { - if (material == null) return; - - FetchVolumeComponent(); - - if (!hbao.IsActive()) return; - - FetchRenderParameters(cameraTextureDescriptor); - CheckParameters(); - UpdateMaterialProperties(); - UpdateShaderKeywords(); - } - - // Here you can implement the rendering logic. - // Use ScriptableRenderContext to issue drawing commands or execute command buffers - // https://docs.unity3d.com/ScriptReference/Rendering.ScriptableRenderContext.html - // You don't have to call ScriptableRenderContext.submit, the render pipeline will call it at specific points in the pipeline. - public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) - { - if (material == null) - { - Debug.LogError("HBAO material has not been correctly initialized..."); - return; - } - - if (!hbao.IsActive()) return; - -#if UNITY_2021_2_OR_NEWER - var historyBuffers = GetCurrentCameraHistoryBuffers(); - historyBuffers?.historyRTSystem.SwapAndSetReferenceSize(aoDesc.width, aoDesc.height); -#else - var historyBuffers = null as CameraHistoryBuffers; -#endif - - var cmd = CommandBufferPool.Get("HBAO"); - - if (hbao.mode.value == HBAO.Mode.LitAO) - { -#if URP_10_0_0_OR_NEWER - CoreUtils.SetKeyword(cmd, ShaderKeywordStrings.ScreenSpaceOcclusion, true); -#endif - cmd.GetTemporaryRT(ShaderProperties.ssaoTex, aoDesc, FilterMode.Bilinear); - } - else - { - cmd.GetTemporaryRT(ShaderProperties.inputTex, sourceDesc, FilterMode.Point); - - // Source copy - CopySource(cmd); - } - - // AO - cmd.SetGlobalVector(ShaderProperties.temporalParams, historyBuffers != null ? new Vector2(s_temporalRotations[historyBuffers.frameCount % 6] / 360.0f, s_temporalOffsets[historyBuffers.frameCount % 4]) : Vector2.zero); - if (hbao.deinterleaving.value == HBAO.Deinterleaving.Disabled) - { - cmd.GetTemporaryRT(ShaderProperties.hbaoTex, aoDesc, FilterMode.Bilinear); - AO(cmd); - } - else - { - cmd.GetTemporaryRT(ShaderProperties.hbaoTex, reinterleavedAoDesc, FilterMode.Bilinear); - DeinterleavedAO(cmd); - } - - // Blur - Blur(cmd); - - // Temporal Filter - TemporalFilter(cmd, historyBuffers); - - // Composite - Composite(cmd); - - cmd.ReleaseTemporaryRT(ShaderProperties.hbaoTex); - if (hbao.mode.value != HBAO.Mode.LitAO) cmd.ReleaseTemporaryRT(ShaderProperties.inputTex); - - context.ExecuteCommandBuffer(cmd); - - CommandBufferPool.Release(cmd); - } - - /// Cleanup any allocated resources that were created during the execution of this render pass. - public override void FrameCleanup(CommandBuffer cmd) - { - if (hbao.mode.value == HBAO.Mode.LitAO) - { - cmd.ReleaseTemporaryRT(ShaderProperties.ssaoTex); -#if URP_10_0_0_OR_NEWER - CoreUtils.SetKeyword(cmd, ShaderKeywordStrings.ScreenSpaceOcclusion, false); -#endif - } - - // we release any camera history buffers that has not rendered for more than 1 frames - for (var i = m_CameraHistoryBuffers.Count - 1; i >= 0; i--) - { - var buffers = m_CameraHistoryBuffers[i]; - if (Time.frameCount - buffers.lastRenderedFrame > 1) - ReleaseCameraHistoryBuffers(ref buffers); - } - } - - public void Cleanup() - { - for (var i = m_CameraHistoryBuffers.Count - 1; i >= 0; i--) - { - var buffers = m_CameraHistoryBuffers[i]; - ReleaseCameraHistoryBuffers(ref buffers); - } - - CoreUtils.Destroy(material); - CoreUtils.Destroy(noiseTex); - } - - private void FetchVolumeComponent() - { - if (hbao == null) - hbao = VolumeManager.instance.stack.GetComponent(); - } - - private void FetchRenderParameters(RenderTextureDescriptor cameraTextureDesc) - { - cameraTextureDesc.msaaSamples = 1; - cameraTextureDesc.depthBufferBits = 0; - sourceDesc = cameraTextureDesc; - - var width = cameraTextureDesc.width; - var height = cameraTextureDesc.height; - var downsamplingFactor = hbao.resolution.value == HBAO.Resolution.Full ? 1 : hbao.deinterleaving.value == HBAO.Deinterleaving.Disabled ? 2 : 1; - if (downsamplingFactor > 1) - { - width = (width + width % 2) / downsamplingFactor; - height = (height + height % 2) / downsamplingFactor; - } - - aoDesc = GetStereoCompatibleDescriptor(width, height, format: colorFormat, readWrite: RenderTextureReadWrite.Linear); - - if (hbao.deinterleaving.value != HBAO.Deinterleaving.Disabled) - { - var reinterleavedWidth = cameraTextureDesc.width + (cameraTextureDesc.width % 4 == 0 ? 0 : 4 - (cameraTextureDesc.width % 4)); - var reinterleavedHeight = cameraTextureDesc.height + (cameraTextureDesc.height % 4 == 0 ? 0 : 4 - (cameraTextureDesc.height % 4)); - var deinterleavedWidth = reinterleavedWidth / 4; - var deinterleavedHeight = reinterleavedHeight / 4; - - deinterleavedDepthDesc = GetStereoCompatibleDescriptor(deinterleavedWidth, deinterleavedHeight, format: depthFormat, readWrite: RenderTextureReadWrite.Linear); - deinterleavedNormalsDesc = GetStereoCompatibleDescriptor(deinterleavedWidth, deinterleavedHeight, format: normalsFormat, readWrite: RenderTextureReadWrite.Linear); - deinterleavedAoDesc = GetStereoCompatibleDescriptor(deinterleavedWidth, deinterleavedHeight, format: colorFormat, readWrite: RenderTextureReadWrite.Linear); - reinterleavedAoDesc = GetStereoCompatibleDescriptor(reinterleavedWidth, reinterleavedHeight, format: colorFormat, readWrite: RenderTextureReadWrite.Linear); - } - - numberOfEyes = 1; -#if ENABLE_VR - if (XRSettings.enabled) - numberOfEyes = 2; -#endif - } - - private RTHandle HistoryBufferAllocator(RTHandleSystem rtHandleSystem, int frameIndex) - { - return rtHandleSystem.Alloc(Vector2.one, colorFormat: graphicsColorFormat, useDynamicScale: true, name: "HBAO_HistoryBuffer_" + frameIndex); - } - - private void AllocCameraHistoryBuffers(ref CameraHistoryBuffers buffers) - { - buffers = new CameraHistoryBuffers(); - buffers.cameraData = cameraData; - buffers.frameCount = 0; - buffers.historyRTSystem = new BufferedRTHandleSystem(); // https://docs.unity3d.com/Packages/com.unity.render-pipelines.core@12.0/manual/rthandle-system-using.html - buffers.historyRTSystem.AllocBuffer((int)HistoryBufferType.AmbientOcclusion, HistoryBufferAllocator, 2); - if (hbao.colorBleedingEnabled.value) - buffers.historyRTSystem.AllocBuffer((int)HistoryBufferType.ColorBleeding, HistoryBufferAllocator, 2); - - m_CameraHistoryBuffers.Add(buffers); - } - - private void ReleaseCameraHistoryBuffers(ref CameraHistoryBuffers buffers) - { - buffers.historyRTSystem.ReleaseAll(); - buffers.historyRTSystem.Dispose(); - - m_CameraHistoryBuffers.Remove(buffers); - - buffers = null; - } - - private CameraHistoryBuffers GetCurrentCameraHistoryBuffers() - { - CameraHistoryBuffers buffers = null; - if (hbao.temporalFilterEnabled.value && !renderingInSceneView) - { - for (var i = 0; i < m_CameraHistoryBuffers.Count; i++) - { - if (m_CameraHistoryBuffers[i].cameraData.camera == cameraData.camera) - { - buffers = m_CameraHistoryBuffers[i]; - break; - } - } - - if ((m_PreviousColorBleedingEnabled != hbao.colorBleedingEnabled.value || - m_PreviousResolution != hbao.resolution.value) - && buffers != null) - { - ReleaseCameraHistoryBuffers(ref buffers); - m_PreviousColorBleedingEnabled = hbao.colorBleedingEnabled.value; - m_PreviousResolution = hbao.resolution.value; - } - - if (buffers == null) - AllocCameraHistoryBuffers(ref buffers); - } - - return buffers; - } - - private void CopySource(CommandBuffer cmd) - { - BlitFullscreenMesh(cmd, source, ShaderProperties.inputTex, material, Pass.Copy); - } - - private void AO(CommandBuffer cmd) - { - BlitFullscreenMeshWithClear(cmd, hbao.mode.value == HBAO.Mode.LitAO ? source : ShaderProperties.inputTex, ShaderProperties.hbaoTex, material, new Color(0, 0, 0, 1), Pass.AO); - } - - private void DeinterleavedAO(CommandBuffer cmd) - { - // Deinterleave depth & normals (4x4) - cmd.SetViewProjectionMatrices(Matrix4x4.identity, Matrix4x4.identity); - for (int i = 0; i < 4; i++) - { - m_RtsDepth[0] = ShaderProperties.depthSliceTex[(i << 2) + 0]; - m_RtsDepth[1] = ShaderProperties.depthSliceTex[(i << 2) + 1]; - m_RtsDepth[2] = ShaderProperties.depthSliceTex[(i << 2) + 2]; - m_RtsDepth[3] = ShaderProperties.depthSliceTex[(i << 2) + 3]; - m_RtsNormals[0] = ShaderProperties.normalsSliceTex[(i << 2) + 0]; - m_RtsNormals[1] = ShaderProperties.normalsSliceTex[(i << 2) + 1]; - m_RtsNormals[2] = ShaderProperties.normalsSliceTex[(i << 2) + 2]; - m_RtsNormals[3] = ShaderProperties.normalsSliceTex[(i << 2) + 3]; - - int offsetX = (i & 1) << 1; int offsetY = (i >> 1) << 1; - cmd.SetGlobalVector(ShaderProperties.deinterleaveOffset[0], new Vector2(offsetX + 0, offsetY + 0)); - cmd.SetGlobalVector(ShaderProperties.deinterleaveOffset[1], new Vector2(offsetX + 1, offsetY + 0)); - cmd.SetGlobalVector(ShaderProperties.deinterleaveOffset[2], new Vector2(offsetX + 0, offsetY + 1)); - cmd.SetGlobalVector(ShaderProperties.deinterleaveOffset[3], new Vector2(offsetX + 1, offsetY + 1)); - for (int j = 0; j < 4; j++) - { - cmd.GetTemporaryRT(ShaderProperties.depthSliceTex[j + 4 * i], deinterleavedDepthDesc, FilterMode.Point); - cmd.GetTemporaryRT(ShaderProperties.normalsSliceTex[j + 4 * i], deinterleavedNormalsDesc, FilterMode.Point); - } - BlitFullscreenMesh(cmd, BuiltinRenderTextureType.CameraTarget, m_RtsDepth, material, Pass.Deinterleave_Depth); // outputs 4 render textures - BlitFullscreenMesh(cmd, BuiltinRenderTextureType.CameraTarget, m_RtsNormals, material, Pass.Deinterleave_Normals); // outputs 4 render textures - } - cmd.SetViewProjectionMatrices(cameraData.camera.worldToCameraMatrix, cameraData.camera.projectionMatrix); - - // AO on each layer - for (int i = 0; i < 4 * 4; i++) - { - cmd.SetGlobalTexture(ShaderProperties.depthTex, ShaderProperties.depthSliceTex[i]); - cmd.SetGlobalTexture(ShaderProperties.normalsTex, ShaderProperties.normalsSliceTex[i]); - cmd.SetGlobalVector(ShaderProperties.jitter, s_jitter[i]); - cmd.GetTemporaryRT(ShaderProperties.aoSliceTex[i], deinterleavedAoDesc, FilterMode.Point); - BlitFullscreenMeshWithClear(cmd, hbao.mode.value == HBAO.Mode.LitAO ? source : ShaderProperties.inputTex, ShaderProperties.aoSliceTex[i], material, new Color(0, 0, 0, 1), Pass.AO_Deinterleaved); // ao - cmd.ReleaseTemporaryRT(ShaderProperties.depthSliceTex[i]); - cmd.ReleaseTemporaryRT(ShaderProperties.normalsSliceTex[i]); - } - - // Atlas Deinterleaved AO, 4x4 - cmd.GetTemporaryRT(ShaderProperties.tempTex, reinterleavedAoDesc, FilterMode.Point); - for (int i = 0; i < 4 * 4; i++) - { - cmd.SetGlobalVector(ShaderProperties.atlasOffset, new Vector2(((i & 1) + (((i & 7) >> 2) << 1)) * deinterleavedAoDesc.width, (((i & 3) >> 1) + ((i >> 3) << 1)) * deinterleavedAoDesc.height)); - BlitFullscreenMesh(cmd, ShaderProperties.aoSliceTex[i], ShaderProperties.tempTex, material, Pass.Atlas_AO_Deinterleaved); // atlassing - cmd.ReleaseTemporaryRT(ShaderProperties.aoSliceTex[i]); - } - - // Reinterleave AO - BlitFullscreenMesh(cmd, ShaderProperties.tempTex, ShaderProperties.hbaoTex, material, Pass.Reinterleave_AO); // reinterleave - cmd.ReleaseTemporaryRT(ShaderProperties.tempTex); - } - - private void Blur(CommandBuffer cmd) - { - if (hbao.blurType.value != HBAO.BlurType.None) - { - cmd.GetTemporaryRT(ShaderProperties.tempTex, aoDesc, FilterMode.Bilinear); - cmd.SetGlobalVector(ShaderProperties.blurDeltaUV, new Vector2(1f / sourceDesc.width, 0)); - BlitFullscreenMesh(cmd, ShaderProperties.hbaoTex, ShaderProperties.tempTex, material, Pass.Blur); - cmd.SetGlobalVector(ShaderProperties.blurDeltaUV, new Vector2(0, 1f / sourceDesc.height)); - BlitFullscreenMesh(cmd, ShaderProperties.tempTex, ShaderProperties.hbaoTex, material, Pass.Blur); - cmd.ReleaseTemporaryRT(ShaderProperties.tempTex); - } - } - - private void TemporalFilter(CommandBuffer cmd, CameraHistoryBuffers buffers) - { - if (hbao.temporalFilterEnabled.value && !renderingInSceneView) - { - cmd.SetGlobalVector(ShaderProperties.historyBufferRTHandleScale, buffers.historyRTSystem.rtHandleProperties.rtHandleScale); - - if (buffers.frameCount == 0) - { - // buffers were just allocated this frame, clear them (previous frame RT) - cmd.SetRenderTarget(buffers.historyRTSystem.GetFrameRT((int)HistoryBufferType.AmbientOcclusion, 1)); - cmd.ClearRenderTarget(false, true, Color.white); - if (hbao.colorBleedingEnabled.value) - { - cmd.SetRenderTarget(buffers.historyRTSystem.GetFrameRT((int)HistoryBufferType.ColorBleeding, 1)); - cmd.ClearRenderTarget(false, true, new Color(0, 0, 0, 1)); - } - } - - var viewportRect = new Rect(Vector2.zero, buffers.historyRTSystem.rtHandleProperties.currentViewportSize); - - if (hbao.colorBleedingEnabled.value) - { - // For Color Bleeding we have 2 history buffers to fill so there are 2 render targets. - // AO is still contained in Color Bleeding history buffer (alpha channel) so that we - // can use it as a render texture for the composite pass. - var currentFrameAORT = buffers.historyRTSystem.GetFrameRT((int)HistoryBufferType.AmbientOcclusion, 0); - var currentFrameCBRT = buffers.historyRTSystem.GetFrameRT((int)HistoryBufferType.ColorBleeding, 0); - var previousFrameAORT = buffers.historyRTSystem.GetFrameRT((int)HistoryBufferType.AmbientOcclusion, 1); - var previousFrameCBRT = buffers.historyRTSystem.GetFrameRT((int)HistoryBufferType.ColorBleeding, 1); - var rts = new RenderTargetIdentifier[] { - currentFrameAORT, - currentFrameCBRT - }; - cmd.SetViewProjectionMatrices(Matrix4x4.identity, Matrix4x4.identity); - cmd.SetGlobalTexture(ShaderProperties.tempTex, previousFrameCBRT); - BlitFullscreenMesh(cmd, previousFrameAORT, rts, viewportRect, material, Pass.Temporal_Filter); - cmd.SetViewProjectionMatrices(cameraData.camera.worldToCameraMatrix, cameraData.camera.projectionMatrix); - cmd.SetGlobalTexture(ShaderProperties.hbaoTex, currentFrameCBRT); - } - else - { - // AO history buffer contains ao in aplha channel so we can just use history as - // a render texture for the composite pass. - var currentFrameRT = buffers.historyRTSystem.GetFrameRT((int)HistoryBufferType.AmbientOcclusion, 0); - var previousFrameRT = buffers.historyRTSystem.GetFrameRT((int)HistoryBufferType.AmbientOcclusion, 1); - BlitFullscreenMesh(cmd, previousFrameRT, currentFrameRT, viewportRect, material, Pass.Temporal_Filter); - cmd.SetGlobalTexture(ShaderProperties.hbaoTex, currentFrameRT); - } - - // increment buffers frameCount for next frame, track last buffer use - buffers.frameCount++; - buffers.lastRenderedFrame = Time.frameCount; - } - else - cmd.SetGlobalVector(ShaderProperties.historyBufferRTHandleScale, Vector4.one); - } - - private void Composite(CommandBuffer cmd) - { - // AO 결과를 메인 렌더 타겟에 합성 - BlitFullscreenMesh(cmd, - hbao.mode.value == HBAO.Mode.LitAO ? source : ShaderProperties.inputTex, - source, - material, - hbao.debugMode.value == HBAO.DebugMode.ViewNormals ? Pass.Debug_ViewNormals : Pass.Composite - ); - - if (hbao.mode.value == HBAO.Mode.LitAO) - { - cmd.SetGlobalTexture("_ScreenSpaceOcclusionTexture", ShaderProperties.ssaoTex); - cmd.SetGlobalVector("_AmbientOcclusionParam", new Vector4(0f, 0f, 0f, hbao.directLightingStrength.value)); - } - } - - private void UpdateMaterialProperties() - { - var sourceWidth = cameraData.cameraTargetDescriptor.width; - var sourceHeight = cameraData.cameraTargetDescriptor.height; - - //float tanHalfFovY = Mathf.Tan(0.5f * cameraData.camera.fieldOfView * Mathf.Deg2Rad); - //float invFocalLenX = 1.0f / (1.0f / tanHalfFovY * (sourceHeight / (float)sourceWidth)); - //float invFocalLenY = 1.0f / (1.0f / tanHalfFovY); - float invFocalLenX = 1.0f / cameraData.camera.projectionMatrix.m00; - float invFocalLenY = 1.0f / cameraData.camera.projectionMatrix.m11; - float maxRadInPixels = Mathf.Max(16, hbao.maxRadiusPixels.value * Mathf.Sqrt((sourceWidth * numberOfEyes * sourceHeight) / (1080.0f * 1920.0f))); - maxRadInPixels /= (hbao.deinterleaving.value == HBAO.Deinterleaving.x4 ? 4 : 1); - - var targetScale = hbao.deinterleaving.value == HBAO.Deinterleaving.x4 ? - new Vector4(reinterleavedAoDesc.width / (float)sourceWidth, reinterleavedAoDesc.height / (float)sourceHeight, 1.0f / (reinterleavedAoDesc.width / (float)sourceWidth), 1.0f / (reinterleavedAoDesc.height / (float)sourceHeight)) : - hbao.resolution.value == HBAO.Resolution.Half /*&& (settings.perPixelNormals.value == HBAO.PerPixelNormals.Reconstruct2Samples || settings.perPixelNormals.value == HBAO.PerPixelNormals.Reconstruct4Samples)*/ ? - new Vector4((sourceWidth + 0.5f) / sourceWidth, (sourceHeight + 0.5f) / sourceHeight, 1f, 1f) : - Vector4.one; - - material.SetTexture(ShaderProperties.noiseTex, noiseTex); - material.SetVector(ShaderProperties.inputTexelSize, new Vector4(1f / sourceWidth, 1f / sourceHeight, sourceWidth, sourceHeight)); - material.SetVector(ShaderProperties.aoTexelSize, new Vector4(1f / aoDesc.width, 1f / aoDesc.height, aoDesc.width, aoDesc.height)); - material.SetVector(ShaderProperties.deinterleavedAOTexelSize, new Vector4(1.0f / deinterleavedAoDesc.width, 1.0f / deinterleavedAoDesc.height, deinterleavedAoDesc.width, deinterleavedAoDesc.height)); - material.SetVector(ShaderProperties.reinterleavedAOTexelSize, new Vector4(1f / reinterleavedAoDesc.width, 1f / reinterleavedAoDesc.height, reinterleavedAoDesc.width, reinterleavedAoDesc.height)); - material.SetVector(ShaderProperties.targetScale, targetScale); - material.SetVector(ShaderProperties.uvToView, new Vector4(2.0f * invFocalLenX, -2.0f * invFocalLenY, -1.0f * invFocalLenX, 1.0f * invFocalLenY)); - material.SetMatrix(ShaderProperties.worldToCameraMatrix, cameraData.camera.worldToCameraMatrix); - //material.SetFloat(ShaderProperties.radius, hbao.radius.value * 0.5f * ((sourceHeight / (hbao.deinterleaving.value == HBAO.Deinterleaving.x4 ? 4 : 1)) / (tanHalfFovY * 2.0f))); - material.SetFloat(ShaderProperties.radius, hbao.radius.value * 0.5f * ((sourceHeight / (hbao.deinterleaving.value == HBAO.Deinterleaving.x4 ? 4 : 1)) / (invFocalLenY * 2.0f))); - material.SetFloat(ShaderProperties.maxRadiusPixels, maxRadInPixels); - material.SetFloat(ShaderProperties.negInvRadius2, -1.0f / (hbao.radius.value * hbao.radius.value)); - material.SetFloat(ShaderProperties.angleBias, hbao.bias.value); - material.SetFloat(ShaderProperties.aoMultiplier, 2.0f * (1.0f / (1.0f - hbao.bias.value))); - material.SetFloat(ShaderProperties.intensity, isLinearColorSpace ? hbao.intensity.value : hbao.intensity.value * 0.454545454545455f); - material.SetFloat(ShaderProperties.multiBounceInfluence, hbao.multiBounceInfluence.value); - material.SetFloat(ShaderProperties.offscreenSamplesContrib, hbao.offscreenSamplesContribution.value); - material.SetFloat(ShaderProperties.maxDistance, hbao.maxDistance.value); - material.SetFloat(ShaderProperties.distanceFalloff, hbao.distanceFalloff.value); - material.SetColor(ShaderProperties.baseColor, hbao.baseColor.value); - material.SetFloat(ShaderProperties.blurSharpness, hbao.sharpness.value); - material.SetFloat(ShaderProperties.colorBleedSaturation, hbao.saturation.value); - material.SetFloat(ShaderProperties.colorBleedBrightnessMask, hbao.brightnessMask.value); - material.SetVector(ShaderProperties.colorBleedBrightnessMaskRange, AdjustBrightnessMaskToGammaSpace(new Vector2(Mathf.Pow(hbao.brightnessMaskRange.value.x, 3), Mathf.Pow(hbao.brightnessMaskRange.value.y, 3)))); - } - - private void UpdateShaderKeywords() - { - if (m_ShaderKeywords == null || m_ShaderKeywords.Length != 12) m_ShaderKeywords = new string[12]; - - m_ShaderKeywords[0] = ShaderProperties.GetOrthographicProjectionKeyword(cameraData.camera.orthographic); - m_ShaderKeywords[1] = ShaderProperties.GetQualityKeyword(hbao.quality.value); - m_ShaderKeywords[2] = ShaderProperties.GetNoiseKeyword(hbao.noiseType.value); - m_ShaderKeywords[3] = ShaderProperties.GetDeinterleavingKeyword(hbao.deinterleaving.value); - m_ShaderKeywords[4] = ShaderProperties.GetDebugKeyword(hbao.debugMode.value); - m_ShaderKeywords[5] = ShaderProperties.GetMultibounceKeyword(hbao.useMultiBounce.value, hbao.mode.value == HBAO.Mode.LitAO); - m_ShaderKeywords[6] = ShaderProperties.GetOffscreenSamplesContributionKeyword(hbao.offscreenSamplesContribution.value); - m_ShaderKeywords[7] = ShaderProperties.GetPerPixelNormalsKeyword(hbao.perPixelNormals.value); - m_ShaderKeywords[8] = ShaderProperties.GetBlurRadiusKeyword(hbao.blurType.value); - m_ShaderKeywords[9] = ShaderProperties.GetVarianceClippingKeyword(hbao.varianceClipping.value); - m_ShaderKeywords[10] = ShaderProperties.GetColorBleedingKeyword(hbao.colorBleedingEnabled.value, hbao.mode.value == HBAO.Mode.LitAO); - m_ShaderKeywords[11] = ShaderProperties.GetModeKeyword(hbao.mode.value); - - material.shaderKeywords = m_ShaderKeywords; - } - - private void CheckParameters() - { - if (hbao.deinterleaving.value != HBAO.Deinterleaving.Disabled && SystemInfo.supportedRenderTargetCount < 4) - hbao.SetDeinterleaving(HBAO.Deinterleaving.Disabled); - - if (hbao.temporalFilterEnabled.value && !motionVectorsSupported) - hbao.EnableTemporalFilter(false); - - if (hbao.colorBleedingEnabled.value && hbao.temporalFilterEnabled.value && SystemInfo.supportedRenderTargetCount < 2) - hbao.EnableTemporalFilter(false); - - if (hbao.colorBleedingEnabled.value && hbao.mode.value == HBAO.Mode.LitAO) - hbao.EnableColorBleeding(false); - - // Noise texture - if (noiseTex == null || m_PreviousNoiseType != hbao.noiseType.value) - { - CoreUtils.Destroy(noiseTex); - - CreateNoiseTexture(); - - m_PreviousNoiseType = hbao.noiseType.value; - } - } - - private RenderTextureDescriptor GetStereoCompatibleDescriptor(int width, int height, RenderTextureFormat format = RenderTextureFormat.Default, int depthBufferBits = 0, RenderTextureReadWrite readWrite = RenderTextureReadWrite.Default) - { - // Inherit the VR setup from the camera descriptor - var desc = sourceDesc; - desc.depthBufferBits = depthBufferBits; - desc.msaaSamples = 1; - desc.width = width; - desc.height = height; - desc.colorFormat = format; - - if (readWrite == RenderTextureReadWrite.sRGB) - desc.sRGB = true; - else if (readWrite == RenderTextureReadWrite.Linear) - desc.sRGB = false; - else if (readWrite == RenderTextureReadWrite.Default) - desc.sRGB = isLinearColorSpace; - - return desc; - } - - public void BlitFullscreenMesh(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier destination, Material material, int passIndex = 0) - { - cmd.SetGlobalTexture(ShaderProperties.mainTex, source); - cmd.SetRenderTarget(destination, 0, CubemapFace.Unknown, -1); - cmd.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, material, 0, passIndex); - } - - public void BlitFullscreenMesh(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier destination, Rect viewportRect, Material material, int passIndex = 0) - { - cmd.SetGlobalTexture(ShaderProperties.mainTex, source); - cmd.SetRenderTarget(destination, 0, CubemapFace.Unknown, -1); - cmd.SetViewport(viewportRect); - cmd.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, material, 0, passIndex); - } - - public void BlitFullscreenMesh(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier[] destinations, Material material, int passIndex = 0) - { - cmd.SetGlobalTexture(ShaderProperties.mainTex, source); - cmd.SetRenderTarget(destinations, destinations[0], 0, CubemapFace.Unknown, -1); - cmd.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, material, 0, passIndex); - } - - public void BlitFullscreenMesh(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier[] destinations, Rect viewportRect, Material material, int passIndex = 0) - { - cmd.SetGlobalTexture(ShaderProperties.mainTex, source); - cmd.SetRenderTarget(destinations, destinations[0], 0, CubemapFace.Unknown, -1); - cmd.SetViewport(viewportRect); - cmd.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, material, 0, passIndex); - } - - public void BlitFullscreenMeshWithClear(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier destination, Material material, Color clearColor, int passIndex = 0) - { - cmd.SetGlobalTexture(ShaderProperties.mainTex, source); - cmd.SetRenderTarget(destination, 0, CubemapFace.Unknown, -1); - cmd.ClearRenderTarget(false, true, clearColor); - cmd.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, material, 0, passIndex); - } - - private Vector2 AdjustBrightnessMaskToGammaSpace(Vector2 v) - { - return isLinearColorSpace ? v : ToGammaSpace(v); - } - - private float ToGammaSpace(float v) - { - return Mathf.Pow(v, 0.454545454545455f); - } - - private Vector2 ToGammaSpace(Vector2 v) - { - return new Vector2(ToGammaSpace(v.x), ToGammaSpace(v.y)); - } - - private void CreateNoiseTexture() - { - noiseTex = new Texture2D(4, 4, SystemInfo.SupportsTextureFormat(TextureFormat.RGHalf) ? TextureFormat.RGHalf : TextureFormat.RGB24, false, true); - noiseTex.filterMode = FilterMode.Point; - noiseTex.wrapMode = TextureWrapMode.Repeat; - int z = 0; - for (int x = 0; x < 4; ++x) - { - for (int y = 0; y < 4; ++y) - { - float r1 = hbao.noiseType.value != HBAO.NoiseType.Dither ? 0.25f * (0.0625f * ((x + y & 3) << 2) + (x & 3)) : MersenneTwister.Numbers[z++]; - float r2 = hbao.noiseType.value != HBAO.NoiseType.Dither ? 0.25f * ((y - x) & 3) : MersenneTwister.Numbers[z++]; - Color color = new Color(r1, r2, 0); - noiseTex.SetPixel(x, y, color); - } - } - noiseTex.Apply(); - - for (int i = 0, j = 0; i < s_jitter.Length; ++i) - { - float r1 = MersenneTwister.Numbers[j++]; - float r2 = MersenneTwister.Numbers[j++]; - s_jitter[i] = new Vector2(r1, r2); - } - } - } - - [SerializeField, HideInInspector] - private Shader shader; - private HBAORenderPass m_HBAORenderPass; - - void OnDisable() - { - m_HBAORenderPass?.Cleanup(); - } - - public override void Create() - { - if (!isActive) - { - m_HBAORenderPass?.Cleanup(); - m_HBAORenderPass = null; - return; - } - - name = "HBAO"; - - m_HBAORenderPass = new HBAORenderPass(); - m_HBAORenderPass.FillSupportedRenderTextureFormats(); - } - -#if URP_10_0_0_OR_NEWER - protected override void Dispose(bool disposing) - { - m_HBAORenderPass?.Cleanup(); - m_HBAORenderPass = null; - } -#endif - - // Here you can inject one or multiple render passes in the renderer. - // This method is called when setting up the renderer once per-camera. - public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) - { - shader = Shader.Find("Hidden/Universal Render Pipeline/HBAO"); - if (shader == null) - { - Debug.LogWarning("HBAO shader was not found. Please ensure it compiles correctly"); - return; - } - - if (renderingData.cameraData.postProcessEnabled) - { - m_HBAORenderPass.Setup(shader, renderer, renderingData); - renderer.EnqueuePass(m_HBAORenderPass); - } - } - } -} diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAORendererFeature.cs.meta b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAORendererFeature.cs.meta deleted file mode 100644 index 2c84c51a..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAORendererFeature.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: f7c2c2c3c19808149a4d3454e1019255 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: - - settings: {fileID: 11400000, guid: 68dde9df85a05a54fbc92e3b6f3a8c42, type: 2} - - hbaoShader: {fileID: 4800000, guid: bf610497676b34e4dbe0f14fe3fe311c, type: 3} - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO.shader b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO.shader deleted file mode 100644 index 777cbcbd..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO.shader +++ /dev/null @@ -1,370 +0,0 @@ -Shader "Hidden/Universal Render Pipeline/HBAO" -{ - Properties - { - _MainTex("", any) = "" {} - _HBAOTex("", any) = "" {} - _TempTex("", any) = "" {} - _NoiseTex("", 2D) = "" {} - _DepthTex("", any) = "" {} - _NormalsTex("", any) = "" {} - } - - HLSLINCLUDE - - #pragma target 3.0 - #pragma prefer_hlslcc gles - #pragma exclude_renderers d3d11_9x - #pragma editor_sync_compilation - //#pragma enable_d3d11_debug_symbols - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" - #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" - - TEXTURE2D_X(_MainTex); - TEXTURE2D_X(_HBAOTex); - TEXTURE2D_X(_TempTex); - TEXTURE2D_X(_DepthTex); - TEXTURE2D_X(_NormalsTex); - //TEXTURE2D_X(_CameraNormalsTexture); - TEXTURE2D_X(_MotionVectorTexture); - TEXTURE2D(_NoiseTex); - // SAMPLER(sampler_PointRepeat); - // SAMPLER(sampler_PointClamp); - - float4 _HistoryBuffer_RTHandleScale; - - CBUFFER_START(FrequentlyUpdatedUniforms) - float4 _Input_TexelSize; - float4 _AO_TexelSize; - float4 _DeinterleavedAO_TexelSize; - float4 _ReinterleavedAO_TexelSize; - float4 _TargetScale; - float4 _UVToView; - float4x4 _WorldToCameraMatrix; - float _Radius; - float _MaxRadiusPixels; - float _NegInvRadius2; - float _AngleBias; - float _AOmultiplier; - float _Intensity; - half4 _BaseColor; - float _MultiBounceInfluence; - float _OffscreenSamplesContrib; - float _MaxDistance; - float _DistanceFalloff; - float _BlurSharpness; - float _ColorBleedSaturation; - float _ColorBleedBrightnessMask; - float2 _ColorBleedBrightnessMaskRange; - float2 _TemporalParams; - CBUFFER_END - - CBUFFER_START(PerPassUpdatedUniforms) - float2 _BlurDeltaUV; - CBUFFER_END - - CBUFFER_START(PerPassUpdatedDeinterleavingUniforms) - float2 _Deinterleave_Offset00; - float2 _Deinterleave_Offset10; - float2 _Deinterleave_Offset01; - float2 _Deinterleave_Offset11; - float2 _AtlasOffset; - float2 _Jitter; - CBUFFER_END - - struct Attributes - { - float4 positionOS : POSITION; - float2 uv : TEXCOORD0; - UNITY_VERTEX_INPUT_INSTANCE_ID - }; - - struct Varyings - { - float4 positionCS : SV_POSITION; - float2 uv : TEXCOORD0; - UNITY_VERTEX_OUTPUT_STEREO - }; - - Varyings Vert(Attributes input) - { - Varyings output; - UNITY_SETUP_INSTANCE_ID(input); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); - //output.positionCS = TransformObjectToHClip(input.positionOS.xyz); - // Note: The pass is setup with a mesh already in CS - // Therefore, we can just output vertex position - output.positionCS = float4(input.positionOS.xyz, 1.0); - #if UNITY_UV_STARTS_AT_TOP - output.positionCS.y *= -1; - #endif - output.uv = input.uv; - return output; - } - - Varyings Vert_Atlas(Attributes input) - { - Varyings output; - UNITY_SETUP_INSTANCE_ID(input); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); - //float3 pos = input.positionOS.xyz; - //pos.xy = pos.xy * (_DeinterleavedAO_TexelSize.zw / _ReinterleavedAO_TexelSize.zw) + _AtlasOffset * _ReinterleavedAO_TexelSize.xy; - //output.positionCS = TransformObjectToHClip(pos); - output.positionCS = float4((input.positionOS.xy + float2(-3.0, 1.0)) * (_DeinterleavedAO_TexelSize.zw / _ReinterleavedAO_TexelSize.zw) + 2.0 * _AtlasOffset * _ReinterleavedAO_TexelSize.xy, 0.0, 1.0); - // flip triangle upside down - output.positionCS.y = 1 - output.positionCS.y; - output.uv = input.uv; - return output; - } - - ENDHLSL - - SubShader - { - Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" } - LOD 100 - ZWrite Off ZTest Always Blend Off Cull Off - - Pass // 0 - { - Name "HBAO - AO" - - HLSLPROGRAM - #pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION - #pragma multi_compile_local __ COLOR_BLEEDING - #pragma multi_compile_local __ OFFSCREEN_SAMPLES_CONTRIBUTION - #pragma multi_compile_local __ NORMALS_RECONSTRUCT2 NORMALS_RECONSTRUCT4 - #pragma multi_compile_local __ INTERLEAVED_GRADIENT_NOISE - #pragma multi_compile_local QUALITY_LOWEST QUALITY_LOW QUALITY_MEDIUM QUALITY_HIGH QUALITY_HIGHEST - #pragma multi_compile_fragment __ _GBUFFER_NORMALS_OCT // support octahedron endoded normals - - #if QUALITY_LOWEST - #define DIRECTIONS 3 - #define STEPS 2 - #elif QUALITY_LOW - #define DIRECTIONS 4 - #define STEPS 3 - #elif QUALITY_MEDIUM - #define DIRECTIONS 6 - #define STEPS 4 - #elif QUALITY_HIGH - #define DIRECTIONS 8 - #define STEPS 4 - #elif QUALITY_HIGHEST - #define DIRECTIONS 8 - #define STEPS 6 - #else - #define DIRECTIONS 1 - #define STEPS 1 - #endif - - #pragma vertex Vert - #pragma fragment AO_Frag - - #include "HBAO_AO.hlsl" - ENDHLSL - } - - Pass // 1 - { - Name "HBAO - AO Deinterleaved" - - HLSLPROGRAM - #pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION - #pragma multi_compile_local __ COLOR_BLEEDING - #pragma multi_compile_local __ OFFSCREEN_SAMPLES_CONTRIBUTION - #pragma multi_compile_local QUALITY_LOWEST QUALITY_LOW QUALITY_MEDIUM QUALITY_HIGH QUALITY_HIGHEST - - #if QUALITY_LOWEST - #define DIRECTIONS 3 - #define STEPS 2 - #elif QUALITY_LOW - #define DIRECTIONS 4 - #define STEPS 3 - #elif QUALITY_MEDIUM - #define DIRECTIONS 6 - #define STEPS 4 - #elif QUALITY_HIGH - #define DIRECTIONS 8 - #define STEPS 4 - #elif QUALITY_HIGHEST - #define DIRECTIONS 8 - #define STEPS 6 - #else - #define DIRECTIONS 1 - #define STEPS 1 - #endif - - #define DEINTERLEAVED - - #pragma vertex Vert - #pragma fragment AO_Frag - - #include "HBAO_AO.hlsl" - ENDHLSL - } - - // 2 - Pass { - Name "HBAO - Deinterleave Depth" - - HLSLPROGRAM - #pragma vertex Vert - #pragma fragment DeinterleaveDepth_Frag - - #include "HBAO_Deinterleaving.hlsl" - ENDHLSL - } - - // 3 - Pass { - Name "HBAO - Deinterleave Normals" - - HLSLPROGRAM - #pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION - #pragma multi_compile_local __ NORMALS_RECONSTRUCT2 NORMALS_RECONSTRUCT4 - #pragma multi_compile_fragment __ _GBUFFER_NORMALS_OCT // support octahedron endoded normals - - #pragma vertex Vert - #pragma fragment DeinterleaveNormals_Frag - - #include "HBAO_Deinterleaving.hlsl" - ENDHLSL - } - - // 4 - Pass { - Name "HBAO - Atlas Deinterleaved AO" - - HLSLPROGRAM - #pragma vertex Vert_Atlas - #pragma fragment Frag - - half4 Frag(Varyings input) : SV_Target - { - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - float2 uv = UnityStereoTransformScreenSpaceTex(input.uv); - return SAMPLE_TEXTURE2D_X(_MainTex, sampler_PointClamp, uv); - } - ENDHLSL - } - - // 5 - Pass { - Name "HBAO - Reinterleave AO" - - HLSLPROGRAM - #pragma vertex Vert - #pragma fragment ReinterleaveAO_Frag - - #include "HBAO_Deinterleaving.hlsl" - ENDHLSL - } - - Pass // 6 - { - Name "HBAO - Blur" - - HLSLPROGRAM - #pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION - #pragma multi_compile_local __ COLOR_BLEEDING - #pragma multi_compile_local BLUR_RADIUS_2 BLUR_RADIUS_3 BLUR_RADIUS_4 BLUR_RADIUS_5 - - #if BLUR_RADIUS_2 - #define KERNEL_RADIUS 2 - #elif BLUR_RADIUS_3 - #define KERNEL_RADIUS 3 - #elif BLUR_RADIUS_4 - #define KERNEL_RADIUS 4 - #elif BLUR_RADIUS_5 - #define KERNEL_RADIUS 5 - #else - #define KERNEL_RADIUS 0 - #endif - - #pragma vertex Vert - #pragma fragment Blur_Frag - - #include "HBAO_Blur.hlsl" - ENDHLSL - } - - Pass // 7 - { - Name "HBAO - Temporal Filter" - - HLSLPROGRAM - #pragma multi_compile_local __ COLOR_BLEEDING - #pragma multi_compile_local __ VARIANCE_CLIPPING_4TAP VARIANCE_CLIPPING_8TAP - - #pragma vertex Vert - #pragma fragment TemporalFilter_Frag - - #include "HBAO_TemporalFilter.hlsl" - ENDHLSL - } - - Pass // 8 - { - Name "HBAO - Copy" - - HLSLPROGRAM - #pragma vertex Vert - #pragma fragment Frag - - half4 Frag(Varyings input) : SV_Target - { - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - float2 uv = UnityStereoTransformScreenSpaceTex(input.uv); - return SAMPLE_TEXTURE2D_X(_MainTex, sampler_PointClamp, uv); - } - ENDHLSL - } - - Pass // 9 - { - Name "HBAO - Composite" - - ColorMask RGB - - HLSLPROGRAM - #pragma multi_compile_local __ LIT_AO - #pragma multi_compile_local __ COLOR_BLEEDING - #pragma multi_compile_local __ MULTIBOUNCE - #pragma multi_compile_local __ DEBUG_AO DEBUG_COLORBLEEDING DEBUG_NOAO_AO DEBUG_AO_AOONLY DEBUG_NOAO_AOONLY - - #pragma vertex Vert - #pragma fragment Composite_Frag - - #include "HBAO_Composite.hlsl" - ENDHLSL - } - - Pass // 10 - { - Name "HBAO - Debug ViewNormals" - - ColorMask RGB - - HLSLPROGRAM - #pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION - #pragma multi_compile_local __ NORMALS_RECONSTRUCT2 NORMALS_RECONSTRUCT4 - #pragma multi_compile_fragment __ _GBUFFER_NORMALS_OCT // support octahedron endoded normals - - #pragma vertex Vert - #pragma fragment AO_Frag - - #define DIRECTIONS 1 - #define STEPS 1 - #define DEBUG_VIEWNORMALS - - #include "HBAO_AO.hlsl" - ENDHLSL - } - } - - Fallback Off -} diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_AO.hlsl b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_AO.hlsl deleted file mode 100644 index f1bb3ac9..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_AO.hlsl +++ /dev/null @@ -1,205 +0,0 @@ -//---------------------------------------------------------------------------------- -// -// Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of NVIDIA CORPORATION nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -//---------------------------------------------------------------------------------- - -#ifndef HBAO_AO_INCLUDED -#define HBAO_AO_INCLUDED - -#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" -#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Macros.hlsl" -#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" -#include "HBAO_Common.hlsl" - -inline float3 FetchLayerViewPos(float2 uv) { - float depth = LinearizeDepth(SAMPLE_TEXTURE2D_X(_DepthTex, sampler_PointClamp, uv).r); -#if ORTHOGRAPHIC_PROJECTION - return float3((uv * _UVToView.xy + _UVToView.zw), depth); -#else - return float3((uv * _UVToView.xy + _UVToView.zw) * depth, depth); -#endif - -} - -inline float Falloff(float distanceSquare) { - // 1 scalar mad instruction - return distanceSquare * _NegInvRadius2 + 1.0; -} - -inline float ComputeAO(float3 P, float3 N, float3 S) { - float3 V = S - P; - float VdotV = dot(V, V); - float NdotV = dot(N, V) * rsqrt(VdotV); - - // Use saturate(x) instead of max(x,0.f) because that is faster on Kepler - return saturate(NdotV - _AngleBias) * saturate(Falloff(VdotV)); -} - -inline float2 RotateDirections(float2 dir, float2 rot) { - return float2(dir.x * rot.x - dir.y * rot.y, - dir.x * rot.y + dir.y * rot.x); -} - -inline float InterleavedGradientNoise(float2 screenPos) { - // http://www.iryoku.com/downloads/Next-Generation-Post-Processing-in-Call-of-Duty-Advanced-Warfare-v18.pptx (slide 123) - float3 magic = float3(0.06711056, 0.00583715, 52.9829189); - return frac(magic.z * frac(dot(screenPos, magic.xy))); -} - -inline float2 FetchNoise(float2 screenPos) { - #if INTERLEAVED_GRADIENT_NOISE - // Use Jorge Jimenez's IGN noise and GTAO spatial offsets distribution - // https://blog.selfshadow.com/publications/s2016-shading-course/activision/s2016_pbs_activision_occlusion.pdf (slide 93) - return float2(InterleavedGradientNoise(screenPos), SAMPLE_TEXTURE2D(_NoiseTex, sampler_PointRepeat, screenPos / 4.0).g); - #else - // (cos(alpha), sin(alpha), jitter) - return SAMPLE_TEXTURE2D(_NoiseTex, sampler_PointRepeat, screenPos / 4.0).rg; - #endif -} - -float4 AO_Frag(Varyings input) : SV_Target -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - float2 uv = UnityStereoTransformScreenSpaceTex(input.uv); - //uint2 positionSS = input.uv * _ScreenSize.xy; - - #ifdef DEINTERLEAVED - float3 P = FetchLayerViewPos(uv); - #else - float3 P = FetchViewPos(uv); - #endif - - #ifndef DEBUG_VIEWNORMALS - clip(_MaxDistance - P.z); - #endif - - #if ORTHOGRAPHIC_PROJECTION - float stepSize = min(_Radius, _MaxRadiusPixels) / (STEPS + 1.0); - #else - float stepSize = min((_Radius / P.z), _MaxRadiusPixels) / (STEPS + 1.0); - #endif - - #ifdef DEINTERLEAVED - float3 N = SAMPLE_TEXTURE2D_X(_NormalsTex, sampler_PointClamp, uv).rgb * 2.0 - 1.0; - float2 rand = _Jitter; // angle, jitter - #else - float3 N = FetchViewNormals(uv, _AO_TexelSize.xy, P); - //float2 rand = FetchNoise(positionSS); - //float2 rand = FetchNoise(input.positionCS.xy); - float2 rand = FetchNoise(uv * _AO_TexelSize.zw); - #endif - - const float alpha = 2.0 * PI / DIRECTIONS; - float ao = 0; - - #if COLOR_BLEEDING - static float2 cbUVs[DIRECTIONS * STEPS]; - static float cbContribs[DIRECTIONS * STEPS]; - #endif - - UNITY_UNROLL - for (int d = 0; d < DIRECTIONS; ++d) { - float angle = alpha * (float(d) + rand.x + _TemporalParams.x); - - // Compute normalized 2D direction - float cosA, sinA; - sincos(angle, sinA, cosA); - float2 direction = float2(cosA, sinA); - - // Jitter starting sample within the first step - float rayPixels = (frac(rand.y + _TemporalParams.y) * stepSize + 1.0); - - UNITY_UNROLL - for (int s = 0; s < STEPS; ++s) { - - #ifdef DEINTERLEAVED - float2 snappedUV = round(rayPixels * direction) * _DeinterleavedAO_TexelSize.xy + uv; - float3 S = FetchLayerViewPos(snappedUV); - #else - float2 snappedUV = round(rayPixels * direction) * _Input_TexelSize.xy + uv; - float3 S = FetchViewPos(snappedUV); - #endif - - rayPixels += stepSize; - - float contrib = ComputeAO(P, N, S); - #if OFFSCREEN_SAMPLES_CONTRIBUTION - float2 offscreenAmount = _OffscreenSamplesContrib * (snappedUV - saturate(snappedUV) != 0 ? 1 : 0); - contrib = max(contrib, offscreenAmount.x); - contrib = max(contrib, offscreenAmount.y); - #endif - ao += contrib; - - #if COLOR_BLEEDING - int sampleIdx = d * s; - cbUVs[sampleIdx] = snappedUV; - cbContribs[sampleIdx] = contrib; - #endif - } - } - - #ifdef DEBUG_VIEWNORMALS - return float4(N * 0.5 + 0.5, 1); - #else - - #if COLOR_BLEEDING - half3 col = half3(0, 0, 0); - UNITY_UNROLL - for (int s = 0; s < DIRECTIONS * STEPS; s += 2) { - half3 emission = SAMPLE_TEXTURE2D_X_LOD(_MainTex, sampler_LinearClamp, cbUVs[s], 0).rgb; - half average = (emission.x + emission.y + emission.z) / 3; - half scaledAverage = saturate((average - _ColorBleedBrightnessMaskRange.x) / (_ColorBleedBrightnessMaskRange.y - _ColorBleedBrightnessMaskRange.x + 1e-6)); - half maskMultiplier = 1 - (scaledAverage * _ColorBleedBrightnessMask); - col += emission * cbContribs[s] * maskMultiplier; - } - float4 aoOutput = float4(col, ao); - #else - float aoOutput = ao; - #endif - - // apply bias multiplier - aoOutput *= (_AOmultiplier / (STEPS * DIRECTIONS)); - - float fallOffStart = _MaxDistance - _DistanceFalloff; - float distFactor = saturate((P.z - fallOffStart) / (_MaxDistance - fallOffStart)); - - #if COLOR_BLEEDING - //aoOutput.rgb = saturate(1 - lerp(dot(aoOutput.rgb, 0.333).xxx, aoOutput.rgb, _ColorBleedSaturation)); - aoOutput.rgb = saturate(lerp(dot(aoOutput.rgb, 0.333).xxx, aoOutput.rgb, _ColorBleedSaturation)); - aoOutput = lerp(saturate(float4(aoOutput.rgb, 1 - aoOutput.a)), float4(0, 0, 0, 1), distFactor); - return aoOutput; - #else - aoOutput = lerp(saturate(1 - aoOutput), 1, distFactor); - return float4(EncodeFloatRG(saturate(P.z * (1.0 / _ProjectionParams.z))), 1.0, aoOutput); - #endif - - #endif // DEBUG_VIEWNORMALS -} - -#endif // HBAO_AO_INCLUDED diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Blur.hlsl b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Blur.hlsl deleted file mode 100644 index 9a6f1662..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Blur.hlsl +++ /dev/null @@ -1,143 +0,0 @@ -//---------------------------------------------------------------------------------- -// -// Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of NVIDIA CORPORATION nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -//---------------------------------------------------------------------------------- - -#ifndef HBAO_BLUR_INCLUDED -#define HBAO_BLUR_INCLUDED - -#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" -#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" -#include "HBAO_Common.hlsl" - -#if COLOR_BLEEDING - -inline void FetchAoAndDepth(float2 uv, inout half4 ao, inout float depth) { - ao = SAMPLE_TEXTURE2D_X_LOD(_MainTex, sampler_PointClamp, uv, 0); - depth = LinearizeDepth(FetchRawDepth(uv)); -} - -inline float CrossBilateralWeight(float r, float d, float d0) { - const float BlurSigma = (float)KERNEL_RADIUS * 0.5; - const float BlurFalloff = 1.0 / (2.0*BlurSigma*BlurSigma); - - float dz = (d0 - d) * _BlurSharpness; - return exp2(-r*r*BlurFalloff - dz*dz); -} - -inline void ProcessSample(float4 ao, float z, float r, float d0, inout half4 totalAO, inout float totalW) { - float w = CrossBilateralWeight(r, d0, z); - totalW += w; - totalAO += w * ao; -} - -inline void ProcessRadius(float2 uv0, float2 deltaUV, float d0, inout half4 totalAO, inout float totalW) { - half4 ao; - float z; - float2 uv; - UNITY_UNROLL - for (int r = 1; r <= KERNEL_RADIUS; r++) { - uv = uv0 + r * deltaUV; - FetchAoAndDepth(uv, ao, z); - ProcessSample(ao, z, r, d0, totalAO, totalW); - } -} - -inline half4 ComputeBlur(float2 uv0, float2 deltaUV) { - half4 totalAO; - float depth; - FetchAoAndDepth(uv0, totalAO, depth); - float totalW = 1.0; - - ProcessRadius(uv0, -deltaUV, depth, totalAO, totalW); - ProcessRadius(uv0, deltaUV, depth, totalAO, totalW); - - totalAO /= totalW; - return totalAO; -} - -#else - -inline void FetchAoAndDepth(float2 uv, inout half ao, inout float2 depth) { - float3 aod = SAMPLE_TEXTURE2D_X_LOD(_MainTex, sampler_PointClamp, uv, 0).rga; - ao = aod.z; - depth = aod.xy; -} - -inline float CrossBilateralWeight(float r, float d, float d0) { - const float BlurSigma = (float)KERNEL_RADIUS * 0.5; - const float BlurFalloff = 1.0 / (2.0*BlurSigma*BlurSigma); - - float dz = (d0 - d) * _ProjectionParams.z * _BlurSharpness; - return exp2(-r*r*BlurFalloff - dz*dz); -} - -inline void ProcessSample(float2 aoz, float r, float d0, inout half totalAO, inout float totalW) { - float w = CrossBilateralWeight(r, d0, aoz.y); - totalW += w; - totalAO += w * aoz.x; -} - -inline void ProcessRadius(float2 uv0, float2 deltaUV, float d0, inout half totalAO, inout float totalW) { - half ao; - float z; - float2 d, uv; - UNITY_UNROLL - for (int r = 1; r <= KERNEL_RADIUS; r++) { - uv = uv0 + r * deltaUV; - FetchAoAndDepth(uv, ao, d); - z = DecodeFloatRG(d); - ProcessSample(float2(ao, z), r, d0, totalAO, totalW); - } -} - -inline float4 ComputeBlur(float2 uv0, float2 deltaUV) { - half totalAO; - float2 depth; - FetchAoAndDepth(uv0, totalAO, depth); - float d0 = DecodeFloatRG(depth); - float totalW = 1.0; - - ProcessRadius(uv0, -deltaUV, d0, totalAO, totalW); - ProcessRadius(uv0, deltaUV, d0, totalAO, totalW); - - totalAO /= totalW; - return float4(depth, 1.0, totalAO); -} -#endif // COLOR_BLEEDING - -float4 Blur_Frag(Varyings input) : SV_Target -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - float2 uv = UnityStereoTransformScreenSpaceTex(input.uv); - - return ComputeBlur(uv, _BlurDeltaUV); -} - -#endif // HBAO_BLUR_INCLUDED diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Common.hlsl b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Common.hlsl deleted file mode 100644 index ba825099..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Common.hlsl +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef HBAO_COMMON_INCLUDED -#define HBAO_COMMON_INCLUDED - -#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" -#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" -#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" -#if VERSION_GREATER_EQUAL(10, 0) -#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" -#endif - -inline float FetchRawDepth(float2 uv) { - return SampleSceneDepth(uv * _TargetScale.xy); -} - -inline float LinearizeDepth(float depth) { - // References: https://docs.unity3d.com/Manual/SL-PlatformDifferences.html -#if ORTHOGRAPHIC_PROJECTION -#if UNITY_REVERSED_Z - depth = 1 - depth; -#endif // UNITY_REVERSED_Z - float linearDepth = _ProjectionParams.y + depth * (_ProjectionParams.z - _ProjectionParams.y); // near + depth * (far - near) -#else - float linearDepth = LinearEyeDepth(depth, _ZBufferParams); -#endif // ORTHOGRAPHIC_PROJECTION - return linearDepth; -} - -inline float3 FetchViewPos(float2 uv) { - float depth = LinearizeDepth(FetchRawDepth(uv)); -#if ORTHOGRAPHIC_PROJECTION - return float3((uv * _UVToView.xy + _UVToView.zw), depth); -#else - return float3((uv * _UVToView.xy + _UVToView.zw) * depth, depth); -#endif -} - -inline float3 MinDiff(float3 P, float3 Pr, float3 Pl) { - float3 V1 = Pr - P; - float3 V2 = P - Pl; - return (dot(V1, V1) < dot(V2, V2)) ? V1 : V2; -} - -inline float3 FetchViewNormals(float2 uv, float2 delta, float3 P) { -#if NORMALS_RECONSTRUCT4 - float3 Pr, Pl, Pt, Pb; - Pr = FetchViewPos(uv + float2(delta.x, 0)); - Pl = FetchViewPos(uv + float2(-delta.x, 0)); - Pt = FetchViewPos(uv + float2(0, delta.y)); - Pb = FetchViewPos(uv + float2(0, -delta.y)); - float3 N = normalize(cross(MinDiff(P, Pr, Pl), MinDiff(P, Pt, Pb))); -#elif NORMALS_RECONSTRUCT2 - float3 Pr, Pt; - Pr = FetchViewPos(uv + float2(delta.x, 0)); - Pt = FetchViewPos(uv + float2(0, delta.y)); - float3 N = normalize(cross(Pt - P, P - Pr)); -#else -#if VERSION_GREATER_EQUAL(10, 0) - float3 N = SampleSceneNormals(uv * _TargetScale.xy); -#if VERSION_GREATER_EQUAL(12, 0) - N = mul((float3x3)_WorldToCameraMatrix, N); // normals are worldspace, convert to viewspace - N = float3(N.x, -N.yz); -#else - N = float3(N.x, -N.y, N.z); -#endif -#else - float3 N = float3(0, 0, 0); -#endif -#endif - return N; -} - -inline float3 FetchViewNormals(float2 uv, float2 delta) { - - float3 P = FetchViewPos(uv); - return FetchViewNormals(uv, delta, P); -} - -// https://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/ - -inline float2 EncodeFloatRG(float v) { - float2 enc = float2(1.0, 255.0) * v; - enc = frac(enc); - enc.x -= enc.y * (1.0 / 255.0); - return enc; -} - -inline float DecodeFloatRG(float2 rg) { - return dot(rg, float2(1.0, 1 / 255.0)); -} - -#endif // HBAO_COMMON_INCLUDED diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Common.hlsl.meta b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Common.hlsl.meta deleted file mode 100644 index 0b08b8be..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Common.hlsl.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c9db0967d4ddb8d4da2fc53a15906f15 -ShaderImporter: - externalObjects: {} - defaultTextures: [] - nonModifiableTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Composite.hlsl b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Composite.hlsl deleted file mode 100644 index c3026810..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Composite.hlsl +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef HBAO_COMPOSITE_INCLUDED -#define HBAO_COMPOSITE_INCLUDED - -#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" -#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" -#include "HBAO_Common.hlsl" - -inline half4 FetchOcclusion(float2 uv) { - uv *= _HistoryBuffer_RTHandleScale.xy; - return SAMPLE_TEXTURE2D_X(_HBAOTex, sampler_PointClamp, uv * _TargetScale.zw); -} - -inline half4 FetchSceneColor(float2 uv) { - //return LOAD_TEXTURE2D_X(_MainTex, positionSS); // load not supported on GLES2 - return SAMPLE_TEXTURE2D_X(_MainTex, sampler_PointClamp, uv); -} - -inline half3 MultiBounceAO(float visibility, half3 albedo) { - half3 a = 2.0404 * albedo - 0.3324; - half3 b = -4.7951 * albedo + 0.6417; - half3 c = 2.7552 * albedo + 0.6903; - - float x = visibility; - return max(x, ((x * a + b) * x + c) * x); -} - -float4 Composite_Frag(Varyings input) : SV_Target -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - //uint2 positionSS = input.uv * _ScreenSize.xy; - float2 uv = UnityStereoTransformScreenSpaceTex(input.uv); - - half4 ao = FetchOcclusion(uv); - half4 col = FetchSceneColor(uv); - - // AO 강도 조절 - ao.a = saturate(pow(abs(ao.a), _Intensity)); - - #if LIT_AO - half3 aoColor = ao.aaa; - col = ao.aaaa; - #else - // AO 색상 계산 - half3 aoColor = lerp(_BaseColor.rgb, half3(1.0, 1.0, 1.0), ao.a); - - #if MULTIBOUNCE - aoColor = lerp(aoColor, MultiBounceAO(ao.a, lerp(col.rgb, _BaseColor.rgb, _BaseColor.rgb)), _MultiBounceInfluence); - #endif - - // 최종 색상 계산 - 직접적인 블렌딩 - half3 finalColor = col.rgb * aoColor; - - // 원본 색상과 AO를 자연스럽게 혼합 - col.rgb = lerp(finalColor, col.rgb, 0.3); - - #if COLOR_BLEEDING - // 컬러 블리딩 효과 - half3 bleedColor = ao.rgb * col.rgb; - col.rgb = lerp(col.rgb, bleedColor, 0.2); - #endif - #endif - - #if DEBUG_AO - col.rgb = aoColor; - #elif DEBUG_COLORBLEEDING && COLOR_BLEEDING - col.rgb = ao.rgb; - #elif DEBUG_NOAO_AO || DEBUG_AO_AOONLY || DEBUG_NOAO_AOONLY - if (uv.x <= 0.4985) { - #if DEBUG_NOAO_AO || DEBUG_NOAO_AOONLY - col = FetchSceneColor(uv); - #endif - return col; - } - if (uv.x > 0.4985 && uv.x < 0.5015) { - return half4(0, 0, 0, 1); - } - #if DEBUG_AO_AOONLY || DEBUG_NOAO_AOONLY - col.rgb = aoColor; - #endif - #endif - - return col; -} - -#endif // HBAO_COMPOSITE_INCLUDED diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Composite.hlsl.meta b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Composite.hlsl.meta deleted file mode 100644 index 216ef631..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Composite.hlsl.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5724686e7ad5fff4cb8cc1ad5529cd06 -ShaderImporter: - externalObjects: {} - defaultTextures: [] - nonModifiableTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Deinterleaving.hlsl b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Deinterleaving.hlsl deleted file mode 100644 index 4fa06fd5..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Deinterleaving.hlsl +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef HBAO_DEINTERLEAVING_INCLUDED -#define HBAO_DEINTERLEAVING_INCLUDED - -#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" -#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" -#include "HBAO_Common.hlsl" - -struct DeinterleavedOutput { - float4 Z00 : SV_Target0; - float4 Z10 : SV_Target1; - float4 Z01 : SV_Target2; - float4 Z11 : SV_Target3; -}; - -DeinterleavedOutput DeinterleaveDepth_Frag(Varyings input) -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - DeinterleavedOutput o; - - float2 uv = UnityStereoTransformScreenSpaceTex(input.uv); - - float2 pos = floor(uv * _DeinterleavedAO_TexelSize.zw) * 4.0; - float2 uv00 = (pos + _Deinterleave_Offset00 + 0.5) * _ReinterleavedAO_TexelSize.xy; - float2 uv10 = (pos + _Deinterleave_Offset10 + 0.5) * _ReinterleavedAO_TexelSize.xy; - float2 uv01 = (pos + _Deinterleave_Offset01 + 0.5) * _ReinterleavedAO_TexelSize.xy; - float2 uv11 = (pos + _Deinterleave_Offset11 + 0.5) * _ReinterleavedAO_TexelSize.xy; - - o.Z00 = FetchRawDepth(uv00).rrrr; - o.Z10 = FetchRawDepth(uv10).rrrr; - o.Z01 = FetchRawDepth(uv01).rrrr; - o.Z11 = FetchRawDepth(uv11).rrrr; - return o; -} - -DeinterleavedOutput DeinterleaveNormals_Frag(Varyings input) -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - DeinterleavedOutput o; - - float2 uv = UnityStereoTransformScreenSpaceTex(input.uv); - - float2 pos = floor(uv * _DeinterleavedAO_TexelSize.zw) * 4.0; - float2 uv00 = (pos + _Deinterleave_Offset00 + 0.5) * _ReinterleavedAO_TexelSize.xy; - float2 uv10 = (pos + _Deinterleave_Offset10 + 0.5) * _ReinterleavedAO_TexelSize.xy; - float2 uv01 = (pos + _Deinterleave_Offset01 + 0.5) * _ReinterleavedAO_TexelSize.xy; - float2 uv11 = (pos + _Deinterleave_Offset11 + 0.5) * _ReinterleavedAO_TexelSize.xy; - - o.Z00 = float4(FetchViewNormals(uv00, _ReinterleavedAO_TexelSize.xy) * 0.5 + 0.5, 0); - o.Z10 = float4(FetchViewNormals(uv10, _ReinterleavedAO_TexelSize.xy) * 0.5 + 0.5, 0); - o.Z01 = float4(FetchViewNormals(uv01, _ReinterleavedAO_TexelSize.xy) * 0.5 + 0.5, 0); - o.Z11 = float4(FetchViewNormals(uv11, _ReinterleavedAO_TexelSize.xy) * 0.5 + 0.5, 0); - - return o; -} - -half4 ReinterleaveAO_Frag(Varyings input) : SV_Target -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - float2 uv = UnityStereoTransformScreenSpaceTex(input.uv); - - float2 offset = fmod(floor(uv * _ReinterleavedAO_TexelSize.zw), 4.0); - uv = (floor(uv * _DeinterleavedAO_TexelSize.zw) + (offset * _DeinterleavedAO_TexelSize.zw) + 0.5) * _ReinterleavedAO_TexelSize.xy; - - return SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv); -} - -#endif // HBAO_DEINTERLEAVING_INCLUDED diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Deinterleaving.hlsl.meta b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Deinterleaving.hlsl.meta deleted file mode 100644 index b13bd5bf..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Deinterleaving.hlsl.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 713016b17f006794a883de31a276c28e -ShaderImporter: - externalObjects: {} - defaultTextures: [] - nonModifiableTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_TemporalFilter.hlsl b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_TemporalFilter.hlsl deleted file mode 100644 index 76e26287..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_TemporalFilter.hlsl +++ /dev/null @@ -1,175 +0,0 @@ -#ifndef HBAO_TEMPORALFILTER_INCLUDED -#define HBAO_TEMPORALFILTER_INCLUDED - -#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" -#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" -#include "HBAO_Common.hlsl" - -struct HistoryOutput { - float4 aoHistory : SV_Target0; - #if COLOR_BLEEDING - half4 colorBleedingHistory : SV_Target1; - #endif -}; - -#if COLOR_BLEEDING -#define CTYPE half4 -#else -#define CTYPE half -#endif - -inline void FetchAoAndDepth(float2 uv, inout CTYPE ao, inout float2 depth) { - #if COLOR_BLEEDING - ao = SAMPLE_TEXTURE2D_X(_HBAOTex, sampler_PointClamp, uv); - depth = EncodeFloatRG(saturate(LinearizeDepth(FetchRawDepth(uv)) * (1.0 / _ProjectionParams.z))); - #else - float3 aod = SAMPLE_TEXTURE2D_X(_HBAOTex, sampler_PointClamp, uv).rga; - ao = aod.z; - depth = aod.xy; - #endif -} - -inline float2 FetchMotionVectors(float2 uv) { - return SAMPLE_TEXTURE2D_X(_MotionVectorTexture, sampler_PointClamp, uv * _TargetScale.xy).rg; -} - -inline float4 FetchAoHistory(float2 uv) { - return SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv * _HistoryBuffer_RTHandleScale.zw); -} - -inline half4 FetchColorBleedingHistory(float2 uv) { - return SAMPLE_TEXTURE2D_X(_TempTex, sampler_LinearClamp, uv * _HistoryBuffer_RTHandleScale.zw); -} - -inline CTYPE FetchNeighbor(float2 uv, float2 offset) { - #if COLOR_BLEEDING - return SAMPLE_TEXTURE2D_X(_HBAOTex, sampler_PointClamp, uv + _AO_TexelSize.xy * offset); - #else - return SAMPLE_TEXTURE2D_X(_HBAOTex, sampler_PointClamp, uv + _AO_TexelSize.xy * offset).a; - #endif -} - -inline half DisocclusionTest(float2 uvm1, float2 depth, float2 depthm1) { - - // disocclusion test - // https://developer.nvidia.com/sites/default/files/akamai/gamedev/files/gdc12/GDC12_Bavoil_Stable_SSAO_In_BF3_With_STF.pdf (Page 19) - float z = DecodeFloatRG(depth); - float zm1 = DecodeFloatRG(depthm1); - // for fetching zi-1, use clamp-to-border to discard out-of-frame data, with borderZ = 0.f - // https://developer.nvidia.com/sites/default/files/akamai/gamedev/files/gdc12/GDC12_Bavoil_Stable_SSAO_In_BF3_With_STF.pdf (Page 39) - // if (uvm1.x < 0 || uvm1.y < 0 || uvm1.x > 1 || uvm1.y > 1) zm1 = 0; - // if (uvm1.x < 0 || uvm1.y < 0 || uvm1.x > 1 || uvm1.y > 1) => dot(step(half4(uvm1, 1, 1), half4(0, 0, uvm1)), 1) is 1 if out-of-frame, so - zm1 *= 1.0 - dot(step(float4(uvm1, 1, 1), float4(0, 0, uvm1)), 1); - // relaxed disocclusion test: abs(1.0 - (z / zm1)) > 0.1 => 10% - // float disocclusion = max(sign(abs(1.0 - (z / zm1)) - 0.1), 0.0); - float disocclusion = abs(1.0 - (z / zm1)) > 0.1; - - return disocclusion; -} - -inline CTYPE VarianceClipping(float2 uv, CTYPE ao, CTYPE aom1, float velocityWeight) { - - // neighborhood clamping - // http://twvideo01.ubm-us.net/o1/vault/gdc2016/Presentations/Pedersen_LasseJonFuglsang_TemporalReprojectionAntiAliasing.pdf // (pages 26-28) - // superseded by variance clipping - // http://developer.download.nvidia.com/gameworks/events/GDC2016/msalvi_temporal_supersampling.pdf (page 23-29) - #if VARIANCE_CLIPPING_4TAP - CTYPE cT = FetchNeighbor(uv, float2(0, 1)); - CTYPE cR = FetchNeighbor(uv, float2(1, 0)); - CTYPE cB = FetchNeighbor(uv, float2(0, -1)); - CTYPE cL = FetchNeighbor(uv, float2(-1, 0)); - // compute 1st and 2nd color moments - CTYPE m1 = ao + cT + cR + cB + cL; - CTYPE m2 = ao * ao + cT * cT + cR * cR + cB * cB + cL * cL; - // aabb from mean u and variance sigma2 - CTYPE mu = m1 / 5.0; - CTYPE sigma = sqrt(m2 / 5.0 - mu * mu); - - #elif VARIANCE_CLIPPING_8TAP - CTYPE cTL = FetchNeighbor(uv, float2(-1, 1)); - CTYPE cT = FetchNeighbor(uv, float2(0, 1)); - CTYPE cTR = FetchNeighbor(uv, float2(1, 1)); - CTYPE cR = FetchNeighbor(uv, float2(1, 0)); - CTYPE cBR = FetchNeighbor(uv, float2(1, -1)); - CTYPE cB = FetchNeighbor(uv, float2(0, -1)); - CTYPE cBL = FetchNeighbor(uv, float2(-1, -1)); - CTYPE cL = FetchNeighbor(uv, float2(-1, 0)); - // compute 1st and 2nd color moments - CTYPE m1 = ao + cTL + cT + cTR + cR + cBR + cB + cBL + cL; - CTYPE m2 = ao * ao + cTL * cTL + cT * cT + cTR * cTR + cR * cR + cBR * cBR + cB * cB + cBL * cBL + cL * cL; - // aabb from mean u and variance sigma2 - CTYPE mu = m1 / 9.0; - CTYPE sigma = sqrt(m2 / 9.0 - mu * mu); - #endif - - #if VARIANCE_CLIPPING_4TAP || VARIANCE_CLIPPING_8TAP - float gamma = lerp(75.0, 0.75, velocityWeight); // scale down sigma for reduced ghosting - CTYPE cmin = mu - gamma * sigma; - CTYPE cmax = mu + gamma * sigma; - - // clipping - return clamp(aom1, cmin, cmax); - #else - return aom1; - #endif -} - -HistoryOutput TemporalFilter_Frag(Varyings input) -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - float2 uv = UnityStereoTransformScreenSpaceTex(input.uv); - - // fetch current frame data - CTYPE ao; float2 depth; - FetchAoAndDepth(uv, ao, depth); - - // fetch motion vectors, calculate previous frame uv - float2 mv = FetchMotionVectors(uv); - float2 uvm1 = uv - mv.xy; - float mvl = length(mv); - - // fetch history - float4 aoHistory = FetchAoHistory(uvm1); - #if COLOR_BLEEDING - half4 colorBleedingHistory = FetchColorBleedingHistory(uvm1); - CTYPE aom1 = colorBleedingHistory; - #else - CTYPE aom1 = aoHistory.w; - #endif - float2 depthm1 = aoHistory.xy; - float mvlm1 = aoHistory.z; - - // velocity weight - float velocityWeight = saturate(abs(mvl - mvlm1) * 300.0); - - // do disocclusion test - half disocclusion = DisocclusionTest(uvm1, depth, depthm1); - - // apply velocity weight and disocclusion - #if COLOR_BLEEDING - aom1.a = aom1.a + saturate(dot(float2(velocityWeight, disocclusion), 1.0)) * (ao.a - aom1.a); - #else - aom1 = aom1 + saturate(dot(float2(velocityWeight, disocclusion), 1.0)) * (ao - aom1); - #endif - - // do variance clipping - aom1 = VarianceClipping(uv, ao, aom1, velocityWeight); - - // exponential accumulation buffer - // http://www.klayge.org/material/4_11/Filmic%20SMAA%20v7.pdf (page 54) - // http://developer.download.nvidia.com/gameworks/events/GDC2016/msalvi_temporal_supersampling.pdf (page 13) - ao = aom1 + 0.1 * (ao - aom1); - - HistoryOutput o; - #if COLOR_BLEEDING - o.aoHistory = float4(depth, mvl, ao.a); - o.colorBleedingHistory = ao; - #else - o.aoHistory = float4(depth, mvl, ao); - #endif - - return o; -} - -#endif // HBAO_TEMPORALFILTER_INCLUDED diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_TemporalFilter.hlsl.meta b/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_TemporalFilter.hlsl.meta deleted file mode 100644 index 79f7a18d..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_TemporalFilter.hlsl.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: bbf71e1c97b8d654da3f7646050e713e -ShaderImporter: - externalObjects: {} - defaultTextures: [] - nonModifiableTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP/Readme.txt b/Assets/External/Horizon Based Ambient Occlusion/SRP/Readme.txt deleted file mode 100644 index 899a6bea..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP/Readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2b6d2f9314838a2176ff1fa524bd7337a81246e624f4075466a8d52822a2d471 -size 444 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO.shader b/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO.shader deleted file mode 100644 index 43a2a40a..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO.shader +++ /dev/null @@ -1,429 +0,0 @@ -Shader "Hidden/HBAO" -{ - Properties { - _MainTex ("", any) = "" {} - _HBAOTex ("", any) = "" {} - _TempTex("", any) = "" {} - _NoiseTex("", 2D) = "" {} - _DepthTex("", any) = "" {} - _NormalsTex("", any) = "" {} - } - - CGINCLUDE - - #pragma target 3.0 - #pragma editor_sync_compilation - - #include "UnityCG.cginc" - - UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex); - UNITY_DECLARE_SCREENSPACE_TEXTURE(_HBAOTex); - UNITY_DECLARE_SCREENSPACE_TEXTURE(_TempTex); - UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); - UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraGBufferTexture0); // diffuse color (RGB), occlusion (A) - UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraGBufferTexture2); // normal (rgb), --unused-- (a) - UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraMotionVectorsTexture); - UNITY_DECLARE_SCREENSPACE_TEXTURE(_NormalsTex); - UNITY_DECLARE_TEX2D(_NoiseTex); - - UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); - UNITY_DECLARE_DEPTH_TEXTURE(_DepthTex); - - CBUFFER_START(FrequentlyUpdatedUniforms) - float4 _Input_TexelSize; - float4 _AO_TexelSize; - float4 _DeinterleavedAO_TexelSize; - float4 _ReinterleavedAO_TexelSize; - float4 _TargetScale; - float4 _UVToView; - float4x4 _WorldToCameraMatrix; - float _Radius; - float _MaxRadiusPixels; - float _NegInvRadius2; - float _AngleBias; - float _AOmultiplier; - float _Intensity; - half4 _BaseColor; - float _MultiBounceInfluence; - float _OffscreenSamplesContrib; - float _MaxDistance; - float _DistanceFalloff; - float _BlurSharpness; - float _ColorBleedSaturation; - float _AlbedoMultiplier; - float _ColorBleedBrightnessMask; - float2 _ColorBleedBrightnessMaskRange; - float2 _TemporalParams; - CBUFFER_END - - CBUFFER_START(PerPassUpdatedUniforms) - float4 _UVTransform; - float2 _BlurDeltaUV; - CBUFFER_END - - CBUFFER_START(PerPassUpdatedDeinterleavingUniforms) - float2 _Deinterleave_Offset00; - float2 _Deinterleave_Offset10; - float2 _Deinterleave_Offset01; - float2 _Deinterleave_Offset11; - float2 _AtlasOffset; - float2 _Jitter; - CBUFFER_END - - struct Attributes - { - float3 vertex : POSITION; - - UNITY_VERTEX_INPUT_INSTANCE_ID - }; - - struct Varyings - { - float4 vertex : SV_POSITION; - float2 uv : TEXCOORD0; - //float2 uvStereo : TEXCOORD1; - //#if STEREO_INSTANCING_ENABLED - //uint stereoTargetEyeIndex : SV_RenderTargetArrayIndex; - //#endif - - UNITY_VERTEX_OUTPUT_STEREO - }; - - float2 TransformTriangleVertexToUV(float2 vertex) - { - float2 uv = (vertex + 1.0) * 0.5; - return uv; - } - - Varyings Vert_Default(Attributes input) - { - Varyings o; - - UNITY_SETUP_INSTANCE_ID(input); - UNITY_INITIALIZE_OUTPUT(Varyings, o); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - - o.vertex = float4(input.vertex.xy, 0.0, 1.0); - o.uv = TransformTriangleVertexToUV(input.vertex.xy); - - #if UNITY_UV_STARTS_AT_TOP - o.uv = o.uv * float2(1.0, -1.0) + float2(0.0, 1.0); - #endif - - //o.uvStereo = TransformStereoScreenSpaceTex(o.uv, 1.0); - o.uv = TransformStereoScreenSpaceTex(o.uv, 1.0); - - return o; - } - - Varyings Vert_Atlas(Attributes input) - { - Varyings o; - - UNITY_SETUP_INSTANCE_ID(input); - UNITY_INITIALIZE_OUTPUT(Varyings, o); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - - o.vertex = float4((input.vertex.xy + float2(-3.0, 1.0)) * (_DeinterleavedAO_TexelSize.zw / _ReinterleavedAO_TexelSize.zw) + 2.0 * _AtlasOffset * _ReinterleavedAO_TexelSize.xy, 0.0, 1.0); - o.uv = TransformTriangleVertexToUV(input.vertex.xy); - - // flip triangle upside down - o.vertex.y = 1 - o.vertex.y; - - //o.uvStereo = TransformStereoScreenSpaceTex(o.uv, 1.0); - o.uv = TransformStereoScreenSpaceTex(o.uv, 1.0); - - return o; - } - - Varyings Vert_UVTransform(Attributes input) - { - Varyings o; - - UNITY_SETUP_INSTANCE_ID(input); - UNITY_INITIALIZE_OUTPUT(Varyings, o); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - - o.vertex = float4(input.vertex.xy, 0.0, 1.0); - o.uv = TransformTriangleVertexToUV(input.vertex.xy) * _UVTransform.xy + _UVTransform.zw; - - //o.uvStereo = TransformStereoScreenSpaceTex(o.uv, 1.0); - o.uv = TransformStereoScreenSpaceTex(o.uv, 1.0); - - //#if STEREO_INSTANCING_ENABLED - //o.stereoTargetEyeIndex = (uint)_DepthSlice; - //#endif - - return o; - } - - ENDCG - - SubShader { - LOD 100 - ZTest Always Cull Off ZWrite Off - - // 0 - Pass { - Name "HBAO - AO" - - CGPROGRAM - #pragma multi_compile_local __ DEFERRED_SHADING ORTHOGRAPHIC_PROJECTION - #pragma multi_compile_local __ COLOR_BLEEDING - #pragma multi_compile_local __ OFFSCREEN_SAMPLES_CONTRIBUTION - #pragma multi_compile_local __ NORMALS_CAMERA NORMALS_RECONSTRUCT - #pragma multi_compile_local __ INTERLEAVED_GRADIENT_NOISE - #pragma multi_compile_local QUALITY_LOWEST QUALITY_LOW QUALITY_MEDIUM QUALITY_HIGH QUALITY_HIGHEST - - #if QUALITY_LOWEST - #define DIRECTIONS 3 - #define STEPS 2 - #elif QUALITY_LOW - #define DIRECTIONS 4 - #define STEPS 3 - #elif QUALITY_MEDIUM - #define DIRECTIONS 6 - #define STEPS 4 - #elif QUALITY_HIGH - #define DIRECTIONS 8 - #define STEPS 4 - #elif QUALITY_HIGHEST - #define DIRECTIONS 8 - #define STEPS 6 - #else - #define DIRECTIONS 1 - #define STEPS 1 - #endif - - #pragma vertex Vert_Default - #pragma fragment AO_Frag - - #include "HBAO_AO.cginc" - ENDCG - } - - // 1 - Pass { - Name "HBAO - AO Deinterleaved" - - CGPROGRAM - #pragma multi_compile_local __ DEFERRED_SHADING ORTHOGRAPHIC_PROJECTION - #pragma multi_compile_local __ COLOR_BLEEDING - #pragma multi_compile_local __ OFFSCREEN_SAMPLES_CONTRIBUTION - #pragma multi_compile_local QUALITY_LOWEST QUALITY_LOW QUALITY_MEDIUM QUALITY_HIGH QUALITY_HIGHEST - - #if QUALITY_LOWEST - #define DIRECTIONS 3 - #define STEPS 2 - #elif QUALITY_LOW - #define DIRECTIONS 4 - #define STEPS 3 - #elif QUALITY_MEDIUM - #define DIRECTIONS 6 - #define STEPS 4 - #elif QUALITY_HIGH - #define DIRECTIONS 8 - #define STEPS 4 - #elif QUALITY_HIGHEST - #define DIRECTIONS 8 - #define STEPS 6 - #else - #define DIRECTIONS 1 - #define STEPS 1 - #endif - - #define DEINTERLEAVED - - #pragma vertex Vert_Default - #pragma fragment AO_Frag - - #include "HBAO_AO.cginc" - ENDCG - } - - // 2 - Pass { - Name "HBAO - Deinterleave Depth" - - CGPROGRAM - #pragma vertex Vert_Default - #pragma fragment DeinterleaveDepth_Frag - - #include "HBAO_Deinterleaving.cginc" - ENDCG - } - - // 3 - Pass { - Name "HBAO - Deinterleave Normals" - - CGPROGRAM - #pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION - #pragma multi_compile_local __ NORMALS_CAMERA NORMALS_RECONSTRUCT - - #pragma vertex Vert_Default - #pragma fragment DeinterleaveNormals_Frag - - #include "HBAO_Deinterleaving.cginc" - ENDCG - } - - // 4 - Pass { - Name "HBAO - Atlas Deinterleaved AO" - - CGPROGRAM - #pragma vertex Vert_Atlas - #pragma fragment Frag - - half4 Frag(Varyings input) : SV_Target - { - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, input.uv); - } - ENDCG - } - - // 5 - Pass { - Name "HBAO - Reinterleave AO" - - CGPROGRAM - #pragma vertex Vert_UVTransform - #pragma fragment ReinterleaveAO_Frag - - #include "HBAO_Deinterleaving.cginc" - ENDCG - } - - // 6 - Pass { - Name "HBAO - Blur" - - CGPROGRAM - #pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION - #pragma multi_compile_local __ COLOR_BLEEDING - #pragma multi_compile_local BLUR_RADIUS_2 BLUR_RADIUS_3 BLUR_RADIUS_4 BLUR_RADIUS_5 - - #if BLUR_RADIUS_2 - #define KERNEL_RADIUS 2 - #elif BLUR_RADIUS_3 - #define KERNEL_RADIUS 3 - #elif BLUR_RADIUS_4 - #define KERNEL_RADIUS 4 - #elif BLUR_RADIUS_5 - #define KERNEL_RADIUS 5 - #endif - - #pragma vertex Vert_Default - #pragma fragment Blur_Frag - - #include "HBAO_Blur.cginc" - ENDCG - } - - // 7 - Pass { - Name "HBAO - Temporal Filter" - - CGPROGRAM - #pragma multi_compile_local __ COLOR_BLEEDING - #pragma multi_compile_local __ VARIANCE_CLIPPING_4TAP VARIANCE_CLIPPING_8TAP - - #pragma vertex Vert_Default - #pragma fragment TemporalFilter_Frag - - #include "HBAO_TemporalFilter.cginc" - ENDCG - } - - // 8 - Pass { - Name "HBAO - Copy" - - CGPROGRAM - #pragma vertex Vert_Default - #pragma fragment Frag - - half4 Frag(Varyings input) : SV_Target - { - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, input.uv); - } - ENDCG - } - - // 9 - Pass { - Name "HBAO - Composite" - - ColorMask RGB - - CGPROGRAM - #pragma multi_compile_local __ COLOR_BLEEDING - #pragma multi_compile_local __ MULTIBOUNCE - #pragma multi_compile_local __ DEBUG_AO DEBUG_COLORBLEEDING DEBUG_NOAO_AO DEBUG_AO_AOONLY DEBUG_NOAO_AOONLY - - #pragma vertex Vert_UVTransform - #pragma fragment Composite_Frag - - #include "HBAO_Composite.cginc" - ENDCG - } - - // 10 - Pass { - Name "HBAO - Composite AfterLighting" - - CGPROGRAM - #pragma multi_compile_local __ COLOR_BLEEDING - #pragma multi_compile_local __ MULTIBOUNCE - #pragma multi_compile_local __ LIGHTING_LOG_ENCODED - - #pragma vertex Vert_Default - #pragma fragment Composite_Frag - - #include "HBAO_Composite.cginc" - ENDCG - } - - // 11 - Pass { - Name "HBAO - Composite BeforeReflections" - - CGPROGRAM - #pragma multi_compile_local __ COLOR_BLEEDING - #pragma multi_compile_local __ LIGHTING_LOG_ENCODED - - #pragma vertex Vert_Default - #pragma fragment Composite_Lit_Frag - - #include "HBAO_Composite.cginc" - ENDCG - } - - // 12 - Pass { - Name "HBAO - Debug ViewNormals" - - ColorMask RGB - - CGPROGRAM - #pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION - #pragma multi_compile_local __ NORMALS_CAMERA NORMALS_RECONSTRUCT - - #pragma vertex Vert_UVTransform - #pragma fragment AO_Frag - - #define DIRECTIONS 1 - #define STEPS 1 - #define DEBUG_VIEWNORMALS - #include "HBAO_AO.cginc" - ENDCG - } - } - - FallBack off -} diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_AO.cginc b/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_AO.cginc deleted file mode 100644 index 74302714..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_AO.cginc +++ /dev/null @@ -1,203 +0,0 @@ -//---------------------------------------------------------------------------------- -// -// Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of NVIDIA CORPORATION nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -//---------------------------------------------------------------------------------- - -#ifndef HBAO_AO_INCLUDED -#define HBAO_AO_INCLUDED - -#include "UnityCG.cginc" -#include "HBAO_Common.cginc" - -inline float3 FetchLayerViewPos(float2 uv) { - float depth = LinearizeDepth(SAMPLE_DEPTH_TEXTURE(_DepthTex, uv)); - #if ORTHOGRAPHIC_PROJECTION - return float3((uv * _UVToView.xy + _UVToView.zw), depth); - #else - return float3((uv * _UVToView.xy + _UVToView.zw) * depth, depth); - #endif -} - -inline float Falloff(float distanceSquare) { - // 1 scalar mad instruction - return distanceSquare * _NegInvRadius2 + 1.0; -} - -inline float ComputeAO(float3 P, float3 N, float3 S) { - float3 V = S - P; - float VdotV = dot(V, V); - float NdotV = dot(N, V) * rsqrt(VdotV); - - // Use saturate(x) instead of max(x,0.f) because that is faster on Kepler - return saturate(NdotV - _AngleBias) * saturate(Falloff(VdotV)); -} - -inline float2 RotateDirections(float2 dir, float2 rot) { - return float2(dir.x * rot.x - dir.y * rot.y, - dir.x * rot.y + dir.y * rot.x); -} - -inline float InterleavedGradientNoise(float2 screenPos) { - // http://www.iryoku.com/downloads/Next-Generation-Post-Processing-in-Call-of-Duty-Advanced-Warfare-v18.pptx (slide 123) - float3 magic = float3(0.06711056, 0.00583715, 52.9829189); - return frac(magic.z * frac(dot(screenPos, magic.xy))); -} - -inline float2 FetchNoise(float2 screenPos) { - #if INTERLEAVED_GRADIENT_NOISE - // Use Jorge Jimenez's IGN noise and GTAO spatial offsets distribution - // https://blog.selfshadow.com/publications/s2016-shading-course/activision/s2016_pbs_activision_occlusion.pdf (slide 93) - return float2(InterleavedGradientNoise(screenPos), UNITY_SAMPLE_TEX2D(_NoiseTex, screenPos / 4.0).g); - #else - // (cos(alpha), sin(alpha), jitter) - return UNITY_SAMPLE_TEX2D(_NoiseTex, screenPos / 4.0).rg; - #endif -} - -float4 AO_Frag(Varyings input) : SV_Target -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - #ifdef DEINTERLEAVED - float3 P = FetchLayerViewPos(input.uv); - #else - float3 P = FetchViewPos(input.uv); - #endif - - #ifndef DEBUG_VIEWNORMALS - clip(_MaxDistance - P.z); - #endif - - #if ORTHOGRAPHIC_PROJECTION - float stepSize = min(_Radius, _MaxRadiusPixels) / (STEPS + 1.0); - #else - float stepSize = min((_Radius / P.z), _MaxRadiusPixels) / (STEPS + 1.0); - #endif - - #ifdef DEINTERLEAVED - float3 N = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_NormalsTex, input.uv).rgb * 2.0 - 1.0; - float2 rand = _Jitter; // angle, jitter - #else - float3 N = FetchViewNormals(input.uv, _AO_TexelSize.xy, P); - float2 rand = FetchNoise(input.uv * _AO_TexelSize.zw); // angle, jitter - #endif - - const float alpha = 2.0 * UNITY_PI / DIRECTIONS; - float ao = 0; - - #if COLOR_BLEEDING - static float2 cbUVs[DIRECTIONS * STEPS]; - static float cbContribs[DIRECTIONS * STEPS]; - #endif - - UNITY_UNROLL - for (int d = 0; d < DIRECTIONS; ++d) { - float angle = alpha * (float(d) + rand.x + _TemporalParams.x); - - // Compute normalized 2D direction - float cosA, sinA; - sincos(angle, sinA, cosA); - float2 direction = float2(cosA, sinA); - - // Jitter starting sample within the first step - float rayPixels = (frac(rand.y + _TemporalParams.y) * stepSize + 1.0); - - UNITY_UNROLL - for (int s = 0; s < STEPS; ++s) { - - #ifdef DEINTERLEAVED - float2 snappedUV = round(rayPixels * direction) * _DeinterleavedAO_TexelSize.xy + input.uv; - float3 S = FetchLayerViewPos(snappedUV); - #else - float2 snappedUV = round(rayPixels * direction) * _Input_TexelSize.xy + input.uv; - float3 S = FetchViewPos(snappedUV); - #endif - rayPixels += stepSize; - - float contrib = ComputeAO(P, N, S); - - #if OFFSCREEN_SAMPLES_CONTRIBUTION - float2 offscreenAmount = _OffscreenSamplesContrib * (snappedUV - saturate(snappedUV) != 0 ? 1 : 0); - contrib = max(contrib, offscreenAmount.x); - contrib = max(contrib, offscreenAmount.y); - #endif - ao += contrib; - - #if COLOR_BLEEDING - int sampleIdx = d * s; - cbUVs[sampleIdx] = snappedUV; - cbContribs[sampleIdx] = contrib; - #endif - } - } - - #ifdef DEBUG_VIEWNORMALS - N = float3(N.x, -N.y, N.z); - return float4(N * 0.5 + 0.5, 1); - #else - - #if COLOR_BLEEDING - half3 col = half3(0, 0, 0); - UNITY_UNROLL - for (int s = 0; s < DIRECTIONS * STEPS; s += 2) { - half3 emission = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, cbUVs[s]).rgb; - half average = (emission.x + emission.y + emission.z) / 3; - half scaledAverage = saturate((average - _ColorBleedBrightnessMaskRange.x) / (_ColorBleedBrightnessMaskRange.y - _ColorBleedBrightnessMaskRange.x + 1e-6)); - half maskMultiplier = 1 - (scaledAverage * _ColorBleedBrightnessMask); - col += emission * cbContribs[s] * maskMultiplier; - } - #if DEFERRED_SHADING - half3 albedo = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraGBufferTexture0, input.uv).rgb * 0.8 + 0.2; - albedo *= _AlbedoMultiplier; - #else - half3 albedo = half3(1, 1, 1); - #endif - float4 aoOutput = float4(col, ao); - #else - float aoOutput = ao; - #endif - - // apply bias multiplier - aoOutput *= (_AOmultiplier / (STEPS * DIRECTIONS)); - - float fallOffStart = _MaxDistance - _DistanceFalloff; - float distFactor = saturate((P.z - fallOffStart) / (_MaxDistance - fallOffStart)); - - #if COLOR_BLEEDING - //aoOutput.rgb = saturate(1 - lerp(dot(aoOutput.rgb, 0.333).xxx, aoOutput.rgb * albedo, _ColorBleedSaturation)); - aoOutput.rgb = saturate(lerp(dot(aoOutput.rgb, 0.333).xxx, aoOutput.rgb * albedo, _ColorBleedSaturation)); - aoOutput = lerp(saturate(float4(aoOutput.rgb, 1 - aoOutput.a)), float4(0, 0, 0, 1), distFactor); - return aoOutput; - #else - aoOutput = lerp(saturate(1 - aoOutput), 1, distFactor); - return float4(EncodeFloatRG(saturate(P.z * (1.0 / _ProjectionParams.z))), 1.0, aoOutput); - #endif - - #endif // DEBUG_VIEWNORMALS -} -#endif // HBAO_AO_INCLUDED diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_AO.cginc.meta b/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_AO.cginc.meta deleted file mode 100644 index 6c170ca0..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_AO.cginc.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: aa7be86dd68319442ac4a9c85bb21c81 -ShaderImporter: - externalObjects: {} - defaultTextures: [] - nonModifiableTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Blur.cginc b/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Blur.cginc deleted file mode 100644 index 1b1fb138..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Blur.cginc +++ /dev/null @@ -1,139 +0,0 @@ -//---------------------------------------------------------------------------------- -// -// Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of NVIDIA CORPORATION nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -//---------------------------------------------------------------------------------- - -#ifndef HBAO_BLUR_INCLUDED -#define HBAO_BLUR_INCLUDED - -#include "HBAO_Common.cginc" - -#if COLOR_BLEEDING - -inline void FetchAoAndDepth(float2 uv, inout half4 ao, inout float depth) { - ao = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv); - depth = LinearizeDepth(FetchRawDepth(uv)); -} - -inline float CrossBilateralWeight(float r, float d, float d0) { - const float BlurSigma = (float)KERNEL_RADIUS * 0.5; - const float BlurFalloff = 1.0 / (2.0*BlurSigma*BlurSigma); - - float dz = (d0 - d) * _BlurSharpness; - return exp2(-r*r*BlurFalloff - dz*dz); -} - -inline void ProcessSample(float4 ao, float z, float r, float d0, inout half4 totalAO, inout float totalW) { - float w = CrossBilateralWeight(r, d0, z); - totalW += w; - totalAO += w * ao; -} - -inline void ProcessRadius(float2 uv0, float2 deltaUV, float d0, inout half4 totalAO, inout float totalW) { - half4 ao; - float z; - float2 uv; - UNITY_UNROLL - for (int r = 1; r <= KERNEL_RADIUS; r++) { - uv = uv0 + r * deltaUV; - FetchAoAndDepth(uv, ao, z); - ProcessSample(ao, z, r, d0, totalAO, totalW); - } -} - -inline half4 ComputeBlur(float2 uv0, float2 deltaUV) { - half4 totalAO; - float depth; - FetchAoAndDepth(uv0, totalAO, depth); - float totalW = 1.0; - - ProcessRadius(uv0, -deltaUV, depth, totalAO, totalW); - ProcessRadius(uv0, deltaUV, depth, totalAO, totalW); - - totalAO /= totalW; - return totalAO; -} - -#else - -inline void FetchAoAndDepth(float2 uv, inout half ao, inout float2 depth) { - float3 aod = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv).rga; - ao = aod.z; - depth = aod.xy; -} - -inline float CrossBilateralWeight(float r, float d, float d0) { - const float BlurSigma = (float)KERNEL_RADIUS * 0.5; - const float BlurFalloff = 1.0 / (2.0*BlurSigma*BlurSigma); - - float dz = (d0 - d) * _ProjectionParams.z * _BlurSharpness; - return exp2(-r*r*BlurFalloff - dz*dz); -} - -inline void ProcessSample(float2 aoz, float r, float d0, inout half totalAO, inout float totalW) { - float w = CrossBilateralWeight(r, d0, aoz.y); - totalW += w; - totalAO += w * aoz.x; -} - -inline void ProcessRadius(float2 uv0, float2 deltaUV, float d0, inout half totalAO, inout float totalW) { - half ao; - float z; - float2 d, uv; - UNITY_UNROLL - for (int r = 1; r <= KERNEL_RADIUS; r++) { - uv = uv0 + r * deltaUV; - FetchAoAndDepth(uv, ao, d); - z = DecodeFloatRG(d); - ProcessSample(float2(ao, z), r, d0, totalAO, totalW); - } -} - -inline float4 ComputeBlur(float2 uv0, float2 deltaUV) { - half totalAO; - float2 depth; - FetchAoAndDepth(uv0, totalAO, depth); - float d0 = DecodeFloatRG(depth); - float totalW = 1.0; - - ProcessRadius(uv0, -deltaUV, d0, totalAO, totalW); - ProcessRadius(uv0, deltaUV, d0, totalAO, totalW); - - totalAO /= totalW; - return float4(depth, 1.0, totalAO); -} -#endif // COLOR_BLEEDING - -float4 Blur_Frag(Varyings input) : SV_Target -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - return ComputeBlur(input.uv, _BlurDeltaUV); -} - -#endif // HBAO_BLUR_INCLUDED diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Common.cginc b/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Common.cginc deleted file mode 100644 index 62fc3208..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Common.cginc +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef HBAO_COMMON_INCLUDED -#define HBAO_COMMON_INCLUDED - -#include "UnityCG.cginc" - -inline float FetchRawDepth(float2 uv) { - return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv * _TargetScale.xy); -} - -inline float LinearizeDepth(float depth) { - // References: https://docs.unity3d.com/Manual/SL-PlatformDifferences.html -#if ORTHOGRAPHIC_PROJECTION -#if UNITY_REVERSED_Z - depth = 1 - depth; -#endif // UNITY_REVERSED_Z - float linearDepth = _ProjectionParams.y + depth * (_ProjectionParams.z - _ProjectionParams.y); // near + depth * (far - near) -#else - float linearDepth = LinearEyeDepth(depth); -#endif // ORTHOGRAPHIC_PROJECTION - return linearDepth; -} - -inline float3 FetchViewPos(float2 uv) { - float depth = LinearizeDepth(FetchRawDepth(uv)); -#if ORTHOGRAPHIC_PROJECTION - return float3((uv * _UVToView.xy + _UVToView.zw), depth); -#else - return float3((uv * _UVToView.xy + _UVToView.zw) * depth, depth); -#endif -} - -inline float3 MinDiff(float3 P, float3 Pr, float3 Pl) { - float3 V1 = Pr - P; - float3 V2 = P - Pl; - return (dot(V1, V1) < dot(V2, V2)) ? V1 : V2; -} - -inline float3 FetchViewNormals(float2 uv, float2 delta, float3 P) { - #if NORMALS_RECONSTRUCT - float3 Pr, Pl, Pt, Pb; - Pr = FetchViewPos(uv + float2(delta.x, 0)); - Pl = FetchViewPos(uv + float2(-delta.x, 0)); - Pt = FetchViewPos(uv + float2(0, delta.y)); - Pb = FetchViewPos(uv + float2(0, -delta.y)); - float3 N = normalize(cross(MinDiff(P, Pr, Pl), MinDiff(P, Pt, Pb))); - #else - #if NORMALS_CAMERA - float3 N = DecodeViewNormalStereo(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv * _TargetScale.xy)); - #else - float3 N = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraGBufferTexture2, uv * _TargetScale.xy).rgb * 2.0 - 1.0; - N = mul((float3x3)_WorldToCameraMatrix, N); - #endif // NORMALS_CAMERA - N = float3(N.x, -N.yz); - #endif // NORMALS_RECONSTRUCT - - return N; -} - -inline float3 FetchViewNormals(float2 uv, float2 delta) { - - float3 P = FetchViewPos(uv); - return FetchViewNormals(uv, delta, P); -} - -#endif // HBAO_COMMON_INCLUDED diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Common.cginc.meta b/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Common.cginc.meta deleted file mode 100644 index 64b6e886..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Common.cginc.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: bd898bf629326454b8b704ad339d0312 -ShaderImporter: - externalObjects: {} - defaultTextures: [] - nonModifiableTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Composite.cginc b/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Composite.cginc deleted file mode 100644 index a6430c0c..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Composite.cginc +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef HBAO_COMPOSITE_INCLUDED -#define HBAO_COMPOSITE_INCLUDED - -#include "UnityCG.cginc" -#include "HBAO_Common.cginc" - -inline half4 FetchOcclusion(float2 uv) { - return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HBAOTex, uv * _TargetScale.zw); -} - -inline half4 FetchSceneColor(float2 uv) { - return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv); -} - -inline half4 FetchGBuffer0(float2 uv) { - return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_TempTex, uv); -} - -inline half4 FetchGBuffer3(float2 uv) { - return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv); -} - -inline half3 MultiBounceAO(float visibility, half3 albedo) { - half3 a = 2.0404 * albedo - 0.3324; - half3 b = -4.7951 * albedo + 0.6417; - half3 c = 2.7552 * albedo + 0.6903; - - float x = visibility; - return max(x, ((x * a + b) * x + c) * x); -} - -half4 Composite_Frag(Varyings input) : SV_Target -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - //uint2 positionSS = input.uv * _ScreenSize.xy; - - half4 ao = FetchOcclusion(input.uv); - - ao.a = saturate(pow(abs(ao.a), _Intensity)); - half3 aoColor = lerp(_BaseColor.rgb, half3(1.0, 1.0, 1.0), ao.a); - - half4 col = FetchSceneColor(input.uv); - - #if LIGHTING_LOG_ENCODED - col.rgb = -log2(col.rgb); - #endif - - #if MULTIBOUNCE - aoColor = lerp(aoColor, MultiBounceAO(ao.a, lerp(col.rgb, _BaseColor.rgb, _BaseColor.rgb)), _MultiBounceInfluence); - #endif - - col.rgb *= aoColor; - - #if COLOR_BLEEDING - //col.rgb += 1 - ao.rgb; - col.rgb += ao.rgb; - #endif - - #if LIGHTING_LOG_ENCODED - col.rgb = exp2(-col.rgb); - #endif - - #if DEBUG_AO - col.rgb = aoColor; - #elif DEBUG_COLORBLEEDING && COLOR_BLEEDING - //col.rgb = 1 - ao.rgb; - col.rgb = ao.rgb; - #elif DEBUG_NOAO_AO || DEBUG_AO_AOONLY || DEBUG_NOAO_AOONLY - if (input.uv.x <= 0.4985) { - #if DEBUG_NOAO_AO || DEBUG_NOAO_AOONLY - col = FetchSceneColor(input.uv); - #endif // DEBUG_NOAO_AO || DEBUG_NOAO_AOONLY - return col; - } - if (input.uv.x > 0.4985 && input.uv.x < 0.5015) { - return half4(0, 0, 0, 1); - } - #if DEBUG_AO_AOONLY || DEBUG_NOAO_AOONLY - col.rgb = aoColor; - #endif // DEBUG_AO_AOONLY) || DEBUG_NOAO_AOONLY - #endif // DEBUG_AO - return col; -} - -struct CombinedOutput { - half4 gbuffer0 : SV_Target0; // albedo (RGB), occlusion (A) - half4 gbuffer3 : SV_Target1; // emission (RGB), unused(A) -}; - -CombinedOutput Composite_Lit_Frag(Varyings input) -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - half4 ao = FetchOcclusion(input.uv); - - ao.a = saturate(pow(abs(ao.a), _Intensity)); - half3 aoColor = lerp(_BaseColor.rgb, half3(1.0, 1.0, 1.0), ao.a); - - half4 albedoOcc = FetchGBuffer0(input.uv); - half4 emission = FetchGBuffer3(input.uv); - - #if LIGHTING_LOG_ENCODED - emission.rgb = -log2(emission.rgb); - #endif - - CombinedOutput o; - o.gbuffer0 = half4(albedoOcc.rgb, albedoOcc.a * ao.a); - o.gbuffer3 = half4(emission.rgb * lerp(aoColor, half3(1.0, 1.0, 1.0), saturate((emission.r + emission.g + emission.b) / 3)), emission.a); - - #if COLOR_BLEEDING - //o.gbuffer3.rgb += 1 - ao.rgb; - o.gbuffer3.rgb += ao.rgb; - #endif - - #if LIGHTING_LOG_ENCODED - o.gbuffer3.rgb = exp2(-o.gbuffer3.rgb); - #endif - - return o; -} - -#endif // HBAO_COMPOSITE_INCLUDED diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Composite.cginc.meta b/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Composite.cginc.meta deleted file mode 100644 index 67f92c29..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Composite.cginc.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: fccaaf1b3dbd6e74d80289679d2d1e5a -ShaderImporter: - externalObjects: {} - defaultTextures: [] - nonModifiableTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Deinterleaving.cginc b/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Deinterleaving.cginc deleted file mode 100644 index 54193e35..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_Deinterleaving.cginc +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef HBAO_DEINTERLEAVING_INCLUDED -#define HBAO_DEINTERLEAVING_INCLUDED - -#include "HBAO_Common.cginc" - -struct DeinterleavedOutput { - float4 Z00 : SV_Target0; - float4 Z10 : SV_Target1; - float4 Z01 : SV_Target2; - float4 Z11 : SV_Target3; -}; - -DeinterleavedOutput DeinterleaveDepth_Frag(Varyings input) -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - DeinterleavedOutput o; - - float2 pos = floor(input.uv * _DeinterleavedAO_TexelSize.zw) * 4.0; - float2 uv00 = (pos + _Deinterleave_Offset00 + 0.5) * _ReinterleavedAO_TexelSize.xy; - float2 uv10 = (pos + _Deinterleave_Offset10 + 0.5) * _ReinterleavedAO_TexelSize.xy; - float2 uv01 = (pos + _Deinterleave_Offset01 + 0.5) * _ReinterleavedAO_TexelSize.xy; - float2 uv11 = (pos + _Deinterleave_Offset11 + 0.5) * _ReinterleavedAO_TexelSize.xy; - - o.Z00 = FetchRawDepth(uv00).rrrr; - o.Z10 = FetchRawDepth(uv10).rrrr; - o.Z01 = FetchRawDepth(uv01).rrrr; - o.Z11 = FetchRawDepth(uv11).rrrr; - return o; -} - -DeinterleavedOutput DeinterleaveNormals_Frag(Varyings input) -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - DeinterleavedOutput o; - - float2 pos = floor(input.uv * _DeinterleavedAO_TexelSize.zw) * 4.0; - float2 uv00 = (pos + _Deinterleave_Offset00 + 0.5) * _ReinterleavedAO_TexelSize.xy; - float2 uv10 = (pos + _Deinterleave_Offset10 + 0.5) * _ReinterleavedAO_TexelSize.xy; - float2 uv01 = (pos + _Deinterleave_Offset01 + 0.5) * _ReinterleavedAO_TexelSize.xy; - float2 uv11 = (pos + _Deinterleave_Offset11 + 0.5) * _ReinterleavedAO_TexelSize.xy; - - o.Z00 = float4(FetchViewNormals(uv00, _ReinterleavedAO_TexelSize.xy) * 0.5 + 0.5, 0); - o.Z10 = float4(FetchViewNormals(uv10, _ReinterleavedAO_TexelSize.xy) * 0.5 + 0.5, 0); - o.Z01 = float4(FetchViewNormals(uv01, _ReinterleavedAO_TexelSize.xy) * 0.5 + 0.5, 0); - o.Z11 = float4(FetchViewNormals(uv11, _ReinterleavedAO_TexelSize.xy) * 0.5 + 0.5, 0); - - return o; -} - -half4 ReinterleaveAO_Frag(Varyings input) : SV_Target -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - float2 offset = fmod(floor(input.uv * _ReinterleavedAO_TexelSize.zw), 4.0); - float2 uv = (floor(input.uv * _DeinterleavedAO_TexelSize.zw) + (offset * _DeinterleavedAO_TexelSize.zw) + 0.5) * _ReinterleavedAO_TexelSize.xy; - - return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv); -} - -#endif // HBAO_DEINTERLEAVING_INCLUDED diff --git a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_TemporalFilter.cginc b/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_TemporalFilter.cginc deleted file mode 100644 index a103aa1c..00000000 --- a/Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_TemporalFilter.cginc +++ /dev/null @@ -1,171 +0,0 @@ -#ifndef HBAO_TEMPORALFILTER_INCLUDED -#define HBAO_TEMPORALFILTER_INCLUDED - -#include "HBAO_Common.cginc" - -struct HistoryOutput { - float4 aoHistory : SV_Target0; - #if COLOR_BLEEDING - half4 colorBleedingHistory : SV_Target1; - #endif -}; - -#if COLOR_BLEEDING -#define CTYPE half4 -#else -#define CTYPE half -#endif - -inline void FetchAoAndDepth(float2 uv, inout CTYPE ao, inout float2 depth) { - #if COLOR_BLEEDING - ao = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HBAOTex, uv); - depth = EncodeFloatRG(saturate(LinearizeDepth(FetchRawDepth(uv)) * (1.0 / _ProjectionParams.z))); - #else - float3 aod = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HBAOTex, uv).rga; - ao = aod.z; - depth = aod.xy; - #endif -} - -inline float2 FetchMotionVectors(float2 uv) { - return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraMotionVectorsTexture, uv * _TargetScale.xy).rg; -} - -inline float4 FetchAoHistory(float2 uv) { - return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv); -} - -inline half4 FetchColorBleedingHistory(float2 uv) { - return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_TempTex, uv); -} - -inline CTYPE FetchNeighbor(float2 uv, float2 offset) { - #if COLOR_BLEEDING - return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HBAOTex, uv + _AO_TexelSize.xy * offset); - #else - return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_HBAOTex, uv + _AO_TexelSize.xy * offset).a; - #endif -} - -inline half DisocclusionTest(float2 uvm1, float2 depth, float2 depthm1) { - - // disocclusion test - // https://developer.nvidia.com/sites/default/files/akamai/gamedev/files/gdc12/GDC12_Bavoil_Stable_SSAO_In_BF3_With_STF.pdf (Page 19) - float z = DecodeFloatRG(depth); - float zm1 = DecodeFloatRG(depthm1); - // for fetching zi-1, use clamp-to-border to discard out-of-frame data, with borderZ = 0.f - // https://developer.nvidia.com/sites/default/files/akamai/gamedev/files/gdc12/GDC12_Bavoil_Stable_SSAO_In_BF3_With_STF.pdf (Page 39) - // if (uvm1.x < 0 || uvm1.y < 0 || uvm1.x > 1 || uvm1.y > 1) zm1 = 0; - // if (uvm1.x < 0 || uvm1.y < 0 || uvm1.x > 1 || uvm1.y > 1) => dot(step(half4(uvm1, 1, 1), half4(0, 0, uvm1)), 1) is 1 if out-of-frame, so - zm1 *= 1.0 - dot(step(float4(uvm1, 1, 1), float4(0, 0, uvm1)), 1); - // relaxed disocclusion test: abs(1.0 - (z / zm1)) > 0.1 => 10% - // float disocclusion = max(sign(abs(1.0 - (z / zm1)) - 0.1), 0.0); - float disocclusion = abs(1.0 - (z / zm1)) > 0.1; - - return disocclusion; -} - -inline CTYPE VarianceClipping(float2 uv, CTYPE ao, CTYPE aom1, float velocityWeight) { - - // neighborhood clamping - // http://twvideo01.ubm-us.net/o1/vault/gdc2016/Presentations/Pedersen_LasseJonFuglsang_TemporalReprojectionAntiAliasing.pdf // (pages 26-28) - // superseded by variance clipping - // http://developer.download.nvidia.com/gameworks/events/GDC2016/msalvi_temporal_supersampling.pdf (page 23-29) - #if VARIANCE_CLIPPING_4TAP - CTYPE cT = FetchNeighbor(uv, float2(0, 1)); - CTYPE cR = FetchNeighbor(uv, float2(1, 0)); - CTYPE cB = FetchNeighbor(uv, float2(0, -1)); - CTYPE cL = FetchNeighbor(uv, float2(-1, 0)); - // compute 1st and 2nd color moments - CTYPE m1 = ao + cT + cR + cB + cL; - CTYPE m2 = ao * ao + cT * cT + cR * cR + cB * cB + cL * cL; - // aabb from mean u and variance sigma2 - CTYPE mu = m1 / 5.0; - CTYPE sigma = sqrt(m2 / 5.0 - mu * mu); - - #elif VARIANCE_CLIPPING_8TAP - CTYPE cTL = FetchNeighbor(uv, float2(-1, 1)); - CTYPE cT = FetchNeighbor(uv, float2(0, 1)); - CTYPE cTR = FetchNeighbor(uv, float2(1, 1)); - CTYPE cR = FetchNeighbor(uv, float2(1, 0)); - CTYPE cBR = FetchNeighbor(uv, float2(1, -1)); - CTYPE cB = FetchNeighbor(uv, float2(0, -1)); - CTYPE cBL = FetchNeighbor(uv, float2(-1, -1)); - CTYPE cL = FetchNeighbor(uv, float2(-1, 0)); - // compute 1st and 2nd color moments - CTYPE m1 = ao + cTL + cT + cTR + cR + cBR + cB + cBL + cL; - CTYPE m2 = ao * ao + cTL * cTL + cT * cT + cTR * cTR + cR * cR + cBR * cBR + cB * cB + cBL * cBL + cL * cL; - // aabb from mean u and variance sigma2 - CTYPE mu = m1 / 9.0; - CTYPE sigma = sqrt(m2 / 9.0 - mu * mu); - #endif - - #if VARIANCE_CLIPPING_4TAP || VARIANCE_CLIPPING_8TAP - float gamma = lerp(75.0, 0.75, velocityWeight); // scale down sigma for reduced ghosting - CTYPE cmin = mu - gamma * sigma; - CTYPE cmax = mu + gamma * sigma; - - // clipping - return clamp(aom1, cmin, cmax); - #else - return aom1; - #endif -} - -HistoryOutput TemporalFilter_Frag(Varyings input) -{ - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); - - // fetch current frame data - CTYPE ao; float2 depth; - FetchAoAndDepth(input.uv, ao, depth); - - // fetch motion vectors, calculate previous frame uv - float2 mv = FetchMotionVectors(input.uv); - float2 uvm1 = input.uv - mv; - float mvl = length(mv); - - // fetch history - float4 aoHistory = FetchAoHistory(uvm1); - #if COLOR_BLEEDING - half4 colorBleedingHistory = FetchColorBleedingHistory(uvm1); - CTYPE aom1 = colorBleedingHistory; - #else - CTYPE aom1 = aoHistory.w; - #endif - float2 depthm1 = aoHistory.xy; - float mvlm1 = aoHistory.z; - - // velocity weight - float velocityWeight = saturate(abs(mvl - mvlm1) * 300.0); - - // do disocclusion test - half disocclusion = DisocclusionTest(uvm1, depth, depthm1); - - // apply velocity weight and disocclusion - #if COLOR_BLEEDING - aom1.a = aom1.a + saturate(dot(float2(velocityWeight, disocclusion), 1.0)) * (ao.a - aom1.a); - #else - aom1 = aom1 + saturate(dot(float2(velocityWeight, disocclusion), 1.0)) * (ao - aom1); - #endif - - // do variance clipping - aom1 = VarianceClipping(input.uv, ao, aom1, velocityWeight); - - // exponential accumulation buffer - // http://www.klayge.org/material/4_11/Filmic%20SMAA%20v7.pdf (page 54) - // http://developer.download.nvidia.com/gameworks/events/GDC2016/msalvi_temporal_supersampling.pdf (page 13) - ao = aom1 + 0.1 * (ao - aom1); - - HistoryOutput o; - #if COLOR_BLEEDING - o.aoHistory = float4(depth, mvl, ao.a); - o.colorBleedingHistory = ao; - #else - o.aoHistory = float4(depth, mvl, ao); - #endif - - return o; -} - -#endif // HBAO_TEMPORALFILTER_INCLUDED diff --git a/Assets/External/VolumetricLightBeam.meta b/Assets/External/VolumetricLightBeam.meta new file mode 100644 index 00000000..947ada6e --- /dev/null +++ b/Assets/External/VolumetricLightBeam.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7a44ef9466a83c349a0d3ced3a94b8fa +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor.meta b/Assets/External/VolumetricLightBeam/Editor.meta similarity index 77% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor.meta rename to Assets/External/VolumetricLightBeam/Editor.meta index ccf8aaf4..04bfa2d5 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor.meta +++ b/Assets/External/VolumetricLightBeam/Editor.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a82bfeb39ff8ba5459ceb4eb8d655938 +guid: db9b532f8762be04da977168e18b0e6c folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/External/VolumetricLightBeam/Editor/ButtonToggleScope.cs b/Assets/External/VolumetricLightBeam/Editor/ButtonToggleScope.cs new file mode 100644 index 00000000..fe62153d --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/ButtonToggleScope.cs @@ -0,0 +1,135 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; + +namespace VLB +{ + class ButtonToggleScope : System.IDisposable + { + SerializedProperty m_Property; + bool m_DisableGroup = false; + GUIContent m_Content = null; + + void Enable() + { + EditorGUILayout.BeginHorizontal(); + if (m_DisableGroup) + EditorGUI.BeginDisabledGroup(isPropertyToggled || m_Property.hasMultipleDifferentValues); + } + + void Disable() + { + EndDisabledGroup(); + DrawToggleButton(); + EditorGUILayout.EndHorizontal(); + m_Property = null; + } + + public void EndDisabledGroup() + { + if (m_DisableGroup) + EditorGUI.EndDisabledGroup(); + m_DisableGroup = false; // prevent from calling EndDisabledGroup twice + } + + public ButtonToggleScope(SerializedProperty prop, bool disableGroup, GUIContent content) + { + m_Property = prop; + m_DisableGroup = disableGroup; + m_Content = content; + Enable(); + } + + public void Dispose() { Disable(); } + + static GUIStyle ms_ToggleButtonStyleNormal = null; + static GUIStyle ms_ToggleButtonStyleToggled = null; + static GUIStyle ms_ToggleButtonStyleMixedValue = null; + + bool isPropertyToggled + { + get + { + switch(m_Property.propertyType) + { + case SerializedPropertyType.Boolean: return m_Property.boolValue; + case SerializedPropertyType.Float: return m_Property.floatValue >= 0.0f; + default: Debug.LogFormat("Invalid PropertyType {0}", m_Property.propertyType); return false; + } + } + } + + void ToggleValue() + { + switch (m_Property.propertyType) + { + case SerializedPropertyType.Boolean: m_Property.boolValue = !m_Property.boolValue; break; + case SerializedPropertyType.Float: + { + if (m_Property.floatValue == 0f) m_Property.floatValue = float.MinValue; + else if (m_Property.floatValue == float.MinValue) m_Property.floatValue = 0f; + else m_Property.floatValue = -m_Property.floatValue; + break; + } + default: Debug.LogFormat("Invalid PropertyType {0}", m_Property.propertyType); break; + } + } + + void DrawToggleButton() + { + if (ms_ToggleButtonStyleNormal == null) + { + ms_ToggleButtonStyleNormal = new GUIStyle(EditorStyles.miniButton); + ms_ToggleButtonStyleToggled = new GUIStyle(ms_ToggleButtonStyleNormal); + ms_ToggleButtonStyleToggled.normal.background = ms_ToggleButtonStyleToggled.active.background; + ms_ToggleButtonStyleMixedValue = new GUIStyle(ms_ToggleButtonStyleToggled); + ms_ToggleButtonStyleMixedValue.fontStyle = FontStyle.Italic; + } + + EditorGUI.BeginChangeCheck(); + EditorGUI.showMixedValue = m_Property.hasMultipleDifferentValues; + + var style = EditorGUI.showMixedValue ? ms_ToggleButtonStyleMixedValue : (isPropertyToggled ? ms_ToggleButtonStyleToggled : ms_ToggleButtonStyleNormal); + var calcSize = style.CalcSize(m_Content); + +#if UNITY_2019_3_OR_NEWER + var defaultColor = GUI.backgroundColor; + if(isPropertyToggled) + GUI.backgroundColor = new Color(0.75f, 0.75f, 0.75f); +#endif + + GUILayout.Button( + m_Content, + style, + GUILayout.MaxWidth(calcSize.x)); + +#if UNITY_2019_3_OR_NEWER + GUI.backgroundColor = defaultColor; +#endif + + EditorGUI.showMixedValue = false; + if (EditorGUI.EndChangeCheck()) + ToggleValue(); + } + + public static ButtonToggleScope FromLight(SerializedProperty prop, bool visible) + { + if (!visible) return null; + + return new ButtonToggleScope(prop, + true, // disableGroup + EditorData.Instance.contentFromSpotLight); + } + + public static ButtonToggleScope Advanced(SerializedProperty prop, bool visible) + { + if (!visible) return null; + + return new ButtonToggleScope(prop, + false, // disableGroup + EditorStrings.Beam.SD.IntensityModeAdvanced); + } + } +} +#endif // UNITY_EDITOR + diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAOControl.cs.meta b/Assets/External/VolumetricLightBeam/Editor/ButtonToggleScope.cs.meta similarity index 83% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAOControl.cs.meta rename to Assets/External/VolumetricLightBeam/Editor/ButtonToggleScope.cs.meta index cfa7f32f..39ec3ea3 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAOControl.cs.meta +++ b/Assets/External/VolumetricLightBeam/Editor/ButtonToggleScope.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 29ecb91848e7b0e4396f2e31373e63e8 +guid: f6e5288f7265ad940adec22ce90353ce MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/External/VolumetricLightBeam/Editor/EditorData.cs b/Assets/External/VolumetricLightBeam/Editor/EditorData.cs new file mode 100644 index 00000000..a482231b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/EditorData.cs @@ -0,0 +1,44 @@ +#if UNITY_EDITOR +using UnityEngine; + +namespace VLB +{ + public class EditorData : ScriptableObject + { + [SerializeField] Texture2D buttonAddDustParticles = null; + [SerializeField] Texture2D buttonAddDynamicOcclusion = null; + [SerializeField] Texture2D buttonAddTriggerZone = null; + [SerializeField] Texture2D buttonAddEffect = null; + [SerializeField] Texture2D buttonFromSpotLight = null; + + [SerializeField] Texture2D buttonAddCookieHD = null; + [SerializeField] Texture2D buttonAddShadowHD = null; + [SerializeField] Texture2D buttonAddTrackRealtimeChangesOnLightHD = null; + + public GUIContent contentAddDustParticles { get { return new GUIContent(Instance.buttonAddDustParticles, EditorStrings.Beam.ButtonAddDustParticles); } } + public GUIContent contentAddDynamicOcclusion { get { return new GUIContent(Instance.buttonAddDynamicOcclusion, EditorStrings.Beam.ButtonAddDynamicOcclusion); } } + public GUIContent contentAddTriggerZone { get { return new GUIContent(Instance.buttonAddTriggerZone, EditorStrings.Beam.ButtonAddTriggerZone); } } + public GUIContent contentAddEffect { get { return new GUIContent(Instance.buttonAddEffect, EditorStrings.Beam.ButtonAddEffect); } } + public GUIContent contentFromSpotLight { get { return new GUIContent(Instance.buttonFromSpotLight, EditorStrings.Beam.FromSpotLight); } } + + public GUIContent contentAddCookieHD { get { return new GUIContent(Instance.buttonAddCookieHD, EditorStrings.Beam.HD.ButtonAddCookie); } } + public GUIContent contentAddShadowHD { get { return new GUIContent(Instance.buttonAddShadowHD, EditorStrings.Beam.HD.ButtonAddShadow); } } + public GUIContent contentAddTrackRealtimeChangesOnLightHD { get { return new GUIContent(Instance.buttonAddTrackRealtimeChangesOnLightHD, EditorStrings.Beam.HD.ButtonAddTrackRealtimeChangesOnLight); } } + + static EditorData ms_Instance = null; + public static EditorData Instance + { + get + { + if (ms_Instance == null) + { + ms_Instance = Resources.Load("VLBEditorData"); + Debug.Assert(ms_Instance != null, "Failed to find asset 'VLBEditorData', please reinstall the 'Volumetric Light Beam' plugin."); + } + return ms_Instance; + } + } + } +} +#endif + diff --git a/Assets/External/VolumetricLightBeam/Editor/EditorData.cs.meta b/Assets/External/VolumetricLightBeam/Editor/EditorData.cs.meta new file mode 100644 index 00000000..e5c80ba5 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/EditorData.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f87284b87b8be7c4b9708f25ddb6669b +timeCreated: 1617782038 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/EditorExtensions.cs b/Assets/External/VolumetricLightBeam/Editor/EditorExtensions.cs new file mode 100644 index 00000000..defa1a8e --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/EditorExtensions.cs @@ -0,0 +1,335 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; +using UnityEditor.IMGUI.Controls; + +namespace VLB +{ + public static class EditorExtensions + { + public static class SD + { + public static GameObject NewBeam() { return new GameObject("Volumetric Light Beam SD", typeof(VolumetricLightBeamSD)); } + + public static GameObject NewBeam2D() + { + var gao = new GameObject("Volumetric Light Beam SD (2D)", typeof(VolumetricLightBeamSD)); + gao.GetComponent().dimensions = Dimensions.Dim2D; + return gao; + } + + public static GameObject NewBeamAndDust() { return new GameObject("Volumetric Light Beam SD + Dust", typeof(VolumetricLightBeamSD), typeof(VolumetricDustParticles)); } + + public static GameObject NewSpotLightAndBeam() + { + var light = Utils.NewWithComponent("Spotlight and Beam SD"); + light.type = LightType.Spot; + var gao = light.gameObject; + gao.AddComponent(); + return gao; + } + } + + public static class HD + { + public static GameObject NewBeam() { return new GameObject("Volumetric Light Beam HD", typeof(VolumetricLightBeamHD)); } + public static GameObject NewBeam2D() { return new GameObject("Volumetric Light Beam HD (2D)", typeof(VolumetricLightBeamHD2D)); } + public static GameObject NewBeamAndDust() { return new GameObject("Volumetric Light Beam HD + Dust", typeof(VolumetricLightBeamHD), typeof(VolumetricDustParticles)); } + + public static GameObject NewSpotLightAndBeam() + { + var light = Utils.NewWithComponent("Spotlight and Beam HD"); + light.type = LightType.Spot; + var gao = light.gameObject; + gao.AddComponent().scalable = false; + return gao; + } + } + + public static void OnNewGameObjectCreated(GameObject gao, MenuCommand menuCommand) + { + Debug.Assert(gao != null); + Debug.Assert(menuCommand != null); + + OnNewGameObjectCreated(gao, menuCommand.context as GameObject); + } + + public static void OnNewGameObjectCreated(GameObject gao, GameObject parentGao) + { + Debug.Assert(gao != null); + + if (parentGao == null) + { +#if UNITY_2021_2_OR_NEWER + var currentPrefabStage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); +#else + var currentPrefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); +#endif + if (currentPrefabStage != null) + { + // The user is in prefab mode without any GAO selected in the hierarchy. Get the current prefab root as parent. + parentGao = currentPrefabStage.prefabContentsRoot; + } + } + + GameObjectUtility.SetParentAndAlign(gao, parentGao); // Ensure it gets reparented if this was a context click (otherwise does nothing) + + Undo.RegisterCreatedObjectUndo(gao, "Create " + gao.name); // Register the creation in the undo system + Selection.activeObject = gao; + } + + public static bool CanAddComponentFromEditor(VolumetricLightBeamAbstractBase self) where TComp : Component + { + return !Application.isPlaying && self != null && self.GetComponent() == null; + } + + public static void AddComponentFromEditor(VolumetricLightBeamAbstractBase self) where TComp : Component + { + if (CanAddComponentFromEditor(self)) + { + /*var comp =*/ Undo.AddComponent(self.gameObject); + } + } + + /// + /// Add a EditorGUILayout.ToggleLeft which properly handles multi-object editing + /// + public static void ToggleLeft(this SerializedProperty prop, GUIContent label, params GUILayoutOption[] options) + { + ToggleLeft(prop, label, prop.boolValue, options); + } + + public static void ToggleLeft(this SerializedProperty prop, GUIContent label, bool forcedValue, params GUILayoutOption[] options) + { + EditorGUI.BeginChangeCheck(); + EditorGUI.showMixedValue = prop.hasMultipleDifferentValues; + var newValue = EditorGUILayout.ToggleLeft(label, forcedValue, options); + EditorGUI.showMixedValue = false; + if (EditorGUI.EndChangeCheck()) + prop.boolValue = newValue; + } + + + public static bool HasAtLeastOneValue(this SerializedProperty prop, bool value) + { + return (prop.boolValue == value) || prop.hasMultipleDifferentValues; + } + + public static bool HasAtLeastOnePositiveValue(this SerializedProperty prop) + { + return (prop.floatValue >= 0.0f) || prop.hasMultipleDifferentValues; + } + + /// + /// Create a EditorGUILayout.Slider which properly handles multi-object editing + /// We apply the 'convIn' conversion to the SerializedProperty value before exposing it as a Slider. + /// We apply the 'convOut' conversion to the Slider value to get the SerializedProperty back. + /// + /// The value the slider shows. + /// Label in front of the slider. + /// The value at the left end of the slider. + /// The value at the right end of the slider. + /// Conversion applied on the SerializedProperty to get the Slider value + /// Conversion applied on the Slider value to get the SerializedProperty + public static bool FloatSlider( + this SerializedProperty prop, + GUIContent label, + float leftValue, float rightValue, + System.Func convIn, + System.Func convOut, + params GUILayoutOption[] options) + { + var floatValue = convIn(prop.floatValue); + EditorGUI.BeginChangeCheck(); + { + EditorGUI.showMixedValue = prop.hasMultipleDifferentValues; + { + floatValue = EditorGUILayout.Slider(label, floatValue, leftValue, rightValue, options); + } + EditorGUI.showMixedValue = false; + } + if (EditorGUI.EndChangeCheck()) + { + prop.floatValue = convOut(floatValue); + return true; + } + return false; + } + + public static bool FloatSlider( + this SerializedProperty prop, + GUIContent label, + float leftValue, float rightValue, + params GUILayoutOption[] options) + { + var floatValue = prop.floatValue; + EditorGUI.BeginChangeCheck(); + { + EditorGUI.showMixedValue = prop.hasMultipleDifferentValues; + { + floatValue = EditorGUILayout.Slider(label, floatValue, leftValue, rightValue, options); + } + EditorGUI.showMixedValue = false; + } + if (EditorGUI.EndChangeCheck()) + { + prop.floatValue = floatValue; + return true; + } + return false; + } +/* + public static void ToggleFromLight(this SerializedProperty prop) + { + ToggleLeft( + prop, + new GUIContent("From Spot", "Get the value from the Light Spot"), + GUILayout.MaxWidth(80.0f)); + } +*/ + public static void ToggleUseGlobalNoise(this SerializedProperty prop) + { + ToggleLeft( + prop, + new GUIContent("Global", "Get the value from the Global 3D Noise"), + GUILayout.MaxWidth(55.0f)); + } + + public static void CustomEnum(this SerializedProperty prop, GUIContent content, string[] descriptions = null) + { + if(descriptions == null) + descriptions = System.Enum.GetNames(typeof(EnumType)); + + Debug.Assert(System.Enum.GetNames(typeof(EnumType)).Length == descriptions.Length, string.Format("Enum '{0}' and the description array don't have the same size", typeof(EnumType))); + + int enumValueIndex = prop.enumValueIndex; + EditorGUI.BeginChangeCheck(); + { + EditorGUI.showMixedValue = prop.hasMultipleDifferentValues; + { +#if UNITY_2018_1_OR_NEWER + enumValueIndex = EditorGUILayout.Popup(content, enumValueIndex, descriptions); +#else + enumValueIndex = EditorGUILayout.Popup(content.text, enumValueIndex, descriptions); +#endif + } + EditorGUI.showMixedValue = false; + } + if (EditorGUI.EndChangeCheck()) + prop.enumValueIndex = enumValueIndex; + } + + public static void CustomMask(this SerializedProperty prop, GUIContent content, string[] descriptions = null) + { + if (descriptions == null) + descriptions = System.Enum.GetNames(typeof(EnumType)); + + Debug.Assert(System.Enum.GetNames(typeof(EnumType)).Length == descriptions.Length, string.Format("Enum '{0}' and the description array don't have the same size", typeof(EnumType))); + + int intValue = prop.intValue; + EditorGUI.BeginChangeCheck(); + { + EditorGUI.showMixedValue = prop.hasMultipleDifferentValues; + { + intValue = EditorGUILayout.MaskField(content, intValue, descriptions); + } + EditorGUI.showMixedValue = false; + } + if (EditorGUI.EndChangeCheck()) + prop.intValue = intValue; + } + + + public static void DrawLineSeparator() + { + DrawLineSeparator(Color.grey, 1, 10); + } + + static void DrawLineSeparator(Color color, int thickness = 2, int padding = 10) + { + Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness)); + + r.x = 0; + r.width = EditorGUIUtility.currentViewWidth; + + r.y += padding / 2; + r.height = thickness; + + EditorGUI.DrawRect(r, color); + } + + + public static bool GlobalToggleButton(ref bool boolean, GUIContent content, string saveString, float maxWidth = 999.0f) + { + EditorGUI.BeginChangeCheck(); + boolean = GUILayout.Toggle(boolean, content, EditorStyles.miniButton, GUILayout.MaxWidth(maxWidth)); + if (EditorGUI.EndChangeCheck()) + { + EditorPrefs.SetBool(saveString, boolean); + SceneView.RepaintAll(); + return true; + } + return false; + } + + + public abstract class EditorGUIWidth : System.IDisposable + { + protected abstract void ApplyWidth(float width); + public EditorGUIWidth(float width) { ApplyWidth(width); } + public void Dispose() { ApplyWidth(0.0f); } + } + + public class LabelWidth : EditorGUIWidth + { + public LabelWidth(float width) : base(width) { } + protected override void ApplyWidth(float width) { EditorGUIUtility.labelWidth = width; } + } + + public class FieldWidth : EditorGUIWidth + { + public FieldWidth(float width) : base(width) { } + protected override void ApplyWidth(float width) { EditorGUIUtility.fieldWidth = width; } + } + + public class ShowMixedValue : System.IDisposable + { + public ShowMixedValue(bool? value) { m_PrevValue = EditorGUI.showMixedValue; EditorGUI.showMixedValue = value ?? false; } + public ShowMixedValue(SerializedProperty prop) : this(prop?.hasMultipleDifferentValues) { } + public void Dispose() { EditorGUI.showMixedValue = m_PrevValue; } + bool m_PrevValue = false; + } + + private static ArcHandle ms_ArcHandle = null; + + // HANDLES + public static ArcHandle DrawHandleRadius(float radius) + { + if (ms_ArcHandle == null) + ms_ArcHandle = new ArcHandle(); + + ms_ArcHandle.SetColorWithRadiusHandle(Color.white, 0f); + ms_ArcHandle.angle = 360f; + ms_ArcHandle.angleHandleSizeFunction = null; + ms_ArcHandle.angleHandleColor = Color.clear; + ms_ArcHandle.radius = radius; + ms_ArcHandle.DrawHandle(); + return ms_ArcHandle; + } + + public static ArcHandle DrawHandleSpotAngle(float angle, float radius) + { + if (ms_ArcHandle == null) + ms_ArcHandle = new ArcHandle(); + + ms_ArcHandle.angleHandleSizeFunction = ArcHandle.DefaultAngleHandleSizeFunction; + ms_ArcHandle.SetColorWithRadiusHandle(Handles.color, Handles.color.maxColorComponent < 0.5f ? 0.25f : 0.1f); + ms_ArcHandle.angleHandleColor = Handles.color; + ms_ArcHandle.radius = radius; + ms_ArcHandle.angle = angle; + ms_ArcHandle.DrawHandle(); + return ms_ArcHandle; + } + } +} +#endif \ No newline at end of file diff --git a/Assets/External/VolumetricLightBeam/Editor/EditorExtensions.cs.meta b/Assets/External/VolumetricLightBeam/Editor/EditorExtensions.cs.meta new file mode 100644 index 00000000..0516f769 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/EditorExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 554d3ed087749984585096b2d627574b +timeCreated: 1504871769 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/EditorMenuItems.cs b/Assets/External/VolumetricLightBeam/Editor/EditorMenuItems.cs new file mode 100644 index 00000000..9eb6bbda --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/EditorMenuItems.cs @@ -0,0 +1,328 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; +using System.Reflection; +using System; + +namespace VLB +{ + public static class EditorMenuItems + { + const string kCategoryName = "\U0001F4A1 Volumetric Light Beam/"; + const string kSceneMenuPrefix = "GameObject/Light/" + kCategoryName; + + static class SD + { + const string kNewBeamPrefix = kSceneMenuPrefix + "SD Beam/"; + + [MenuItem(kNewBeamPrefix + "3D Beam", false, 100)] + static void Menu_CreateNewBeam(MenuCommand menuCommand) { EditorExtensions.OnNewGameObjectCreated(EditorExtensions.SD.NewBeam(), menuCommand); } + + [MenuItem(kNewBeamPrefix + "3D Beam and Spotlight", false, 101)] + static void Menu_CreateSpotLightAndBeam(MenuCommand menuCommand) { EditorExtensions.OnNewGameObjectCreated(EditorExtensions.SD.NewSpotLightAndBeam(), menuCommand); } + + [MenuItem(kNewBeamPrefix + "2D Beam", false, 102)] + static void Menu_CreateNewBeam2D(MenuCommand menuCommand) { EditorExtensions.OnNewGameObjectCreated(EditorExtensions.SD.NewBeam2D(), menuCommand); } + } + + static class HD + { + const string kNewBeamPrefix = kSceneMenuPrefix + "HD Beam/"; + + [MenuItem(kNewBeamPrefix + "3D Beam", false, 200)] + static void Menu_CreateNewBeam(MenuCommand menuCommand) { EditorExtensions.OnNewGameObjectCreated(EditorExtensions.HD.NewBeam(), menuCommand); } + + [MenuItem(kNewBeamPrefix + "3D Beam and Spotlight", false, 201)] + static void Menu_CreateSpotLightAndBeam(MenuCommand menuCommand) { EditorExtensions.OnNewGameObjectCreated(EditorExtensions.HD.NewSpotLightAndBeam(), menuCommand); } + + [MenuItem(kNewBeamPrefix + "2D Beam", false, 202)] + static void Menu_CreateNewBeam2D(MenuCommand menuCommand) { EditorExtensions.OnNewGameObjectCreated(EditorExtensions.HD.NewBeam2D(), menuCommand); } + } + + + + const string kAddVolumetricBeam = "CONTEXT/Light/\U0001F4A1 Attach a Volumetric Beam "; + static bool CanAddVolumetricBeam(Light light) { return !Application.isPlaying && light != null && light.type == LightType.Spot && light.GetComponent() == null; } + + static T Menu_AttachBeam_Command(MenuCommand menuCommand) where T : VolumetricLightBeamAbstractBase + { + var light = menuCommand.context as Light; + T comp = null; + if (CanAddVolumetricBeam(light)) + comp = Undo.AddComponent(light.gameObject); + return comp; + } + + [MenuItem(kAddVolumetricBeam + "SD", false)] + static void Menu_AttachBeamSD_Command(MenuCommand menuCommand) { Menu_AttachBeam_Command(menuCommand); } + + [MenuItem(kAddVolumetricBeam + "HD", false)] + static void Menu_AttachBeamHD_Command(MenuCommand menuCommand) { + var beamHD = Menu_AttachBeam_Command(menuCommand); + if (beamHD) beamHD.scalable = false; + } + + [MenuItem(kAddVolumetricBeam + "SD", true)] + [MenuItem(kAddVolumetricBeam + "HD", true)] + static bool Menu_AttachBeam_Validate() { return CanAddVolumetricBeam(GetActiveLight()); } + + + const int kMenuItemPriorityBase = 1000; + + ///////////////////////////// + // DOCUMENTATION + ///////////////////////////// + const int kMenuItemPriorityDocumentation = kMenuItemPriorityBase + 1; + const string kDocumentationSuffix = "/\u2754 Documentation"; + + [MenuItem("CONTEXT/" + VolumetricLightBeamSD.ClassName + kDocumentationSuffix, false, kMenuItemPriorityDocumentation)] + static void Menu_BeamSD_Doc(MenuCommand menuCommand) { Application.OpenURL(Consts.Help.SD.UrlBeam); } + + [MenuItem("CONTEXT/" + VolumetricLightBeamHD.ClassName + kDocumentationSuffix, false, kMenuItemPriorityDocumentation)] + static void Menu_BeamHD_Doc(MenuCommand menuCommand) { Application.OpenURL(Consts.Help.HD.UrlBeam); } + + [MenuItem("CONTEXT/" + VolumetricDustParticles.ClassName + kDocumentationSuffix, false, kMenuItemPriorityDocumentation)] + static void Menu_DustParticles_Doc(MenuCommand menuCommand) { Application.OpenURL(Consts.Help.UrlDustParticles); } + + [MenuItem("CONTEXT/" + DynamicOcclusionRaycasting.ClassName + kDocumentationSuffix, false, kMenuItemPriorityDocumentation)] + static void Menu_DynamicOcclusionRaycasting_Doc(MenuCommand menuCommand) { Application.OpenURL(Consts.Help.SD.UrlDynamicOcclusionRaycasting); } + + [MenuItem("CONTEXT/" + DynamicOcclusionDepthBuffer.ClassName + kDocumentationSuffix, false, kMenuItemPriorityDocumentation)] + static void Menu_DynamicOcclusionDepthBuffer_Doc(MenuCommand menuCommand) { Application.OpenURL(Consts.Help.SD.UrlDynamicOcclusionDepthBuffer); } + + [MenuItem("CONTEXT/" + SkewingHandleSD.ClassName + kDocumentationSuffix, false, kMenuItemPriorityDocumentation)] + static void Menu_SkewingHandle_Doc(MenuCommand menuCommand) { Application.OpenURL(Consts.Help.SD.UrlSkewingHandle); } + + [MenuItem("CONTEXT/" + TriggerZone.ClassName + kDocumentationSuffix, false, kMenuItemPriorityDocumentation)] + static void Menu_TriggerZone_Doc(MenuCommand menuCommand) { Application.OpenURL(Consts.Help.UrlTriggerZone); } + + [MenuItem("CONTEXT/" + EffectFlicker.ClassName + kDocumentationSuffix, false, kMenuItemPriorityDocumentation)] + static void Menu_EffectFlicker_Doc(MenuCommand menuCommand) { Application.OpenURL(Consts.Help.UrlEffectFlicker); } + + [MenuItem("CONTEXT/" + EffectPulse.ClassName + kDocumentationSuffix, false, kMenuItemPriorityDocumentation)] + static void Menu_EffectPulse_Doc(MenuCommand menuCommand) { Application.OpenURL(Consts.Help.UrlEffectPulse); } + + [MenuItem("CONTEXT/" + EffectFromProfile.ClassName + kDocumentationSuffix, false, kMenuItemPriorityDocumentation)] + static void Menu_EffectFromProfile_Doc(MenuCommand menuCommand) { Application.OpenURL(Consts.Help.UrlEffectPulse); } + + [MenuItem("CONTEXT/" + VolumetricCookieHD.ClassName + kDocumentationSuffix, false, kMenuItemPriorityDocumentation)] + static void Menu_CookieHD_Doc(MenuCommand menuCommand) { Application.OpenURL(Consts.Help.HD.UrlCookie); } + + [MenuItem("CONTEXT/" + VolumetricShadowHD.ClassName + kDocumentationSuffix, false, kMenuItemPriorityDocumentation)] + static void Menu_ShadowHD_Doc(MenuCommand menuCommand) { Application.OpenURL(Consts.Help.HD.UrlShadow); } + + [MenuItem("CONTEXT/" + TrackRealtimeChangesOnLightHD.ClassName + kDocumentationSuffix, false, kMenuItemPriorityDocumentation)] + static void Menu_TrackRealtimeChangesOnLight_Doc(MenuCommand menuCommand) { Application.OpenURL(Consts.Help.HD.UrlTrackRealtimeChangesOnLight); } + + [MenuItem("CONTEXT/" + Config.ClassName + kDocumentationSuffix, false, kMenuItemPriorityDocumentation)] + static void Menu_Config_Doc(MenuCommand menuCommand) { Application.OpenURL(Consts.Help.UrlConfig); } + + ///////////////////////////// + // GLOBAL CONFIG + ///////////////////////////// + const int kMenuItemPriorityOpenConfig = kMenuItemPriorityBase + 2; + const string kOpenConfigSuffix = "/\u2699 Open Global Config"; + + [MenuItem("CONTEXT/" + VolumetricLightBeamAbstractBase.ClassName + kOpenConfigSuffix, false, kMenuItemPriorityOpenConfig)] + [MenuItem("CONTEXT/" + VolumetricDustParticles.ClassName + kOpenConfigSuffix, false, kMenuItemPriorityOpenConfig)] + [MenuItem("CONTEXT/" + DynamicOcclusionAbstractBase.ClassName + kOpenConfigSuffix, false, kMenuItemPriorityOpenConfig)] + [MenuItem("CONTEXT/" + SkewingHandleSD.ClassName + kOpenConfigSuffix, false, kMenuItemPriorityOpenConfig)] + [MenuItem("CONTEXT/" + TriggerZone.ClassName + kOpenConfigSuffix, false, kMenuItemPriorityOpenConfig)] + [MenuItem("CONTEXT/" + EffectAbstractBase.ClassName + kOpenConfigSuffix, false, kMenuItemPriorityOpenConfig)] + [MenuItem("CONTEXT/" + EffectFromProfile.ClassName + kOpenConfigSuffix, false, kMenuItemPriorityOpenConfig)] + [MenuItem("CONTEXT/" + VolumetricCookieHD.ClassName + kOpenConfigSuffix, false, kMenuItemPriorityOpenConfig)] + [MenuItem("CONTEXT/" + VolumetricShadowHD.ClassName + kOpenConfigSuffix, false, kMenuItemPriorityOpenConfig)] + [MenuItem("CONTEXT/" + TrackRealtimeChangesOnLightHD.ClassName + kOpenConfigSuffix, false, kMenuItemPriorityOpenConfig)] + public static void Menu_Beam_Config(MenuCommand menuCommand) { Config.EditorSelectInstance(); } + + ///////////////////////////// + // ADDITIONAL COMPONENTS + ///////////////////////////// + const string kAddParticlesSD = "CONTEXT/" + VolumetricLightBeamSD.ClassName + "/Add Dust Particles"; + [MenuItem(kAddParticlesSD, false)] static void Menu_AddDustParticles_CommandSD(MenuCommand menuCommand) => Menu_AddDustParticles_Command_Common(menuCommand); + [MenuItem(kAddParticlesSD, true)] static bool Menu_AddDustParticles_ValidateSD() => Menu_AddDustParticles_Validate_Common(); + + const string kAddParticlesHD = "CONTEXT/" + VolumetricLightBeamHD.ClassName + "/Add Dust Particles"; + [MenuItem(kAddParticlesHD, false)] static void Menu_AddDustParticles_CommandHD(MenuCommand menuCommand) => Menu_AddDustParticles_Command_Common(menuCommand); + [MenuItem(kAddParticlesHD, true)] static bool Menu_AddDustParticles_ValidateHD() => Menu_AddDustParticles_Validate_Common(); + + static void Menu_AddDustParticles_Command_Common(MenuCommand menuCommand) { EditorExtensions.AddComponentFromEditor(menuCommand.context as VolumetricLightBeamAbstractBase); } + static bool Menu_AddDustParticles_Validate_Common() { return EditorExtensions.CanAddComponentFromEditor(GetActiveVolumetricLightBeam()); } + + const string kAddDynamicOcclusionRaycasting = "CONTEXT/" + VolumetricLightBeamSD.ClassName + "/Add Dynamic Occlusion (Raycasting)"; + [MenuItem(kAddDynamicOcclusionRaycasting, false)] static void Menu_AddDynamicOcclusionRaycasting_Command(MenuCommand menuCommand) { EditorExtensions.AddComponentFromEditor(menuCommand.context as VolumetricLightBeamSD); } + [MenuItem(kAddDynamicOcclusionRaycasting, true)] static bool Menu_AddDynamicOcclusionRaycasting_Validate() { return Config.Instance.featureEnabledDynamicOcclusion && EditorExtensions.CanAddComponentFromEditor(GetActiveVolumetricLightBeam()); } + + const string kAddDynamicOcclusionDepthBuffer = "CONTEXT/" + VolumetricLightBeamSD.ClassName + "/Add Dynamic Occlusion (Depth Buffer)"; + [MenuItem(kAddDynamicOcclusionDepthBuffer, false)] static void Menu_AddDynamicOcclusionDepthBuffer_Command(MenuCommand menuCommand) { EditorExtensions.AddComponentFromEditor(menuCommand.context as VolumetricLightBeamSD); } + [MenuItem(kAddDynamicOcclusionDepthBuffer, true)] static bool Menu_AddDynamicOcclusionDepthBuffer_Validate() { return Config.Instance.featureEnabledDynamicOcclusion && EditorExtensions.CanAddComponentFromEditor(GetActiveVolumetricLightBeam()); } + + const string kAddTriggerZoneSD = "CONTEXT/" + VolumetricLightBeamSD.ClassName + "/Add Trigger Zone"; + [MenuItem(kAddTriggerZoneSD, false)] static void Menu_AddTriggerZone_CommandSD(MenuCommand menuCommand) => Menu_AddTriggerZone_Command_Common(menuCommand); + [MenuItem(kAddTriggerZoneSD, true)] static bool Menu_AddTriggerZone_ValidateSD() => Menu_AddTriggerZone_Validate_Common(); + + const string kAddTriggerZoneHD = "CONTEXT/" + VolumetricLightBeamHD.ClassName + "/Add Trigger Zone"; + [MenuItem(kAddTriggerZoneHD, false)] static void Menu_AddTriggerZone_CommandHD(MenuCommand menuCommand) => Menu_AddTriggerZone_Command_Common(menuCommand); + [MenuItem(kAddTriggerZoneHD, true)] static bool Menu_AddTriggerZone_ValidateHD() => Menu_AddTriggerZone_Validate_Common(); + + static void Menu_AddTriggerZone_Command_Common(MenuCommand menuCommand) { EditorExtensions.AddComponentFromEditor(menuCommand.context as VolumetricLightBeamAbstractBase); } + static bool Menu_AddTriggerZone_Validate_Common() { return EditorExtensions.CanAddComponentFromEditor(GetActiveVolumetricLightBeam()); } + + const string kAddEffectFlickerSD = "CONTEXT/" + VolumetricLightBeamSD.ClassName + "/Add Effect Flicker"; + [MenuItem(kAddEffectFlickerSD, false)] static void Menu_EffectFlicker_CommandSD(MenuCommand menuCommand) => Menu_EffectFlicker_Command_Common(menuCommand); + [MenuItem(kAddEffectFlickerSD, true)] static bool Menu_EffectFlicker_ValidateSD() => Menu_Effect_Validate_Common(); + + const string kAddEffectFlickerHD = "CONTEXT/" + VolumetricLightBeamHD.ClassName + "/Add Effect Flicker"; + [MenuItem(kAddEffectFlickerHD, false)] static void Menu_EffectFlicker_CommandHD(MenuCommand menuCommand) => Menu_EffectFlicker_Command_Common(menuCommand); + [MenuItem(kAddEffectFlickerHD, true)] static bool Menu_EffectFlicker_ValidateHD() => Menu_Effect_Validate_Common(); + + const string kAddEffectFromProfileSD = "CONTEXT/" + VolumetricLightBeamSD.ClassName + "/Add Effect from Profile"; + [MenuItem(kAddEffectFromProfileSD, false)] static void Menu_EffectFromProfile_CommandSD(MenuCommand menuCommand) => Menu_EffectFromProfile_Command_Common(menuCommand); + [MenuItem(kAddEffectFromProfileSD, true)] static bool Menu_EffectFromProfile_ValidateSD() => Menu_Effect_Validate_Common(); + + static void Menu_EffectFlicker_Command_Common(MenuCommand menuCommand) { EditorExtensions.AddComponentFromEditor(menuCommand.context as VolumetricLightBeamAbstractBase); } + + const string kAddEffectPulseSD = "CONTEXT/" + VolumetricLightBeamSD.ClassName + "/Add Effect Pulse"; + [MenuItem(kAddEffectPulseSD, false)] static void Menu_EffectPulse_CommandSD(MenuCommand menuCommand) => Menu_EffectPulse_Command_Common(menuCommand); + [MenuItem(kAddEffectPulseSD, true)] static bool Menu_EffectPulse_ValidateSD() => Menu_Effect_Validate_Common(); + + const string kAddEffectPulseHD = "CONTEXT/" + VolumetricLightBeamHD.ClassName + "/Add Effect Pulse"; + [MenuItem(kAddEffectPulseHD, false)] static void Menu_EffectPulse_CommandHD(MenuCommand menuCommand) => Menu_EffectPulse_Command_Common(menuCommand); + [MenuItem(kAddEffectPulseHD, true)] static bool Menu_EffectPulse_ValidateHD() => Menu_Effect_Validate_Common(); + + const string kAddEffectFromProfileHD = "CONTEXT/" + VolumetricLightBeamHD.ClassName + "/Add Effect from Profile"; + [MenuItem(kAddEffectFromProfileHD, false)] static void Menu_EffectFromProfile_CommandHD(MenuCommand menuCommand) => Menu_EffectFromProfile_Command_Common(menuCommand); + [MenuItem(kAddEffectFromProfileHD, true)] static bool Menu_EffectFromProfile_ValidateHD() => Menu_Effect_Validate_Common(); + + static void Menu_EffectPulse_Command_Common(MenuCommand menuCommand) { EditorExtensions.AddComponentFromEditor(menuCommand.context as VolumetricLightBeamAbstractBase); } + static void Menu_EffectFromProfile_Command_Common(MenuCommand menuCommand) { EditorExtensions.AddComponentFromEditor(menuCommand.context as VolumetricLightBeamAbstractBase); } + + static bool Menu_Effect_Validate_Common() + { + var activeBeam = GetActiveVolumetricLightBeam(); + return !Application.isPlaying + && activeBeam != null + && activeBeam.GetComponent() == null + && activeBeam.GetComponent() == null + ; + } + + const string kAddShadow = "CONTEXT/" + VolumetricLightBeamHD.ClassName + "/Add Volumetric Shadow"; + [MenuItem(kAddShadow, false)] static void Menu_AddShadow_Command(MenuCommand menuCommand) { EditorExtensions.AddComponentFromEditor(menuCommand.context as VolumetricLightBeamHD); } + [MenuItem(kAddShadow, true)] static bool Menu_AddShadow_Validate() { return Config.Instance.featureEnabledShadow && EditorExtensions.CanAddComponentFromEditor(GetActiveVolumetricLightBeam()); } + + const string kAddCookie = "CONTEXT/" + VolumetricLightBeamHD.ClassName + "/Add Volumetric Cookie"; + [MenuItem(kAddCookie, false)] static void Menu_AddCookie_Command(MenuCommand menuCommand) { EditorExtensions.AddComponentFromEditor(menuCommand.context as VolumetricLightBeamHD); } + [MenuItem(kAddCookie, true)] static bool Menu_AddCookie_Validate() { return Config.Instance.featureEnabledCookie && EditorExtensions.CanAddComponentFromEditor(GetActiveVolumetricLightBeam()); } + + const string kAddTrackRealtime = "CONTEXT/" + VolumetricLightBeamHD.ClassName + "/Add Track Realtime Changes on Light"; + [MenuItem(kAddTrackRealtime, false)] static void Menu_AddTrackRealtime_Command(MenuCommand menuCommand) { EditorExtensions.AddComponentFromEditor(menuCommand.context as VolumetricLightBeamHD); } + [MenuItem(kAddTrackRealtime, true)] static bool Menu_AddTrackRealtime_Validate() { return EditorExtensions.CanAddComponentFromEditor(GetActiveVolumetricLightBeam()) && GetActiveVolumetricLightBeam().GetComponent() != null; } + + static Light GetActiveLight() { return Selection.activeGameObject != null ? Selection.activeGameObject.GetComponent() : null; } + static VolumetricLightBeamAbstractBase GetActiveVolumetricLightBeam() { return Selection.activeGameObject != null ? Selection.activeGameObject.GetComponent() : null; } + + + + + ///////////////////////////// + // EDIT MENU + ///////////////////////////// + const string kEditMenu = "Edit/" + kCategoryName; + + [MenuItem(kEditMenu + "\u2699 Open Config", false, 20001)] + static void Menu_EditOpenConfig() { Config.EditorSelectInstance(); } + +#if UNITY_2019_3_OR_NEWER + [MenuItem(kEditMenu + "Enable scene Pickability on all beams", false, 20101)] + static void Menu_SetAllBeamsPickabilityEnabled() { SetAllBeamsPickability(true); } + + [MenuItem(kEditMenu + "Disable scene Pickability on all beams", false, 20102)] + static void Menu_SetAllBeamsPickabilityDisable() { SetAllBeamsPickability(false); } + + [MenuItem(kEditMenu + "Enable scene Visibility on all beams", false, 20201)] + static void Menu_SetAllBeamsVisibilityEnabled() { SetAllBeamsVisibility(true); } + + [MenuItem(kEditMenu + "Disable scene Visibility on all beams", false, 20202)] + static void Menu_SetAllBeamsVisibilityDisable() { SetAllBeamsVisibility(false); } + + static void SetAllBeamsVisibility(bool enabled) + { + var beams = Resources.FindObjectsOfTypeAll(); + + foreach (var beam in beams) + beam.gameObject.SetSceneVisibilityState(enabled); + } + + static void SetAllBeamsPickability(bool enabled) + { + var beams = Resources.FindObjectsOfTypeAll(); + + foreach (var beam in beams) + beam.gameObject.SetScenePickabilityState(enabled); + } +#endif // UNITY_2019_3_OR_NEWER + + + ///////////////////////////// + // PROJECT BROWSER + ///////////////////////////// + const string kProjectBrowserMenuPrefix = "Assets/Create/" + kCategoryName; + + static string CurrentProjectFolderPath + { + get + { + var projectWindowUtilType = typeof(ProjectWindowUtil); + MethodInfo getActiveFolderPath = projectWindowUtilType.GetMethod("GetActiveFolderPath", BindingFlags.Static | BindingFlags.NonPublic); + if (getActiveFolderPath != null) + { + object obj = getActiveFolderPath.Invoke(null, new object[0]); + if(obj != null) + return obj.ToString(); + } + return ""; + } + } + + [MenuItem(kProjectBrowserMenuPrefix + "Flicker Effect Profile", false, 1000)] + public static void CreateEffectProfileFlicker() { CreateEffectProfile("VLBEffectProfile_Flicker"); } + + [MenuItem(kProjectBrowserMenuPrefix + "Pulse Effect Profile", false, 1001)] + public static void CreateEffectProfilePulse() { CreateEffectProfile("VLBEffectProfile_Pulse"); } + + static void CreateEffectProfile(string name) where T : Component + { + if (Application.isPlaying) + { + Debug.LogError("Can't create new prefab during playmode"); + return; + } + + var currentProjectPath = CurrentProjectFolderPath; + if(!currentProjectPath.StartsWith("Assets", StringComparison.CurrentCultureIgnoreCase)) + { + Debug.LogErrorFormat("Can't create new asset under folder '{0}'", currentProjectPath); + return; + } + + var assetPath = System.IO.Path.Combine(currentProjectPath, name + ".prefab"); + assetPath = AssetDatabase.GenerateUniqueAssetPath(assetPath); + + var gao = new GameObject(); + gao.AddComponent(); + + bool result; + PrefabUtility.SaveAsPrefabAsset(gao, assetPath, out result); + + if (result) + Debug.LogFormat("Prefab '{0}' was saved successfully", assetPath); + else + Debug.LogFormat("Prefab '{0}' failed to save", assetPath); + + GameObject.DestroyImmediate(gao); + } + } +} +#endif + diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/RotateObject.cs.meta b/Assets/External/VolumetricLightBeam/Editor/EditorMenuItems.cs.meta similarity index 83% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/RotateObject.cs.meta rename to Assets/External/VolumetricLightBeam/Editor/EditorMenuItems.cs.meta index 002c89a0..96bea7b2 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/RotateObject.cs.meta +++ b/Assets/External/VolumetricLightBeam/Editor/EditorMenuItems.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 661c50f52ae812e42a32e8ed7dfa84c1 +guid: 59bb1c7e6f7293443af232bd3ee62887 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/External/VolumetricLightBeam/Editor/EditorStrings.cs b/Assets/External/VolumetricLightBeam/Editor/EditorStrings.cs new file mode 100644 index 00000000..2c02d5a1 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/EditorStrings.cs @@ -0,0 +1,465 @@ +#if UNITY_EDITOR +using UnityEngine; + +namespace VLB +{ + public static class EditorStrings + { + public static class Common + { + public static readonly GUIContent ButtonOpenGlobalConfig = new GUIContent("Open Config asset in use"); + public const string HelpNoiseLoadingFailed = "Fail to load 3D noise texture. Please check your Config."; + + public static readonly string[] DimensionsEnumDescriptions = new string[] + { + "3D", + "2D", + }; + } + + public static class Beam + { + public static readonly GUIContent HeaderBasic = new GUIContent("Basic", "Basic beam's properties (color, thickness...)"); + public static readonly GUIContent HeaderShape = new GUIContent("Shape", "Tweak the shape of the cone (sport angle, range distance...)"); + public static readonly GUIContent HeaderAttenuation = new GUIContent("Fall-Off Attenuation", "Control the beam's range distance and the light fall-off behaviour"); + public static readonly GUIContent Header3DNoise = new GUIContent("3D Noise", "Simulate animated volumetric fog / mist / smoke effects.\nIt makes the volumetric lights look less 'perfect' and so much more realistic.\nTo achieve that, a tiled 3D noise texture is internally loaded and used by the beam shader."); + public static readonly GUIContent HeaderBlendingDistances = new GUIContent("Soft Intersections Blending Distances", "Because the volumetric beams are rendered using cone geometry, it is possible that it intersects with the camera's near plane or with the world's geometry, which could produce unwanted artifacts.\nThese properties are designed to fix this issue."); + public static readonly GUIContent HeaderGeometry = new GUIContent("Cone Geometry", "Control how the beam's geometry is generated."); + public static readonly GUIContent HeaderFadeOut = new GUIContent("Fade Out"); + public static readonly GUIContent Header2D = new GUIContent("2D", "Tweak and combine the order when beams are rendered with 2D objects (such as 2D sprites)"); + public static readonly GUIContent HeaderInfos = new GUIContent("Infos"); + + public const string FromSpotLight = "Get the value from the Light Spot"; + + public static readonly GUIContent ColorMode = new GUIContent("Color", "Apply a flat/plain/single color, or a gradient."); + public static readonly GUIContent ColorGradient = new GUIContent("", "Use the gradient editor to set color and alpha variations along the beam."); + public static readonly GUIContent ColorFlat = new GUIContent("", "Use the color picker to set a plain RGBA color (takes account of the alpha value)."); + + public const string IntensityMultiplier = "Multiplier to modulate the intensity from the attached Unity's spotlight."; + + public static readonly GUIContent HDRPExposureWeight = new GUIContent("Exposure Weight", "Use this slider to set how much effect the exposure has on the beam intensity."); + + public static readonly GUIContent BlendingMode = new GUIContent("Blending Mode", "Additive: highly recommended blending mode\nSoftAdditive: softer additive\nTraditional Transparency: support dark/black colors"); + public static readonly GUIContent ShaderAccuracy = new GUIContent("Shader Accuracy", "- Fast: a lot of computation are done on the vertex shader to maximize performance.\n- High: most of the computation are done on the pixel shader to maximize graphical quality at some performance cost.\n\nWe recommend to keep the default 'Fast' shader accuracy to ensure best performance, except when using the 'Tilt Factor' feature or when using a very rich 'Gradient Color'."); + + public static readonly GUIContent SpotAngle = new GUIContent("Spot Angle", "Define the angle (in degrees) at the base of the beam's cone"); + public const string SpotAngleMultiplier = "Multiplier to modulate the angle from the attached Unity's spotlight."; + + public static readonly GUIContent GlareFrontal = new GUIContent("Glare (frontal)", "Boost intensity factor when looking at the beam from the inside directly at the source."); + public static readonly GUIContent GlareBehind = new GUIContent("Glare (from behind)", "Boost intensity factor when looking at the beam from behind."); + + public static readonly GUIContent TrackChanges = new GUIContent( + " Track changes during Playtime", + "Check this box to be able to modify properties during Playtime via Script, Animator and/or Timeline.\nEnabling this feature is at very minor performance cost. So keep it disabled if you don't plan to modify this light beam during playtime."); + + public static readonly GUIContent FallOffStart = new GUIContent("Attenuation Start Distance", "Distance from the light source (in units) the beam intensity will start to fall-off."); + public static readonly GUIContent FallOffEnd = new GUIContent("Light Range Max Distance", "Distance from the light source (in units) the beam is entirely faded out."); + public const string FallOffEndMultiplier = "Distance multiplier to modulate the range from the attached Unity's spotlight."; + + public static readonly GUIContent NoiseMode = new GUIContent("Enabled", "Enable 3D Noise effect and choose the mode:\n- World Space: the noise will look 'grounded' in the world\n- Local Space: the noise will look 'tied' to the beam"); + public static readonly GUIContent NoiseIntensity = new GUIContent("Intensity", "Higher intensity means the noise contribution is stronger and more visible"); + public static readonly GUIContent NoiseScale = new GUIContent("Scale", "3D Noise texture scaling: higher scale make the noise more visible, but potentially less realistic"); + public static readonly GUIContent NoiseVelocity = new GUIContent("Velocity", "Direction and speed of the noise scrolling, simulating the fog/smoke movement"); + public static readonly string[] NoiseModeEnumDescriptions = new string[] + { + "Disabled", + "Enabled (World Space)", + "Enabled (Local Space)", + }; + + public static readonly GUIContent CameraClippingDistance = new GUIContent("Camera", "Distance from the camera the beam will fade with.\n- 0.0: hard intersection\n- Higher values produce soft intersection when the camera is near the cone triangles.\n\nThis distance is NOT scaled according to the beam's GameObject scale. You'll have to set a consistent distance value when scaling your beams, specially with very tiny or very large scaling factors."); + public static readonly GUIContent DepthBlendDistance = new GUIContent("Opaque geometry", "Distance from the world geometry the beam will fade with.\n- 0.0 (feature disabled): hard intersection but faster (doesn't require to update the depth texture).\n- Higher values produce soft intersection when the beam intersects world's geometry, but require to update the camera's depth texture.\n\nThis distance is NOT scaled according to the beam's GameObject scale. You'll have to set a consistent distance value when scaling your beams, specially with very tiny or very large scaling factors."); + + public static readonly GUIContent ConeRadiusStart = new GUIContent("Light Source Radius", "Radius (in units) at the beam's source (the top of the cone).\n0 will generate a perfect cone geometry.\nHigher values will generate truncated cones."); + + public static readonly GUIContent GeomMeshType = new GUIContent("Mesh Type", "- Shared: Use the global shared mesh (recommended setting, since it will save a lot of memory). Will use the geometry properties set on configuration file.\n- Custom: Use a custom mesh instead. Will use the geometry properties set on the beam."); + public static readonly GUIContent GeomCap = new GUIContent("Cap", "Show Cap Geometry (only visible from inside)"); + public static readonly GUIContent GeomSides = new GUIContent("Sides", "Number of Sides of the cone.\nHigher values make the beam looks more 'round', but require more memory and graphic performance.\nA recommended value for a decent quality while keeping the poly count low is 18."); + public static readonly GUIContent GeomSegments = new GUIContent("Segments", "Number of Segments of the cone.\nHigher values give better looking results but require more performance. We recommend at least 3 segments, specially regarding Attenuation and Gradient, otherwise the approximation could become inaccurate.\nThe longer the beam, the more segments we recommend to set.\nA recommended value is 4."); + + public static readonly GUIContent Scalable = new GUIContent("Is Scalable?", "The scaling of the beam's GameObject (or any of its parent in the hierarchy)...\n-True: ...will be applied to the beam itself and will change its size.\n-False: ...won't be applied to the beam itself, so the beam won't have its size changed.\n\nIn short, we recommend to set the Scalable property at:\n-True when there is no Unity Light attached to the same GameObject, so you will be able to scale your beam easily.\n- False when there is a Unity Light attached to the same GameObject, because the Unity Light are NOT scalable: this way your beam will always fit the Unity Light size."); + + public static readonly GUIContent FadeOutEnabled = new GUIContent("Enabled", "Enable the fade out of the beam according to the distance to the camera."); + public static readonly GUIContent FadeOutBegin = new GUIContent("Begin Distance", "Fade out starting distance. Beyond this distance, the beam intensity will start to be dimmed."); + public static readonly GUIContent FadeOutEnd = new GUIContent("End", "Fade out ending distance. Beyond this distance, the beam will be culled off to save on performance."); + + public static readonly GUIContent Dimensions = new GUIContent("Dimensions", "- 3D: beam along the Z axis.\n- 2D: beam along the X axis, so you won't have to rotate it to see it in 2D."); + public const string SortingLayer = "Sorting Layer"; + public static readonly GUIContent SortingOrder = new GUIContent("Order", "The overlay priority within its layer. Lower numbers are rendered first and subsequent numbers overlay those below."); + + // BUTTONS + public static readonly GUIContent ButtonCreateOverridePerPlatform = new GUIContent("Create another Config asset for a specific platform", ""); + public static readonly GUIContent ButtonResetProperties = new GUIContent("Default values", "Reset properties to their default values."); + public static readonly GUIContent ButtonGenerateGeometry = new GUIContent("Regenerate geometry", "Force to re-create the Beam Geometry GameObject."); + public static readonly GUIContent ButtonEditInScene = new GUIContent("Edit in Scene View", "Edit some beam's properties directly in the Scene View using convenient gizmos."); + public const string ButtonAddDustParticles = "+ Volumetric Dust Particles\nAdd highly detailed dustlight/mote particles on your beam."; + public const string ButtonAddDynamicOcclusion = "+ Dynamic Occlusion\nGives awareness to your beam so it reacts to changes in the world: it could be occluded by environment geometry."; + public const string ButtonAddDynamicOcclusionRaycasting = "+ Dynamic Occlusion (Raycasting)"; + public const string ButtonAddDynamicOcclusionDepthBuffer = "+ Dynamic Occlusion (Depth Buffer)"; + public const string ButtonAddTriggerZone = "+ Trigger Zone\nTrack objects passing through the light beam and track when the beam is passing over them."; + public const string ButtonAddEffect = "+ Effect\nAdd runtime FX to easily animate your light and/or beam with effects such as strobe/flickering and pulsing/flashing."; + public const string ButtonAddEffectFlicker = "+ Effect Flicker"; + public const string ButtonAddEffectPulse = "+ Effect Pulse"; + public const string ButtonAddEffectFromProfile = "+ Effect from Profile"; + + // HELP BOXES + public const string HelpNoSpotlight = "To bind properties from the Light and the Beam together, this component must be attached to a Light of type 'Spot'"; + public const string HelpFadeOutNoMainCamera = "Fail to retrieve the main camera specified in the config."; + + public const string PrefEditInScene = "VLB_BEAM_EDITINSCENE"; + + public static class SD + { + public static readonly GUIContent IntensityModeAdvanced = new GUIContent("Adv", "Advanced Mode: control inside and outside intensity values independently."); + public static readonly GUIContent IntensityGlobal = new GUIContent("Intensity", "Global beam intensity. If you want to control values for inside and outside independently, use the advanced mode."); + public static readonly GUIContent IntensityOutside = new GUIContent("Intensity (outside)", "Beam outside intensity (when looking at the beam from behind)."); + public static readonly GUIContent IntensityInside = new GUIContent("Intensity (inside)", "Beam inside intensity (when looking at the beam from the inside directly at the source)."); + + public static readonly GUIContent SideThickness = new GUIContent("Side Thickness", "Thickness of the beam when looking at it from the side.\n1 = the beam is fully visible (no difference between the center and the edges), but produces hard edges.\nLower values produce softer transition at beam edges."); + + public static readonly GUIContent AttenuationEquation = new GUIContent("Attenuation Equation", "Attenuation equation used to compute fading between 'Attenuation Start Distance' and 'Light Range Max Distance'.\n- Linear: Simple linear attenuation\n- Quadratic: Quadratic attenuation, which usually gives more realistic results\n- Blend: Custom blending mix between linear (0.0) and quadratic attenuation (1.0)"); + public static readonly GUIContent AttenuationCustomBlending = new GUIContent("", "Blending value between Linear (0.0) and Quadratic (1.0) attenuation equations."); + + public static readonly GUIContent SkewingLocalForwardDirection = new GUIContent("Skewing Factor", "Distort the shape of the beam horizontally and vertically while keeping its circular slice unchanged."); + public static readonly GUIContent ClippingPlane = new GUIContent("Clipping Plane", "Additional clipping plane transform. Will cut the beam according to the GameObject's position and rotation."); + public static readonly GUIContent EditorShowClippingPlane = new GUIContent("Debug", "Display the additional clipping plane."); + + public static readonly GUIContent TiltFactor = new GUIContent("Tilt Factor", "Tilt the color and attenuation gradient compared to the global beam's direction.\nCan only be used with 'High' shader accuracy mode."); + public static readonly GUIContent EditorShowTiltDirection = new GUIContent("Debug", "Display the direction of the tilt factor in editor."); + + public const string HelpDepthMobile = "On mobile platforms, the depth buffer precision can be pretty low. Try to keep a small depth range on your cameras: the difference between the near and far clip planes should stay as low as possible."; + public const string HelpTrackChangesEnabled = "This beam will keep track of the changes of its own properties and the spotlight attached to it (if any) during playtime. You can modify every properties except 'geomSides'."; + public const string HelpAnimatorWarning = "If you want to animate your light beam in real-time, you should enable the 'Track Changes During Playtime' property."; + public const string HelpTiltedWithShaderAccuracyFast = "We highly recommend to set the 'Shader Accuracy' property to 'High' when using 'Tilt Factor'."; + public const string PrefShowAddClippingPlane = "VLB_BEAM_SHOWADDCLIPPINGPLANE"; + } + + public static class HD + { + public static readonly GUIContent HeaderRaymarching = new GUIContent("Raymarching", ""); + public static readonly GUIContent HeaderCookie = new GUIContent("Cookie", ""); + + public static readonly GUIContent SideSoftness = new GUIContent("Side Softness", "Smoothness of the beam when looking at it from the side, controlling how soft it looks on the edges."); + public static readonly GUIContent Intensity = new GUIContent("Intensity", "Controls the brightness of the beam."); + + public static readonly GUIContent AttenuationEquation = new GUIContent("Attenuation Equation", "Attenuation equation used to compute fading between 'Attenuation Start Distance' and 'Light Range Max Distance'.\n- Linear: Simple linear attenuation\n- Quadratic: Quadratic attenuation, which usually gives more realistic results"); + + public static readonly GUIContent RaymarchingQuality = new GUIContent("Quality", "Specify which raymarching quality you want to use for this beam (the higher the steps, the better quality, the slower the performances).\n\nThe different qualities names and steps count can be configured from plugin's config."); + + public static readonly GUIContent JitteringFactor = new GUIContent("Jittering Factor", "When using Shadow or Cookie with a raymarching quality with too low steps count, some banding artifacts can appear.\nIn this case, increase jittering to add noise to smooth raymarching inaccuracy."); + public static readonly GUIContent JitteringFrameRate = new GUIContent("Jittering Frame Rate", "Animate the jittering noise texture over the time:\n0 = the jittering won't be animated.\nhigher values = the jittering will be animated more often."); + public static readonly GUIContent JitteringLerpRange = new GUIContent("Jittering Lerp Range", "Configure where the jittering will be visible along the beam. This range is specified between 0 (the tip of the beam) and 1 (the end of the beam):\n- before the range: no jittering\n- in the range: jittering will lerp from 0 to 'jittering factor' value\n- after the range: 'jittering factor' value"); + + public const string TipJittering = "When using this feature, we highly recommend to increase the 'Jittering Factor' property on your HD beam.\nAdding jittering allows to have a decent rendering quality by smoothing banding artifact while keeping raymarching steps as low as possible(and so good performance)."; + + + public const string ButtonAddShadow = "+ Volumetric Shadow\nGives awareness to your beam so it reacts to changes in the world: it could be occluded by environment geometry."; + public const string ButtonAddCookie = "+ Volumetric Cookie\nSpecify a cookie texture to the beam, which is a mask to simulate a shadow with a specific shape or color."; + + public const string ButtonAddTrackRealtimeChangesOnLight = "+Track Realtime Changes On Light\nAdd this script be able to modify properties on the Unity's Light component during Playtime via Script, Animator and/or Timeline.\nEnabling this feature is at very minor performance cost. So keep it disabled if you don't plan to modify the Unity's Light component during playtime."; + public const string TipTrackRealtimeChangesOnLight = "Realtime changes on the Unity's Light component properties (via Script, Animator and/or Timeline) will be taken into account."; + } + } + + public static class DustParticles + { + public static readonly GUIContent HeaderRendering = new GUIContent("Rendering"); + public static readonly GUIContent HeaderDirectionAndVelocity = new GUIContent("Direction & Velocity"); + public static readonly GUIContent HeaderCulling = new GUIContent("Culling"); + public static readonly GUIContent HeaderSpawning = new GUIContent("Spawning"); + public static readonly GUIContent HeaderInfos = new GUIContent("Infos"); + + public static readonly GUIContent Alpha = new GUIContent("Alpha", "Max alpha of the particles"); + public static readonly GUIContent Size = new GUIContent("Size", "Max size of the particles"); + + public static readonly GUIContent Direction = new GUIContent("Direction", "Direction of the particles\n- Random: random direction.\n- Local Space: particles follow the velicity direction in local space (Z is along the beam).\n- World Space: particles follow the velicity direction in world space."); + public static readonly GUIContent Velocity = new GUIContent("Velocity", "Movement speed of the particles along the chosen direction"); + + public static readonly GUIContent CullingEnabled = new GUIContent("Enabled", "Enable particles culling based on the distance to the Main Camera.\nWe highly recommend to enable this feature to keep good runtime performances."); + public static readonly GUIContent CullingMaxDistance = new GUIContent("Max Distance", "The particles will not be rendered if they are further than this distance to the Main Camera"); + + public static readonly GUIContent Density = new GUIContent("Density", "Control how many particles are spawned. The higher the density, the more particles are spawned, the higher the performance cost is"); + public static readonly GUIContent SpawnDistanceRange = new GUIContent("Distance Range", "The distance range (from the light source) where the particles are spawned.\n- Min bound: the higher it is, the more the particles are spawned away from the light source.\n- Max bound: the lower it is, the more the particles are gathered near the light source."); + + // HELP BOXES + public const string HelpFailToInstantiate = "Fail to instantiate the Particles. Please check your Config."; + public const string HelpRecommendation = "We do not recommend to use this feature if you plan to move or change properties of the beam during playtime."; + } + + public static class DynOcclusion + { + public static readonly GUIContent HeaderUpdateRate = new GUIContent("Update Rate"); + public static readonly GUIContent HeaderRaycasting = new GUIContent("Raycasting"); + public static readonly GUIContent HeaderOccluderSurface = new GUIContent("Occluder Surface"); + public static readonly GUIContent HeaderClippingPlane = new GUIContent("Clipping Plane"); + public static readonly GUIContent HeaderCamera = new GUIContent("Camera"); + public static readonly GUIContent HeaderEditorDebug = new GUIContent("Editor Debug"); + + public static readonly GUIContent Dimensions = new GUIContent("Dimensions", "Should it interact with 2D or 3D occluders?\n- 3D: the beam will react against 3D Occluders.\n- 2D: the beam will react against 2D Occluders. This is useful when using the beams with 2D objects (such as 2D Sprites)."); + + public static readonly GUIContent LayerMask = new GUIContent("Layer Mask", + "The beam can only be occluded by objects located on the layers matching this mask.\nIt's very important to set it as restrictive as possible (checking only the layers which are necessary) to perform a more efficient process in order to increase the performance."); + public static readonly GUIContent ConsiderTriggers = new GUIContent("Consider Triggers", + "Should this beam be occluded by triggers or not?"); + public const string ConsiderTriggersNoPossible = "In order to be able to consider triggers as 2D occluders, you should tick the 'Queries Hit Triggers' checkbox under the 'Physics 2D' settings menu."; + public static readonly GUIContent MinOccluderArea = new GUIContent("Min Occluder Area", + "Minimum 'area' of the collider to become an occluder.\nColliders smaller than this value will not block the beam."); + public static readonly GUIContent UpdateRate = new GUIContent("Update Rate", "How often will the occlusion be processed?\nTry to update the occlusion as rarely as possible to keep good performance."); + public static readonly string[] UpdateRateDescriptions = new string[] + { + "Never", + "On Enable (only once)", + "On Beam Move", + "Every X Frames", + "On Beam Move and Every X Frames", + }; + + public static readonly GUIContent WaitXFrames = new GUIContent("X frames to wait", + "How many frames we wait between 2 occlusion tests?\nIf you want your beam to be super responsive to the changes of your environment, update it every frame by setting 1.\nIf you want to save on performance, we recommend to wait few frames between each update by setting a higher value."); + public static readonly GUIContent MinSurfaceRatio = new GUIContent("Min Occluded %", "Approximated percentage of the beam to collide with the surface in order to be considered as occluder."); + public static readonly GUIContent MaxSurfaceDot = new GUIContent("Max Angle", "Max angle (in degrees) between the beam and the surface in order to be considered as occluder."); + public static readonly GUIContent PlaneAlignment = new GUIContent("Alignment", "Alignment of the computed clipping plane:\n- Surface: align to the surface normal which blocks the beam. Works better for large occluders such as floors and walls.\n- Beam: keep the plane aligned with the beam direction. Works better with more complex occluders or with corners."); + public static readonly GUIContent PlaneOffset = new GUIContent("Offset Units", "Translate the plane. We recommend to set a small positive offset in order to handle non-flat surface better."); + public static readonly GUIContent FadeDistanceToSurface = new GUIContent("Fade Distance Units", "Fade out the beam before the occlusion surface in order to soften the transition."); + public static readonly GUIContent EditorShowDebugPlane = new GUIContent("Show Debug Plane", "Draw debug plane on the scene view."); + public static readonly GUIContent EditorRaycastAtEachFrame = new GUIContent("Update in Editor", "Perform occlusion tests and raycasts in Editor."); + + public static string GetUpdateRateAdvice(DynamicOcclusionUpdateRate value) + { + switch (value) + { + case DynamicOcclusionUpdateRate.Never: return string.Format("The occlusion will never be updated.\nThe only way to update it is to manually call '{0}.ProcessOcclusionManually()' from script whenever you need.", typeof(T).Name); + case DynamicOcclusionUpdateRate.OnEnable: return "The occlusion will only be updated once on start, and each time the beam is enabled/activated (after being disabled/deactivated).\nIt's suitable for static beams located in static environment."; + case DynamicOcclusionUpdateRate.OnBeamMove: return "The occlusion will only be updated when the beam will move.\nIt's suitable for moving beams located in static environment."; + case DynamicOcclusionUpdateRate.EveryXFrames: return "The occlusion will be updated every {0} frame(s).\nIt's suitable for static beams located in moving environment."; + case DynamicOcclusionUpdateRate.OnBeamMoveAndEveryXFrames: return "The occlusion will be updated when the beam will move in addition to every {0} frame(s).\nIt's suitable for moving beams located in moving environment."; + default: return null; + } + } + + public static readonly GUIContent DepthBufferOcclusionCulling = new GUIContent("Occlusion Culling", "Whether or not the virtual camera will use occlusion culling during rendering from the beam's POV."); + public static readonly GUIContent DepthBufferDepthMapResolution = new GUIContent("Depth Map Resolution", "Controls how large the depth texture captured by the virtual camera is.\nThe lower the resolution, the better the performance, but the less accurate the rendering."); + + public const string HelpDepthBufferAndBeam2D = "'Dynamic Occlusion (Depth Buffer)' doesn't work with 2D sprites nor 2D colliders. It will only track 3D objects."; + + public const string HelpOverrideLayer = "To keep good performance, it's highly recommended to set an 'Override Layer' in the Config when using this feature, to prevent from having a LayerMark including any Volumetric Beam."; + public static string HelpLayerMaskIssues { get { return string.Format("The beams are generated on the layer '{0}' (set in the Config), but this LayerMask includes this layer.\nTo keep good performance, it's highly recommended to set a LayerMask which doesn't include this layer!", UnityEngine.LayerMask.LayerToName(VLB.Config.Instance.geometryLayerID)); } } + + public const string HelpFeatureDisabled = "The Dynamic Occlusion features have been disabled in the plugin's Config."; + } + + public static class TriggerZone + { + public static readonly GUIContent HeaderInfos = new GUIContent("Infos"); + + public static readonly GUIContent SetIsTrigger = new GUIContent("Set Is Trigger", "Define if the Collider will be created as a convex trigger (not physical, most common behavior) or as a regular collider (physical)."); + public static readonly GUIContent RangeMultiplier = new GUIContent("Range Multiplier", "Change the length of the Collider.\nFor example, set 2.0 to make the Collider 2x longer than the beam."); + + public const string HelpDescription2D = "Generate a 2D Polygon Collider with the same shape than the beam, supporting dynamic occlusion."; + public const string HelpDescription3D = "Generate a 3D Mesh Collider with the same shape than the beam. The collider doesn't support occlusion though."; + public const string HelpTrackChangesDuringPlaytimeEnabled = "The TriggerZone collider cannot be changed in realtime.\nIf you animate a property which change the shape of the beam, the collider shape won't fit anymore."; + } + + public static class SkewingHandle + { + public static readonly GUIContent Beam = new GUIContent("Beam", "The Volumetric Light Beam you want to modify."); + public static readonly GUIContent ShouldUpdateEachFrame = new GUIContent("Should Update Each Frame", "Should the beam's skewing property be updated each frame or only once?"); + + public const string ErrorAttachedToSelf = "You should attach the 'SkewingHandle' component to another GameObject than the beam itself."; + public const string ErrorCannotSkew = "This beam can't be skewed because it doesn't use 'Custom' mesh type."; + public const string ErrorCannotUpdate = "This beam can't be updated each frame since its property 'Track Changes During Playtime' is disabled."; + + public const string HelpFeatureDisabled = "The 'Mesh Skewing' feature has been disabled in the plugin's Config."; + } + + + public static class Shadow + { + public static readonly GUIContent HeaderUpdateRate = new GUIContent("Update Rate"); + public static readonly GUIContent HeaderVisual = new GUIContent("Visual"); + public static readonly GUIContent HeaderCamera = new GUIContent("Depth Camera"); + + public static readonly GUIContent Strength = new GUIContent("Strength", "Controls how dark the shadow cast by this Light Beam will be.\nThe bigger the value, the more the shadow will affect the visual."); + public static readonly GUIContent LayerMask = new GUIContent("Layer Mask", + "The beam can only be occluded by objects located on the layers matching this mask.\nIt's very important to set it as restrictive as possible (checking only the layers which are necessary) to perform a more efficient process in order to increase the performance."); + public static readonly GUIContent UpdateRate = new GUIContent("Update Rate", "How often will the occlusion be processed?\nTry to update the occlusion as rarely as possible to keep good performance."); + public static readonly string[] UpdateRateDescriptions = new string[] + { + "Never", + "On Enable (only once)", + "On Beam Move", + "Every X Frames", + "On Beam Move and Every X Frames", + }; + + public static readonly GUIContent WaitXFrames = new GUIContent("X frames to wait", + "How many frames we wait between 2 occlusion tests?\nIf you want your beam to be super responsive to the changes of your environment, update it every frame by setting 1.\nIf you want to save on performance, we recommend to wait few frames between each update by setting a higher value."); + + public static string GetUpdateRateAdvice(ShadowUpdateRate value) + { + switch (value) + { + case ShadowUpdateRate.Never: return string.Format("The occlusion will never be updated.\nThe only way to update it is to manually call '{0}.ProcessOcclusionManually()' from script whenever you need.", typeof(T).Name); + case ShadowUpdateRate.OnEnable: return "The occlusion will only be updated once on start, and each time the beam is enabled/activated (after being disabled/deactivated).\nIt's suitable for static beams located in static environment."; + case ShadowUpdateRate.OnBeamMove: return "The occlusion will only be updated when the beam will move.\nIt's suitable for moving beams located in static environment."; + case ShadowUpdateRate.EveryXFrames: return "The occlusion will be updated every {0} frame(s).\nIt's suitable for static beams located in moving environment."; + case ShadowUpdateRate.OnBeamMoveAndEveryXFrames: return "The occlusion will be updated when the beam will move in addition to every {0} frame(s).\nIt's suitable for moving beams located in moving environment."; + default: return null; + } + } + + public static readonly GUIContent OcclusionCulling = new GUIContent("Occlusion Culling", "Whether or not the virtual camera will use occlusion culling during rendering from the beam's POV."); + public static readonly GUIContent DepthMapResolution = new GUIContent("Depth Map Resolution", "Controls how large the depth texture captured by the virtual camera is.\nThe lower the resolution, the better the performance, but the less accurate the rendering."); + + public const string HelpOverrideLayer = "To keep good performance, it's highly recommended to set an 'Override Layer' in the Config when using this feature, to prevent from having a LayerMark including any Volumetric Beam."; + public static string HelpLayerMaskIssues { get { return string.Format("The beams are generated on the layer '{0}' (set in the Config), but this LayerMask includes this layer.\nTo keep good performance, it's highly recommended to set a LayerMask which doesn't include this layer!", UnityEngine.LayerMask.LayerToName(VLB.Config.Instance.geometryLayerID)); } } + + public const string HelpFeatureDisabled = "The Shadow feature has been disabled in the plugin's Config."; + } + + public static class Cookie + { + public static readonly GUIContent HeaderVisual = new GUIContent("Visual"); + public static readonly GUIContent HeaderTexture = new GUIContent("Texture"); + public static readonly GUIContent HeaderTransform = new GUIContent("Transform"); + + public static readonly GUIContent Contribution = new GUIContent("Contribution", "How much the cookie texture will contribute to the beam rendering."); + public static readonly GUIContent CookieTexture = new GUIContent("Cookie Texture", "Specify the texture mask asset.\nIt can be a regular 'Cookie' texture or any other texture type."); + public static readonly GUIContent Channel = new GUIContent("Texture Channel", "Which channel(s) will be used to render the cookie.\nSpecify a unique channel with a black & white texture to render a regular cookie.\nSpecify RGBA with a colored texture to simulate light passing through a stained glass."); + public static readonly GUIContent Negative = new GUIContent("Negative", "- False: white/opaque value in chosen texture channel is visible.\n- True: white/opaque value in chosen texture channel is hidden."); + + public static readonly GUIContent Translation = new GUIContent("Translation", "2D local translation applied to the cookie texture."); + public static readonly GUIContent Rotation = new GUIContent("Rotation", "Local rotation angle of the cookie texture (in degrees)."); + public static readonly GUIContent Scale = new GUIContent("Scale", "2D local scale applied to the cookie texture."); + + public const string TipCookieMipMaps = "The specified cookie texture generates mip maps.\nWe highly recommend to disable mip maps generation on it to prevent from having rendering artifacts around objects edges in front or inside volumetric light beams."; + } + + public static class Config + { + public static readonly GUIContent HeaderBeamGeometry = new GUIContent("Beam Geometry", ""); + public static readonly GUIContent HeaderRendering = new GUIContent("Rendering", ""); + public static readonly GUIContent HeaderURPSpecific = new GUIContent("URP Specific Options", ""); + public static readonly GUIContent HeaderSharedMesh = new GUIContent("Shared Mesh", ""); + public static readonly GUIContent HeaderGlobal3DNoise = new GUIContent("Global 3D Noise", ""); + public static readonly GUIContent HeaderFadeOutCamera = new GUIContent("Camera to compute Fade Out", ""); + public static readonly GUIContent HeaderFeaturesEnabled = new GUIContent("Features Enabled", "Disable the features you don't use in your project to speed up export time, specially with URP and HDRP."); + public static readonly GUIContent HeaderInternalData = new GUIContent("Internal Data (do not change)", ""); + + public static readonly GUIContent GeometryOverrideLayer = new GUIContent("Override Layer", "- If enabled, we force the procedural beam geometry GameObjects to be created on the Layer specified here.\n- If disabled, the procedural beam geometry GameObjects inherit the Layer of their beam (the GameObject containing the 'VolumetricLightBeam' component)."); + public static readonly GUIContent GeometryTag = new GUIContent("Tag", "The tag applied on the procedural geometry GameObjects"); + public static readonly GUIContent GeometryRenderQueueSD = new GUIContent("Render Queue (SD beams)", "Determine in which order SD beams are rendered compared to other objects.\nThis way for example transparent objects are rendered after opaque objects, and so on."); + public static readonly GUIContent GeometryRenderQueueHD = new GUIContent("Render Queue (HD beams)", "Determine in which order HD beams are rendered compared to other objects.\nThis way for example transparent objects are rendered after opaque objects, and so on."); + public static readonly GUIContent GeometryRenderPipeline = new GUIContent("Render Pipeline", "Select the Render Pipeline (Built-In or SRP) in use."); + public static readonly GUIContent GeometryRenderingMode = new GUIContent("Rendering Mode", +@"- Multi-Pass: Use the 2 pass shader for SD beams (will generate 2 drawcalls per beam) and the 1 pass shader for HD beams (will generate 1 drawcall per beam). Not compatible with Scriptable Render Pipelines such as HDRP and URP. +- Default: Use the 1 pass shader. Will generate 1 drawcall per beam. +- GPU Instancing: Dynamically batch multiple beams to combine and reduce draw calls. +- SRP Batcher: Use the SRP Batcher to automatically batch multiple beams and reduce draw calls. Only available when using SRP."); + + public static string GetErrorSrpAndMultiPassNotCompatible(ShaderMode shaderMode) { return string.Format("Using a Scriptable Render Pipeline with 'Multi-Pass' Rendering Mode is not supported: please choose another Rendering Mode, or '{0}' will be used.", VLB.Config.Instance.GetActualRenderingMode(shaderMode)); } + public static string GetErrorSrpBatcherOnlyCompatibleWithSrp(ShaderMode shaderMode) { return string.Format("The 'SRP Batcher' Rendering Mode is only compatible when using a SRP: please choose another Rendering Mode, or '{0}' will be used.", VLB.Config.Instance.GetActualRenderingMode(shaderMode)); } + public const string ErrorRenderPipelineMismatch = "It looks like the 'Render Pipeline' is not correctly set.\nPlease make sure to select the proper value depending on your pipeline in use."; + + public static readonly GUIContent URPDepthCameraScriptableRendererIndex = new GUIContent("Custom renderer index for Depth Camera", "When using URP, specify a custom Renderer index used by the depth cameras for the 'Dynamic Occlusion (Depth Buffer)' and 'HD Shadow' features.\nThe 'Renderer list' is editable in the URP asset.\n\nWe recommend to specify a custom index referencing the URP default 'ForwardRenderer' when you are using a custom renderer that doesn't support writing to depth render texture. This is the case if you encounter errors like 'RenderTexture.Create failed: colorFormat & depthStencilFormat cannot both be none'.\n\nSet -1 to disable this feature."); + + public static readonly GUIContent FadeOutCameraTag = new GUIContent("Fade Out Camera Tag", "Tag used to retrieve the camera used to compute the fade out factor on beams"); + + public static readonly GUIContent SharedMeshSides = new GUIContent("Cone Mesh Sides", "Number of Sides of the cone.\nHigher values make the beam looks more 'round', but require more memory and graphic performance.\nA recommended value for a decent quality while keeping the poly count low is 18."); + public static readonly GUIContent SharedMeshSegments = new GUIContent("Cone Mesh Segments", "Number of Segments of the cone.\nHigher values give better looking results but require more performance. We recommend at least 3 segments, specially regarding Attenuation and Gradient, otherwise the approximation could become inaccurate.\nThe longer the beam, the more segments we recommend to set.\nA recommended value is 4."); + public static readonly GUIContent GlobalNoiseScale = new GUIContent("Scale", "Global 3D Noise texture scaling: higher scale make the noise more visible, but potentially less realistic"); + public static readonly GUIContent GlobalNoiseVelocity = new GUIContent("Velocity", "Global World Space direction and speed of the noise scrolling, simulating the fog/smoke movement"); + public static readonly GUIContent NoiseTexture3D = new GUIContent("3D Noise Texture", "3D Texture storing noise data."); + public static readonly GUIContent DustParticlesPrefab = new GUIContent("Dust Particles Prefab", "ParticleSystem prefab instantiated for the Volumetric Dust Particles feature (Unity 5.5 or above)"); + public static readonly GUIContent DitheringFactor = new GUIContent("Screen Space Dithering", "Depending on the quality of your screen, you might see some artifacts with high contrast visual (like a white beam over a black background).\nThese is a very common problem known as color banding.\nTo help with this issue, the plugin offers a Dithering factor: it smooths the banding by introducing a subtle pattern of noise."); + public static readonly GUIContent DitheringNoiseTexture = new GUIContent("Dithering Noise Texture", "Noise texture for dithering feature."); + public static readonly GUIContent UseLightColorTemperature = new GUIContent("Use Light Color Temperature", "Contribution of the attached spotlight temperature to the final beam color.\nOnly useful when:\n- The beams is attached to a Unity spotlight.\n- The beams color is linked to the Unity Light color.\n- The Unity light uses 'color temperature mode' and is specified with 'Filter' and 'Temperature' properties."); + public static readonly GUIContent OpenDocumentation = new GUIContent("Documentation", "Open the online documentation."); + public static readonly GUIContent CopyDebugInfo = new GUIContent("Copy debug info", "Copy to the clipboard system information useful for debugging. Please send use this data when you encounter a problem."); + public static readonly GUIContent ClearAssetStoreCache = new GUIContent("Clear Asset Store cache", "Delete the AssetStore download cache to force Unity to re-download the proper package.\nCan solve issues when changing Unity version or updating the asset."); + public static readonly GUIContent ResetToDefaultButton = new GUIContent("Default values", "Reset properties to their default values."); + public static readonly GUIContent ResetInternalDataButton = new GUIContent("Reset internal data", "Reset internal data to their default values."); + + public static readonly GUIContent FeatureEnabledColorGradient = new GUIContent("Color Gradient", "- Off: do not support having a gradient as color.\n- High Only: support gradient color only for devices with Shader Level = 35 or higher.\n- High and Low: support gradient color for all devices"); + public static readonly GUIContent FeatureEnabledNoise3D = new GUIContent("Noise 3D", "Support 'Noise 3D' feature or not."); + + public static readonly string[] GeometryRenderPipelineEnumDescriptions = new string[] + { + "Built-In", + "URP", + "HDRP", + }; + + public static string GetErrorInvalidShader() { return string.Format("Fail to generate shader asset. Please try to reset the Config asset or reinstall the plugin."); } + + public static readonly string InvalidPlatformOverride = string.Format( + "This Config asset has an invalid name. It should be named either:\n- '{0}{1}' for the default config.\n- '{0}PlatformName{1}' for a config specific to a platform, e.g. '{0}Android{1}'." + , VLB.Config.kAssetName + , VLB.Config.kAssetNameExt + ); + + public static readonly string WrongAssetLocation = string.Format( + "This Config asset is not the one in use, please make sure: it's directly located under a 'Resources' folder." + ); + + public static readonly string NotCurrentAssetInUse = string.Format( + "This Config asset is not the one in use for current Target Platform '{0}'." + , PlatformHelper.GetCurrentPlatformSuffix() + ); + public static class SD + { + public static readonly GUIContent FeatureEnabledDepthBlend = new GUIContent("Soft Intersect w/ Opaque Geometry (SD only)", "Support having soft intersection when the beam intersects other opaque geometry or not."); + public static readonly GUIContent FeatureEnabledDynamicOcclusion = new GUIContent("Dynamic Occlusion (SD only)", "Support 'Dynamic Occlusion' features or not."); + public static readonly GUIContent FeatureEnabledMeshSkewing = new GUIContent("Mesh Skewing (SD only)", "Support 'Mesh Skewing' feature or not."); + public static readonly GUIContent FeatureEnabledShaderAccuracyHigh = new GUIContent("High Shader Accuracy (SD only)", "Support 'Shader Accuracy' property set to 'High' or not."); + } + + public static class HD + { + public static readonly GUIContent HDSpecific = new GUIContent("HD Specific Options", ""); + + public static readonly GUIContent CameraBlendingDistance = new GUIContent("Camera Blending Distance", "Distance from the camera the beam will fade with (HD only. For SD beams, this option can be configured per beam).\n- 0.0: hard intersection\n- Higher values produce soft intersection when the camera is near the cone triangles."); + public static readonly GUIContent JitteringNoiseTexture = new GUIContent("Jittering Noise Texture (HD only)", ""); + + public static readonly GUIContent TitleRaymarchingQuality = new GUIContent("Raymarching Qualities (Name / Steps Count)", "Specify each different raymarching quality with:\n- an understandable name (to be chosen per HD beam)\n- a number specifying how many raymarching steps will be computed per pixel (the higher, the better quality, the slower the performance)\n\nA new HD beam shader variant will be generated per raymarching quality for the HD beam shader: the more different qualities you'll have, the slower it will get to compile all shader variants and to export standalone builds."); + public static readonly GUIContent DefaultRaymarchingQuality = new GUIContent("Default Raymarching Quality", "Raymarching Quality applied by default to newly created HD Volumetric Light Beams"); + + public static readonly GUIContent FeatureEnabledShadow = new GUIContent("Shadow (HD only)", "Support 'Volumetric Shadow' feature or not."); + public static readonly GUIContent FeatureEnabledCookie = new GUIContent("Cookie (HD only)", "Support 'Volumetric Cookie' featur or not."); + } + } + + public static class Effects + { + public static readonly GUIContent HeaderTimings = new GUIContent("Timings", ""); + public static readonly GUIContent HeaderPause = new GUIContent("Pause", ""); + public static readonly GUIContent HeaderVisual = new GUIContent("Visual", ""); + public static readonly GUIContent HeaderMisc = new GUIContent("Misc", ""); + + public static readonly GUIContent PerformPauses = new GUIContent("Perform Pauses", "If enabled, pauses will be added between 2 flickering sequences."); + public static readonly GUIContent FlickeringDuration = new GUIContent("Flickering Duration", "The duration of a flickering sequence.\nA random value will be picked each time inside this range."); + public static readonly GUIContent PauseDuration = new GUIContent("Pause Duration", "The duration of a pause sequence.\nA random value will be picked each time inside this range."); + public static readonly GUIContent RestoreIntensityOnPause = new GUIContent("Restore Intensity On Pause", "Restore the default intensity during the pause sequences."); + public static readonly GUIContent FrequencyFlicker = new GUIContent("Frequency", "Frequency of flickering.\nHigher value means the flickering will occur faster."); + public static readonly GUIContent FrequencyPulse = new GUIContent("Frequency", "Frequency of pulsing.\nHigher value means the pulsing will occur faster."); + public static readonly GUIContent IntensityAmplitude = new GUIContent("Intensity Amplitude", "The amplitude of intensity change which will be applied to the Light and/or Beam.\nA random value will be picked each time inside that range."); + public static readonly GUIContent Smoothing = new GUIContent("Smoothing", "How much intensity change will be smoothed.\nHigher value means the more smoothing."); + public static readonly GUIContent RestoreIntensityOnDisable = new GUIContent("Restore Intensity On Disable", "Restore the default intensity when this component is disabled."); + public static readonly GUIContent ComponentsToChange = new GUIContent("Components To Change", "Decide which component to change among:\n- Unity's Light\n- Volumetric Light Beam\n- Volumetric Dust Particles"); + public static readonly GUIContent ChangeVolumetricBeamIntensity = new GUIContent("Change Volumetric Beam Intensity", "Apply the flicker on the Volumetric Beam Intensity."); + + public static readonly GUIContent EffectProfile = new GUIContent("Effect Profile", "The Effect Profile asset to use"); + public static readonly GUIContent ButtonNewProfileFlicker = new GUIContent("New Flicker profile", "Create a new flicker profile asset"); + public static readonly GUIContent ButtonNewProfilePulse = new GUIContent("New Pulse profile", "Create a new pulse profile asset"); + + + public const string HelpNoValidComponents = "This component must be applied with a 'Unity Light' and/or a 'Volumetric Light Beam SD/HD'."; + public const string HelpLightNotChangeable = "To apply this effect on the Unity Light's intensity, it must use 'Realtime' or 'Mixed' mode."; + public const string HelpBeamNotChangeable = "To apply this effect on the Volumetric Light Beam's intensity, it must have its 'Track Changes During Playtime' property enabled."; + + public const string HelpEffectProfile = "Specify an Effect Profile asset to be applied on this 'Unity Light' and/or a 'Volumetric Light Beam SD/HD' at runtime.\nEffect Profile assets use Unity prefabs workflow to offer hierarchy and override systems to your assets."; + + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/EditorStrings.cs.meta b/Assets/External/VolumetricLightBeam/Editor/EditorStrings.cs.meta new file mode 100644 index 00000000..ac768ca2 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/EditorStrings.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 962298216d0e67f4c9294aa63ae5e9a4 +timeCreated: 1525089533 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_Common.cs b/Assets/External/VolumetricLightBeam/Editor/Editor_Common.cs new file mode 100644 index 00000000..4c58b765 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_Common.cs @@ -0,0 +1,129 @@ +#if UNITY_EDITOR +#if UNITY_2019_1_OR_NEWER +#define UI_USE_FOLDOUT_HEADER_2019 +#endif + +using UnityEditor; +using UnityEditor.IMGUI.Controls; +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System; +using System.Linq.Expressions; +using System.Reflection; + +namespace VLB +{ + public abstract class Editor_Common : Editor + { + protected virtual void OnEnable() + { + FoldableHeader.OnEnable(); + } + + public override void OnInspectorGUI() + { + serializedObject.Update(); + #if UNITY_2019_3_OR_NEWER + // no vertical space in 2019.3 looks better + #else + EditorGUILayout.Separator(); + #endif + } + + protected static void ButtonOpenConfig(bool miniButton = true) + { + bool buttonClicked = false; + if (miniButton) buttonClicked = GUILayout.Button(EditorStrings.Common.ButtonOpenGlobalConfig, EditorStyles.miniButton); + else buttonClicked = GUILayout.Button(EditorStrings.Common.ButtonOpenGlobalConfig); + + if (buttonClicked) + Config.EditorSelectInstance(); + } + + + // SERIALIZED PROPERTY RETRIEVAL + string GetThisNamespaceAsString() { return GetType().Namespace; } + + SerializedProperty FindProperty(string prefix, string name) + { + Debug.Assert(serializedObject != null); + var prop = serializedObject.FindProperty(name); // try first with the plain name + if (prop == null) + { + name = string.Format("{0}{1}{2}", prefix, char.ToUpperInvariant(name[0]), name.Substring(1)); // try with a different name to catch private props: get '_Name' from 'name' + prop = serializedObject.FindProperty(name); + } + return prop; + } + + void RetrieveSerializedProperties(string prefix, Type t) + { + if (t == null) return; + if (t.Namespace != GetThisNamespaceAsString()) return; + + var allEditorFields = t.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly); + foreach (var field in allEditorFields) + { + if (field.FieldType == typeof(SerializedProperty)) + { + var runtimeFieldName = field.Name; + var serializedProp = FindProperty(prefix, runtimeFieldName); + Debug.AssertFormat(serializedProp != null, "Fail to find serialized field '{0}' in object {1}", runtimeFieldName, serializedObject.targetObject); + field.SetValue(this, serializedProp); + } + } + + RetrieveSerializedProperties(prefix, t.BaseType); + } + + protected void RetrieveSerializedProperties(string prefix) + { + RetrieveSerializedProperties(prefix, GetType()); + } + + protected static void DrawMultiplierProperty(SerializedProperty property, string tooltip) + { + using (new EditorExtensions.LabelWidth(13f)) + { + EditorGUI.BeginChangeCheck(); + EditorGUILayout.PropertyField(property, new GUIContent("x", tooltip), GUILayout.MinWidth(35.0f), GUILayout.MaxWidth(55.0f)); + if(EditorGUI.EndChangeCheck()) + { + property.floatValue = Mathf.Max(property.floatValue, Consts.Beam.MultiplierMin); + } + } + } + + protected struct InfoTip + { + public MessageType type; + public string message; + } + + protected virtual void GetInfoTips(List tips) {} + + protected bool DrawInfos() + { + var tips = new List(); + GetInfoTips(tips); + + if (tips != null && tips.Count > 0) + { + if (FoldableHeader.Begin(this, EditorStrings.Beam.HeaderInfos)) + { + if (tips != null) + { + foreach (var tip in tips) + EditorGUILayout.HelpBox(tip.message, tip.type); + } + } + FoldableHeader.End(); + return true; + } + return false; + } + } +} +#endif // UNITY_EDITOR + diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_Common.cs.meta b/Assets/External/VolumetricLightBeam/Editor/Editor_Common.cs.meta new file mode 100644 index 00000000..9f0688d3 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_Common.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 11a6b248e0eebc44bb9ba203d8a8d77a +timeCreated: 1508779655 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_Config.cs b/Assets/External/VolumetricLightBeam/Editor/Editor_Config.cs new file mode 100644 index 00000000..69763123 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_Config.cs @@ -0,0 +1,616 @@ +#if UNITY_EDITOR + +#if UNITY_2019_3_OR_NEWER +#define VLB_LIGHT_TEMPERATURE_SUPPORT +#endif + +using UnityEngine; +using UnityEditor; +using UnityEditorInternal; + +namespace VLB +{ + [CustomEditor(typeof(Config))] + public class Editor_Config : Editor_Common + { + SerializedProperty geometryOverrideLayer = null, geometryLayerID = null, geometryTag = null, geometryRenderQueue = null, geometryRenderQueueHD = null, renderPipeline = null, renderingMode = null; + SerializedProperty sharedMeshSides = null, sharedMeshSegments = null; + SerializedProperty hdBeamsCameraBlendingDistance = null; + SerializedProperty urpDepthCameraScriptableRendererIndex = null; + SerializedProperty globalNoiseScale = null, globalNoiseVelocity = null; + SerializedProperty fadeOutCameraTag = null; + SerializedProperty noiseTexture3D = null; + SerializedProperty dustParticlesPrefab = null; + SerializedProperty ditheringFactor = null, ditheringNoiseTexture = null, jitteringNoiseTexture = null; + SerializedProperty raymarchingQualities = null, defaultRaymarchingQualityUniqueID = null; + SerializedProperty featureEnabledColorGradient = null, featureEnabledDepthBlend = null, featureEnabledNoise3D = null, featureEnabledDynamicOcclusion = null, featureEnabledMeshSkewing = null, featureEnabledShaderAccuracyHigh = null; + SerializedProperty featureEnabledShadow = null, featureEnabledCookie = null; +#if VLB_LIGHT_TEMPERATURE_SUPPORT + SerializedProperty useLightColorTemperature = null; +#endif + + Config m_TargetConfig = null; + RenderQueueDrawer m_DrawerRenderQueue; + RenderQueueDrawer m_DrawerRenderQueueHD; + + protected override void OnEnable() + { + base.OnEnable(); + RetrieveSerializedProperties("m_"); + + m_DrawerRenderQueue = new RenderQueueDrawer(geometryRenderQueue); + m_DrawerRenderQueueHD = new RenderQueueDrawer(geometryRenderQueueHD); + + Noise3D.LoadIfNeeded(); // Try to load Noise3D, maybe for the 1st time + + m_TargetConfig = this.target as Config; + + RaymarchingQualitiesInit(); + } + + void RenderingModeGUIDraw(SerializedProperty sprop, GUIContent label) + { + EditorGUILayout.PropertyField(sprop, label); + + if (renderPipeline.enumValueIndex == (int)RenderPipeline.BuiltIn) + { + if (sprop.enumValueIndex == (int)RenderingMode.SRPBatcher) + EditorGUILayout.HelpBox(EditorStrings.Config.GetErrorSrpBatcherOnlyCompatibleWithSrp(ShaderMode.SD), MessageType.Error); + } + else + { + if (sprop.enumValueIndex == (int)RenderingMode.MultiPass) + EditorGUILayout.HelpBox(EditorStrings.Config.GetErrorSrpAndMultiPassNotCompatible(ShaderMode.SD), MessageType.Error); + } + } + + protected override void OnHeaderGUI() + { + GUILayout.BeginVertical("In BigTitle"); + EditorGUILayout.Separator(); + + var title = string.Format("Volumetric Light Beam - Plugin Configuration"); + EditorGUILayout.LabelField(title, EditorStyles.boldLabel); + EditorGUILayout.LabelField(string.Format("Current Version: {0}", Version.CurrentAsString), EditorStyles.miniBoldLabel); + EditorGUILayout.Separator(); + GUILayout.EndVertical(); + } + + void OnAddConfigPerPlatform(object platform) + { + var p = (RuntimePlatform)platform; + var clone = UnityEngine.Object.Instantiate(m_TargetConfig); + Debug.Assert(clone); + var path = AssetDatabase.GetAssetPath(m_TargetConfig).Replace(m_TargetConfig.name + Config.kAssetNameExt, ""); + Config.CreateAsset(clone, path + Config.kAssetName + p.ToString() + Config.kAssetNameExt); + Selection.activeObject = clone; + } + + [System.Flags] + enum DirtyFlags + { + Target = 1 << 1, + Shader = 1 << 2, + Noise = 1 << 3, + GlobalMesh = 1 << 4, + AllBeamGeom = 1 << 5, + AllMeshes = 1 << 6 + } + + void SetDirty(DirtyFlags flags) + { + if (m_IsUsedInstance) + { + if (flags.HasFlag(DirtyFlags.Target)) EditorUtility.SetDirty(target); + if (flags.HasFlag(DirtyFlags.Shader)) m_NeedToRefreshShader = true; + if (flags.HasFlag(DirtyFlags.Noise)) m_NeedToReloadNoise = true; + if (flags.HasFlag(DirtyFlags.GlobalMesh)) GlobalMeshSD.Destroy(); + if (flags.HasFlag(DirtyFlags.AllBeamGeom)) Utils._EditorSetAllBeamGeomDirty(); + if (flags.HasFlag(DirtyFlags.AllMeshes)) Utils._EditorSetAllMeshesDirty(); + } + } + + bool m_NeedToReloadNoise = false; + bool m_NeedToRefreshShader = false; + bool m_IsUsedInstance = false; + + + #region Raymarching Qualities + ReorderableList m_ListQualities; + + void RaymarchingQualitiesInit() + { + m_ListQualities = new ReorderableList(serializedObject + , raymarchingQualities + , true // draggable + , true // displayHeader + , true // displayAddButton + , true // displayRemoveButton + ); + m_ListQualities.drawHeaderCallback = RaymarchingQualitiesDrawHeader; + m_ListQualities.drawElementCallback = RaymarchingQualitiesDrawElement; + m_ListQualities.onAddCallback = RaymarchingQualitiesOnAdd; + m_ListQualities.onRemoveCallback = RaymarchingQualitiesOnRemove; + m_ListQualities.onChangedCallback = RaymarchingQualitiesOnChanged; + m_ListQualities.onCanRemoveCallback = RaymarchingQualitiesOnCanRemove; + } + + void RaymarchingQualitiesDrawHeader(Rect rect) + { + EditorGUI.LabelField(rect, EditorStrings.Config.HD.TitleRaymarchingQuality); + } + + void RaymarchingQualitiesDrawElement(Rect rect, int i, bool isActive, bool isFocused) + { + const float kBorder = 1.0f; + rect.yMin += kBorder; + rect.yMax -= kBorder * 2; + + const float kPropSeparator = 5.0f; + const float kWidthSteps = 50.0f; + + Rect rectName = rect; + rectName.width -= kWidthSteps + kPropSeparator; + + Rect rectSteps = rect; + rectSteps.x = rect.xMax - kWidthSteps; + rectSteps.width = kWidthSteps; + + var qual = m_TargetConfig.GetRaymarchingQualityForIndex(i); + { + EditorGUI.BeginChangeCheck(); + qual.name = EditorGUI.TextField(rectName, qual.name); + if (EditorGUI.EndChangeCheck()) + SetDirty(DirtyFlags.Target); + + EditorGUI.BeginChangeCheck(); + qual.stepCount = Mathf.Max(EditorGUI.IntField(rectSteps, qual.stepCount), Consts.Config.HD.RaymarchingQualitiesStepsMin); + if (EditorGUI.EndChangeCheck()) + SetDirty(DirtyFlags.Target | DirtyFlags.Shader); + } + } + + void RaymarchingQualitiesOnAdd(ReorderableList list) + { + var newQual = RaymarchingQuality.New(); + m_TargetConfig.AddRaymarchingQuality(newQual); + SetDirty(DirtyFlags.Target); + } + + void RaymarchingQualitiesOnRemove(ReorderableList list) + { + if (list.count < 1) + { + Debug.LogError("Having at least 1 RaymarchingQuality value is mandatory: cannot delete."); + return; + } + + var qual = m_TargetConfig.GetRaymarchingQualityForIndex(list.index); + if (qual != null) + { + if (qual.uniqueID == m_TargetConfig.defaultRaymarchingQualityUniqueID) + { + EditorUtility.DisplayDialog(string.Format("Can't remove Raymarching Quality '{0}'", qual.name) + , string.Format("We cannot remove Raymarching Quality '{0}' with {1} steps because it's the default quality", qual.name, qual.stepCount) + , "Ok"); + return; + } + + if (EditorUtility.DisplayDialog(string.Format("Remove Raymarching Quality '{0}'?", qual.name) + , string.Format("Do you really want to remove the Raymarching Quality '{0}' with {1} steps?\nAll Volumetric Light Beams using this quality will now use the default quality.", qual.name, qual.stepCount) + , "Ok" + , "Cancel")) + { + m_TargetConfig.RemoveRaymarchingQualityAtIndex(list.index); + SetDirty(DirtyFlags.Target | DirtyFlags.AllBeamGeom); // force beams in opened scenes to regenerate with default quality in case they used removed quality + } + } + } + + void RaymarchingQualitiesOnChanged(ReorderableList list) + { + SetDirty(DirtyFlags.Target | DirtyFlags.Shader); + } + + bool RaymarchingQualitiesOnCanRemove(ReorderableList list) + { + var qual = m_TargetConfig.GetRaymarchingQualityForIndex(list.index); + if (qual != null && qual.uniqueID == m_TargetConfig.defaultRaymarchingQualityUniqueID) + return false; // cannot remove default quality + + return list.count > 1; + } + + void RaymarchingQualitiesDraw() + { + Debug.Assert(m_ListQualities != null); + m_ListQualities.DoLayoutList(); + + DrawRaymarchingQualitiesPopup(Config.Instance, defaultRaymarchingQualityUniqueID, EditorStrings.Config.HD.DefaultRaymarchingQuality); + +#if VLB_DEBUG + for (int i = 0; i < m_TargetConfig.raymarchingQualitiesCount; ++i) + { + var qual = m_TargetConfig.GetRaymarchingQualityForIndex(i); + if (qual != null) + { + EditorGUILayout.LabelField(string.Format("#DEBUG# [{0}] {1} - {2} - {3}" + , i + , qual.uniqueID + , qual.name + , qual.stepCount + )); + } + } +#endif // VLB_DEBUG + } + + public static void DrawRaymarchingQualitiesPopup(Config instance, SerializedProperty prop, GUIContent content) + { + Debug.Assert(instance != null); + + int selectedIndex = -1; + var descriptions = new GUIContent[instance.raymarchingQualitiesCount]; + + for (int i = 0; i < instance.raymarchingQualitiesCount; ++i) + { + var qual = instance.GetRaymarchingQualityForIndex(i); + descriptions[i] = new GUIContent(string.Format("{0} ({1})", qual.name, qual.stepCount)); + + if (qual.uniqueID == prop.intValue) + selectedIndex = i; + } + + if (selectedIndex < 0) + { // in case we couldn't find the serialized ID, fallback to 0 + selectedIndex = 0; + + var fallback = instance.GetRaymarchingQualityForIndex(selectedIndex); + Debug.LogErrorFormat("Failed to find default raymarching quality index in popup that fit with quality unique ID {0}.", prop.intValue); + } + + EditorGUI.BeginChangeCheck(); + { + EditorGUI.showMixedValue = prop.hasMultipleDifferentValues; + { + selectedIndex = EditorGUILayout.Popup(content, selectedIndex, descriptions); + } + EditorGUI.showMixedValue = false; + } + if (EditorGUI.EndChangeCheck()) + { + var newQual = instance.GetRaymarchingQualityForIndex(selectedIndex); + prop.intValue = newQual.uniqueID; + } + +#if VLB_DEBUG + { + var qual = instance.GetRaymarchingQualityForIndex(selectedIndex); + EditorGUILayout.LabelField(string.Format("#DEBUG# Serialized Unique ID: {0} | Found Unique ID: {1} / Steps: {2}", prop.intValue, qual.uniqueID, qual.stepCount)); + } +#endif // VLB_DEBUG + } + #endregion + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + Debug.Assert(m_TargetConfig != null); + + m_NeedToReloadNoise = false; + m_NeedToRefreshShader = false; + m_IsUsedInstance = m_TargetConfig.IsCurrentlyUsedInstance(); + + // Config per plaftorm +#if UNITY_2018_1_OR_NEWER + { + bool hasValidName = m_TargetConfig.HasValidAssetName(); + bool isCurrentPlatformSuffix = m_TargetConfig.GetAssetSuffix() == PlatformHelper.GetCurrentPlatformSuffix(); + + var platformSuffix = m_TargetConfig.GetAssetSuffix(); + string platformStr = "Default Config asset"; + if(!string.IsNullOrEmpty(platformSuffix)) + platformStr = string.Format("Config asset for platform '{0}'", m_TargetConfig.GetAssetSuffix()); + if (!hasValidName) + platformStr += " (INVALID)"; + EditorGUILayout.LabelField(platformStr, EditorStyles.boldLabel); + + if (GUILayout.Button(EditorStrings.Beam.ButtonCreateOverridePerPlatform, EditorStyles.miniButton)) + { + var menu = new GenericMenu(); + foreach (var platform in System.Enum.GetValues(typeof(RuntimePlatform))) + menu.AddItem(new GUIContent(platform.ToString()), false, OnAddConfigPerPlatform, platform); + menu.ShowAsContext(); + } + + if (!hasValidName) + { + EditorGUILayout.Separator(); + EditorGUILayout.HelpBox(EditorStrings.Config.InvalidPlatformOverride, MessageType.Error); + ButtonOpenConfig(); + } + else if (!m_IsUsedInstance) + { + EditorGUILayout.Separator(); + + if (isCurrentPlatformSuffix) + EditorGUILayout.HelpBox(EditorStrings.Config.WrongAssetLocation, MessageType.Error); + else + EditorGUILayout.HelpBox(EditorStrings.Config.NotCurrentAssetInUse, MessageType.Warning); + + ButtonOpenConfig(); + } + + EditorExtensions.DrawLineSeparator(); + } +#endif + + { + EditorGUI.BeginChangeCheck(); + { + if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderBeamGeometry)) + { + using (new EditorGUILayout.HorizontalScope()) + { + geometryOverrideLayer.boolValue = EditorGUILayout.Toggle(EditorStrings.Config.GeometryOverrideLayer, geometryOverrideLayer.boolValue); + using (new EditorGUI.DisabledGroupScope(!geometryOverrideLayer.boolValue)) + { + geometryLayerID.intValue = EditorGUILayout.LayerField(geometryLayerID.intValue); + } + } + + geometryTag.stringValue = EditorGUILayout.TagField(EditorStrings.Config.GeometryTag, geometryTag.stringValue); + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderRendering)) + { + m_DrawerRenderQueue.Draw(EditorStrings.Config.GeometryRenderQueueSD); + m_DrawerRenderQueueHD.Draw(EditorStrings.Config.GeometryRenderQueueHD); + + if (BeamGeometrySD.isCustomRenderPipelineSupported) + { + EditorGUI.BeginChangeCheck(); + { + renderPipeline.CustomEnum(EditorStrings.Config.GeometryRenderPipeline, EditorStrings.Config.GeometryRenderPipelineEnumDescriptions); + } + if (EditorGUI.EndChangeCheck()) + { + SetDirty(DirtyFlags.AllBeamGeom | DirtyFlags.Shader); // need to fully reset the BeamGeom to update the shader + SRPHelper.SetScriptingDefineSymbolsForRenderPipeline((RenderPipeline)renderPipeline.enumValueIndex); + } + } + + if (m_TargetConfig.hasRenderPipelineMismatch) + EditorGUILayout.HelpBox(EditorStrings.Config.ErrorRenderPipelineMismatch, MessageType.Error); + +#if VLB_DEBUG + EditorGUILayout.LabelField("#DEBUG# RP Scripting Define Symbol: " + SRPHelper.renderPipelineScriptingDefineSymbolAsString); +#endif + + EditorGUI.BeginChangeCheck(); + { + RenderingModeGUIDraw(renderingMode, EditorStrings.Config.GeometryRenderingMode); + } + if (EditorGUI.EndChangeCheck()) + { + SetDirty(DirtyFlags.AllBeamGeom | DirtyFlags.GlobalMesh | DirtyFlags.Shader); // need to fully reset the BeamGeom to update the shader + } + + if (m_TargetConfig.GetBeamShader(ShaderMode.SD) == null) + EditorGUILayout.HelpBox(EditorStrings.Config.GetErrorInvalidShader(), MessageType.Error); + + if (m_TargetConfig.GetBeamShader(ShaderMode.HD) == null) + EditorGUILayout.HelpBox(EditorStrings.Config.GetErrorInvalidShader(), MessageType.Error); + + if (ditheringFactor.FloatSlider(EditorStrings.Config.DitheringFactor, 0.0f, 1.0f)) + { + SetDirty(DirtyFlags.Shader); + } + +#if VLB_LIGHT_TEMPERATURE_SUPPORT + EditorGUILayout.PropertyField(useLightColorTemperature, EditorStrings.Config.UseLightColorTemperature); +#endif + } + FoldableHeader.End(); + } + if (EditorGUI.EndChangeCheck()) + { + Utils._EditorSetAllMeshesDirty(); + } + + if (m_TargetConfig.renderPipeline == RenderPipeline.URP) + { + if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderURPSpecific)) + { + EditorGUILayout.PropertyField(urpDepthCameraScriptableRendererIndex, EditorStrings.Config.URPDepthCameraScriptableRendererIndex); + + } + FoldableHeader.End(); + } + + if (FoldableHeader.Begin(this, EditorStrings.Config.HD.HDSpecific)) + { + RaymarchingQualitiesDraw(); + + EditorGUI.BeginChangeCheck(); + EditorGUILayout.PropertyField(hdBeamsCameraBlendingDistance, EditorStrings.Config.HD.CameraBlendingDistance); + if (EditorGUI.EndChangeCheck()) { SetDirty(DirtyFlags.Shader); } + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderSharedMesh)) + { + EditorGUI.BeginChangeCheck(); + EditorGUILayout.PropertyField(sharedMeshSides, EditorStrings.Config.SharedMeshSides); + EditorGUILayout.PropertyField(sharedMeshSegments, EditorStrings.Config.SharedMeshSegments); + if (EditorGUI.EndChangeCheck()) + { + SetDirty(DirtyFlags.GlobalMesh | DirtyFlags.AllMeshes); + } + + var meshInfo = "These properties will change the mesh tessellation of each Volumetric Light Beam with 'Shared' MeshType.\nAdjust them carefully since they could impact performance."; + meshInfo += string.Format("\nShared Mesh stats: {0} vertices, {1} triangles", MeshGenerator.GetSharedMeshVertexCount(), MeshGenerator.GetSharedMeshIndicesCount() / 3); + EditorGUILayout.HelpBox(meshInfo, MessageType.Info); + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderGlobal3DNoise)) + { + EditorGUILayout.PropertyField(globalNoiseScale, EditorStrings.Config.GlobalNoiseScale); + EditorGUILayout.PropertyField(globalNoiseVelocity, EditorStrings.Config.GlobalNoiseVelocity); + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderFadeOutCamera)) + { + EditorGUI.BeginChangeCheck(); + fadeOutCameraTag.stringValue = EditorGUILayout.TagField(EditorStrings.Config.FadeOutCameraTag, fadeOutCameraTag.stringValue); + if (EditorGUI.EndChangeCheck() && Application.isPlaying) + m_TargetConfig.ForceUpdateFadeOutCamera(); + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderFeaturesEnabled)) + { + EditorGUI.BeginChangeCheck(); + { + EditorGUILayout.PropertyField(featureEnabledColorGradient, EditorStrings.Config.FeatureEnabledColorGradient); + EditorGUILayout.PropertyField(featureEnabledNoise3D, EditorStrings.Config.FeatureEnabledNoise3D); + EditorGUILayout.PropertyField(featureEnabledDepthBlend, EditorStrings.Config.SD.FeatureEnabledDepthBlend); + EditorGUILayout.PropertyField(featureEnabledDynamicOcclusion, EditorStrings.Config.SD.FeatureEnabledDynamicOcclusion); + EditorGUILayout.PropertyField(featureEnabledMeshSkewing, EditorStrings.Config.SD.FeatureEnabledMeshSkewing); + EditorGUILayout.PropertyField(featureEnabledShaderAccuracyHigh, EditorStrings.Config.SD.FeatureEnabledShaderAccuracyHigh); + EditorGUILayout.PropertyField(featureEnabledShadow, EditorStrings.Config.HD.FeatureEnabledShadow); + EditorGUILayout.PropertyField(featureEnabledCookie, EditorStrings.Config.HD.FeatureEnabledCookie); + } + if (EditorGUI.EndChangeCheck()) + { + SetDirty(DirtyFlags.Shader | DirtyFlags.AllBeamGeom); + } + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Config.HeaderInternalData)) + { + EditorGUILayout.PropertyField(dustParticlesPrefab, EditorStrings.Config.DustParticlesPrefab); + + { + EditorGUI.BeginChangeCheck(); + EditorGUILayout.PropertyField(noiseTexture3D, EditorStrings.Config.NoiseTexture3D); + if (EditorGUI.EndChangeCheck()) + SetDirty(DirtyFlags.Noise); + + if (Noise3D.isSupported && !Noise3D.isProperlyLoaded) + EditorGUILayout.HelpBox(EditorStrings.Common.HelpNoiseLoadingFailed, MessageType.Error); + } + + { + EditorGUI.BeginChangeCheck(); + EditorGUILayout.PropertyField(ditheringNoiseTexture, EditorStrings.Config.DitheringNoiseTexture); + EditorGUILayout.PropertyField(jitteringNoiseTexture, EditorStrings.Config.HD.JitteringNoiseTexture); + if (EditorGUI.EndChangeCheck()) + SetDirty(DirtyFlags.Shader); + } + } + FoldableHeader.End(); + + if (GUILayout.Button(EditorStrings.Config.OpenDocumentation, EditorStyles.miniButton)) + { + UnityEditor.Help.BrowseURL(Consts.Help.UrlConfig); + } + + using (new EditorGUILayout.HorizontalScope()) + { + if (GUILayout.Button(EditorStrings.Config.CopyDebugInfo, EditorStyles.miniButton)) + { + var debugInfo = m_TargetConfig.GetDebugInfo(); + GUIUtility.systemCopyBuffer = debugInfo; + Debug.Log("Copied to clipboard:\n" + debugInfo); + } + + + if (GUILayout.Button(EditorStrings.Config.ClearAssetStoreCache, EditorStyles.miniButton)) + { + ClearAssetStoreCache(); + } + } + + using (new EditorGUILayout.HorizontalScope()) + { + if (GUILayout.Button(EditorStrings.Config.ResetToDefaultButton, EditorStyles.miniButton)) + { + UnityEditor.Undo.RecordObject(target, "Reset Config Properties"); + m_TargetConfig.Reset(); + SetDirty(DirtyFlags.Target | DirtyFlags.Noise); + } + + if (GUILayout.Button(EditorStrings.Config.ResetInternalDataButton, EditorStyles.miniButton)) + { + UnityEditor.Undo.RecordObject(target, "Reset Internal Data"); + m_TargetConfig.ResetInternalData(); + SetDirty(DirtyFlags.Target | DirtyFlags.Noise); + } + } + } + + serializedObject.ApplyModifiedProperties(); + + if (m_NeedToRefreshShader) + m_TargetConfig.RefreshShaders(Config.RefreshShaderFlags.All); // need to be done AFTER ApplyModifiedProperties + + if (m_NeedToReloadNoise) + Noise3D._EditorForceReloadData(); // Should be called AFTER ApplyModifiedProperties so the Config instance has the proper values when reloading data + } + + static string GetAssetStoreCacheFolder() + { + switch (Application.platform) + { + case RuntimePlatform.WindowsEditor: + { + const string kAppData = "AppData"; + var appDataPath = Application.persistentDataPath; + appDataPath = appDataPath.Substring(0, appDataPath.IndexOf(kAppData) + kAppData.Length); + return System.IO.Path.Combine(appDataPath, "Roaming/Unity/Asset Store-5.x/Tech Salad/"); + } + + case RuntimePlatform.OSXEditor: + return "~/Library/Unity/Asset Store-5.x/Tech Salad/"; + + case RuntimePlatform.LinuxEditor: + return "~/.local/share/unity3d/Asset Store-5.x/Tech Salad/"; + + default: + return null; + } + } + + static void ClearAssetStoreCache() + { + string path = GetAssetStoreCacheFolder(); + if (path == string.Empty) + { + EditorUtility.DisplayDialog("Clear Asset Store Cache" + , "Failed to compute Asset Store cache folder" + , "Ok"); + return; + } + + if(FileUtil.DeleteFileOrDirectory(path)) + { + EditorUtility.DisplayDialog("Clear Asset Store Cache" + , string.Format("Folder '{0}' has been cleared successfully", path) + , "Ok"); + } + else + { + EditorUtility.DisplayDialog("Clear Asset Store Cache" + , string.Format("Failed to clear folder '{0}'", path) + , "Ok"); + } + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_Config.cs.meta b/Assets/External/VolumetricLightBeam/Editor/Editor_Config.cs.meta new file mode 100644 index 00000000..d31b8f43 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_Config.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 11b7e89a4cae94542bcb6c9be7c2ee9b +timeCreated: 1508778801 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_EffectAbstractBase.cs b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectAbstractBase.cs new file mode 100644 index 00000000..3de32ff9 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectAbstractBase.cs @@ -0,0 +1,68 @@ +#if UNITY_EDITOR +using UnityEditor; + +namespace VLB +{ + public abstract class Editor_EffectAbstractBase : Editor_CommonSD where T : EffectAbstractBase + { + SerializedProperty componentsToChange = null; + SerializedProperty restoreIntensityOnDisable = null; + + protected TargetList m_Targets; + + protected override void OnEnable() + { + base.OnEnable(); + m_Targets = new TargetList(targets); + } + + protected abstract void DisplayChildProperties(); + + public sealed override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + if (m_Targets.HasAtLeastOneTargetWith((T comp) => + { + if (comp.componentsToChange.HasFlag(EffectAbstractBase.ComponentsToChange.UnityLight)) + { + var light = comp.GetComponent(); +#if UNITY_5_6_OR_NEWER + return (light && light.lightmapBakeType == UnityEngine.LightmapBakeType.Baked); +#else + return (light && light.lightmappingMode == UnityEngine.LightmappingMode.Baked); +#endif + } + return false; + })) + { + EditorGUILayout.HelpBox(EditorStrings.Effects.HelpLightNotChangeable, MessageType.Warning); + } + + if (m_Targets.HasAtLeastOneTargetWith((T comp) => + { + if (comp.componentsToChange.HasFlag(EffectAbstractBase.ComponentsToChange.VolumetricLightBeam)) + { + var beam = comp.GetComponent(); + return (beam && !beam.trackChangesDuringPlaytime); + } + return false; + })) + { + EditorGUILayout.HelpBox(EditorStrings.Effects.HelpBeamNotChangeable, MessageType.Warning); + } + + DisplayChildProperties(); + + if (FoldableHeader.Begin(this, EditorStrings.Effects.HeaderMisc)) + { + componentsToChange.CustomMask(EditorStrings.Effects.ComponentsToChange); + EditorGUILayout.PropertyField(restoreIntensityOnDisable, EditorStrings.Effects.RestoreIntensityOnDisable); + } + FoldableHeader.End(); + + serializedObject.ApplyModifiedProperties(); + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_EffectAbstractBase.cs.meta b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectAbstractBase.cs.meta new file mode 100644 index 00000000..820d16d5 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectAbstractBase.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 18e0ceec3655f144990c0deb0f6493bb +timeCreated: 1617647862 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_EffectFlicker.cs b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectFlicker.cs new file mode 100644 index 00000000..e72405bf --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectFlicker.cs @@ -0,0 +1,48 @@ +#if UNITY_EDITOR +using UnityEditor; + +namespace VLB +{ + [CustomEditor(typeof(EffectFlicker))] + [CanEditMultipleObjects] + public class Editor_EffectFlicker : Editor_EffectAbstractBase + { + SerializedProperty performPauses = null; + SerializedProperty flickeringDuration = null; + SerializedProperty pauseDuration = null; + SerializedProperty restoreIntensityOnPause = null; + SerializedProperty frequency = null; + SerializedProperty intensityAmplitude = null; + SerializedProperty smoothing = null; + + protected override void DisplayChildProperties() + { + if (FoldableHeader.Begin(this, EditorStrings.Effects.HeaderTimings)) + { + EditorGUILayout.PropertyField(frequency, EditorStrings.Effects.FrequencyFlicker); + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Effects.HeaderPause)) + { + EditorGUILayout.PropertyField(performPauses, EditorStrings.Effects.PerformPauses); + + if (m_Targets.HasAtLeastOneTargetWith((EffectFlicker comp) => { return comp.performPauses == true; })) + { + EditorGUILayout.PropertyField(flickeringDuration, EditorStrings.Effects.FlickeringDuration); + EditorGUILayout.PropertyField(pauseDuration, EditorStrings.Effects.PauseDuration); + EditorGUILayout.PropertyField(restoreIntensityOnPause, EditorStrings.Effects.RestoreIntensityOnPause); + } + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Effects.HeaderVisual)) + { + EditorGUILayout.PropertyField(intensityAmplitude, EditorStrings.Effects.IntensityAmplitude); + EditorGUILayout.PropertyField(smoothing, EditorStrings.Effects.Smoothing); + } + FoldableHeader.End(); + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_EffectFlicker.cs.meta b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectFlicker.cs.meta new file mode 100644 index 00000000..2e277e7d --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectFlicker.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: acd24c9fc8968d74aa2ffe5a14630857 +timeCreated: 1617383958 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_EffectFromProfile.cs b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectFromProfile.cs new file mode 100644 index 00000000..1e36a31e --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectFromProfile.cs @@ -0,0 +1,67 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace VLB +{ + [CustomEditor(typeof(EffectFromProfile))] + [CanEditMultipleObjects] + public class Editor_EffectFromProfile : Editor_CommonHD + { + SerializedProperty effectProfile = null; + TargetList m_Targets; + + protected override void OnEnable() + { + base.OnEnable(); + m_Targets = new TargetList(targets); + } + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + bool needToApplyProfile = false; + + EditorGUI.BeginChangeCheck(); + { + EditorGUILayout.PropertyField(effectProfile, EditorStrings.Effects.EffectProfile); + } + if (EditorGUI.EndChangeCheck()) + { + needToApplyProfile = Application.isPlaying; + } + + DrawInfos(); + + using (new EditorGUILayout.HorizontalScope()) + { + if (GUILayout.Button(EditorStrings.Effects.ButtonNewProfileFlicker, EditorStyles.miniButton)) + { + EditorMenuItems.CreateEffectProfileFlicker(); + } + + if (GUILayout.Button(EditorStrings.Effects.ButtonNewProfilePulse, EditorStyles.miniButton)) + { + EditorMenuItems.CreateEffectProfilePulse(); + } + } + + serializedObject.ApplyModifiedProperties(); + + if(needToApplyProfile) + { + m_Targets.DoAction((EffectFromProfile effectFromProfile) => { effectFromProfile.InitInstanceFromProfile(); }); + } + } + + protected override void GetInfoTips(List tips) + { + tips.Add(new InfoTip { type = MessageType.Info, message = EditorStrings.Effects.HelpEffectProfile }); + base.GetInfoTips(tips); + } + } +} + +#endif diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAOEditor.cs.meta b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectFromProfile.cs.meta similarity index 83% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAOEditor.cs.meta rename to Assets/External/VolumetricLightBeam/Editor/Editor_EffectFromProfile.cs.meta index f11400ee..ca79a511 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAOEditor.cs.meta +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectFromProfile.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e055f53efc7d248489d6579ce7685547 +guid: 859621dcc73bfb343a4f3ab99a4c121a MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_EffectPulse.cs b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectPulse.cs new file mode 100644 index 00000000..921c2ed5 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectPulse.cs @@ -0,0 +1,29 @@ +#if UNITY_EDITOR +using UnityEditor; + +namespace VLB +{ + [CustomEditor(typeof(EffectPulse))] + [CanEditMultipleObjects] + public class Editor_EffectPulse : Editor_EffectAbstractBase + { + SerializedProperty frequency = null; + SerializedProperty intensityAmplitude = null; + + protected override void DisplayChildProperties() + { + if (FoldableHeader.Begin(this, EditorStrings.Effects.HeaderTimings)) + { + EditorGUILayout.PropertyField(frequency, EditorStrings.Effects.FrequencyPulse); + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Effects.HeaderVisual)) + { + EditorGUILayout.PropertyField(intensityAmplitude, EditorStrings.Effects.IntensityAmplitude); + } + FoldableHeader.End(); + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_EffectPulse.cs.meta b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectPulse.cs.meta new file mode 100644 index 00000000..657ac173 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_EffectPulse.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e5ae0f0491b8ca743b77f3ffbaf703d1 +timeCreated: 1617647714 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_TriggerZone.cs b/Assets/External/VolumetricLightBeam/Editor/Editor_TriggerZone.cs new file mode 100644 index 00000000..26466373 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_TriggerZone.cs @@ -0,0 +1,46 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace VLB +{ + [CustomEditor(typeof(TriggerZone))] + [CanEditMultipleObjects] + public class Editor_TriggerZone : Editor_CommonSD + { + SerializedProperty setIsTrigger = null; + SerializedProperty rangeMultiplier = null; + TargetList m_Targets; + + protected override void OnEnable() + { + base.OnEnable(); + m_Targets = new TargetList(targets); + } + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + EditorGUILayout.PropertyField(setIsTrigger, EditorStrings.TriggerZone.SetIsTrigger); + EditorGUILayout.PropertyField(rangeMultiplier, EditorStrings.TriggerZone.RangeMultiplier); + + if (FoldableHeader.Begin(this, EditorStrings.TriggerZone.HeaderInfos)) + { + EditorGUILayout.HelpBox( + UtilsBeamProps.GetDimensions(m_Targets.m_Targets[0]) == Dimensions.Dim3D ? EditorStrings.TriggerZone.HelpDescription3D : EditorStrings.TriggerZone.HelpDescription2D + , MessageType.Info); + + if(m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamAbstractBase beam) => { return UtilsBeamProps.CanChangeDuringPlaytime(beam); })) + { + EditorGUILayout.HelpBox(EditorStrings.TriggerZone.HelpTrackChangesDuringPlaytimeEnabled, MessageType.Warning); + } + } + FoldableHeader.End(); + + serializedObject.ApplyModifiedProperties(); + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_TriggerZone.cs.meta b/Assets/External/VolumetricLightBeam/Editor/Editor_TriggerZone.cs.meta new file mode 100644 index 00000000..1734b8d6 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_TriggerZone.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ded92402e19378c4a90ceb5ed4b418f9 +timeCreated: 1531119204 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricDustParticles.cs b/Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricDustParticles.cs new file mode 100644 index 00000000..e50a5bc3 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricDustParticles.cs @@ -0,0 +1,94 @@ +#if UNITY_EDITOR +using UnityEditor; +using UnityEngine; + +namespace VLB +{ + [CustomEditor(typeof(VolumetricDustParticles))] + [CanEditMultipleObjects] + public class Editor_VolumetricDustParticles : Editor_CommonSD + { + SerializedProperty alpha = null; + SerializedProperty size = null; + SerializedProperty direction = null; + SerializedProperty velocity = null; + SerializedProperty density = null; + SerializedProperty spawnDistanceRange = null; + SerializedProperty cullingEnabled = null; + SerializedProperty cullingMaxDistance = null; + + static bool AreParticlesInfosUpdated() { return Application.isPlaying; } + public override bool RequiresConstantRepaint() { return AreParticlesInfosUpdated(); } + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + var particles = target as VolumetricDustParticles; + + if (particles.gameObject.activeSelf && particles.enabled && !particles.particlesAreInstantiated) + { + EditorGUILayout.HelpBox(EditorStrings.DustParticles.HelpFailToInstantiate, MessageType.Error); + ButtonOpenConfig(); + } + + if (FoldableHeader.Begin(this, EditorStrings.DustParticles.HeaderRendering)) + { + EditorGUILayout.PropertyField(alpha, EditorStrings.DustParticles.Alpha); + EditorGUILayout.PropertyField(size, EditorStrings.DustParticles.Size); + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.DustParticles.HeaderDirectionAndVelocity)) + { + EditorGUILayout.PropertyField(direction, EditorStrings.DustParticles.Direction); + + if (particles.direction == ParticlesDirection.Random) + { + var vec = velocity.vector3Value; + vec.z = EditorGUILayout.FloatField(EditorStrings.DustParticles.Velocity, vec.z); + velocity.vector3Value = vec; + } + else + { + EditorGUILayout.PropertyField(velocity, EditorStrings.DustParticles.Velocity); + } + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.DustParticles.HeaderCulling)) + { + EditorGUILayout.PropertyField(cullingEnabled, EditorStrings.DustParticles.CullingEnabled); + if (cullingEnabled.boolValue) + EditorGUILayout.PropertyField(cullingMaxDistance, EditorStrings.DustParticles.CullingMaxDistance); + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.DustParticles.HeaderSpawning)) + { + EditorGUILayout.PropertyField(density, EditorStrings.DustParticles.Density); + EditorGUILayout.PropertyField(spawnDistanceRange, EditorStrings.DustParticles.SpawnDistanceRange); + + { + var infos = "Current particles count: "; + if (AreParticlesInfosUpdated()) infos += particles.particlesCurrentCount; + else infos += "(playtime only)"; + if (particles.isCulled) + infos += string.Format(" (culled by '{0}')", particles.mainCamera.name); + infos += string.Format("\nMax particles count: {0}", particles.particlesMaxCount); + EditorGUILayout.HelpBox(infos, MessageType.Info); + } + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.DustParticles.HeaderInfos)) + { + EditorGUILayout.HelpBox(EditorStrings.DustParticles.HelpRecommendation, MessageType.Info); + } + FoldableHeader.End(); + + serializedObject.ApplyModifiedProperties(); + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricDustParticles.cs.meta b/Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricDustParticles.cs.meta new file mode 100644 index 00000000..6272af2e --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricDustParticles.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 264a06b7c9bbc6940bd66056f4a38291 +timeCreated: 1510686811 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricLightBeamAbstractBase.cs b/Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricLightBeamAbstractBase.cs new file mode 100644 index 00000000..b84b8a06 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricLightBeamAbstractBase.cs @@ -0,0 +1,345 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace VLB +{ + public abstract class Editor_VolumetricLightBeamAbstractBase : Editor_Common + { + TargetList m_Targets; + + protected override void OnEnable() + { + base.OnEnable(); + m_Targets = new TargetList(targets); + } + + protected string GetBatchingReport() + { + if (m_Targets.Count > 1) + { + string reasons = ""; + for (int i = 1; i < m_Targets.Count; ++i) + { + if (!BatchingHelper.CanBeBatched(m_Targets[0], m_Targets[i], ref reasons)) + { + return "Selected beams can't be batched together:\n" + reasons; + } + } + } + return null; + } + + + protected void AddComponentToTargets() where T : MonoBehaviour + { + foreach (var target in m_Targets) EditorExtensions.AddComponentFromEditor(target); + } + + protected void DrawEditInSceneButton() + { + EditorGUI.BeginChangeCheck(); + bool editInScene = EditorPrefs.GetBool(EditorStrings.Beam.PrefEditInScene, false); + editInScene = GUILayout.Toggle(editInScene, EditorStrings.Beam.ButtonEditInScene, EditorStyles.miniButton); + if (EditorGUI.EndChangeCheck()) + { + EditorPrefs.SetBool(EditorStrings.Beam.PrefEditInScene, editInScene); + SceneView.RepaintAll(); + } + } + + protected bool DrawFallOffSliderHandle(Transform beamTransf, Vector3 beamGlobalForward, Vector3 beamScale, float lineStartOffset, float lineAlpha, Handles.CapFunction capFunction, string recordName, System.Func getValue, System.Action setValue) + { + Debug.Assert(beamTransf != null); + + EditorGUI.BeginChangeCheck(); + var sliderPos = beamTransf.position + getValue() * beamScale.z * beamGlobalForward; + sliderPos = Handles.Slider(sliderPos, beamGlobalForward, HandleUtility.GetHandleSize(sliderPos) * 0.1f, capFunction, 0.5f); + + Handles.Label(sliderPos, string.Format("{0} {1:0.0}", recordName, getValue()), labelStyle); + + var savedCol = Handles.color; + { + var col = savedCol; + col.a = lineAlpha; + Handles.color = col; + Handles.DrawLine(beamTransf.position + beamGlobalForward * lineStartOffset, sliderPos); + Handles.color = savedCol; + } + + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(target, string.Format("Edit Beam '{0}'", recordName)); + + var sliderVec = (sliderPos - beamTransf.position); + var sliderLength = 0.0f; + if (Vector3.Dot(sliderVec, beamGlobalForward) > 0.0f) + sliderLength = sliderVec.magnitude; + + sliderLength /= beamScale.z; + setValue(sliderLength); + return true; + } + return false; + } + + protected GUIStyle labelStyle + { + get + { + var style = new GUIStyle(GUI.skin.GetStyle("Label")); + style.normal.textColor = Handles.color; + style.alignment = TextAnchor.LowerCenter; + style.fixedWidth = 200.0f; + return style; + } + } + + bool DrawRadiusHandle(Transform beamTransf, Vector3 beamGlobalForward, Vector3 beamScale, Vector3 pos, string recordName, System.Func getValue, System.Action setValue) + { + Debug.Assert(beamTransf != null); + + var rot = Quaternion.LookRotation(beamTransf.up, beamGlobalForward); + + UnityEditor.IMGUI.Controls.ArcHandle hdl = null; + + float maxScaleXY = Mathf.Max(beamScale.x, beamScale.y); + + EditorGUI.BeginChangeCheck(); + { + using (new Handles.DrawingScope(Matrix4x4.TRS(pos, rot * Quaternion.Euler(0.0f, 45.0f, 0.0f), Vector3.one))) + { + hdl = EditorExtensions.DrawHandleRadius(getValue() * maxScaleXY); + } + + using (new Handles.DrawingScope(Matrix4x4.TRS(pos, rot, Vector3.one))) + { + Handles.Label(getValue() * maxScaleXY * Vector3.forward, string.Format("{0} {1:0.00}", recordName, getValue()), labelStyle); + } + } + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(target, string.Format("Edit Beam '{0}'", recordName)); + setValue(hdl.radius / maxScaleXY); + return true; + } + return false; + } + + bool DrawSpotAngleHandle(Transform beamTransf, Vector3 beamGlobalForward, Vector3 pos, float handleRadius, string recordName, System.Func getValue, System.Action setValue) + { + Debug.Assert(beamTransf != null); + + var left = Vector3.Cross(beamGlobalForward, beamTransf.up); // show angle handle properly with 2d beams + var rot = Quaternion.LookRotation(beamGlobalForward, left); + + UnityEditor.IMGUI.Controls.ArcHandle hdl = null; + EditorGUI.BeginChangeCheck(); + { + using (new Handles.DrawingScope(Matrix4x4.TRS(pos, rot * Quaternion.Euler(0.0f, -getValue() / 2, 0.0f), Vector3.one))) + { + hdl = EditorExtensions.DrawHandleSpotAngle(getValue(), handleRadius); + } + + using (new Handles.DrawingScope(Matrix4x4.TRS(pos, rot, Vector3.one))) + { + Handles.Label(Vector3.forward * handleRadius, string.Format("{0} {1:0.0}", recordName, getValue()), labelStyle); + } + } + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(target, string.Format("Edit Beam '{0}'", recordName)); + setValue(hdl.angle); + return true; + } + return false; + } + + + static Vector3 GetBeamGlobalForward(VolumetricLightBeamAbstractBase beam) + { + if (beam is VolumetricLightBeamSD sd) return sd.beamGlobalForward; + if (beam is VolumetricLightBeamHD hd) return hd.beamGlobalForward; + return Vector3.forward; + } + + static Vector3 GetBeamLossyScaleIfScalable(VolumetricLightBeamAbstractBase beam) + { + if (beam.IsScalable()) + return beam.GetLossyScale(); + return Vector3.one; + } + + static float GetBeamConeRadiusStart(VolumetricLightBeamAbstractBase beam) + { + if (beam is VolumetricLightBeamSD sd) return sd.coneRadiusStart; + if (beam is VolumetricLightBeamHD hd) return hd.coneRadiusStart; + return 0.0f; + } + + static void SetBeamConeRadiusStart(VolumetricLightBeamAbstractBase beam, float radius) + { + if (beam is VolumetricLightBeamSD sd) sd.coneRadiusStart = radius; + if (beam is VolumetricLightBeamHD hd) hd.coneRadiusStart = radius; + } + + static float GetBeamConeRadiusEnd(VolumetricLightBeamAbstractBase beam) + { + if (beam is VolumetricLightBeamSD sd) return sd.coneRadiusEnd; + if (beam is VolumetricLightBeamHD hd) return hd.coneRadiusEnd; + return 1.0f; + } + + static void SetBeamConeRadiusEnd(VolumetricLightBeamAbstractBase beam, float radius) + { + if (beam is VolumetricLightBeamSD sd) sd.coneRadiusEnd = radius; + if (beam is VolumetricLightBeamHD hd) hd.coneRadiusEnd = radius; + } + + static float GetBeamSpotAngle(VolumetricLightBeamAbstractBase beam) + { + if (beam is VolumetricLightBeamSD sd) return sd.spotAngle; + if (beam is VolumetricLightBeamHD hd) return hd.spotAngle; + return 1.0f; + } + + static void SetBeamSpotAngle(VolumetricLightBeamAbstractBase beam, float radius) + { + if (beam is VolumetricLightBeamSD sd) sd.spotAngle = radius; + if (beam is VolumetricLightBeamHD hd) hd.spotAngle = radius; + } + + static float GetBeamFallOffEnd(VolumetricLightBeamAbstractBase beam) + { + if (beam is VolumetricLightBeamSD sd) return sd.fallOffEnd; + if (beam is VolumetricLightBeamHD hd) return hd.fallOffEnd; + return 1.0f; + } + + static void SetBeamFallOffEnd(VolumetricLightBeamAbstractBase beam, float radius) + { + if (beam is VolumetricLightBeamSD sd) sd.fallOffEnd = radius; + if (beam is VolumetricLightBeamHD hd) hd.fallOffEnd = radius; + } + + static float GetBeamFallOffStart(VolumetricLightBeamAbstractBase beam) + { + if (beam is VolumetricLightBeamSD sd) return sd.fallOffStart; + if (beam is VolumetricLightBeamHD hd) return hd.fallOffStart; + return 1.0f; + } + + static bool GetBeamHasMeshSkewing(VolumetricLightBeamAbstractBase beam) + { + if (beam is VolumetricLightBeamSD sd) return sd.hasMeshSkewing; + return false; + } + + static bool GetBeamUseSpotAngleFromLight(VolumetricLightBeamAbstractBase beam) + { + if (beam is VolumetricLightBeamSD sd) return sd.spotAngleFromLight; + if (beam is VolumetricLightBeamHD hd) return hd.useSpotAngleFromAttachedLightSpot; + return false; + } + + static bool GetBeamUseFallOffEndFromLight(VolumetricLightBeamAbstractBase beam) + { + if (beam is VolumetricLightBeamSD sd) return sd.fallOffEndFromLight; + if (beam is VolumetricLightBeamHD hd) return hd.useFallOffEndFromAttachedLightSpot; + return false; + } + + protected virtual bool DrawEditInSceneHandles() + { + bool editInScene = EditorPrefs.GetBool(EditorStrings.Beam.PrefEditInScene, false); + if (!editInScene) + return false; + + var beam = target as VolumetricLightBeamAbstractBase; + Debug.Assert(beam != null); + + bool update = false; + + VolumetricLightBeamSD.AttachedLightType lightType; + var hasSpotLight = beam.GetLightSpotAttachedSlow(out lightType) != null; + + Handles.color = beam.ComputeColorAtDepth(0.0f).ComputeComplementaryColor(true); + { + update |= DrawRadiusHandle(beam.transform, GetBeamGlobalForward(beam), GetBeamLossyScaleIfScalable(beam), beam.transform.position, "Source Radius", () => GetBeamConeRadiusStart(beam), (float v) => SetBeamConeRadiusStart(beam, v)); + + if (!hasSpotLight || !GetBeamUseSpotAngleFromLight(beam)) + { + update |= DrawSpotAngleHandle(beam.transform, GetBeamGlobalForward(beam), beam.transform.position, GetBeamFallOffEnd(beam) / 2, "Spot Angle", () => GetBeamSpotAngle(beam), (float v) => SetBeamSpotAngle(beam, v)); + } + } + + if (!GetBeamHasMeshSkewing(beam)) + { + Handles.color = beam.ComputeColorAtDepth(1.0f).ComputeComplementaryColor(true); + { + if (!hasSpotLight || !GetBeamUseFallOffEndFromLight(beam)) + { + update |= DrawFallOffSliderHandle(beam.transform, GetBeamGlobalForward(beam), GetBeamLossyScaleIfScalable(beam), GetBeamFallOffStart(beam), 0.5f, Handles.CubeHandleCap, "Range Limit", () => GetBeamFallOffEnd(beam), (float v) => SetBeamFallOffEnd(beam, v)); + } + + if (!hasSpotLight || !GetBeamUseSpotAngleFromLight(beam)) + { + var fallOffEndPos = beam.transform.TransformPoint(GetBeamGlobalForward(beam) * GetBeamFallOffEnd(beam)); + update |= DrawRadiusHandle(beam.transform, GetBeamGlobalForward(beam), GetBeamLossyScaleIfScalable(beam), fallOffEndPos, "End Radius", () => GetBeamConeRadiusEnd(beam), (float v) => SetBeamConeRadiusEnd(beam, v)); + } + } + } + + return update; + } + + + + protected GUIStyle buttonAddComponentStyle { get => GUI.skin.button; } + + protected void DrawButtonAddComponentDust() + { + bool showButtonDust = m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamAbstractBase beam) => { return beam.GetComponent() == null; }); + + if (showButtonDust && GUILayout.Button(EditorData.Instance.contentAddDustParticles, buttonAddComponentStyle)) + AddComponentToTargets(); + } + + protected void DrawButtonAddComponentTriggerZone() + { + bool showButtonTriggerZone = m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamAbstractBase beam) => { return beam.GetComponent() == null; }); + + if (showButtonTriggerZone && GUILayout.Button(EditorData.Instance.contentAddTriggerZone, buttonAddComponentStyle)) + AddComponentToTargets(); + } + + protected void DrawButtonAddComponentEffect() + { + bool showButtonEffect = m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamAbstractBase beam) => + { + return beam.GetComponent() == null && beam.GetComponent() == null; + }); + + if (showButtonEffect && GUILayout.Button(EditorData.Instance.contentAddEffect, buttonAddComponentStyle)) + { + var menu = new GenericMenu(); + menu.AddItem(new GUIContent(EditorStrings.Beam.ButtonAddEffectFlicker), false, AddComponentToTargets); + menu.AddItem(new GUIContent(EditorStrings.Beam.ButtonAddEffectPulse), false, AddComponentToTargets); + menu.AddItem(new GUIContent(EditorStrings.Beam.ButtonAddEffectFromProfile), false, AddComponentToTargets); + menu.ShowAsContext(); + } + } + + protected override void GetInfoTips(List tips) + { + var gpuInstancingReport = GetBatchingReport(); + if (!string.IsNullOrEmpty(gpuInstancingReport)) + tips.Add(new InfoTip { type = MessageType.Warning, message = gpuInstancingReport }); + + base.GetInfoTips(tips); + } + } +} +#endif // UNITY_EDITOR + diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.cs.meta b/Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricLightBeamAbstractBase.cs.meta similarity index 83% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.cs.meta rename to Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricLightBeamAbstractBase.cs.meta index b6cea389..30dc5258 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.cs.meta +++ b/Assets/External/VolumetricLightBeam/Editor/Editor_VolumetricLightBeamAbstractBase.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 90fbf49926625114084d7e0c0cffe8d1 +guid: 0a7989b7ed3b0b44985bf22d8b4059fe MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/External/VolumetricLightBeam/Editor/FoldableHeader.cs b/Assets/External/VolumetricLightBeam/Editor/FoldableHeader.cs new file mode 100644 index 00000000..cad51008 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/FoldableHeader.cs @@ -0,0 +1,77 @@ +#if UNITY_EDITOR +#if UNITY_2019_1_OR_NEWER +#define UI_USE_FOLDOUT_HEADER_2019 +#endif + +using UnityEditor; +using UnityEngine; +using System.Collections.Generic; +using System; + +namespace VLB +{ + public static class FoldableHeader + { + public static void OnEnable() + { + ms_CurrentFoldableHeader = null; + } + + public static bool Begin(UnityEngine.Object self, string label) + { + return Begin(self, new GUIContent(label)); + } + + public static bool Begin(UnityEngine.Object self, GUIContent label) + { + var uniqueString = label.text; + if(self) uniqueString = self.ToString() + uniqueString; + + if (ms_StyleHeaderFoldable == null) + { + ms_StyleHeaderFoldable = new GUIStyle(EditorStyles.foldout); + ms_StyleHeaderFoldable.fontStyle = FontStyle.Bold; + } + + ms_CurrentFoldableHeader = uniqueString; + + bool folded = IsFolded(uniqueString); + + +#if UI_USE_FOLDOUT_HEADER_2019 + folded = !EditorGUILayout.BeginFoldoutHeaderGroup(!folded, label); +#else + folded = !EditorGUILayout.Foldout(!folded, label, toggleOnLabelClick: true, style: ms_StyleHeaderFoldable); +#endif + + if (folded) ms_FoldedHeaders.Add(uniqueString); + else ms_FoldedHeaders.Remove(uniqueString); + + return !folded; + } + + public static void End() + { + Debug.Assert(ms_CurrentFoldableHeader != null, "Trying to call FoldableHeader.End() but there is no header opened"); + bool isFolded = IsFolded(ms_CurrentFoldableHeader); + ms_CurrentFoldableHeader = null; + +#if UI_USE_FOLDOUT_HEADER_2019 + EditorGUILayout.EndFoldoutHeaderGroup(); +#if UNITY_2019_3_OR_NEWER + if(!isFolded) EditorGUILayout.Separator(); +#endif +#else + EditorExtensions.DrawLineSeparator(); +#endif + } + + static bool IsFolded(string uniqueString) { return ms_FoldedHeaders.Contains(uniqueString); } + + static string ms_CurrentFoldableHeader = null; + static HashSet ms_FoldedHeaders = new HashSet(); + static GUIStyle ms_StyleHeaderFoldable = null; + } +} +#endif // UNITY_EDITOR + diff --git a/Assets/External/VolumetricLightBeam/Editor/FoldableHeader.cs.meta b/Assets/External/VolumetricLightBeam/Editor/FoldableHeader.cs.meta new file mode 100644 index 00000000..2239191c --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/FoldableHeader.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ccdd6181af634264e819236c461b2ac4 +timeCreated: 1582578385 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/HD.meta b/Assets/External/VolumetricLightBeam/Editor/HD.meta new file mode 100644 index 00000000..8b857a2d --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/HD.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 74f66c89e2b413640926a98f67110525 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/HD/Editor_CommonHD.cs b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_CommonHD.cs new file mode 100644 index 00000000..8de0c453 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_CommonHD.cs @@ -0,0 +1,14 @@ +#if UNITY_EDITOR +namespace VLB +{ + public class Editor_CommonHD : Editor_Common + { + protected override void OnEnable() + { + base.OnEnable(); + RetrieveSerializedProperties("m_"); + } + } +} +#endif // UNITY_EDITOR + diff --git a/Assets/External/VolumetricLightBeam/Editor/HD/Editor_CommonHD.cs.meta b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_CommonHD.cs.meta new file mode 100644 index 00000000..3a74c349 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_CommonHD.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: ac1e2bfb8fc962941a00fa077e3cabf5 +timeCreated: 1640627913 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/HD/Editor_TrackRealtimeChangesOnLightHD.cs b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_TrackRealtimeChangesOnLightHD.cs new file mode 100644 index 00000000..ceba36e6 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_TrackRealtimeChangesOnLightHD.cs @@ -0,0 +1,26 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace VLB +{ + [CustomEditor(typeof(TrackRealtimeChangesOnLightHD))] + [CanEditMultipleObjects] + public class Editor_TrackRealtimeChangesOnLightHD : Editor_CommonHD + { + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + DrawInfos(); + } + + protected override void GetInfoTips(List tips) + { + tips.Add(new InfoTip { type = MessageType.Info, message = EditorStrings.Beam.HD.TipTrackRealtimeChangesOnLight }); + base.GetInfoTips(tips); + } + } +} + +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/HD/Editor_TrackRealtimeChangesOnLightHD.cs.meta b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_TrackRealtimeChangesOnLightHD.cs.meta new file mode 100644 index 00000000..c66f1943 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_TrackRealtimeChangesOnLightHD.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5771d378121df014ea4bf9be7db052b6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricCookieHD.cs b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricCookieHD.cs new file mode 100644 index 00000000..f886d91a --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricCookieHD.cs @@ -0,0 +1,73 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace VLB +{ + [CustomEditor(typeof(VolumetricCookieHD))] + [CanEditMultipleObjects] + public class Editor_VolumetricCookieHD : Editor_CommonHD + { + SerializedProperty m_Contribution = null, m_CookieTexture = null, m_Channel = null, m_Negative = null; + SerializedProperty m_Translation = null, m_Rotation = null, m_Scale = null; + protected TargetList m_Targets; + + protected override void OnEnable() + { + base.OnEnable(); + m_Targets = new TargetList(targets); + } + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + if (FoldableHeader.Begin(this, EditorStrings.Cookie.HeaderVisual)) + { + EditorGUILayout.Slider(m_Contribution, Consts.Cookie.ContributionMin, Consts.Cookie.ContributionMax, EditorStrings.Cookie.Contribution); + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Cookie.HeaderTexture)) + { + EditorGUILayout.PropertyField(m_CookieTexture, EditorStrings.Cookie.CookieTexture); + EditorGUILayout.PropertyField(m_Channel, EditorStrings.Cookie.Channel); + + if (m_Targets.HasAtLeastOneTargetWith((VolumetricCookieHD comp) => { return comp.channel != CookieChannel.RGBA; })) + { + EditorGUILayout.PropertyField(m_Negative, EditorStrings.Cookie.Negative); + } + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Cookie.HeaderTransform)) + { + EditorGUILayout.PropertyField(m_Translation, EditorStrings.Cookie.Translation); + EditorGUILayout.PropertyField(m_Rotation, EditorStrings.Cookie.Rotation); + EditorGUILayout.PropertyField(m_Scale, EditorStrings.Cookie.Scale); + } + FoldableHeader.End(); + + DrawInfos(); + + serializedObject.ApplyModifiedProperties(); + } + + protected override void GetInfoTips(List tips) + { + if (m_Targets.HasAtLeastOneTargetWith((VolumetricCookieHD comp) => { + if (comp.cookieTexture is Texture2D tex2D) + return tex2D.mipmapCount > 1; + return false; + })) + tips.Add(new InfoTip { type = MessageType.Warning, message = EditorStrings.Cookie.TipCookieMipMaps }); + + if (m_Targets.HasAtLeastOneTargetWith((VolumetricCookieHD comp) => { return comp.GetComponent().jitteringFactor == 0.0f; })) + tips.Add(new InfoTip { type = MessageType.Info, message = EditorStrings.Beam.HD.TipJittering }); + + base.GetInfoTips(tips); + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricCookieHD.cs.meta b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricCookieHD.cs.meta new file mode 100644 index 00000000..159cac53 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricCookieHD.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9141d4662b9e5734b8d7facedcf6cb6c +timeCreated: 1614360514 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD.cs b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD.cs new file mode 100644 index 00000000..95023a07 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD.cs @@ -0,0 +1,318 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +#pragma warning disable 0429, 0162 // Unreachable expression code detected (because of Noise3D.isSupported on mobile) + +namespace VLB +{ + [CustomEditor(typeof(VolumetricLightBeamHD))] + [CanEditMultipleObjects] + public class Editor_VolumetricLightBeamHD : Editor_VolumetricLightBeamAbstractBase + { + SerializedProperty m_ColorFromLight = null, m_ColorMode = null, m_ColorFlat = null, m_ColorGradient = null; + SerializedProperty m_Intensity = null, m_IntensityMultiplier = null; + SerializedProperty m_BlendingMode = null; + SerializedProperty m_SideSoftness = null; + SerializedProperty m_SpotAngle = null, m_SpotAngleMultiplier = null; + SerializedProperty m_ConeRadiusStart = null; + SerializedProperty m_Scalable = null; + SerializedProperty m_FallOffStart = null, m_FallOffEnd = null, m_FallOffEndMultiplier = null; + SerializedProperty m_AttenuationEquation = null; + SerializedProperty m_NoiseMode = null, m_NoiseIntensity = null, m_NoiseScaleUseGlobal = null, m_NoiseScaleLocal = null, m_NoiseVelocityUseGlobal = null, m_NoiseVelocityLocal = null; + SerializedProperty m_JitteringFactor = null, m_JitteringFrameRate = null, m_JitteringLerpRange = null, m_RaymarchingQualityID = null; + + TargetList m_Targets; + + protected override void OnEnable() + { + base.OnEnable(); + RetrieveSerializedProperties("m_"); + m_Targets = new TargetList(targets); + } + + void DisplayDebugInfo(VolumetricLightBeamHD beam) + { + Debug.Assert(beam); + var geom = beam._EDITOR_GetBeamGeometry(); + if(!geom) + { + EditorGUILayout.LabelField("No BeamGeometry"); + return; + } + +#if VLB_DEBUG + string matInfo = string.Format("Material: {0} | ID: {1} / {2}" + , geom._EDITOR_IsUsingCustomMaterial ? "CUSTOM" : "INSTANCED" + , geom._EDITOR_InstancedMaterialID + , MaterialManager.StaticPropertiesHD.staticPropertiesCount); + EditorGUILayout.LabelField(matInfo); +#endif // VLB_DEBUG + } + + protected virtual void DrawProperties(bool hasLightSpot) + { + if (FoldableHeader.Begin(this, EditorStrings.Beam.HeaderBasic)) + { + // Color + using (ButtonToggleScope.FromLight(m_ColorFromLight, hasLightSpot)) + { + if (!hasLightSpot) EditorGUILayout.BeginHorizontal(); // mandatory to have the color picker on the same line (when the button "from light" is not here) + { + if (Config.Instance.featureEnabledColorGradient == FeatureEnabledColorGradient.Off) + { + EditorGUILayout.PropertyField(m_ColorFlat, EditorStrings.Beam.ColorMode); + } + else + { + using (new EditorExtensions.LabelWidth(65f)) + { + EditorGUILayout.PropertyField(m_ColorMode, EditorStrings.Beam.ColorMode); + } + + if (m_ColorMode.enumValueIndex == (int)ColorMode.Gradient) + EditorGUILayout.PropertyField(m_ColorGradient, EditorStrings.Beam.ColorGradient); + else + EditorGUILayout.PropertyField(m_ColorFlat, EditorStrings.Beam.ColorFlat); + } + } + if (!hasLightSpot) EditorGUILayout.EndHorizontal(); + } + + // Blending Mode + EditorGUILayout.PropertyField(m_BlendingMode, EditorStrings.Beam.BlendingMode); + + // Intensity + using (var lightDisabledGrp = ButtonToggleScope.FromLight(m_IntensityMultiplier, hasLightSpot)) + { + if (m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamHD beam) => { return beam.useIntensityFromAttachedLightSpot; })) + { + using (new EditorExtensions.ShowMixedValue(m_Intensity)) + { + // display grayed out Unity's light intensity + EditorGUILayout.FloatField(EditorStrings.Beam.HD.Intensity, SpotLightHelper.GetIntensity(m_Targets[0].lightSpotAttached)); + } + + lightDisabledGrp?.EndDisabledGroup(); // muliplier factor should be available + DrawMultiplierProperty(m_IntensityMultiplier, EditorStrings.Beam.IntensityMultiplier); // multiplier property + } + else + { + EditorGUILayout.PropertyField(m_Intensity, EditorStrings.Beam.HD.Intensity); + } + } + + EditorGUILayout.Slider(m_SideSoftness, Consts.Beam.HD.SideSoftnessMin, Consts.Beam.HD.SideSoftnessMax, EditorStrings.Beam.HD.SideSoftness); + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Beam.HeaderShape)) + { + // Fade End + using (var lightDisabledGrp = ButtonToggleScope.FromLight(m_FallOffEndMultiplier, hasLightSpot)) + { + if (m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamHD beam) => { return beam.useFallOffEndFromAttachedLightSpot; })) + { + using (new EditorExtensions.ShowMixedValue(m_FallOffEnd)) + { + // display grayed out Unity's light range + EditorGUILayout.FloatField(EditorStrings.Beam.FallOffEnd, SpotLightHelper.GetFallOffEnd(m_Targets[0].lightSpotAttached)); + } + + lightDisabledGrp?.EndDisabledGroup(); // muliplier factor should be available + DrawMultiplierProperty(m_FallOffEndMultiplier, EditorStrings.Beam.FallOffEndMultiplier); // multiplier property + } + else + { + EditorGUILayout.PropertyField(m_FallOffEnd, EditorStrings.Beam.FallOffEnd); + } + } + + // Spot Angle + using (var lightDisabledGrp = ButtonToggleScope.FromLight(m_SpotAngleMultiplier, hasLightSpot)) + { + if (m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamHD beam) => { return beam.useSpotAngleFromAttachedLightSpot; })) + { + using (new EditorExtensions.ShowMixedValue(m_SpotAngle)) + { + // display grayed out Unity's light angle + EditorGUILayout.FloatField(EditorStrings.Beam.SpotAngle, SpotLightHelper.GetSpotAngle(m_Targets[0].lightSpotAttached)); + } + + lightDisabledGrp?.EndDisabledGroup(); // muliplier factor should be available + DrawMultiplierProperty(m_SpotAngleMultiplier, EditorStrings.Beam.SpotAngleMultiplier); // multiplier property + } + else + { + EditorGUILayout.Slider(m_SpotAngle, Consts.Beam.SpotAngleMin, Consts.Beam.SpotAngleMax, EditorStrings.Beam.SpotAngle); + } + } + + EditorGUILayout.PropertyField(m_ConeRadiusStart, EditorStrings.Beam.ConeRadiusStart); + + EditorGUILayout.PropertyField(m_Scalable, EditorStrings.Beam.Scalable); + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Beam.HD.HeaderRaymarching)) + { + Editor_Config.DrawRaymarchingQualitiesPopup(Config.Instance, m_RaymarchingQualityID, EditorStrings.Beam.HD.RaymarchingQuality); + + EditorGUILayout.PropertyField(m_JitteringFactor, EditorStrings.Beam.HD.JitteringFactor); + + if(m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamHD beam) => { return beam.jitteringFactor > 0.0f; })) + { + EditorGUILayout.IntSlider(m_JitteringFrameRate, Consts.Beam.HD.JitteringFrameRateMin, Consts.Beam.HD.JitteringFrameRateMax, EditorStrings.Beam.HD.JitteringFrameRate); + EditorGUILayout.PropertyField(m_JitteringLerpRange, EditorStrings.Beam.HD.JitteringLerpRange); + } + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Beam.HeaderAttenuation)) + { + EditorGUILayout.PropertyField(m_AttenuationEquation, EditorStrings.Beam.HD.AttenuationEquation); + + if (m_FallOffEnd.hasMultipleDifferentValues) + EditorGUILayout.PropertyField(m_FallOffStart, EditorStrings.Beam.FallOffStart); + else + m_FallOffStart.FloatSlider(EditorStrings.Beam.FallOffStart, 0f, m_FallOffEnd.floatValue - Consts.Beam.FallOffDistancesMinThreshold); + + EditorGUILayout.Separator(); + } + FoldableHeader.End(); + + if (Config.Instance.featureEnabledNoise3D) + { + if (FoldableHeader.Begin(this, EditorStrings.Beam.Header3DNoise)) + { + m_NoiseMode.CustomEnum(EditorStrings.Beam.NoiseMode, EditorStrings.Beam.NoiseModeEnumDescriptions); + + bool showNoiseProps = m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamHD beam) => { return beam.isNoiseEnabled; }); + if (showNoiseProps) + { + EditorGUILayout.Slider(m_NoiseIntensity, Consts.Beam.NoiseIntensityMin, Consts.Beam.NoiseIntensityMax, EditorStrings.Beam.NoiseIntensity); + + using (new EditorGUILayout.HorizontalScope()) + { + using (new EditorGUI.DisabledGroupScope(m_NoiseScaleUseGlobal.boolValue)) + { + EditorGUILayout.Slider(m_NoiseScaleLocal, Consts.Beam.NoiseScaleMin, Consts.Beam.NoiseScaleMax, EditorStrings.Beam.NoiseScale); + } + m_NoiseScaleUseGlobal.ToggleUseGlobalNoise(); + } + + using (new EditorGUILayout.HorizontalScope()) + { + using (new EditorGUI.DisabledGroupScope(m_NoiseVelocityUseGlobal.boolValue)) + { + EditorGUILayout.PropertyField(m_NoiseVelocityLocal, EditorStrings.Beam.NoiseVelocity); + } + m_NoiseVelocityUseGlobal.ToggleUseGlobalNoise(); + } + + if (Noise3D.isSupported && !Noise3D.isProperlyLoaded) + EditorGUILayout.HelpBox(EditorStrings.Common.HelpNoiseLoadingFailed, MessageType.Error); + + if (!Noise3D.isSupported) + EditorGUILayout.HelpBox(Noise3D.isNotSupportedString, MessageType.Info); + } + } + FoldableHeader.End(); + } + } + + public sealed override void OnInspectorGUI() + { + base.OnInspectorGUI(); + Debug.Assert(m_Targets.Count > 0); + + // Prevent from drawing inspector when editor props are dirty + // in Unity 2022, inspector is drawn BEFORE calling Update & GenerateGeometry which set a valid raymarching ID + // and that generates a error message in DrawRaymarchingQualitiesPopup + foreach (var target in m_Targets) + { + // make sure to display inspector when selecting a prefab asset (since update is not called for prefab asset in project browser, its EditorDirtyFlags.Props will be always true) + bool isPrefabAsset = PrefabUtility.IsPartOfPrefabAsset(target.gameObject); + + if(target.enabled // always display inspector for disabled component: when disabling a Beam, OnValidate is called which set EditorDirtyFlags.Props + && !isPrefabAsset + && target._EditorIsDirty()) + return; + } + + DisplayDebugInfo(m_Targets[0]); + + VolumetricLightBeamSD.AttachedLightType lightType; + bool hasLightSpot = m_Targets[0].GetLightSpotAttachedSlow(out lightType) != null; + if (lightType == VolumetricLightBeamSD.AttachedLightType.OtherLight) + { + EditorGUILayout.HelpBox(EditorStrings.Beam.HelpNoSpotlight, MessageType.Warning); + } + + DrawProperties(hasLightSpot); + + DrawInfos(); + DrawEditInSceneButton(); + DrawCustomActionButtons(); + DrawAdditionalFeatures(); + + serializedObject.ApplyModifiedProperties(); + } + + GUIContent AddEnabledStatusToContentText(GUIContent inContent, SerializedProperty prop) + { + Debug.Assert(prop.propertyType == SerializedPropertyType.Float); + + var content = new GUIContent(inContent); + if (prop.hasMultipleDifferentValues) + content.text += " (-)"; + else + content.text += prop.floatValue > 0.0 ? " (on)" : " (off)"; + return content; + } + + void DrawCustomActionButtons() + { + using (new EditorGUILayout.HorizontalScope()) + { + if (GUILayout.Button(EditorStrings.Beam.ButtonResetProperties, EditorStyles.miniButton)) + { + m_Targets.RecordUndoAction("Reset Light Beam Properties", + (VolumetricLightBeamHD beam) => { beam.Reset(); beam.GenerateGeometry(); } ); + } + } + } + + void DrawAdditionalFeatures() + { + if (Application.isPlaying) return; // do not support adding additional components at runtime + + using (new EditorGUILayout.HorizontalScope()) + { + DrawButtonAddComponentDust(); + + bool showButtonCookie = Config.Instance.featureEnabledCookie && m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamHD beam) => { return beam.GetComponent() == null; }); + if (showButtonCookie && GUILayout.Button(EditorData.Instance.contentAddCookieHD, buttonAddComponentStyle)) + AddComponentToTargets(); + + bool showButtonShadow = Config.Instance.featureEnabledShadow && m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamHD beam) => { return beam.GetComponent() == null; }); + if (showButtonShadow && GUILayout.Button(EditorData.Instance.contentAddShadowHD, buttonAddComponentStyle)) + AddComponentToTargets(); + + DrawButtonAddComponentEffect(); + DrawButtonAddComponentTriggerZone(); + + bool showButtonTrackRealtime = m_Targets.HaveAll((VolumetricLightBeamHD beam) => { return beam.GetComponent() != null && beam.GetComponent() == null; }); + if (showButtonTrackRealtime && GUILayout.Button(EditorData.Instance.contentAddTrackRealtimeChangesOnLightHD, buttonAddComponentStyle)) + AddComponentToTargets(); + } + } + + protected virtual void OnSceneGUI() + { + DrawEditInSceneHandles(); + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD.cs.meta b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD.cs.meta new file mode 100644 index 00000000..8eef3985 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 55808f07a0c39974b9c12cfe0421e3e6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD2D.cs b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD2D.cs new file mode 100644 index 00000000..a9aa826a --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD2D.cs @@ -0,0 +1,47 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; +using System.Linq; + +namespace VLB +{ + [CustomEditor(typeof(VolumetricLightBeamHD2D))] + [CanEditMultipleObjects] + public class Editor_VolumetricLightBeamHD2D : Editor_VolumetricLightBeamHD + { + SerializedProperty m_SortingLayerID = null, m_SortingOrder = null; + string[] m_SortingLayerNames; + + TargetList m_Targets; + + protected override void OnEnable() + { + base.OnEnable(); + m_Targets = new TargetList(targets); + m_SortingLayerNames = SortingLayer.layers.Select(l => l.name).ToArray(); + } + + protected override void DrawProperties(bool hasLightSpot) + { + base.DrawProperties(hasLightSpot); + + if (FoldableHeader.Begin(this, EditorStrings.Beam.Header2D)) + { + DrawSortingLayerAndOrder(); + } + FoldableHeader.End(); + } + + void DrawSortingLayerAndOrder() + { + var updatedProperties = SortingLayerAndOrderDrawer.Draw(m_SortingLayerID, m_SortingOrder); + + if (updatedProperties.HasFlag(SortingLayerAndOrderDrawer.UpdatedProperties.SortingLayerID)) + m_Targets.RecordUndoAction("Edit Sorting Layer", (VolumetricLightBeamHD2D beam) => beam.sortingLayerID = m_SortingLayerID.intValue); // call setters + + if (updatedProperties.HasFlag(SortingLayerAndOrderDrawer.UpdatedProperties.SortingOrder)) + m_Targets.RecordUndoAction("Edit Sorting Order", (VolumetricLightBeamHD2D beam) => beam.sortingOrder = m_SortingOrder.intValue); // call setters + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD2D.cs.meta b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD2D.cs.meta new file mode 100644 index 00000000..970e01c1 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricLightBeamHD2D.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 92675a6e6f8c5444291f530d44f8067d +timeCreated: 1504689328 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricShadowHD.cs b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricShadowHD.cs new file mode 100644 index 00000000..fdece2df --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricShadowHD.cs @@ -0,0 +1,104 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace VLB +{ + [CustomEditor(typeof(VolumetricShadowHD))] + [CanEditMultipleObjects] + public class Editor_VolumetricShadowHD : Editor_CommonHD + { + SerializedProperty m_Strength = null; + SerializedProperty m_DepthMapResolution = null, m_LayerMask = null, m_UseOcclusionCulling = null; + SerializedProperty m_UpdateRate = null, m_WaitXFrames = null; + TargetList m_Targets; + + protected override void OnEnable() + { + base.OnEnable(); + m_Targets = new TargetList(targets); + } + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + bool shouldUpdateDepthCameraProperties = false; + + if (FoldableHeader.Begin(this, EditorStrings.Shadow.HeaderVisual)) + { + EditorGUILayout.Slider(m_Strength, Consts.Shadow.StrengthMin, Consts.Shadow.StrengthMax, EditorStrings.Shadow.Strength); + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Shadow.HeaderCamera)) + { + EditorGUI.BeginChangeCheck(); + { + EditorGUILayout.PropertyField(m_LayerMask, EditorStrings.Shadow.LayerMask); + + if (Config.Instance.geometryOverrideLayer == false) + { + EditorGUILayout.HelpBox(EditorStrings.Shadow.HelpOverrideLayer, MessageType.Warning); + } + else if (m_Targets.HasAtLeastOneTargetWith((VolumetricShadowHD comp) => { return comp.HasLayerMaskIssues(); })) + { + EditorGUILayout.HelpBox(EditorStrings.Shadow.HelpLayerMaskIssues, MessageType.Warning); + } + + EditorGUILayout.PropertyField(m_UseOcclusionCulling, EditorStrings.Shadow.OcclusionCulling); + } + if (EditorGUI.EndChangeCheck()) + { + shouldUpdateDepthCameraProperties = true; + } + + EditorGUI.BeginChangeCheck(); + { + EditorGUILayout.PropertyField(m_DepthMapResolution, EditorStrings.Shadow.DepthMapResolution); + } + if (EditorGUI.EndChangeCheck()) + { + if (Application.isPlaying) + { + Debug.LogErrorFormat(Consts.Shadow.GetErrorChangeRuntimeDepthMapResolution(m_Targets[0])); + } + } + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Shadow.HeaderUpdateRate)) + { + m_UpdateRate.CustomEnum(EditorStrings.Shadow.UpdateRate, EditorStrings.Shadow.UpdateRateDescriptions); + + if (m_Targets.HasAtLeastOneTargetWith((VolumetricShadowHD comp) => { return comp.updateRate.HasFlag(ShadowUpdateRate.EveryXFrames); })) + { + EditorGUILayout.PropertyField(m_WaitXFrames, EditorStrings.Shadow.WaitXFrames); + } + + EditorGUILayout.HelpBox( + string.Format(EditorStrings.Shadow.GetUpdateRateAdvice(m_Targets[0].updateRate), m_Targets[0].waitXFrames), + MessageType.Info); + } + + FoldableHeader.End(); + + DrawInfos(); + + serializedObject.ApplyModifiedProperties(); + + if (shouldUpdateDepthCameraProperties) + { + foreach (var target in m_Targets) target.UpdateDepthCameraProperties(); + } + } + + protected override void GetInfoTips(List tips) + { + if (m_Targets.HasAtLeastOneTargetWith((VolumetricShadowHD comp) => { return comp.GetComponent().jitteringFactor == 0.0f; })) + tips.Add(new InfoTip { type = MessageType.Info, message = EditorStrings.Beam.HD.TipJittering }); + base.GetInfoTips(tips); + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricShadowHD.cs.meta b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricShadowHD.cs.meta new file mode 100644 index 00000000..99444561 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/HD/Editor_VolumetricShadowHD.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b011c09b423a06e49976d4d71ef5b553 +timeCreated: 1614360514 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons.meta b/Assets/External/VolumetricLightBeam/Editor/Icons.meta new file mode 100644 index 00000000..de2aa695 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9dedb0a098aa6d54ca26c9e18517d37c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_button.png b/Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_button.png new file mode 100644 index 00000000..144d6411 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_button.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7a0d37f5886f9ac56e350da7fe119e869056c1306b2795c663f7073c983fde4 +size 1570 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_button.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_button.png.meta new file mode 100644 index 00000000..933da30a --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_button.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: c0b232bfb34a77a4a84fdc476cfedea4 +timeCreated: 1617797074 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_icon.png b/Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_icon.png new file mode 100644 index 00000000..c5bec56e --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15467dd70425e74ce7fdf7907d2fd720ba18026057b5b4781fe6f27094d21986 +size 10970 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_icon.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_icon.png.meta new file mode 100644 index 00000000..97076237 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/DynamicOcclusion_icon.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: f4140fedf3f72d7448a4e55ea9db44ab +timeCreated: 1513615323 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/Effect_button.png b/Assets/External/VolumetricLightBeam/Editor/Icons/Effect_button.png new file mode 100644 index 00000000..240b82eb --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/Effect_button.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:99e53575122b91ae838aedd48b74bc63c124f574b68bd320a2d02862bd702585 +size 1639 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/Effect_button.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/Effect_button.png.meta new file mode 100644 index 00000000..330cb83e --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/Effect_button.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: 1a5ba5df396106d4cafd5a96415ffb6c +timeCreated: 1617798010 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/Effect_icon.png b/Assets/External/VolumetricLightBeam/Editor/Icons/Effect_icon.png new file mode 100644 index 00000000..d77aa1a9 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/Effect_icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59b0c8abbd84a33b3f2c4cd0052388b200b10d032f9d4226ab214b1b535c547a +size 12033 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/Effect_icon.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/Effect_icon.png.meta new file mode 100644 index 00000000..1dbdc945 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/Effect_icon.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: 6dfec383bc9ad504891027fdab8062b1 +timeCreated: 1617798010 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/FromSpotLight_button.png b/Assets/External/VolumetricLightBeam/Editor/Icons/FromSpotLight_button.png new file mode 100644 index 00000000..059bbf27 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/FromSpotLight_button.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:375a91ceb36cc4432c5f94d587eb60856868b1114c6b32cc0a659cd01383bc70 +size 1269 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/FromSpotLight_button.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/FromSpotLight_button.png.meta new file mode 100644 index 00000000..666a18df --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/FromSpotLight_button.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: 350d4bb70b7205342aefcb03e66a7dcb +timeCreated: 1617992244 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/SkewingHandle_icon.png b/Assets/External/VolumetricLightBeam/Editor/Icons/SkewingHandle_icon.png new file mode 100644 index 00000000..a1d580bd --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/SkewingHandle_icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc2f36406c168040cb605a2d5aee9edc447f78233b44b6aeb3f8c2eda8773507 +size 8925 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/SkewingHandle_icon.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/SkewingHandle_icon.png.meta new file mode 100644 index 00000000..b4a4c09a --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/SkewingHandle_icon.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: 96c382e4368041b4aad93aed0a833e2b +timeCreated: 1617808226 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_button.png b/Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_button.png new file mode 100644 index 00000000..247df2d8 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_button.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47e7a9e975d8e9e3e64b9dcb3cec06a55a19a6d7aaa6f4d3e78ec958f8f8d3f2 +size 1508 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_button.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_button.png.meta new file mode 100644 index 00000000..10c9ae27 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_button.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: c7101e7dd11772c44b7977bcc3d30042 +timeCreated: 1617796383 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_icon.png b/Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_icon.png new file mode 100644 index 00000000..2d32d82b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c04782ddb48822ee089fc979a1ae687ad63246813de25641963b0baf34269009 +size 10480 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_icon.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_icon.png.meta new file mode 100644 index 00000000..42005019 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/TrackRealtimeChangesOnLight_icon.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: 92cd5f0496b5c33418ef9b57bb0a7e7b +timeCreated: 1531459068 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_button.png b/Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_button.png new file mode 100644 index 00000000..267c3cbd --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_button.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ec5c9d3039eb1cd88ffa775aca49626054d0f21c595c41dd29618efba9a16d6 +size 1551 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_button.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_button.png.meta new file mode 100644 index 00000000..4cba4229 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_button.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: 3fcfb96a95b4b82439ae47f4f060137c +timeCreated: 1617796383 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_icon.png b/Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_icon.png new file mode 100644 index 00000000..14e80689 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1388cd0cb590aad6c0eec94ccdf6c9664de4cf203fef9a9388416ae14d9effe1 +size 10872 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_icon.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_icon.png.meta new file mode 100644 index 00000000..b22a5074 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/TriggerZone_icon.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: 568401c2857b94943af27dc14afca0ae +timeCreated: 1531459068 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_button.png b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_button.png new file mode 100644 index 00000000..b692b1e7 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_button.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:457a2f19a4098b2bc462b0226fe5f7d06cfa2b4e7cd579ab124da5041b39f999 +size 1582 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_button.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_button.png.meta new file mode 100644 index 00000000..234becb8 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_button.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: dbfd5683708f62f4a88afbd49cb649a4 +timeCreated: 1617798010 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_icon.png b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_icon.png new file mode 100644 index 00000000..e7b53063 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f02870734a573bdcff6d47c1c46bcf13282c79957b0e8662c391d5f59cbd778f +size 11388 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_icon.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_icon.png.meta new file mode 100644 index 00000000..0b9494e5 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricCookie_icon.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: cc27b1da0fcf63b40bfa30f6d7317bc1 +timeCreated: 1617798010 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_button.png b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_button.png new file mode 100644 index 00000000..c11b4e8e --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_button.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d1ff730a4fe936b93fda7c0e0b870fdf63ec3628599fc4d2e681886462f291c +size 1454 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_button.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_button.png.meta new file mode 100644 index 00000000..05f5bd72 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_button.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: eae0c95c9c12c4e40a87d028b6e5aaad +timeCreated: 1617781625 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_icon.png b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_icon.png new file mode 100644 index 00000000..ee04087b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a9133909bc76d08a25ae18cb76a2ac684d1fb9d1d1b65e22d6cff5ebcb7f913 +size 10117 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_icon.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_icon.png.meta new file mode 100644 index 00000000..f4ee5631 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricDustParticles_icon.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: 54d50eb83191723439a591eeeb0eab84 +timeCreated: 1617781142 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricLightBeam_icon.png b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricLightBeam_icon.png new file mode 100644 index 00000000..4583c46c --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricLightBeam_icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ee33144e67bce6ae70ce3da10fa2bfe370e9a273c064400cef9c912856918f5 +size 28692 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricLightBeam_icon.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricLightBeam_icon.png.meta new file mode 100644 index 00000000..235f92a3 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricLightBeam_icon.png.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: 837747a8b63291a48838c340da834873 +timeCreated: 1507401784 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_button.png b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_button.png new file mode 100644 index 00000000..144d6411 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_button.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7a0d37f5886f9ac56e350da7fe119e869056c1306b2795c663f7073c983fde4 +size 1570 diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_button.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_button.png.meta new file mode 100644 index 00000000..6741eb1b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_button.png.meta @@ -0,0 +1,110 @@ +fileFormatVersion: 2 +guid: efed7519f7ad1054aa787834f3c3344d +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: 1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_icon.png b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_icon.png new file mode 100644 index 00000000..c5bec56e --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15467dd70425e74ce7fdf7907d2fd720ba18026057b5b4781fe6f27094d21986 +size 10970 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/icon.png.meta b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_icon.png.meta similarity index 81% rename from Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/icon.png.meta rename to Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_icon.png.meta index d5255918..6bac843b 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/icon.png.meta +++ b/Assets/External/VolumetricLightBeam/Editor/Icons/VolumetricShadow_icon.png.meta @@ -1,9 +1,9 @@ fileFormatVersion: 2 -guid: 6daa87e2aaa1bb04d930ca4b4bc926a7 +guid: 88e1a1651b6b6994b8c93fb42aec5383 TextureImporter: - internalIDToNameTable: [] + fileIDToRecycleName: {} externalObjects: {} - serializedVersion: 10 + serializedVersion: 9 mipmaps: mipMapMode: 0 enableMipMap: 1 @@ -31,16 +31,16 @@ TextureImporter: maxTextureSize: 2048 textureSettings: serializedVersion: 2 - filterMode: -1 + filterMode: 2 aniso: 1 mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 + wrapU: 1 + wrapV: 1 + wrapW: 1 nPOTScale: 0 lightmap: 0 compressionQuality: 50 - spriteMode: 1 + spriteMode: 0 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 @@ -80,19 +80,28 @@ TextureImporter: allowsAlphaSplitting: 0 overridden: 0 androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] physicsShape: [] bones: [] - spriteID: ea6ccb6043e0b05449baf0ac8d87f817 - internalID: 0 + spriteID: vertices: [] indices: edges: [] weights: [] - secondaryTextures: [] spritePackingTag: pSDRemoveMatte: 0 pSDShowRemoveMatteOption: 0 diff --git a/Assets/External/VolumetricLightBeam/Editor/OnBuildPostprocess.cs b/Assets/External/VolumetricLightBeam/Editor/OnBuildPostprocess.cs new file mode 100644 index 00000000..b55c04a1 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/OnBuildPostprocess.cs @@ -0,0 +1,15 @@ +#if UNITY_EDITOR && UNITY_2018_1_OR_NEWER +using UnityEditor; +using UnityEditor.Build; +using UnityEditor.Build.Reporting; +using UnityEngine; + +class OnBuildPostprocess : IPostprocessBuildWithReport +{ + public int callbackOrder { get { return 0; } } + public void OnPostprocessBuild(BuildReport report) + { + VLB.PlatformHelper.SetBuildTargetOverride(BuildTarget.NoTarget); + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/OnBuildPostprocess.cs.meta b/Assets/External/VolumetricLightBeam/Editor/OnBuildPostprocess.cs.meta new file mode 100644 index 00000000..871ee4fc --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/OnBuildPostprocess.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f6591152e52a89a4dba853ddca8c00f6 +timeCreated: 1612121684 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/OnBuildPreprocess.cs b/Assets/External/VolumetricLightBeam/Editor/OnBuildPreprocess.cs new file mode 100644 index 00000000..815b1750 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/OnBuildPreprocess.cs @@ -0,0 +1,16 @@ +#if UNITY_EDITOR && UNITY_2018_1_OR_NEWER +using UnityEditor; +using UnityEditor.Build; +using UnityEditor.Build.Reporting; +using UnityEngine; + +class OnBuildPreprocess : IPreprocessBuildWithReport +{ + public int callbackOrder { get { return 0; } } + public void OnPreprocessBuild(BuildReport report) + { + VLB.PlatformHelper.SetBuildTargetOverride(report.summary.platform); + VLB.Config.Instance.SetScriptingDefineSymbolsForCurrentRenderPipeline(); + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/OnBuildPreprocess.cs.meta b/Assets/External/VolumetricLightBeam/Editor/OnBuildPreprocess.cs.meta new file mode 100644 index 00000000..1e526db2 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/OnBuildPreprocess.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9b7dc575bd0b12c449148d07bc32fe49 +timeCreated: 1612121684 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/OnBuildTargetChanged.cs b/Assets/External/VolumetricLightBeam/Editor/OnBuildTargetChanged.cs new file mode 100644 index 00000000..ed20b5df --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/OnBuildTargetChanged.cs @@ -0,0 +1,20 @@ +#if UNITY_EDITOR && UNITY_2018_1_OR_NEWER +using UnityEngine; +using UnityEditor; +using UnityEditor.Build; + +namespace VLB +{ + public class ActiveBuildTargetListener : IActiveBuildTargetChanged + { + public int callbackOrder { get { return 0; } } + public void OnActiveBuildTargetChanged(BuildTarget previousTarget, BuildTarget newTarget) + { + Config.Instance.RefreshShaders(Config.RefreshShaderFlags.All); + Config.Instance.SetScriptingDefineSymbolsForCurrentRenderPipeline(); + GlobalMeshSD.Destroy(); + Utils._EditorSetAllMeshesDirty(); + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/OnBuildTargetChanged.cs.meta b/Assets/External/VolumetricLightBeam/Editor/OnBuildTargetChanged.cs.meta new file mode 100644 index 00000000..3553704c --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/OnBuildTargetChanged.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f54417ff4a50cfb4ba556d04b6689eab +timeCreated: 1612121684 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/RenderQueueDrawer.cs b/Assets/External/VolumetricLightBeam/Editor/RenderQueueDrawer.cs new file mode 100644 index 00000000..42006435 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/RenderQueueDrawer.cs @@ -0,0 +1,67 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; + +namespace VLB +{ + class RenderQueueDrawer + { + bool isPropValueInEnumList + { + get + { + foreach (RenderQueue rq in System.Enum.GetValues(typeof(RenderQueue))) + { + if (rq != RenderQueue.Custom && m_Prop.intValue == (int)rq) + return true; + } + return false; + } + } + + public RenderQueueDrawer(SerializedProperty sprop) + { + Debug.Assert(sprop != null); + m_Prop = sprop; + m_IsRenderQueueCustom = !isPropValueInEnumList; + } + + public void Draw(GUIContent label) + { + using (new EditorGUILayout.HorizontalScope()) + { + EditorGUI.BeginChangeCheck(); + { + EditorGUI.BeginChangeCheck(); + + if (!m_IsRenderQueueCustom && !isPropValueInEnumList) + m_IsRenderQueueCustom = true; // handle proper dropbox change to "custom" when resetting Config to default values + + RenderQueue rq = m_IsRenderQueueCustom ? RenderQueue.Custom : (RenderQueue)m_Prop.intValue; + rq = (RenderQueue)EditorGUILayout.EnumPopup(label, rq); + if (EditorGUI.EndChangeCheck()) + { + m_IsRenderQueueCustom = (rq == RenderQueue.Custom); + + if (!m_IsRenderQueueCustom) + m_Prop.intValue = (int)rq; + } + + EditorGUI.BeginDisabledGroup(!m_IsRenderQueueCustom); + { + m_Prop.intValue = EditorGUILayout.IntField(m_Prop.intValue, GUILayout.MaxWidth(65.0f)); + } + EditorGUI.EndDisabledGroup(); + } + if (EditorGUI.EndChangeCheck()) + { + Utils._EditorSetAllBeamGeomDirty(); // TODO switch sd / hd ? + } + } + } + + SerializedProperty m_Prop; + bool m_IsRenderQueueCustom = false; + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/RenderQueueDrawer.cs.meta b/Assets/External/VolumetricLightBeam/Editor/RenderQueueDrawer.cs.meta new file mode 100644 index 00000000..47f695b6 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/RenderQueueDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e021c10e47c09b64e977dbc0de5bff22 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources.meta b/Assets/External/VolumetricLightBeam/Editor/Resources.meta similarity index 77% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources.meta rename to Assets/External/VolumetricLightBeam/Editor/Resources.meta index 02949c25..a67bf9e9 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources.meta +++ b/Assets/External/VolumetricLightBeam/Editor/Resources.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2ad43aa805fd6dd44a59e307ed9aa4bc +guid: 47da327390025e44eaa9d73a65a256c7 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/External/VolumetricLightBeam/Editor/Resources/VLBEditorData.asset b/Assets/External/VolumetricLightBeam/Editor/Resources/VLBEditorData.asset new file mode 100644 index 00000000..d5876b5b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Resources/VLBEditorData.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7bd4680a181ce5f6959cfb7c0175770bd4ba8c661c11ca5b8801150971a88abe +size 1185 diff --git a/Assets/External/VolumetricLightBeam/Editor/Resources/VLBEditorData.asset.meta b/Assets/External/VolumetricLightBeam/Editor/Resources/VLBEditorData.asset.meta new file mode 100644 index 00000000..3428a4ad --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/Resources/VLBEditorData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8979130d593fc654f8d175cfe9729e82 +timeCreated: 1617863368 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/SD.meta b/Assets/External/VolumetricLightBeam/Editor/SD.meta new file mode 100644 index 00000000..b0ef4a54 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SD.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 45a369b8973058c40817b12ec35060c9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/SD/Editor_CommonSD.cs b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_CommonSD.cs new file mode 100644 index 00000000..62fabd4b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_CommonSD.cs @@ -0,0 +1,14 @@ +#if UNITY_EDITOR +namespace VLB +{ + public class Editor_CommonSD : Editor_Common + { + protected override void OnEnable() + { + base.OnEnable(); + RetrieveSerializedProperties("_"); + } + } +} +#endif // UNITY_EDITOR + diff --git a/Assets/External/VolumetricLightBeam/Editor/SD/Editor_CommonSD.cs.meta b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_CommonSD.cs.meta new file mode 100644 index 00000000..552846d4 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_CommonSD.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: de0354a8f662c4649a2aee6dbd130cd2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionAbstractBase.cs b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionAbstractBase.cs new file mode 100644 index 00000000..8d96fdc8 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionAbstractBase.cs @@ -0,0 +1,51 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; + +namespace VLB +{ + public class Editor_DynamicOcclusionAbstractBase : Editor_CommonSD where T : DynamicOcclusionAbstractBase + { + SerializedProperty updateRate = null; + SerializedProperty waitXFrames = null; + protected TargetList m_Targets; + + protected override void OnEnable() + { + base.OnEnable(); + m_Targets = new TargetList(targets); + } + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + if (!Config.Instance.featureEnabledDynamicOcclusion) + { + EditorGUILayout.HelpBox(EditorStrings.DynOcclusion.HelpFeatureDisabled, MessageType.Warning); + } + } + + protected void DisplayCommonInspector() + { + if (FoldableHeader.Begin(this, EditorStrings.DynOcclusion.HeaderUpdateRate)) + { + updateRate.CustomEnum(EditorStrings.DynOcclusion.UpdateRate, EditorStrings.DynOcclusion.UpdateRateDescriptions); + + if (m_Targets.HasAtLeastOneTargetWith((T comp) => { return comp.updateRate.HasFlag(DynamicOcclusionUpdateRate.EveryXFrames); })) + { + EditorGUILayout.PropertyField(waitXFrames, EditorStrings.DynOcclusion.WaitXFrames); + } + + EditorGUILayout.HelpBox( + string.Format(EditorStrings.DynOcclusion.GetUpdateRateAdvice(m_Targets[0].updateRate), m_Targets[0].waitXFrames), + MessageType.Info); + } + + FoldableHeader.End(); + + serializedObject.ApplyModifiedProperties(); + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionAbstractBase.cs.meta b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionAbstractBase.cs.meta new file mode 100644 index 00000000..87126bb2 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionAbstractBase.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0192ed587a87bfb41b9ec2ac3f6098e2 +timeCreated: 1580771203 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionDepthBuffer.cs b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionDepthBuffer.cs new file mode 100644 index 00000000..5a026a27 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionDepthBuffer.cs @@ -0,0 +1,55 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; + +namespace VLB +{ + [CustomEditor(typeof(DynamicOcclusionDepthBuffer))] + [CanEditMultipleObjects] + public class Editor_DynamicOcclusionDepthBuffer : Editor_DynamicOcclusionAbstractBase + { + SerializedProperty depthMapResolution = null; + SerializedProperty layerMask = null; + SerializedProperty useOcclusionCulling = null; + SerializedProperty fadeDistanceToSurface = null; + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + if (m_Targets.HasAtLeastOneTargetWith((DynamicOcclusionDepthBuffer comp) => { return comp.GetComponent().dimensions == Dimensions.Dim2D; })) + { + EditorGUILayout.HelpBox(EditorStrings.DynOcclusion.HelpDepthBufferAndBeam2D, MessageType.Warning); + } + + if (FoldableHeader.Begin(this, EditorStrings.DynOcclusion.HeaderCamera)) + { + EditorGUILayout.PropertyField(layerMask, EditorStrings.DynOcclusion.LayerMask); + + if(Config.Instance.geometryOverrideLayer == false) + { + EditorGUILayout.HelpBox(EditorStrings.DynOcclusion.HelpOverrideLayer, MessageType.Warning); + } + else if (m_Targets.HasAtLeastOneTargetWith((DynamicOcclusionDepthBuffer comp) => { return comp.HasLayerMaskIssues(); })) + { + EditorGUILayout.HelpBox(EditorStrings.DynOcclusion.HelpLayerMaskIssues, MessageType.Warning); + } + + EditorGUILayout.PropertyField(useOcclusionCulling, EditorStrings.DynOcclusion.DepthBufferOcclusionCulling); + EditorGUILayout.PropertyField(depthMapResolution, EditorStrings.DynOcclusion.DepthBufferDepthMapResolution); + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.DynOcclusion.HeaderOccluderSurface)) + { + EditorGUILayout.PropertyField(fadeDistanceToSurface, EditorStrings.DynOcclusion.FadeDistanceToSurface); + } + FoldableHeader.End(); + + DisplayCommonInspector(); + + serializedObject.ApplyModifiedProperties(); + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionDepthBuffer.cs.meta b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionDepthBuffer.cs.meta new file mode 100644 index 00000000..e2dce92b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionDepthBuffer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: cd6cc47c61bc28e4fb4568a2e48d1c32 +timeCreated: 1578172705 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionRaycasting.cs b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionRaycasting.cs new file mode 100644 index 00000000..c1efea45 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionRaycasting.cs @@ -0,0 +1,111 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; + +namespace VLB +{ + [CustomEditor(typeof(DynamicOcclusionRaycasting))] + [CanEditMultipleObjects] + public class Editor_DynamicOcclusionRaycasting : Editor_DynamicOcclusionAbstractBase + { + SerializedProperty dimensions = null; + SerializedProperty layerMask = null; + SerializedProperty considerTriggers = null; + SerializedProperty minOccluderArea = null; + SerializedProperty planeAlignment = null; + SerializedProperty maxSurfaceDot = null; + SerializedProperty planeOffset = null; + SerializedProperty fadeDistanceToSurface = null; + SerializedProperty minSurfaceRatio = null; + + public override bool RequiresConstantRepaint() { return Application.isPlaying || DynamicOcclusionRaycasting.editorRaycastAtEachFrame; } + + protected override void OnEnable() + { + base.OnEnable(); + DynamicOcclusionRaycasting.EditorLoadPrefs(); + } + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + if (FoldableHeader.Begin(this, EditorStrings.DynOcclusion.HeaderRaycasting)) + { + dimensions.CustomEnum(EditorStrings.DynOcclusion.Dimensions, EditorStrings.Common.DimensionsEnumDescriptions); + EditorGUILayout.PropertyField(layerMask, EditorStrings.DynOcclusion.LayerMask); + EditorGUILayout.PropertyField(considerTriggers, EditorStrings.DynOcclusion.ConsiderTriggers); + + if (Physics2D.queriesHitTriggers == false) + { + if(m_Targets.HasAtLeastOneTargetWith((DynamicOcclusionRaycasting instance) => { return instance.dimensions == Dimensions.Dim2D && instance.considerTriggers; })) + { + EditorGUILayout.HelpBox(EditorStrings.DynOcclusion.ConsiderTriggersNoPossible, MessageType.Error); + } + } + + EditorGUILayout.PropertyField(minOccluderArea, EditorStrings.DynOcclusion.MinOccluderArea); + } + + FoldableHeader.End(); + + DisplayCommonInspector(); + + if (FoldableHeader.Begin(this, EditorStrings.DynOcclusion.HeaderOccluderSurface)) + { + minSurfaceRatio.FloatSlider( + EditorStrings.DynOcclusion.MinSurfaceRatio, + Consts.DynOcclusion.RaycastingMinSurfaceRatioMin, Consts.DynOcclusion.RaycastingMinSurfaceRatioMax, + (value) => value * 100f, // conversion value to slider + (value) => value / 100f // conversion slider to value + ); + + maxSurfaceDot.FloatSlider( + EditorStrings.DynOcclusion.MaxSurfaceDot, + Consts.DynOcclusion.RaycastingMaxSurfaceAngleMin, Consts.DynOcclusion.RaycastingMaxSurfaceAngleMax, + (value) => Mathf.Acos(value) * Mathf.Rad2Deg, // conversion value to slider + (value) => Mathf.Cos(value * Mathf.Deg2Rad) // conversion slider to value + ); + } + + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.DynOcclusion.HeaderClippingPlane)) + { + EditorGUILayout.PropertyField(planeAlignment, EditorStrings.DynOcclusion.PlaneAlignment); + EditorGUILayout.PropertyField(planeOffset, EditorStrings.DynOcclusion.PlaneOffset); + EditorGUILayout.PropertyField(fadeDistanceToSurface, EditorStrings.DynOcclusion.FadeDistanceToSurface); + } + + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.DynOcclusion.HeaderEditorDebug)) + { + using (new EditorGUILayout.HorizontalScope()) + { + EditorExtensions.GlobalToggleButton(ref DynamicOcclusionRaycasting.editorShowDebugPlane, EditorStrings.DynOcclusion.EditorShowDebugPlane, EditorPrefsStrings.DynOcclusion.PrefShowDebugPlane); + EditorExtensions.GlobalToggleButton(ref DynamicOcclusionRaycasting.editorRaycastAtEachFrame, EditorStrings.DynOcclusion.EditorRaycastAtEachFrame, EditorPrefsStrings.DynOcclusion.PrefRaycastingEditor); + } + + if (Application.isPlaying || DynamicOcclusionRaycasting.editorRaycastAtEachFrame) + { + if (!serializedObject.isEditingMultipleObjects) + { + var instance = (target as DynamicOcclusionRaycasting); + Debug.Assert(instance); + var hit = instance.editorCurrentHitResult; + var lastFrameUpdate = instance.editorDebugData.lastFrameUpdate; + + var occluderInfo = string.Format("Last update {0} frame(s) ago\n", Time.frameCount - lastFrameUpdate); + occluderInfo += (hit.hasCollider) ? string.Format("Current occluder: '{0}'\nEstimated occluder area: {1} units²", hit.name, hit.bounds.GetMaxArea2D()) : "No occluder found"; + EditorGUILayout.HelpBox(occluderInfo, MessageType.Info); + } + } + } + FoldableHeader.End(); + + serializedObject.ApplyModifiedProperties(); + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionRaycasting.cs.meta b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionRaycasting.cs.meta new file mode 100644 index 00000000..b751d3e1 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_DynamicOcclusionRaycasting.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 296c1775a3a72104091469b9f856ae7b +timeCreated: 1508778801 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/SD/Editor_SkewingHandleSD.cs b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_SkewingHandleSD.cs new file mode 100644 index 00000000..dad3c8af --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_SkewingHandleSD.cs @@ -0,0 +1,47 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; + +namespace VLB +{ + [CustomEditor(typeof(SkewingHandleSD))] + public class Editor_SkewingHandleSD : Editor_CommonSD + { + SerializedProperty volumetricLightBeam = null; + SerializedProperty shouldUpdateEachFrame = null; + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + var thisTarget = target as SkewingHandleSD; + if (thisTarget == null) + return; + + if(Config.Instance.featureEnabledMeshSkewing == false) + EditorGUILayout.HelpBox(EditorStrings.SkewingHandle.HelpFeatureDisabled, MessageType.Warning); + + EditorGUILayout.PropertyField(volumetricLightBeam, EditorStrings.SkewingHandle.Beam); + EditorGUILayout.PropertyField(shouldUpdateEachFrame, EditorStrings.SkewingHandle.ShouldUpdateEachFrame); + + if (thisTarget.volumetricLightBeam) + { + if(thisTarget.IsAttachedToSelf()) + { + EditorGUILayout.HelpBox(EditorStrings.SkewingHandle.ErrorAttachedToSelf, MessageType.Error); + } + else if (!thisTarget.CanSetSkewingVector()) + { + EditorGUILayout.HelpBox(EditorStrings.SkewingHandle.ErrorCannotSkew, MessageType.Error); + } + else if (thisTarget.shouldUpdateEachFrame && !thisTarget.CanUpdateEachFrame()) + { + EditorGUILayout.HelpBox(EditorStrings.SkewingHandle.ErrorCannotUpdate, MessageType.Error); + } + } + serializedObject.ApplyModifiedProperties(); + } + } +} +#endif + diff --git a/Assets/External/VolumetricLightBeam/Editor/SD/Editor_SkewingHandleSD.cs.meta b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_SkewingHandleSD.cs.meta new file mode 100644 index 00000000..4c5bb12c --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_SkewingHandleSD.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f95e2188469d17a4081bb82c36e6e8de +timeCreated: 1604927219 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/SD/Editor_VolumetricLightBeamSD.cs b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_VolumetricLightBeamSD.cs new file mode 100644 index 00000000..07fd3c22 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_VolumetricLightBeamSD.cs @@ -0,0 +1,562 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; +using UnityEditor.IMGUI.Controls; +using System.Collections.Generic; +using System.Linq; + +#pragma warning disable 0429, 0162 // Unreachable expression code detected (because of Noise3D.isSupported on mobile) + +namespace VLB +{ + [CustomEditor(typeof(VolumetricLightBeamSD))] + [CanEditMultipleObjects] + public class Editor_VolumetricLightBeamSD : Editor_VolumetricLightBeamAbstractBase + { + SerializedProperty trackChangesDuringPlaytime = null; + SerializedProperty colorFromLight = null, colorMode = null, color = null, colorGradient = null; + SerializedProperty intensityFromLight = null, intensityModeAdvanced = null, intensityInside = null, intensityOutside = null, intensityMultiplier = null; + SerializedProperty blendingMode = null, shaderAccuracy = null; + SerializedProperty fresnelPow = null, glareFrontal = null, glareBehind = null; + SerializedProperty spotAngleFromLight = null, spotAngle = null, spotAngleMultiplier = null; + SerializedProperty coneRadiusStart = null, geomMeshType = null, geomCustomSides = null, geomCustomSegments = null, geomCap = null; + SerializedProperty fallOffEndFromLight = null, fallOffStart = null, fallOffEnd = null, fallOffEndMultiplier = null; + SerializedProperty attenuationEquation = null, attenuationCustomBlending = null; + SerializedProperty depthBlendDistance = null, cameraClippingDistance = null; + SerializedProperty noiseMode = null, noiseIntensity = null, noiseScaleUseGlobal = null, noiseScaleLocal = null, noiseVelocityUseGlobal = null, noiseVelocityLocal = null; + SerializedProperty fadeOutBegin = null, fadeOutEnd = null; + SerializedProperty dimensions = null, sortingLayerID = null, sortingOrder = null; + SerializedProperty skewingLocalForwardDirection = null, clippingPlaneTransform = null, tiltFactor = null; + SerializedProperty hdrpExposureWeight = null; + + TargetList m_Targets; + string[] m_SortingLayerNames; + + protected override void OnEnable() + { + base.OnEnable(); + RetrieveSerializedProperties("_"); + + m_SortingLayerNames = SortingLayer.layers.Select(l => l.name).ToArray(); + m_Targets = new TargetList(targets); + } + + static void PropertyThickness(SerializedProperty sp) + { + sp.FloatSlider( + EditorStrings.Beam.SD.SideThickness, + 0, 1, + (value) => Mathf.Clamp01(1 - (value / Consts.Beam.SD.FresnelPowMaxValue)), // conversion value to slider + (value) => (1 - value) * Consts.Beam.SD.FresnelPowMaxValue // conversion slider to value + ); + } + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + Debug.Assert(m_Targets.Count > 0); + +#if VLB_DEBUG + if (m_Targets.Count == 1) + { + string msg = ""; + var geom = m_Targets[0].GetComponentInChildren(); + if (geom == null) + msg = "No BeamGeometry"; + else + msg = string.Format("Material: {0} | ID: {1} / {2}" + , geom._EDITOR_IsUsingCustomMaterial ? "CUSTOM" : "INSTANCED" + , geom._EDITOR_InstancedMaterialID + , MaterialManager.StaticPropertiesSD.staticPropertiesCount); + EditorGUILayout.LabelField(msg); + } +#endif // VLB_DEBUG + + VolumetricLightBeamSD.AttachedLightType lightType; + bool hasLightSpot = m_Targets[0].GetLightSpotAttachedSlow(out lightType) != null; + if (lightType == VolumetricLightBeamSD.AttachedLightType.OtherLight) + { + EditorGUILayout.HelpBox(EditorStrings.Beam.HelpNoSpotlight, MessageType.Warning); + } + + if (FoldableHeader.Begin(this, EditorStrings.Beam.HeaderBasic)) + { + // Color + using (ButtonToggleScope.FromLight(colorFromLight, hasLightSpot)) + { + if (!hasLightSpot) EditorGUILayout.BeginHorizontal(); // mandatory to have the color picker on the same line (when the button "from light" is not here) + { + if (Config.Instance.featureEnabledColorGradient == FeatureEnabledColorGradient.Off) + { + EditorGUILayout.PropertyField(color, EditorStrings.Beam.ColorMode); + } + else + { + using (new EditorExtensions.LabelWidth(65f)) + { + EditorGUILayout.PropertyField(colorMode, EditorStrings.Beam.ColorMode); + } + + if (colorMode.enumValueIndex == (int)ColorMode.Gradient) + EditorGUILayout.PropertyField(colorGradient, EditorStrings.Beam.ColorGradient); + else + EditorGUILayout.PropertyField(color, EditorStrings.Beam.ColorFlat); + } + } + if (!hasLightSpot) EditorGUILayout.EndHorizontal(); + } + + // Blending Mode + EditorGUILayout.PropertyField(blendingMode, EditorStrings.Beam.BlendingMode); + + EditorGUILayout.Separator(); + + // Intensity + bool advancedModeEnabled = false; + using (var lightDisabledGrp = ButtonToggleScope.FromLight(intensityFromLight, hasLightSpot)) + { + bool advancedModeButton = !hasLightSpot || intensityFromLight.HasAtLeastOneValue(false); + using (ButtonToggleScope.Advanced(intensityModeAdvanced, advancedModeButton)) + { + advancedModeEnabled = intensityModeAdvanced.HasAtLeastOneValue(true); + using (new EditorGUILayout.HorizontalScope()) + { + if (m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamSD beam) => { return beam.useIntensityFromAttachedLightSpot; })) + { + using (new EditorExtensions.ShowMixedValue(intensityOutside)) + { + // display grayed out Unity's light intensity + EditorGUILayout.FloatField(EditorStrings.Beam.SD.IntensityGlobal, SpotLightHelper.GetIntensity(m_Targets[0].lightSpotAttached)); + } + + lightDisabledGrp?.EndDisabledGroup(); // muliplier factor should be available + DrawMultiplierProperty(intensityMultiplier, EditorStrings.Beam.IntensityMultiplier); // multiplier property + } + else + { + EditorGUILayout.PropertyField(intensityOutside, advancedModeEnabled ? EditorStrings.Beam.SD.IntensityOutside : EditorStrings.Beam.SD.IntensityGlobal); + } + } + } + } + + if (advancedModeEnabled) + EditorGUILayout.PropertyField(intensityInside, EditorStrings.Beam.SD.IntensityInside); + else + intensityInside.floatValue = intensityOutside.floatValue; + + if(Config.Instance.isHDRPExposureWeightSupported) + { + EditorGUILayout.PropertyField(hdrpExposureWeight, EditorStrings.Beam.HDRPExposureWeight); + } + + PropertyThickness(fresnelPow); + + EditorGUILayout.Separator(); + + EditorGUILayout.PropertyField(glareFrontal, EditorStrings.Beam.GlareFrontal); + EditorGUILayout.PropertyField(glareBehind, EditorStrings.Beam.GlareBehind); + + EditorGUILayout.Separator(); + + if (Config.Instance.featureEnabledShaderAccuracyHigh) + { + EditorGUILayout.PropertyField(shaderAccuracy, EditorStrings.Beam.ShaderAccuracy); + EditorGUILayout.Separator(); + } + + trackChangesDuringPlaytime.ToggleLeft(EditorStrings.Beam.TrackChanges); + DrawAnimatorWarning(); + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Beam.HeaderShape)) + { + // Fade End + using (var lightDisabledGrp = ButtonToggleScope.FromLight(fallOffEndFromLight, hasLightSpot)) + { + if (m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamSD beam) => { return beam.useFallOffEndFromAttachedLightSpot; })) + { + using (new EditorExtensions.ShowMixedValue(fallOffEnd)) + { + // display grayed out Unity's light range + EditorGUILayout.FloatField(EditorStrings.Beam.FallOffEnd, SpotLightHelper.GetFallOffEnd(m_Targets[0].lightSpotAttached)); + } + + lightDisabledGrp?.EndDisabledGroup(); // muliplier factor should be available + DrawMultiplierProperty(fallOffEndMultiplier, EditorStrings.Beam.FallOffEndMultiplier); // multiplier property + } + else + { + EditorGUILayout.PropertyField(fallOffEnd, EditorStrings.Beam.FallOffEnd); + } + } + + // Spot Angle + using (var lightDisabledGrp = ButtonToggleScope.FromLight(spotAngleFromLight, hasLightSpot)) + { + if (m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamSD beam) => { return beam.useSpotAngleFromAttachedLightSpot; })) + { + using (new EditorExtensions.ShowMixedValue(spotAngle)) + { + // display grayed out Unity's light angle + EditorGUILayout.FloatField(EditorStrings.Beam.SpotAngle, SpotLightHelper.GetSpotAngle(m_Targets[0].lightSpotAttached)); + } + + lightDisabledGrp?.EndDisabledGroup(); // muliplier factor should be available + DrawMultiplierProperty(spotAngleMultiplier, EditorStrings.Beam.SpotAngleMultiplier); // multiplier property + } + else + { + EditorGUILayout.Slider(spotAngle, Consts.Beam.SpotAngleMin, Consts.Beam.SpotAngleMax, EditorStrings.Beam.SpotAngle); + } + } + + using (new EditorGUILayout.HorizontalScope()) + { + EditorGUILayout.PropertyField(coneRadiusStart, EditorStrings.Beam.ConeRadiusStart); + EditorGUI.BeginChangeCheck(); + { + geomCap.ToggleLeft(EditorStrings.Beam.GeomCap, GUILayout.MaxWidth(42.0f)); + } + if (EditorGUI.EndChangeCheck()) { SetMeshesDirty(); } + } + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Beam.HeaderAttenuation)) + { + EditorGUILayout.BeginHorizontal(); + { + EditorGUILayout.PropertyField(attenuationEquation, EditorStrings.Beam.SD.AttenuationEquation); + if (attenuationEquation.enumValueIndex == (int)AttenuationEquation.Blend) + EditorGUILayout.PropertyField(attenuationCustomBlending, EditorStrings.Beam.SD.AttenuationCustomBlending); + } + EditorGUILayout.EndHorizontal(); + + if (fallOffEnd.hasMultipleDifferentValues) + EditorGUILayout.PropertyField(fallOffStart, EditorStrings.Beam.FallOffStart); + else + fallOffStart.FloatSlider(EditorStrings.Beam.FallOffStart, 0f, fallOffEnd.floatValue - Consts.Beam.FallOffDistancesMinThreshold); + + EditorGUILayout.Separator(); + + // Tilt + if (m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamSD beam) => { return beam.shaderAccuracy == ShaderAccuracy.High; })) + { + using (new EditorGUILayout.HorizontalScope()) + { + EditorGUILayout.PropertyField(tiltFactor, EditorStrings.Beam.SD.TiltFactor); + EditorExtensions.GlobalToggleButton(ref VolumetricLightBeamSD.editorShowTiltFactor, EditorStrings.Beam.SD.EditorShowTiltDirection, EditorPrefsStrings.Beam.PrefShowTiltDir, 50f); + } + } + + if (m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamSD beam) => { return beam.isTilted && beam.shaderAccuracy != ShaderAccuracy.High; })) + EditorGUILayout.HelpBox(EditorStrings.Beam.SD.HelpTiltedWithShaderAccuracyFast, MessageType.Warning); + } + FoldableHeader.End(); + + if (Config.Instance.featureEnabledNoise3D) + { + if (FoldableHeader.Begin(this, EditorStrings.Beam.Header3DNoise)) + { + noiseMode.CustomEnum(EditorStrings.Beam.NoiseMode, EditorStrings.Beam.NoiseModeEnumDescriptions); + + bool showNoiseProps = m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamSD beam) => { return beam.isNoiseEnabled; }); + if (showNoiseProps) + { + EditorGUILayout.PropertyField(noiseIntensity, EditorStrings.Beam.NoiseIntensity); + + using (new EditorGUILayout.HorizontalScope()) + { + using (new EditorGUI.DisabledGroupScope(noiseScaleUseGlobal.boolValue)) + { + EditorGUILayout.PropertyField(noiseScaleLocal, EditorStrings.Beam.NoiseScale); + } + noiseScaleUseGlobal.ToggleUseGlobalNoise(); + } + + using (new EditorGUILayout.HorizontalScope()) + { + using (new EditorGUI.DisabledGroupScope(noiseVelocityUseGlobal.boolValue)) + { + EditorGUILayout.PropertyField(noiseVelocityLocal, EditorStrings.Beam.NoiseVelocity); + } + noiseVelocityUseGlobal.ToggleUseGlobalNoise(); + } + + if (Noise3D.isSupported && !Noise3D.isProperlyLoaded) + EditorGUILayout.HelpBox(EditorStrings.Common.HelpNoiseLoadingFailed, MessageType.Error); + + if (!Noise3D.isSupported) + EditorGUILayout.HelpBox(Noise3D.isNotSupportedString, MessageType.Info); + } + } + FoldableHeader.End(); + } + + if(FoldableHeader.Begin(this, EditorStrings.Beam.HeaderBlendingDistances)) + { + { + var content = AddEnabledStatusToContentText(EditorStrings.Beam.CameraClippingDistance, cameraClippingDistance); + EditorGUILayout.PropertyField(cameraClippingDistance, content); + } + + { + var content = AddEnabledStatusToContentText(EditorStrings.Beam.DepthBlendDistance, depthBlendDistance); + EditorGUILayout.PropertyField(depthBlendDistance, content); + } + } + FoldableHeader.End(); + + if(FoldableHeader.Begin(this, EditorStrings.Beam.HeaderGeometry)) + { + EditorGUI.BeginChangeCheck(); + { + EditorGUILayout.PropertyField(geomMeshType, EditorStrings.Beam.GeomMeshType); + } + if (EditorGUI.EndChangeCheck()) { SetMeshesDirty(); } + + if (geomMeshType.intValue == (int)MeshType.Custom) + { + EditorGUI.indentLevel++; + + EditorGUI.BeginChangeCheck(); + { + EditorGUILayout.PropertyField(geomCustomSides, EditorStrings.Beam.GeomSides); + EditorGUILayout.PropertyField(geomCustomSegments, EditorStrings.Beam.GeomSegments); + } + if (EditorGUI.EndChangeCheck()) { SetMeshesDirty(); } + + if (Config.Instance.featureEnabledMeshSkewing) + { + var vec3 = skewingLocalForwardDirection.vector3Value; + var vec2 = Vector2.zero; + EditorGUI.BeginChangeCheck(); + { + vec2 = EditorGUILayout.Vector2Field(EditorStrings.Beam.SD.SkewingLocalForwardDirection, vec3.xy()); + } + if (EditorGUI.EndChangeCheck()) + { + vec3 = new Vector3(vec2.x, vec2.y, 1.0f); + skewingLocalForwardDirection.vector3Value = vec3; + SetMeshesDirty(); + } + } + + if (m_Targets.Count == 1) + { + EditorGUILayout.HelpBox(m_Targets[0].meshStats, MessageType.Info); + } + + EditorGUI.indentLevel--; + } + + using (new EditorGUILayout.HorizontalScope()) + { + EditorGUILayout.PropertyField(clippingPlaneTransform, EditorStrings.Beam.SD.ClippingPlane); + + if (m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamSD beam) => { return beam.clippingPlaneTransform != null; })) + { + EditorExtensions.GlobalToggleButton(ref VolumetricLightBeamSD.editorShowClippingPlane, EditorStrings.Beam.SD.EditorShowClippingPlane, EditorStrings.Beam.SD.PrefShowAddClippingPlane, 50f); + } + } + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Beam.HeaderFadeOut)) + { + bool wasEnabled = fadeOutBegin.floatValue <= fadeOutEnd.floatValue; + + if(m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamSD beam) => { return (beam.fadeOutBegin <= beam.fadeOutEnd) != wasEnabled; })) + { + wasEnabled = true; + EditorGUI.showMixedValue = true; + } + + System.Action setFadeOutBegin = value => + { + fadeOutBegin.floatValue = value; + m_Targets.RecordUndoAction("Change Fade Out Begin Distance", + (VolumetricLightBeamSD beam) => { beam.fadeOutBegin = value; }); + }; + + System.Action setFadeOutEnd = value => + { + fadeOutEnd.floatValue = value; + m_Targets.RecordUndoAction("Change Fade Out End Distance", + (VolumetricLightBeamSD beam) => { beam.fadeOutEnd = value; }); + }; + + EditorGUI.BeginChangeCheck(); + bool isEnabled = EditorGUILayout.Toggle(EditorStrings.Beam.FadeOutEnabled, wasEnabled); + EditorGUI.showMixedValue = false; + if (EditorGUI.EndChangeCheck()) + { + float invValue = isEnabled ? 1 : -1; + float valueA = Mathf.Abs(fadeOutBegin.floatValue); + float valueB = Mathf.Abs(fadeOutEnd.floatValue); + setFadeOutBegin(invValue * Mathf.Min(valueA, valueB)); + setFadeOutEnd (invValue * Mathf.Max(valueA, valueB)); + } + + if (isEnabled) + { + const float kEpsilon = 0.1f; + + using (new EditorGUILayout.HorizontalScope()) + { + EditorGUI.BeginChangeCheck(); + EditorGUILayout.PropertyField(fadeOutBegin, EditorStrings.Beam.FadeOutBegin); + if (EditorGUI.EndChangeCheck()) + { + setFadeOutBegin(Mathf.Clamp(fadeOutBegin.floatValue, 0, fadeOutEnd.floatValue - kEpsilon)); + } + + using (new EditorExtensions.LabelWidth(30f)) + { + EditorGUI.BeginChangeCheck(); + EditorGUILayout.PropertyField(fadeOutEnd, EditorStrings.Beam.FadeOutEnd); + if (EditorGUI.EndChangeCheck()) + { + setFadeOutEnd(Mathf.Max(fadeOutBegin.floatValue + kEpsilon, fadeOutEnd.floatValue)); + } + } + } + if (Application.isPlaying) + { + if(Config.Instance.fadeOutCameraTransform == null) + { + EditorGUILayout.HelpBox(EditorStrings.Beam.HelpFadeOutNoMainCamera, MessageType.Error); + } + } + } + } + FoldableHeader.End(); + + if (FoldableHeader.Begin(this, EditorStrings.Beam.Header2D)) + { + dimensions.CustomEnum(EditorStrings.Beam.Dimensions, EditorStrings.Common.DimensionsEnumDescriptions); + DrawSortingLayerAndOrder(); + } + FoldableHeader.End(); + + DrawInfos(); + DrawEditInSceneButton(); + DrawCustomActionButtons(); + DrawAdditionalFeatures(); + + serializedObject.ApplyModifiedProperties(); + } + + GUIContent AddEnabledStatusToContentText(GUIContent inContent, SerializedProperty prop) + { + Debug.Assert(prop.propertyType == SerializedPropertyType.Float); + + var content = new GUIContent(inContent); + if (prop.hasMultipleDifferentValues) + content.text += " (-)"; + else + content.text += prop.floatValue > 0.0 ? " (on)" : " (off)"; + return content; + } + + void SetMeshesDirty() + { + foreach (var entity in m_Targets) entity._EditorSetMeshDirty(); + } + + void DrawSortingLayerAndOrder() + { + var updatedProperties = SortingLayerAndOrderDrawer.Draw(sortingLayerID, sortingOrder); + + if(updatedProperties.HasFlag(SortingLayerAndOrderDrawer.UpdatedProperties.SortingLayerID)) + m_Targets.RecordUndoAction("Edit Sorting Layer", (VolumetricLightBeamSD beam) => beam.sortingLayerID = sortingLayerID.intValue); // call setters + + if (updatedProperties.HasFlag(SortingLayerAndOrderDrawer.UpdatedProperties.SortingOrder)) + m_Targets.RecordUndoAction("Edit Sorting Order", (VolumetricLightBeamSD beam) => beam.sortingOrder = sortingOrder.intValue); // call setters + } + + void DrawAnimatorWarning() + { + var showAnimatorWarning = m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamSD beam) => { return beam.GetComponent() != null && beam.trackChangesDuringPlaytime == false; }); + + if (showAnimatorWarning) + EditorGUILayout.HelpBox(EditorStrings.Beam.SD.HelpAnimatorWarning, MessageType.Warning); + } + + void DrawCustomActionButtons() + { + using (new EditorGUILayout.HorizontalScope()) + { + if (GUILayout.Button(EditorStrings.Beam.ButtonResetProperties, EditorStyles.miniButton)) + { + m_Targets.RecordUndoAction("Reset Light Beam Properties", + (VolumetricLightBeamSD beam) => { beam.Reset(); beam.GenerateGeometry(); } ); + } + + if(m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamSD beam) => { return beam.geomMeshType == MeshType.Custom; })) + { + if (GUILayout.Button(EditorStrings.Beam.ButtonGenerateGeometry, EditorStyles.miniButton)) + { + foreach (var entity in m_Targets) entity.GenerateGeometry(); + } + } + } + } + + void DrawAdditionalFeatures() + { + if (Application.isPlaying) return; // do not support adding additional components at runtime + + using (new EditorGUILayout.HorizontalScope()) + { + DrawButtonAddComponentDust(); + + bool showButtonOcclusion = Config.Instance.featureEnabledDynamicOcclusion && m_Targets.HasAtLeastOneTargetWith((VolumetricLightBeamSD beam) => { return beam.GetComponent() == null; }); + if (showButtonOcclusion && GUILayout.Button(EditorData.Instance.contentAddDynamicOcclusion, buttonAddComponentStyle)) + { + var menu = new GenericMenu(); + menu.AddItem(new GUIContent(EditorStrings.Beam.ButtonAddDynamicOcclusionRaycasting), false, AddComponentToTargets); + menu.AddItem(new GUIContent(EditorStrings.Beam.ButtonAddDynamicOcclusionDepthBuffer), false, AddComponentToTargets); + menu.ShowAsContext(); + } + + DrawButtonAddComponentEffect(); + DrawButtonAddComponentTriggerZone(); + } + } + + protected override void GetInfoTips(List tips) + { + if (m_Targets.Count == 1) + { + if (depthBlendDistance.floatValue > 0f || !Noise3D.isSupported || trackChangesDuringPlaytime.boolValue) + { + if (depthBlendDistance.floatValue > 0f) + { +#if UNITY_IPHONE || UNITY_IOS || UNITY_ANDROID + tips.Add(new InfoTip { type = MessageType.Info, message = EditorStrings.Beam.SD.HelpDepthMobile }); +#endif + } + + if (trackChangesDuringPlaytime.boolValue) + tips.Add(new InfoTip { type = MessageType.Info, message = EditorStrings.Beam.SD.HelpTrackChangesEnabled }); + } + } + + base.GetInfoTips(tips); + } + + protected virtual void OnSceneGUI() + { + if(DrawEditInSceneHandles()) + { + var beam = target as VolumetricLightBeamSD; + Debug.Assert(beam != null); + beam.UpdateAfterManualPropertyChange(); + } + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/SD/Editor_VolumetricLightBeamSD.cs.meta b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_VolumetricLightBeamSD.cs.meta new file mode 100644 index 00000000..f1e0db37 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SD/Editor_VolumetricLightBeamSD.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2bd45af80c148e249bd23ff7970f6181 +timeCreated: 1504689328 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/SortingLayerAndOrderDrawer.cs b/Assets/External/VolumetricLightBeam/Editor/SortingLayerAndOrderDrawer.cs new file mode 100644 index 00000000..97738110 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SortingLayerAndOrderDrawer.cs @@ -0,0 +1,53 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; +using System.Linq; + +namespace VLB +{ + static class SortingLayerAndOrderDrawer + { + [System.Flags] + public enum UpdatedProperties + { + None = 0, + SortingLayerID = 1 << 1, + SortingOrder = 1 << 2, + } + + public static UpdatedProperties Draw(SerializedProperty sortingLayerID, SerializedProperty sortingOrder) + { + string[] m_SortingLayerNames = SortingLayer.layers.Select(l => l.name).ToArray(); + + var updatedProperties = UpdatedProperties.None; + + using (new EditorGUILayout.HorizontalScope()) + { + EditorGUI.BeginChangeCheck(); + EditorGUI.showMixedValue = sortingLayerID.hasMultipleDifferentValues; + int layerIndex = System.Array.IndexOf(m_SortingLayerNames, SortingLayer.IDToName(sortingLayerID.intValue)); + layerIndex = EditorGUILayout.Popup(EditorStrings.Beam.SortingLayer, layerIndex, m_SortingLayerNames); + EditorGUI.showMixedValue = false; + if (EditorGUI.EndChangeCheck()) + { + sortingLayerID.intValue = SortingLayer.NameToID(m_SortingLayerNames[layerIndex]); + + updatedProperties |= UpdatedProperties.SortingLayerID; + } + + using (new EditorExtensions.LabelWidth(40f)) + { + EditorGUI.BeginChangeCheck(); + EditorGUILayout.PropertyField(sortingOrder, EditorStrings.Beam.SortingOrder, GUILayout.MaxWidth(90f)); + if (EditorGUI.EndChangeCheck()) + { + updatedProperties |= UpdatedProperties.SortingOrder; + } + } + } + + return updatedProperties; + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Editor/SortingLayerAndOrderDrawer.cs.meta b/Assets/External/VolumetricLightBeam/Editor/SortingLayerAndOrderDrawer.cs.meta new file mode 100644 index 00000000..96dde0a1 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/SortingLayerAndOrderDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 29aa37c243c52d84a9532e0438f02099 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Editor/TargetList.cs b/Assets/External/VolumetricLightBeam/Editor/TargetList.cs new file mode 100644 index 00000000..6f4d7d99 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/TargetList.cs @@ -0,0 +1,91 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace VLB +{ + public class TargetList : IEnumerable where T : MonoBehaviour + { + public int Count { get { return m_Targets != null ? m_Targets.Count : 0; } } + public T this[int key] { get { return m_Targets != null ? m_Targets[key] : null; } } + + public List m_Targets = null; + + public TargetList(UnityEngine.Object[] entities) + { + m_Targets = new List(); + foreach (var entity in entities) + { + if (entity is T) + { + m_Targets.Add(entity as T); // directly get the component from the object + } + else + { + // otherwise get access from the current MonoBehaviour, in case the current MonoBehaviour is not the type wanted as target + var behaviour = entity as MonoBehaviour; + var comp = behaviour.GetComponent(); + if (comp) + m_Targets.Add(comp); + } + } + Debug.Assert(m_Targets.Count > 0); + } + + public bool HasAtLeastOneTargetWith(System.Func lambda) + { + foreach (var target in m_Targets) + { + if (lambda(target)) + { + return true; + } + } + return false; + } + + public bool HaveAll(System.Func lambda) + { + if (m_Targets.Count == 0) return false; + + foreach (var target in m_Targets) + { + if (!lambda(target)) + { + return false; + } + } + return true; + } + + public void RecordUndoAction(string name, System.Action lambda) + { + Undo.RecordObjects(m_Targets.ToArray(), name); + + DoAction(lambda); + } + + public void DoAction(System.Action lambda) + { + foreach (var target in m_Targets) + { + lambda(target); + } + } + + // make this object foreach compatible + public IEnumerator GetEnumerator() + { + foreach (var target in m_Targets) + yield return target; + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return this.GetEnumerator(); + } + } +} +#endif + diff --git a/Assets/External/VolumetricLightBeam/Editor/TargetList.cs.meta b/Assets/External/VolumetricLightBeam/Editor/TargetList.cs.meta new file mode 100644 index 00000000..eb21c950 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Editor/TargetList.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b0e1e5cc7f9712648b3438ad03f9f073 +timeCreated: 1578239648 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Resources.meta b/Assets/External/VolumetricLightBeam/Resources.meta new file mode 100644 index 00000000..e09483c8 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fe027dac27b1c72459980e7e0486c3c8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Resources/DustParticles.mat b/Assets/External/VolumetricLightBeam/Resources/DustParticles.mat new file mode 100644 index 00000000..f13f28c9 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Resources/DustParticles.mat @@ -0,0 +1,34 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: DustParticles + m_Shader: {fileID: 203, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 5 + m_CustomRenderQueue: 3000 + stringTagMap: {} + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + data: + first: + name: _MainTex + second: + m_Texture: {fileID: 2800000, guid: 365cef3e061d6364697f7ace5046c93e, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + data: + first: + name: _InvFade + second: 1 + m_Colors: + data: + first: + name: _TintColor + second: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/External/VolumetricLightBeam/Resources/DustParticles.mat.meta b/Assets/External/VolumetricLightBeam/Resources/DustParticles.mat.meta new file mode 100644 index 00000000..3aa6f04b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Resources/DustParticles.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8d20a6834f5625e4eba5372d38bf7e99 +timeCreated: 1510679888 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Resources/DustParticles.prefab b/Assets/External/VolumetricLightBeam/Resources/DustParticles.prefab new file mode 100644 index 00000000..570e008d --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Resources/DustParticles.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d682a129b76787e366809cc96dc99bd71d772e29721a738fa55a79ae4b1ec7e8 +size 25179 diff --git a/Assets/External/VolumetricLightBeam/Resources/DustParticles.prefab.meta b/Assets/External/VolumetricLightBeam/Resources/DustParticles.prefab.meta new file mode 100644 index 00000000..8a0c7754 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Resources/DustParticles.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 472bc216b0f362147943a3cedc36711f +timeCreated: 1510760761 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Resources/DustParticles.psd b/Assets/External/VolumetricLightBeam/Resources/DustParticles.psd new file mode 100644 index 00000000..6c4a5ac8 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Resources/DustParticles.psd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:272ed43024bc2b1318745cf0851b78827901b552c4bdec7ab4d53916cf39f2ce +size 240789 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures/Dragons.png.meta b/Assets/External/VolumetricLightBeam/Resources/DustParticles.psd.meta similarity index 81% rename from Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures/Dragons.png.meta rename to Assets/External/VolumetricLightBeam/Resources/DustParticles.psd.meta index c5c8f498..351ff40b 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures/Dragons.png.meta +++ b/Assets/External/VolumetricLightBeam/Resources/DustParticles.psd.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: ca39994063dd9c94894e7e05a63ed4af -timeCreated: 1454158430 -licenseType: Store +guid: 365cef3e061d6364697f7ace5046c93e +timeCreated: 1510679738 +licenseType: Free TextureImporter: fileIDToRecycleName: {} serializedVersion: 2 @@ -17,17 +17,17 @@ TextureImporter: bumpmap: convertToNormalMap: 0 externalNormalMap: 0 - heightScale: 0.25 + heightScale: .25 normalMapFilter: 0 isReadable: 0 grayScaleToAlpha: 0 generateCubemap: 0 cubemapConvolution: 0 - cubemapConvolutionSteps: 7 + cubemapConvolutionSteps: 8 cubemapConvolutionExponent: 1.5 seamlessCubemap: 0 textureFormat: -1 - maxTextureSize: 2048 + maxTextureSize: 32 textureSettings: filterMode: -1 aniso: -1 @@ -42,15 +42,14 @@ TextureImporter: spriteExtrude: 1 spriteMeshType: 1 alignment: 0 - spritePivot: {x: 0.5, y: 0.5} + spritePivot: {x: .5, y: .5} spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 - alphaIsTransparency: 0 + alphaIsTransparency: 1 textureType: -1 buildTargetSettings: [] spriteSheet: sprites: [] - outline: [] spritePackingTag: userData: assetBundleName: diff --git a/Assets/External/VolumetricLightBeam/Resources/Noise3D_64x64x64.asset b/Assets/External/VolumetricLightBeam/Resources/Noise3D_64x64x64.asset new file mode 100644 index 00000000..03e4f642 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Resources/Noise3D_64x64x64.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ad6122113cd908f94da2f7c22b01788d1ecf07a6f8883897dd2cb718fcf2bd5 +size 525028 diff --git a/Assets/External/VolumetricLightBeam/Resources/Noise3D_64x64x64.asset.meta b/Assets/External/VolumetricLightBeam/Resources/Noise3D_64x64x64.asset.meta new file mode 100644 index 00000000..fd7a0464 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Resources/Noise3D_64x64x64.asset.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: e4c4c1cbfaa63db45b17891f8f2caf6d +timeCreated: 1619169302 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11700000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Resources/VLBBlueNoise.png b/Assets/External/VolumetricLightBeam/Resources/VLBBlueNoise.png new file mode 100644 index 00000000..91116acc --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Resources/VLBBlueNoise.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e294b9ae8705b02016fb95ff02c7cb35cf6585cf464266fde1a6db288c3df252 +size 277916 diff --git a/Assets/External/VolumetricLightBeam/Resources/VLBBlueNoise.png.meta b/Assets/External/VolumetricLightBeam/Resources/VLBBlueNoise.png.meta new file mode 100644 index 00000000..3f3509d0 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Resources/VLBBlueNoise.png.meta @@ -0,0 +1,121 @@ +fileFormatVersion: 2 +guid: 7c156dffca1e1ef4c916c6237a9d5f16 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Resources/VLBDitheringNoise.png b/Assets/External/VolumetricLightBeam/Resources/VLBDitheringNoise.png new file mode 100644 index 00000000..a8fac53d --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Resources/VLBDitheringNoise.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dc56831cfd1f909c654cc4aca4a794f5f2cc57095c23b3a9ef1093bce7a6c3f9 +size 262 diff --git a/Assets/External/VolumetricLightBeam/Resources/VLBDitheringNoise.png.meta b/Assets/External/VolumetricLightBeam/Resources/VLBDitheringNoise.png.meta new file mode 100644 index 00000000..0fa88e15 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Resources/VLBDitheringNoise.png.meta @@ -0,0 +1,121 @@ +fileFormatVersion: 2 +guid: 52f46dcaae8132a4090a9a8d14ece711 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples.meta b/Assets/External/VolumetricLightBeam/Samples.meta new file mode 100644 index 00000000..40a66324 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cbe76784cd06bb941a5c01416408e3dd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Animations.meta b/Assets/External/VolumetricLightBeam/Samples/Animations.meta new file mode 100644 index 00000000..8778e4a3 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Animations.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4962a40d34917cf43b6e35698ca2c02f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.anim b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.anim new file mode 100644 index 00000000..30c03b94 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.anim @@ -0,0 +1,309 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: AnimAngleAndColor + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + - time: 1 + value: 90 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: spotAngle + path: + classID: 114 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: -1 + outSlope: -1 + tangentMode: 10 + - time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 1 + inSlope: 1 + outSlope: 1 + tangentMode: 10 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: color.r + path: + classID: 114 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: .972413778 + inSlope: .0275862217 + outSlope: .0275862217 + tangentMode: 10 + - time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: .972413778 + inSlope: -.0275862217 + outSlope: -.0275862217 + tangentMode: 10 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: color.g + path: + classID: 114 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 0 + inSlope: .958620548 + outSlope: .958620548 + tangentMode: 10 + - time: 1 + value: .958620548 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 0 + inSlope: -.958620548 + outSlope: -.958620548 + tangentMode: 10 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: color.b + path: + classID: 114 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: color.a + path: + classID: 114 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - path: 0 + attribute: 1767412965 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + classID: 114 + customType: 0 + isPPtrCurve: 0 + - path: 0 + attribute: 57601170 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + classID: 114 + customType: 0 + isPPtrCurve: 0 + - path: 0 + attribute: 1857226873 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + classID: 114 + customType: 0 + isPPtrCurve: 0 + - path: 0 + attribute: 517602550 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + classID: 114 + customType: 0 + isPPtrCurve: 0 + - path: 0 + attribute: 2278600012 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + classID: 114 + customType: 0 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_StartTime: 0 + m_StopTime: 2 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + - time: 1 + value: 90 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: spotAngle + path: + classID: 114 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: -1 + outSlope: -1 + tangentMode: 10 + - time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 1 + inSlope: 1 + outSlope: 1 + tangentMode: 10 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: color.r + path: + classID: 114 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: .972413778 + inSlope: .0275862217 + outSlope: .0275862217 + tangentMode: 10 + - time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: .972413778 + inSlope: -.0275862217 + outSlope: -.0275862217 + tangentMode: 10 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: color.g + path: + classID: 114 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 0 + inSlope: .958620548 + outSlope: .958620548 + tangentMode: 10 + - time: 1 + value: .958620548 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 0 + inSlope: -.958620548 + outSlope: -.958620548 + tangentMode: 10 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: color.b + path: + classID: 114 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: color.a + path: + classID: 114 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_GenerateMotionCurves: 0 + m_Events: [] diff --git a/Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.anim.meta b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.anim.meta new file mode 100644 index 00000000..92f34838 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2da70c68670fd4a4eb423ef705ba51ab +timeCreated: 1509868687 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.controller b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.controller new file mode 100644 index 00000000..b4423f5a --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.controller @@ -0,0 +1,67 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: AnimAngleAndColor + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 110772430} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &110204976 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: New Animation + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 2da70c68670fd4a4eb423ef705ba51ab, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: +--- !u!1107 &110772430 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 110204976} + m_Position: {x: 144, y: 24, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: -72, y: -60, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 110204976} diff --git a/Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.controller.meta b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.controller.meta new file mode 100644 index 00000000..46561f26 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimAngleAndColor.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c55990406d8ba4149b299c7f48f819fd +timeCreated: 1509868687 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.anim b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.anim new file mode 100644 index 00000000..b6cb304d --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.anim @@ -0,0 +1,116 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: AnimFadingDistances + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 2 + value: 6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: fallOffEnd + path: + classID: 114 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - path: 0 + attribute: 2398626827 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + classID: 114 + customType: 0 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 2 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 2 + value: 6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: fallOffEnd + path: + classID: 114 + script: {fileID: 11500000, guid: 7b69c542c9a8f4f44a3123e3fa103d13, type: 3} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_GenerateMotionCurves: 0 + m_IsEmpty: 0 + m_Events: [] diff --git a/Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.anim.meta b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.anim.meta new file mode 100644 index 00000000..16f41d93 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7ecd9944b6be1bd4786c90076c64b534 +timeCreated: 1509878761 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.controller b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.controller new file mode 100644 index 00000000..8336fdc9 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.controller @@ -0,0 +1,67 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: AnimFadingDistances + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 110731564} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &110292738 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: AnimFadingDistances + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 7ecd9944b6be1bd4786c90076c64b534, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: +--- !u!1107 &110731564 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 110292738} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 110292738} diff --git a/Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.controller.meta b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.controller.meta new file mode 100644 index 00000000..203801b0 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimFadingDistances.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 040292e6fd2a7b149a7c000103e8632d +timeCreated: 1509878761 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.anim b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.anim new file mode 100644 index 00000000..bd89cdfb --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.anim @@ -0,0 +1,309 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: AnimLightProperties + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: m_Color.r + path: + classID: 108 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + - time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: m_Color.g + path: + classID: 108 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + - time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: m_Color.b + path: + classID: 108 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + - time: 2 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: m_Color.a + path: + classID: 108 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + - time: 1 + value: 80 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: m_SpotAngle + path: + classID: 108 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - path: 0 + attribute: 4215373228 + script: {fileID: 0} + classID: 108 + customType: 0 + isPPtrCurve: 0 + - path: 0 + attribute: 2334886179 + script: {fileID: 0} + classID: 108 + customType: 0 + isPPtrCurve: 0 + - path: 0 + attribute: 3044587006 + script: {fileID: 0} + classID: 108 + customType: 0 + isPPtrCurve: 0 + - path: 0 + attribute: 2526845255 + script: {fileID: 0} + classID: 108 + customType: 0 + isPPtrCurve: 0 + - path: 0 + attribute: 304273561 + script: {fileID: 0} + classID: 108 + customType: 0 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_StartTime: 0 + m_StopTime: 2 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: m_Color.r + path: + classID: 108 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + - time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: m_Color.g + path: + classID: 108 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + - time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: m_Color.b + path: + classID: 108 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + - time: 2 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: m_Color.a + path: + classID: 108 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + - time: 1 + value: 80 + inSlope: 0 + outSlope: 0 + tangentMode: 10 + - time: 2 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: m_SpotAngle + path: + classID: 108 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_GenerateMotionCurves: 0 + m_Events: [] diff --git a/Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.anim.meta b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.anim.meta new file mode 100644 index 00000000..f3b6be01 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: db19a367419a6b3429ffd7cb7d5c2f89 +timeCreated: 1509879186 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.controller b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.controller new file mode 100644 index 00000000..f5363ed8 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.controller @@ -0,0 +1,67 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: AnimLightProperties + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 110714998} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &110227352 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: AnimLight + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_Motion: {fileID: 7400000, guid: db19a367419a6b3429ffd7cb7d5c2f89, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: +--- !u!1107 &110714998 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 110227352} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 110227352} diff --git a/Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.controller.meta b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.controller.meta new file mode 100644 index 00000000..206860a9 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Animations/AnimLightProperties.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 25d91ec95cd77c247a608d0dbaac623f +timeCreated: 1509879186 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials.meta b/Assets/External/VolumetricLightBeam/Samples/Materials.meta similarity index 77% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials.meta rename to Assets/External/VolumetricLightBeam/Samples/Materials.meta index d98f4a69..8791cae5 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials.meta +++ b/Assets/External/VolumetricLightBeam/Samples/Materials.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0d0bb23ae9cc0ea44a4501419c2f20fa +guid: d7b9c359efdbc0f4fadf02d2da3353b3 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies.meta b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies.meta new file mode 100644 index 00000000..85f9f8f3 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0173167817859174e846b695e97d4f21 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_colored.jpg b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_colored.jpg new file mode 100644 index 00000000..b0dbaab4 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_colored.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:95bbc20b5dc4cc5a52500934276b39af704853ffbb75834736fb9cb1b757edc0 +size 83574 diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_colored.jpg.meta b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_colored.jpg.meta new file mode 100644 index 00000000..a343f799 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_colored.jpg.meta @@ -0,0 +1,121 @@ +fileFormatVersion: 2 +guid: 48b7d34a21cae3143885186139bdf09a +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_fan.png b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_fan.png new file mode 100644 index 00000000..9efa0904 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_fan.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97cc152af4ce959257ee4e924e1ea344641b8701f353af7e43ea10b44195b443 +size 72348 diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_fan.png.meta b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_fan.png.meta new file mode 100644 index 00000000..4b8396ff --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_fan.png.meta @@ -0,0 +1,121 @@ +fileFormatVersion: 2 +guid: 079bd60333c68b44cb7dd7691ad6b7db +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 1 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: 0 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 2 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 4 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_heart.psd b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_heart.psd new file mode 100644 index 00000000..28e9c745 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_heart.psd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12e0a965c6148e748f94eaa22b2a0d7fdb01458b5732d8936ff7eeb0808de03e +size 107249 diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_heart.psd.meta b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_heart.psd.meta new file mode 100644 index 00000000..def724d3 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_heart.psd.meta @@ -0,0 +1,121 @@ +fileFormatVersion: 2 +guid: ede7fde1533717d4f873795d5e2dfb91 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 1 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: 0 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 2 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 4 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_star.psd b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_star.psd new file mode 100644 index 00000000..e2a09111 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_star.psd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:72d6ea60bf3d61a2ff7fdefbabbf679a28a1c8a3a0ac7eeb4bf6b5851a45d231 +size 250305 diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_star.psd.meta b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_star.psd.meta new file mode 100644 index 00000000..9aa13bf1 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/Cookies/cookie_star.psd.meta @@ -0,0 +1,121 @@ +fileFormatVersion: 2 +guid: 43e08d74d115a8a4d9456744d3b0eb62 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 1 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: 0 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 2 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 4 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/checkIfInsideBeam.mat b/Assets/External/VolumetricLightBeam/Samples/Materials/checkIfInsideBeam.mat new file mode 100644 index 00000000..6bb09317 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/checkIfInsideBeam.mat @@ -0,0 +1,138 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: checkIfInsideBeam + m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 5 + m_CustomRenderQueue: 2000 + stringTagMap: {} + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + data: + first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _BumpMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailNormalMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _ParallaxMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _OcclusionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _EmissionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailMask + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailAlbedoMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _MetallicGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + data: + first: + name: _SrcBlend + second: 1 + data: + first: + name: _DstBlend + second: 0 + data: + first: + name: _Cutoff + second: .5 + data: + first: + name: _Parallax + second: .0199999996 + data: + first: + name: _ZWrite + second: 1 + data: + first: + name: _Glossiness + second: .5 + data: + first: + name: _BumpScale + second: 1 + data: + first: + name: _OcclusionStrength + second: 1 + data: + first: + name: _DetailNormalMapScale + second: 1 + data: + first: + name: _UVSec + second: 0 + data: + first: + name: _Mode + second: 0 + data: + first: + name: _Metallic + second: .5 + m_Colors: + data: + first: + name: _EmissionColor + second: {r: 0, g: 0, b: 0, a: 1} + data: + first: + name: _Color + second: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/checkIfInsideBeam.mat.meta b/Assets/External/VolumetricLightBeam/Samples/Materials/checkIfInsideBeam.mat.meta new file mode 100644 index 00000000..b548547b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/checkIfInsideBeam.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 863df4913247ae3499994d7e90827a32 +timeCreated: 1531568652 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/geometry_hdrp.mat b/Assets/External/VolumetricLightBeam/Samples/Materials/geometry_hdrp.mat new file mode 100644 index 00000000..9e9c1b2f --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/geometry_hdrp.mat @@ -0,0 +1,243 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: geometry_hdrp + m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _AnisotropyMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BaseColorMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BentNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BentNormalMapOS: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _CoatMaskMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortionVectorMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissiveColorMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _HeightMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _IridescenceMaskMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _IridescenceThicknessMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MaskMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMapOS: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecularColorMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SubsurfaceMaskMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _TangentMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _TangentMapOS: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ThicknessMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _TransmittanceColorMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AORemapMax: 1 + - _AORemapMin: 0 + - _ATDistance: 1 + - _AlbedoAffectEmissive: 0 + - _AlphaCutoff: 0.5 + - _AlphaCutoffEnable: 0 + - _AlphaCutoffPostpass: 0.5 + - _AlphaCutoffPrepass: 0.5 + - _AlphaCutoffShadow: 0.5 + - _Anisotropy: 0 + - _BlendMode: 0 + - _CoatMask: 0 + - _CullMode: 2 + - _CullModeForward: 2 + - _Cutoff: 0.5 + - _DepthOffsetEnable: 0 + - _DetailAlbedoScale: 1 + - _DetailNormalScale: 1 + - _DetailSmoothnessScale: 1 + - _DiffusionProfile: 0 + - _DiffusionProfileHash: 0 + - _DisplacementLockObjectScale: 1 + - _DisplacementLockTilingScale: 1 + - _DisplacementMode: 0 + - _DistortionBlendMode: 0 + - _DistortionBlurBlendMode: 0 + - _DistortionBlurDstBlend: 0 + - _DistortionBlurRemapMax: 1 + - _DistortionBlurRemapMin: 0 + - _DistortionBlurScale: 1 + - _DistortionBlurSrcBlend: 0 + - _DistortionDepthTest: 1 + - _DistortionDstBlend: 0 + - _DistortionEnable: 0 + - _DistortionScale: 1 + - _DistortionSrcBlend: 0 + - _DistortionVectorBias: -1 + - _DistortionVectorScale: 2 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 1 + - _Drag: 1 + - _DstBlend: 0 + - _EmissiveColorMode: 1 + - _EmissiveExposureWeight: 1 + - _EmissiveIntensity: 1 + - _EmissiveIntensityUnit: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _EnableGeometricSpecularAA: 0 + - _EnableMotionVectorForVertexAnimation: 0 + - _EnableSpecularOcclusion: 0 + - _EnableWind: 0 + - _EnergyConservingSpecularColor: 1 + - _HdrpVersion: 2 + - _HeightAmplitude: 0.02 + - _HeightCenter: 0.5 + - _HeightMapParametrization: 0 + - _HeightMax: 1 + - _HeightMin: -1 + - _HeightOffset: 0 + - _HeightPoMAmplitude: 2 + - _HeightTessAmplitude: 2 + - _HeightTessCenter: 0.5 + - _InitialBend: 1 + - _InvTilingScale: 1 + - _Ior: 1 + - _IridescenceMask: 1 + - _IridescenceThickness: 1 + - _LinkDetailsWithBase: 1 + - _MaterialID: 1 + - _Metallic: 0 + - _NormalMapSpace: 0 + - _NormalScale: 1 + - _PPDLodThreshold: 5 + - _PPDMaxSamples: 15 + - _PPDMinSamples: 5 + - _PPDPrimitiveLength: 1 + - _PPDPrimitiveWidth: 1 + - _ReceivesSSR: 1 + - _RefractionModel: 0 + - _SSRefractionProjectionModel: 0 + - _ShiverDirectionality: 0.5 + - _ShiverDrag: 0.2 + - _Smoothness: 0.5 + - _SmoothnessRemapMax: 1 + - _SmoothnessRemapMin: 0 + - _SpecularAAScreenSpaceVariance: 0.1 + - _SpecularAAThreshold: 0.2 + - _SrcBlend: 1 + - _StencilRef: 2 + - _StencilRefDepth: 0 + - _StencilRefGBuffer: 2 + - _StencilRefMV: 128 + - _StencilWriteMask: 3 + - _StencilWriteMaskDepth: 32 + - _StencilWriteMaskGBuffer: 3 + - _StencilWriteMaskMV: 128 + - _Stiffness: 1 + - _SubsurfaceMask: 1 + - _SupportDecals: 1 + - _SurfaceType: 0 + - _TexWorldScale: 1 + - _TexWorldScaleEmissive: 1 + - _Thickness: 1 + - _ThicknessMultiplier: 1 + - _TransmissionEnable: 1 + - _TransparentBackfaceEnable: 0 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingVelocity: 0 + - _UVBase: 0 + - _UVDetail: 0 + - _UVEmissive: 0 + - _UseEmissiveIntensity: 0 + - _UseShadowThreshold: 0 + - _ZTestDepthEqualForOpaque: 4 + - _ZTestGBuffer: 4 + - _ZTestModeDistortion: 8 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0} + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - _EmissiveColor: {r: 0, g: 0, b: 0, a: 1} + - _EmissiveColorLDR: {r: 0, g: 0, b: 0, a: 1} + - _InvPrimScale: {r: 1, g: 1, b: 0, a: 0} + - _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0} + - _SpecularColor: {r: 1, g: 1, b: 1, a: 1} + - _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0} + - _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1} + - _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0} + - _UVMappingMask: {r: 1, g: 0, b: 0, a: 0} + - _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0} diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Post Process Volume Profile.asset.meta b/Assets/External/VolumetricLightBeam/Samples/Materials/geometry_hdrp.mat.meta similarity index 64% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Post Process Volume Profile.asset.meta rename to Assets/External/VolumetricLightBeam/Samples/Materials/geometry_hdrp.mat.meta index 4c51ddc2..510e11be 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Post Process Volume Profile.asset.meta +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/geometry_hdrp.mat.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: f1c9c1b41992f574b96467b208087240 +guid: 3cd8e1320c011904b8e4fbcb14859857 NativeFormatImporter: externalObjects: {} - mainObjectFileID: 0 + mainObjectFileID: 2100000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/geometry_urp.mat b/Assets/External/VolumetricLightBeam/Samples/Materials/geometry_urp.mat new file mode 100644 index 00000000..75aa272c --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/geometry_urp.mat @@ -0,0 +1,135 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-644000588771630624 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: geometry_urp + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + - _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials/Dragons.mat.meta b/Assets/External/VolumetricLightBeam/Samples/Materials/geometry_urp.mat.meta similarity index 78% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials/Dragons.mat.meta rename to Assets/External/VolumetricLightBeam/Samples/Materials/geometry_urp.mat.meta index 7f002df5..b1a21325 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials/Dragons.mat.meta +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/geometry_urp.mat.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a66ae531fc9a3474caa5ddc1f82de0cd +guid: 22da0242e6c073f4881cee3a6d12c081 NativeFormatImporter: externalObjects: {} mainObjectFileID: 0 diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/green.mat b/Assets/External/VolumetricLightBeam/Samples/Materials/green.mat new file mode 100644 index 00000000..5658fc15 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/green.mat @@ -0,0 +1,138 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: green + m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 5 + m_CustomRenderQueue: 2000 + stringTagMap: {} + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + data: + first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _BumpMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailNormalMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _ParallaxMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _OcclusionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _EmissionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailMask + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailAlbedoMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _MetallicGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + data: + first: + name: _SrcBlend + second: 1 + data: + first: + name: _DstBlend + second: 0 + data: + first: + name: _Cutoff + second: .5 + data: + first: + name: _Parallax + second: .0199999996 + data: + first: + name: _ZWrite + second: 1 + data: + first: + name: _Glossiness + second: .5 + data: + first: + name: _BumpScale + second: 1 + data: + first: + name: _OcclusionStrength + second: 1 + data: + first: + name: _DetailNormalMapScale + second: 1 + data: + first: + name: _UVSec + second: 0 + data: + first: + name: _Mode + second: 0 + data: + first: + name: _Metallic + second: 0 + m_Colors: + data: + first: + name: _EmissionColor + second: {r: 0, g: 0, b: 0, a: 1} + data: + first: + name: _Color + second: {r: 0, g: 1, b: .00689649582, a: 1} diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/green.mat.meta b/Assets/External/VolumetricLightBeam/Samples/Materials/green.mat.meta new file mode 100644 index 00000000..c3552fd7 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/green.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 17dcb61e250d9ab4fb89d92b3abab5a2 +timeCreated: 1508480156 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/red.mat b/Assets/External/VolumetricLightBeam/Samples/Materials/red.mat new file mode 100644 index 00000000..527a50cf --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/red.mat @@ -0,0 +1,138 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: red + m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 5 + m_CustomRenderQueue: 2000 + stringTagMap: {} + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + data: + first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _BumpMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailNormalMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _ParallaxMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _OcclusionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _EmissionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailMask + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailAlbedoMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _MetallicGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + data: + first: + name: _SrcBlend + second: 1 + data: + first: + name: _DstBlend + second: 0 + data: + first: + name: _Cutoff + second: .5 + data: + first: + name: _Parallax + second: .0199999996 + data: + first: + name: _ZWrite + second: 1 + data: + first: + name: _Glossiness + second: .5 + data: + first: + name: _BumpScale + second: 1 + data: + first: + name: _OcclusionStrength + second: 1 + data: + first: + name: _DetailNormalMapScale + second: 1 + data: + first: + name: _UVSec + second: 0 + data: + first: + name: _Mode + second: 0 + data: + first: + name: _Metallic + second: 0 + m_Colors: + data: + first: + name: _EmissionColor + second: {r: 0, g: 0, b: 0, a: 1} + data: + first: + name: _Color + second: {r: 1, g: 0, b: 0, a: 1} diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/red.mat.meta b/Assets/External/VolumetricLightBeam/Samples/Materials/red.mat.meta new file mode 100644 index 00000000..fe4b550c --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/red.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9da0a6ff0e3be1c47b973173cc500d41 +timeCreated: 1504767185 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/skybox.mat b/Assets/External/VolumetricLightBeam/Samples/Materials/skybox.mat new file mode 100644 index 00000000..da6f1431 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/skybox.mat @@ -0,0 +1,162 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: skybox + m_Shader: {fileID: 106, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _SUNDISK_HIGH_QUALITY + m_LightmapFlags: 5 + m_CustomRenderQueue: 1000 + stringTagMap: {} + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + data: + first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _BumpMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailNormalMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _ParallaxMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _OcclusionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _EmissionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailMask + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailAlbedoMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _MetallicGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + data: + first: + name: _SrcBlend + second: 1 + data: + first: + name: _DstBlend + second: 0 + data: + first: + name: _Cutoff + second: .5 + data: + first: + name: _Exposure + second: 1.67999995 + data: + first: + name: _SunSize + second: .0460000001 + data: + first: + name: _AtmosphereThickness + second: 2.25 + data: + first: + name: _SunDisk + second: 2 + data: + first: + name: _Parallax + second: .0199999996 + data: + first: + name: _ZWrite + second: 1 + data: + first: + name: _Glossiness + second: .5 + data: + first: + name: _BumpScale + second: 1 + data: + first: + name: _OcclusionStrength + second: 1 + data: + first: + name: _DetailNormalMapScale + second: 1 + data: + first: + name: _UVSec + second: 0 + data: + first: + name: _Mode + second: 0 + data: + first: + name: _Metallic + second: 0 + m_Colors: + data: + first: + name: _EmissionColor + second: {r: 0, g: 0, b: 0, a: 1} + data: + first: + name: _Color + second: {r: 1, g: 1, b: 1, a: 1} + data: + first: + name: _SkyTint + second: {r: .5, g: .5, b: .5, a: 1} + data: + first: + name: _GroundColor + second: {r: .368999988, g: .349000007, b: .340999991, a: 1} diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/skybox.mat.meta b/Assets/External/VolumetricLightBeam/Samples/Materials/skybox.mat.meta new file mode 100644 index 00000000..131f7c4a --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/skybox.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: be6c37625a5b4e740a428df2a39d8e99 +timeCreated: 1504786486 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/white.mat b/Assets/External/VolumetricLightBeam/Samples/Materials/white.mat new file mode 100644 index 00000000..f5a66e32 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/white.mat @@ -0,0 +1,138 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: white + m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 5 + m_CustomRenderQueue: 2000 + stringTagMap: {} + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + data: + first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _BumpMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailNormalMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _ParallaxMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _OcclusionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _EmissionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailMask + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailAlbedoMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _MetallicGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + data: + first: + name: _SrcBlend + second: 1 + data: + first: + name: _DstBlend + second: 0 + data: + first: + name: _Cutoff + second: .5 + data: + first: + name: _Parallax + second: .0199999996 + data: + first: + name: _ZWrite + second: 1 + data: + first: + name: _Glossiness + second: .5 + data: + first: + name: _BumpScale + second: 1 + data: + first: + name: _OcclusionStrength + second: 1 + data: + first: + name: _DetailNormalMapScale + second: 1 + data: + first: + name: _UVSec + second: 0 + data: + first: + name: _Mode + second: 0 + data: + first: + name: _Metallic + second: 0 + m_Colors: + data: + first: + name: _EmissionColor + second: {r: 0, g: 0, b: 0, a: 1} + data: + first: + name: _Color + second: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/white.mat.meta b/Assets/External/VolumetricLightBeam/Samples/Materials/white.mat.meta new file mode 100644 index 00000000..cc721f61 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/white.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ad68a7436f4a15b4babc7f386f3a39eb +timeCreated: 1504770165 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/yellow.mat b/Assets/External/VolumetricLightBeam/Samples/Materials/yellow.mat new file mode 100644 index 00000000..80b725b9 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/yellow.mat @@ -0,0 +1,138 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: yellow + m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 5 + m_CustomRenderQueue: 2000 + stringTagMap: {} + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + data: + first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _BumpMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailNormalMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _ParallaxMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _OcclusionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _EmissionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailMask + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailAlbedoMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _MetallicGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + data: + first: + name: _SrcBlend + second: 1 + data: + first: + name: _DstBlend + second: 0 + data: + first: + name: _Cutoff + second: .5 + data: + first: + name: _Parallax + second: .0199999996 + data: + first: + name: _ZWrite + second: 1 + data: + first: + name: _Glossiness + second: .5 + data: + first: + name: _BumpScale + second: 1 + data: + first: + name: _OcclusionStrength + second: 1 + data: + first: + name: _DetailNormalMapScale + second: 1 + data: + first: + name: _UVSec + second: 0 + data: + first: + name: _Mode + second: 0 + data: + first: + name: _Metallic + second: 0 + m_Colors: + data: + first: + name: _EmissionColor + second: {r: 0, g: 0, b: 0, a: 1} + data: + first: + name: _Color + second: {r: .944827676, g: 1, b: 0, a: 1} diff --git a/Assets/External/VolumetricLightBeam/Samples/Materials/yellow.mat.meta b/Assets/External/VolumetricLightBeam/Samples/Materials/yellow.mat.meta new file mode 100644 index 00000000..16a528f3 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Materials/yellow.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ca4190bfb837aad43b0033df1090d810 +timeCreated: 1508480202 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Scenes.meta b/Assets/External/VolumetricLightBeam/Samples/Scenes.meta new file mode 100644 index 00000000..75487a68 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scenes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b54ec68f0dbe6b343a1bfb92f2cdb6fb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScenePrefab.prefab b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScenePrefab.prefab new file mode 100644 index 00000000..53e76671 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScenePrefab.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ffadeb759ff04688ca2be283cc41b99b9588d644308fae6376d9cd4836c0078 +size 303950 diff --git a/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScenePrefab.prefab.meta b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScenePrefab.prefab.meta new file mode 100644 index 00000000..5f9b26d4 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScenePrefab.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fd04eba1f9a87034f8ed311eb9200a26 +timeCreated: 1605695100 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_builtin_pipeline.unity b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_builtin_pipeline.unity new file mode 100644 index 00000000..3a36ef00 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_builtin_pipeline.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a1b7a6419372c44fa818b9d6cdab6fe0fe1537bdc019c42e1fc3e23f45a2d46c +size 79988 diff --git a/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_builtin_pipeline.unity.meta b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_builtin_pipeline.unity.meta new file mode 100644 index 00000000..75356455 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_builtin_pipeline.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 39a75289481b17942af8f57ef86a75f1 +timeCreated: 1504765333 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_hdrp.unity b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_hdrp.unity new file mode 100644 index 00000000..83c53fdf --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_hdrp.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9a17172b1c91a3e50a5f83cd6775d7fd3ac5d192b8e01635b1c931ab74b7ed4 +size 94053 diff --git a/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_hdrp.unity.meta b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_hdrp.unity.meta new file mode 100644 index 00000000..b3650d82 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_hdrp.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d24de02260cafa448b3d3c5919df248d +timeCreated: 1504765333 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_urp.unity b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_urp.unity new file mode 100644 index 00000000..818e251f --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_urp.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87637cf453e60fbe705bb6d922359331a4aa0d28d88c48f192700dd81f4f4990 +size 92234 diff --git a/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_urp.unity.meta b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_urp.unity.meta new file mode 100644 index 00000000..8af8a26e --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoScene_urp.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0ce3da0b1321e384a9b561822b6983f7 +timeCreated: 1504765333 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Scenes/demoStressTest.unity b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoStressTest.unity new file mode 100644 index 00000000..38f2679f --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoStressTest.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:882cf8d1e3bdf2d7dc42c0714d116cf0366a3532cdfecde4b315b529f48497cb +size 1688445 diff --git a/Assets/External/VolumetricLightBeam/Samples/Scenes/demoStressTest.unity.meta b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoStressTest.unity.meta new file mode 100644 index 00000000..46da7a79 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scenes/demoStressTest.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5a65372c6011338468eddf39b0084626 +timeCreated: 1507704497 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Scripts.meta b/Assets/External/VolumetricLightBeam/Samples/Scripts.meta new file mode 100644 index 00000000..ed6dd33b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0a64fd1b94a995f4a865eea7422d485e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Scripts/CameraToggleBeamVisibility.cs b/Assets/External/VolumetricLightBeam/Samples/Scripts/CameraToggleBeamVisibility.cs new file mode 100644 index 00000000..32761b78 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scripts/CameraToggleBeamVisibility.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace VLB_Samples +{ + [RequireComponent(typeof(Camera))] + public class CameraToggleBeamVisibility : MonoBehaviour + { + [SerializeField] KeyCode m_KeyCode = KeyCode.Space; + + void Update() + { + if (Input.GetKeyDown(m_KeyCode)) + { + var cam = GetComponent(); + + int layerID = VLB.Config.Instance.geometryLayerID; + int layerMask = 1 << layerID; + if ((cam.cullingMask & layerMask) == layerMask) + { + cam.cullingMask &= ~layerMask; + } + else + { + cam.cullingMask |= layerMask; + } + } + } + } +} + diff --git a/Assets/External/VolumetricLightBeam/Samples/Scripts/CameraToggleBeamVisibility.cs.meta b/Assets/External/VolumetricLightBeam/Samples/Scripts/CameraToggleBeamVisibility.cs.meta new file mode 100644 index 00000000..4fab1ca5 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scripts/CameraToggleBeamVisibility.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c266971950f6c8249832946861d54fa8 +timeCreated: 1507707781 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Scripts/CheckIfInsideBeam.cs b/Assets/External/VolumetricLightBeam/Samples/Scripts/CheckIfInsideBeam.cs new file mode 100644 index 00000000..50f9c61b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scripts/CheckIfInsideBeam.cs @@ -0,0 +1,53 @@ +using UnityEngine; + +namespace VLB_Samples +{ + [RequireComponent(typeof(Collider), typeof(Rigidbody), typeof(MeshRenderer))] + public class CheckIfInsideBeam : MonoBehaviour + { + bool isInsideBeam = false; + Material m_Material = null; + Collider m_Collider = null; + + void Start() + { + m_Collider = GetComponent(); + Debug.Assert(m_Collider); + + var meshRenderer = GetComponent(); + if (meshRenderer) + m_Material = meshRenderer.material; + Debug.Assert(m_Material); + } + + void Update() + { + if (m_Material) + { + m_Material.SetColor("_Color", isInsideBeam ? Color.green : Color.red); + } + } + + void FixedUpdate() + { + isInsideBeam = false; + } + + void OnTriggerStay(Collider trigger) + { + var dynamicOcclusion = trigger.GetComponent(); + + if (dynamicOcclusion) + { + // This GameObject is inside the beam's TriggerZone. + // Make sure it's not hidden by an occluder + isInsideBeam = !dynamicOcclusion.IsColliderHiddenByDynamicOccluder(m_Collider); + } + else + { + isInsideBeam = true; + } + } + } +} + diff --git a/Assets/External/VolumetricLightBeam/Samples/Scripts/CheckIfInsideBeam.cs.meta b/Assets/External/VolumetricLightBeam/Samples/Scripts/CheckIfInsideBeam.cs.meta new file mode 100644 index 00000000..95da4d26 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scripts/CheckIfInsideBeam.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: aa80be3114439164cb57d970b56bc816 +timeCreated: 1531568745 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Scripts/FeaturesNotSupportedMessage.cs b/Assets/External/VolumetricLightBeam/Samples/Scripts/FeaturesNotSupportedMessage.cs new file mode 100644 index 00000000..a6180192 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scripts/FeaturesNotSupportedMessage.cs @@ -0,0 +1,13 @@ +using UnityEngine; + +namespace VLB_Samples +{ + public class FeaturesNotSupportedMessage : MonoBehaviour + { + void Start() + { + if(!VLB.Noise3D.isSupported) + Debug.LogWarning(VLB.Noise3D.isNotSupportedString); + } + } +} diff --git a/Assets/External/VolumetricLightBeam/Samples/Scripts/FeaturesNotSupportedMessage.cs.meta b/Assets/External/VolumetricLightBeam/Samples/Scripts/FeaturesNotSupportedMessage.cs.meta new file mode 100644 index 00000000..a897e11b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scripts/FeaturesNotSupportedMessage.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dd7339057fb22c84ea73609eb1efb890 +timeCreated: 1514884227 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Scripts/FreeCameraController.cs b/Assets/External/VolumetricLightBeam/Samples/Scripts/FreeCameraController.cs new file mode 100644 index 00000000..c49e6d96 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scripts/FreeCameraController.cs @@ -0,0 +1,72 @@ +using UnityEngine; + +namespace VLB_Samples +{ + public class FreeCameraController : MonoBehaviour + { + public float cameraSensitivity = 90; + public float speedNormal = 10; + public float speedFactorSlow = 0.25f; + public float speedFactorFast = 3; + public float speedClimb = 4; + + float rotationH = 0.0f; + float rotationV = 0.0f; + + bool m_UseMouseView = true; + bool useMouseView + { + get { return m_UseMouseView; } + set + { + m_UseMouseView = value; + Cursor.lockState = value ? CursorLockMode.Locked : CursorLockMode.None; + Cursor.visible = !value; + } + } + + void Start() + { + useMouseView = true; + + var euler = transform.rotation.eulerAngles; + rotationH = euler.y; + rotationV = euler.x; + if (rotationV > 180f) + rotationV -= 360f; + } + + void Update() + { + if (useMouseView) + { + rotationH += Input.GetAxis("Mouse X") * cameraSensitivity * Time.deltaTime; + rotationV -= Input.GetAxis("Mouse Y") * cameraSensitivity * Time.deltaTime; + } + rotationV = Mathf.Clamp(rotationV, -90, 90); + + transform.rotation = Quaternion.AngleAxis(rotationH, Vector3.up); + transform.rotation *= Quaternion.AngleAxis(rotationV, Vector3.right); + + var speed = speedNormal; + if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) speed *= speedFactorFast; + else if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) speed *= speedFactorSlow; + + transform.position += speed * Input.GetAxis("Vertical") * Time.deltaTime * transform.forward; + transform.position += speed * Input.GetAxis("Horizontal") * Time.deltaTime * transform.right; + + if (Input.GetKey(KeyCode.Q)) { transform.position += speedClimb * Time.deltaTime * Vector3.up; } + if (Input.GetKey(KeyCode.E)) { transform.position += speedClimb * Time.deltaTime * Vector3.down; } + + if ( +#if !UNITY_EDITOR + Input.GetMouseButtonDown(0) || +#endif + Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(2)) + useMouseView = !useMouseView; + + if (Input.GetKeyDown(KeyCode.Escape)) + useMouseView = false; + } + } +} diff --git a/Assets/External/VolumetricLightBeam/Samples/Scripts/FreeCameraController.cs.meta b/Assets/External/VolumetricLightBeam/Samples/Scripts/FreeCameraController.cs.meta new file mode 100644 index 00000000..ead105ac --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scripts/FreeCameraController.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 73cef9fd683cb8c4fb218b6e5dc2f16e +timeCreated: 1504706738 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Scripts/LightGenerator.cs b/Assets/External/VolumetricLightBeam/Samples/Scripts/LightGenerator.cs new file mode 100644 index 00000000..e6475d85 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scripts/LightGenerator.cs @@ -0,0 +1,87 @@ +using UnityEngine; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace VLB_Samples +{ + public class LightGenerator : MonoBehaviour + { + [Range(1, 100)] + [SerializeField] int CountX = 10; + [Range(1, 100)] + [SerializeField] int CountY = 10; + [SerializeField] float OffsetUnits = 1; + [SerializeField] float PositionY = 1; + [SerializeField] bool NoiseEnabled = false; + [SerializeField] bool AddLight = true; + + public void Generate() + { + for (int i = 0; i < CountX; ++i) + { + for (int j = 0; j < CountY; ++j) + { + GameObject gao = null; + if(AddLight) + gao = new GameObject("Light_" + i + "_" + j, typeof(Light), typeof(VLB.VolumetricLightBeamSD), typeof(Rotater)); + else + gao = new GameObject("Light_" + i + "_" + j, typeof(VLB.VolumetricLightBeamSD), typeof(Rotater)); + + gao.transform.SetPositionAndRotation( new Vector3(i * OffsetUnits, PositionY, j * OffsetUnits), + Quaternion.Euler(Random.Range(-45, 45) + 90f, Random.Range(0, 360), 0)); + + var beam = gao.GetComponent(); + + if (AddLight) + { + var light = gao.GetComponent(); + light.type = LightType.Spot; + light.color = new Color(Random.value, Random.value, Random.value, 1.0f); + light.range = Random.Range(3f, 8f); + light.intensity = Random.Range(0.2f, 5f); + light.spotAngle = Random.Range(10f, 90f); + + if(VLB.Config.Instance.geometryOverrideLayer) + { + // remove the layer of the beams from the light's culling mask to prevent from breaking GPU Instancing + light.cullingMask = ~(1 << VLB.Config.Instance.geometryLayerID); + } + } + else + { + beam.color = new Color(Random.value, Random.value, Random.value, 1.0f); + beam.fallOffEnd = Random.Range(3f, 8f); + beam.spotAngle = Random.Range(10f, 90f); + } + + beam.coneRadiusStart = Random.Range(0f, 0.1f); + beam.geomCustomSides = Random.Range(12, 36); + beam.fresnelPow = Random.Range(1, 7.5f); + beam.noiseMode = NoiseEnabled ? VLB.NoiseMode.WorldSpace : VLB.NoiseMode.Disabled; + + var rotater = gao.GetComponent(); + rotater.EulerSpeed = new Vector3(0, Random.Range(-500, 500), 0); + } + } + } + } + +#if UNITY_EDITOR + [CustomEditor(typeof(LightGenerator))] + public class LightGeneratorEditor : Editor + { + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + if (Application.isPlaying) return; + if (GUILayout.Button("Generate")) + { + (target as LightGenerator).Generate(); + } + } + } +#endif +} + diff --git a/Assets/External/VolumetricLightBeam/Samples/Scripts/LightGenerator.cs.meta b/Assets/External/VolumetricLightBeam/Samples/Scripts/LightGenerator.cs.meta new file mode 100644 index 00000000..1a436f82 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scripts/LightGenerator.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 40a4b77a9b84c3040a81c0b7a629248a +timeCreated: 1507704560 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Samples/Scripts/Rotater.cs b/Assets/External/VolumetricLightBeam/Samples/Scripts/Rotater.cs new file mode 100644 index 00000000..14df6024 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scripts/Rotater.cs @@ -0,0 +1,18 @@ +using UnityEngine; +using UnityEngine.Serialization; + +namespace VLB_Samples +{ + public class Rotater : MonoBehaviour + { + [FormerlySerializedAs("m_EulerSpeed")] + public Vector3 EulerSpeed = Vector3.zero; + + void Update() + { + var euler = transform.rotation.eulerAngles; + euler += EulerSpeed * Time.deltaTime; + transform.rotation = Quaternion.Euler(euler); + } + } +} diff --git a/Assets/External/VolumetricLightBeam/Samples/Scripts/Rotater.cs.meta b/Assets/External/VolumetricLightBeam/Samples/Scripts/Rotater.cs.meta new file mode 100644 index 00000000..bf6a10cd --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Samples/Scripts/Rotater.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 031dc173b8912b246aaed3b7e88df54e +timeCreated: 1504710999 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts.meta b/Assets/External/VolumetricLightBeam/Scripts.meta new file mode 100644 index 00000000..0922b3dc --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ed54394714f6fb647b466aa0a753200c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/BatchingHelper.cs b/Assets/External/VolumetricLightBeam/Scripts/BatchingHelper.cs new file mode 100644 index 00000000..9dbf3a6c --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/BatchingHelper.cs @@ -0,0 +1,239 @@ +// Force isDepthBlendEnabled at true when GPU Instancing is enabled, to prevent from breaking the batch if 1 beam has it at 0 and 1 has it at > 0 +#define FORCE_ENABLE_DEPTHBLEND_FOR_BATCHING + +using UnityEngine; + +namespace VLB +{ + public static class BatchingHelper + { + public static bool IsGpuInstancingEnabled(Material material) + { + Debug.Assert(material != null); + return material.enableInstancing; + } + + public static void SetMaterialProperties(Material material, bool enableGpuInstancing) + { + Debug.Assert(material != null); + material.enableInstancing = enableGpuInstancing; + } + + // SD +#if FORCE_ENABLE_DEPTHBLEND_FOR_BATCHING + public static bool forceEnableDepthBlend { get { + var renderingMode = Config.Instance.GetActualRenderingMode(ShaderMode.SD); + return renderingMode == RenderingMode.GPUInstancing || renderingMode == RenderingMode.SRPBatcher; + } } +#else + public const bool forceEnableDepthBlend = false; +#endif + + static bool DoesRenderingModePreventBatching(ShaderMode shaderMode, ref string reasons) + { + var renderingMode = Config.Instance.GetActualRenderingMode(shaderMode); + if (renderingMode != RenderingMode.GPUInstancing && renderingMode != RenderingMode.SRPBatcher) + { + reasons = string.Format("Current Rendering Mode is '{0}'. To enable batching, use '{1}'", renderingMode, RenderingMode.GPUInstancing); + if (Config.Instance.renderPipeline != RenderPipeline.BuiltIn) + reasons += string.Format(" or '{0}'", RenderingMode.SRPBatcher); + return true; + } + return false; + } + +#if UNITY_EDITOR + static void CheckMaterialID(VolumetricLightBeamAbstractBase beamA, VolumetricLightBeamAbstractBase beamB, ref bool ret, ref string reasons) + { + var matIdA = beamA._EDITOR_GetInstancedMaterialID(); + var matIdB = beamB._EDITOR_GetInstancedMaterialID(); + if (matIdA >= 0 && matIdB >= 0) + { + bool haveSameMatID = matIdA == matIdB; + if (haveSameMatID != ret) + { + AppendErrorMessage(ref reasons, "UNKNOWN REASON: beams have not the same material ID"); + Debug.LogErrorFormat("Beams {0} and {1} have not the same material ID while the reason is unknown", beamA.name, beamB.name); + } + + if (!haveSameMatID) + ret = false; + } + } +#endif // UNITY_EDITOR + + public static bool CanBeBatched(VolumetricLightBeamSD beamA, VolumetricLightBeamSD beamB, ref string reasons) + { + if(DoesRenderingModePreventBatching(ShaderMode.SD, ref reasons)) + return false; + + bool ret = true; + ret &= CanBeBatched(beamA, ref reasons); + ret &= CanBeBatched(beamB, ref reasons); + +#if UNITY_EDITOR + bool shouldCheckMaterialID = ret; +#endif // UNITY_EDITOR + + if (Config.Instance.featureEnabledDynamicOcclusion) + { + if ((beamA.GetComponent() == null) != (beamB.GetComponent() == null)) + { + AppendErrorMessage(ref reasons, string.Format("{0}/{1}: dynamically occluded and non occluded beams cannot be batched together", beamA.name, beamB.name)); + ret = false; + } + } + + if (Config.Instance.featureEnabledColorGradient != FeatureEnabledColorGradient.Off && beamA.colorMode != beamB.colorMode) + { + AppendErrorMessage(ref reasons, string.Format("'Color Mode' mismatch: {0} / {1}", beamA.colorMode, beamB.colorMode)); + ret = false; + } + + if (beamA.blendingMode != beamB.blendingMode) + { + AppendErrorMessage(ref reasons, string.Format("'Blending Mode' mismatch: {0} / {1}", beamA.blendingMode, beamB.blendingMode)); + ret = false; + } + + if (Config.Instance.featureEnabledNoise3D && beamA.isNoiseEnabled != beamB.isNoiseEnabled) + { + AppendErrorMessage(ref reasons, string.Format("'3D Noise' enabled mismatch: {0} / {1}", beamA.noiseMode, beamB.noiseMode)); + ret = false; + } + + if (Config.Instance.featureEnabledDepthBlend && !forceEnableDepthBlend) + { +#pragma warning disable 0162 + if ((beamA.depthBlendDistance > 0) != (beamB.depthBlendDistance > 0)) + { + AppendErrorMessage(ref reasons, string.Format("'Opaque Geometry Blending' mismatch: {0} / {1}", beamA.depthBlendDistance, beamB.depthBlendDistance)); + ret = false; + } +#pragma warning restore 0162 + } + + if (Config.Instance.featureEnabledShaderAccuracyHigh && beamA.shaderAccuracy != beamB.shaderAccuracy) + { + AppendErrorMessage(ref reasons, string.Format("'Shader Accuracy' mismatch: {0} / {1}", beamA.shaderAccuracy, beamB.shaderAccuracy)); + ret = false; + } + +#if UNITY_EDITOR + if (shouldCheckMaterialID) + { + CheckMaterialID(beamA, beamB, ref ret, ref reasons); + } +#endif // UNITY_EDITOR + return ret; + } + + public static bool CanBeBatched(VolumetricLightBeamSD beam, ref string reasons) + { + bool ret = true; + + if (Config.Instance.GetActualRenderingMode(ShaderMode.SD) == RenderingMode.GPUInstancing) + { + if (beam.geomMeshType != MeshType.Shared) + { + AppendErrorMessage(ref reasons, string.Format("{0} is not using shared mesh", beam.name)); + ret = false; + } + } + + if (Config.Instance.featureEnabledDynamicOcclusion && beam.GetComponent() != null) + { + AppendErrorMessage(ref reasons, string.Format("{0} is using the DynamicOcclusion DepthBuffer feature", beam.name)); + ret = false; + } + return ret; + } + + // HD + public static bool CanBeBatched(VolumetricLightBeamHD beamA, VolumetricLightBeamHD beamB, ref string reasons) + { + if (DoesRenderingModePreventBatching(ShaderMode.HD, ref reasons)) + return false; + + bool ret = true; + ret &= CanBeBatched(beamA, ref reasons); + ret &= CanBeBatched(beamB, ref reasons); + +#if UNITY_EDITOR + bool shouldCheckMaterialID = ret; +#endif // UNITY_EDITOR + + if (Config.Instance.featureEnabledColorGradient != FeatureEnabledColorGradient.Off && beamA.colorMode != beamB.colorMode) + { + AppendErrorMessage(ref reasons, string.Format("'Color Mode' mismatch: {0} / {1}", beamA.colorMode, beamB.colorMode)); + ret = false; + } + + if (beamA.blendingMode != beamB.blendingMode) + { + AppendErrorMessage(ref reasons, string.Format("'Blending Mode' mismatch: {0} / {1}", beamA.blendingMode, beamB.blendingMode)); + ret = false; + } + + if (beamA.attenuationEquation != beamB.attenuationEquation) + { + AppendErrorMessage(ref reasons, string.Format("'Attenuation Equation' mismatch: {0} / {1}", beamA.attenuationEquation, beamB.attenuationEquation)); + ret = false; + } + + if (Config.Instance.featureEnabledNoise3D && beamA.isNoiseEnabled != beamB.isNoiseEnabled) + { + AppendErrorMessage(ref reasons, string.Format("'3D Noise' enabled mismatch: {0} / {1}", beamA.noiseMode, beamB.noiseMode)); + ret = false; + } + + if (beamA.raymarchingQualityID != beamB.raymarchingQualityID) + { + AppendErrorMessage(ref reasons, string.Format("'Raymarching Quality' mismatch: {0} / {1}" + , Config.Instance.GetRaymarchingQualityForUniqueID(beamA.raymarchingQualityID).name + , Config.Instance.GetRaymarchingQualityForUniqueID(beamB.raymarchingQualityID).name)); + ret = false; + } + +#if UNITY_EDITOR + if (shouldCheckMaterialID) + { + CheckMaterialID(beamA, beamB, ref ret, ref reasons); + } +#endif // UNITY_EDITOR + return ret; + } + + public static bool CanBeBatched(VolumetricLightBeamHD beam, ref string reasons) + { + bool ret = true; + + if (Config.Instance.featureEnabledShadow && beam.GetAdditionalComponentShadow() != null) + { + AppendErrorMessage(ref reasons, string.Format("{0} is using the Shadow feature", beam.name)); + ret = false; + } + + if (Config.Instance.featureEnabledCookie && beam.GetAdditionalComponentCookie() != null) + { + AppendErrorMessage(ref reasons, string.Format("{0} is using the Cookie feature", beam.name)); + ret = false; + } + + return ret; + } + + public static bool CanBeBatched(VolumetricLightBeamAbstractBase beamA, VolumetricLightBeamAbstractBase beamB, ref string reasons) + { + if (beamA is VolumetricLightBeamSD aSD && beamB is VolumetricLightBeamSD bSD) return CanBeBatched(aSD, bSD, ref reasons); + if (beamA is VolumetricLightBeamHD aHD && beamB is VolumetricLightBeamHD bHD) return CanBeBatched(aHD, bHD, ref reasons); + return false; + } + + static void AppendErrorMessage(ref string message, string toAppend) + { + if (message != "") message += "\n"; + message += "- " + toAppend; + } + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/BatchingHelper.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/BatchingHelper.cs.meta new file mode 100644 index 00000000..d855b278 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/BatchingHelper.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: eb22530640d12f542baf4bb5bf6306ff +timeCreated: 1538426592 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/BeamGeometryAbstractBase.cs b/Assets/External/VolumetricLightBeam/Scripts/BeamGeometryAbstractBase.cs new file mode 100644 index 00000000..8d4674c3 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/BeamGeometryAbstractBase.cs @@ -0,0 +1,56 @@ +using UnityEngine; + +namespace VLB +{ + public abstract class BeamGeometryAbstractBase : MonoBehaviour + { + public MeshRenderer meshRenderer { get; protected set; } + + public MeshFilter meshFilter { get; protected set; } + public Mesh coneMesh { get; protected set; } + + protected Matrix4x4 m_ColorGradientMatrix; + protected Material m_CustomMaterial = null; + + protected abstract VolumetricLightBeamAbstractBase GetMaster(); + + void Start() + { + DestroyInvalidOwner(); // Handle copy / paste the LightBeam in Editor + } + + + void OnDestroy() + { + if (m_CustomMaterial) + { + DestroyImmediate(m_CustomMaterial); + m_CustomMaterial = null; + } + } + + void DestroyInvalidOwner() + { + if (!GetMaster()) + DestroyBeamGeometryGameObject(this); + } + + public static void DestroyBeamGeometryGameObject(BeamGeometryAbstractBase beamGeom) + { + if (beamGeom) + DestroyImmediate(beamGeom.gameObject); + } + +#if UNITY_EDITOR + void Update() + { + if (!Application.isPlaying) + { + DestroyInvalidOwner(); + } + } + + public bool _EDITOR_IsUsingCustomMaterial { get { return m_CustomMaterial != null; } } +#endif + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/BeamGeometryAbstractBase.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/BeamGeometryAbstractBase.cs.meta new file mode 100644 index 00000000..6d8939db --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/BeamGeometryAbstractBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 29242f41c5b476944bd6b05a56906080 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/CachedLightProperties.cs b/Assets/External/VolumetricLightBeam/Scripts/CachedLightProperties.cs new file mode 100644 index 00000000..73a4806b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/CachedLightProperties.cs @@ -0,0 +1,41 @@ +#if UNITY_EDITOR +using UnityEngine; + +namespace VLB +{ + public struct CachedLightProperties + { + Light light; + float range; + float spotAngle; + Color color; + + public CachedLightProperties(Light lightParam) + { + light = lightParam; + range = -1f; + spotAngle = -1f; + color = Color.white; + + if (light) + { + Debug.Assert(light.type == LightType.Spot); + range = light.range; + spotAngle = light.spotAngle; + color = light.color; + } + } + + public override int GetHashCode() { return light ? light.GetHashCode() : 0; } + public bool Equals(CachedLightProperties other) { return Equals(other, this); } + public override bool Equals(object obj) + { + if (obj == null || GetType() != obj.GetType()) + return false; + + var other = (CachedLightProperties)obj; + return other.range == range && other.spotAngle == spotAngle && other.color == color; + } + } +} +#endif diff --git a/Assets/External/VolumetricLightBeam/Scripts/CachedLightProperties.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/CachedLightProperties.cs.meta new file mode 100644 index 00000000..bc02b1b1 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/CachedLightProperties.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b455c84cf6c7ad74e84e15749caaccc3 +timeCreated: 1510650372 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/Config.cs b/Assets/External/VolumetricLightBeam/Scripts/Config.cs new file mode 100644 index 00000000..4442d206 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/Config.cs @@ -0,0 +1,867 @@ +#if UNITY_EDITOR +//#define PROFILE_INSTANCE_LOADING +using UnityEditor; +#endif +using UnityEngine; +using UnityEngine.Serialization; + +#if VLB_URP +using UnityEngine.Rendering.Universal; +#endif + +namespace VLB +{ + [HelpURL(Consts.Help.UrlConfig)] + public class Config : ScriptableObject + { + public const string ClassName = "Config"; + + public const string kAssetName = "VLBConfigOverride"; + public const string kAssetNameExt = ".asset"; + + /// + /// Override the layer on which the procedural geometry is created or not + /// + public bool geometryOverrideLayer = Consts.Config.GeometryOverrideLayerDefault; + + /// + /// The layer the procedural geometry gameObject is in (only if geometryOverrideLayer is enabled) + /// + public int geometryLayerID = Consts.Config.GeometryLayerIDDefault; + + /// + /// The tag applied on the procedural geometry gameObject + /// + public string geometryTag = Consts.Config.GeometryTagDefault; + + /// + /// Determine in which order beams are rendered compared to other objects. + /// This way for example transparent objects are rendered after opaque objects, and so on. + /// + public int geometryRenderQueue = (int)Consts.Config.GeometryRenderQueueDefault; + public int geometryRenderQueueHD = (int)Consts.Config.HD.GeometryRenderQueueDefault; + + /// + /// Select the Render Pipeline (Built-In or SRP) in use. + /// + public RenderPipeline renderPipeline + { + get { return m_RenderPipeline; } + set + { +#if UNITY_EDITOR + m_RenderPipeline = value; +#else + Debug.LogError("Modifying the RenderPipeline in standalone builds is not permitted"); +#endif + } + } + [FormerlySerializedAs("renderPipeline"), FormerlySerializedAs("_RenderPipeline")] + [SerializeField] RenderPipeline m_RenderPipeline = Consts.Config.GeometryRenderPipelineDefault; + + /// + /// MultiPass: Use the 2 pass shader. Will generate 2 drawcalls per beam. + /// SinglePass: Use the 1 pass shader. Will generate 1 drawcall per beam. + /// GPUInstancing: Dynamically batch multiple beams to combine and reduce draw calls (Feature only supported in Unity 5.6 or above). More info: https://docs.unity3d.com/Manual/GPUInstancing.html + /// SRPBatcher: Use the SRP Batcher to automatically batch multiple beams and reduce draw calls. Only available when using SRP. + /// + public RenderingMode renderingMode + { + get { return m_RenderingMode; } + set + { +#if UNITY_EDITOR + m_RenderingMode = value; +#else + Debug.LogError("Modifying the RenderingMode in standalone builds is not permitted"); +#endif + } + } + [FormerlySerializedAs("renderingMode"), FormerlySerializedAs("_RenderingMode")] + [SerializeField] RenderingMode m_RenderingMode = Consts.Config.GeometryRenderingModeDefault; + + + public bool IsSRPBatcherSupported() + { + // The SRP Batcher Rendering Mode is only compatible when using a SRP + if (renderPipeline == RenderPipeline.BuiltIn) return false; + + // SRP Batcher only works with URP and HDRP + var rp = SRPHelper.projectRenderPipeline; + return rp == RenderPipeline.URP || rp == RenderPipeline.HDRP; + } + + /// + /// Actual Rendering Mode used on the current platform + /// + public RenderingMode GetActualRenderingMode(ShaderMode shaderMode) + { + if (renderingMode == RenderingMode.SRPBatcher && !IsSRPBatcherSupported()) return RenderingMode.Default; + + // Using a Scriptable Render Pipeline with 'Multi-Pass' Rendering Mode is not supported + if (renderPipeline != RenderPipeline.BuiltIn && renderingMode == RenderingMode.MultiPass) return RenderingMode.Default; + + // HD beams require single pass shaders + if (shaderMode == ShaderMode.HD && renderingMode == RenderingMode.MultiPass) return RenderingMode.Default; + + return renderingMode; + } + + /// + /// Depending on the actual Rendering Mode used, returns true if the single pass shader will be used, false otherwise. + /// + public bool SD_useSinglePassShader { get { return GetActualRenderingMode(ShaderMode.SD) != RenderingMode.MultiPass; } } + + public bool SD_requiresDoubleSidedMesh { get { return SD_useSinglePassShader; } } + + /// + /// Main shader applied to the cone beam geometry + /// + public Shader GetBeamShader(ShaderMode mode) + { +#if UNITY_EDITOR + var shader = GetBeamShaderInternal(mode); + if (shader == null) + RefreshShader(mode, RefreshShaderFlags.All); + return shader; +#else + return GetBeamShaderInternal(mode); +#endif + } + + ref Shader GetBeamShaderInternal(ShaderMode mode) + { + if(mode == ShaderMode.SD) return ref _BeamShader; + else return ref _BeamShaderHD; + } + + int GetRenderQueueInternal(ShaderMode mode) + { + if (mode == ShaderMode.SD) return geometryRenderQueue; + else return geometryRenderQueueHD; + } + + public Material NewMaterialTransient(ShaderMode mode, bool gpuInstanced) + { + var material = MaterialManager.NewMaterialPersistent(GetBeamShader(mode), gpuInstanced); + if (material) + { + material.hideFlags = Consts.Internal.ProceduralObjectsHideFlags; + material.renderQueue = GetRenderQueueInternal(mode); + } + return material; + } + + /// + /// Depending on the quality of your screen, you might see some artifacts with high contrast visual (like a white beam over a black background). + /// These is a very common problem known as color banding. + /// To help with this issue, the plugin offers a Dithering factor: it smooths the banding by introducing a subtle pattern of noise. + /// + public float ditheringFactor = Consts.Config.DitheringFactor; + + /// + /// Contribution of the attached spotlight temperature to the final beam color. + /// Only useful when: + /// - The beams is attached to a Unity spotlight. + /// - The beams color is linked to the Unity Light color. + /// - The Unity light uses 'color temperature mode' and is specified with 'Filter' and 'Temperature' properties. + /// + public bool useLightColorTemperature = Consts.Config.UseLightColorTemperatureDefault; + + /// + /// Number of Sides of the shared cone mesh + /// + public int sharedMeshSides = Consts.Config.SharedMeshSidesDefault; + + /// + /// Number of Segments of the shared cone mesh + /// + public int sharedMeshSegments = Consts.Config.SharedMeshSegmentsDefault; + + /// + /// Distance from the camera the beam will fade (for HD beams only, for SD beams, this option can be configured per beam) + /// 0 = hard intersection + /// Higher values produce soft intersection when the camera is near the cone triangles. + /// + public float hdBeamsCameraBlendingDistance = Consts.Config.HD.CameraBlendingDistance; + + /// + /// When using URP, specify a custom Renderer index used by the depth cameras for the 'Dynamic Occlusion (Depth Buffer)' with SD beams and 'Volumetric Shadow' for HD Beams features. + /// The 'Renderer list' is editable in the URP asset. + /// We recommend to specify a custom index referencing the URP default 'ForwardRenderer' when you are using a custom renderer that doesn't support writing to depth render texture. + /// This is the case if you encounter errors like: 'RenderTexture.Create failed: colorFormat & depthStencilFormat cannot both be none.' + /// Set -1 to disable this feature. + /// + public int urpDepthCameraScriptableRendererIndex = -1; + + public void SetURPScriptableRendererIndexToDepthCamera(Camera camera) + { +#if VLB_URP + if (urpDepthCameraScriptableRendererIndex < 0) + return; + + Debug.Assert(camera); + var cameraData = camera.GetUniversalAdditionalCameraData(); + if (cameraData) + { + cameraData.SetRenderer(urpDepthCameraScriptableRendererIndex); + } +#endif + } + + /// + /// Global 3D Noise texture scaling: higher scale make the noise more visible, but potentially less realistic. + /// + [Range(Consts.Beam.NoiseScaleMin, Consts.Beam.NoiseScaleMax)] + public float globalNoiseScale = Consts.Beam.NoiseScaleDefault; + + /// + /// Global World Space direction and speed of the noise scrolling, simulating the fog/smoke movement + /// + public Vector3 globalNoiseVelocity = Consts.Beam.NoiseVelocityDefault; + + /// + /// Tag used to retrieve the camera used to compute the fade out factor on beams + /// + public string fadeOutCameraTag = Consts.Config.FadeOutCameraTagDefault; + + public Transform fadeOutCameraTransform + { + get + { + if (m_CachedFadeOutCamera == null) + { + ForceUpdateFadeOutCamera(); + } + + return m_CachedFadeOutCamera; + } + } + + /// + /// Call this function if you want to manually change the fadeOutCameraTag property at runtime + /// + public void ForceUpdateFadeOutCamera() + { + var gao = GameObject.FindGameObjectWithTag(fadeOutCameraTag); + if (gao) + m_CachedFadeOutCamera = gao.transform; + } + + /// + /// 3D Texture storing noise data. + /// + [HighlightNull] + public Texture3D noiseTexture3D = null; + + /// + /// ParticleSystem prefab instantiated for the Volumetric Dust Particles feature (Unity 5.5 or above) + /// + [HighlightNull] + public ParticleSystem dustParticlesPrefab = null; + + /// + /// Noise texture for dithering feature + /// + [HighlightNull] + public Texture2D ditheringNoiseTexture = null; + + [HighlightNull] + public Texture2D jitteringNoiseTexture = null; + + /// + /// Off: do not support having a gradient as color. + /// High Only: support gradient color only for devices with Shader Level = 35 or higher. + /// High and Low: support gradient color for all devices. + /// + public FeatureEnabledColorGradient featureEnabledColorGradient = Consts.Config.FeatureEnabledColorGradientDefault; + + /// + /// Support 'Soft Intersection with Opaque Geometry' feature or not. + /// + public bool featureEnabledDepthBlend = Consts.Config.FeatureEnabledDefault; + + /// + /// Support 'Noise 3D' feature or not. + /// + public bool featureEnabledNoise3D = Consts.Config.FeatureEnabledDefault; + + /// + /// Support 'Dynamic Occlusion' features or not. + /// + public bool featureEnabledDynamicOcclusion = Consts.Config.FeatureEnabledDefault; + + /// + /// Support 'Mesh Skewing' feature or not. + /// + public bool featureEnabledMeshSkewing = Consts.Config.FeatureEnabledDefault; + + /// + /// Support 'Shader Accuracy' property set to 'High' or not. + /// + public bool featureEnabledShaderAccuracyHigh = Consts.Config.FeatureEnabledDefault; + + /// + /// Support 'Shadow' features or not. + /// + public bool featureEnabledShadow = true; + + /// + /// Support 'Cookie' feature or not. + /// + public bool featureEnabledCookie = true; + + + + /// RAYMARCHING BEGIN + [SerializeField] RaymarchingQuality[] m_RaymarchingQualities = null; + + [SerializeField] int m_DefaultRaymarchingQualityUniqueID = 0; + + public int defaultRaymarchingQualityUniqueID => m_DefaultRaymarchingQualityUniqueID; + + public RaymarchingQuality GetRaymarchingQualityForIndex(int index) + { + Debug.Assert(index >= 0); + Debug.Assert(m_RaymarchingQualities != null); + Debug.Assert(index < m_RaymarchingQualities.Length); + return m_RaymarchingQualities[index]; + } + + public RaymarchingQuality GetRaymarchingQualityForUniqueID(int id) + { + int index = GetRaymarchingQualityIndexForUniqueID(id); + if (index >= 0) + return GetRaymarchingQualityForIndex(index); + return null; + } + + public int GetRaymarchingQualityIndexForUniqueID(int id) + { + for (int i = 0; i < m_RaymarchingQualities.Length; ++i) + { + var qual = m_RaymarchingQualities[i]; + if (qual != null && qual.uniqueID == id) + return i; + } + + Debug.LogErrorFormat("Failed to find RaymarchingQualityIndex for Unique ID {0}", id); + return -1; + } + + public bool IsRaymarchingQualityUniqueIDValid(int id) { return GetRaymarchingQualityIndexForUniqueID(id) >= 0; } + +#if UNITY_EDITOR + public void AddRaymarchingQuality(RaymarchingQuality qual) + { + ArrayUtility.Add(ref m_RaymarchingQualities, qual); + } + + public void RemoveRaymarchingQualityAtIndex(int index) + { + Debug.Assert(index >= 0); + Debug.Assert(index < m_RaymarchingQualities.Length); + ArrayUtility.RemoveAt(ref m_RaymarchingQualities, index); + } +#endif + + public int raymarchingQualitiesCount { get { return Mathf.Max(1, m_RaymarchingQualities != null ? m_RaymarchingQualities.Length : 1); } } + + void CreateDefaultRaymarchingQualityPreset(bool onlyIfNeeded) + { + if (m_RaymarchingQualities == null || m_RaymarchingQualities.Length == 0 || !onlyIfNeeded) + { + m_RaymarchingQualities = new RaymarchingQuality[3]; + // set forced unique ID for default qualities to keep finding them even when deleting Config instance + m_RaymarchingQualities[0] = RaymarchingQuality.New("Fast", 1, 5); + m_RaymarchingQualities[1] = RaymarchingQuality.New("Balanced", 2, 10); + m_RaymarchingQualities[2] = RaymarchingQuality.New("High", 3, 20); + m_DefaultRaymarchingQualityUniqueID = m_RaymarchingQualities[1].uniqueID; + } + } + /// RAYMARCHING END + + + public bool isHDRPExposureWeightSupported + { + get + { + #if UNITY_2021_1_OR_NEWER + return renderPipeline == RenderPipeline.HDRP; + #else + return false; // GetCurrentExposureMultiplier is accessible but doesn't return a proper value in Unity 2020 for some reasons + #endif + } + } + + // INTERNAL +#pragma warning disable 0414 + [SerializeField] int pluginVersion = -1; + [SerializeField] Material _DummyMaterial = null; + [SerializeField] Material _DummyMaterialHD = null; + [SerializeField] Shader _BeamShader = null; + [SerializeField] Shader _BeamShaderHD = null; +#pragma warning restore 0414 + + Transform m_CachedFadeOutCamera = null; + + public bool hasRenderPipelineMismatch { get { return (SRPHelper.projectRenderPipeline == RenderPipeline.BuiltIn) != (m_RenderPipeline == RenderPipeline.BuiltIn); } } + + [RuntimeInitializeOnLoadMethod] + static void OnStartup() + { + Instance.m_CachedFadeOutCamera = null; + Instance.RefreshGlobalShaderProperties(); + +#if UNITY_EDITOR + Instance.RefreshShaders(RefreshShaderFlags.All); +#endif + + if (Instance.hasRenderPipelineMismatch) + Debug.LogError("It looks like the 'Render Pipeline' is not correctly set in the config. Please make sure to select the proper value depending on your pipeline in use.", Instance); + } + +#if UNITY_EDITOR + [InitializeOnLoadMethod] + static void OnProjectLoadedInEditor() + { + // Code executed on Unity Editor startup + // use the static variable and NOT the Instance property to prevent from creating a Config instance right away when you unpack the plugin, + // otherwise other assets (noise texture...) might not be loaded and references can be broken + if (ms_Instance) + ms_Instance.SetScriptingDefineSymbolsForCurrentRenderPipeline(); + } + + public void SetScriptingDefineSymbolsForCurrentRenderPipeline() + { + SRPHelper.SetScriptingDefineSymbolsForRenderPipeline(renderPipeline); + } +#endif + + public void Reset() + { + geometryOverrideLayer = Consts.Config.GeometryOverrideLayerDefault; + geometryLayerID = Consts.Config.GeometryLayerIDDefault; + geometryTag = Consts.Config.GeometryTagDefault; + geometryRenderQueue = (int)Consts.Config.GeometryRenderQueueDefault; + geometryRenderQueueHD = (int)Consts.Config.HD.GeometryRenderQueueDefault; + + sharedMeshSides = Consts.Config.SharedMeshSidesDefault; + sharedMeshSegments = Consts.Config.SharedMeshSegmentsDefault; + + globalNoiseScale = Consts.Beam.NoiseScaleDefault; + globalNoiseVelocity = Consts.Beam.NoiseVelocityDefault; + + renderPipeline = Consts.Config.GeometryRenderPipelineDefault; + renderingMode = Consts.Config.GeometryRenderingModeDefault; + ditheringFactor = Consts.Config.DitheringFactor; + useLightColorTemperature = Consts.Config.UseLightColorTemperatureDefault; + + fadeOutCameraTag = Consts.Config.FadeOutCameraTagDefault; + + featureEnabledColorGradient = Consts.Config.FeatureEnabledColorGradientDefault; + featureEnabledDepthBlend = Consts.Config.FeatureEnabledDefault; + featureEnabledNoise3D = Consts.Config.FeatureEnabledDefault; + featureEnabledDynamicOcclusion = Consts.Config.FeatureEnabledDefault; + featureEnabledMeshSkewing = Consts.Config.FeatureEnabledDefault; + featureEnabledShaderAccuracyHigh = Consts.Config.FeatureEnabledDefault; + + hdBeamsCameraBlendingDistance = Consts.Config.HD.CameraBlendingDistance; + urpDepthCameraScriptableRendererIndex = -1; + + CreateDefaultRaymarchingQualityPreset(onlyIfNeeded: false); + + ResetInternalData(); + +#if UNITY_EDITOR + GlobalMeshSD.Destroy(); + Utils._EditorSetAllMeshesDirty(); +#endif + } + + void RefreshGlobalShaderProperties() + { + Shader.SetGlobalFloat(ShaderProperties.GlobalUsesReversedZBuffer, SystemInfo.usesReversedZBuffer ? 1.0f : 0.0f); + Shader.SetGlobalFloat(ShaderProperties.GlobalDitheringFactor, ditheringFactor); + Shader.SetGlobalTexture(ShaderProperties.GlobalDitheringNoiseTex, ditheringNoiseTexture); + + Shader.SetGlobalFloat(ShaderProperties.HD.GlobalCameraBlendingDistance, hdBeamsCameraBlendingDistance); + Shader.SetGlobalTexture(ShaderProperties.HD.GlobalJitteringNoiseTex, jitteringNoiseTexture); + } + +#if UNITY_EDITOR + public void _EditorSetRenderingModeAndRefreshShader(RenderingMode mode) + { + renderingMode = mode; + RefreshShaders(RefreshShaderFlags.All); + } + + void OnValidate() + { + sharedMeshSides = Mathf.Clamp(sharedMeshSides, Consts.Config.SharedMeshSidesMin, Consts.Config.SharedMeshSidesMax); + sharedMeshSegments = Mathf.Clamp(sharedMeshSegments, Consts.Config.SharedMeshSegmentsMin, Consts.Config.SharedMeshSegmentsMax); + + ditheringFactor = Mathf.Clamp01(ditheringFactor); + + hdBeamsCameraBlendingDistance = Mathf.Max(hdBeamsCameraBlendingDistance, 0f); + } + + void AutoSelectRenderPipeline() + { + var newPipeline = SRPHelper.projectRenderPipeline; + if (newPipeline != renderPipeline) + { + renderPipeline = newPipeline; + EditorUtility.SetDirty(this); // make sure to save this property change + RefreshShaders(RefreshShaderFlags.All); + SetScriptingDefineSymbolsForCurrentRenderPipeline(); + } + } + + public static void EditorSelectInstance() + { + Selection.activeObject = Instance; // this will create the instance if it doesn't exist + if (Selection.activeObject == null) + Debug.LogError("Cannot find any Config resource"); + } + + ref Material GetDummyMaterial(ShaderMode shaderMode) + { + if (shaderMode == ShaderMode.SD) return ref _DummyMaterial; + else return ref _DummyMaterialHD; + } + + [System.Flags] + public enum RefreshShaderFlags + { + Reference = 1 << 1, + Dummy = 1 << 2, + All = Reference | Dummy, + } + + public void RefreshShaders(RefreshShaderFlags flags) + { + foreach (ShaderMode shaderMode in System.Enum.GetValues(typeof(ShaderMode))) + RefreshShader(shaderMode, flags); + } + + public void RefreshShader(ShaderMode shaderMode, RefreshShaderFlags flags) + { + ref Shader shader = ref GetBeamShaderInternal(shaderMode); + + if (flags.HasFlag(RefreshShaderFlags.Reference)) + { + var prevShader = shader; + + var configProps = new ShaderGenerator.ConfigProps + { + renderPipeline = m_RenderPipeline, + renderingMode = GetActualRenderingMode(shaderMode), + dithering = ditheringFactor > 0.0f, + noise3D = featureEnabledNoise3D, + colorGradient = featureEnabledColorGradient, + depthBlend = featureEnabledDepthBlend, + dynamicOcclusion = featureEnabledDynamicOcclusion, + meshSkewing = featureEnabledMeshSkewing, + shaderAccuracyHigh = featureEnabledShaderAccuracyHigh, + cookie = featureEnabledCookie, + shadow = featureEnabledShadow, + raymarchingQualities = m_RaymarchingQualities + }; + + shader = ShaderGenerator.Generate(shaderMode, configProps); + + if (shader != prevShader) + { + EditorUtility.SetDirty(this); + } + } + + if (flags.HasFlag(RefreshShaderFlags.Dummy) && shader != null) + { + bool gpuInstanced = GetActualRenderingMode(shaderMode) == RenderingMode.GPUInstancing; + ref var dummyMat = ref GetDummyMaterial(shaderMode); + dummyMat = DummyMaterial.Create(shaderMode, shader, gpuInstanced); + } + + if (GetDummyMaterial(shaderMode) == null) + { + Debug.LogErrorFormat(this, "No dummy material referenced to VLB config for ShaderMode {0}, please try to reset this asset.", shaderMode); + } + + RefreshGlobalShaderProperties(); + } + + static void DeleteAsset(ref T assetObject) where T : UnityEngine.Object + { + if (assetObject) + { + var path = UnityEditor.AssetDatabase.GetAssetPath(assetObject); + AssetDatabase.DeleteAsset(path); + assetObject = null; + } + } + + public static void CleanGeneratedAssets() + { + var instance = Instance; + if (instance) + { + DeleteAsset(ref instance._DummyMaterial); + DeleteAsset(ref instance._DummyMaterialHD); + DeleteAsset(ref instance._BeamShader); + DeleteAsset(ref instance._BeamShaderHD); + DeleteAsset(ref instance); + } + } +#endif // UNITY_EDITOR + + public void ResetInternalData() + { + noiseTexture3D = Resources.Load("Noise3D_64x64x64") as Texture3D; + + dustParticlesPrefab = Resources.Load("DustParticles", typeof(ParticleSystem)) as ParticleSystem; + + ditheringNoiseTexture = Resources.Load("VLBDitheringNoise", typeof(Texture2D)) as Texture2D; + jitteringNoiseTexture = Resources.Load("VLBBlueNoise", typeof(Texture2D)) as Texture2D; + +#if UNITY_EDITOR + RefreshShaders(RefreshShaderFlags.All); +#endif + } + + public ParticleSystem NewVolumetricDustParticles() + { + if (!dustParticlesPrefab) + { + if (Application.isPlaying) + { + Debug.LogError("Failed to instantiate VolumetricDustParticles prefab."); + } + return null; + } + + var instance = Instantiate(dustParticlesPrefab); + instance.useAutoRandomSeed = false; + instance.name = "Dust Particles"; + instance.gameObject.hideFlags = Consts.Internal.ProceduralObjectsHideFlags; + instance.gameObject.SetActive(true); + return instance; + } + + void OnEnable() + { + CreateDefaultRaymarchingQualityPreset(onlyIfNeeded:true); + + HandleBackwardCompatibility(pluginVersion, Version.Current); + pluginVersion = Version.Current; + } + + void HandleBackwardCompatibility(int serializedVersion, int newVersion) + { +#if UNITY_EDITOR + if (serializedVersion == -1) return; // freshly new spawned config: nothing to do + if (serializedVersion == newVersion) return; // same version: nothing to do + + if (serializedVersion < 1830) + { + AutoSelectRenderPipeline(); + } + + if (serializedVersion < 1950) + { + ResetInternalData(); // retrieve Noise3D texture converted from binary data to texture 3D asset in 1950 + EditorUtility.SetDirty(this); // make sure to save this property change + } + + if (serializedVersion < 1980) + { + useLightColorTemperature = false; // light temperature support introduced in version 1980 + EditorUtility.SetDirty(this); // make sure to save this property change + } + + if (serializedVersion < 20000) + { + ResetInternalData(); // retrieve Jittering Noise texture introduced in 20000 + EditorUtility.SetDirty(this); // make sure to save this property change + } + + if (serializedVersion < 20002) + { + SetScriptingDefineSymbolsForCurrentRenderPipeline(); // new Scripting Define Symbols introduced in 20002 + } + + if (newVersion > serializedVersion) + { + // Import to keep, we have to regenerate the shader each time the plugin is updated + RefreshShaders(RefreshShaderFlags.All); + } +#endif + } + + // Singleton management + static Config ms_Instance = null; + public static Config Instance { get { return GetInstance(true); } } + +#if UNITY_EDITOR && VLB_DEBUG + public struct Guard : System.IDisposable { + public Guard(bool assert) { + if (m_IsAccessing && assert) Debug.LogError("Circular loop in Config.Instance"); + m_IsAccessing = true; + } + + public void Dispose() { m_IsAccessing = false; } + static bool m_IsAccessing = false; + } +#endif // UNITY_EDITOR && VLB_DEBUG + +#if UNITY_EDITOR + static bool ms_ShouldInvalidateCache = false; + public Config() + { + ms_ShouldInvalidateCache = true; // new instance detected, force the cache to be refreshed + } +#endif + + static Config LoadAssetInternal(string assetName) + { + #if PROFILE_INSTANCE_LOADING + var startTime = EditorApplication.timeSinceStartup; + #endif + var instance = Resources.Load(assetName); + #if PROFILE_INSTANCE_LOADING + var totalTime = EditorApplication.timeSinceStartup - startTime; + Debug.Log($"Loading {assetName} in {(int)(totalTime*1000)} ms"); + #endif + return instance; + } + + private static Config GetInstance(bool assertIfNotFound) + { + #if UNITY_EDITOR && VLB_DEBUG + using (new Guard(true)) + #endif // UNITY_EDITOR && VLB_DEBUG + { + bool updateInstance = ms_Instance == null; + #if UNITY_EDITOR + updateInstance |= ms_ShouldInvalidateCache; // Force instance reloading when detecting Config asset changes + #endif + if (updateInstance) + { + #if UNITY_EDITOR + if (ms_IsCreatingInstance) + { + Debug.LogError(string.Format("Trying to access Config.Instance while creating it. Breaking before infinite loop.")); + return null; + } + #endif // UNITY_EDITOR + + // Try to load the instance + { + var newInstance = LoadAssetInternal(kAssetName + PlatformHelper.GetCurrentPlatformSuffix()); + if (newInstance == null) newInstance = LoadAssetInternal(kAssetName); + + #if UNITY_EDITOR + if (newInstance && newInstance != ms_Instance) + { + ms_Instance = newInstance; + newInstance.RefreshGlobalShaderProperties(); // make sure noise textures are properly loaded as soon as the editor is started + } + ms_ShouldInvalidateCache = false; + #endif // UNITY_EDITOR + + ms_Instance = newInstance; + } + + if (ms_Instance == null) + { + #if UNITY_EDITOR + ms_IsCreatingInstance = true; + ms_Instance = CreateInstanceAsset(); + ms_IsCreatingInstance = false; + + ms_Instance.AutoSelectRenderPipeline(); + ms_Instance.SetScriptingDefineSymbolsForCurrentRenderPipeline(); // force set define symbols the first time we create the instance + + if (Application.isPlaying) + ms_Instance.Reset(); // Reset is not automatically when instancing a ScriptableObject when in playmode + #endif // UNITY_EDITOR + Debug.Assert(!(assertIfNotFound && ms_Instance == null), string.Format("Can't find any resource of type '{0}'. Make sure you have a ScriptableObject of this type in a 'Resources' folder.", typeof(Config))); + } + } + } + return ms_Instance; + } + + #if UNITY_EDITOR + static bool ms_IsCreatingInstance = false; + + public bool IsCurrentlyUsedInstance() { return Instance == this; } + + public bool HasValidAssetName() + { + if (name.IndexOf(kAssetName) != 0) + return false; + + return PlatformHelper.IsValidPlatformSuffix(GetAssetSuffix()); + } + + public string GetAssetSuffix() + { + var fullname = name; + var strToFind = kAssetName; + if (fullname.IndexOf(strToFind) == 0) return fullname.Substring(strToFind.Length); + else return ""; + } + + static void CreateFolderAndAsset(Object obj, string folderParent, string folderResources, string assetName) + { + if (!AssetDatabase.IsValidFolder(string.Format("{0}/{1}", folderParent, folderResources))) + AssetDatabase.CreateFolder(folderParent, folderResources); + + CreateAsset(obj, string.Format("{0}/{1}/{2}", folderParent, folderResources, assetName)); + } + + public static void CreateAsset(Object obj, string fullPath) + { + AssetDatabase.CreateAsset(obj, fullPath); + AssetDatabase.SaveAssets(); + } + + static Config CreateInstanceAsset() + { + var asset = CreateInstance(); + Debug.Assert(asset != null); + CreateFolderAndAsset(asset, "Assets", "Resources", kAssetName + kAssetNameExt); + return asset; + } + + public string GetDebugInfo() + { +#if UNITY_2021_2_OR_NEWER + string scriptingDefineSymbols = PlayerSettings.GetScriptingDefineSymbols(UnityEditor.Build.NamedBuildTarget.FromBuildTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup)); +#else + string scriptingDefineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup); +#endif + + return "Unity version: " + Application.unityVersion + + "\nVLB version: " + Version.Current + + "\nPlatform: " + Application.platform + + "\nOS: " + SystemInfo.operatingSystem + + "\nShader Level: " + SystemInfo.graphicsShaderLevel + + "\nGraphics API: " + SystemInfo.graphicsDeviceType + + "\nUses Reversed ZBuffer: " + SystemInfo.usesReversedZBuffer + + "\nScripting Define Symbols: " + scriptingDefineSymbols + + "\nRender Pipeline Asset: " + (UnityEngine.Rendering.GraphicsSettings.defaultRenderPipeline != null ? UnityEngine.Rendering.GraphicsSettings.defaultRenderPipeline.ToString() : "none") + + "\nRender Pipeline Enum: " + SRPHelper.projectRenderPipeline + + "\nRender Pipeline Selected: " + renderPipeline + + "\nRender Pipeline Symbol: " + SRPHelper.renderPipelineScriptingDefineSymbolAsString + + "\nRendering Mode SD: " + GetActualRenderingMode(ShaderMode.SD) + + "\nRendering Mode HD: " + GetActualRenderingMode(ShaderMode.HD) + + "\nRendering Path: " + (Camera.main != null ? Camera.main.actualRenderingPath.ToString() : "no main camera") + + "\nColor Space: " + QualitySettings.activeColorSpace + ; + } +#endif // UNITY_EDITOR + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/Config.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/Config.cs.meta new file mode 100644 index 00000000..e3993964 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/Config.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: fed3f3d91454db34f894abc9ea1d8ec4 +timeCreated: 1508325517 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/Consts.cs b/Assets/External/VolumetricLightBeam/Scripts/Consts.cs new file mode 100644 index 00000000..32540836 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/Consts.cs @@ -0,0 +1,244 @@ +using UnityEngine; + +namespace VLB +{ + public static class Consts + { + public const string PluginFolder = "VolumetricLightBeam"; + + public static class Help + { + const string UrlBase = "http://saladgamer.com/vlb-doc/"; + const string UrlSuffix = "/"; + public const string UrlDustParticles = UrlBase + "comp-dustparticles" + UrlSuffix; + public const string UrlTriggerZone = UrlBase + "comp-triggerzone" + UrlSuffix; + public const string UrlEffectFlicker = UrlBase + "comp-effect-flicker" + UrlSuffix; + public const string UrlEffectPulse = UrlBase + "comp-effect-pulse" + UrlSuffix; + public const string UrlEffectFromProfile = UrlBase + "comp-effect-from-profile" + UrlSuffix; + public const string UrlConfig = UrlBase + "config" + UrlSuffix; + + public static class SD + { + public const string UrlBeam = UrlBase + "comp-lightbeam-sd" + UrlSuffix; + public const string UrlDynamicOcclusionRaycasting = UrlBase + "comp-dynocclusion-sd-raycasting" + UrlSuffix; + public const string UrlDynamicOcclusionDepthBuffer = UrlBase + "comp-dynocclusion-sd-depthbuffer" + UrlSuffix; + public const string UrlSkewingHandle = UrlBase + "comp-skewinghandle-sd" + UrlSuffix; + } + + public static class HD + { + public const string UrlBeam = UrlBase + "comp-lightbeam-hd" + UrlSuffix; + public const string UrlShadow = UrlBase + "comp-shadow-hd" + UrlSuffix; + public const string UrlCookie = UrlBase + "comp-cookie-hd" + UrlSuffix; + public const string UrlTrackRealtimeChangesOnLight = UrlBase + "comp-trackrealtimechanges-hd" + UrlSuffix; + } + } + + public static class Internal + { + public static readonly bool ProceduralObjectsVisibleInEditor = true; + public static HideFlags ProceduralObjectsHideFlags { get { return ProceduralObjectsVisibleInEditor ? (HideFlags.NotEditable | HideFlags.DontSave) : (HideFlags.HideAndDontSave); } } + } + + public static class Beam + { + public static readonly Color FlatColor = Color.white; + public const ColorMode ColorModeDefault = ColorMode.Flat; + + public const float MultiplierDefault = 1f; + public const float MultiplierMin = 0f; + + public const float IntensityDefault = 1f; + public const float IntensityMin = 0f; + + public const float HDRPExposureWeightDefault = 0f; + public const float HDRPExposureWeightMin = 0f; + public const float HDRPExposureWeightMax = 1f; + + public const float SpotAngleDefault = 35f; + public const float SpotAngleMin = 0.1f; + public const float SpotAngleMax = 179.9f; + public const float ConeRadiusStart = 0.1f; + public const MeshType GeomMeshType = MeshType.Shared; + public const int GeomSidesDefault = 18; + public const int GeomSidesMin = 3; + public const int GeomSidesMax = 256; + public const int GeomSegmentsDefault = 5; + public const int GeomSegmentsMin = 0; + public const int GeomSegmentsMax = 64; + public const bool GeomCap = false; + public const bool ScalableDefault = true; + + public const AttenuationEquation AttenuationEquationDefault = AttenuationEquation.Quadratic; + public const float AttenuationCustomBlendingDefault = 0.5f; + public const float AttenuationCustomBlendingMin = 0.0f; + public const float AttenuationCustomBlendingMax = 1.0f; + public const float FallOffStart = 0f; + public const float FallOffEnd = 3f; + public const float FallOffDistancesMinThreshold = 0.01f; + + public const float DepthBlendDistance = 2f; + public const float CameraClippingDistance = 0.5f; + + public const NoiseMode NoiseModeDefault = NoiseMode.Disabled; + public const float NoiseIntensityMin = 0.0f; + public const float NoiseIntensityMax = 1.0f; + public const float NoiseIntensityDefault = 0.5f; + public const float NoiseScaleMin = 0.01f; + public const float NoiseScaleMax = 2f; + public const float NoiseScaleDefault = 0.5f; + + public static readonly Vector3 NoiseVelocityDefault = new Vector3(0.07f, 0.18f, 0.05f); + + public const BlendingMode BlendingModeDefault = BlendingMode.Additive; + public const ShaderAccuracy ShaderAccuracyDefault = ShaderAccuracy.Fast; + + public const float FadeOutBeginDefault = -150; + public const float FadeOutEndDefault = -200; + public const Dimensions DimensionsDefault = Dimensions.Dim3D; + + public static class SD + { + public const float FresnelPowMaxValue = 10f; + public const float FresnelPow = 8f; + + public const float GlareFrontalDefault = 0.5f; + public const float GlareBehindDefault = 0.5f; + public const float GlareMin = 0.0f; + public const float GlareMax = 1.0f; + + public static readonly Vector2 TiltDefault = Vector2.zero; + public static readonly Vector3 SkewingLocalForwardDirectionDefault = Vector3.forward; + public const Transform ClippingPlaneTransformDefault = null; + } + + public static class HD + { + public const AttenuationEquationHD AttenuationEquationDefault = AttenuationEquationHD.Quadratic; + + public const float SideSoftnessDefault = 1f; + public const float SideSoftnessMin = 0.0001f; + public const float SideSoftnessMax = 10.0f; + + public const float JitteringFactorDefault = 0f; + public const float JitteringFactorMin = 0f; + + public const int JitteringFrameRateDefault = 60; + public const int JitteringFrameRateMin = 0; + public const int JitteringFrameRateMax = 120; + + public static readonly MinMaxRangeFloat JitteringLerpRange = new MinMaxRangeFloat(0.0f, 0.33f); + } + } + + public static class DustParticles + { + public const float AlphaDefault = 0.5f; + public const float SizeDefault = 0.01f; + public const ParticlesDirection DirectionDefault = ParticlesDirection.Random; + public static readonly Vector3 VelocityDefault = new Vector3(0.0f, 0.0f, 0.03f); + public const float DensityDefault = 5f; + public const float DensityMin = 0f; + public const float DensityMax = 1000f; + public static readonly MinMaxRangeFloat SpawnDistanceRangeDefault = new MinMaxRangeFloat(0.0f, 0.7f); + public const bool CullingEnabledDefault = false; + public const float CullingMaxDistanceDefault = 10f; + public const float CullingMaxDistanceMin = 1f; + } + + public static class DynOcclusion + { + public static readonly LayerMask LayerMaskDefault = 1; // Default layer + public const DynamicOcclusionUpdateRate UpdateRateDefault = DynamicOcclusionUpdateRate.EveryXFrames; + public const int WaitFramesCountDefault = 3; + + public const Dimensions RaycastingDimensionsDefault = Dimensions.Dim3D; + public const bool RaycastingConsiderTriggersDefault = false; + public const float RaycastingMinOccluderAreaDefault = 0.0f; + public const float RaycastingMinSurfaceRatioDefault = 0.5f; + public const float RaycastingMinSurfaceRatioMin = 50f; + public const float RaycastingMinSurfaceRatioMax = 100f; + public const float RaycastingMaxSurfaceDotDefault = 0.25f; // around 75 degrees + public const float RaycastingMaxSurfaceAngleMin = 45f; + public const float RaycastingMaxSurfaceAngleMax = 90f; + public const PlaneAlignment RaycastingPlaneAlignmentDefault = PlaneAlignment.Surface; + public const float RaycastingPlaneOffsetDefault = 0.1f; + public const float RaycastingFadeDistanceToSurfaceDefault = 0.25f; + + + public const int DepthBufferDepthMapResolutionDefault = 128; + public const bool DepthBufferOcclusionCullingDefault = true; + public const float DepthBufferFadeDistanceToSurfaceDefault = 0.0f; + } + + public static class Effects + { + public const EffectAbstractBase.ComponentsToChange ComponentsToChangeDefault = (EffectAbstractBase.ComponentsToChange)int.MaxValue; + public const bool RestoreIntensityOnDisableDefault = true; + public const float FrequencyDefault = 10.0f; + public const bool PerformPausesDefault = false; + public const bool RestoreIntensityOnPauseDefault = false; + public static readonly MinMaxRangeFloat FlickeringDurationDefault = new MinMaxRangeFloat(1.0f, 4.0f); + public static readonly MinMaxRangeFloat PauseDurationDefault = new MinMaxRangeFloat(0.0f, 1.0f); + public static readonly MinMaxRangeFloat IntensityAmplitudeDefault = new MinMaxRangeFloat(-1.0f, 1.0f); + public const float SmoothingDefault = 0.05f; + } + + public static class Shadow + { + public const float StrengthDefault = 1.0f; + public const float StrengthMin = 0.0f; + public const float StrengthMax = 1.0f; + public static readonly LayerMask LayerMaskDefault = 1; // Default layer + public const ShadowUpdateRate UpdateRateDefault = ShadowUpdateRate.EveryXFrames; + public const int WaitFramesCountDefault = 3; + public const int DepthMapResolutionDefault = 128; + public const bool OcclusionCullingDefault = true; + + public static string GetErrorChangeRuntimeDepthMapResolution(VLB.VolumetricShadowHD comp) { return string.Format("Can't change {0} Shadow.depthMapResolution property at runtime after DepthCamera initialization", comp.name); } + } + + public static class Cookie + { + public const float ContributionDefault = 1.0f; + public const float ContributionMin = 0.0f; + public const float ContributionMax = 1.0f; + public const Texture CookieTextureDefault = null; + public const CookieChannel ChannelDefault = CookieChannel.Alpha; + public const bool NegativeDefault = false; + public static readonly Vector2 TranslationDefault = Vector2.zero; + public const float RotationDefault = 0.0f; + public static readonly Vector2 ScaleDefault = Vector2.one; + } + + public static class Config + { + public const bool GeometryOverrideLayerDefault = true; + public const int GeometryLayerIDDefault = 1; + public const string GeometryTagDefault = "Untagged"; + public const string FadeOutCameraTagDefault = "MainCamera"; + public const RenderQueue GeometryRenderQueueDefault = RenderQueue.Transparent; + public const RenderPipeline GeometryRenderPipelineDefault = RenderPipeline.BuiltIn; + public const RenderingMode GeometryRenderingModeDefault = RenderingMode.Default; + public const int Noise3DSizeDefault = 64; + public const float DitheringFactor = 0.0f; + public const bool UseLightColorTemperatureDefault = true; + public const bool FeatureEnabledDefault = true; + public const FeatureEnabledColorGradient FeatureEnabledColorGradientDefault = FeatureEnabledColorGradient.HighOnly; + + public const int SharedMeshSidesDefault = 24; + public const int SharedMeshSidesMin = 3; + public const int SharedMeshSidesMax = 256; + public const int SharedMeshSegmentsDefault = 5; + public const int SharedMeshSegmentsMin = 0; + public const int SharedMeshSegmentsMax = 64; + + public static class HD + { + public const RenderQueue GeometryRenderQueueDefault = RenderQueue.Transparent + 100; + public const float CameraBlendingDistance = 0.5f; + public const int RaymarchingQualitiesStepsMin = 2; + } + } + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/Consts.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/Consts.cs.meta new file mode 100644 index 00000000..ee449bef --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/Consts.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: aa337c7dd20e18b49b4b0b5b42e59e96 +timeCreated: 1508860935 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/DummyMaterial.cs b/Assets/External/VolumetricLightBeam/Scripts/DummyMaterial.cs new file mode 100644 index 00000000..84a4cd77 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/DummyMaterial.cs @@ -0,0 +1,49 @@ +using UnityEngine; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace VLB +{ + public static class DummyMaterial + { +#if UNITY_EDITOR + static string GetPath(ShaderMode shaderMode, Shader shader) + { + string kDummyFilename = "VLBDummyMaterial" + shaderMode + ".mat"; + string kDummyPathFallback = "Assets/" + Consts.PluginFolder + "/Shaders/" + kDummyFilename; + + Debug.Assert(shader); + + var shaderPath = AssetDatabase.GetAssetPath(shader); + if (string.IsNullOrEmpty(shaderPath)) + return kDummyPathFallback; + + var shaderFolder = System.IO.Path.GetDirectoryName(shaderPath); + return System.IO.Path.Combine(shaderFolder, kDummyFilename); + } + + /// + /// Create a dummy material with the proper instancing flag to prevent from stripping away needed shader variants when exporting build + /// + public static Material Create(ShaderMode shaderMode, Shader shader, bool gpuInstanced) + { + if (shader == null) + return null; + + string path = GetPath(shaderMode, shader); + var dummyMat = AssetDatabase.LoadAssetAtPath(path); + if (dummyMat == null + || dummyMat.shader != shader + || BatchingHelper.IsGpuInstancingEnabled(dummyMat) != gpuInstanced) + { + dummyMat = MaterialManager.NewMaterialPersistent(shader, gpuInstanced); + if (dummyMat) + AssetDatabase.CreateAsset(dummyMat, path); + } + + return dummyMat; + } +#endif + } +} \ No newline at end of file diff --git a/Assets/External/VolumetricLightBeam/Scripts/DummyMaterial.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/DummyMaterial.cs.meta new file mode 100644 index 00000000..446ec42d --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/DummyMaterial.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1cb6a728dad16224884d567a0a1d618d +timeCreated: 1546757296 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/EditorPrefsStrings.cs b/Assets/External/VolumetricLightBeam/Scripts/EditorPrefsStrings.cs new file mode 100644 index 00000000..1b92388a --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/EditorPrefsStrings.cs @@ -0,0 +1,16 @@ +public static class EditorPrefsStrings +{ +#if UNITY_EDITOR + public static class Beam + { + public const string PrefShowTiltDir = "VLB_BEAM_SHOWTILTDIR"; + } + + public static class DynOcclusion + { + public const string PrefShowDebugPlane = "VLB_DYNOCCLUSION_SHOWDEBUGPLANE"; + public const string PrefRaycastingEditor = "VLB_DYNOCCLUSION_RAYCASTINGEDITOR"; + } +#endif +} + diff --git a/Assets/External/VolumetricLightBeam/Scripts/EditorPrefsStrings.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/EditorPrefsStrings.cs.meta new file mode 100644 index 00000000..9bbb467d --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/EditorPrefsStrings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a26cf2b22b6b7cd47ab72ea8f98b0a73 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/EffectAbstractBase.cs b/Assets/External/VolumetricLightBeam/Scripts/EffectAbstractBase.cs new file mode 100644 index 00000000..0aeb46f2 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/EffectAbstractBase.cs @@ -0,0 +1,126 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Serialization; + +namespace VLB +{ + [AddComponentMenu("")] // hide it from Component search + public class EffectAbstractBase : MonoBehaviour + { + public const string ClassName = "EffectAbstractBase"; + + [System.Flags] + public enum ComponentsToChange + { + UnityLight = 1 << 0, + VolumetricLightBeam = 1 << 1, + VolumetricDustParticles = 1 << 2, + } + + /// + /// Decide which component to change among: + /// - Unity's Light + /// - Volumetric Light Beam + /// - Volumetric Dust Particles + /// + public ComponentsToChange componentsToChange = Consts.Effects.ComponentsToChangeDefault; + + /// + /// Restore the default intensity when this component is disabled. + /// + [FormerlySerializedAs("restoreBaseIntensity")] + public bool restoreIntensityOnDisable = Consts.Effects.RestoreIntensityOnDisableDefault; + + [System.Obsolete("Use 'restoreIntensityOnDisable' instead")] + public bool restoreBaseIntensity { get { return restoreIntensityOnDisable; } set { restoreIntensityOnDisable = value; } } + + protected VolumetricLightBeamAbstractBase m_Beam = null; + protected Light m_Light = null; + protected VolumetricDustParticles m_Particles = null; + protected float m_BaseIntensityBeamInside = 0.0f; + protected float m_BaseIntensityBeamOutside = 0.0f; + protected float m_BaseIntensityLight = 0.0f; + + public virtual void InitFrom(EffectAbstractBase Source) + { + if(Source) + { + componentsToChange = Source.componentsToChange; + restoreIntensityOnDisable = Source.restoreIntensityOnDisable; + } + } + + void GetIntensity(VolumetricLightBeamSD beam) + { + if (beam) + { + m_BaseIntensityBeamInside = beam.intensityInside; + m_BaseIntensityBeamOutside = beam.intensityOutside; + } + } + + void GetIntensity(VolumetricLightBeamHD beam) + { + if (beam) + { + m_BaseIntensityBeamOutside = beam.intensity; + } + } + + void SetIntensity(VolumetricLightBeamSD beam, float additive) + { + if (beam) + { + beam.intensityInside = Mathf.Max(0.0f, m_BaseIntensityBeamInside + additive); + beam.intensityOutside = Mathf.Max(0.0f, m_BaseIntensityBeamOutside + additive); + } + } + + void SetIntensity(VolumetricLightBeamHD beam, float additive) + { + if (beam) + { + beam.intensity = Mathf.Max(0.0f, m_BaseIntensityBeamOutside + additive); + } + } + + protected void SetAdditiveIntensity(float additive) + { + if (componentsToChange.HasFlag(ComponentsToChange.VolumetricLightBeam) && m_Beam) + { + SetIntensity(m_Beam as VolumetricLightBeamSD, additive); + SetIntensity(m_Beam as VolumetricLightBeamHD, additive); + } + + if (componentsToChange.HasFlag(ComponentsToChange.UnityLight) && m_Light) + m_Light.intensity = Mathf.Max(0.0f, m_BaseIntensityLight + additive); + + if (componentsToChange.HasFlag(ComponentsToChange.VolumetricDustParticles) && m_Particles) + m_Particles.alphaAdditionalRuntime = 1.0f + additive; + } + + void Awake() + { + m_Beam = GetComponent(); + m_Light = GetComponent(); + m_Particles = GetComponent(); + GetIntensity(m_Beam as VolumetricLightBeamSD); + GetIntensity(m_Beam as VolumetricLightBeamHD); + m_BaseIntensityLight = m_Light ? m_Light.intensity : 0.0f; + } + + protected virtual void OnEnable() + { + StopAllCoroutines(); + } + + void OnDisable() + { + StopAllCoroutines(); + + if (restoreIntensityOnDisable) + SetAdditiveIntensity(0.0f); + } + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/EffectAbstractBase.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/EffectAbstractBase.cs.meta new file mode 100644 index 00000000..87aeb21c --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/EffectAbstractBase.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2a25e62b0a3d171468d83a4db6928379 +timeCreated: 1617641637 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/EffectFlicker.cs b/Assets/External/VolumetricLightBeam/Scripts/EffectFlicker.cs new file mode 100644 index 00000000..50005d4b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/EffectFlicker.cs @@ -0,0 +1,125 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace VLB +{ + [HelpURL(Consts.Help.UrlEffectFlicker)] + public class EffectFlicker : EffectAbstractBase + { + public new const string ClassName = "EffectFlicker"; + + /// + /// Frequency of flickering. + /// Higher value means the flickering will occur faster. + /// + [Range(1.0f, 60.0f)] + public float frequency = Consts.Effects.FrequencyDefault; + + /// + /// If enabled, pauses will be added between 2 flickering sequences. + /// + public bool performPauses = Consts.Effects.PerformPausesDefault; + + /// + /// The duration of a flickering sequence. + /// A random value will be picked each time inside that range. + /// + [MinMaxRange(0.0f, 10.0f)] + public MinMaxRangeFloat flickeringDuration = Consts.Effects.FlickeringDurationDefault; + + /// + /// The duration of a pause sequence. + /// A random value will be picked each time inside that range. + /// + [MinMaxRange(0.0f, 10.0f)] + public MinMaxRangeFloat pauseDuration = Consts.Effects.PauseDurationDefault; + + /// + /// Restore the default intensity during a pause sequence. + /// + public bool restoreIntensityOnPause = Consts.Effects.RestoreIntensityOnPauseDefault; + + /// + /// The amplitude of intensity change which will be applied to the Light and/or Beam. + /// A random value will be picked each time inside that range. + /// + [MinMaxRange(-5.0f, 5.0f)] + public MinMaxRangeFloat intensityAmplitude = Consts.Effects.IntensityAmplitudeDefault; + + /// + /// How much intensity change will be smoothed. + /// Higher value means the more smoothing. + /// + [Range(0.0f, 0.25f)] + public float smoothing = Consts.Effects.SmoothingDefault; + + + float m_CurrentAdditiveIntensity = 0.0f; + + public override void InitFrom(EffectAbstractBase source) + { + base.InitFrom(source); + + var sourceFlicker = source as EffectFlicker; + if (sourceFlicker) + { + frequency = sourceFlicker.frequency; + performPauses = sourceFlicker.performPauses; + flickeringDuration = sourceFlicker.flickeringDuration; + pauseDuration = sourceFlicker.pauseDuration; + restoreIntensityOnPause = sourceFlicker.restoreIntensityOnPause; + intensityAmplitude = sourceFlicker.intensityAmplitude; + smoothing = sourceFlicker.smoothing; + } + } + + protected override void OnEnable() + { + base.OnEnable(); + StartCoroutine(CoUpdate()); + } + + IEnumerator CoUpdate() + { + while(true) + { + yield return CoFlicker(); + + if(performPauses) + { + yield return CoChangeIntensity(pauseDuration.randomValue, restoreIntensityOnPause ? 0f : m_CurrentAdditiveIntensity); + } + } + } + + IEnumerator CoFlicker() + { + float remainingDuration = flickeringDuration.randomValue; + float lastTime = Time.deltaTime; + + while (!performPauses || remainingDuration > 0.0f) + { + Debug.Assert(frequency > 0.0f); + float freqDuration = 1.0f / frequency; + yield return CoChangeIntensity(freqDuration, intensityAmplitude.randomValue); + remainingDuration -= freqDuration; + } + } + + IEnumerator CoChangeIntensity(float expectedDuration, float nextIntensity) + { + float velocity = 0.0f; + float t = 0.0f; + + while (t < expectedDuration) + { + m_CurrentAdditiveIntensity = Mathf.SmoothDamp(m_CurrentAdditiveIntensity, nextIntensity, ref velocity, smoothing); + SetAdditiveIntensity(m_CurrentAdditiveIntensity); + t += Time.deltaTime; + yield return null; + } + } + } +} + diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAOControl.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/EffectFlicker.cs.meta similarity index 50% rename from Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAOControl.cs.meta rename to Assets/External/VolumetricLightBeam/Scripts/EffectFlicker.cs.meta index 1896ad0d..2400ea84 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAOControl.cs.meta +++ b/Assets/External/VolumetricLightBeam/Scripts/EffectFlicker.cs.meta @@ -1,12 +1,12 @@ fileFormatVersion: 2 -guid: b8c0ece2d92e8be4f8a5909e6896f948 -timeCreated: 1453634854 -licenseType: Store +guid: de6c986ea168387458edac98bcd43dfd +timeCreated: 1617798048 +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: 6dfec383bc9ad504891027fdab8062b1, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/EffectFromProfile.cs b/Assets/External/VolumetricLightBeam/Scripts/EffectFromProfile.cs new file mode 100644 index 00000000..b9c61e70 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/EffectFromProfile.cs @@ -0,0 +1,57 @@ +using UnityEngine; + +namespace VLB +{ + [HelpURL(Consts.Help.UrlEffectFromProfile)] + public class EffectFromProfile : MonoBehaviour + { + public const string ClassName = "EffectFromProfile"; + + public EffectAbstractBase effectProfile + { + get { return m_EffectProfile; } + set + { + m_EffectProfile = value; + InitInstanceFromProfile(); + } + } + + public void InitInstanceFromProfile() + { + if (m_EffectInstance) + { + if (m_EffectProfile) + m_EffectInstance.InitFrom(m_EffectProfile); + else + m_EffectInstance.enabled = false; + } + } + + void OnEnable() + { + if (m_EffectInstance) + { + m_EffectInstance.enabled = true; + } + else if (m_EffectProfile) + { + m_EffectInstance = (gameObject.AddComponent(m_EffectProfile.GetType()) as EffectAbstractBase); + InitInstanceFromProfile(); + } + } + + void OnDisable() + { + if (m_EffectInstance) + { + m_EffectInstance.enabled = false; + } + } + + [SerializeField] + EffectAbstractBase m_EffectProfile = null; + + EffectAbstractBase m_EffectInstance = null; + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/EffectFromProfile.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/EffectFromProfile.cs.meta new file mode 100644 index 00000000..9e3ffc68 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/EffectFromProfile.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e9448d07e745b5a41ac023a4477c2cc7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 6dfec383bc9ad504891027fdab8062b1, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/EffectPulse.cs b/Assets/External/VolumetricLightBeam/Scripts/EffectPulse.cs new file mode 100644 index 00000000..cd9aca87 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/EffectPulse.cs @@ -0,0 +1,59 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace VLB +{ + [HelpURL(Consts.Help.UrlEffectPulse)] + public class EffectPulse : EffectAbstractBase + { + public new const string ClassName = "EffectPulse"; + + /// + /// Frequency of pulsing. + /// Higher value means the pulsing will occur faster. + /// + [Range(0.1f, 60.0f)] + public float frequency = Consts.Effects.FrequencyDefault; + + /// + /// The amplitude of intensity change which will be applied to the Light and/or Beam. + /// A random value will be picked each time inside that range. + /// + [MinMaxRange(-5.0f, 5.0f)] + public MinMaxRangeFloat intensityAmplitude = Consts.Effects.IntensityAmplitudeDefault; + + public override void InitFrom(EffectAbstractBase source) + { + base.InitFrom(source); + + var sourcePulse = source as EffectPulse; + if (sourcePulse) + { + frequency = sourcePulse.frequency; + intensityAmplitude = sourcePulse.intensityAmplitude; + } + } + + protected override void OnEnable() + { + base.OnEnable(); + StartCoroutine(CoUpdate()); + } + + IEnumerator CoUpdate() + { + var t = 0.0f; + while (true) + { + var sin = Mathf.Sin(frequency * t); + var value = intensityAmplitude.GetLerpedValue(sin * 0.5f + 0.5f); + SetAdditiveIntensity(value); + + yield return null; + t += Time.deltaTime; + } + } + } +} + diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/RotateObject.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/EffectPulse.cs.meta similarity index 50% rename from Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/RotateObject.cs.meta rename to Assets/External/VolumetricLightBeam/Scripts/EffectPulse.cs.meta index 09485494..0542528e 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/RotateObject.cs.meta +++ b/Assets/External/VolumetricLightBeam/Scripts/EffectPulse.cs.meta @@ -1,12 +1,12 @@ fileFormatVersion: 2 -guid: f1b93e48d84b64e4cac4a08f2da9f69f -timeCreated: 1453573806 -licenseType: Store +guid: d4d69db65d6d47040b7bd02d847008da +timeCreated: 1617798061 +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: 6dfec383bc9ad504891027fdab8062b1, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/Enums.cs b/Assets/External/VolumetricLightBeam/Scripts/Enums.cs new file mode 100644 index 00000000..1fe013c5 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/Enums.cs @@ -0,0 +1,189 @@ +namespace VLB +{ + public enum FeatureEnabledColorGradient + { + Off, // Do not support having a gradient as color + HighOnly, // Support gradient color only for devices with Shader Level = 35 or higher + HighAndLow // Support gradient color for all devices + }; + + public enum ColorMode + { + Flat, // Apply a flat/plain/single color + Gradient // Apply a gradient + } + + public enum AttenuationEquation + { + Linear = 0, // Simple linear attenuation. + Quadratic = 1, // Quadratic attenuation, which usually gives more realistic results. + Blend = 2 // Custom blending mix between linear and quadratic attenuation formulas. Use attenuationEquation property to tweak the mix. + } + + public enum AttenuationEquationHD + { + Linear = 0, // Simple linear attenuation. + Quadratic = 1, // Quadratic attenuation, which usually gives more realistic results. + } + + public enum BlendingMode + { + Additive, + SoftAdditive, + TraditionalTransparency, + } + + public enum ShaderAccuracy + { + /// Default accuracy: a lot of computation are done on the vertex shader to maximize performance. + Fast, + /// Higher accuracy: most of the computation are done on the pixel shader to maximize graphical quality at some performance cost. + High, + } + + public enum NoiseMode + { + /// 3D Noise is disabled + Disabled, + /// 3D Noise is enabled: noise will look static compared to the world + WorldSpace, + /// 3D Noise is enabled: noise will look static compared to the beam position + LocalSpace, + } + + public enum MeshType + { + Shared, // Use the global shared mesh (recommended setting, since it will save a lot on memory). Will use the geometry properties set on Config. + Custom, // Use a custom mesh instead. Will use the geometry properties set on the beam. + } + + public enum RenderPipeline + { + /// Unity's built-in Render Pipeline. + BuiltIn, + /// Use the Universal Render Pipeline. + URP, + /// Use the High Definition Render Pipeline. + HDRP, + } + + public enum ShaderMode { SD, HD } + + public enum RenderingMode + { + /// Use the 2 pass shader. Will generate 2 drawcalls per beam (Not compatible with custom Render Pipeline such as HDRP and LWRP). + MultiPass, + /// Use the 1 pass shader. Will generate 1 drawcall per beam. + Default, + /// Dynamically batch multiple beams to combine and reduce draw calls. + GPUInstancing, + /// Use the SRP Batcher to automatically batch multiple beams and reduce draw calls. Only available when using SRP. + SRPBatcher, + } + + public enum RenderQueue + { + /// Specify a custom render queue. + Custom = 0, + + /// This render queue is rendered before any others. + Background = 1000, + + /// Opaque geometry uses this queue. + Geometry = 2000, + + /// Alpha tested geometry uses this queue. + AlphaTest = 2450, + + /// Last render queue that is considered "opaque". + GeometryLast = 2500, + + /// This render queue is rendered after Geometry and AlphaTest, in back-to-front order. + Transparent = 3000, + + /// This render queue is meant for overlay effects. + Overlay = 4000, + } + + public enum Dimensions + { + /// 3D + Dim3D, + + /// 2D + Dim2D + } + + public enum PlaneAlignment + { + /// Align the plane to the surface normal which blocks the beam. Works better for large occluders such as floors and walls. + Surface, + /// Keep the plane aligned with the beam direction. Works better with more complex occluders or with corners. + Beam + } + + [System.Flags] + public enum DynamicOcclusionUpdateRate + { + Never = 1 << 0, + OnEnable = 1 << 1, + OnBeamMove = 1 << 2, + EveryXFrames = 1 << 3, + OnBeamMoveAndEveryXFrames = OnBeamMove | EveryXFrames, + } + + public enum ParticlesDirection + { + /// Random direction. + Random, + /// Particles follow the velicity direction in local space (Z is along the beam). + LocalSpace, + /// Particles follow the velicity direction in world space. + WorldSpace + } + + [System.Flags] + public enum ShadowUpdateRate + { + Never = 1 << 0, + OnEnable = 1 << 1, + OnBeamMove = 1 << 2, + EveryXFrames = 1 << 3, + OnBeamMoveAndEveryXFrames = OnBeamMove | EveryXFrames, + } + + + public enum CookieChannel + { + Red = 0, + Green = 1, + Blue = 2, + Alpha = 3, + RGBA = 4 + } + + [System.Flags] + public enum DirtyProps + { + None = 0, + Intensity = 1 << 1, + HDRPExposureWeight = 1 << 2, + ColorMode = 1 << 3, + Color = 1 << 4, + BlendingMode = 1 << 5, + Cone = 1 << 6, + SideSoftness = 1 << 7, + Attenuation = 1 << 8, + Dimensions = 1 << 9, + RaymarchingQuality = 1 << 10, + Jittering = 1 << 11, + NoiseMode = 1 << 12, + NoiseIntensity = 1 << 13, + NoiseVelocityAndScale = 1 << 14, + CookieProps = 1 << 15, + ShadowProps = 1 << 16, + AllWithoutMaterialChange = Intensity | HDRPExposureWeight | Color | Cone | SideSoftness | Jittering | NoiseIntensity | NoiseVelocityAndScale | CookieProps | ShadowProps, + OnlyMaterialChangeOnly = Attenuation | ColorMode | BlendingMode | Dimensions | RaymarchingQuality | NoiseMode, + All = AllWithoutMaterialChange | OnlyMaterialChangeOnly, + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/Enums.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/Enums.cs.meta new file mode 100644 index 00000000..e2b2fdcc --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/Enums.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 368667f41a4ca5a48bb73bc39c67ab69 +timeCreated: 1521635218 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD.meta b/Assets/External/VolumetricLightBeam/Scripts/HD.meta new file mode 100644 index 00000000..d06da32f --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f7d599459b095bc4f944b920b9b4d2f6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/BeamGeometryHD.cs b/Assets/External/VolumetricLightBeam/Scripts/HD/BeamGeometryHD.cs new file mode 100644 index 00000000..6fb9b8d2 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/BeamGeometryHD.cs @@ -0,0 +1,556 @@ +#if DEBUG +//#define DEBUG_SHOW_MESH_NORMALS +#endif +#define FORCE_CURRENT_CAMERA_DEPTH_TEXTURE_MODE + +#if UNITY_2018_1_OR_NEWER +#define VLB_SRP_SUPPORT // Comment this to disable SRP support +#endif + +using UnityEngine; +using System.Collections; + +#pragma warning disable 0429, 0162 // Unreachable expression code detected (because of Noise3D.isSupported on mobile) + +namespace VLB +{ + [AddComponentMenu("")] // hide it from Component search + [ExecuteInEditMode] + [HelpURL(Consts.Help.HD.UrlBeam)] + public class BeamGeometryHD : BeamGeometryAbstractBase + { + VolumetricLightBeamHD m_Master = null; + VolumetricCookieHD m_Cookie = null; + VolumetricShadowHD m_Shadow = null; + + protected override VolumetricLightBeamAbstractBase GetMaster() { return m_Master; } + + public bool visible + { + set { if (meshRenderer) meshRenderer.enabled = value; } + } + + public int sortingLayerID + { + set { if (meshRenderer) meshRenderer.sortingLayerID = value; } + } + + public int sortingOrder + { + set { if(meshRenderer) meshRenderer.sortingOrder = value; } + } + +#if VLB_SRP_SUPPORT + Camera m_CurrentCameraRenderingSRP = null; + + void OnDisable() + { + SRPHelper.UnregisterOnBeginCameraRendering(OnBeginCameraRenderingSRP); + m_CurrentCameraRenderingSRP = null; + } + + public static bool isCustomRenderPipelineSupported { get { return true; } } +#else + public static bool isCustomRenderPipelineSupported { get { return false; } } +#endif + + bool shouldUseGPUInstancedMaterial + { + get + { + if (Config.Instance.GetActualRenderingMode(ShaderMode.HD) == RenderingMode.GPUInstancing) + { + return m_Cookie == null && m_Shadow == null; // sampler cannot be passed to shader as instanced property + } + return false; + } + } + + void OnEnable() + { +#if VLB_SRP_SUPPORT + SRPHelper.RegisterOnBeginCameraRendering(OnBeginCameraRenderingSRP); +#endif + } + + public void Initialize(VolumetricLightBeamHD master) + { + Debug.Assert(master != null); + + var customHideFlags = Consts.Internal.ProceduralObjectsHideFlags; + m_Master = master; + + transform.SetParent(master.transform, false); + + meshRenderer = gameObject.GetOrAddComponent(); + meshRenderer.hideFlags = customHideFlags; + meshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; + meshRenderer.receiveShadows = false; + meshRenderer.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off; // different reflection probes could break batching with GPU Instancing + meshRenderer.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off; + + m_Cookie = m_Master.GetAdditionalComponentCookie(); + m_Shadow = m_Master.GetAdditionalComponentShadow(); + + if (!shouldUseGPUInstancedMaterial) + { + m_CustomMaterial = Config.Instance.NewMaterialTransient(ShaderMode.HD, gpuInstanced:false); + ApplyMaterial(); + } + + if (m_Master.DoesSupportSorting2D()) + { + if (SortingLayer.IsValid(m_Master.GetSortingLayerID())) + sortingLayerID = m_Master.GetSortingLayerID(); + else + Debug.LogError(string.Format("Beam '{0}' has an invalid sortingLayerID ({1}). Please fix it by setting a valid layer.", Utils.GetPath(m_Master.transform), m_Master.GetSortingLayerID())); + + sortingOrder = m_Master.GetSortingOrder(); + } + + meshFilter = gameObject.GetOrAddComponent(); + meshFilter.hideFlags = customHideFlags; + + gameObject.hideFlags = customHideFlags; + +#if UNITY_EDITOR + UnityEditor.GameObjectUtility.SetStaticEditorFlags(gameObject, master.GetStaticEditorFlagsForSubObjects()); + gameObject.SetSameSceneVisibilityStatesThan(master.gameObject); +#endif + } + + /// + /// Generate the cone mesh and calls UpdateMaterialAndBounds. + /// Since this process involves recreating a new mesh, make sure to not call it at every frame during playtime. + /// + public void RegenerateMesh() + { + Debug.Assert(m_Master); + + if (Config.Instance.geometryOverrideLayer) + gameObject.layer = Config.Instance.geometryLayerID; + else + gameObject.layer = m_Master.gameObject.layer; + + gameObject.tag = Config.Instance.geometryTag; + + coneMesh = GlobalMeshHD.Get(); + meshFilter.sharedMesh = coneMesh; + + UpdateMaterialAndBounds(); + } + + Vector3 ComputeLocalMatrix() + { + // In the VS, we compute the vertices so the whole beam fits into a fixed 2x2x1 box. + // We have to apply some scaling to get the proper beam size. + // This way we have the proper bounds without having to recompute specific bounds foreach beam. + var maxRadius = Mathf.Max(m_Master.coneRadiusStart, m_Master.coneRadiusEnd); + + var localScale = new Vector3(maxRadius, maxRadius, m_Master.maxGeometryDistance); + if (!m_Master.scalable) + localScale = localScale.Divide(m_Master.GetLossyScale()); + + transform.localScale = localScale; + transform.localRotation = m_Master.beamInternalLocalRotation; + + return localScale; + } + + bool isNoiseEnabled { get { return m_Master.isNoiseEnabled && m_Master.noiseIntensity > 0f && Noise3D.isSupported; } } // test Noise3D.isSupported the last + + MaterialManager.StaticPropertiesHD ComputeMaterialStaticProperties() + { + var colorGradient = MaterialManager.ColorGradient.Off; + if (m_Master.colorMode == ColorMode.Gradient) + { + var precision = Utils.GetFloatPackingPrecision(); + colorGradient = precision == Utils.FloatPackingPrecision.High ? MaterialManager.ColorGradient.MatrixHigh : MaterialManager.ColorGradient.MatrixLow; + } + + Debug.Assert((int)BlendingMode.Additive == (int)MaterialManager.BlendingMode.Additive); + Debug.Assert((int)BlendingMode.SoftAdditive == (int)MaterialManager.BlendingMode.SoftAdditive); + Debug.Assert((int)BlendingMode.TraditionalTransparency == (int)MaterialManager.BlendingMode.TraditionalTransparency); + + return new MaterialManager.StaticPropertiesHD + { + blendingMode = (MaterialManager.BlendingMode)m_Master.blendingMode, + attenuation = m_Master.attenuationEquation == AttenuationEquationHD.Linear ? MaterialManager.HD.Attenuation.Linear : MaterialManager.HD.Attenuation.Quadratic, + noise3D = isNoiseEnabled ? MaterialManager.Noise3D.On : MaterialManager.Noise3D.Off, + colorGradient = colorGradient, + shadow = m_Shadow != null ? MaterialManager.HD.Shadow.On : MaterialManager.HD.Shadow.Off, + cookie = (m_Cookie != null ? (m_Cookie.channel == CookieChannel.RGBA ? MaterialManager.HD.Cookie.RGBA : MaterialManager.HD.Cookie.SingleChannel) : MaterialManager.HD.Cookie.Off), + raymarchingQualityIndex = m_Master.raymarchingQualityIndex + }; + } + + bool ApplyMaterial() + { + var staticProps = ComputeMaterialStaticProperties(); + + Material mat = null; + if (!shouldUseGPUInstancedMaterial) + { + mat = m_CustomMaterial; + if(mat) + staticProps.ApplyToMaterial(mat); + } + else + { + mat = MaterialManager.GetInstancedMaterial(m_Master._INTERNAL_InstancedMaterialGroupID, ref staticProps); + } + + meshRenderer.material = mat; + return mat != null; + } + +#if DEBUG + bool m_CanChangePropertyBlock = false; +#endif + + public void SetMaterialProp(int nameID, float value) + { + if (m_CustomMaterial) + m_CustomMaterial.SetFloat(nameID, value); + else + { +#if DEBUG + Debug.Assert(m_CanChangePropertyBlock == true); +#endif + MaterialManager.materialPropertyBlock.SetFloat(nameID, value); + } + } + + public void SetMaterialProp(int nameID, Vector4 value) + { + if (m_CustomMaterial) + m_CustomMaterial.SetVector(nameID, value); + else + { +#if DEBUG + Debug.Assert(m_CanChangePropertyBlock == true); +#endif + MaterialManager.materialPropertyBlock.SetVector(nameID, value); + } + } + + public void SetMaterialProp(int nameID, Color value) + { + if (m_CustomMaterial) + m_CustomMaterial.SetColor(nameID, value); + else + { +#if DEBUG + Debug.Assert(m_CanChangePropertyBlock == true); +#endif + MaterialManager.materialPropertyBlock.SetColor(nameID, value); + } + } + + public void SetMaterialProp(int nameID, Matrix4x4 value) + { + if (m_CustomMaterial) + m_CustomMaterial.SetMatrix(nameID, value); + else + { +#if DEBUG + Debug.Assert(m_CanChangePropertyBlock == true); +#endif + MaterialManager.materialPropertyBlock.SetMatrix(nameID, value); + } + } + + public void SetMaterialProp(int nameID, Texture value) + { + if (m_CustomMaterial) + m_CustomMaterial.SetTexture(nameID, value); +#if DEBUG + else + { + Debug.Assert(m_CanChangePropertyBlock == true); + Debug.LogErrorFormat(m_Master, "Setting a Texture property to a GPU instanced material is not supported: '{0}'", m_Master); + } +#endif + } + + public enum InvalidTexture + { + Null, + NoDepth + } + + public void SetMaterialProp(int nameID, InvalidTexture invalidTexture) + { + if (m_CustomMaterial) + { + Texture tex = null; + if (invalidTexture == InvalidTexture.NoDepth) + tex = SystemInfo.usesReversedZBuffer? Texture2D.blackTexture: Texture2D.whiteTexture; + + m_CustomMaterial.SetTexture(nameID, tex); + } + } + + void MaterialChangeStart() + { + if (m_CustomMaterial == null) + meshRenderer.GetPropertyBlock(MaterialManager.materialPropertyBlock); +#if DEBUG + m_CanChangePropertyBlock = true; +#endif + } + + void MaterialChangeStop() + { +#if DEBUG + m_CanChangePropertyBlock = false; +#endif + if (m_CustomMaterial == null) + meshRenderer.SetPropertyBlock(MaterialManager.materialPropertyBlock); + } + + //////////////////////// + /// DIRTY PROPERTIES + //////////////////////// + DirtyProps m_DirtyProps = DirtyProps.None; + + public void SetPropertyDirty(DirtyProps prop) + { + m_DirtyProps |= prop; + + if(prop.HasAtLeastOneFlag(DirtyProps.OnlyMaterialChangeOnly)) + { + UpdateMaterialAndBounds(); // need to change material variant + } + } + + void UpdateMaterialAndBounds() + { + Debug.Assert(m_Master); + + if (ApplyMaterial() == false) + { + return; + } + + MaterialChangeStart(); + { + m_DirtyProps = DirtyProps.All; // make sure all props will be updated on next camera render + + if (isNoiseEnabled) + { + Noise3D.LoadIfNeeded(); + } + + // make sure the bounds are good from the startup + ComputeLocalMatrix(); // compute matrix before sending it to the shader + +#if VLB_SRP_SUPPORT + // This update is to make QA test 'ReflectionObliqueProjection' pass + UpdateMatricesPropertiesForGPUInstancingSRP(); +#endif + } + MaterialChangeStop(); + +#if DEBUG_SHOW_MESH_NORMALS + for (int vertexInd = 0; vertexInd < coneMesh.vertexCount; vertexInd++) + { + var vertex = coneMesh.vertices[vertexInd]; + + // apply modification done inside VS + vertex.x *= Mathf.Lerp(coneRadius.x, coneRadius.y, vertex.z); + vertex.y *= Mathf.Lerp(coneRadius.x, coneRadius.y, vertex.z); + vertex.z *= m_Master.fallOffEnd; + + var cosSinFlat = new Vector2(vertex.x, vertex.y).normalized; + var normal = new Vector3(cosSinFlat.x * Mathf.Cos(slopeRad), cosSinFlat.y * Mathf.Cos(slopeRad), -Mathf.Sin(slopeRad)).normalized; + + vertex = transform.TransformPoint(vertex); + normal = transform.TransformDirection(normal); + Debug.DrawRay(vertex, normal * 0.25f); + } +#endif + } + +#if VLB_SRP_SUPPORT + void UpdateMatricesPropertiesForGPUInstancingSRP() + { + if (SRPHelper.IsUsingCustomRenderPipeline() && Config.Instance.GetActualRenderingMode(ShaderMode.HD) == RenderingMode.GPUInstancing) + { + SetMaterialProp(ShaderProperties.LocalToWorldMatrix, transform.localToWorldMatrix); + SetMaterialProp(ShaderProperties.WorldToLocalMatrix, transform.worldToLocalMatrix); + } + } + + #if UNITY_2019_1_OR_NEWER + void OnBeginCameraRenderingSRP(UnityEngine.Rendering.ScriptableRenderContext context, Camera cam) + #else + void OnBeginCameraRenderingSRP(Camera cam) + #endif + { + m_CurrentCameraRenderingSRP = cam; + } +#endif + + void OnWillRenderObject() + { + Camera currentCam = null; + +#if VLB_SRP_SUPPORT + if (SRPHelper.IsUsingCustomRenderPipeline()) + { + currentCam = m_CurrentCameraRenderingSRP; + } + else +#endif + { + currentCam = Camera.current; + } + + OnWillCameraRenderThisBeam(currentCam); + } + + void OnWillCameraRenderThisBeam(Camera cam) + { + if (m_Master && cam) + { + if ( +#if UNITY_EDITOR + Utils.IsEditorCamera(cam) || // make sure to call UpdateCameraRelatedProperties for editor scene camera +#endif + cam.enabled) // prevent from doing stuff when we render from a previous DynamicOcclusionDepthBuffer's DepthCamera, because the DepthCamera are disabled + { + Debug.Assert(cam.GetComponentInParent() == null); + UpdateMaterialPropertiesForCamera(cam); + + if (m_Shadow) + m_Shadow.OnWillCameraRenderThisBeam(cam, this); + } + } + } + + void UpdateDirtyMaterialProperties() + { + if (m_DirtyProps != DirtyProps.None) + { + if (m_DirtyProps.HasFlag(DirtyProps.Intensity)) + { + SetMaterialProp(ShaderProperties.HD.Intensity, m_Master.intensity); + } + + if (m_DirtyProps.HasFlag(DirtyProps.HDRPExposureWeight) && Config.Instance.isHDRPExposureWeightSupported) + { + SetMaterialProp(ShaderProperties.HDRPExposureWeight, m_Master.hdrpExposureWeight); + } + + if (m_DirtyProps.HasFlag(DirtyProps.SideSoftness)) + { + SetMaterialProp(ShaderProperties.HD.SideSoftness, m_Master.sideSoftness); + } + + if (m_DirtyProps.HasFlag(DirtyProps.Color)) + { + if (m_Master.colorMode == ColorMode.Flat) + { + SetMaterialProp(ShaderProperties.ColorFlat, m_Master.colorFlat); + } + else + { + var precision = Utils.GetFloatPackingPrecision(); + m_ColorGradientMatrix = m_Master.colorGradient.SampleInMatrix((int)precision); + // pass the gradient matrix in OnWillRenderObject() + } + } + + if (m_DirtyProps.HasFlag(DirtyProps.Cone)) + { + // kMinRadius and kMinApexOffset prevents artifacts when fresnel computation is done in the vertex shader + const float kMinRadius = 0.0001f; + var coneRadius = new Vector2(Mathf.Max(m_Master.coneRadiusStart, kMinRadius), Mathf.Max(m_Master.coneRadiusEnd, kMinRadius)); + SetMaterialProp(ShaderProperties.ConeRadius, coneRadius); + + const float kMinApexOffset = 0.0001f; + float apexOffsetZ = m_Master.GetConeApexOffsetZ(false); + float nonNullApex = Mathf.Sign(apexOffsetZ) * Mathf.Max(Mathf.Abs(apexOffsetZ), kMinApexOffset); + SetMaterialProp(ShaderProperties.ConeGeomProps, new Vector2(nonNullApex, Config.Instance.sharedMeshSides)); + + SetMaterialProp(ShaderProperties.DistanceFallOff, new Vector3(m_Master.fallOffStart, m_Master.fallOffEnd, m_Master.maxGeometryDistance)); + + ComputeLocalMatrix(); // compute matrix before sending it to the shader + } + + if (m_DirtyProps.HasFlag(DirtyProps.Jittering)) + { + SetMaterialProp(ShaderProperties.HD.Jittering, new Vector4(m_Master.jitteringFactor, m_Master.jitteringFrameRate, m_Master.jitteringLerpRange.minValue, m_Master.jitteringLerpRange.maxValue)); + } + + if (isNoiseEnabled) + { + if (m_DirtyProps.HasFlag(DirtyProps.NoiseMode) || m_DirtyProps.HasFlag(DirtyProps.NoiseIntensity)) + { + SetMaterialProp(ShaderProperties.NoiseParam, new Vector2( + m_Master.noiseIntensity, + m_Master.noiseMode == NoiseMode.WorldSpace ? 0f : 1f)); + } + + if (m_DirtyProps.HasFlag(DirtyProps.NoiseVelocityAndScale)) + { + var noiseVelocity = m_Master.noiseVelocityUseGlobal ? Config.Instance.globalNoiseVelocity : m_Master.noiseVelocityLocal; + var noiseScale = m_Master.noiseScaleUseGlobal ? Config.Instance.globalNoiseScale : m_Master.noiseScaleLocal; + + SetMaterialProp(ShaderProperties.NoiseVelocityAndScale, new Vector4( + noiseVelocity.x, + noiseVelocity.y, + noiseVelocity.z, + noiseScale)); + } + } + + if (m_DirtyProps.HasFlag(DirtyProps.CookieProps)) + VolumetricCookieHD.ApplyMaterialProperties(m_Cookie, this); + + if (m_DirtyProps.HasFlag(DirtyProps.ShadowProps)) + VolumetricShadowHD.ApplyMaterialProperties(m_Shadow, this); + + m_DirtyProps = DirtyProps.None; + } + } + + void UpdateMaterialPropertiesForCamera(Camera cam) + { + if (cam && m_Master) + { + MaterialChangeStart(); + { + SetMaterialProp(ShaderProperties.HD.TransformScale, m_Master.scalable ? m_Master.GetLossyScale() : Vector3.one); + + var camForwardVectorOSN = transform.InverseTransformDirection(cam.transform.forward).normalized; + SetMaterialProp(ShaderProperties.HD.CameraForwardOS, camForwardVectorOSN); + SetMaterialProp(ShaderProperties.HD.CameraForwardWS, cam.transform.forward); + + UpdateDirtyMaterialProperties(); + + if (m_Master.colorMode == ColorMode.Gradient) + { + // Send the gradient matrix every frame since it's not a shader's property + SetMaterialProp(ShaderProperties.ColorGradientMatrix, m_ColorGradientMatrix); + } + +#if VLB_SRP_SUPPORT + // This update is to be able to move beams without trackChangesDuringPlaytime enabled with SRP & GPU Instancing + UpdateMatricesPropertiesForGPUInstancingSRP(); +#endif + } + MaterialChangeStop(); + +#if FORCE_CURRENT_CAMERA_DEPTH_TEXTURE_MODE + cam.depthTextureMode |= DepthTextureMode.Depth; +#endif + } + } + +#if UNITY_EDITOR + public int _EDITOR_InstancedMaterialID { get { return ComputeMaterialStaticProperties().GetMaterialID(); } } +#endif + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/BeamGeometryHD.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/HD/BeamGeometryHD.cs.meta new file mode 100644 index 00000000..a21b6fda --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/BeamGeometryHD.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c44f4896d3776534e9c0542bb3004c8f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/GlobalMeshHD.cs b/Assets/External/VolumetricLightBeam/Scripts/HD/GlobalMeshHD.cs new file mode 100644 index 00000000..38c7a154 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/GlobalMeshHD.cs @@ -0,0 +1,37 @@ +using UnityEngine; + +namespace VLB +{ + public static class GlobalMeshHD + { + public static Mesh Get() + { + if (ms_Mesh == null) + { + Destroy(); + + ms_Mesh = MeshGenerator.GenerateConeZ_Radii_DoubleCaps( + lengthZ: 1f, + radiusStart: 1f, + radiusEnd: 1f, + numSides: Config.Instance.sharedMeshSides, + inverted: true); + + ms_Mesh.hideFlags = Consts.Internal.ProceduralObjectsHideFlags; + } + + return ms_Mesh; + } + + public static void Destroy() + { + if (ms_Mesh != null) + { + GameObject.DestroyImmediate(ms_Mesh); + ms_Mesh = null; + } + } + + static Mesh ms_Mesh = null; + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/GlobalMeshHD.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/HD/GlobalMeshHD.cs.meta new file mode 100644 index 00000000..9481a700 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/GlobalMeshHD.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: ef8cffdc0722e5740aa18175f5ba5358 +timeCreated: 1646242645 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/RaymarchingQuality.cs b/Assets/External/VolumetricLightBeam/Scripts/HD/RaymarchingQuality.cs new file mode 100644 index 00000000..a093e947 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/RaymarchingQuality.cs @@ -0,0 +1,52 @@ +using UnityEngine; + +namespace VLB +{ + [System.Serializable] + public class RaymarchingQuality + { + public int uniqueID => _UniqueID; + public bool hasValidUniqueID => _UniqueID >= 0; + + public string name; + public int stepCount; + + public static RaymarchingQuality defaultInstance => ms_DefaultInstance; + + [SerializeField] int _UniqueID; + static RaymarchingQuality ms_DefaultInstance = new RaymarchingQuality(-1); + const int kRandomUniqueIdMinRange = 4; // default qualities have fixed ID from 1 to 3 + + private RaymarchingQuality(int uniqueID) + { + _UniqueID = uniqueID; + name = "New quality"; + stepCount = 10; + } + + static public RaymarchingQuality New() + { + int id = Random.Range(kRandomUniqueIdMinRange, int.MaxValue); + return new RaymarchingQuality(id); + } + + static public RaymarchingQuality New(string name, int forcedUniqueID, int stepCount) + { + var instance = new RaymarchingQuality(forcedUniqueID); + instance.name = name; + instance.stepCount = stepCount; + return instance; + } + + static bool HasRaymarchingQualityWithSameUniqueID(RaymarchingQuality[] values, int id) + { + foreach (var qual in values) + { + if (qual != null && qual.uniqueID == id) + return true; + } + return false; + } + } +} + diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/RaymarchingQuality.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/HD/RaymarchingQuality.cs.meta new file mode 100644 index 00000000..6d3277bc --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/RaymarchingQuality.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f2d6a8c686dc7e749a8aaa943effba3f +timeCreated: 1613290493 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/TrackRealtimeChangesOnLightHD.cs b/Assets/External/VolumetricLightBeam/Scripts/HD/TrackRealtimeChangesOnLightHD.cs new file mode 100644 index 00000000..29d4b8c0 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/TrackRealtimeChangesOnLightHD.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace VLB +{ + [DisallowMultipleComponent] + [RequireComponent(typeof(Light), typeof(VolumetricLightBeamHD))] + [HelpURL(Consts.Help.HD.UrlTrackRealtimeChangesOnLight)] + public class TrackRealtimeChangesOnLightHD : MonoBehaviour + { + public const string ClassName = "TrackRealtimeChangesOnLightHD"; + + VolumetricLightBeamHD m_Master = null; + + void Awake() + { + m_Master = GetComponent(); + Debug.Assert(m_Master); + } + + void Update() + { + if(m_Master.enabled) + { + m_Master.AssignPropertiesFromAttachedSpotLight(); + } + } + } +} + diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/TrackRealtimeChangesOnLightHD.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/HD/TrackRealtimeChangesOnLightHD.cs.meta new file mode 100644 index 00000000..21c0da60 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/TrackRealtimeChangesOnLightHD.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 05c9c09d0366bdb43b3d087e6ca2aadc +timeCreated: 1616221308 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 92cd5f0496b5c33418ef9b57bb0a7e7b, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricCookieHD.cs b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricCookieHD.cs new file mode 100644 index 00000000..ab3afec5 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricCookieHD.cs @@ -0,0 +1,166 @@ +using UnityEngine; + +namespace VLB +{ + [ExecuteInEditMode] + [DisallowMultipleComponent] + [RequireComponent(typeof(VolumetricLightBeamHD))] + [HelpURL(Consts.Help.HD.UrlCookie)] + public class VolumetricCookieHD : MonoBehaviour + { + public const string ClassName = "VolumetricCookieHD"; + + /// + /// How much the cookie texture will contribute to the beam rendering. + /// + public float contribution + { + get { return m_Contribution; } + set { if (m_Contribution != value) { m_Contribution = value; SetDirty(); } } + } + + /// + /// Specify the texture mask asset. + /// It can be a regular 'Cookie' texture or any other texture type. + /// + public Texture cookieTexture + { + get { return m_CookieTexture; } + set { if (m_CookieTexture != value) { m_CookieTexture = value; SetDirty(); } } + } + + /// + /// Which channel(s) will be used to render the cookie. + /// + public CookieChannel channel + { + get { return m_Channel; } + set { if (m_Channel != value) { m_Channel = value; SetDirty(); } } + } + + /// + /// - False: white/opaque value in chosen texture channel is visible. + /// - True: white/opaque value in chosen texture channel is hidden. + /// + public bool negative + { + get { return m_Negative; } + set { if (m_Negative != value) { m_Negative = value; SetDirty(); } } + } + + /// + /// 2D local translation applied to the cookie texture. + /// + public Vector2 translation + { + get { return m_Translation; } + set { if (m_Translation != value) { m_Translation = value; SetDirty(); } } + } + + /// + /// Rotation angle of the cookie texture (in degrees). + /// + public float rotation + { + get { return m_Rotation; } + set { if (m_Rotation != value) { m_Rotation = value; SetDirty(); } } + } + + /// + /// 2D local scale applied to the cookie texture. + /// + public Vector2 scale + { + get { return m_Scale; } + set { if (m_Scale != value) { m_Scale = value; SetDirty(); } } + } + + [SerializeField] float m_Contribution = Consts.Cookie.ContributionDefault; + [SerializeField] Texture m_CookieTexture = Consts.Cookie.CookieTextureDefault; + [SerializeField] CookieChannel m_Channel = Consts.Cookie.ChannelDefault; + [SerializeField] bool m_Negative = Consts.Cookie.NegativeDefault; + [SerializeField] Vector2 m_Translation = Consts.Cookie.TranslationDefault; + [SerializeField] float m_Rotation = Consts.Cookie.RotationDefault; + [SerializeField] Vector2 m_Scale = Consts.Cookie.ScaleDefault; + + VolumetricLightBeamHD m_Master = null; + + void SetDirty() + { + if (m_Master) + m_Master.SetPropertyDirty(DirtyProps.CookieProps); + } + + public static void ApplyMaterialProperties(VolumetricCookieHD instance, BeamGeometryHD geom) + { + Debug.Assert(geom != null); + if (instance && instance.enabled && instance.cookieTexture != null) + { + geom.SetMaterialProp(ShaderProperties.HD.CookieTexture, instance.cookieTexture); + geom.SetMaterialProp(ShaderProperties.HD.CookieProperties, + new Vector4(instance.negative ? instance.contribution : -instance.contribution + , (float)instance.channel + , Mathf.Cos(instance.rotation * Mathf.Deg2Rad) + , Mathf.Sin(instance.rotation * Mathf.Deg2Rad) + )); + geom.SetMaterialProp(ShaderProperties.HD.CookiePosAndScale, new Vector4(instance.translation.x, instance.translation.y, instance.scale.x, instance.scale.y)); + } + else + { + geom.SetMaterialProp(ShaderProperties.HD.CookieTexture, BeamGeometryHD.InvalidTexture.Null); + geom.SetMaterialProp(ShaderProperties.HD.CookieProperties, Vector4.zero); + } + } + + void Awake() + { + m_Master = GetComponent(); + Debug.Assert(m_Master); + } + + void OnEnable() { SetDirty(); } + void OnDisable() { SetDirty(); } + void OnDidApplyAnimationProperties() { SetDirty(); } + + void Start() + { +#if UNITY_EDITOR + if (!Application.isPlaying) + MakeBeamGeomDirty(); +#endif // UNITY_EDITOR + + if (Application.isPlaying) + { + SetDirty(); + } + } + + void OnDestroy() + { +#if UNITY_EDITOR + if (!Application.isPlaying) + MakeBeamGeomDirty(); +#endif // UNITY_EDITOR + + if (Application.isPlaying) + { + SetDirty(); + } + } + +#if UNITY_EDITOR + void MakeBeamGeomDirty() + { + var beam = GetComponent(); + if (beam) + beam._EditorSetBeamGeomDirty(); // need to recall BeamGeometry.Initialize to force havin a custom material + } + + void OnValidate() + { + SetDirty(); + } +#endif // UNITY_EDITOR + } +} + diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricCookieHD.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricCookieHD.cs.meta new file mode 100644 index 00000000..767d0f61 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricCookieHD.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 4bac7e82715c48546b7e9cdec13ae802 +timeCreated: 1614337268 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: cc27b1da0fcf63b40bfa30f6d7317bc1, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD.cs b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD.cs new file mode 100644 index 00000000..3283a6d4 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD.cs @@ -0,0 +1,712 @@ +//#define DEBUG_SHOW_APEX +#if UNITY_2019_3_OR_NEWER +#define VLB_LIGHT_TEMPERATURE_SUPPORT +#endif + +using UnityEngine; +using UnityEngine.Serialization; +using System.Collections; + +namespace VLB +{ + [ExecuteInEditMode] + [DisallowMultipleComponent] + [SelectionBase] + [HelpURL(Consts.Help.HD.UrlBeam)] + public partial class VolumetricLightBeamHD : VolumetricLightBeamAbstractBase + { + public new const string ClassName = "VolumetricLightBeamHD"; + + /// + /// Get the color value from the light (when attached to a Spotlight) or not + /// + public bool colorFromLight + { + get { return m_ColorFromLight; } + set { if (m_ColorFromLight != value) { m_ColorFromLight = value; ValidateProperties(); } } + } + + /// + /// Apply a flat/plain/single color, or a gradient + /// + public ColorMode colorMode + { + get { + if (Config.Instance.featureEnabledColorGradient == FeatureEnabledColorGradient.Off) return ColorMode.Flat; + return m_ColorMode; + } + set { if (m_ColorMode != value) { m_ColorMode = value; ValidateProperties(); SetPropertyDirty(DirtyProps.ColorMode); } } + } + + /// + /// RGBA plain color, if colorMode is Flat (takes account of the alpha value). + /// + public Color colorFlat + { + get { return m_ColorFlat; } + set { if (m_ColorFlat != value) { m_ColorFlat = value; ValidateProperties(); SetPropertyDirty(DirtyProps.Color); } } + } + + /// + /// Gradient color applied along the beam, if colorMode is Gradient (takes account of the color and alpha variations). + /// + public Gradient colorGradient + { + get { return m_ColorGradient; } + set { if (m_ColorGradient != value) { m_ColorGradient = value; ValidateProperties(); SetPropertyDirty(DirtyProps.Color); } } + } + +#if UNITY_EDITOR + public override Color ComputeColorAtDepth(float depthRatio) + { + if (colorMode == ColorMode.Flat) return colorFlat; + else return colorGradient.Evaluate(depthRatio); + } +#endif + + bool useColorFromAttachedLightSpot => colorFromLight && lightSpotAttached != null; + +#if VLB_LIGHT_TEMPERATURE_SUPPORT + bool useColorTemperatureFromAttachedLightSpot => useColorFromAttachedLightSpot && lightSpotAttached.useColorTemperature && Config.Instance.useLightColorTemperature; +#else + bool useColorTemperatureFromAttachedLightSpot => false; +#endif + + /// + /// Beam intensity + /// + public float intensity + { + get { return m_Intensity; } + set { if (m_Intensity != value) { m_Intensity = value; ValidateProperties(); SetPropertyDirty(DirtyProps.Intensity); } } + } + + /// + /// Multiplier to modulate the spotlight intensity. + /// + public float intensityMultiplier + { + get { return m_IntensityMultiplier; } + set { if (m_IntensityMultiplier != value) { m_IntensityMultiplier = value; ValidateProperties(); } } + } + + /// + /// Get the intensity value from the light (when attached to a Spotlight) or not + /// + public bool useIntensityFromAttachedLightSpot => intensityMultiplier >= 0.0f && lightSpotAttached != null; + + /// + /// HDRP Only + /// Use this property to set how much effect the camera exposure has on the beam intensity. + /// + public float hdrpExposureWeight + { + get { return m_HDRPExposureWeight; } + set { if (m_HDRPExposureWeight != value) { m_HDRPExposureWeight = value; ValidateProperties(); SetPropertyDirty(DirtyProps.HDRPExposureWeight); } } + } + + /// + /// Change how the light beam colors will be mixed with the scene + /// + public BlendingMode blendingMode + { + get { return m_BlendingMode; } + set { if (m_BlendingMode != value) { m_BlendingMode = value; ValidateProperties(); SetPropertyDirty(DirtyProps.BlendingMode); } } + } + + + /// + /// Spot Angle (in degrees). This doesn't take account of the radiusStart, and is not necessarily the same than the cone angle. + /// + public float spotAngle + { + get { return m_SpotAngle; } + set { if (m_SpotAngle != value) { m_SpotAngle = value; ValidateProperties(); SetPropertyDirty(DirtyProps.Cone); } } + } + + /// + /// Multiplier to modulate the spotlight spot angle. + /// + public float spotAngleMultiplier + { + get { return m_SpotAngleMultiplier; } + set { if (m_SpotAngleMultiplier != value) { m_SpotAngleMultiplier = value; ValidateProperties(); } } + } + + /// + /// Get the spotAngle value from the light (when attached to a Spotlight) or not + /// + public bool useSpotAngleFromAttachedLightSpot => spotAngleMultiplier >= 0.0f && lightSpotAttached != null; + + /// + /// Cone Angle (in degrees). This takes account of the radiusStart, and is not necessarily the same than the spot angle. + /// + public float coneAngle { get { return Mathf.Atan2(coneRadiusEnd - coneRadiusStart, maxGeometryDistance) * Mathf.Rad2Deg * 2f; } } + + /// + /// Start radius of the cone geometry. + /// 0 will generate a perfect cone geometry. Higher values will generate truncated cones. + /// + public float coneRadiusStart + { + get { return m_ConeRadiusStart; } + set { if (m_ConeRadiusStart != value) { m_ConeRadiusStart = value; ValidateProperties(); SetPropertyDirty(DirtyProps.Cone); } } + } + + /// + /// End radius of the cone geometry + /// + public float coneRadiusEnd { + get { return Utils.ComputeConeRadiusEnd(maxGeometryDistance, spotAngle); } + set { spotAngle = Utils.ComputeSpotAngle(maxGeometryDistance, value); } + } + + /// + /// Volume (in unit^3) of the cone (from the base to fallOffEnd) + /// + public float coneVolume { get { float r1 = coneRadiusStart, r2 = coneRadiusEnd; return (Mathf.PI / 3) * (r1 * r1 + r1 * r2 + r2 * r2) * fallOffEnd; } } + + /// + /// Apex distance of the truncated radius + /// If coneRadiusStart = 0, the apex is the at the truncated radius, so coneApexOffsetZ = 0 + /// Otherwise, coneApexOffsetZ > 0 and represents the local position Z offset + /// + public float GetConeApexOffsetZ(bool counterApplyScaleForUnscalableBeam) + { + // simple intercept + float ratioRadius = coneRadiusStart / coneRadiusEnd; + if (ratioRadius == 1f) + return float.MaxValue; + else + { + float value = ((maxGeometryDistance * ratioRadius) / (1 - ratioRadius)); + if(counterApplyScaleForUnscalableBeam && !scalable) value /= GetLossyScale().z; + return value; + } + } + + /// + /// The scaling of the beam's GameObject (or any of its parent in the hierarchy)... + /// - True: ...will be applied to the beam itself and will change its size. + /// - False: ...won't be applied to the beam itself, so the beam won't have its size changed. + /// In short, we recommend to set the Scalable property at: + /// - True when there is no Unity Light attached to the same GameObject, so you will be able to scale your beam easily. + /// - False when there is a Unity Light attached to the same GameObject, because the Unity Light are NOT scalable: this way you beam will always fit the Unity Light size. + /// + public bool scalable { + get { return m_Scalable; } + set { if (m_Scalable != value) { m_Scalable = value; SetPropertyDirty(DirtyProps.Attenuation); } } + } + + public override bool IsScalable() { return scalable; } + + + /// + /// Light attenuation formula used to compute fading between 'fallOffStart' and 'fallOffEnd' + /// + public AttenuationEquationHD attenuationEquation + { + get { return m_AttenuationEquation; } + set { if (m_AttenuationEquation != value) { m_AttenuationEquation = value; ValidateProperties(); SetPropertyDirty(DirtyProps.Attenuation); } } + } + + /// + /// Distance from the light source (in units) the beam will start to fade out. + /// + public float fallOffStart + { + get { return m_FallOffStart; } + set { if (m_FallOffStart != value) { m_FallOffStart = value; ValidateProperties(); SetPropertyDirty(DirtyProps.Cone); } } + } + + /// + /// Distance from the light source (in units) the beam is entirely faded out. + /// + public float fallOffEnd + { + get { return m_FallOffEnd; } + set { if (m_FallOffEnd != value) { m_FallOffEnd = value; ValidateProperties(); SetPropertyDirty(DirtyProps.Cone); } } + } + + public float maxGeometryDistance { get { return fallOffEnd; } } + + /// + /// Distance multiplier to modulate the spotlight range. + /// + public float fallOffEndMultiplier + { + get { return m_FallOffEndMultiplier; } + set { if (m_FallOffEndMultiplier != value) { m_FallOffEndMultiplier = value; ValidateProperties(); } } + } + + /// + /// Get the fallOffEnd value from the light (when attached to a Spotlight) or not + /// + public bool useFallOffEndFromAttachedLightSpot { get { return fallOffEndMultiplier >= 0f && lightSpotAttached != null; } } + + public float sideSoftness + { + get { return m_SideSoftness; } + set { if (m_SideSoftness != value) { m_SideSoftness = value; ValidateProperties(); SetPropertyDirty(DirtyProps.SideSoftness); } } + } + + /// + /// When using Shadow or Cookie with a raymarching quality with too low steps count, some banding artifacts can appear. + /// In this case, increase jittering to add noise to smooth raymarching inaccuracy. + /// + public float jitteringFactor + { + get { return m_JitteringFactor; } + set { if (m_JitteringFactor != value) { m_JitteringFactor = value; ValidateProperties(); SetPropertyDirty(DirtyProps.Jittering); } } + } + + /// + /// Animate the jittering noise texture over the time. + /// + public int jitteringFrameRate + { + get { return m_JitteringFrameRate; } + set { if (m_JitteringFrameRate != value) { m_JitteringFrameRate = value; ValidateProperties(); SetPropertyDirty(DirtyProps.Jittering); } } + } + + /// + /// Configure where the jittering will be visible along the beam. + /// This range is specified between 0 (the tip of the beam) and 1 (the end of the beam): + /// - before the range: no jittering + /// - in the range: jittering will lerp from 0 to 'jittering factor' value + /// - after the range: 'jittering factor' value + /// + public MinMaxRangeFloat jitteringLerpRange + { + get { return m_JitteringLerpRange; } + set { if (m_JitteringLerpRange != value) { m_JitteringLerpRange = value; ValidateProperties(); SetPropertyDirty(DirtyProps.Jittering); } } + } + + /// + /// Enable 3D Noise effect and choose the mode + /// + public NoiseMode noiseMode + { + get { return m_NoiseMode; } + set { if (m_NoiseMode != value) { m_NoiseMode = value; ValidateProperties(); SetPropertyDirty(DirtyProps.NoiseMode); } } + } + + public bool isNoiseEnabled { get { return noiseMode != NoiseMode.Disabled; } } + + /// + /// Contribution factor of the 3D Noise (when enabled). + /// Higher intensity means the noise contribution is stronger and more visible. + /// + public float noiseIntensity + { + get { return m_NoiseIntensity; } + set { if (m_NoiseIntensity != value) { m_NoiseIntensity = value; ValidateProperties(); SetPropertyDirty(DirtyProps.NoiseIntensity); } } + } + + /// + /// Get the noiseScale value from the Global 3D Noise configuration + /// + public bool noiseScaleUseGlobal + { + get { return m_NoiseScaleUseGlobal; } + set { if (m_NoiseScaleUseGlobal != value) { m_NoiseScaleUseGlobal = value; ValidateProperties(); SetPropertyDirty(DirtyProps.NoiseVelocityAndScale); } } + } + + /// + /// 3D Noise texture scaling: higher scale make the noise more visible, but potentially less realistic. + /// + public float noiseScaleLocal + { + get { return m_NoiseScaleLocal; } + set { if (m_NoiseScaleLocal != value) { m_NoiseScaleLocal = value; ValidateProperties(); SetPropertyDirty(DirtyProps.NoiseVelocityAndScale); } } + } + + /// + /// Get the noiseVelocity value from the Global 3D Noise configuration + /// + public bool noiseVelocityUseGlobal + { + get { return m_NoiseVelocityUseGlobal; } + set { if (m_NoiseVelocityUseGlobal != value) { m_NoiseVelocityUseGlobal = value; ValidateProperties(); SetPropertyDirty(DirtyProps.NoiseVelocityAndScale); } } + } + + /// + /// World Space direction and speed of the 3D Noise scrolling, simulating the fog/smoke movement. + /// + public Vector3 noiseVelocityLocal + { + get { return m_NoiseVelocityLocal; } + set { if (m_NoiseVelocityLocal != value) { m_NoiseVelocityLocal = value; ValidateProperties(); SetPropertyDirty(DirtyProps.NoiseVelocityAndScale); } } + } + + public int raymarchingQualityID + { + get { return m_RaymarchingQualityID; } + set { if (m_RaymarchingQualityID != value) { m_RaymarchingQualityID = value; ValidateProperties(); SetPropertyDirty(DirtyProps.RaymarchingQuality); } } + } + + public int raymarchingQualityIndex + { + get { return Config.Instance.GetRaymarchingQualityIndexForUniqueID(raymarchingQualityID); } + set { raymarchingQualityID = Config.Instance.GetRaymarchingQualityForIndex(raymarchingQualityIndex).uniqueID; } + } + + public override BeamGeometryAbstractBase GetBeamGeometry() { return m_BeamGeom; } + protected override void SetBeamGeometryNull() { m_BeamGeom = null; } + + public int blendingModeAsInt { get { return Mathf.Clamp((int)blendingMode, 0, System.Enum.GetValues(typeof(BlendingMode)).Length); } } + + public Quaternion beamInternalLocalRotation { get { return GetDimensions() == Dimensions.Dim3D ? Quaternion.identity : Quaternion.LookRotation(Vector3.right, Vector3.up); } } + public Vector3 beamLocalForward { get { return GetDimensions() == Dimensions.Dim3D ? Vector3.forward : Vector3.right; } } + public Vector3 beamGlobalForward { get { return transform.TransformDirection(beamLocalForward); } } + public override Vector3 GetLossyScale() { return GetDimensions() == Dimensions.Dim3D ? transform.lossyScale : new Vector3(transform.lossyScale.z, transform.lossyScale.y, transform.lossyScale.x); } + + public VolumetricCookieHD GetAdditionalComponentCookie() { return GetComponent(); } + public VolumetricShadowHD GetAdditionalComponentShadow() { return GetComponent(); } + + public void SetPropertyDirty(DirtyProps flags) + { + if (m_BeamGeom) m_BeamGeom.SetPropertyDirty(flags); + } + + // Overridden in Beam 2D version + public virtual Dimensions GetDimensions() { return Dimensions.Dim3D; } + public virtual bool DoesSupportSorting2D() { return false; } + public virtual int GetSortingLayerID() { return 0; } + public virtual int GetSortingOrder() { return 0; } + + // SERIALIZED PROPERTIES + [SerializeField] bool m_ColorFromLight = true; + [SerializeField] ColorMode m_ColorMode = Consts.Beam.ColorModeDefault; + [SerializeField] Color m_ColorFlat = Consts.Beam.FlatColor; + [SerializeField] Gradient m_ColorGradient; + [SerializeField] BlendingMode m_BlendingMode = Consts.Beam.BlendingModeDefault; + [SerializeField] float m_Intensity = Consts.Beam.IntensityDefault; + [SerializeField] float m_IntensityMultiplier = Consts.Beam.MultiplierDefault; + [SerializeField] float m_HDRPExposureWeight = Consts.Beam.HDRPExposureWeightDefault; + [SerializeField] float m_SpotAngle = Consts.Beam.SpotAngleDefault; + [SerializeField] float m_SpotAngleMultiplier = Consts.Beam.MultiplierDefault; + [SerializeField] float m_ConeRadiusStart = Consts.Beam.ConeRadiusStart; + [SerializeField] bool m_Scalable = Consts.Beam.ScalableDefault; + [SerializeField] float m_FallOffStart = Consts.Beam.FallOffStart; + [SerializeField] float m_FallOffEnd = Consts.Beam.FallOffEnd; + [SerializeField] float m_FallOffEndMultiplier = Consts.Beam.MultiplierDefault; + [SerializeField] AttenuationEquationHD m_AttenuationEquation = Consts.Beam.HD.AttenuationEquationDefault; + [SerializeField] float m_SideSoftness = Consts.Beam.HD.SideSoftnessDefault; + [SerializeField] int m_RaymarchingQualityID = -1; + [SerializeField] float m_JitteringFactor = Consts.Beam.HD.JitteringFactorDefault; + [SerializeField] int m_JitteringFrameRate = Consts.Beam.HD.JitteringFrameRateDefault; + [MinMaxRange(0.0f, 1.0f)] [SerializeField] MinMaxRangeFloat m_JitteringLerpRange = Consts.Beam.HD.JitteringLerpRange; + [SerializeField] NoiseMode m_NoiseMode = Consts.Beam.NoiseModeDefault; + [SerializeField] float m_NoiseIntensity = Consts.Beam.NoiseIntensityDefault; + [SerializeField] bool m_NoiseScaleUseGlobal = true; + [SerializeField] float m_NoiseScaleLocal = Consts.Beam.NoiseScaleDefault; + [SerializeField] bool m_NoiseVelocityUseGlobal = true; + [SerializeField] Vector3 m_NoiseVelocityLocal = Consts.Beam.NoiseVelocityDefault; + + + /// Internal property used for QA testing purpose, do not change + public uint _INTERNAL_InstancedMaterialGroupID { get; protected set; } + + protected BeamGeometryHD m_BeamGeom = null; + +#if UNITY_EDITOR + public BeamGeometryHD _EDITOR_GetBeamGeometry() { return m_BeamGeom; } + public override int _EDITOR_GetInstancedMaterialID() { return m_BeamGeom ? m_BeamGeom._EDITOR_InstancedMaterialID : int.MinValue; } + + static VolumetricLightBeamHD[] _EditorFindAllInstances() + { + return Resources.FindObjectsOfTypeAll(); + } + + public static void _EditorSetAllMeshesDirty() + { + foreach (var instance in _EditorFindAllInstances()) + instance._EditorSetMeshDirty(); + } + + public static void _EditorSetAllBeamGeomDirty() + { + foreach (var instance in _EditorFindAllInstances()) + instance.m_EditorDirtyFlags |= EditorDirtyFlags.FullBeamGeomGAO; + } +#endif // UNITY_EDITOR + + /// + /// Returns a value indicating if the world position passed in argument is inside the light beam or not. + /// This functions treats the beam like infinite (like the beam had an infinite length and never fell off) + /// + /// World position + /// + /// < 0 position is out + /// = 0 position is exactly on the beam geometry + /// > 0 position is inside the cone + /// + public float GetInsideBeamFactor(Vector3 posWS) { return GetInsideBeamFactorFromObjectSpacePos(transform.InverseTransformPoint(posWS)); } + + public float GetInsideBeamFactorFromObjectSpacePos(Vector3 posOS) + { + if(GetDimensions() == Dimensions.Dim2D) + { + posOS = new Vector3(posOS.z, posOS.y, posOS.x); + } + + if (posOS.z < 0f) return -1f; + + Vector2 posOSXY = posOS.xy(); + + // Compute a factor to know how far inside the beam cone the camera is + var triangle2D = new Vector2(posOSXY.magnitude, posOS.z + GetConeApexOffsetZ(true)).normalized; + const float maxRadiansDiff = 0.1f; + float slopeRad = (coneAngle * Mathf.Deg2Rad) / 2; + + return Mathf.Clamp((Mathf.Abs(Mathf.Sin(slopeRad)) - Mathf.Abs(triangle2D.x)) / maxRadiansDiff, -1, 1); + } + + /// + /// Regenerate the beam mesh (and also the material). + /// This can be slow (it recreates a mesh from scratch), so don't call this function during playtime. + /// You would need to call this function only if you want to change the properties 'geomSides' and 'geomCap' during playtime. + /// Otherwise, for the other properties, just enable 'trackChangesDuringPlaytime', or manually call 'UpdateAfterManualPropertyChange()' + /// + public virtual void GenerateGeometry() + { + if(pluginVersion == -1) + { + // Applied default quality to newly created beams + raymarchingQualityID = Config.Instance.defaultRaymarchingQualityUniqueID; + } + + if (!Config.Instance.IsRaymarchingQualityUniqueIDValid(raymarchingQualityID)) + { + Debug.LogErrorFormat(gameObject, "HD Beam '{0}': fallback to default quality '{1}'" + , name + , Config.Instance.GetRaymarchingQualityForUniqueID(Config.Instance.defaultRaymarchingQualityUniqueID).name + ); + raymarchingQualityID = Config.Instance.defaultRaymarchingQualityUniqueID; + Utils.MarkCurrentSceneDirty(); + } + + HandleBackwardCompatibility(pluginVersion, Version.Current); + pluginVersion = Version.Current; + + ValidateProperties(); + + if (m_BeamGeom == null) + { + m_BeamGeom = Utils.NewWithComponent("Beam Geometry"); + m_BeamGeom.Initialize(this); + } + + m_BeamGeom.RegenerateMesh(); + m_BeamGeom.visible = enabled; + } + + /// + /// Update the beam material and its bounds. + /// Calling manually this function is useless if your beam has its property 'trackChangesDuringPlaytime' enabled + /// (because then this function is automatically called each frame). + /// However, if 'trackChangesDuringPlaytime' is disabled, and you change a property via Script for example, + /// you need to call this function to take the property change into account. + /// All properties changes are took into account, expect 'geomSides' and 'geomCap' which require to regenerate the geometry via 'GenerateGeometry()' + /// + public virtual void UpdateAfterManualPropertyChange() + { + ValidateProperties(); + SetPropertyDirty(DirtyProps.All); + } + +#if !UNITY_EDITOR + void Start() + { + InitLightSpotAttachedCached(); + + // In standalone builds, simply generate the geometry once in Start + GenerateGeometry(); + } +#else + void Start() + { + if (Application.isPlaying) + { + InitLightSpotAttachedCached(); + GenerateGeometry(); + m_EditorDirtyFlags = EditorDirtyFlags.Clean; + } + else + { + // In Editor, creating geometry from Start and/or OnValidate generates warning in Unity 2017. + // So we do it from Update + m_EditorDirtyFlags = EditorDirtyFlags.Everything; + } + } + + void OnValidate() + { + m_EditorDirtyFlags |= EditorDirtyFlags.Props; // Props have been modified from Editor + } + + void Update() // EDITOR ONLY + { + EditorHandleLightPropertiesUpdate(); // Handle edition of light properties in Editor + + if (m_EditorDirtyFlags == EditorDirtyFlags.Clean) + { + if (Application.isPlaying) + { + return; + } + } + else + { + if (m_EditorDirtyFlags.HasFlag(EditorDirtyFlags.Mesh)) + { + if (m_EditorDirtyFlags.HasFlag(EditorDirtyFlags.BeamGeomGAO)) + DestroyBeam(); + + GenerateGeometry(); // regenerate everything + } + else if (m_EditorDirtyFlags.HasFlag(EditorDirtyFlags.Props)) + { + ValidateProperties(); + } + } + + // If we modify the attached Spotlight properties, or if we animate the beam via Unity 2017's timeline, + // we are not notified of properties changes. So we update the material anyway. + UpdateAfterManualPropertyChange(); + + m_EditorDirtyFlags = EditorDirtyFlags.Clean; + } + + public virtual void Reset() + { + m_ColorMode = Consts.Beam.ColorModeDefault; + m_ColorFlat = Consts.Beam.FlatColor; + m_ColorFromLight = true; + + m_Intensity = Consts.Beam.IntensityDefault; + m_IntensityMultiplier = Consts.Beam.MultiplierDefault; + + m_HDRPExposureWeight = Consts.Beam.HDRPExposureWeightDefault; + + m_BlendingMode = Consts.Beam.BlendingModeDefault; + + m_SpotAngle = Consts.Beam.SpotAngleDefault; + m_SpotAngleMultiplier = Consts.Beam.MultiplierDefault; + + m_ConeRadiusStart = Consts.Beam.ConeRadiusStart; + m_Scalable = Consts.Beam.ScalableDefault; + + m_AttenuationEquation = Consts.Beam.HD.AttenuationEquationDefault; + + m_FallOffStart = Consts.Beam.FallOffStart; + m_FallOffEnd = Consts.Beam.FallOffEnd; + m_FallOffEndMultiplier = Consts.Beam.MultiplierDefault; + + m_SideSoftness = Consts.Beam.HD.SideSoftnessDefault; + m_JitteringFactor = Consts.Beam.HD.JitteringFactorDefault; + m_JitteringFrameRate = Consts.Beam.HD.JitteringFrameRateDefault; + m_JitteringLerpRange = Consts.Beam.HD.JitteringLerpRange; + + m_NoiseMode = Consts.Beam.NoiseModeDefault; + m_NoiseIntensity = Consts.Beam.NoiseIntensityDefault; + m_NoiseScaleUseGlobal = true; + m_NoiseScaleLocal = Consts.Beam.NoiseScaleDefault; + m_NoiseVelocityUseGlobal = true; + m_NoiseVelocityLocal = Consts.Beam.NoiseVelocityDefault; + + m_EditorDirtyFlags = EditorDirtyFlags.Everything; + } +#endif // UNITY_EDITOR + + void OnEnable() + { + if (m_BeamGeom) m_BeamGeom.visible = true; + } + + void OnDisable() + { + if (m_BeamGeom) m_BeamGeom.visible = false; + } + + void OnDidApplyAnimationProperties() + { + AssignPropertiesFromAttachedSpotLight(); // catch changes on UnityLight properties if it exists + UpdateAfterManualPropertyChange(); + } + + public void AssignPropertiesFromAttachedSpotLight() + { + var lightSpot = lightSpotAttached; + if (lightSpot) + { + Debug.AssertFormat(lightSpot.type == LightType.Spot, "Light attached to {0} '{1}' must be a Spot", ClassName, name); + if (useIntensityFromAttachedLightSpot) intensity = SpotLightHelper.GetIntensity(lightSpot) * intensityMultiplier; + if (useFallOffEndFromAttachedLightSpot) fallOffEnd = SpotLightHelper.GetFallOffEnd(lightSpot) * fallOffEndMultiplier; + if (useSpotAngleFromAttachedLightSpot) spotAngle = Mathf.Clamp(SpotLightHelper.GetSpotAngle(lightSpot) * spotAngleMultiplier, Consts.Beam.SpotAngleMin, Consts.Beam.SpotAngleMax); + if (m_ColorFromLight) + { + colorMode = ColorMode.Flat; + +#if VLB_LIGHT_TEMPERATURE_SUPPORT + if (useColorTemperatureFromAttachedLightSpot) + { + Color colorFromTemp = Mathf.CorrelatedColorTemperatureToRGB(lightSpot.colorTemperature); + var finalColor = lightSpot.color.linear * colorFromTemp; + colorFlat = finalColor.gamma; + } + else +#endif + { + colorFlat = lightSpot.color; + } + } + } + } + + void ClampProperties() + { + m_Intensity = Mathf.Max(m_Intensity, Consts.Beam.IntensityMin); + + m_FallOffEnd = Mathf.Max(Consts.Beam.FallOffDistancesMinThreshold, m_FallOffEnd); + m_FallOffStart = Mathf.Clamp(m_FallOffStart, 0f, m_FallOffEnd - Consts.Beam.FallOffDistancesMinThreshold); + + m_SpotAngle = Mathf.Clamp(m_SpotAngle, Consts.Beam.SpotAngleMin, Consts.Beam.SpotAngleMax); + m_ConeRadiusStart = Mathf.Max(m_ConeRadiusStart, 0f); + + m_SideSoftness = Mathf.Clamp(m_SideSoftness, Consts.Beam.HD.SideSoftnessMin, Consts.Beam.HD.SideSoftnessMax); + m_JitteringFactor = Mathf.Max(m_JitteringFactor, Consts.Beam.HD.JitteringFactorMin); + m_JitteringFrameRate = Mathf.Clamp(m_JitteringFrameRate, Consts.Beam.HD.JitteringFrameRateMin, Consts.Beam.HD.JitteringFrameRateMax); + + m_NoiseIntensity = Mathf.Clamp(m_NoiseIntensity, Consts.Beam.NoiseIntensityMin, Consts.Beam.NoiseIntensityMax); + + // do not clamp multipliers properties since negative values means off + } + + void ValidateProperties() + { + AssignPropertiesFromAttachedSpotLight(); + ClampProperties(); + } + + void HandleBackwardCompatibility(int serializedVersion, int newVersion) + { + if (serializedVersion == -1) return; // freshly new spawned entity: nothing to do + if (serializedVersion == newVersion) return; // same version: nothing to do + + // TODO + + Utils.MarkCurrentSceneDirty(); + } + +#if UNITY_EDITOR && DEBUG_SHOW_APEX + void OnDrawGizmos() + { + Gizmos.matrix = transform.localToWorldMatrix; + Gizmos.color = Color.green; + Gizmos.DrawWireSphere(new Vector3(0, 0, -GetConeApexOffsetZ(true)), 0.25f); + } +#endif // UNITY_EDITOR + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD.cs.meta new file mode 100644 index 00000000..4de85713 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD.cs.meta @@ -0,0 +1,28 @@ +fileFormatVersion: 2 +guid: 92b0a6142b2b0b449a62558873544363 +labels: +- volumetric +- light +- lighting +- ray +- shaft +- beam +- density +- vr +- dynamic +- spot +- spotlight +- fog +- noise +- occlusion +- procedural +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: + - m_Shader: {fileID: 4800000, guid: 936bd00b0f168d949b0c27d2be40615a, type: 3} + executionOrder: 0 + icon: {fileID: 2800000, guid: 837747a8b63291a48838c340da834873, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD2D.cs b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD2D.cs new file mode 100644 index 00000000..33de4a21 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD2D.cs @@ -0,0 +1,66 @@ +using UnityEngine; +using UnityEngine.Serialization; +using System.Collections; + +namespace VLB +{ + [ExecuteInEditMode] + [DisallowMultipleComponent] + [SelectionBase] + [HelpURL(Consts.Help.HD.UrlBeam)] + public partial class VolumetricLightBeamHD2D : VolumetricLightBeamHD + { + /// + /// Unique ID of the beam's sorting layer. + /// + public int sortingLayerID + { + get { return m_SortingLayerID; } + set { + m_SortingLayerID = value; + if (m_BeamGeom) m_BeamGeom.sortingLayerID = value; + } + } + + /// + /// Name of the beam's sorting layer. + /// + public string sortingLayerName + { + get { return SortingLayer.IDToName(sortingLayerID); } + set { sortingLayerID = SortingLayer.NameToID(value); } + } + + /// + /// The overlay priority within its layer. + /// Lower numbers are rendered first and subsequent numbers overlay those below. + /// + public int sortingOrder + { + get { return m_SortingOrder; } + set + { + m_SortingOrder = value; + if (m_BeamGeom) m_BeamGeom.sortingOrder = value; + } + } + + public override Dimensions GetDimensions() { return Dimensions.Dim2D; } + public override bool DoesSupportSorting2D() { return true; } + public override int GetSortingLayerID() { return sortingLayerID; } + public override int GetSortingOrder() { return sortingOrder; } + + [SerializeField] int m_SortingLayerID = 0; + [SerializeField] int m_SortingOrder = 0; + +#if UNITY_EDITOR + public override void Reset() + { + base.Reset(); + + sortingLayerID = 0; + sortingOrder = 0; + } +#endif // UNITY_EDITOR + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD2D.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD2D.cs.meta new file mode 100644 index 00000000..ba5d378e --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricLightBeamHD2D.cs.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: 979040b6cddec5e4e8261012ed1f2e84 +labels: +- volumetric +- light +- lighting +- ray +- shaft +- beam +- density +- vr +- dynamic +- spot +- spotlight +- fog +- noise +- occlusion +- procedural +timeCreated: 1507404056 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: + - m_Shader: {fileID: 4800000, guid: 936bd00b0f168d949b0c27d2be40615a, type: 3} + executionOrder: 0 + icon: {fileID: 2800000, guid: 837747a8b63291a48838c340da834873, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricShadowHD.cs b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricShadowHD.cs new file mode 100644 index 00000000..27713a31 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricShadowHD.cs @@ -0,0 +1,384 @@ +using UnityEngine; + +namespace VLB +{ + [ExecuteInEditMode] + [DisallowMultipleComponent] + [RequireComponent(typeof(VolumetricLightBeamHD))] + [HelpURL(Consts.Help.HD.UrlShadow)] + public class VolumetricShadowHD : MonoBehaviour + { + public const string ClassName = "VolumetricShadowHD"; + + /// + /// Controls how dark the shadow cast by this Light Beam will be. + /// The bigger the value, the more the shadow will affect the visual. + /// + public float strength + { + get { return m_Strength; } + set { if (m_Strength != value) { m_Strength = value; SetDirty(); } } + } + + /// + /// How often will the occlusion be processed? + /// Try to update the occlusion as rarely as possible to keep good performance. + /// + public ShadowUpdateRate updateRate + { + get { return m_UpdateRate; } + set { m_UpdateRate = value; } + } + + /// + /// How many frames we wait between 2 occlusion tests? + /// If you want your beam to be super responsive to the changes of your environment, update it every frame by setting 1. + /// If you want to save on performance, we recommend to wait few frames between each update by setting a higher value. + /// + public int waitXFrames + { + get { return m_WaitXFrames; } + set { m_WaitXFrames = value; } + } + + /// + /// The beam can only be occluded by objects located on the layers matching this mask. + /// It's very important to set it as restrictive as possible (checking only the layers which are necessary) + /// to perform a more efficient process in order to increase the performance. + /// It should NOT include the layer on which the beams are generated. + /// + public LayerMask layerMask + { + get { return m_LayerMask; } + set + { + m_LayerMask = value; + UpdateDepthCameraProperties(); + } + } + /// + /// Whether or not the virtual camera will use occlusion culling during rendering from the beam's POV. + /// + public bool useOcclusionCulling + { + get { return m_UseOcclusionCulling; } + set + { + m_UseOcclusionCulling = value; + UpdateDepthCameraProperties(); + } + } + + /// + /// Controls how large the depth texture captured by the virtual camera is. + /// The lower the resolution, the better the performance, but the less accurate the rendering. + /// + public int depthMapResolution + { + get { return m_DepthMapResolution; } + set + { + if(m_DepthCamera != null && Application.isPlaying) { Debug.LogErrorFormat(Consts.Shadow.GetErrorChangeRuntimeDepthMapResolution(this)); } + m_DepthMapResolution = value; + } + } + + /// + /// Manually process the occlusion. + /// You have to call this function in order to update the occlusion when using ShadowUpdateRate.Never. + /// + public void ProcessOcclusionManually() { ProcessOcclusion(ProcessOcclusionSource.User); } + + [SerializeField] float m_Strength = Consts.Shadow.StrengthDefault; + [SerializeField] ShadowUpdateRate m_UpdateRate = Consts.Shadow.UpdateRateDefault; + [SerializeField] int m_WaitXFrames = Consts.Shadow.WaitFramesCountDefault; + [SerializeField] LayerMask m_LayerMask = Consts.Shadow.LayerMaskDefault; + [SerializeField] bool m_UseOcclusionCulling = Consts.Shadow.OcclusionCullingDefault; + [SerializeField] int m_DepthMapResolution = Consts.Shadow.DepthMapResolutionDefault; + + public void UpdateDepthCameraProperties() + { + if (m_DepthCamera) + { + m_DepthCamera.cullingMask = layerMask; + m_DepthCamera.useOcclusionCulling = useOcclusionCulling; + } + } + + enum ProcessOcclusionSource + { + RenderLoop, + OnEnable, + EditorUpdate, + User, + } + + void ProcessOcclusion(ProcessOcclusionSource source) + { + if (!Config.Instance.featureEnabledShadow) + return; + + if(m_LastFrameRendered == Time.frameCount && Application.isPlaying && source == ProcessOcclusionSource.OnEnable) + return; // allow to call ProcessOcclusion from OnEnable (when disabling/enabling multiple a beam on the same frame) without generating an error + + Debug.Assert(!Application.isPlaying || m_LastFrameRendered != Time.frameCount, "ProcessOcclusion has been called twice on the same frame, which is forbidden"); + Debug.Assert(m_Master && m_DepthCamera); + + if (SRPHelper.IsUsingCustomRenderPipeline()) // Recursive rendering is not supported on SRP + m_NeedToUpdateOcclusionNextFrame = true; + else + ProcessOcclusionInternal(); + + SetDirty(); // refresh material + + if (updateRate.HasFlag(ShadowUpdateRate.OnBeamMove)) + m_TransformPacked = transform.GetWorldPacked(); + + bool firstTime = m_LastFrameRendered < 0; + m_LastFrameRendered = Time.frameCount; + + if (firstTime && _INTERNAL_ApplyRandomFrameOffset) + { + m_LastFrameRendered += Random.Range(0, waitXFrames); // add a random offset to prevent from updating texture for all beams having the same wait value + } + } + + public static void ApplyMaterialProperties(VolumetricShadowHD instance, BeamGeometryHD geom) + { + Debug.Assert(geom != null); + + if (instance && instance.enabled) + { + Debug.Assert(instance.m_DepthCamera); + geom.SetMaterialProp(ShaderProperties.HD.ShadowDepthTexture, instance.m_DepthCamera.targetTexture); + + var scale = instance.m_Master.scalable ? instance.m_Master.GetLossyScale() : Vector3.one; + geom.SetMaterialProp(ShaderProperties.HD.ShadowProps, new Vector4(Mathf.Sign(scale.x) * Mathf.Sign(scale.z), Mathf.Sign(scale.y), instance.m_Strength, instance.m_DepthCamera.orthographic ? 0f : 1f)); + } + else + { + geom.SetMaterialProp(ShaderProperties.HD.ShadowDepthTexture, BeamGeometryHD.InvalidTexture.NoDepth); + } + } + + void Awake() + { + m_Master = GetComponent(); + Debug.Assert(m_Master); + +#if UNITY_EDITOR + MarkMaterialAsDirty(); +#endif + } + + void OnEnable() + { + OnValidateProperties(); + InstantiateOrActivateDepthCamera(); + OnBeamEnabled(); + } + + void OnDisable() + { + if (m_DepthCamera) m_DepthCamera.gameObject.SetActive(false); + SetDirty(); // refresh material with empty depth texture + } + + void OnDestroy() + { + DestroyDepthCamera(); + +#if UNITY_EDITOR + MarkMaterialAsDirty(); +#endif + } + + void ProcessOcclusionInternal() + { + UpdateDepthCameraPropertiesAccordingToBeam(); + m_DepthCamera.Render(); + } + + void OnBeamEnabled() + { +#if UNITY_EDITOR + if (!Application.isPlaying) { return; } +#endif + if (!enabled) { return; } + + if (!updateRate.HasFlag(ShadowUpdateRate.Never)) + ProcessOcclusion(ProcessOcclusionSource.OnEnable); + } + + public void OnWillCameraRenderThisBeam(Camera cam, BeamGeometryHD beamGeom) + { +#if UNITY_EDITOR + if (!Application.isPlaying) { return; } +#endif + if (!enabled) { return; } + + if(cam != null + && cam.enabled + && Time.frameCount != m_LastFrameRendered // prevent from updating multiple times if there are more than 1 camera + && updateRate != ShadowUpdateRate.Never) + { + bool shouldUpdate = false; + + if (!shouldUpdate && updateRate.HasFlag(ShadowUpdateRate.OnBeamMove)) + { + if (!m_TransformPacked.IsSame(transform)) + shouldUpdate = true; + } + + if (!shouldUpdate && updateRate.HasFlag(ShadowUpdateRate.EveryXFrames)) + { + if (Time.frameCount >= m_LastFrameRendered + waitXFrames) + shouldUpdate = true; + } + + if (shouldUpdate) + ProcessOcclusion(ProcessOcclusionSource.RenderLoop); + } + } + + void Update() + { + if (m_NeedToUpdateOcclusionNextFrame && m_Master && m_DepthCamera + && Time.frameCount > 1) // fix NullReferenceException in UnityEngine.Rendering.Universal.Internal.CopyDepthPass.Execute when using SRP + { + ProcessOcclusionInternal(); + m_NeedToUpdateOcclusionNextFrame = false; + } + } + + void UpdateDepthCameraPropertiesAccordingToBeam() + { + Debug.Assert(m_Master); + + Utils.SetupDepthCamera(m_DepthCamera + , m_Master.GetConeApexOffsetZ(true), m_Master.maxGeometryDistance, m_Master.coneRadiusStart, m_Master.coneRadiusEnd + , m_Master.beamLocalForward, m_Master.GetLossyScale(), m_Master.scalable, m_Master.beamInternalLocalRotation + , false); + } + + void InstantiateOrActivateDepthCamera() + { + if (m_DepthCamera != null) + { + m_DepthCamera.gameObject.SetActive(true); // active it in case it has been disabled by OnDisable() + } + else + { + // delete old depth cameras when duplicating the GAO + gameObject.ForeachComponentsInDirectChildrenOnly(cam => DestroyImmediate(cam.gameObject), true); + + m_DepthCamera = Utils.NewWithComponent("Depth Camera"); + + if (m_DepthCamera && m_Master) + { + m_DepthCamera.enabled = false; + + UpdateDepthCameraProperties(); // set layerMask & useOcclusionCulling + m_DepthCamera.clearFlags = CameraClearFlags.Depth; + m_DepthCamera.depthTextureMode = DepthTextureMode.Depth; + m_DepthCamera.renderingPath = RenderingPath.Forward; // RenderingPath.VertexLit is faster, but RenderingPath.Forward allows to catch alpha cutout + m_DepthCamera.gameObject.hideFlags = Consts.Internal.ProceduralObjectsHideFlags; + m_DepthCamera.transform.SetParent(transform, false); + Config.Instance.SetURPScriptableRendererIndexToDepthCamera(m_DepthCamera); + + var rt = new RenderTexture(depthMapResolution, depthMapResolution, 16, RenderTextureFormat.Depth); + m_DepthCamera.targetTexture = rt; + + UpdateDepthCameraPropertiesAccordingToBeam(); + +#if UNITY_EDITOR + UnityEditor.GameObjectUtility.SetStaticEditorFlags(m_DepthCamera.gameObject, m_Master.GetStaticEditorFlagsForSubObjects()); + m_DepthCamera.gameObject.SetSameSceneVisibilityStatesThan(m_Master.gameObject); +#endif + } + } + } + + void DestroyDepthCamera() + { + if (m_DepthCamera) + { + if (m_DepthCamera.targetTexture) + { + m_DepthCamera.targetTexture.Release(); + DestroyImmediate(m_DepthCamera.targetTexture); + m_DepthCamera.targetTexture = null; + } + + DestroyImmediate(m_DepthCamera.gameObject); // Make sure to delete the GAO + m_DepthCamera = null; + } + } + + void OnValidateProperties() + { + m_WaitXFrames = Mathf.Clamp(m_WaitXFrames, 1, 60); + m_DepthMapResolution = Mathf.Clamp(Mathf.NextPowerOfTwo(m_DepthMapResolution), 8, 2048); + } + + void SetDirty() + { + if (m_Master) + m_Master.SetPropertyDirty(DirtyProps.ShadowProps); + } + + VolumetricLightBeamHD m_Master = null; + TransformUtils.Packed m_TransformPacked; + int m_LastFrameRendered = int.MinValue; + public int _INTERNAL_LastFrameRendered { get { return m_LastFrameRendered; } } // for unit tests + + Camera m_DepthCamera = null; + bool m_NeedToUpdateOcclusionNextFrame = false; + public static bool _INTERNAL_ApplyRandomFrameOffset = true; + +#if UNITY_EDITOR + bool m_NeedToReinstantiateDepthCamera = false; + + void MarkMaterialAsDirty() + { + // when adding/removing this component in editor, we might need to switch from a GPU Instanced material to a custom one, + // since this feature doesn't support GPU Instancing + if (!Application.isPlaying) + m_Master._EditorSetBeamGeomDirty(); + } + + void OnValidate() + { + OnValidateProperties(); + m_NeedToReinstantiateDepthCamera = true; + } + + void LateUpdate() + { + if (!Application.isPlaying) + { + if (m_NeedToReinstantiateDepthCamera) + { + DestroyDepthCamera(); + InstantiateOrActivateDepthCamera(); + m_NeedToReinstantiateDepthCamera = false; + } + + if (m_Master && m_Master.enabled) + ProcessOcclusion(ProcessOcclusionSource.EditorUpdate); + } + } + + public bool HasLayerMaskIssues() + { + if (Config.Instance.geometryOverrideLayer) + { + int layerBit = 1 << Config.Instance.geometryLayerID; + return ((layerMask.value & layerBit) == layerBit); + } + return false; + } +#endif // UNITY_EDITOR + } +} + diff --git a/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricShadowHD.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricShadowHD.cs.meta new file mode 100644 index 00000000..6ed1d13b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HD/VolumetricShadowHD.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 51e172702b541584f96980fe85c79969 +timeCreated: 1614355336 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: f4140fedf3f72d7448a4e55ea9db44ab, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/HighlightNullAttribute.cs b/Assets/External/VolumetricLightBeam/Scripts/HighlightNullAttribute.cs new file mode 100644 index 00000000..9867c1d1 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HighlightNullAttribute.cs @@ -0,0 +1,33 @@ +using UnityEngine; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace VLB +{ + /// + /// Highlight in red in inspector in not set + /// + public sealed class HighlightNullAttribute : PropertyAttribute { } + +#if UNITY_EDITOR + [CustomPropertyDrawer(typeof(HighlightNullAttribute))] + public class HighlightNullDrawer : PropertyDrawer + { + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + if (property.propertyType != SerializedPropertyType.ObjectReference) + { + EditorGUI.LabelField(position, label.text, "Only valid for object references"); + return; + } + + if (property.objectReferenceValue == null) + EditorGUI.DrawRect(position, Color.red); + + EditorGUI.ObjectField(position, property, label); + } + } +#endif +} + diff --git a/Assets/External/VolumetricLightBeam/Scripts/HighlightNullAttribute.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/HighlightNullAttribute.cs.meta new file mode 100644 index 00000000..a90a3ea4 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/HighlightNullAttribute.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: e7b5213963066994eaa8a96b953deb97 +timeCreated: 1511460052 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/MaterialManager.cs b/Assets/External/VolumetricLightBeam/Scripts/MaterialManager.cs new file mode 100644 index 00000000..98a21c98 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/MaterialManager.cs @@ -0,0 +1,305 @@ +using UnityEngine; +using UnityEngine.Rendering; +using System.Collections; + +namespace VLB +{ + public static class MaterialManager + { + public static MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock(); + + public enum BlendingMode + { + Additive, + SoftAdditive, + TraditionalTransparency, + Count + } + + public enum ColorGradient + { + Off, + MatrixLow, + MatrixHigh, + Count + } + + public enum Noise3D + { + Off, + On, + Count + } + + public static class SD + { + public enum DepthBlend + { + Off, + On, + Count + } + + public enum DynamicOcclusion + { + Off, + ClippingPlane, + DepthTexture, + Count + } + + public enum MeshSkewing + { + Off, + On, + Count + } + + public enum ShaderAccuracy + { + Fast, + High, + Count + } + } + + public static class HD + { + public enum Attenuation + { + Linear, + Quadratic, + Count + } + + public enum Shadow + { + Off, + On, + Count + } + + public enum Cookie + { + Off, + SingleChannel, + RGBA, + Count + } + } + + static readonly UnityEngine.Rendering.BlendMode[] BlendingMode_SrcFactor = new UnityEngine.Rendering.BlendMode[(int)BlendingMode.Count] + { + UnityEngine.Rendering.BlendMode.One, // Additive + UnityEngine.Rendering.BlendMode.OneMinusDstColor, // SoftAdditive + UnityEngine.Rendering.BlendMode.SrcAlpha, // TraditionalTransparency + }; + + static readonly UnityEngine.Rendering.BlendMode[] BlendingMode_DstFactor = new UnityEngine.Rendering.BlendMode[(int)BlendingMode.Count] + { + UnityEngine.Rendering.BlendMode.One, // Additive + UnityEngine.Rendering.BlendMode.One, // SoftAdditive + UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha, // TraditionalTransparency + }; + + static readonly bool[] BlendingMode_AlphaAsBlack = new bool[(int)BlendingMode.Count] + { + true, // Additive + true, // SoftAdditive + false, // TraditionalTransparency + }; + + interface IStaticProperties + { + int GetPropertiesCount(); + int GetMaterialID(); + void ApplyToMaterial(Material mat); + ShaderMode GetShaderMode(); + } + + // STATIC PROPERTIES SD + public struct StaticPropertiesSD : IStaticProperties + { + public ShaderMode GetShaderMode() { return ShaderMode.SD; } + public static int staticPropertiesCount { get { return (int)BlendingMode.Count * (int)Noise3D.Count * (int)SD.DepthBlend.Count * (int)ColorGradient.Count * (int)SD.DynamicOcclusion.Count * (int)SD.MeshSkewing.Count * (int)SD.ShaderAccuracy.Count; } } + public int GetPropertiesCount() { return staticPropertiesCount; } + + public BlendingMode blendingMode; + public Noise3D noise3D; + public SD.DepthBlend depthBlend; + public ColorGradient colorGradient; + public SD.DynamicOcclusion dynamicOcclusion; + public SD.MeshSkewing meshSkewing; + public SD.ShaderAccuracy shaderAccuracy; + + int blendingModeID { get { return (int)blendingMode; } } + int noise3DID { get { return Config.Instance.featureEnabledNoise3D ? (int)noise3D : 0; } } + int depthBlendID { get { return Config.Instance.featureEnabledDepthBlend ? (int)depthBlend : 0; } } + int colorGradientID { get { return Config.Instance.featureEnabledColorGradient != FeatureEnabledColorGradient.Off ? (int)colorGradient : 0; } } + int dynamicOcclusionID { get { return Config.Instance.featureEnabledDynamicOcclusion ? (int)dynamicOcclusion : 0; } } + int meshSkewingID { get { return Config.Instance.featureEnabledMeshSkewing ? (int)meshSkewing : 0; } } + int shaderAccuracyID { get { return Config.Instance.featureEnabledShaderAccuracyHigh ? (int)shaderAccuracy : 0; } } + + public int GetMaterialID() + { + return (((((((blendingModeID) + * (int)Noise3D.Count + noise3DID) + * (int)SD.DepthBlend.Count + depthBlendID) + * (int)ColorGradient.Count + colorGradientID) + * (int)SD.DynamicOcclusion.Count + dynamicOcclusionID) + * (int)SD.MeshSkewing.Count + meshSkewingID) + * (int)SD.ShaderAccuracy.Count + shaderAccuracyID) + ; + } + + public void ApplyToMaterial(Material mat) + { + mat.SetKeywordEnabled(ShaderKeywords.AlphaAsBlack, BlendingMode_AlphaAsBlack[(int)blendingMode]); + mat.SetKeywordEnabled(ShaderKeywords.ColorGradientMatrixLow, colorGradient == ColorGradient.MatrixLow); + mat.SetKeywordEnabled(ShaderKeywords.ColorGradientMatrixHigh, colorGradient == ColorGradient.MatrixHigh); + mat.SetKeywordEnabled(ShaderKeywords.SD.DepthBlend, depthBlend == SD.DepthBlend.On); + mat.SetKeywordEnabled(ShaderKeywords.Noise3D, noise3D == Noise3D.On); + mat.SetKeywordEnabled(ShaderKeywords.SD.OcclusionClippingPlane, dynamicOcclusion == SD.DynamicOcclusion.ClippingPlane); + mat.SetKeywordEnabled(ShaderKeywords.SD.OcclusionDepthTexture, dynamicOcclusion == SD.DynamicOcclusion.DepthTexture); + mat.SetKeywordEnabled(ShaderKeywords.SD.MeshSkewing, meshSkewing == SD.MeshSkewing.On); + mat.SetKeywordEnabled(ShaderKeywords.SD.ShaderAccuracyHigh, shaderAccuracy == SD.ShaderAccuracy.High); + + mat.SetBlendingMode(ShaderProperties.BlendSrcFactor, BlendingMode_SrcFactor[(int)blendingMode]); + mat.SetBlendingMode(ShaderProperties.BlendDstFactor, BlendingMode_DstFactor[(int)blendingMode]); + mat.SetZTest(ShaderProperties.ZTest, CompareFunction.LessEqual); + } + } + + // STATIC PROPERTIES HD + public struct StaticPropertiesHD : IStaticProperties + { + public ShaderMode GetShaderMode() { return ShaderMode.HD; } + public static int staticPropertiesCount { get { return (int)BlendingMode.Count * (int)HD.Attenuation.Count * (int)Noise3D.Count * (int)ColorGradient.Count * (int)HD.Shadow.Count * (int)HD.Cookie.Count * Config.Instance.raymarchingQualitiesCount; } } + public int GetPropertiesCount() { return staticPropertiesCount; } + + public BlendingMode blendingMode; + public HD.Attenuation attenuation; + public Noise3D noise3D; + public ColorGradient colorGradient; + public HD.Shadow shadow; + public HD.Cookie cookie; + public int raymarchingQualityIndex; + + int blendingModeID { get { return (int)blendingMode; } } + int attenuationID { get { return (int)attenuation; } } + int noise3DID { get { return Config.Instance.featureEnabledNoise3D ? (int)noise3D : 0; } } + int colorGradientID { get { return Config.Instance.featureEnabledColorGradient != FeatureEnabledColorGradient.Off ? (int)colorGradient : 0; } } + int dynamicOcclusionID { get { return Config.Instance.featureEnabledShadow ? (int)shadow : 0; } } + int cookieID { get { return Config.Instance.featureEnabledCookie ? (int)cookie : 0; } } + int raymarchingQualityID { get { return raymarchingQualityIndex; } } + + public int GetMaterialID() + { + return (((((((blendingModeID) + * (int)HD.Attenuation.Count + attenuationID) + * (int)Noise3D.Count + noise3DID) + * (int)ColorGradient.Count + colorGradientID) + * (int)HD.Shadow.Count + dynamicOcclusionID) + * (int)HD.Cookie.Count + cookieID) + * (int)Config.Instance.raymarchingQualitiesCount + raymarchingQualityID) + ; + } + + public void ApplyToMaterial(Material mat) + { + mat.SetKeywordEnabled(ShaderKeywords.AlphaAsBlack, BlendingMode_AlphaAsBlack[(int)blendingMode]); + mat.SetKeywordEnabled(ShaderKeywords.HD.AttenuationLinear, attenuation == HD.Attenuation.Linear); + mat.SetKeywordEnabled(ShaderKeywords.HD.AttenuationQuad, attenuation == HD.Attenuation.Quadratic); + mat.SetKeywordEnabled(ShaderKeywords.ColorGradientMatrixLow, colorGradient == ColorGradient.MatrixLow); + mat.SetKeywordEnabled(ShaderKeywords.ColorGradientMatrixHigh, colorGradient == ColorGradient.MatrixHigh); + mat.SetKeywordEnabled(ShaderKeywords.Noise3D, noise3D == Noise3D.On); + mat.SetKeywordEnabled(ShaderKeywords.HD.Shadow, shadow == HD.Shadow.On); + mat.SetKeywordEnabled(ShaderKeywords.HD.CookieSingleChannel, cookie == HD.Cookie.SingleChannel); + mat.SetKeywordEnabled(ShaderKeywords.HD.CookieRGBA, cookie == HD.Cookie.RGBA); + + for (int i = 0; i < Config.Instance.raymarchingQualitiesCount; ++i) + mat.SetKeywordEnabled(ShaderKeywords.HD.GetRaymarchingQuality(i), raymarchingQualityIndex == i); + + mat.SetBlendingMode(ShaderProperties.BlendSrcFactor, BlendingMode_SrcFactor[(int)blendingMode]); + mat.SetBlendingMode(ShaderProperties.BlendDstFactor, BlendingMode_DstFactor[(int)blendingMode]); + mat.SetZTest(ShaderProperties.ZTest, CompareFunction.Always); + } + } + + public static Material NewMaterialPersistent(Shader shader, bool gpuInstanced) + { + if (!shader) + { + Debug.LogError("Invalid VLB Shader. Please try to reset the VLB Config asset or reinstall the plugin."); + return null; + } + + var material = new Material(shader); + BatchingHelper.SetMaterialProperties(material, gpuInstanced); + return material; + } + + class MaterialsGroup + { + public Material[] materials = null; + + public MaterialsGroup(int count) + { + Debug.Assert(count > 0); + materials = new Material[count]; + } + } + + // SD Instanced Material Access + static Hashtable ms_MaterialsGroupSD = new Hashtable(1); + public static Material GetInstancedMaterial(uint groupID, ref StaticPropertiesSD staticProps) + { + IStaticProperties iStaticProp = staticProps; + return GetInstancedMaterial(ms_MaterialsGroupSD, groupID, ref iStaticProp); + } + + // HD Instanced Material Access + static Hashtable ms_MaterialsGroupHD = new Hashtable(1); + public static Material GetInstancedMaterial(uint groupID, ref StaticPropertiesHD staticProps) + { + IStaticProperties iStaticProp = staticProps; + return GetInstancedMaterial(ms_MaterialsGroupHD, groupID, ref iStaticProp); + } + + static Material GetInstancedMaterial(Hashtable groups, uint groupID, ref IStaticProperties staticProps) // pass StaticProperties by ref to avoid per value arg copy + { + MaterialsGroup group = (MaterialsGroup)groups[groupID]; + if (group == null) + { + group = new MaterialsGroup(staticProps.GetPropertiesCount()); + groups[groupID] = group; + } + + int matID = staticProps.GetMaterialID(); + Debug.Assert(matID < staticProps.GetPropertiesCount()); + Debug.Assert(group.materials != null); + var mat = group.materials[matID]; + if (mat == null) + { + mat = Config.Instance.NewMaterialTransient(staticProps.GetShaderMode(), gpuInstanced:true); + if(mat) + { + group.materials[matID] = mat; + staticProps.ApplyToMaterial(mat); + } + } + + return mat; + } + + // Material Utils + enum ZWrite { Off = 0, On = 1 } + static void SetBlendingMode(this Material mat, int nameID, BlendMode value) { mat.SetInt(nameID, (int)value); } + static void SetStencilRef(this Material mat, int nameID, int value) { mat.SetInt(nameID, value); } + static void SetStencilComp(this Material mat, int nameID, CompareFunction value) { mat.SetInt(nameID, (int)value); } + static void SetStencilOp(this Material mat, int nameID, StencilOp value) { mat.SetInt(nameID, (int)value); } + static void SetCull(this Material mat, int nameID, CullMode value) { mat.SetInt(nameID, (int)value); } + static void SetZWrite(this Material mat, int nameID, ZWrite value) { mat.SetInt(nameID, (int)value); } + static void SetZTest(this Material mat, int nameID, CompareFunction value) { mat.SetInt(nameID, (int)value); } + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/MaterialManager.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/MaterialManager.cs.meta new file mode 100644 index 00000000..8ea86286 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/MaterialManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6f3b53f8b071fa74997d838b723bcfa7 +timeCreated: 1537852951 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/MaterialModifier.cs b/Assets/External/VolumetricLightBeam/Scripts/MaterialModifier.cs new file mode 100644 index 00000000..ed1eda82 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/MaterialModifier.cs @@ -0,0 +1,18 @@ +using UnityEngine; + +namespace VLB +{ + public static class MaterialModifier + { + public interface Interface + { + void SetMaterialProp(int nameID, float value); + void SetMaterialProp(int nameID, Vector4 value); + void SetMaterialProp(int nameID, Color value); + void SetMaterialProp(int nameID, Matrix4x4 value); + void SetMaterialProp(int nameID, Texture value); + } + + public delegate void Callback(Interface owner); + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/MaterialModifier.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/MaterialModifier.cs.meta new file mode 100644 index 00000000..321fa39c --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/MaterialModifier.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 51c15cec95cca374a92f3e0c0d7b7fe8 +timeCreated: 1577644734 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/MeshGenerator.cs b/Assets/External/VolumetricLightBeam/Scripts/MeshGenerator.cs new file mode 100644 index 00000000..2590030b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/MeshGenerator.cs @@ -0,0 +1,444 @@ +using UnityEngine; + +namespace VLB +{ + public static class MeshGenerator + { + const float kMinTruncatedRadius = 0.001f; + + static float GetAngleOffset(int numSides) + { + // rotate square beams so they are properly oriented to scale them more easily + return numSides == 4 ? (Mathf.PI * 0.25f) : 0f; + } + + static float GetRadiiScale(int numSides) + { + // with 4 sides, place the vertices in the square's corners to fit with the depth buffer camera frustum + return numSides == 4 ? Mathf.Sqrt(2f) : 1f; + } + + public static Mesh GenerateConeZ_RadiusAndAngle(float lengthZ, float radiusStart, float coneAngle, int numSides, int numSegments, bool cap, bool doubleSided) + { + Debug.Assert(lengthZ > 0f); + Debug.Assert(coneAngle > 0f && coneAngle < 180f); + var radiusEnd = lengthZ * Mathf.Tan(coneAngle * Mathf.Deg2Rad * 0.5f); + + return GenerateConeZ_Radii(lengthZ, radiusStart, radiusEnd, numSides, numSegments, cap, doubleSided); + } + + public static Mesh GenerateConeZ_Angle(float lengthZ, float coneAngle, int numSides, int numSegments, bool cap, bool doubleSided) + { + return GenerateConeZ_RadiusAndAngle(lengthZ, 0f, coneAngle, numSides, numSegments, cap, doubleSided); + } + + + // Cone with optional cap (at start only), optional segments count, vertices + UVs (storing info about cap and side) + public static Mesh GenerateConeZ_Radii(float lengthZ, float radiusStart, float radiusEnd, int numSides, int numSegments, bool cap, bool doubleSided) + { + Debug.Assert(lengthZ > 0f); + Debug.Assert(radiusStart >= 0f); + Debug.Assert(numSides >= 3); + Debug.Assert(numSegments >= 0); + + var mesh = new Mesh(); + bool genCap = cap && radiusStart > 0f; + + // We use the XY position of the vertices to compute the cone normal in the shader. + // With a perfectly sharp cone, we couldn't compute accurate normals at its top. + radiusStart = Mathf.Max(radiusStart, kMinTruncatedRadius); + + { + float radiiScale = GetRadiiScale(numSides); + radiusStart *= radiiScale; + radiusEnd *= radiiScale; + } + + int vertCountSides = numSides * (numSegments + 2); + int vertCountTotal = vertCountSides; + + if (genCap) + vertCountTotal += numSides + 1; + + // VERTICES + { + float angleOffset = GetAngleOffset(numSides); + + var vertices = new Vector3[vertCountTotal]; + + for (int i = 0; i < numSides; i++) + { + float angle = angleOffset + 2 * Mathf.PI * i / numSides; + float angleCos = Mathf.Cos(angle); + float angleSin = Mathf.Sin(angle); + + for (int seg = 0; seg < numSegments + 2; seg++) + { + float tseg = (float)seg / (numSegments + 1); + Debug.Assert(tseg >= 0f && tseg <= 1f); + float radius = Mathf.Lerp(radiusStart, radiusEnd, tseg); + vertices[i + seg * numSides] = new Vector3(radius * angleCos, radius * angleSin, tseg * lengthZ); + } + } + + if (genCap) + { + int ind = vertCountSides; + + vertices[ind] = Vector3.zero; + ind++; + + for (int i = 0; i < numSides; i++) + { + float angle = angleOffset + 2 * Mathf.PI * i / numSides; + float angleCos = Mathf.Cos(angle); + float angleSin = Mathf.Sin(angle); + vertices[ind] = new Vector3(radiusStart * angleCos, radiusStart * angleSin, 0f); + ind++; + } + + Debug.Assert(ind == vertices.Length); + } + + if (!doubleSided) + { + mesh.vertices = vertices; + } + else + { + var vertices2 = new Vector3[vertices.Length * 2]; + vertices.CopyTo(vertices2, 0); + vertices.CopyTo(vertices2, vertices.Length); + mesh.vertices = vertices2; + } + } + + // UV (used to flags vertices as sides or cap) + // X: 0 = sides ; 1 = cap + // Y: 0 = front face ; 1 = back face (doubleSided only) + { + var uv = new Vector2[vertCountTotal]; + int ind = 0; + for (int i = 0; i < vertCountSides; i++) + uv[ind++] = Vector2.zero; + + if (genCap) + { + for (int i = 0; i < numSides + 1; i++) + uv[ind++] = new Vector2(1, 0); + } + + Debug.Assert(ind == uv.Length); + + + if (!doubleSided) + { + mesh.uv = uv; + } + else + { + var uv2 = new Vector2[uv.Length * 2]; + uv.CopyTo(uv2, 0); + uv.CopyTo(uv2, uv.Length); + + for (int i = 0; i < uv.Length; i++) + { + var value = uv2[i + uv.Length]; + uv2[i + uv.Length] = new Vector2(value.x, 1); + } + + mesh.uv = uv2; + } + } + + // INDICES + { + int triCountSides = numSides * 2 * Mathf.Max(numSegments + 1, 1); + int indCountSides = triCountSides * 3; + int indCountTotal = indCountSides; + + if (genCap) + indCountTotal += numSides * 3; + + var indices = new int[indCountTotal]; + int ind = 0; + + for (int i = 0; i < numSides; i++) + { + int ip1 = i + 1; + if (ip1 == numSides) + ip1 = 0; + + for (int k = 0; k < numSegments + 1; ++k) + { + var offset = k * numSides; + + indices[ind++] = offset + i; + indices[ind++] = offset + ip1; + indices[ind++] = offset + i + numSides; + + indices[ind++] = offset + ip1 + numSides; + indices[ind++] = offset + i + numSides; + indices[ind++] = offset + ip1; + } + } + + if (genCap) + { + for (int i = 0; i < numSides - 1; i++) + { + indices[ind++] = vertCountSides; + indices[ind++] = vertCountSides + i + 2; + indices[ind++] = vertCountSides + i + 1; + } + + indices[ind++] = vertCountSides; + indices[ind++] = vertCountSides + 1; + indices[ind++] = vertCountSides + numSides; + } + + Debug.Assert(ind == indices.Length); + + if (!doubleSided) + { + mesh.triangles = indices; + } + else + { + var indices2 = new int[indices.Length * 2]; + indices.CopyTo(indices2, 0); + + for (int i = 0; i < indices.Length; i += 3) + { + indices2[indices.Length + i + 0] = indices[i + 0] + vertCountTotal; + indices2[indices.Length + i + 1] = indices[i + 2] + vertCountTotal; + indices2[indices.Length + i + 2] = indices[i + 1] + vertCountTotal; + } + + mesh.triangles = indices2; + } + } + + mesh.bounds = ComputeBounds(lengthZ, radiusStart, radiusEnd); + + Debug.Assert(mesh.vertexCount == GetVertexCount(numSides, numSegments, genCap ? CapMode.SpecificVerticesPerCap_1Cap : CapMode.None, doubleSided)); + Debug.Assert(mesh.triangles.Length == GetIndicesCount(numSides, numSegments, genCap ? CapMode.SpecificVerticesPerCap_1Cap : CapMode.None, doubleSided)); + + return mesh; + } + + + // Cone with double caps, no segments, vertices only (no UVs) + public static Mesh GenerateConeZ_Radii_DoubleCaps(float lengthZ, float radiusStart, float radiusEnd, int numSides, bool inverted) + { + Debug.Assert(lengthZ > 0f); + Debug.Assert(radiusStart >= 0f); + Debug.Assert(numSides >= 3); + + var mesh = new Mesh(); + + // We use the XY position of the vertices to compute the cone normal in the shader. + // With a perfectly sharp cone, we couldn't compute accurate normals at its top. + radiusStart = Mathf.Max(radiusStart, kMinTruncatedRadius); + + int vertCountSides = numSides * 2; + int vertCountTotal = vertCountSides; + + System.Func vertSidesStartFromSlide = (int slideID) => + { + return numSides * slideID; + }; + + System.Func vertCenterFromSlide = (int slideID) => + { + return vertCountSides + slideID; + }; + + vertCountTotal += 2; // caps + + // VERTICES + { + float angleOffset = GetAngleOffset(numSides); + + var vertices = new Vector3[vertCountTotal]; + + for (int i = 0; i < numSides; i++) + { + float angle = angleOffset + 2 * Mathf.PI * i / numSides; + float angleCos = Mathf.Cos(angle); + float angleSin = Mathf.Sin(angle); + + for (int seg = 0; seg < 2; seg++) + { + float tseg = (float)seg; + Debug.Assert(tseg >= 0f && tseg <= 1f); + float radius = Mathf.Lerp(radiusStart, radiusEnd, tseg); + vertices[i + vertSidesStartFromSlide(seg)] = new Vector3(radius * angleCos, radius * angleSin, tseg * lengthZ); + } + } + + vertices[vertCenterFromSlide(0)] = Vector3.zero; // cap start + vertices[vertCenterFromSlide(1)] = new Vector3(0f, 0f, lengthZ); // cap end + + mesh.vertices = vertices; + } + + // INDICES + { + int triCountSides = numSides * 2; + int indCountSides = triCountSides * 3; + int indCountTotal = indCountSides; + + indCountTotal += numSides * 3; // cap start + indCountTotal += numSides * 3; // cap end + + var indices = new int[indCountTotal]; + int ind = 0; + + for (int i = 0; i < numSides; i++) + { + int ip1 = i + 1; + if (ip1 == numSides) + ip1 = 0; + + for (int k = 0; k < 1; ++k) + { + var offset = k * numSides; + + indices[ind + 0] = offset + i; + indices[ind + (inverted ? 1 : 2)] = offset + ip1; + indices[ind + (inverted ? 2 : 1)] = offset + i + numSides; + + indices[ind + 3] = offset + ip1 + numSides; + indices[ind + (inverted ? 4 : 5)] = offset + i + numSides; + indices[ind + (inverted ? 5 : 4)] = offset + ip1; + + ind += 6; + } + } + + System.Action generateCapIndexes = (int slideID, bool invert) => + { + int vertSidesStart = vertSidesStartFromSlide(slideID); + + for (int i = 0; i < numSides - 1; i++) + { + indices[ind + 0] = vertCenterFromSlide(slideID); + indices[ind + (invert ? 1 : 2)] = vertSidesStart + i + 1; + indices[ind + (invert ? 2 : 1)] = vertSidesStart + i + 0; + ind += 3; + } + + indices[ind + 0] = vertCenterFromSlide(slideID); + indices[ind + (invert ? 1 : 2)] = vertSidesStart; + indices[ind + (invert ? 2 : 1)] = vertSidesStart + numSides - 1; + ind += 3; + }; + + generateCapIndexes(0, inverted); // cap start + generateCapIndexes(1, !inverted); // cap end + + Debug.Assert(ind == indices.Length); + + mesh.triangles = indices; + } + + var bounds = new Bounds( + new Vector3(0, 0, lengthZ * 0.5f), + new Vector3(Mathf.Max(radiusStart, radiusEnd) * 2, Mathf.Max(radiusStart, radiusEnd) * 2, lengthZ) + ); + mesh.bounds = bounds; + + Debug.Assert(mesh.vertexCount == GetVertexCount(numSides, 0, CapMode.OneVertexPerCap_2Caps, doubleSided: false)); + Debug.Assert(mesh.triangles.Length == GetIndicesCount(numSides, 0, CapMode.OneVertexPerCap_2Caps, doubleSided: false)); + + return mesh; + } + + public static Bounds ComputeBounds(float lengthZ, float radiusStart, float radiusEnd) + { + float maxDiameter = Mathf.Max(radiusStart, radiusEnd) * 2; + return new Bounds( + new Vector3(0, 0, lengthZ * 0.5f), + new Vector3(maxDiameter, maxDiameter, lengthZ) + ); + } + + public enum CapMode + { + None, + OneVertexPerCap_1Cap, + OneVertexPerCap_2Caps, + SpecificVerticesPerCap_1Cap, + SpecificVerticesPerCap_2Caps, + } + + static int GetCapAdditionalVerticesCount(CapMode capMode, int numSides) + { + switch (capMode) + { + case CapMode.None: return 0; + case CapMode.OneVertexPerCap_1Cap: return 1; + case CapMode.OneVertexPerCap_2Caps: return 2; + case CapMode.SpecificVerticesPerCap_1Cap: return 1 * (numSides + 1); + case CapMode.SpecificVerticesPerCap_2Caps: return 2 * (numSides + 1); + default: return 0; + } + } + + static int GetCapAdditionalIndicesCount(CapMode capMode, int numSides) + { + switch (capMode) + { + case CapMode.None: return 0; + case CapMode.OneVertexPerCap_1Cap: + case CapMode.SpecificVerticesPerCap_1Cap: return 1 * (numSides * 3); + case CapMode.OneVertexPerCap_2Caps: + case CapMode.SpecificVerticesPerCap_2Caps: return 2 * (numSides * 3); + default: return 0; + } + } + + public static int GetVertexCount(int numSides, int numSegments, CapMode capMode, bool doubleSided) + { + Debug.Assert(numSides >= 2); + Debug.Assert(numSegments >= 0); + + int count = numSides * (numSegments + 2); + count += GetCapAdditionalVerticesCount(capMode, numSides); + if (doubleSided) count *= 2; + return count; + } + + public static int GetIndicesCount(int numSides, int numSegments, CapMode capMode, bool doubleSided) + { + Debug.Assert(numSides >= 2); + Debug.Assert(numSegments >= 0); + + int count = numSides * (numSegments + 1) * 2 * 3; + count += GetCapAdditionalIndicesCount(capMode, numSides); + if (doubleSided) count *= 2; + return count; + } + + public static int GetSharedMeshVertexCount() + { + return GetVertexCount(Config.Instance.sharedMeshSides, Config.Instance.sharedMeshSegments, CapMode.SpecificVerticesPerCap_1Cap, Config.Instance.SD_requiresDoubleSidedMesh); + } + + public static int GetSharedMeshIndicesCount() + { + return GetIndicesCount(Config.Instance.sharedMeshSides, Config.Instance.sharedMeshSegments, CapMode.SpecificVerticesPerCap_1Cap, Config.Instance.SD_requiresDoubleSidedMesh); + } + + public static int GetSharedMeshHDVertexCount() + { + return GetVertexCount(Config.Instance.sharedMeshSides, 0, CapMode.OneVertexPerCap_2Caps, doubleSided: false); + } + + public static int GetSharedMeshHDIndicesCount() + { + return GetIndicesCount(Config.Instance.sharedMeshSides, 0, CapMode.OneVertexPerCap_2Caps, doubleSided: false); + } + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/MeshGenerator.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/MeshGenerator.cs.meta new file mode 100644 index 00000000..6237cdf4 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/MeshGenerator.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bc0059e5d7876fb4b97e542dcc0e8350 +timeCreated: 1504627701 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/MinMaxRangeFloat.cs b/Assets/External/VolumetricLightBeam/Scripts/MinMaxRangeFloat.cs new file mode 100644 index 00000000..a7b34a19 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/MinMaxRangeFloat.cs @@ -0,0 +1,102 @@ +using System; +using UnityEngine; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace VLB +{ + [Serializable] + public struct MinMaxRangeFloat : IEquatable + { + public float minValue { get { return m_MinValue; } } + public float maxValue { get { return m_MaxValue; } } + + public float randomValue { get { return UnityEngine.Random.Range(minValue, maxValue); } } + public Vector2 asVector2 { get { return new Vector2(minValue, maxValue); } } + + public float GetLerpedValue(float lerp01) { return Mathf.Lerp(minValue, maxValue, lerp01); } + + public MinMaxRangeFloat(float min, float max) { m_MinValue = min; m_MaxValue = max; Debug.Assert(min <= max); } + + public override bool Equals(object obj) => obj is MinMaxRangeFloat other && this.Equals(other); + public bool Equals(MinMaxRangeFloat other) => (m_MinValue == other.m_MinValue) && (m_MaxValue == other.m_MaxValue); + public override int GetHashCode() => (m_MinValue, m_MaxValue).GetHashCode(); + public static bool operator ==(MinMaxRangeFloat lhs, MinMaxRangeFloat rhs) => lhs.Equals(rhs); + public static bool operator !=(MinMaxRangeFloat lhs, MinMaxRangeFloat rhs) => !(lhs == rhs); + + [SerializeField] float m_MinValue; + [SerializeField] float m_MaxValue; + } + + public class MinMaxRangeAttribute : System.Attribute + { + public float minValue { get; private set; } + public float maxValue { get; private set; } + + public MinMaxRangeAttribute(float min, float max) { minValue = min; maxValue = max; Debug.Assert(min <= max); } + } + +#if UNITY_EDITOR + [CustomPropertyDrawer(typeof(MinMaxRangeFloat), true)] + public class MinMaxRangeFloatPropertyDrawer : PropertyDrawer + { + static float RoundFloat(float f) { return (float)Math.Round(f * 100f) / 100f; } + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + label = EditorGUI.BeginProperty(position, label, property); + { + position = EditorGUI.PrefixLabel(position, label); + + var propMin = property.FindPropertyRelative("m_MinValue"); + Debug.AssertFormat(propMin != null, "Failed to find property 'MinMaxRangeFloat.m_MinValue'"); + var propMax = property.FindPropertyRelative("m_MaxValue"); + Debug.AssertFormat(propMax != null, "Failed to find property 'MinMaxRangeFloat.m_MaxValue'"); + + float valueMin = RoundFloat(propMin.floatValue); + float valueMax = RoundFloat(propMax.floatValue); + + float rangeMin = 0.0f, rangeMax = 1.0f; + + var ranges = (MinMaxRangeAttribute[])fieldInfo.GetCustomAttributes(typeof(MinMaxRangeAttribute), true); + if (ranges.Length > 0) + { + rangeMin = ranges[0].minValue; + rangeMax = ranges[0].maxValue; + } + + const float kBoundsFieldWidth = 40.0f; + const float kWidthOffset = 5.0f; + + EditorGUI.showMixedValue = propMin.hasMultipleDifferentValues || propMax.hasMultipleDifferentValues; + { + EditorGUI.BeginChangeCheck(); + { + var rectMinValue = new Rect(position); + rectMinValue.width = kBoundsFieldWidth; + valueMin = EditorGUI.FloatField(rectMinValue, valueMin); + + position.xMin += kBoundsFieldWidth + kWidthOffset; + + var reactMaxValue = new Rect(position); + reactMaxValue.xMin = reactMaxValue.xMax - kBoundsFieldWidth; + valueMax = EditorGUI.FloatField(reactMaxValue, valueMax); + + position.xMax -= kBoundsFieldWidth + kWidthOffset; + + EditorGUI.MinMaxSlider(position, ref valueMin, ref valueMax, rangeMin, rangeMax); + } + if (EditorGUI.EndChangeCheck()) + { + propMin.floatValue = valueMin; + propMax.floatValue = valueMax; + } + } + EditorGUI.showMixedValue = false; + } + EditorGUI.EndProperty(); + } + } +#endif +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/MinMaxRangeFloat.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/MinMaxRangeFloat.cs.meta new file mode 100644 index 00000000..2d949dde --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/MinMaxRangeFloat.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dbd77861b0969d4469f82aed94865349 +timeCreated: 1617383958 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/Noise3D.cs b/Assets/External/VolumetricLightBeam/Scripts/Noise3D.cs new file mode 100644 index 00000000..6ced5da5 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/Noise3D.cs @@ -0,0 +1,77 @@ +using UnityEngine; + +#pragma warning disable 0429, 0162 // Unreachable expression code detected (because of Noise3D.isSupported on mobile) + +namespace VLB +{ + public static class Noise3D + { + /// + /// Returns if the 3D Noise feature is supported on the current platform or not. + /// 3D Noise feature requires a graphicsShaderLevel 35 or higher (which is basically Shader Model 3.5 / OpenGL ES 3.0 or above) + /// If not supported, the beams will look like the 3D Noise has been disabled. + /// + public static bool isSupported { + get { + if (!ms_IsSupportedChecked) + { + ms_IsSupported = SystemInfo.graphicsShaderLevel >= kMinShaderLevel; + if (!ms_IsSupported) + Debug.LogWarning(isNotSupportedString); + ms_IsSupportedChecked = true; + } + return ms_IsSupported; + } + } + + /// + /// Returns if the 3D Noise Texture has been successfully loaded or not. + /// If the feature is not supported (isSupported == false), isProperlyLoaded is also false. + /// + public static bool isProperlyLoaded { get { return ms_NoiseTexture != null; } } + + public static string isNotSupportedString { get { + var str = string.Format("3D Noise requires higher shader capabilities (Shader Model 3.5 / OpenGL ES 3.0), which are not available on the current platform: graphicsShaderLevel (current/required) = {0} / {1}", + SystemInfo.graphicsShaderLevel, + kMinShaderLevel); +#if UNITY_EDITOR + str += "\nPlease change the editor's graphics emulation for a more capable one via \"Edit/Graphics Emulation\" and press Play to force the light beams to be recomputed."; +#endif + return str; + } + } + + static bool ms_IsSupportedChecked = false; + static bool ms_IsSupported = false; + static Texture3D ms_NoiseTexture = null; + + const int kMinShaderLevel = 35; // Shader Model 3.5 / OpenGL ES 3.0 to handle sampler3D -> https://docs.unity3d.com/ScriptReference/SystemInfo-graphicsShaderLevel.html + + [RuntimeInitializeOnLoadMethod] + static void OnStartUp() + { + LoadIfNeeded(); + } + +#if UNITY_EDITOR + public static void _EditorForceReloadData() + { + ms_NoiseTexture = null; + LoadIfNeeded(); + } +#endif + + public static void LoadIfNeeded() + { + if (!isSupported) return; + + if (ms_NoiseTexture == null) + { + ms_NoiseTexture = Config.Instance.noiseTexture3D; + + Shader.SetGlobalTexture(ShaderProperties.GlobalNoiseTex3D, ms_NoiseTexture); + Shader.SetGlobalFloat(ShaderProperties.GlobalNoiseCustomTime, -1.0f); + } + } + } +} \ No newline at end of file diff --git a/Assets/External/VolumetricLightBeam/Scripts/Noise3D.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/Noise3D.cs.meta new file mode 100644 index 00000000..6de3831c --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/Noise3D.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 57abb2ea789b7604eae964ef5c2fdcbb +timeCreated: 1508397352 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/PlatformHelper.cs b/Assets/External/VolumetricLightBeam/Scripts/PlatformHelper.cs new file mode 100644 index 00000000..0c66bdb3 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/PlatformHelper.cs @@ -0,0 +1,107 @@ +using UnityEngine; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace VLB +{ + public class PlatformHelper + { +#if UNITY_EDITOR + static BuildTarget ms_BuildTargetOverride = BuildTarget.NoTarget; + + public static void SetBuildTargetOverride(BuildTarget target) + { + ms_BuildTargetOverride = target; + Config.Instance.RefreshShaders(Config.RefreshShaderFlags.All); + } + + static BuildTarget GetCurrentBuildTarget() + { + if (BuildPipeline.isBuildingPlayer && ms_BuildTargetOverride != BuildTarget.NoTarget) return ms_BuildTargetOverride; + return EditorUserBuildSettings.activeBuildTarget; + } + + static RuntimePlatform BuildTargetToRuntimePlatform(BuildTarget buildTarget) + { +#pragma warning disable 0618 // obsolete BuildTargets + switch (buildTarget) + { + case BuildTarget.Android: return RuntimePlatform.Android; + case BuildTarget.PS4: return RuntimePlatform.PS4; + case BuildTarget.StandaloneLinux64: return RuntimePlatform.LinuxPlayer; + case BuildTarget.StandaloneWindows: return RuntimePlatform.WindowsPlayer; + case BuildTarget.StandaloneWindows64: return RuntimePlatform.WindowsPlayer; + case BuildTarget.WSAPlayer: return RuntimePlatform.WSAPlayerARM; + case BuildTarget.XboxOne: return RuntimePlatform.XboxOne; + case BuildTarget.iOS: return RuntimePlatform.IPhonePlayer; + case BuildTarget.tvOS: return RuntimePlatform.tvOS; + case BuildTarget.WebGL: return RuntimePlatform.WebGLPlayer; + +#if UNITY_2017_1_OR_NEWER + case BuildTarget.Switch: return RuntimePlatform.Switch; +#endif + +#if UNITY_2017_3_OR_NEWER + case BuildTarget.StandaloneOSX: return RuntimePlatform.OSXPlayer; +#else + case BuildTarget.StandaloneOSXUniversal:return RuntimePlatform.OSXPlayer; +#endif + +#if UNITY_2019_3_OR_NEWER + case BuildTarget.Stadia: return RuntimePlatform.Stadia; +#endif + +#if UNITY_2020_2_OR_NEWER + case BuildTarget.CloudRendering: return RuntimePlatform.CloudRendering; +#endif + +#if UNITY_2021_1_OR_NEWER + case BuildTarget.GameCoreScarlett: return RuntimePlatform.GameCoreScarlett; + case BuildTarget.GameCoreXboxOne: return RuntimePlatform.GameCoreXboxOne; + case BuildTarget.PS5: return RuntimePlatform.PS5; +#endif + + // obsolete + case BuildTarget.StandaloneOSXIntel: return RuntimePlatform.OSXPlayer; + case BuildTarget.StandaloneOSXIntel64: return RuntimePlatform.OSXPlayer; + case BuildTarget.StandaloneLinuxUniversal:return RuntimePlatform.LinuxPlayer; + case BuildTarget.WiiU: return RuntimePlatform.WiiU; + case BuildTarget.PSP2: return RuntimePlatform.PSP2; + case BuildTarget.PS3: return RuntimePlatform.PS3; + case BuildTarget.XBOX360: return RuntimePlatform.XBOX360; + + default: return (RuntimePlatform)(-1); + } +#pragma warning restore 0618 + } + + public static bool IsValidPlatformSuffix(string suffix) + { + if (string.IsNullOrEmpty(suffix)) + return true; + + foreach (var platform in System.Enum.GetNames(typeof(RuntimePlatform))) + { + if (suffix == platform) + return true; + } + return false; + } +#endif // UNITY_EDITOR + + public static string GetCurrentPlatformSuffix() + { +#if UNITY_EDITOR + return GetPlatformSuffix(BuildTargetToRuntimePlatform(GetCurrentBuildTarget())); +#else + return GetPlatformSuffix(Application.platform); +#endif + } + + static string GetPlatformSuffix(RuntimePlatform platform) + { + return platform.ToString(); + } + } +} \ No newline at end of file diff --git a/Assets/External/VolumetricLightBeam/Scripts/PlatformHelper.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/PlatformHelper.cs.meta new file mode 100644 index 00000000..cae92d50 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/PlatformHelper.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 30abcef3cbaaee1408d5966265dc731b +timeCreated: 1612121684 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/PolygonHelper.cs b/Assets/External/VolumetricLightBeam/Scripts/PolygonHelper.cs new file mode 100644 index 00000000..c9fcf52a --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/PolygonHelper.cs @@ -0,0 +1,84 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace VLB +{ + public class PolygonHelper : MonoBehaviour + { + public struct Plane2D + { + public Vector2 normal; + public float distance; + + public float Distance(Vector2 point) { return Vector2.Dot(normal, point) + distance; } + + public Vector2 ClosestPoint(Vector2 pt) { return pt - normal * Distance(pt); } + + public Vector2 Intersect(Vector2 p1, Vector2 p2) + { + float denominator = Vector2.Dot(normal, p1 - p2); + + if (Utils.IsAlmostZero(denominator)) + return (p1 + p2) * 0.5f; + + float u = (normal.x * p1.x + normal.y * p1.y + distance) / denominator; + return (p1 + u * (p2 - p1)); + } + + public bool GetSide(Vector2 point) { return Distance(point) > 0.0f; } + + public static Plane2D FromPoints(Vector3 p1, Vector3 p2) + { + var v = (p2 - p1).normalized; + + return new Plane2D + { + normal = new Vector2(v.y, -v.x), + distance = (-v.y * p1.x + v.x * p1.y) + }; + } + + public static Plane2D FromNormalAndPoint(Vector3 normalizedNormal, Vector3 p1) + { + return new Plane2D + { + normal = normalizedNormal, + distance = (-normalizedNormal.x * p1.x - normalizedNormal.y * p1.y) + }; + } + + public void Flip() { normal = -normal; distance = -distance; } + + public Vector2[] CutConvex(Vector2[] poly) + { + Debug.Assert(poly.Length >= 3); + var polyOut = new List(poly.Length); + + Vector2 startingPoint = poly[poly.Length - 1]; + foreach (var endPoint in poly) + { + var startingSide = GetSide(startingPoint); + var endSide = GetSide(endPoint); + if (startingSide && endSide) + { + polyOut.Add(endPoint); + } + else if (startingSide && !endSide) + { + polyOut.Add(Intersect(startingPoint, endPoint)); + } + else if (!startingSide && endSide) + { + polyOut.Add(Intersect(startingPoint, endPoint)); + polyOut.Add(endPoint); + } + startingPoint = endPoint; + } + + return polyOut.ToArray(); + } + + public override string ToString() { return string.Format("{0} x {1} + {2}", normal.x, normal.y, distance); } + } + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/PolygonHelper.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/PolygonHelper.cs.meta new file mode 100644 index 00000000..a27fd3fd --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/PolygonHelper.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7b55955c734a6a04db43faaa6390235a +timeCreated: 1596631375 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/SD.meta b/Assets/External/VolumetricLightBeam/Scripts/SD.meta new file mode 100644 index 00000000..e613cfad --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SD.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4971b1491b54ae042b77f5bea641a9f0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/SD/BeamGeometrySD.cs b/Assets/External/VolumetricLightBeam/Scripts/SD/BeamGeometrySD.cs new file mode 100644 index 00000000..7f7f55dc --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SD/BeamGeometrySD.cs @@ -0,0 +1,621 @@ +#if DEBUG +//#define DEBUG_SHOW_MESH_NORMALS +#endif +#define FORCE_CURRENT_CAMERA_DEPTH_TEXTURE_MODE + +#if UNITY_2018_1_OR_NEWER +#define VLB_SRP_SUPPORT // Comment this to disable SRP support +#endif + +using UnityEngine; +using System.Collections; + +#pragma warning disable 0429, 0162 // Unreachable expression code detected (because of Noise3D.isSupported on mobile) + +namespace VLB +{ + [AddComponentMenu("")] // hide it from Component search + [ExecuteInEditMode] + [HelpURL(Consts.Help.SD.UrlBeam)] + public class BeamGeometrySD : BeamGeometryAbstractBase, MaterialModifier.Interface + { + VolumetricLightBeamSD m_Master = null; + MeshType m_CurrentMeshType = MeshType.Shared; + MaterialModifier.Callback m_MaterialModifierCallback = null; + Coroutine m_CoFadeOut = null; + + protected override VolumetricLightBeamAbstractBase GetMaster() { return m_Master; } + + bool visible + { + get { return meshRenderer.enabled; } + set { meshRenderer.enabled = value; } + } + + public int sortingLayerID + { + get { return meshRenderer.sortingLayerID; } + set { meshRenderer.sortingLayerID = value; } + } + + public int sortingOrder + { + get { return meshRenderer.sortingOrder; } + set { meshRenderer.sortingOrder = value; } + } + + public bool _INTERNAL_IsFadeOutCoroutineRunning { get { return m_CoFadeOut != null; } } + + float ComputeFadeOutFactor(Transform camTransform) + { + if (m_Master.isFadeOutEnabled) + { + float distanceCamToBeam = Vector3.SqrMagnitude(meshRenderer.bounds.center - camTransform.position); + return Mathf.InverseLerp(m_Master.fadeOutEnd * m_Master.fadeOutEnd, m_Master.fadeOutBegin * m_Master.fadeOutBegin, distanceCamToBeam); + } + else + { + return 1.0f; + } + } + + IEnumerator CoUpdateFadeOut() + { + while (m_Master.isFadeOutEnabled) + { + ComputeFadeOutFactor(); + yield return null; + } + + SetFadeOutFactorProp(1.0f); + m_CoFadeOut = null; + } + + void ComputeFadeOutFactor() + { + var camTransform = Config.Instance.fadeOutCameraTransform; + if (camTransform) + { + float fadeOutFactor = ComputeFadeOutFactor(camTransform); + SetFadeOutFactorProp(fadeOutFactor); + } + else + { + SetFadeOutFactorProp(1.0f); + } + } + + void SetFadeOutFactorProp(float value) + { + if (value > 0) + { + meshRenderer.enabled = true; + + MaterialChangeStart(); + SetMaterialProp(ShaderProperties.SD.FadeOutFactor, value); + MaterialChangeStop(); + } + else + { + meshRenderer.enabled = false; + } + } + + void StopFadeOutCoroutine() + { + if (m_CoFadeOut != null) + { + StopCoroutine(m_CoFadeOut); + m_CoFadeOut = null; + } + } + + public void RestartFadeOutCoroutine() + { + #if UNITY_EDITOR + if (Application.isPlaying) + #endif + { + StopFadeOutCoroutine(); + + if (m_Master && m_Master.isFadeOutEnabled) + { + m_CoFadeOut = StartCoroutine(CoUpdateFadeOut()); + } + } + } + + public void OnMasterEnable() + { + visible = true; + RestartFadeOutCoroutine(); + } + + public void OnMasterDisable() + { + StopFadeOutCoroutine(); + visible = false; + } + +#if VLB_SRP_SUPPORT + Camera m_CurrentCameraRenderingSRP = null; + + void OnDisable() + { + SRPHelper.UnregisterOnBeginCameraRendering(OnBeginCameraRenderingSRP); + m_CurrentCameraRenderingSRP = null; + } + + public static bool isCustomRenderPipelineSupported { get { return true; } } +#else + public static bool isCustomRenderPipelineSupported { get { return false; } } +#endif + + bool shouldUseGPUInstancedMaterial + { get { + return m_Master._INTERNAL_DynamicOcclusionMode != MaterialManager.SD.DynamicOcclusion.DepthTexture // sampler cannot be passed to shader as instanced property + && Config.Instance.GetActualRenderingMode(ShaderMode.SD) == RenderingMode.GPUInstancing; + }} + + void OnEnable() + { + // When a GAO is disabled, all its coroutines are killed, so renable them on OnEnable. + RestartFadeOutCoroutine(); + +#if VLB_SRP_SUPPORT + SRPHelper.RegisterOnBeginCameraRendering(OnBeginCameraRenderingSRP); +#endif + } + + public void Initialize(VolumetricLightBeamSD master) + { + Debug.Assert(master != null); + + var customHideFlags = Consts.Internal.ProceduralObjectsHideFlags; + m_Master = master; + + transform.SetParent(master.transform, false); + + meshRenderer = gameObject.GetOrAddComponent(); + meshRenderer.hideFlags = customHideFlags; + meshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; + meshRenderer.receiveShadows = false; + meshRenderer.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off; // different reflection probes could break batching with GPU Instancing + meshRenderer.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off; + + if (!shouldUseGPUInstancedMaterial) + { + m_CustomMaterial = Config.Instance.NewMaterialTransient(ShaderMode.SD, gpuInstanced:false); + ApplyMaterial(); + } + + if (SortingLayer.IsValid(m_Master.sortingLayerID)) + sortingLayerID = m_Master.sortingLayerID; + else + Debug.LogError(string.Format("Beam '{0}' has an invalid sortingLayerID ({1}). Please fix it by setting a valid layer.", Utils.GetPath(m_Master.transform), m_Master.sortingLayerID)); + + sortingOrder = m_Master.sortingOrder; + + meshFilter = gameObject.GetOrAddComponent(); + meshFilter.hideFlags = customHideFlags; + + gameObject.hideFlags = customHideFlags; + +#if UNITY_EDITOR + UnityEditor.GameObjectUtility.SetStaticEditorFlags(gameObject, master.GetStaticEditorFlagsForSubObjects()); + gameObject.SetSameSceneVisibilityStatesThan(master.gameObject); +#endif + + RestartFadeOutCoroutine(); + } + + /// + /// Generate the cone mesh and calls UpdateMaterialAndBounds. + /// Since this process involves recreating a new mesh, make sure to not call it at every frame during playtime. + /// + public void RegenerateMesh(bool masterEnabled) + { + Debug.Assert(m_Master); + + if (Config.Instance.geometryOverrideLayer) + gameObject.layer = Config.Instance.geometryLayerID; + else + gameObject.layer = m_Master.gameObject.layer; + + gameObject.tag = Config.Instance.geometryTag; + + if (coneMesh && m_CurrentMeshType == MeshType.Custom) + { + DestroyImmediate(coneMesh); + } + + m_CurrentMeshType = m_Master.geomMeshType; + + switch (m_Master.geomMeshType) + { + case MeshType.Custom: + { + coneMesh = MeshGenerator.GenerateConeZ_Radii(1f, 1f, 1f, m_Master.geomCustomSides, m_Master.geomCustomSegments, m_Master.geomCap, Config.Instance.SD_requiresDoubleSidedMesh); + coneMesh.hideFlags = Consts.Internal.ProceduralObjectsHideFlags; + meshFilter.mesh = coneMesh; + break; + } + case MeshType.Shared: + { + coneMesh = GlobalMeshSD.Get(); + meshFilter.sharedMesh = coneMesh; + break; + } + default: + { + Debug.LogError("Unsupported MeshType"); + break; + } + } + + UpdateMaterialAndBounds(); + + visible = masterEnabled; + } + + Vector3 ComputeLocalMatrix() + { + // In the VS, we compute the vertices so the whole beam fits into a fixed 2x2x1 box. + // We have to apply some scaling to get the proper beam size. + // This way we have the proper bounds without having to recompute specific bounds foreach beam. + var maxRadius = Mathf.Max(m_Master.coneRadiusStart, m_Master.coneRadiusEnd); + transform.localScale = new Vector3(maxRadius, maxRadius, m_Master.maxGeometryDistance); + transform.localRotation = m_Master.beamInternalLocalRotation; + + return transform.localScale; + } + + bool isNoiseEnabled { get { return m_Master.isNoiseEnabled && m_Master.noiseIntensity > 0f && Noise3D.isSupported; } } // test Noise3D.isSupported the last + +#pragma warning disable 0162 + bool isDepthBlendEnabled { get { return BatchingHelper.forceEnableDepthBlend || m_Master.depthBlendDistance > 0f; } } +#pragma warning restore 0162 + + MaterialManager.StaticPropertiesSD ComputeMaterialStaticProperties() + { + var colorGradient = MaterialManager.ColorGradient.Off; + if (m_Master.colorMode == ColorMode.Gradient) + { + var precision = Utils.GetFloatPackingPrecision(); + colorGradient = precision == Utils.FloatPackingPrecision.High ? MaterialManager.ColorGradient.MatrixHigh : MaterialManager.ColorGradient.MatrixLow; + } + + Debug.Assert((int)BlendingMode.Additive == (int)MaterialManager.BlendingMode.Additive); + Debug.Assert((int)BlendingMode.SoftAdditive == (int)MaterialManager.BlendingMode.SoftAdditive); + Debug.Assert((int)BlendingMode.TraditionalTransparency == (int)MaterialManager.BlendingMode.TraditionalTransparency); + + return new MaterialManager.StaticPropertiesSD + { + blendingMode = (MaterialManager.BlendingMode)m_Master.blendingMode, + noise3D = isNoiseEnabled ? MaterialManager.Noise3D.On : MaterialManager.Noise3D.Off, + depthBlend = isDepthBlendEnabled ? MaterialManager.SD.DepthBlend.On : MaterialManager.SD.DepthBlend.Off, + colorGradient = colorGradient, + dynamicOcclusion = m_Master._INTERNAL_DynamicOcclusionMode_Runtime, + meshSkewing = m_Master.hasMeshSkewing ? MaterialManager.SD.MeshSkewing.On : MaterialManager.SD.MeshSkewing.Off, + shaderAccuracy = (m_Master.shaderAccuracy == ShaderAccuracy.Fast) ? MaterialManager.SD.ShaderAccuracy.Fast : MaterialManager.SD.ShaderAccuracy.High + }; + } + + bool ApplyMaterial() + { + var staticProps = ComputeMaterialStaticProperties(); + + Material mat = null; + if (!shouldUseGPUInstancedMaterial) + { + mat = m_CustomMaterial; + if(mat) + staticProps.ApplyToMaterial(mat); + } + else + { + mat = MaterialManager.GetInstancedMaterial(m_Master._INTERNAL_InstancedMaterialGroupID, ref staticProps); + } + + meshRenderer.material = mat; + return mat != null; + } + + public void SetMaterialProp(int nameID, float value) + { + if (m_CustomMaterial) + m_CustomMaterial.SetFloat(nameID, value); + else + MaterialManager.materialPropertyBlock.SetFloat(nameID, value); + } + + public void SetMaterialProp(int nameID, Vector4 value) + { + if (m_CustomMaterial) + m_CustomMaterial.SetVector(nameID, value); + else + MaterialManager.materialPropertyBlock.SetVector(nameID, value); + } + + public void SetMaterialProp(int nameID, Color value) + { + if (m_CustomMaterial) + m_CustomMaterial.SetColor(nameID, value); + else + MaterialManager.materialPropertyBlock.SetColor(nameID, value); + } + + public void SetMaterialProp(int nameID, Matrix4x4 value) + { + if (m_CustomMaterial) + m_CustomMaterial.SetMatrix(nameID, value); + else + MaterialManager.materialPropertyBlock.SetMatrix(nameID, value); + } + + public void SetMaterialProp(int nameID, Texture value) + { + if (m_CustomMaterial) + m_CustomMaterial.SetTexture(nameID, value); + else + Debug.LogError("Setting a Texture property to a GPU instanced material is not supported"); + } + + void MaterialChangeStart() + { + if (m_CustomMaterial == null) + meshRenderer.GetPropertyBlock(MaterialManager.materialPropertyBlock); + } + + void MaterialChangeStop() + { + if (m_CustomMaterial == null) + meshRenderer.SetPropertyBlock(MaterialManager.materialPropertyBlock); + } + + public void SetDynamicOcclusionCallback(string shaderKeyword, MaterialModifier.Callback cb) + { + m_MaterialModifierCallback = cb; + + if (m_CustomMaterial) + { + m_CustomMaterial.SetKeywordEnabled(shaderKeyword, cb != null); + + if (cb != null) + cb(this); + } + else + UpdateMaterialAndBounds(); + } + + public void UpdateMaterialAndBounds() + { + Debug.Assert(m_Master); + + if (ApplyMaterial() == false) + { + return; + } + + MaterialChangeStart(); + { + if (m_CustomMaterial == null) + { + if(m_MaterialModifierCallback != null) + m_MaterialModifierCallback(this); + } + + float slopeRad = (m_Master.coneAngle * Mathf.Deg2Rad) / 2; // use coneAngle (instead of spotAngle) which is more correct with the geometry + SetMaterialProp(ShaderProperties.SD.ConeSlopeCosSin, new Vector2(Mathf.Cos(slopeRad), Mathf.Sin(slopeRad))); + + // kMinRadius and kMinApexOffset prevents artifacts when fresnel computation is done in the vertex shader + const float kMinRadius = 0.0001f; + var coneRadius = new Vector2(Mathf.Max(m_Master.coneRadiusStart, kMinRadius), Mathf.Max(m_Master.coneRadiusEnd, kMinRadius)); + SetMaterialProp(ShaderProperties.ConeRadius, coneRadius); + + const float kMinApexOffset = 0.0001f; + float nonNullApex = Mathf.Sign(m_Master.coneApexOffsetZ) * Mathf.Max(Mathf.Abs(m_Master.coneApexOffsetZ), kMinApexOffset); + SetMaterialProp(ShaderProperties.ConeGeomProps, new Vector2(nonNullApex, m_Master.geomSides)); + + if (m_Master.usedColorMode == ColorMode.Flat) + { + SetMaterialProp(ShaderProperties.ColorFlat, m_Master.color); + } + else + { + var precision = Utils.GetFloatPackingPrecision(); + m_ColorGradientMatrix = m_Master.colorGradient.SampleInMatrix((int)precision); + // pass the gradient matrix in OnWillRenderObject() + } + + float intensityInside, intensityOutside; + m_Master.GetInsideAndOutsideIntensity(out intensityInside, out intensityOutside); + SetMaterialProp(ShaderProperties.SD.AlphaInside, intensityInside); + SetMaterialProp(ShaderProperties.SD.AlphaOutside, intensityOutside); + SetMaterialProp(ShaderProperties.SD.AttenuationLerpLinearQuad, m_Master.attenuationLerpLinearQuad); + SetMaterialProp(ShaderProperties.DistanceFallOff, new Vector3(m_Master.fallOffStart, m_Master.fallOffEnd, m_Master.maxGeometryDistance)); + SetMaterialProp(ShaderProperties.SD.DistanceCamClipping, m_Master.cameraClippingDistance); + SetMaterialProp(ShaderProperties.SD.FresnelPow, Mathf.Max(0.001f, m_Master.fresnelPow)); // no pow 0, otherwise will generate inf fresnel and issues on iOS + SetMaterialProp(ShaderProperties.SD.GlareBehind, m_Master.glareBehind); + SetMaterialProp(ShaderProperties.SD.GlareFrontal, m_Master.glareFrontal); + SetMaterialProp(ShaderProperties.SD.DrawCap, m_Master.geomCap ? 1 : 0); + SetMaterialProp(ShaderProperties.SD.TiltVector, m_Master.tiltFactor); + SetMaterialProp(ShaderProperties.SD.AdditionalClippingPlaneWS, m_Master.additionalClippingPlane); + + if (Config.Instance.isHDRPExposureWeightSupported) + { + SetMaterialProp(ShaderProperties.HDRPExposureWeight, m_Master.hdrpExposureWeight); + } + + if (isDepthBlendEnabled) + { + SetMaterialProp(ShaderProperties.SD.DepthBlendDistance, m_Master.depthBlendDistance); + } + + if (isNoiseEnabled) + { + Noise3D.LoadIfNeeded(); + + var noiseVelocity = m_Master.noiseVelocityUseGlobal ? Config.Instance.globalNoiseVelocity : m_Master.noiseVelocityLocal; + var noiseScale = m_Master.noiseScaleUseGlobal ? Config.Instance.globalNoiseScale : m_Master.noiseScaleLocal; + + SetMaterialProp(ShaderProperties.NoiseVelocityAndScale, new Vector4( + noiseVelocity.x, + noiseVelocity.y, + noiseVelocity.z, + noiseScale)); + + SetMaterialProp(ShaderProperties.NoiseParam, new Vector2( + m_Master.noiseIntensity, + m_Master.noiseMode == NoiseMode.WorldSpace ? 0f : 1f)); + } + + var localScale = ComputeLocalMatrix(); // compute matrix before sending it to the shader + + if (m_Master.hasMeshSkewing) + { + var localForwardDirectionNormalized = m_Master.skewingLocalForwardDirectionNormalized; + SetMaterialProp(ShaderProperties.SD.LocalForwardDirection, localForwardDirectionNormalized); + + if (coneMesh != null) // coneMesh can be null few frames with Dynamic Occlusion & GPU Instancing + { + var localForwardDirectionN = localForwardDirectionNormalized; + localForwardDirectionN /= localForwardDirectionN.z; + localForwardDirectionN *= m_Master.fallOffEnd; + localForwardDirectionN.x /= localScale.x; + localForwardDirectionN.y /= localScale.y; + + var bounds = MeshGenerator.ComputeBounds(1f, 1f, 1f); + var min = bounds.min; + var max = bounds.max; + + if (localForwardDirectionN.x > 0.0f) max.x += localForwardDirectionN.x; + else min.x += localForwardDirectionN.x; + + if (localForwardDirectionN.y > 0.0f) max.y += localForwardDirectionN.y; + else min.y += localForwardDirectionN.y; + + bounds.min = min; + bounds.max = max; + coneMesh.bounds = bounds; + } + } + +#if VLB_SRP_SUPPORT + // This update is to make QA test 'ReflectionObliqueProjection' pass + UpdateMatricesPropertiesForGPUInstancingSRP(); +#endif + } + MaterialChangeStop(); + +#if DEBUG_SHOW_MESH_NORMALS + for (int vertexInd = 0; vertexInd < coneMesh.vertexCount; vertexInd++) + { + var vertex = coneMesh.vertices[vertexInd]; + + // apply modification done inside VS + vertex.x *= Mathf.Lerp(coneRadius.x, coneRadius.y, vertex.z); + vertex.y *= Mathf.Lerp(coneRadius.x, coneRadius.y, vertex.z); + vertex.z *= m_Master.fallOffEnd; + + var cosSinFlat = new Vector2(vertex.x, vertex.y).normalized; + var normal = new Vector3(cosSinFlat.x * Mathf.Cos(slopeRad), cosSinFlat.y * Mathf.Cos(slopeRad), -Mathf.Sin(slopeRad)).normalized; + + vertex = transform.TransformPoint(vertex); + normal = transform.TransformDirection(normal); + Debug.DrawRay(vertex, normal * 0.25f); + } +#endif + } + +#if VLB_SRP_SUPPORT + void UpdateMatricesPropertiesForGPUInstancingSRP() + { + if (SRPHelper.IsUsingCustomRenderPipeline() && Config.Instance.GetActualRenderingMode(ShaderMode.SD) == RenderingMode.GPUInstancing) + { + SetMaterialProp(ShaderProperties.LocalToWorldMatrix, transform.localToWorldMatrix); + SetMaterialProp(ShaderProperties.WorldToLocalMatrix, transform.worldToLocalMatrix); + } + } + + #if UNITY_2019_1_OR_NEWER + void OnBeginCameraRenderingSRP(UnityEngine.Rendering.ScriptableRenderContext context, Camera cam) + #else + void OnBeginCameraRenderingSRP(Camera cam) + #endif + { + m_CurrentCameraRenderingSRP = cam; + } +#endif + + void OnWillRenderObject() + { + Camera currentCam = null; + +#if VLB_SRP_SUPPORT + if (SRPHelper.IsUsingCustomRenderPipeline()) + { + currentCam = m_CurrentCameraRenderingSRP; + } + else +#endif + { + currentCam = Camera.current; + } + + OnWillCameraRenderThisBeam(currentCam); + } + + void OnWillCameraRenderThisBeam(Camera cam) + { + if (m_Master && cam) + { + if ( +#if UNITY_EDITOR + Utils.IsEditorCamera(cam) || // make sure to call UpdateCameraRelatedProperties for editor scene camera +#endif + cam.enabled) // prevent from doing stuff when we render from a previous DynamicOcclusionDepthBuffer's DepthCamera, because the DepthCamera are disabled + { + UpdateCameraRelatedProperties(cam); + m_Master._INTERNAL_OnWillCameraRenderThisBeam(cam); + } + } + } + + void UpdateCameraRelatedProperties(Camera cam) + { + if (cam && m_Master) + { + MaterialChangeStart(); + { + var camPosOS = m_Master.transform.InverseTransformPoint(cam.transform.position); + + var camForwardVectorOSN = transform.InverseTransformDirection(cam.transform.forward).normalized; + float camIsInsideBeamFactor = cam.orthographic ? -1f : m_Master.GetInsideBeamFactorFromObjectSpacePos(camPosOS); + SetMaterialProp(ShaderProperties.SD.CameraParams, new Vector4(camForwardVectorOSN.x, camForwardVectorOSN.y, camForwardVectorOSN.z, camIsInsideBeamFactor)); + +#if VLB_SRP_SUPPORT + // This update is to be able to move beams without trackChangesDuringPlaytime enabled with SRP & GPU Instancing + UpdateMatricesPropertiesForGPUInstancingSRP(); +#endif + + if (m_Master.usedColorMode == ColorMode.Gradient) + { + // Send the gradient matrix every frame since it's not a shader's property + SetMaterialProp(ShaderProperties.ColorGradientMatrix, m_ColorGradientMatrix); + } + } + MaterialChangeStop(); + +#if FORCE_CURRENT_CAMERA_DEPTH_TEXTURE_MODE + if (m_Master.depthBlendDistance > 0f) + cam.depthTextureMode |= DepthTextureMode.Depth; +#endif + } + } + +#if UNITY_EDITOR + public int _EDITOR_InstancedMaterialID { get { return ComputeMaterialStaticProperties().GetMaterialID(); } } +#endif + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/SD/BeamGeometrySD.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/SD/BeamGeometrySD.cs.meta new file mode 100644 index 00000000..075c31b4 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SD/BeamGeometrySD.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 50a48a2b69575db4c8b5bf5aa8186d89 +timeCreated: 1504793414 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionAbstractBase.cs b/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionAbstractBase.cs new file mode 100644 index 00000000..5f6dedd8 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionAbstractBase.cs @@ -0,0 +1,185 @@ +using UnityEngine; +using UnityEngine.Serialization; + +namespace VLB +{ + [AddComponentMenu("")] // hide it from Component search + [DisallowMultipleComponent] + [RequireComponent(typeof(VolumetricLightBeamSD))] + public abstract class DynamicOcclusionAbstractBase : MonoBehaviour + { + public const string ClassName = "DynamicOcclusionAbstractBase"; + + /// + /// How often will the occlusion be processed? + /// Try to update the occlusion as rarely as possible to keep good performance. + /// + public DynamicOcclusionUpdateRate updateRate = Consts.DynOcclusion.UpdateRateDefault; + + /// + /// How many frames we wait between 2 occlusion tests? + /// If you want your beam to be super responsive to the changes of your environment, update it every frame by setting 1. + /// If you want to save on performance, we recommend to wait few frames between each update by setting a higher value. + /// + [FormerlySerializedAs("waitFrameCount")] + public int waitXFrames = Consts.DynOcclusion.WaitFramesCountDefault; + + /// + /// Manually process the occlusion. + /// You have to call this function in order to update the occlusion when using DynamicOcclusionUpdateRate.Never. + /// + public void ProcessOcclusionManually() { ProcessOcclusion(ProcessOcclusionSource.User); } + + public event System.Action onOcclusionProcessed; + + public static bool _INTERNAL_ApplyRandomFrameOffset = true; + + + protected enum ProcessOcclusionSource + { + RenderLoop, + OnEnable, + EditorUpdate, + User, + } + + protected void ProcessOcclusion(ProcessOcclusionSource source) + { + if (!Config.Instance.featureEnabledDynamicOcclusion) + return; + + if (m_LastFrameRendered == Time.frameCount && Application.isPlaying && source == ProcessOcclusionSource.OnEnable) + return; // allow to call ProcessOcclusion from OnEnable (when disabling/enabling multiple a beam on the same frame) without generating an error + + Debug.Assert(!Application.isPlaying || m_LastFrameRendered != Time.frameCount, "ProcessOcclusion has been called twice on the same frame, which is forbidden"); + Debug.Assert(m_Master); + + bool occlusionSuccess = OnProcessOcclusion(source); + + if(onOcclusionProcessed != null) + onOcclusionProcessed(); + + if (m_Master) + { + Debug.Assert(m_MaterialModifierCallbackCached != null); + m_Master._INTERNAL_SetDynamicOcclusionCallback(GetShaderKeyword(), occlusionSuccess ? m_MaterialModifierCallbackCached : (MaterialModifier.Callback)(null)); + } + + if (updateRate.HasFlag(DynamicOcclusionUpdateRate.OnBeamMove)) + m_TransformPacked = transform.GetWorldPacked(); + + bool firstTime = m_LastFrameRendered < 0; + m_LastFrameRendered = Time.frameCount; + + if (firstTime && _INTERNAL_ApplyRandomFrameOffset) + { + m_LastFrameRendered += Random.Range(0, waitXFrames); // add a random offset to prevent from updating texture for all beams having the same wait value + } + } + + TransformUtils.Packed m_TransformPacked; + int m_LastFrameRendered = int.MinValue; + public int _INTERNAL_LastFrameRendered { get { return m_LastFrameRendered; } } // for unit tests + protected VolumetricLightBeamSD m_Master = null; + protected MaterialModifier.Callback m_MaterialModifierCallbackCached = null; + + protected abstract string GetShaderKeyword(); + protected abstract MaterialManager.SD.DynamicOcclusion GetDynamicOcclusionMode(); + + protected abstract bool OnProcessOcclusion(ProcessOcclusionSource source); + protected abstract void OnModifyMaterialCallback(MaterialModifier.Interface owner); + protected abstract void OnEnablePostValidate(); + + + protected virtual void OnValidateProperties() + { + waitXFrames = Mathf.Clamp(waitXFrames, 1, 60); + } + + protected virtual void Awake() + { + m_Master = GetComponent(); + Debug.Assert(m_Master); + + m_Master._INTERNAL_DynamicOcclusionMode = GetDynamicOcclusionMode(); + } + + protected virtual void OnDestroy() + { + m_Master._INTERNAL_DynamicOcclusionMode = MaterialManager.SD.DynamicOcclusion.Off; + DisableOcclusion(); + } + + protected virtual void OnEnable() + { + // cache the delegate to prevent from being inlined as '() => OnModifyMaterialCallback' when calling _INTERNAL_SetDynamicOcclusionCallback and from generating GC garbage + m_MaterialModifierCallbackCached = OnModifyMaterialCallback; + + OnValidateProperties(); + + OnEnablePostValidate(); + +#if UNITY_EDITOR + if (Application.isPlaying) +#endif + { + m_Master.onWillCameraRenderThisBeam += OnWillCameraRender; + + if (!updateRate.HasFlag(DynamicOcclusionUpdateRate.Never)) + m_Master.RegisterOnBeamGeometryInitializedCallback(() => ProcessOcclusion(ProcessOcclusionSource.OnEnable)); + } + } + + protected virtual void OnDisable() + { +#if UNITY_EDITOR + if (Application.isPlaying) +#endif + { + m_Master.onWillCameraRenderThisBeam -= OnWillCameraRender; + } + + DisableOcclusion(); + } + +#if UNITY_EDITOR + protected virtual void OnValidate() + { + OnValidateProperties(); + } +#endif + + + void OnWillCameraRender(Camera cam) + { + Debug.Assert(Application.isPlaying); + + if (cam != null && cam.enabled + && Time.frameCount != m_LastFrameRendered) // prevent from updating multiple times if there are more than 1 camera + { + bool shouldUpdate = false; + + if (!shouldUpdate && updateRate.HasFlag(DynamicOcclusionUpdateRate.OnBeamMove)) + { + if (!m_TransformPacked.IsSame(transform)) + shouldUpdate = true; + } + + if (!shouldUpdate && updateRate.HasFlag(DynamicOcclusionUpdateRate.EveryXFrames)) + { + if (Time.frameCount >= m_LastFrameRendered + waitXFrames) + shouldUpdate = true; + } + + if (shouldUpdate) + ProcessOcclusion(ProcessOcclusionSource.RenderLoop); + } + } + + void DisableOcclusion() + { + m_Master._INTERNAL_SetDynamicOcclusionCallback(GetShaderKeyword(), null); + } + } +} + diff --git a/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionAbstractBase.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionAbstractBase.cs.meta new file mode 100644 index 00000000..bb82020a --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionAbstractBase.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c87e171f8942d184e958eba76fd39108 +timeCreated: 1510650372 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionDepthBuffer.cs b/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionDepthBuffer.cs new file mode 100644 index 00000000..c8511c4b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionDepthBuffer.cs @@ -0,0 +1,225 @@ +using UnityEngine; +using System.Collections; + +namespace VLB +{ + [ExecuteInEditMode] + [HelpURL(Consts.Help.SD.UrlDynamicOcclusionDepthBuffer)] + public class DynamicOcclusionDepthBuffer : DynamicOcclusionAbstractBase + { + public new const string ClassName = "DynamicOcclusionDepthBuffer"; + + /// + /// The beam can only be occluded by objects located on the layers matching this mask. + /// It's very important to set it as restrictive as possible (checking only the layers which are necessary) + /// to perform a more efficient process in order to increase the performance. + /// It should NOT include the layer on which the beams are generated. + /// + public LayerMask layerMask = Consts.DynOcclusion.LayerMaskDefault; + + /// + /// Whether or not the virtual camera will use occlusion culling during rendering from the beam's POV. + /// + public bool useOcclusionCulling = Consts.DynOcclusion.DepthBufferOcclusionCullingDefault; + + /// + /// Controls how large the depth texture captured by the virtual camera is. + /// The lower the resolution, the better the performance, but the less accurate the rendering. + /// + public int depthMapResolution = Consts.DynOcclusion.DepthBufferDepthMapResolutionDefault; + + /// + /// Fade out the beam before the occlusion surface in order to soften the transition. + /// + public float fadeDistanceToSurface = Consts.DynOcclusion.DepthBufferFadeDistanceToSurfaceDefault; + + + protected override string GetShaderKeyword() { return ShaderKeywords.SD.OcclusionDepthTexture; } + protected override MaterialManager.SD.DynamicOcclusion GetDynamicOcclusionMode() { return MaterialManager.SD.DynamicOcclusion.DepthTexture; } + + Camera m_DepthCamera = null; + bool m_NeedToUpdateOcclusionNextFrame = false; + + void ProcessOcclusionInternal() + { + UpdateDepthCameraPropertiesAccordingToBeam(); + m_DepthCamera.Render(); + } + + protected override bool OnProcessOcclusion(ProcessOcclusionSource source) + { + Debug.Assert(m_Master && m_DepthCamera); + + if (SRPHelper.IsUsingCustomRenderPipeline()) // Recursive rendering is not supported on SRP + m_NeedToUpdateOcclusionNextFrame = true; + else + ProcessOcclusionInternal(); + + return true; + } + + void Update() + { + if (m_NeedToUpdateOcclusionNextFrame && m_Master && m_DepthCamera + && Time.frameCount > 1) // fix NullReferenceException in UnityEngine.Rendering.Universal.Internal.CopyDepthPass.Execute when using SRP + { + ProcessOcclusionInternal(); + m_NeedToUpdateOcclusionNextFrame = false; + } + } + + void UpdateDepthCameraPropertiesAccordingToBeam() + { + Debug.Assert(m_Master); + + Utils.SetupDepthCamera(m_DepthCamera + , m_Master.coneApexOffsetZ, m_Master.maxGeometryDistance, m_Master.coneRadiusStart, m_Master.coneRadiusEnd + , m_Master.beamLocalForward, m_Master.GetLossyScale(), m_Master.IsScalable(), m_Master.beamInternalLocalRotation + , true); + } + + public bool HasLayerMaskIssues() + { + if(Config.Instance.geometryOverrideLayer) + { + int layerBit = 1 << Config.Instance.geometryLayerID; + return ((layerMask.value & layerBit) == layerBit); + } + return false; + } + + protected override void OnValidateProperties() + { + base.OnValidateProperties(); + depthMapResolution = Mathf.Clamp(Mathf.NextPowerOfTwo(depthMapResolution), 8, 2048); + fadeDistanceToSurface = Mathf.Max(fadeDistanceToSurface, 0f); + } + + void InstantiateOrActivateDepthCamera() + { + if (m_DepthCamera != null) + { + m_DepthCamera.gameObject.SetActive(true); // active it in case it has been disabled by OnDisable() + } + else + { + // delete old depth cameras when duplicating the GAO + gameObject.ForeachComponentsInDirectChildrenOnly(cam => DestroyImmediate(cam.gameObject), true); + + m_DepthCamera = Utils.NewWithComponent("Depth Camera"); + + if (m_DepthCamera && m_Master) + { + m_DepthCamera.enabled = false; + m_DepthCamera.cullingMask = layerMask; + m_DepthCamera.clearFlags = CameraClearFlags.Depth; + m_DepthCamera.depthTextureMode = DepthTextureMode.Depth; + m_DepthCamera.renderingPath = RenderingPath.VertexLit; // faster + m_DepthCamera.useOcclusionCulling = useOcclusionCulling; + m_DepthCamera.gameObject.hideFlags = Consts.Internal.ProceduralObjectsHideFlags; + m_DepthCamera.transform.SetParent(transform, false); + Config.Instance.SetURPScriptableRendererIndexToDepthCamera(m_DepthCamera); + + var rt = new RenderTexture(depthMapResolution, depthMapResolution, 16, RenderTextureFormat.Depth); + m_DepthCamera.targetTexture = rt; + + UpdateDepthCameraPropertiesAccordingToBeam(); + +#if UNITY_EDITOR + UnityEditor.GameObjectUtility.SetStaticEditorFlags(m_DepthCamera.gameObject, m_Master.GetStaticEditorFlagsForSubObjects()); + m_DepthCamera.gameObject.SetSameSceneVisibilityStatesThan(m_Master.gameObject); +#endif + } + } + } + + protected override void OnEnablePostValidate() + { + InstantiateOrActivateDepthCamera(); + } + + protected override void OnDisable() + { + base.OnDisable(); + if (m_DepthCamera) m_DepthCamera.gameObject.SetActive(false); + } + + protected override void Awake() + { + base.Awake(); + +#if UNITY_EDITOR + MarkMaterialAsDirty(); +#endif + } + + protected override void OnDestroy() + { + base.OnDestroy(); + + DestroyDepthCamera(); + +#if UNITY_EDITOR + MarkMaterialAsDirty(); +#endif + } + + void DestroyDepthCamera() + { + if (m_DepthCamera) + { + if (m_DepthCamera.targetTexture) + { + m_DepthCamera.targetTexture.Release(); + DestroyImmediate(m_DepthCamera.targetTexture); + m_DepthCamera.targetTexture = null; + } + + DestroyImmediate(m_DepthCamera.gameObject); // Make sure to delete the GAO + m_DepthCamera = null; + } + } + + protected override void OnModifyMaterialCallback(MaterialModifier.Interface owner) + { + Debug.Assert(owner != null); + owner.SetMaterialProp(ShaderProperties.SD.DynamicOcclusionDepthTexture, m_DepthCamera.targetTexture); + var scale = m_Master.GetLossyScale(); + owner.SetMaterialProp(ShaderProperties.SD.DynamicOcclusionDepthProps, new Vector4(Mathf.Sign(scale.x) * Mathf.Sign(scale.z), Mathf.Sign(scale.y), fadeDistanceToSurface, m_DepthCamera.orthographic ? 0f : 1f)); + } + +#if UNITY_EDITOR + bool m_NeedToReinstantiateDepthCamera = false; + + void MarkMaterialAsDirty() + { + // when adding/removing this component in editor, we might need to switch from a GPU Instanced material to a custom one, + // since this feature doesn't support GPU Instancing + if (!Application.isPlaying) + m_Master._EditorSetBeamGeomDirty(); + } + + protected override void OnValidate() + { + base.OnValidate(); + m_NeedToReinstantiateDepthCamera = true; + } + + void LateUpdate() + { + if (!Application.isPlaying) + { + if (m_NeedToReinstantiateDepthCamera) + { + DestroyDepthCamera(); + InstantiateOrActivateDepthCamera(); + m_NeedToReinstantiateDepthCamera = false; + } + + if(m_Master && m_Master.enabled) + ProcessOcclusion(ProcessOcclusionSource.EditorUpdate); + } + } +#endif // UNITY_EDITOR + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionDepthBuffer.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionDepthBuffer.cs.meta new file mode 100644 index 00000000..3319b26b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionDepthBuffer.cs.meta @@ -0,0 +1,28 @@ +fileFormatVersion: 2 +guid: fdb43fff075aa0b4b995dcfaed06dc44 +labels: +- volumetric +- light +- lighting +- ray +- shaft +- beam +- density +- vr +- dynamic +- spot +- spotlight +- fog +- noise +- occlusion +- procedural +timeCreated: 1577531941 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: f4140fedf3f72d7448a4e55ea9db44ab, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionRaycasting.cs b/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionRaycasting.cs new file mode 100644 index 00000000..00f8705a --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionRaycasting.cs @@ -0,0 +1,472 @@ +#if DEBUG +//#define DEBUG_SHOW_RAYCAST_LINES +#endif + +using UnityEngine; +using UnityEngine.Serialization; + +namespace VLB +{ + [ExecuteInEditMode] + [HelpURL(Consts.Help.SD.UrlDynamicOcclusionRaycasting)] + public class DynamicOcclusionRaycasting : DynamicOcclusionAbstractBase + { + public new const string ClassName = "DynamicOcclusionRaycasting"; + + /// + /// Should it interact with 2D or 3D occluders? + /// + public Dimensions dimensions = Consts.DynOcclusion.RaycastingDimensionsDefault; + + /// + /// The beam can only be occluded by objects located on the layers matching this mask. + /// It's very important to set it as restrictive as possible (checking only the layers which are necessary) + /// to perform a more efficient process in order to increase the performance. + /// + public LayerMask layerMask = Consts.DynOcclusion.LayerMaskDefault; + + /// + /// Should this beam be occluded by triggers or not? + /// + public bool considerTriggers = Consts.DynOcclusion.RaycastingConsiderTriggersDefault; + + /// + /// Minimum 'area' of the collider to become an occluder. + /// Colliders smaller than this value will not block the beam. + /// + public float minOccluderArea = Consts.DynOcclusion.RaycastingMinOccluderAreaDefault; + + /// + /// Approximated percentage of the beam to collide with the surface in order to be considered as occluder + /// + public float minSurfaceRatio = Consts.DynOcclusion.RaycastingMinSurfaceRatioDefault; + + /// + /// Max angle (in degrees) between the beam and the surface in order to be considered as occluder + /// + public float maxSurfaceDot = Consts.DynOcclusion.RaycastingMaxSurfaceDotDefault; + + /// + /// Alignment of the computed clipping plane: + /// + public PlaneAlignment planeAlignment = Consts.DynOcclusion.RaycastingPlaneAlignmentDefault; + + /// + /// Translate the plane. We recommend to set a small positive offset in order to handle non-flat surface better. + /// + public float planeOffset = Consts.DynOcclusion.RaycastingPlaneOffsetDefault; + + /// + /// Fade out the beam before the computed clipping plane in order to soften the transition. + /// + [FormerlySerializedAs("fadeDistanceToPlane")] + public float fadeDistanceToSurface = Consts.DynOcclusion.RaycastingFadeDistanceToSurfaceDefault; + + [System.Obsolete("Use 'fadeDistanceToSurface' instead")] + public float fadeDistanceToPlane { get { return fadeDistanceToSurface; } set { fadeDistanceToSurface = value; } } + + + public bool IsColliderHiddenByDynamicOccluder(Collider collider) + { + Debug.Assert(collider, "You should pass a valid Collider to VLB.DynamicOcclusion.IsColliderHiddenByDynamicOccluder"); + + if (!planeEquationWS.IsValid()) + return false; + + var isInside = GeometryUtility.TestPlanesAABB(new Plane[] { planeEquationWS }, collider.bounds); + return !isInside; + } + + public struct HitResult + { + public HitResult(ref RaycastHit hit3D) + { + point = hit3D.point; + normal = hit3D.normal; + distance = hit3D.distance; + collider3D = hit3D.collider; + collider2D = null; + } + + public HitResult(ref RaycastHit2D hit2D) + { + point = hit2D.point; + normal = hit2D.normal; + distance = hit2D.distance; + collider2D = hit2D.collider; + collider3D = null; + } + + public Vector3 point; + public Vector3 normal; + public float distance; + + Collider2D collider2D; + Collider collider3D; + + public bool hasCollider { get { return collider2D || collider3D; } } + + public string name + { + get + { + if (collider3D) return collider3D.name; + else if (collider2D) return collider2D.name; + else return "null collider"; + } + } + + public Bounds bounds + { + get + { + if (collider3D) return collider3D.bounds; + else if (collider2D) return collider2D.bounds; + else return new Bounds(); + } + } + + public void SetNull() { collider2D = null; collider3D = null; } + } + + /// + /// Get information about the current occluder hit by the beam. + /// Can be null if the beam is not occluded. + /// + HitResult m_CurrentHit; + + protected override string GetShaderKeyword() { return ShaderKeywords.SD.OcclusionClippingPlane; } + protected override MaterialManager.SD.DynamicOcclusion GetDynamicOcclusionMode() { return MaterialManager.SD.DynamicOcclusion.ClippingPlane; } + + float m_RangeMultiplier = 1f; + public Plane planeEquationWS { get; private set; } + +#if UNITY_EDITOR + public HitResult editorCurrentHitResult { get { return m_CurrentHit; } } + + public struct EditorDebugData + { + public int lastFrameUpdate; + } + public EditorDebugData editorDebugData; + + public static bool editorShowDebugPlane = true; + public static bool editorRaycastAtEachFrame = true; + private static bool editorPrefsLoaded = false; + + public static void EditorLoadPrefs() + { + if (!editorPrefsLoaded) + { + editorShowDebugPlane = UnityEditor.EditorPrefs.GetBool(EditorPrefsStrings.DynOcclusion.PrefShowDebugPlane, true); + editorRaycastAtEachFrame = UnityEditor.EditorPrefs.GetBool(EditorPrefsStrings.DynOcclusion.PrefRaycastingEditor, true); + editorPrefsLoaded = true; + } + } +#endif + + protected override void OnValidateProperties() + { + base.OnValidateProperties(); + minOccluderArea = Mathf.Max(minOccluderArea, 0f); + fadeDistanceToSurface = Mathf.Max(fadeDistanceToSurface, 0f); + } + + protected override void OnEnablePostValidate() + { + m_CurrentHit.SetNull(); + +#if UNITY_EDITOR + EditorLoadPrefs(); + editorDebugData.lastFrameUpdate = 0; +#endif + } + + protected override void OnDisable() + { + base.OnDisable(); + SetHitNull(); + } + + void Start() + { + if (Application.isPlaying) + { + var triggerZone = GetComponent(); + if (triggerZone) + { + m_RangeMultiplier = Mathf.Max(1f, triggerZone.rangeMultiplier); + } + } + } + + Vector3 GetRandomVectorAround(Vector3 direction, float angleDiff) + { + var halfAngle = angleDiff * 0.5f; + return Quaternion.Euler(Random.Range(-halfAngle, halfAngle), Random.Range(-halfAngle, halfAngle), Random.Range(-halfAngle, halfAngle)) * direction; + } + + QueryTriggerInteraction queryTriggerInteraction { get { return considerTriggers ? QueryTriggerInteraction.Collide : QueryTriggerInteraction.Ignore; } } + + float raycastMaxDistance { get { return m_Master.raycastDistance * m_RangeMultiplier * m_Master.GetLossyScale().z; } } + + HitResult GetBestHit(Vector3 rayPos, Vector3 rayDir) + { + return dimensions == Dimensions.Dim2D ? GetBestHit2D(rayPos, rayDir) : GetBestHit3D(rayPos, rayDir); + } + + HitResult GetBestHit3D(Vector3 rayPos, Vector3 rayDir) + { + var hits = Physics.RaycastAll(rayPos, rayDir, raycastMaxDistance, layerMask.value, queryTriggerInteraction); + + int bestHit = -1; + float bestLength = float.MaxValue; + for (int i = 0; i < hits.Length; ++i) + { + if (hits[i].collider.gameObject != m_Master.gameObject) // skip collider from TriggerZone + { + if (hits[i].collider.bounds.GetMaxArea2D() >= minOccluderArea) + { + if (hits[i].distance < bestLength) + { + bestLength = hits[i].distance; + bestHit = i; + } + } + } + } + +#if DEBUG_SHOW_RAYCAST_LINES + Debug.DrawLine(rayPos, rayPos + rayDir * raycastMaxDistance, bestHit != -1 ? Color.green : Color.red); +#endif + if (bestHit != -1) + return new HitResult(ref hits[bestHit]); + else + return new HitResult(); + } + + HitResult GetBestHit2D(Vector3 rayPos, Vector3 rayDir) + { + var hits = Physics2D.RaycastAll(new Vector2(rayPos.x, rayPos.y), new Vector2(rayDir.x, rayDir.y), raycastMaxDistance, layerMask.value); + + int bestHit = -1; + float bestLength = float.MaxValue; + for (int i = 0; i < hits.Length; ++i) + { + if (!considerTriggers && hits[i].collider.isTrigger) // do not query triggers if considerTriggers is disabled + continue; + + if (hits[i].collider.gameObject != m_Master.gameObject) // skip collider from TriggerZone + { + if (hits[i].collider.bounds.GetMaxArea2D() >= minOccluderArea) + { + if (hits[i].distance < bestLength) + { + bestLength = hits[i].distance; + bestHit = i; + } + } + } + } + +#if DEBUG_SHOW_RAYCAST_LINES + Debug.DrawLine(rayPos, rayPos + rayDir * raycastMaxDistance, bestHit != -1 ? Color.green : Color.red); +#endif + if (bestHit != -1) + return new HitResult(ref hits[bestHit]); + else + return new HitResult(); + } + + enum Direction { + Up, + Down, + Left, + Right, + Max2D = Down, + Max3D = Right, + }; + uint m_PrevNonSubHitDirectionId = 0; + + uint GetDirectionCount() { return dimensions == Dimensions.Dim2D ? ((uint)Direction.Max2D + 1) : ((uint)Direction.Max3D + 1); } + + Vector3 GetDirection(uint dirInt) + { + dirInt = dirInt % GetDirectionCount(); + switch (dirInt) + { + case (uint)Direction.Up: return m_Master.raycastGlobalUp; + case (uint)Direction.Right: return m_Master.raycastGlobalRight; + case (uint)Direction.Down: return -m_Master.raycastGlobalUp; + case (uint)Direction.Left: return -m_Master.raycastGlobalRight; + } + return Vector3.zero; + } + + + bool IsHitValid(ref HitResult hit, Vector3 forwardVec) + { + if (hit.hasCollider) + { + float dot = Vector3.Dot(hit.normal, -forwardVec); + return dot >= maxSurfaceDot; + } + return false; + } + + protected override bool OnProcessOcclusion(ProcessOcclusionSource source) + { +#if UNITY_EDITOR + editorDebugData.lastFrameUpdate = Time.frameCount; +#endif + var raycastGlobalForward = m_Master.raycastGlobalForward; + var bestHit = GetBestHit(transform.position, raycastGlobalForward); + + if (IsHitValid(ref bestHit, raycastGlobalForward)) + { + if (minSurfaceRatio > 0.5f) + { + var raycastDistance = m_Master.raycastDistance; + for (uint i = 0; i < GetDirectionCount(); i++) + { + var dir3 = GetDirection(i + m_PrevNonSubHitDirectionId) * (minSurfaceRatio * 2 - 1); + dir3.Scale(transform.localScale); + var startPt = transform.position + dir3 * m_Master.coneRadiusStart; + var newPt = transform.position + dir3 * m_Master.coneRadiusEnd + raycastGlobalForward * raycastDistance; + + var bestHitSub = GetBestHit(startPt, (newPt - startPt).normalized); + if (IsHitValid(ref bestHitSub, raycastGlobalForward)) + { + if (bestHitSub.distance > bestHit.distance) + { + bestHit = bestHitSub; + } + } + else + { + m_PrevNonSubHitDirectionId = i; + bestHit.SetNull(); + break; + } + } + } + } + else + { + bestHit.SetNull(); + } + + SetHit(ref bestHit); + return bestHit.hasCollider; + } + + void SetHit(ref HitResult hit) + { + if (!hit.hasCollider) + { + SetHitNull(); + } + else + { + switch (planeAlignment) + { + case PlaneAlignment.Beam: + SetClippingPlane(new Plane(-m_Master.raycastGlobalForward, hit.point)); + break; + case PlaneAlignment.Surface: + default: + SetClippingPlane(new Plane(hit.normal, hit.point)); + break; + } + + m_CurrentHit = hit; + } + } + + void SetHitNull() + { + SetClippingPlaneOff(); + m_CurrentHit.SetNull(); + } + + protected override void OnModifyMaterialCallback(MaterialModifier.Interface owner) + { + Debug.Assert(owner != null); + var planeWS = planeEquationWS; + owner.SetMaterialProp(ShaderProperties.SD.DynamicOcclusionClippingPlaneWS, new Vector4(planeWS.normal.x, planeWS.normal.y, planeWS.normal.z, planeWS.distance)); + owner.SetMaterialProp(ShaderProperties.SD.DynamicOcclusionClippingPlaneProps, fadeDistanceToSurface); + } + + void SetClippingPlane(Plane planeWS) + { + planeWS = planeWS.TranslateCustom(planeWS.normal * planeOffset); + SetPlaneWS(planeWS); + Debug.Assert(m_MaterialModifierCallbackCached != null); + m_Master._INTERNAL_SetDynamicOcclusionCallback(GetShaderKeyword(), m_MaterialModifierCallbackCached); + } + + void SetClippingPlaneOff() + { + SetPlaneWS(new Plane()); + m_Master._INTERNAL_SetDynamicOcclusionCallback(GetShaderKeyword(), null); + } + + void SetPlaneWS(Plane planeWS) + { + planeEquationWS = planeWS; + +#if UNITY_EDITOR + m_DebugPlaneLocal = planeWS; + if (m_DebugPlaneLocal.IsValid()) + { + float dist; + if (m_DebugPlaneLocal.Raycast(new Ray(transform.position, m_Master.raycastGlobalForward), out dist)) + m_DebugPlaneLocal.distance = dist; // compute local distance + } +#endif + } + +#if UNITY_EDITOR + void LateUpdate() + { + if (!Application.isPlaying) + { + // In Editor, process raycasts at each frame update + if (!editorRaycastAtEachFrame) + SetHitNull(); + else + ProcessOcclusion(ProcessOcclusionSource.EditorUpdate); + } + } + + Plane m_DebugPlaneLocal; + + void OnDrawGizmos() + { + if (!editorShowDebugPlane) + return; + + if (m_DebugPlaneLocal.IsValid()) + { + var planePos = transform.position + m_DebugPlaneLocal.distance * m_Master.raycastGlobalForward; + float planeDistNormalized = Mathf.Clamp01(Mathf.InverseLerp(0f, m_Master.raycastDistance, m_DebugPlaneLocal.distance)); + float planeSize = Mathf.Lerp(m_Master.coneRadiusStart, m_Master.coneRadiusEnd, planeDistNormalized); + + var color = m_Master.ComputeColorAtDepth(planeDistNormalized).ComputeComplementaryColor(false); + Utils.GizmosDrawPlane( + m_DebugPlaneLocal.normal, + planePos, + color, + Matrix4x4.identity, + planeSize, + planeSize * 0.5f); + + UnityEditor.Handles.color = color; + UnityEditor.Handles.DrawWireDisc(planePos, + m_DebugPlaneLocal.normal, + planeSize * (minSurfaceRatio * 2 - 1)); + } + } +#endif + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionRaycasting.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionRaycasting.cs.meta new file mode 100644 index 00000000..51f34357 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SD/DynamicOcclusionRaycasting.cs.meta @@ -0,0 +1,28 @@ +fileFormatVersion: 2 +guid: 558dd6d156642974780bc97cd2ab1bd2 +labels: +- volumetric +- light +- lighting +- ray +- shaft +- beam +- density +- vr +- dynamic +- spot +- spotlight +- fog +- noise +- occlusion +- procedural +timeCreated: 1513615359 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: f4140fedf3f72d7448a4e55ea9db44ab, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/SD/GlobalMeshSD.cs b/Assets/External/VolumetricLightBeam/Scripts/SD/GlobalMeshSD.cs new file mode 100644 index 00000000..cd2e9159 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SD/GlobalMeshSD.cs @@ -0,0 +1,45 @@ +using UnityEngine; +using System.Collections; + +namespace VLB +{ + public static class GlobalMeshSD + { + public static Mesh Get() + { + var needDoubleSided = Config.Instance.SD_requiresDoubleSidedMesh; + + if (ms_Mesh == null + || ms_DoubleSided != needDoubleSided) + { + Destroy(); + + ms_Mesh = MeshGenerator.GenerateConeZ_Radii( + lengthZ: 1f, + radiusStart: 1f, + radiusEnd: 1f, + numSides: Config.Instance.sharedMeshSides, + numSegments: Config.Instance.sharedMeshSegments, + cap: true, + doubleSided: needDoubleSided); + + ms_Mesh.hideFlags = Consts.Internal.ProceduralObjectsHideFlags; + ms_DoubleSided = needDoubleSided; + } + + return ms_Mesh; + } + + public static void Destroy() + { + if (ms_Mesh != null) + { + GameObject.DestroyImmediate(ms_Mesh); + ms_Mesh = null; + } + } + + static Mesh ms_Mesh = null; + static bool ms_DoubleSided = false; + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/SD/GlobalMeshSD.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/SD/GlobalMeshSD.cs.meta new file mode 100644 index 00000000..4bdfaf88 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SD/GlobalMeshSD.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0e4bae9c762e9004296c04beb33798ed +timeCreated: 1529559345 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/SD/SkewingHandleSD.cs b/Assets/External/VolumetricLightBeam/Scripts/SD/SkewingHandleSD.cs new file mode 100644 index 00000000..0e5f123b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SD/SkewingHandleSD.cs @@ -0,0 +1,59 @@ +using UnityEngine; +using System.Collections; + +namespace VLB +{ + [ExecuteInEditMode] + [HelpURL(Consts.Help.SD.UrlSkewingHandle)] + public class SkewingHandleSD : MonoBehaviour + { + public const string ClassName = "SkewingHandleSD"; + + public VolumetricLightBeamSD volumetricLightBeam = null; + public bool shouldUpdateEachFrame = false; + +#if UNITY_EDITOR + void Update() + { + if (!Application.isPlaying && CanSetSkewingVector()) + SetSkewingVector(); + } +#endif + + public bool IsAttachedToSelf() { return volumetricLightBeam != null && volumetricLightBeam.gameObject == this.gameObject; } + public bool CanSetSkewingVector() { return volumetricLightBeam != null && volumetricLightBeam.canHaveMeshSkewing; } + public bool CanUpdateEachFrame() { return CanSetSkewingVector() && volumetricLightBeam.trackChangesDuringPlaytime; } + bool ShouldUpdateEachFrame() { return shouldUpdateEachFrame && CanUpdateEachFrame(); } + + void OnEnable() + { + if(CanSetSkewingVector()) + SetSkewingVector(); + } + + void Start() + { + if (Application.isPlaying && ShouldUpdateEachFrame()) + { + StartCoroutine(CoUpdate()); + } + } + + IEnumerator CoUpdate() + { + while(ShouldUpdateEachFrame()) + { + SetSkewingVector(); + yield return null; + } + } + + void SetSkewingVector() + { + Debug.Assert(CanSetSkewingVector()); + var vec = volumetricLightBeam.transform.InverseTransformPoint(transform.position); + volumetricLightBeam.skewingLocalForwardDirection = vec; + } + } +} + diff --git a/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOEditor.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/SD/SkewingHandleSD.cs.meta similarity index 50% rename from Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOEditor.cs.meta rename to Assets/External/VolumetricLightBeam/Scripts/SD/SkewingHandleSD.cs.meta index 6ea3f96a..b5a175eb 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOEditor.cs.meta +++ b/Assets/External/VolumetricLightBeam/Scripts/SD/SkewingHandleSD.cs.meta @@ -1,12 +1,12 @@ fileFormatVersion: 2 -guid: c11bfebf2cb67334d8e543d164ef0cb0 -timeCreated: 1478884394 -licenseType: Store +guid: 39d38d9261901ee459f4c704884f0ad3 +timeCreated: 1617808264 +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: 96c382e4368041b4aad93aed0a833e2b, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/SD/VolumetricLightBeamSD.cs b/Assets/External/VolumetricLightBeam/Scripts/SD/VolumetricLightBeamSD.cs new file mode 100644 index 00000000..5303e3b8 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SD/VolumetricLightBeamSD.cs @@ -0,0 +1,1103 @@ +//#define DEBUG_SHOW_APEX +//#define DEBUG_GLOBAL_VECTORS +//#define DEBUG_GLOBAL_RAYCAST_VECTORS +#if UNITY_2019_3_OR_NEWER +#define VLB_LIGHT_TEMPERATURE_SUPPORT +#endif + +using UnityEngine; +using UnityEngine.Serialization; +using System.Collections; + +namespace VLB +{ + [ExecuteInEditMode] + [DisallowMultipleComponent] + [SelectionBase] + [HelpURL(Consts.Help.SD.UrlBeam)] + public partial class VolumetricLightBeamSD : VolumetricLightBeamAbstractBase + { + public new const string ClassName = "VolumetricLightBeamSD"; + + /// + /// Get the color value from the light (when attached to a Spotlight) or not + /// + public bool colorFromLight = true; + + /// + /// Apply a flat/plain/single color, or a gradient + /// + public ColorMode colorMode = Consts.Beam.ColorModeDefault; + + public ColorMode usedColorMode + { + get + { + if (Config.Instance.featureEnabledColorGradient == FeatureEnabledColorGradient.Off) return ColorMode.Flat; + return colorMode; + } + } + + /// + /// RGBA plain color, if colorMode is Flat (takes account of the alpha value). + /// +#if UNITY_2018_1_OR_NEWER + [ColorUsageAttribute(false, true)] +#else + [ColorUsageAttribute(false, true, 0f, 8f, 0.125f, 3f)] +#endif + [FormerlySerializedAs("colorValue")] + public Color color = Consts.Beam.FlatColor; + + /// + /// Gradient color applied along the beam, if colorMode is Gradient (takes account of the color and alpha variations). + /// + public Gradient colorGradient; + +#if UNITY_EDITOR + public override Color ComputeColorAtDepth(float depthRatio) + { + if (usedColorMode == ColorMode.Flat) return color; + else return colorGradient.Evaluate(depthRatio); + } +#endif + + bool useColorFromAttachedLightSpot { get { return colorFromLight && lightSpotAttached != null; } } + + bool useColorTemperatureFromAttachedLightSpot + { + get + { +#if VLB_LIGHT_TEMPERATURE_SUPPORT + return useColorFromAttachedLightSpot && lightSpotAttached.useColorTemperature && Config.Instance.useLightColorTemperature; +#else + return false; +#endif + } + } + + /// + /// Get the intensity value from the light (when attached to a Spotlight) or not + /// + public bool intensityFromLight = true; + + /// + /// Disabled: the inside and outside intensity values are the same and controlled by intensityGlobal property + /// Enabled: the inside and outside intensity values are distinct (intensityInside and intensityOutside) + /// + public bool intensityModeAdvanced = false; + + /// + /// Beam inside intensity (when looking at the beam from the inside directly at the source). + /// You can change this property only if intensityModeAdvanced is true. Use intensityGlobal otherwise. + /// + [FormerlySerializedAs("alphaInside")] + [Min(Consts.Beam.IntensityMin)] + public float intensityInside = Consts.Beam.IntensityDefault; + + [System.Obsolete("Use 'intensityGlobal' or 'intensityInside' instead")] + public float alphaInside { get { return intensityInside; } set { intensityInside = value; } } + + /// + /// Beam outside intensity (when looking at the beam from behind). + /// You can change this property only if intensityModeAdvanced is true. Use intensityGlobal otherwise. + /// + [FormerlySerializedAs("alphaOutside"), FormerlySerializedAs("alpha")] + [Min(Consts.Beam.IntensityMin)] + public float intensityOutside = Consts.Beam.IntensityDefault; + + [System.Obsolete("Use 'intensityGlobal' or 'intensityOutside' instead")] + public float alphaOutside { get { return intensityOutside; } set { intensityOutside = value; } } + + /// + /// Global beam intensity, to use when intensityModeAdvanced is false. + /// Otherwise use intensityOutside and intensityInside independently. + /// + public float intensityGlobal { get { return intensityOutside; } set { intensityInside = value; intensityOutside = value; } } + + /// + /// Multiplier to modulate the spotlight intensity. + /// + [Min(Consts.Beam.MultiplierMin)] + public float intensityMultiplier = Consts.Beam.MultiplierDefault; + + public bool useIntensityFromAttachedLightSpot { get { return intensityFromLight && lightSpotAttached != null; } } + + public void GetInsideAndOutsideIntensity(out float inside, out float outside) + { + if(intensityModeAdvanced) + { + inside = intensityInside; + outside = intensityOutside; + } + else + { +#if UNITY_EDITOR + if (Application.isPlaying) +#endif + { + Debug.Assert(Utils.Approximately(intensityInside, intensityOutside), "The beam is not using advanced intensity mode, but its inside and outside have not the same value.", gameObject); + } + inside = outside = intensityOutside; + } + } + + /// + /// HDRP Only + /// Use this property to set how much effect the camera exposure has on the beam intensity. + /// + [Range(Consts.Beam.HDRPExposureWeightMin, Consts.Beam.HDRPExposureWeightMax)] + public float hdrpExposureWeight = Consts.Beam.HDRPExposureWeightDefault; + + /// + /// Change how the light beam colors will be mixed with the scene + /// + public BlendingMode blendingMode = Consts.Beam.BlendingModeDefault; + + /// + /// Get the spotAngle value from the light (when attached to a Spotlight) or not + /// + [FormerlySerializedAs("angleFromLight")] + public bool spotAngleFromLight = true; + + public bool useSpotAngleFromAttachedLightSpot { get { return spotAngleFromLight && lightSpotAttached != null; } } + + /// + /// Spot Angle (in degrees). This doesn't take account of the radiusStart, and is not necessarily the same than the cone angle. + /// + [Range(Consts.Beam.SpotAngleMin, Consts.Beam.SpotAngleMax)] + public float spotAngle = Consts.Beam.SpotAngleDefault; + + /// + /// Multiplier to modulate the spotlight spot angle. + /// + [Min(Consts.Beam.MultiplierMin)] + public float spotAngleMultiplier = Consts.Beam.MultiplierDefault; + + /// + /// Cone Angle (in degrees). This takes account of the radiusStart, and is not necessarily the same than the spot angle. + /// + public float coneAngle { get { return Mathf.Atan2(coneRadiusEnd - coneRadiusStart, maxGeometryDistance) * Mathf.Rad2Deg * 2f; } } + + /// + /// Start radius of the cone geometry. + /// 0 will generate a perfect cone geometry. Higher values will generate truncated cones. + /// + [FormerlySerializedAs("radiusStart")] + public float coneRadiusStart = Consts.Beam.ConeRadiusStart; + + /// + /// End radius of the cone geometry + /// + public float coneRadiusEnd { + get { return Utils.ComputeConeRadiusEnd(maxGeometryDistance, spotAngle); } + set { spotAngle = Utils.ComputeSpotAngle(maxGeometryDistance, value); } + } + + /// + /// Volume (in unit^3) of the cone (from the base to fallOffEnd) + /// + public float coneVolume { get { float r1 = coneRadiusStart, r2 = coneRadiusEnd; return (Mathf.PI / 3) * (r1 * r1 + r1 * r2 + r2 * r2) * fallOffEnd; } } + + /// + /// Apex distance of the truncated radius + /// If coneRadiusStart = 0, the apex is the at the truncated radius, so coneApexOffsetZ = 0 + /// Otherwise, coneApexOffsetZ > 0 and represents the local position Z offset + /// + public float coneApexOffsetZ { + get { // simple intercept + float ratioRadius = coneRadiusStart / coneRadiusEnd; + return ratioRadius == 1f ? float.MaxValue : ((maxGeometryDistance * ratioRadius) / (1 - ratioRadius)); + } + } + + public Vector3 coneApexPositionLocal { get { return new Vector3(0, 0, -coneApexOffsetZ); } } + public Vector3 coneApexPositionGlobal { get { return transform.localToWorldMatrix.MultiplyPoint(coneApexPositionLocal); } } + + public override bool IsScalable() { return true; } + + /// + /// - Fast: a lot of computation are done on the vertex shader to maximize performance. + /// - High: most of the computation are done on the pixel shader to maximize graphical quality at some performance cost. + /// + public ShaderAccuracy shaderAccuracy = Consts.Beam.ShaderAccuracyDefault; + + /// + /// Shared: this beam will use the global shared mesh (recommended setting, since it will save a lot on memory). + /// Custom: this beam will use a custom mesh instead. Check the following properties to control how the mesh will be generated. + /// + public MeshType geomMeshType = Consts.Beam.GeomMeshType; + + /// + /// Set a custom number of Sides for the cone geometry. + /// Higher values give better looking results, but require more memory and graphic performance. + /// This value is only used when geomMeshType is Custom. + /// + [FormerlySerializedAs("geomSides")] + public int geomCustomSides = Consts.Beam.GeomSidesDefault; + + /// + /// Returns the effective number of Sides used by this beam. + /// Could come from the shared mesh, or the custom mesh + /// + public int geomSides + { + get { return geomMeshType == MeshType.Custom ? geomCustomSides : Config.Instance.sharedMeshSides; } + set { geomCustomSides = value; Debug.LogWarningFormat("The setter VLB.{0}.geomSides is OBSOLETE and has been renamed to geomCustomSides.", ClassName); } + } + + /// + /// Set a custom Segments for the cone geometry. + /// Higher values give better looking results, but require more memory and graphic performance. + /// This value is only used when geomMeshType is Custom. + /// + public int geomCustomSegments = Consts.Beam.GeomSegmentsDefault; + + /// + /// Returns the effective number of Segments used by this beam. + /// Could come from the shared mesh, or the custom mesh + /// + public int geomSegments + { + get { return geomMeshType == MeshType.Custom ? geomCustomSegments : Config.Instance.sharedMeshSegments; } + set { geomCustomSegments = value; Debug.LogWarningFormat("The setter VLB.{0}.geomSegments is OBSOLETE and has been renamed to geomCustomSegments.", ClassName); } + } + + /// + /// Distort the beam's shape horizontally (X axis) and vertically (Y axis) while keeping its circular slice and gradient unchanged. + /// (This property is only available when 'Mesh Type' is 'Custom') + /// + public Vector3 skewingLocalForwardDirection = Consts.Beam.SD.SkewingLocalForwardDirectionDefault; + + public Vector3 skewingLocalForwardDirectionNormalized + { + get + { + if (Mathf.Approximately(skewingLocalForwardDirection.z, 0.0f)) + { + Debug.LogErrorFormat("Beam {0} has a skewingLocalForwardDirection with a null Z, which is forbidden", name); + return Vector3.forward; + } + else return skewingLocalForwardDirection.normalized; + } + } + + public bool canHaveMeshSkewing { get { return geomMeshType == MeshType.Custom; } } + + public bool hasMeshSkewing + { + get + { + if (!Config.Instance.featureEnabledMeshSkewing) return false; + if (!canHaveMeshSkewing) return false; + var dotForward = Vector3.Dot(skewingLocalForwardDirectionNormalized, Vector3.forward); + if (Mathf.Approximately(dotForward, 1.0f)) return false; + return true; + } + } + + /// + /// Additional clipping plane transform. Will cut the beam according to the GameObject's position and rotation. + /// + public Transform clippingPlaneTransform = Consts.Beam.SD.ClippingPlaneTransformDefault; + + public Vector4 additionalClippingPlane { get { return clippingPlaneTransform == null ? Vector4.zero : Utils.PlaneEquation(clippingPlaneTransform.forward, clippingPlaneTransform.position); } } + + /// + /// Show the cone cap (only visible from inside) + /// + public bool geomCap = Consts.Beam.GeomCap; + + /// + /// Light attenuation formula used to compute fading between 'fallOffStart' and 'fallOffEnd' + /// + public AttenuationEquation attenuationEquation = Consts.Beam.AttenuationEquationDefault; + + /// + /// Custom blending mix between linear and quadratic attenuation formulas. + /// Only used if attenuationEquation is set to AttenuationEquation.Blend. + /// 0.0 = 100% Linear + /// 0.5 = Mix between 50% Linear and 50% Quadratic + /// 1.0 = 100% Quadratic + /// + [Range(Consts.Beam.AttenuationCustomBlendingMin, Consts.Beam.AttenuationCustomBlendingMax)] + public float attenuationCustomBlending = Consts.Beam.AttenuationCustomBlendingDefault; + + /// + /// Proper lerp value between linear and quadratic attenuation, used by the shader. + /// + public float attenuationLerpLinearQuad { + get { + if (attenuationEquation == AttenuationEquation.Linear) return 0f; + else if (attenuationEquation == AttenuationEquation.Quadratic) return 1f; + return attenuationCustomBlending; + } + } + + /// + /// Distance from the light source (in units) the beam will start to fade out. + /// + /// + [FormerlySerializedAs("fadeStart")] + public float fallOffStart = Consts.Beam.FallOffStart; + + [System.Obsolete("Use 'fallOffStart' instead")] + public float fadeStart { get { return fallOffStart; } set { fallOffStart = value; } } + + /// + /// Distance from the light source (in units) the beam is entirely faded out. + /// + [FormerlySerializedAs("fadeEnd")] + public float fallOffEnd = Consts.Beam.FallOffEnd; + + [System.Obsolete("Use 'fallOffEnd' instead")] + public float fadeEnd { get { return fallOffEnd; } set { fallOffEnd = value; } } + + /// + /// Get the fallOffEnd value from the light (when attached to a Spotlight) or not + /// + [FormerlySerializedAs("fadeEndFromLight")] + public bool fallOffEndFromLight = true; + + [System.Obsolete("Use 'fallOffEndFromLight' instead")] + public bool fadeEndFromLight { get { return fallOffEndFromLight; } set { fallOffEndFromLight = value; } } + + public bool useFallOffEndFromAttachedLightSpot { get { return fallOffEndFromLight && lightSpotAttached != null; } } + + /// + /// Distance multiplier to modulate the spotlight range. + /// + [Min(Consts.Beam.MultiplierMin)] + public float fallOffEndMultiplier = Consts.Beam.MultiplierDefault; + + public float maxGeometryDistance { get { return fallOffEnd + Mathf.Max(Mathf.Abs(tiltFactor.x), Mathf.Abs(tiltFactor.y)); } } + + /// + /// Distance from the world geometry the beam will fade. + /// 0 = hard intersection + /// Higher values produce soft intersection when the beam intersects other opaque geometry. + /// + public float depthBlendDistance = Consts.Beam.DepthBlendDistance; + + /// + /// Distance from the camera the beam will fade. + /// 0 = hard intersection + /// Higher values produce soft intersection when the camera is near the cone triangles. + /// + public float cameraClippingDistance = Consts.Beam.CameraClippingDistance; + + /// + /// Boost intensity factor when looking at the beam from the inside directly at the source. + /// + [Range(Consts.Beam.SD.GlareMin, Consts.Beam.SD.GlareMax)] + public float glareFrontal = Consts.Beam.SD.GlareFrontalDefault; + + /// + /// Boost intensity factor when looking at the beam from behind. + /// + [Range(Consts.Beam.SD.GlareMin, Consts.Beam.SD.GlareMax)] + public float glareBehind = Consts.Beam.SD.GlareBehindDefault; + + /// + /// Modulate the thickness of the beam when looking at it from the side. + /// Higher values produce thinner beam with softer transition at beam edges. + /// + [FormerlySerializedAs("fresnelPowOutside")] + public float fresnelPow = Consts.Beam.SD.FresnelPow; + + /// + /// Enable 3D Noise effect and choose the mode + /// + public NoiseMode noiseMode = Consts.Beam.NoiseModeDefault; + + public bool isNoiseEnabled { get { return noiseMode != NoiseMode.Disabled; } } + + [System.Obsolete("Use 'noiseMode' instead")] + public bool noiseEnabled { get { return isNoiseEnabled; } set { noiseMode = value ? NoiseMode.WorldSpace : NoiseMode.Disabled; } } + + /// + /// Contribution factor of the 3D Noise (when enabled). + /// Higher intensity means the noise contribution is stronger and more visible. + /// + [Range(Consts.Beam.NoiseIntensityMin, Consts.Beam.NoiseIntensityMax)] + public float noiseIntensity = Consts.Beam.NoiseIntensityDefault; + + /// + /// Get the noiseScale value from the Global 3D Noise configuration + /// + public bool noiseScaleUseGlobal = true; + + /// + /// 3D Noise texture scaling: higher scale make the noise more visible, but potentially less realistic. + /// + [Range(Consts.Beam.NoiseScaleMin, Consts.Beam.NoiseScaleMax)] + public float noiseScaleLocal = Consts.Beam.NoiseScaleDefault; + + /// + /// Get the noiseVelocity value from the Global 3D Noise configuration + /// + public bool noiseVelocityUseGlobal = true; + + /// + /// World Space direction and speed of the 3D Noise scrolling, simulating the fog/smoke movement. + /// + public Vector3 noiseVelocityLocal = Consts.Beam.NoiseVelocityDefault; + + /// + /// Fade out starting distance. + /// Beyond this distance, the beam intensity will start to be dimmed. + /// + public float fadeOutBegin + { + get { return _FadeOutBegin; } + set { SetFadeOutValue(ref _FadeOutBegin, value); } + } + + /// + /// Fade out ending distance. + /// Beyond this distance, the beam will be culled off to save on performance. + /// + public float fadeOutEnd + { + get { return _FadeOutEnd; } + set { SetFadeOutValue(ref _FadeOutEnd, value); } + } + + /// + /// Is Fade Out feature enabled or not? + /// + public bool isFadeOutEnabled { get { return _FadeOutBegin >= 0 && _FadeOutEnd >= 0; } } + + /// + /// - 3D: beam along the Z axis. + /// - 2D: beam along the X axis, so you won't have to rotate it to see it in 2D. + /// + public Dimensions dimensions = Consts.Beam.DimensionsDefault; + + /// + /// Tilt the color and attenuation gradient compared to the global beam's direction. + /// Should be used with 'High' Shader Accuracy mode. + /// + public Vector2 tiltFactor = Consts.Beam.SD.TiltDefault; + + public bool isTilted { get { return !tiltFactor.Approximately(Vector2.zero); } } + + /// + /// Unique ID of the beam's sorting layer. + /// + public int sortingLayerID + { + get { return _SortingLayerID; } + set { + _SortingLayerID = value; + if (m_BeamGeom) m_BeamGeom.sortingLayerID = value; + } + } + + /// + /// Name of the beam's sorting layer. + /// + public string sortingLayerName + { + get { return SortingLayer.IDToName(sortingLayerID); } + set { sortingLayerID = SortingLayer.NameToID(value); } + } + + /// + /// The overlay priority within its layer. + /// Lower numbers are rendered first and subsequent numbers overlay those below. + /// + public int sortingOrder + { + get { return _SortingOrder; } + set + { + _SortingOrder = value; + if (m_BeamGeom) m_BeamGeom.sortingOrder = value; + } + } + + /// + /// If true, the light beam will keep track of the changes of its own properties and the spotlight attached to it (if any) during playtime. + /// This would allow you to modify the light beam in realtime from Script, Animator and/or Timeline. + /// Enabling this feature is at very minor performance cost. So keep it disabled if you don't plan to modify this light beam during playtime. + /// + public bool trackChangesDuringPlaytime + { + get { return _TrackChangesDuringPlaytime; } + set { _TrackChangesDuringPlaytime = value; StartPlaytimeUpdateIfNeeded(); } + } + + /// Is the beam currently tracking property changes? + public bool isCurrentlyTrackingChanges { get { return m_CoPlaytimeUpdate != null; } } + + public override BeamGeometryAbstractBase GetBeamGeometry() { return m_BeamGeom; } + protected override void SetBeamGeometryNull() { m_BeamGeom = null; } + + public int blendingModeAsInt { get { return Mathf.Clamp((int)blendingMode, 0, System.Enum.GetValues(typeof(BlendingMode)).Length); } } + + public Quaternion beamInternalLocalRotation { get { return dimensions == Dimensions.Dim3D ? Quaternion.identity : Quaternion.LookRotation(Vector3.right, Vector3.up); } } + public Vector3 beamLocalForward { get { return dimensions == Dimensions.Dim3D ? Vector3.forward : Vector3.right; } } + public Vector3 beamGlobalForward { get { return transform.TransformDirection(beamLocalForward); } } + public override Vector3 GetLossyScale() { return dimensions == Dimensions.Dim3D ? transform.lossyScale : new Vector3(transform.lossyScale.z, transform.lossyScale.y, transform.lossyScale.x); } + + public float raycastDistance { + get { + if (!hasMeshSkewing) return maxGeometryDistance; + else + { + var skewingZ = skewingLocalForwardDirectionNormalized.z; + return Mathf.Approximately(skewingZ, 0.0f) ? maxGeometryDistance : (maxGeometryDistance / skewingZ); + } + } + } + + Vector3 ComputeRaycastGlobalVector(Vector3 localVec) + { + var rot = transform.rotation * beamInternalLocalRotation; + return rot * localVec; + } + + public Vector3 raycastGlobalForward { get { return ComputeRaycastGlobalVector(hasMeshSkewing ? skewingLocalForwardDirectionNormalized : Vector3.forward); } } + public Vector3 raycastGlobalUp { get { return ComputeRaycastGlobalVector(Vector3.up); } } + public Vector3 raycastGlobalRight { get { return ComputeRaycastGlobalVector(Vector3.right); } } + + // INTERNAL + public MaterialManager.SD.DynamicOcclusion _INTERNAL_DynamicOcclusionMode + { + get { return Config.Instance.featureEnabledDynamicOcclusion ? m_INTERNAL_DynamicOcclusionMode : MaterialManager.SD.DynamicOcclusion.Off; } + set { m_INTERNAL_DynamicOcclusionMode = value; } + } + + public MaterialManager.SD.DynamicOcclusion _INTERNAL_DynamicOcclusionMode_Runtime { get { return m_INTERNAL_DynamicOcclusionMode_Runtime ? _INTERNAL_DynamicOcclusionMode : MaterialManager.SD.DynamicOcclusion.Off; } } + + MaterialManager.SD.DynamicOcclusion m_INTERNAL_DynamicOcclusionMode = MaterialManager.SD.DynamicOcclusion.Off; + bool m_INTERNAL_DynamicOcclusionMode_Runtime = false; + + public void _INTERNAL_SetDynamicOcclusionCallback(string shaderKeyword, MaterialModifier.Callback cb) + { + m_INTERNAL_DynamicOcclusionMode_Runtime = cb != null; + + if (m_BeamGeom) + m_BeamGeom.SetDynamicOcclusionCallback(shaderKeyword, cb); + } + + public delegate void OnWillCameraRenderCB(Camera cam); + public event OnWillCameraRenderCB onWillCameraRenderThisBeam; + + public void _INTERNAL_OnWillCameraRenderThisBeam(Camera cam) + { + if (onWillCameraRenderThisBeam != null) + onWillCameraRenderThisBeam(cam); + } + + public delegate void OnBeamGeometryInitialized(); + private OnBeamGeometryInitialized m_OnBeamGeometryInitialized; + + public void RegisterOnBeamGeometryInitializedCallback(OnBeamGeometryInitialized cb) + { + m_OnBeamGeometryInitialized += cb; + + if(m_BeamGeom) + { + CallOnBeamGeometryInitializedCallback(); + } + } + + void CallOnBeamGeometryInitializedCallback() + { + if (m_OnBeamGeometryInitialized != null) + { + m_OnBeamGeometryInitialized(); + m_OnBeamGeometryInitialized = null; + } + } + + [FormerlySerializedAs("trackChangesDuringPlaytime")] + [SerializeField] bool _TrackChangesDuringPlaytime = false; + + [SerializeField] int _SortingLayerID = 0; + [SerializeField] int _SortingOrder = 0; + + [FormerlySerializedAs("fadeOutBegin")] + [SerializeField] float _FadeOutBegin = Consts.Beam.FadeOutBeginDefault; + [FormerlySerializedAs("fadeOutEnd")] + [SerializeField] float _FadeOutEnd = Consts.Beam.FadeOutEndDefault; + + void SetFadeOutValue(ref float propToChange, float value) + { + bool wasEnabled = isFadeOutEnabled; + propToChange = value; + +#if UNITY_EDITOR + if (Application.isPlaying) +#endif + { + if (isFadeOutEnabled != wasEnabled) + OnFadeOutStateChanged(); + } + } + + void OnFadeOutStateChanged() + { +#if UNITY_EDITOR + if (Application.isPlaying) +#endif + { + // Restart only when fadeout is enabled: on disable, the coroutine will kill itself automatically + if (isFadeOutEnabled && m_BeamGeom) m_BeamGeom.RestartFadeOutCoroutine(); + } + } + + /// Internal property used for QA testing purpose, do not change + public uint _INTERNAL_InstancedMaterialGroupID { get; protected set; } + + BeamGeometrySD m_BeamGeom = null; + Coroutine m_CoPlaytimeUpdate = null; + +#if UNITY_EDITOR + public override int _EDITOR_GetInstancedMaterialID() { return m_BeamGeom ? m_BeamGeom._EDITOR_InstancedMaterialID : int.MinValue; } + + static VolumetricLightBeamSD[] _EditorFindAllInstances() + { + return Resources.FindObjectsOfTypeAll(); + } + + public static void _EditorSetAllMeshesDirty() + { + foreach (var instance in _EditorFindAllInstances()) + instance._EditorSetMeshDirty(); + } + + public static void _EditorSetAllBeamGeomDirty() + { + foreach (var instance in _EditorFindAllInstances()) + instance.m_EditorDirtyFlags |= EditorDirtyFlags.FullBeamGeomGAO; + } +#endif // UNITY_EDITOR + + public string meshStats + { + get + { + Mesh mesh = m_BeamGeom ? m_BeamGeom.coneMesh : null; + if (mesh) return string.Format("Cone angle: {0:0.0} degrees\nMesh: {1} vertices, {2} triangles", coneAngle, mesh.vertexCount, mesh.triangles.Length / 3); + else return "no mesh available"; + } + } + + public int meshVerticesCount { get { return (m_BeamGeom && m_BeamGeom.coneMesh) ? m_BeamGeom.coneMesh.vertexCount : 0; } } + public int meshTrianglesCount { get { return (m_BeamGeom && m_BeamGeom.coneMesh) ? m_BeamGeom.coneMesh.triangles.Length / 3 : 0; } } + + /// + /// Returns a value indicating if the world position passed in argument is inside the light beam or not. + /// This functions treats the beam like infinite (like the beam had an infinite length and never fell off) + /// + /// World position + /// + /// < 0 position is out + /// = 0 position is exactly on the beam geometry + /// > 0 position is inside the cone + /// + public float GetInsideBeamFactor(Vector3 posWS) { return GetInsideBeamFactorFromObjectSpacePos(transform.InverseTransformPoint(posWS)); } + + public float GetInsideBeamFactorFromObjectSpacePos(Vector3 posOS) + { + if(dimensions == Dimensions.Dim2D) + { + posOS = new Vector3(posOS.z, posOS.y, posOS.x); + } + + if (posOS.z < 0f) return -1f; + + Vector2 posOSXY = posOS.xy(); + + if (hasMeshSkewing) + { + Vector3 localForwardDirN = skewingLocalForwardDirectionNormalized; + posOSXY -= localForwardDirN.xy() * (posOS.z / localForwardDirN.z); + } + + // Compute a factor to know how far inside the beam cone the camera is + var triangle2D = new Vector2(posOSXY.magnitude, posOS.z + coneApexOffsetZ).normalized; + const float maxRadiansDiff = 0.1f; + float slopeRad = (coneAngle * Mathf.Deg2Rad) / 2; + + return Mathf.Clamp((Mathf.Abs(Mathf.Sin(slopeRad)) - Mathf.Abs(triangle2D.x)) / maxRadiansDiff, -1, 1); + } + + [System.Obsolete("Use 'GenerateGeometry()' instead")] + public void Generate() { GenerateGeometry(); } + + /// + /// Regenerate the beam mesh (and also the material). + /// This can be slow (it recreates a mesh from scratch), so don't call this function during playtime. + /// You would need to call this function only if you want to change the properties 'geomSides' and 'geomCap' during playtime. + /// Otherwise, for the other properties, just enable 'trackChangesDuringPlaytime', or manually call 'UpdateAfterManualPropertyChange()' + /// + public virtual void GenerateGeometry() + { + HandleBackwardCompatibility(pluginVersion, Version.Current); + pluginVersion = Version.Current; + + ValidateProperties(); + + if (m_BeamGeom == null) + { + m_BeamGeom = Utils.NewWithComponent("Beam Geometry"); + m_BeamGeom.Initialize(this); + CallOnBeamGeometryInitializedCallback(); + } + + m_BeamGeom.RegenerateMesh(enabled); + } + + /// + /// Update the beam material and its bounds. + /// Calling manually this function is useless if your beam has its property 'trackChangesDuringPlaytime' enabled + /// (because then this function is automatically called each frame). + /// However, if 'trackChangesDuringPlaytime' is disabled, and you change a property via Script for example, + /// you need to call this function to take the property change into account. + /// All properties changes are took into account, expect 'geomSides' and 'geomCap' which require to regenerate the geometry via 'GenerateGeometry()' + /// + public virtual void UpdateAfterManualPropertyChange() + { + ValidateProperties(); + if (m_BeamGeom) m_BeamGeom.UpdateMaterialAndBounds(); + } + +#if !UNITY_EDITOR + void Start() + { + InitLightSpotAttachedCached(); + + // In standalone builds, simply generate the geometry once in Start + GenerateGeometry(); + } +#else + void Start() + { + if (Application.isPlaying) + { + InitLightSpotAttachedCached(); + GenerateGeometry(); + m_EditorDirtyFlags = EditorDirtyFlags.Clean; + } + else + { + // In Editor, creating geometry from Start and/or OnValidate generates warning in Unity 2017. + // So we do it from Update + m_EditorDirtyFlags = EditorDirtyFlags.Everything; + } + + StartPlaytimeUpdateIfNeeded(); + } + + void OnValidate() + { + m_EditorDirtyFlags |= EditorDirtyFlags.Props; // Props have been modified from Editor + } + + void Update() // EDITOR ONLY + { + EditorHandleLightPropertiesUpdate(); // Handle edition of light properties in Editor + + if (m_EditorDirtyFlags == EditorDirtyFlags.Clean) + { + if (Application.isPlaying) + { + if (!trackChangesDuringPlaytime) // during Playtime, realtime changes are handled by CoUpdateDuringPlaytime + return; + } + } + else + { + if (m_EditorDirtyFlags.HasFlag(EditorDirtyFlags.Mesh)) + { + if (m_EditorDirtyFlags.HasFlag(EditorDirtyFlags.BeamGeomGAO)) + DestroyBeam(); + + GenerateGeometry(); // regenerate everything + } + else if (m_EditorDirtyFlags.HasFlag(EditorDirtyFlags.Props)) + { + ValidateProperties(); + } + } + + // If we modify the attached Spotlight properties, or if we animate the beam via Unity 2017's timeline, + // we are not notified of properties changes. So we update the material anyway. + UpdateAfterManualPropertyChange(); + + m_EditorDirtyFlags = EditorDirtyFlags.Clean; + } + + public void Reset() + { + colorMode = Consts.Beam.ColorModeDefault; + color = Consts.Beam.FlatColor; + colorFromLight = true; + + intensityFromLight = true; + intensityModeAdvanced = false; + intensityInside = Consts.Beam.IntensityDefault; + intensityOutside = Consts.Beam.IntensityDefault; + intensityMultiplier = Consts.Beam.MultiplierDefault; + hdrpExposureWeight = Consts.Beam.HDRPExposureWeightDefault; + + blendingMode = Consts.Beam.BlendingModeDefault; + shaderAccuracy = Consts.Beam.ShaderAccuracyDefault; + + spotAngleFromLight = true; + spotAngle = Consts.Beam.SpotAngleDefault; + spotAngleMultiplier = Consts.Beam.MultiplierDefault; + + coneRadiusStart = Consts.Beam.ConeRadiusStart; + geomMeshType = Consts.Beam.GeomMeshType; + geomCustomSides = Consts.Beam.GeomSidesDefault; + geomCustomSegments = Consts.Beam.GeomSegmentsDefault; + geomCap = Consts.Beam.GeomCap; + + attenuationEquation = Consts.Beam.AttenuationEquationDefault; + attenuationCustomBlending = Consts.Beam.AttenuationCustomBlendingDefault; + + fallOffEndFromLight = true; + fallOffStart = Consts.Beam.FallOffStart; + fallOffEnd = Consts.Beam.FallOffEnd; + fallOffEndMultiplier = Consts.Beam.MultiplierDefault; + + depthBlendDistance = Consts.Beam.DepthBlendDistance; + cameraClippingDistance = Consts.Beam.CameraClippingDistance; + + glareFrontal = Consts.Beam.SD.GlareFrontalDefault; + glareBehind = Consts.Beam.SD.GlareBehindDefault; + + fresnelPow = Consts.Beam.SD.FresnelPow; + + noiseMode = Consts.Beam.NoiseModeDefault; + noiseIntensity = Consts.Beam.NoiseIntensityDefault; + noiseScaleUseGlobal = true; + noiseScaleLocal = Consts.Beam.NoiseScaleDefault; + noiseVelocityUseGlobal = true; + noiseVelocityLocal = Consts.Beam.NoiseVelocityDefault; + + sortingLayerID = 0; + sortingOrder = 0; + + fadeOutBegin = Consts.Beam.FadeOutBeginDefault; + fadeOutEnd = Consts.Beam.FadeOutEndDefault; + + dimensions = Consts.Beam.DimensionsDefault; + tiltFactor = Consts.Beam.SD.TiltDefault; + skewingLocalForwardDirection = Consts.Beam.SD.SkewingLocalForwardDirectionDefault; + clippingPlaneTransform = Consts.Beam.SD.ClippingPlaneTransformDefault; + + trackChangesDuringPlaytime = false; + + m_EditorDirtyFlags = EditorDirtyFlags.Everything; + } +#endif + + void OnEnable() + { + if (m_BeamGeom) + m_BeamGeom.OnMasterEnable(); + + StartPlaytimeUpdateIfNeeded(); + +#if UNITY_EDITOR + EditorLoadPrefs(); +#endif + } + + void OnDisable() + { + if (m_BeamGeom) + m_BeamGeom.OnMasterDisable(); + + m_CoPlaytimeUpdate = null; + } + + void StartPlaytimeUpdateIfNeeded() + { + if (Application.isPlaying && trackChangesDuringPlaytime && m_CoPlaytimeUpdate == null) + { + m_CoPlaytimeUpdate = StartCoroutine(CoPlaytimeUpdate()); + } + } + + IEnumerator CoPlaytimeUpdate() + { + while (trackChangesDuringPlaytime && enabled) + { + UpdateAfterManualPropertyChange(); + yield return null; + } + m_CoPlaytimeUpdate = null; + } + + void AssignPropertiesFromAttachedSpotLight() + { + var lightSpot = lightSpotAttached; + if (lightSpot) + { + Debug.AssertFormat(lightSpot.type == LightType.Spot, "Light attached to {0} '{1}' must be a Spot", ClassName, name); + if (intensityFromLight) + { + intensityModeAdvanced = false; + intensityGlobal = SpotLightHelper.GetIntensity(lightSpot) * intensityMultiplier; + } + + if (fallOffEndFromLight) fallOffEnd = SpotLightHelper.GetFallOffEnd(lightSpot) * fallOffEndMultiplier; + if (spotAngleFromLight) spotAngle = Mathf.Clamp(SpotLightHelper.GetSpotAngle(lightSpot) * spotAngleMultiplier, Consts.Beam.SpotAngleMin, Consts.Beam.SpotAngleMax); + if (colorFromLight) + { + colorMode = ColorMode.Flat; + +#if VLB_LIGHT_TEMPERATURE_SUPPORT + if (useColorTemperatureFromAttachedLightSpot) + { + Color colorFromTemp = Mathf.CorrelatedColorTemperatureToRGB(lightSpot.colorTemperature); + var finalColor = lightSpot.color.linear * colorFromTemp; + color = finalColor.gamma; + } + else +#endif + { + color = lightSpot.color; + } + } + } + } + + void ClampProperties() + { + intensityInside = Mathf.Max(intensityInside, Consts.Beam.IntensityMin); + intensityOutside = Mathf.Max(intensityOutside, Consts.Beam.IntensityMin); + intensityMultiplier = Mathf.Max(intensityMultiplier, Consts.Beam.MultiplierMin); + + attenuationCustomBlending = Mathf.Clamp(attenuationCustomBlending, Consts.Beam.AttenuationCustomBlendingMin, Consts.Beam.AttenuationCustomBlendingMax); + + fallOffEnd = Mathf.Max(Consts.Beam.FallOffDistancesMinThreshold, fallOffEnd); + fallOffStart = Mathf.Clamp(fallOffStart, 0f, fallOffEnd - Consts.Beam.FallOffDistancesMinThreshold); + fallOffEndMultiplier = Mathf.Max(fallOffEndMultiplier, Consts.Beam.MultiplierMin); + + spotAngle = Mathf.Clamp(spotAngle, Consts.Beam.SpotAngleMin, Consts.Beam.SpotAngleMax); + spotAngleMultiplier = Mathf.Max(spotAngleMultiplier, Consts.Beam.MultiplierMin); + coneRadiusStart = Mathf.Max(coneRadiusStart, 0f); + + depthBlendDistance = Mathf.Max(depthBlendDistance, 0f); + cameraClippingDistance = Mathf.Max(cameraClippingDistance, 0f); + + geomCustomSides = Mathf.Clamp(geomCustomSides, Consts.Beam.GeomSidesMin, Consts.Beam.GeomSidesMax); + geomCustomSegments = Mathf.Clamp(geomCustomSegments, Consts.Beam.GeomSegmentsMin, Consts.Beam.GeomSegmentsMax); + + fresnelPow = Mathf.Max(0f, fresnelPow); + + glareBehind = Mathf.Clamp(glareBehind, Consts.Beam.SD.GlareMin, Consts.Beam.SD.GlareMax); + glareFrontal = Mathf.Clamp(glareFrontal, Consts.Beam.SD.GlareMin, Consts.Beam.SD.GlareMax); + + noiseIntensity = Mathf.Clamp(noiseIntensity, Consts.Beam.NoiseIntensityMin, Consts.Beam.NoiseIntensityMax); + } + + void ValidateProperties() + { + AssignPropertiesFromAttachedSpotLight(); + ClampProperties(); + } + + void HandleBackwardCompatibility(int serializedVersion, int newVersion) + { + if (serializedVersion == -1) return; // freshly new spawned entity: nothing to do + if (serializedVersion == newVersion) return; // same version: nothing to do + + if (serializedVersion < 1301) + { + // quadratic attenuation is a new feature of 1.3 + attenuationEquation = AttenuationEquation.Linear; + } + + if (serializedVersion < 1501) + { + // custom mesh is a new feature of 1.5 + geomMeshType = MeshType.Custom; + geomCustomSegments = 5; + } + + if (serializedVersion < 1610) + { + // intensity global/advanced mode is a feature of 1.61 + intensityFromLight = false; + intensityModeAdvanced = !Mathf.Approximately(intensityInside, intensityOutside); + } + + if (serializedVersion < 1910) + { + // prevent from triggering error message if inside and outside intensity are not equal with advanced mode disabled + if(!intensityModeAdvanced && !Mathf.Approximately(intensityInside, intensityOutside)) + { + intensityInside = intensityOutside; + } + } + + Utils.MarkCurrentSceneDirty(); + } + +#if UNITY_EDITOR + public static bool editorShowTiltFactor = false; + public static bool editorShowClippingPlane = false; + private static bool editorPrefsLoaded = false; + + static void EditorLoadPrefs() + { + if (!editorPrefsLoaded) + { + editorShowTiltFactor = UnityEditor.EditorPrefs.GetBool(EditorPrefsStrings.Beam.PrefShowTiltDir, false); + editorPrefsLoaded = true; + } + } + + void OnDrawGizmos() + { +#if DEBUG_SHOW_APEX + Gizmos.matrix = transform.localToWorldMatrix; + Gizmos.color = Color.green; + Gizmos.DrawWireSphere(coneApexPositionLocal, 0.025f); +#endif + +#if DEBUG_GLOBAL_VECTORS + Debug.DrawLine(transform.position, transform.position + beamGlobalForward, Color.blue); +#endif + +#if DEBUG_GLOBAL_RAYCAST_VECTORS + Debug.DrawLine(transform.position, transform.position + raycastGlobalForward, Color.blue); + Debug.DrawLine(transform.position, transform.position + raycastGlobalRight, Color.red); + Debug.DrawLine(transform.position, transform.position + raycastGlobalUp, Color.green); +#endif + + if (editorShowTiltFactor) + { + Utils.GizmosDrawPlane( + new Vector3(tiltFactor.x, tiltFactor.y, 1.0f), + Vector3.zero, + Color.white, + transform.localToWorldMatrix, + 0.25f, + 0.5f); + } + + if (editorShowClippingPlane && clippingPlaneTransform != null) + { + float kPlaneSize = 0.7f; + Utils.GizmosDrawPlane( + Vector3.forward, + Vector3.zero, + Color.white, + clippingPlaneTransform.localToWorldMatrix, + kPlaneSize, + kPlaneSize * 0.5f); + } + } +#endif // UNITY_EDITOR + } + } diff --git a/Assets/External/VolumetricLightBeam/Scripts/SD/VolumetricLightBeamSD.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/SD/VolumetricLightBeamSD.cs.meta new file mode 100644 index 00000000..518f40b0 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SD/VolumetricLightBeamSD.cs.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: 7b69c542c9a8f4f44a3123e3fa103d13 +labels: +- volumetric +- light +- lighting +- ray +- shaft +- beam +- density +- vr +- dynamic +- spot +- spotlight +- fog +- noise +- occlusion +- procedural +timeCreated: 1507404056 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: + - m_Shader: {fileID: 4800000, guid: 936bd00b0f168d949b0c27d2be40615a, type: 3} + executionOrder: 0 + icon: {fileID: 2800000, guid: 837747a8b63291a48838c340da834873, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/SRPHelper.cs b/Assets/External/VolumetricLightBeam/Scripts/SRPHelper.cs new file mode 100644 index 00000000..92b79882 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SRPHelper.cs @@ -0,0 +1,186 @@ +#if UNITY_2018_1_OR_NEWER +#define VLB_SRP_SUPPORT // Comment this to disable SRP support +#endif + +#if VLB_SRP_SUPPORT +#if UNITY_2019_1_OR_NEWER +using AliasCurrentPipeline = UnityEngine.Rendering.RenderPipelineManager; +using AliasCameraEvents = UnityEngine.Rendering.RenderPipelineManager; +using CallbackType = System.Action; +#else +using AliasCurrentPipeline = UnityEngine.Experimental.Rendering.RenderPipelineManager; +using AliasCameraEvents = UnityEngine.Experimental.Rendering.RenderPipeline; +using CallbackType = System.Action; +#endif // UNITY_2019_1_OR_NEWER +#endif // VLB_SRP_SUPPORT + +using UnityEngine; +using System.Collections.Generic; + +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace VLB +{ + public static class SRPHelper + { + + public static string renderPipelineScriptingDefineSymbolAsString + { + get + { + #if VLB_BUILTIN + return "VLB_BUILTIN"; + #elif VLB_URP + return "VLB_URP"; + #elif VLB_HDRP + return "VLB_HDRP"; + #else + return "NO VLB Symbols"; + #endif + } + } + + public static RenderPipeline projectRenderPipeline + { + get + { + // cache the value to prevent from comparing strings (in ComputeRenderPipeline) each frame when SRPBatcher is enabled + if (!m_IsRenderPipelineCached) + { + m_RenderPipelineCached = ComputeRenderPipeline(); + m_IsRenderPipelineCached = true; + } + return m_RenderPipelineCached; + } + } + + static bool m_IsRenderPipelineCached = false; + static RenderPipeline m_RenderPipelineCached; + + static RenderPipeline ComputeRenderPipeline() + { +#if VLB_SRP_SUPPORT + var rp = UnityEngine.Rendering.GraphicsSettings.defaultRenderPipeline; + if (rp) + { + var name = rp.GetType().ToString(); + if (name.Contains("Universal")) return RenderPipeline.URP; + if (name.Contains("Lightweight")) return RenderPipeline.URP; + if (name.Contains("HD")) return RenderPipeline.HDRP; + } +#endif + return RenderPipeline.BuiltIn; + } + +#if VLB_SRP_SUPPORT + public static bool IsUsingCustomRenderPipeline() + { + // TODO: optimize and use renderPipelineType + return AliasCurrentPipeline.currentPipeline != null || UnityEngine.Rendering.GraphicsSettings.defaultRenderPipeline != null; + } + + public static void RegisterOnBeginCameraRendering(CallbackType cb) + { + if (IsUsingCustomRenderPipeline()) + { + AliasCameraEvents.beginCameraRendering -= cb; + AliasCameraEvents.beginCameraRendering += cb; + } + } + + public static void UnregisterOnBeginCameraRendering(CallbackType cb) + { + if (IsUsingCustomRenderPipeline()) + { + AliasCameraEvents.beginCameraRendering -= cb; + } + } + + #if UNITY_EDITOR + static void AppendScriptingDefineSymbols(string[] symbolsToRemove, string symbolToAdd) + { + #if UNITY_2021_2_OR_NEWER + var namedBuildTarget = UnityEditor.Build.NamedBuildTarget.FromBuildTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup); + string[] scriptingDefineSymbolsArray = null; + PlayerSettings.GetScriptingDefineSymbols(namedBuildTarget, out scriptingDefineSymbolsArray); + + var scriptingDefineSymbolsList = new List(scriptingDefineSymbolsArray); + + bool hasChanged = false; + foreach (var toRem in symbolsToRemove) + { + hasChanged |= scriptingDefineSymbolsList.Remove(toRem); + } + + if (!scriptingDefineSymbolsList.Contains(symbolToAdd)) + { + scriptingDefineSymbolsList.Add(symbolToAdd); + hasChanged = true; + } + + if (hasChanged) + { + PlayerSettings.SetScriptingDefineSymbols(namedBuildTarget, scriptingDefineSymbolsList.ToArray()); + } + #else + var scriptingDefineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup); + if (scriptingDefineSymbols == null) + scriptingDefineSymbols = ""; + + bool hasChanged = false; + foreach (var toRem in symbolsToRemove) + { + if (scriptingDefineSymbols.Contains(toRem)) + { + scriptingDefineSymbols = scriptingDefineSymbols.Replace(toRem, ""); + hasChanged = true; + } + } + + if (!scriptingDefineSymbols.Contains(symbolToAdd)) + { + if (scriptingDefineSymbols.Length > 0) + scriptingDefineSymbols += ";"; + scriptingDefineSymbols += symbolToAdd; + hasChanged = true; + } + + if (hasChanged) + { + scriptingDefineSymbols = scriptingDefineSymbols.Replace(";;", ";"); + PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, scriptingDefineSymbols); + } + #endif // UNITY_2021_2_OR_NEWER + } + + public static void SetScriptingDefineSymbolsForRenderPipeline(RenderPipeline renderPipeline) + { + var allSymbols = new List { "VLB_BUILTIN", "VLB_URP", "VLB_HDRP" }; + + string defineSymbol = ""; + switch (renderPipeline) + { + case RenderPipeline.BuiltIn: + defineSymbol = "VLB_BUILTIN"; + break; + case RenderPipeline.URP: + defineSymbol = "VLB_URP"; + break; + case RenderPipeline.HDRP: + defineSymbol = "VLB_HDRP"; + break; + } + + allSymbols.Remove(defineSymbol); + + AppendScriptingDefineSymbols(allSymbols.ToArray(), defineSymbol); + } + #endif // UNITY_EDITOR +#else + public static bool IsUsingCustomRenderPipeline() { return false; } +#endif + } +} + diff --git a/Assets/External/VolumetricLightBeam/Scripts/SRPHelper.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/SRPHelper.cs.meta new file mode 100644 index 00000000..6d46e84c --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SRPHelper.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8086b200893fe0c4e88663a09fdc78a3 +timeCreated: 1585382401 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/ShaderGenerator.cs b/Assets/External/VolumetricLightBeam/Scripts/ShaderGenerator.cs new file mode 100644 index 00000000..72347921 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/ShaderGenerator.cs @@ -0,0 +1,393 @@ +#if UNITY_EDITOR +using UnityEngine; +using UnityEngine.Rendering; +using UnityEditor; +using System.Collections; +using System.Collections.Generic; +using System.IO; + +namespace VLB +{ + public class ShaderGenerator : ScriptableObject + { + [SerializeField] TextAsset m_Base = null; + TextAsset textAssetBase { get { return m_Base; } } + + [SerializeField] TextAsset m_Pass = null; + TextAsset textAssetPass { get { return m_Pass; } } + + [SerializeField] TextAsset m_IncludesBuiltin = null; + TextAsset textAssetIncludesBuiltin { get { return m_IncludesBuiltin; } } + + [SerializeField] TextAsset m_IncludesURP = null; + TextAsset textAssetIncludesURP { get { return m_IncludesURP; } } + + [SerializeField] TextAsset m_IncludesHDRP = null; + TextAsset textAssetIncludesHDRP { get { return m_IncludesHDRP; } } + + static string GetShaderAssetName(ShaderMode shaderMode) { return string.Format("VLBGeneratedShader{0}.shader", shaderMode); } + + static string GetFolderOutputPath() + { + var assetPath = AssetDatabase.GetAssetPath(Instance); + var fullPath = Path.GetFullPath(assetPath); + var fullDir = Path.GetDirectoryName(fullPath); + return fullDir; // full path to shader generator directory + } + + public class ConfigProps + { + public RenderPipeline renderPipeline; + public RenderingMode renderingMode; + + public bool dithering; + public FeatureEnabledColorGradient colorGradient; + public bool noise3D; + + public bool dynamicOcclusion; + public bool depthBlend; + public bool meshSkewing; + public bool shaderAccuracyHigh; + + public bool cookie; + public bool shadow; + + public RaymarchingQuality[] raymarchingQualities; + } + + public static Shader Generate(ShaderMode shaderMode, ConfigProps configProps) + { + Debug.Assert(configProps != null); + + // The instance might not be accessible yet, when called from Config.OnEnable for instance if the Config is enabled before the ShaderGenerator. + // In this case we don't generate the shader right away, we store the parameters instead and we'll generate the shader in ShaderGenerator.OnEnable. + if (Instance == null) + { + AddGenerationParamOnEnable(shaderMode, configProps); + return null; + } + + return new GenShader(configProps).Generate(shaderMode); + } + + static string LoadText(TextAsset textAsset) + { + Debug.Assert(textAsset != null, "Fail to load a TextAsset, please try to reinstall the VolumetricLightBeam plugin"); + return textAsset.text; + } + + TextAsset GetTextAssetIncludes(RenderPipeline rp) + { + switch (rp) + { + case RenderPipeline.BuiltIn: + return textAssetIncludesBuiltin; + case RenderPipeline.URP: + return textAssetIncludesURP; + case RenderPipeline.HDRP: + return textAssetIncludesHDRP; + } + return null; + } + + static bool IsFogSupported(RenderPipeline rp) { return rp != RenderPipeline.HDRP; } + + enum ShaderLangage { CG, HLSL } + + static ShaderLangage GetShaderLangage(RenderPipeline rp) + { + switch (rp) + { + case RenderPipeline.BuiltIn: + return ShaderLangage.CG; + case RenderPipeline.URP: + case RenderPipeline.HDRP: + return ShaderLangage.HLSL; + } + return ShaderLangage.CG; + } + + static string GetShaderLangagePre (ShaderLangage lang) { return lang == ShaderLangage.CG ? "CGPROGRAM" : "HLSLPROGRAM"; } + static string GetShaderLangagePost(ShaderLangage lang) { return lang == ShaderLangage.CG ? "ENDCG" : "ENDHLSL"; } + + static string NewLine(string str) { return " " + str + System.Environment.NewLine; } + static string NewDefine(string define, int value = 1) { return NewLine(string.Format("#define {0} {1}", define, value)); } + static string NewInclude(string define) { return NewLine(string.Format("#include \"{0}\"", define)); } + + public class GenPass + { + CullMode m_CullMode; + + public GenPass(CullMode cullMode) + { + m_CullMode = cullMode; + } + + static void AppendMultiCompile(ref string str, bool genDefaultVariant, params string[] options) + { +#if UNITY_2019_1_OR_NEWER + const string kPrefix = "#pragma multi_compile_local"; +#else + const string kPrefix = "#pragma multi_compile"; +#endif + var newLine = kPrefix; + if(genDefaultVariant) newLine += " __"; + foreach (string opt in options) newLine += " " + opt; + str += NewLine(newLine); + } + + public string Generate(ShaderMode shaderMode, RenderPipeline rp, ConfigProps configProps, int passID, int passCount) + { + Debug.Assert(configProps != null); + var code = LoadText(Instance.textAssetPass); + + code = code.Replace("{VLB_GEN_CULLING}", m_CullMode.ToString()); + code = code.Replace("{VLB_GEN_PRAGMA_INSTANCING}", configProps.renderingMode == RenderingMode.GPUInstancing ? "#pragma multi_compile_instancing" : ""); + code = code.Replace("{VLB_GEN_PRAGMA_FOG}", IsFogSupported(rp) ? "#pragma multi_compile_fog" : ""); + + string multiCompileVariants = ""; + AppendMultiCompile(ref multiCompileVariants, true, ShaderKeywords.AlphaAsBlack); + if (configProps.noise3D) AppendMultiCompile(ref multiCompileVariants, true, ShaderKeywords.Noise3D); + switch(configProps.colorGradient) + { + case FeatureEnabledColorGradient.HighOnly: AppendMultiCompile(ref multiCompileVariants, true, ShaderKeywords.ColorGradientMatrixHigh); break; + case FeatureEnabledColorGradient.HighAndLow: AppendMultiCompile(ref multiCompileVariants, true, ShaderKeywords.ColorGradientMatrixHigh, ShaderKeywords.ColorGradientMatrixLow); break; + } + + if (shaderMode == ShaderMode.SD) + { + if (configProps.depthBlend) AppendMultiCompile(ref multiCompileVariants, true, ShaderKeywords.SD.DepthBlend); + if (configProps.dynamicOcclusion) AppendMultiCompile(ref multiCompileVariants, true, ShaderKeywords.SD.OcclusionClippingPlane, ShaderKeywords.SD.OcclusionDepthTexture); + if (configProps.meshSkewing) AppendMultiCompile(ref multiCompileVariants, true, ShaderKeywords.SD.MeshSkewing); + if (configProps.shaderAccuracyHigh) AppendMultiCompile(ref multiCompileVariants, true, ShaderKeywords.SD.ShaderAccuracyHigh); + } + else if (shaderMode == ShaderMode.HD) + { + AppendMultiCompile(ref multiCompileVariants, false, ShaderKeywords.HD.AttenuationLinear, ShaderKeywords.HD.AttenuationQuad); + if (configProps.shadow) AppendMultiCompile(ref multiCompileVariants, true, ShaderKeywords.HD.Shadow); + if (configProps.cookie) AppendMultiCompile(ref multiCompileVariants, true, ShaderKeywords.HD.CookieSingleChannel, ShaderKeywords.HD.CookieRGBA); + + if (configProps.raymarchingQualities != null) + { + Debug.Assert(configProps.raymarchingQualities.Length > 0); + var allParams = new string[configProps.raymarchingQualities.Length]; + for (int i = 0; i < configProps.raymarchingQualities.Length; ++i) + { + allParams[i] = ShaderKeywords.HD.GetRaymarchingQuality(i); + } + AppendMultiCompile(ref multiCompileVariants, false, allParams); + } + else + { + Debug.LogErrorFormat("Invalid RaymarchingQualities array during shader generation."); + } + } + + code = code.Replace("{VLB_GEN_PRAGMA_MULTI_COMPILE_VARIANTS}", multiCompileVariants); + + var lang = GetShaderLangage(rp); + code = code.Replace("{VLB_GEN_PROGRAM_PRE}", GetShaderLangagePre(lang)); + code = code.Replace("{VLB_GEN_PROGRAM_POST}", GetShaderLangagePost(lang)); + + var passPre = ""; + if (shaderMode == ShaderMode.HD) + { + passPre += NewDefine("VLB_SHADER_HD"); + + code = code.Replace("{VLB_GEN_INPUT_VS}", ""); + code = code.Replace("{VLB_GEN_INPUT_FS}", ""); + } + else + { + if (passCount > 1) + { + code = code.Replace("{VLB_GEN_INPUT_VS}", string.Format(", {0}", passID)); + code = code.Replace("{VLB_GEN_INPUT_FS}", string.Format(", {0}", passID)); + } + else + { + code = code.Replace("{VLB_GEN_INPUT_VS}", ", v.texcoord.y"); + code = code.Replace("{VLB_GEN_INPUT_FS}", ", i.cameraPosObjectSpace_outsideBeam.w"); + } + } + + if (rp != RenderPipeline.BuiltIn) + { + passPre += NewDefine("VLB_SRP_API"); + + if (configProps.renderingMode == RenderingMode.SRPBatcher) + { + passPre += NewDefine("VLB_SRP_BATCHER"); + + if (rp == RenderPipeline.URP) + { + // force enable constant buffers to fix SRP Batcher support on Android + passPre += NewLine("#pragma enable_cbuffer"); + } + } + } + + if (configProps.dithering) + { + passPre += NewDefine("VLB_DITHERING"); + } + + passPre += LoadText(Instance.GetTextAssetIncludes(rp)); + + code = code.Replace("{VLB_GEN_PRE}", passPre); + code = code.Replace("{VLB_GEN_RAYMARCHING_QUALITIES}", shaderMode == ShaderMode.HD ? GenerateRaymarchingQualities(configProps) : ""); + + return code; + } + + string GenerateRaymarchingQualities(ConfigProps enabledFeatures) + { + string str = ""; + for (int i = 0; i < enabledFeatures.raymarchingQualities.Length; ++i) + { + str += NewLine(string.Format("#if {0}", ShaderKeywords.HD.GetRaymarchingQuality(i))); + str += NewDefine(ShaderKeywords.HD.RaymarchingStepCount, enabledFeatures.raymarchingQualities[i].stepCount); + str += NewLine("#endif"); + } + return str; + } + } + + class GenShader + { + ConfigProps m_ConfigProps; + List m_Passes = new List(); + + public GenShader(ConfigProps configProps) + { + Debug.Assert(configProps != null); + m_ConfigProps = configProps; + + AddPass(CullMode.Front); + + if (configProps.renderPipeline == RenderPipeline.BuiltIn && configProps.renderingMode == RenderingMode.MultiPass) + AddPass(CullMode.Back); + } + + GenShader AddPass(CullMode cullMode) + { + m_Passes.Add(new GenPass(cullMode)); + return this; + } + + public Shader Generate(ShaderMode shaderMode) + { + var shaderName = string.Format("Hidden/VLB_{0}_{1}_{2}", shaderMode, m_ConfigProps.renderPipeline, m_ConfigProps.renderingMode); + var code = LoadText(Instance.textAssetBase); + code = code.Replace("{VLB_GEN_SHADERNAME}", shaderName); + + { + var passes = ""; + for (int i = 0; i < m_Passes.Count; ++i) + passes += m_Passes[i].Generate(shaderMode, m_ConfigProps.renderPipeline, m_ConfigProps, i, m_Passes.Count); + code = code.Replace("{VLB_GEN_PASSES}", passes); + } + + { + var includes = ""; + includes += NewInclude(GetRenderPipelineInclude(m_ConfigProps.renderPipeline)); + includes += NewInclude(GetSharedInclude(shaderMode)); + code = code.Replace("{VLB_GEN_SPECIFIC_INCLUDE}", includes); + } + + // Write shader file + var outputFolderPath = ShaderGenerator.GetFolderOutputPath(); + var outputFullPath = Path.Combine(outputFolderPath, GetShaderAssetName(shaderMode)); + try + { + File.WriteAllText(outputFullPath, code); + } + catch (System.Exception ex) + { + Debug.LogErrorFormat("Failed to generate shader {0} in folder '{1}':\n{2}", shaderName, outputFullPath, ex.Message); + return null; + } + AssetDatabase.Refresh(); + + var shader = Shader.Find(shaderName); + Debug.Assert(shader != null, string.Format("Failed to generate shader '{0}' at '{1}'", shaderName, outputFullPath)); + return shader; + } + + string GetRenderPipelineInclude(RenderPipeline rp) + { + switch(rp) + { + case RenderPipeline.BuiltIn: return "ShaderSpecificBuiltin.cginc"; + case RenderPipeline.HDRP: return "ShaderSpecificHDRP.hlsl"; + case RenderPipeline.URP: return "ShaderSpecificURP.cginc"; + } + return null; + } + + string GetSharedInclude(ShaderMode shaderMode) + { + switch (shaderMode) + { + case ShaderMode.SD: return "VolumetricLightBeamSharedSD.cginc"; + case ShaderMode.HD: return "VolumetricLightBeamSharedHD.cginc"; + } + return null; + } + } + + static ShaderGenerator FindInstance() + { + var assetGUIDs = AssetDatabase.FindAssets("ShaderGenerator"); + + foreach (var guid in assetGUIDs) + { + var path = AssetDatabase.GUIDToAssetPath(guid); + var asset = AssetDatabase.LoadAssetAtPath(path); + if (asset) + return asset; + } + return null; + } + + // Store data to generate the shader on OnEnable + static Hashtable ms_ConfigPropsOnEnable = null; + static void AddGenerationParamOnEnable(ShaderMode shaderMode, ConfigProps configProps) + { + Debug.Assert(configProps != null); + if(ms_ConfigPropsOnEnable == null) + ms_ConfigPropsOnEnable = new Hashtable(2); + ms_ConfigPropsOnEnable[shaderMode] = configProps; + } + + void OnEnable() + { + if (ms_ConfigPropsOnEnable != null && Instance != null) + { + foreach(DictionaryEntry entry in ms_ConfigPropsOnEnable) + { + var shaderMode = (ShaderMode)entry.Key; + var configProps = (ConfigProps)entry.Value; + Debug.Assert(configProps != null); + Generate(shaderMode, configProps); + } + + ms_ConfigPropsOnEnable = null; + } + } + + // Singleton management + static ShaderGenerator m_Instance = null; + static ShaderGenerator Instance + { + get + { + if (m_Instance == null) + m_Instance = FindInstance(); + return m_Instance; + } + } + } +} +#endif + diff --git a/Assets/External/VolumetricLightBeam/Scripts/ShaderGenerator.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/ShaderGenerator.cs.meta new file mode 100644 index 00000000..89fd75bb --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/ShaderGenerator.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5a0074f2031380c488da5e38151a7a47 +timeCreated: 1592812245 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/ShaderKeywords.cs b/Assets/External/VolumetricLightBeam/Scripts/ShaderKeywords.cs new file mode 100644 index 00000000..1811a10b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/ShaderKeywords.cs @@ -0,0 +1,32 @@ +namespace VLB +{ + public static class ShaderKeywords + { + public const string AlphaAsBlack = "VLB_ALPHA_AS_BLACK"; + public const string ColorGradientMatrixLow = "VLB_COLOR_GRADIENT_MATRIX_LOW"; + public const string ColorGradientMatrixHigh = "VLB_COLOR_GRADIENT_MATRIX_HIGH"; + public const string Noise3D = "VLB_NOISE_3D"; + + public static class SD + { + public const string DepthBlend = "VLB_DEPTH_BLEND"; + public const string OcclusionClippingPlane = "VLB_OCCLUSION_CLIPPING_PLANE"; + public const string OcclusionDepthTexture = "VLB_OCCLUSION_DEPTH_TEXTURE"; + public const string MeshSkewing = "VLB_MESH_SKEWING"; + public const string ShaderAccuracyHigh = "VLB_SHADER_ACCURACY_HIGH"; + } + + public static class HD + { + public const string AttenuationLinear = "VLB_ATTENUATION_LINEAR"; + public const string AttenuationQuad = "VLB_ATTENUATION_QUAD"; + public const string Shadow = "VLB_SHADOW"; + public const string CookieSingleChannel = "VLB_COOKIE_1CHANNEL"; + public const string CookieRGBA = "VLB_COOKIE_RGBA"; + + public const string RaymarchingStepCount = "VLB_RAYMARCHING_STEP_COUNT"; + public static string GetRaymarchingQuality(int id) { return "VLB_RAYMARCHING_QUALITY_" + id; } + } + } +} + diff --git a/Assets/External/VolumetricLightBeam/Scripts/ShaderKeywords.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/ShaderKeywords.cs.meta new file mode 100644 index 00000000..69fcb703 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/ShaderKeywords.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d03404178af782e419e82d8a3b973df5 +timeCreated: 1607620118 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/ShaderProperties.cs b/Assets/External/VolumetricLightBeam/Scripts/ShaderProperties.cs new file mode 100644 index 00000000..f07b7701 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/ShaderProperties.cs @@ -0,0 +1,72 @@ +using UnityEngine; + +namespace VLB +{ + public static class ShaderProperties + { + public static readonly int ConeRadius = Shader.PropertyToID("_ConeRadius"); + public static readonly int ConeGeomProps = Shader.PropertyToID("_ConeGeomProps"); + public static readonly int ColorFlat = Shader.PropertyToID("_ColorFlat"); + public static readonly int DistanceFallOff = Shader.PropertyToID("_DistanceFallOff"); + public static readonly int NoiseVelocityAndScale = Shader.PropertyToID("_NoiseVelocityAndScale"); + public static readonly int NoiseParam = Shader.PropertyToID("_NoiseParam"); + public static readonly int ColorGradientMatrix = Shader.PropertyToID("_ColorGradientMatrix"); + public static readonly int LocalToWorldMatrix = Shader.PropertyToID("_LocalToWorldMatrix"); + public static readonly int WorldToLocalMatrix = Shader.PropertyToID("_WorldToLocalMatrix"); + public static readonly int BlendSrcFactor = Shader.PropertyToID("_BlendSrcFactor"); + public static readonly int BlendDstFactor = Shader.PropertyToID("_BlendDstFactor"); + public static readonly int ZTest = Shader.PropertyToID("_ZTest"); + public static readonly int ParticlesTintColor = Shader.PropertyToID("_TintColor"); + public static readonly int HDRPExposureWeight = Shader.PropertyToID("_HDRPExposureWeight"); + + public static readonly int GlobalUsesReversedZBuffer = Shader.PropertyToID("_VLB_UsesReversedZBuffer"); + public static readonly int GlobalNoiseTex3D = Shader.PropertyToID("_VLB_NoiseTex3D"); + public static readonly int GlobalNoiseCustomTime = Shader.PropertyToID("_VLB_NoiseCustomTime"); + public static readonly int GlobalDitheringFactor = Shader.PropertyToID("_VLB_DitheringFactor"); + public static readonly int GlobalDitheringNoiseTex = Shader.PropertyToID("_VLB_DitheringNoiseTex"); + + public static class SD + { + public static readonly int FadeOutFactor = Shader.PropertyToID("_FadeOutFactor"); + public static readonly int ConeSlopeCosSin = Shader.PropertyToID("_ConeSlopeCosSin"); + public static readonly int AlphaInside = Shader.PropertyToID("_AlphaInside"); + public static readonly int AlphaOutside = Shader.PropertyToID("_AlphaOutside"); + public static readonly int AttenuationLerpLinearQuad = Shader.PropertyToID("_AttenuationLerpLinearQuad"); + public static readonly int DistanceCamClipping = Shader.PropertyToID("_DistanceCamClipping"); + public static readonly int FresnelPow = Shader.PropertyToID("_FresnelPow"); + public static readonly int GlareBehind = Shader.PropertyToID("_GlareBehind"); + public static readonly int GlareFrontal = Shader.PropertyToID("_GlareFrontal"); + public static readonly int DrawCap = Shader.PropertyToID("_DrawCap"); + public static readonly int DepthBlendDistance = Shader.PropertyToID("_DepthBlendDistance"); + public static readonly int CameraParams = Shader.PropertyToID("_CameraParams"); + + public static readonly int DynamicOcclusionClippingPlaneWS = Shader.PropertyToID("_DynamicOcclusionClippingPlaneWS"); + public static readonly int DynamicOcclusionClippingPlaneProps = Shader.PropertyToID("_DynamicOcclusionClippingPlaneProps"); + public static readonly int DynamicOcclusionDepthTexture = Shader.PropertyToID("_DynamicOcclusionDepthTexture"); + public static readonly int DynamicOcclusionDepthProps = Shader.PropertyToID("_DynamicOcclusionDepthProps"); + public static readonly int LocalForwardDirection = Shader.PropertyToID("_LocalForwardDirection"); + public static readonly int TiltVector = Shader.PropertyToID("_TiltVector"); + public static readonly int AdditionalClippingPlaneWS = Shader.PropertyToID("_AdditionalClippingPlaneWS"); + } + + public static class HD + { + public static readonly int Intensity = Shader.PropertyToID("_Intensity"); + public static readonly int SideSoftness = Shader.PropertyToID("_SideSoftness"); + public static readonly int CameraForwardOS = Shader.PropertyToID("_CameraForwardOS"); + public static readonly int CameraForwardWS = Shader.PropertyToID("_CameraForwardWS"); + public static readonly int TransformScale = Shader.PropertyToID("_TransformScale"); + + public static readonly int ShadowDepthTexture = Shader.PropertyToID("_ShadowDepthTexture"); + public static readonly int ShadowProps = Shader.PropertyToID("_ShadowProps"); + public static readonly int Jittering = Shader.PropertyToID("_Jittering"); + public static readonly int CookieTexture = Shader.PropertyToID("_CookieTexture"); + public static readonly int CookieProperties = Shader.PropertyToID("_CookieProperties"); + public static readonly int CookiePosAndScale = Shader.PropertyToID("_CookiePosAndScale"); + + public static readonly int GlobalCameraBlendingDistance = Shader.PropertyToID("_VLB_CameraBlendingDistance"); + public static readonly int GlobalJitteringNoiseTex = Shader.PropertyToID("_VLB_JitteringNoiseTex"); + } + } +} + diff --git a/Assets/External/VolumetricLightBeam/Scripts/ShaderProperties.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/ShaderProperties.cs.meta new file mode 100644 index 00000000..86788126 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/ShaderProperties.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f7c111997c90d464c94acc87b1711d59 +timeCreated: 1560540688 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/SpotLightHelper.cs b/Assets/External/VolumetricLightBeam/Scripts/SpotLightHelper.cs new file mode 100644 index 00000000..b8c5fa25 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SpotLightHelper.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +namespace VLB +{ + public static class SpotLightHelper + { + public static float GetIntensity(Light light) { return light != null ? light.intensity : 0.0f; } + public static float GetSpotAngle(Light light) { return light != null ? light.spotAngle : 0.0f; } + public static float GetFallOffEnd(Light light) { return light != null ? light.range : 0.0f; } + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/SpotLightHelper.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/SpotLightHelper.cs.meta new file mode 100644 index 00000000..1c5bc51b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/SpotLightHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0676e781913ae234287aca297db85792 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/TransformUtils.cs b/Assets/External/VolumetricLightBeam/Scripts/TransformUtils.cs new file mode 100644 index 00000000..7deb3c09 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/TransformUtils.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace VLB +{ + public static class TransformUtils + { + public struct Packed + { + public Vector3 position; + public Quaternion rotation; + public Vector3 lossyScale; + + public bool IsSame(Transform transf) + { + return transf.position == position && transf.rotation == rotation && transf.lossyScale == lossyScale; + } + } + + public static Packed GetWorldPacked(this Transform self) + { + return new Packed() + { + position = self.position, + rotation = self.rotation, + lossyScale = self.lossyScale, + }; + } + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/TransformUtils.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/TransformUtils.cs.meta new file mode 100644 index 00000000..27f627c1 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/TransformUtils.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: db47de7f89a659b49982236fc59b4e04 +timeCreated: 1578089892 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/TriggerZone.cs b/Assets/External/VolumetricLightBeam/Scripts/TriggerZone.cs new file mode 100644 index 00000000..19303d85 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/TriggerZone.cs @@ -0,0 +1,159 @@ +using UnityEngine; + +namespace VLB +{ + [DisallowMultipleComponent] + [RequireComponent(typeof(VolumetricLightBeamAbstractBase))] + [HelpURL(Consts.Help.UrlTriggerZone)] + public class TriggerZone : MonoBehaviour + { + public const string ClassName = "TriggerZone"; + + /// + /// Define if the Collider will be created as a convex trigger (not physical, most common behavior) or as a regular collider (physical). + /// + public bool setIsTrigger = true; + + /// + /// Change the length of the Collider. For example, set 2.0 to make the Collider 2x longer than the beam. Default value is 1.0. + /// + public float rangeMultiplier = 1.0f; + + enum TriggerZoneUpdateRate + { + /// Compute the Trigger Zone only once at startup + OnEnable, + /// Compute the Trigger Zone each time the dynamic occlusion has changed + OnOcclusionChange, + } + + /// + /// How often will the Trigger Zone be computed? + /// + TriggerZoneUpdateRate updateRate + { + get + { + Debug.Assert(m_Beam != null); + if(UtilsBeamProps.GetDimensions(m_Beam) == Dimensions.Dim3D) return TriggerZoneUpdateRate.OnEnable; // for 3D meshes, do it only once because it's too performance heavy + return m_DynamicOcclusionRaycasting != null ? TriggerZoneUpdateRate.OnOcclusionChange : TriggerZoneUpdateRate.OnEnable; + } + } + const int kMeshColliderNumSides = 8; + + VolumetricLightBeamAbstractBase m_Beam = null; + DynamicOcclusionRaycasting m_DynamicOcclusionRaycasting = null; + PolygonCollider2D m_PolygonCollider2D = null; + + void OnEnable() + { + m_Beam = GetComponent(); + Debug.Assert(m_Beam != null); + + m_DynamicOcclusionRaycasting = GetComponent(); + + switch(updateRate) + { + case TriggerZoneUpdateRate.OnEnable: + { + ComputeZone(); + enabled = false; + break; + } + case TriggerZoneUpdateRate.OnOcclusionChange: + { + if(m_DynamicOcclusionRaycasting) + m_DynamicOcclusionRaycasting.onOcclusionProcessed += OnOcclusionProcessed; + break; + } + } + } + + void OnOcclusionProcessed() + { + ComputeZone(); + } + + void ComputeZone() + { + if (m_Beam) + { + var coneRadiusStart = UtilsBeamProps.GetConeRadiusStart(m_Beam); + var rangeEnd = UtilsBeamProps.GetFallOffEnd(m_Beam) * rangeMultiplier; + var lerpedRadiusEnd = Mathf.LerpUnclamped(coneRadiusStart, UtilsBeamProps.GetConeRadiusEnd(m_Beam), rangeMultiplier); + + if (UtilsBeamProps.GetDimensions(m_Beam) == Dimensions.Dim3D) + { + var meshCollider = gameObject.GetOrAddComponent(); + Debug.Assert(meshCollider); + + int sides = Mathf.Min(UtilsBeamProps.GetGeomSides(m_Beam), kMeshColliderNumSides); + var mesh = MeshGenerator.GenerateConeZ_Radii_DoubleCaps( + lengthZ: rangeEnd, + radiusStart: coneRadiusStart, + radiusEnd: lerpedRadiusEnd, + numSides: kMeshColliderNumSides, + inverted: false); + mesh.hideFlags = Consts.Internal.ProceduralObjectsHideFlags; + + meshCollider.sharedMesh = mesh; + meshCollider.convex = setIsTrigger; + meshCollider.isTrigger = setIsTrigger; + } + else + { + if (m_PolygonCollider2D == null) + { + m_PolygonCollider2D = gameObject.GetOrAddComponent(); + Debug.Assert(m_PolygonCollider2D); + } + + var polyCoordsLS = new Vector2[] // polygon coord in local space + { + new Vector2(0.0f, -coneRadiusStart), + new Vector2(rangeEnd, -lerpedRadiusEnd), + new Vector2(rangeEnd, lerpedRadiusEnd), + new Vector2(0.0f, coneRadiusStart) + }; + + if (m_DynamicOcclusionRaycasting && m_DynamicOcclusionRaycasting.planeEquationWS.IsValid()) + { + var plane3dWS = m_DynamicOcclusionRaycasting.planeEquationWS; + + if (Utils.IsAlmostZero(plane3dWS.normal.z)) + { + // Compute 2 points on the plane in world space + // Use this technique instead of transforming the plane's normal to fully support scaling + + var ptOnPlane1 = plane3dWS.ClosestPointOnPlaneCustom(Vector3.zero); + var ptOnPlane2 = plane3dWS.ClosestPointOnPlaneCustom(Vector3.up); + + if(Utils.IsAlmostZero(Vector3.SqrMagnitude(ptOnPlane1 - ptOnPlane2))) + ptOnPlane1 = plane3dWS.ClosestPointOnPlaneCustom(Vector3.right); + + // Compute 2 points on the plane in local space + ptOnPlane1 = transform.InverseTransformPoint(ptOnPlane1); + ptOnPlane2 = transform.InverseTransformPoint(ptOnPlane2); + + // Compute plane equation in local space + var plane2dLS = PolygonHelper.Plane2D.FromPoints(ptOnPlane1, ptOnPlane2); + if (plane2dLS.normal.x > 0.0f) plane2dLS.Flip(); + + polyCoordsLS = plane2dLS.CutConvex(polyCoordsLS); + } + } + + m_PolygonCollider2D.points = polyCoordsLS; + m_PolygonCollider2D.isTrigger = setIsTrigger; + } + } + } + +#if UNITY_EDITOR + void OnValidate() + { + rangeMultiplier = Mathf.Max(rangeMultiplier, 0.001f); + } +#endif + } +} diff --git a/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOGaiaExtension.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/TriggerZone.cs.meta similarity index 50% rename from Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOGaiaExtension.cs.meta rename to Assets/External/VolumetricLightBeam/Scripts/TriggerZone.cs.meta index af960a45..f22afd59 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOGaiaExtension.cs.meta +++ b/Assets/External/VolumetricLightBeam/Scripts/TriggerZone.cs.meta @@ -1,12 +1,12 @@ fileFormatVersion: 2 -guid: 50df544c23aafa84584188552d7a8cd5 -timeCreated: 1462456119 -licenseType: Store +guid: 5b5217c9f8723a447824a7530d14c03d +timeCreated: 1531459125 +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: 568401c2857b94943af27dc14afca0ae, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/Utils.cs b/Assets/External/VolumetricLightBeam/Scripts/Utils.cs new file mode 100644 index 00000000..5ed61682 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/Utils.cs @@ -0,0 +1,364 @@ +using System; +using UnityEngine; + +namespace VLB +{ + public static class Utils + { + public static float ComputeConeRadiusEnd(float fallOffEnd, float spotAngle) + { + return fallOffEnd * Mathf.Tan(spotAngle * Mathf.Deg2Rad * 0.5f); + } + + public static float ComputeSpotAngle(float fallOffEnd, float coneRadiusEnd) + { + return Mathf.Atan2(coneRadiusEnd, fallOffEnd) * Mathf.Rad2Deg * 2.0f; + } + + public static void Swap(ref T a, ref T b) + { + var temp = a; + a = b; + b = temp; + } + + public static string GetPath(Transform current) + { + if (current.parent == null) + return "/" + current.name; + return GetPath(current.parent) + "/" + current.name; + } + + public static T NewWithComponent(string name) where T : Component + { + return (new GameObject(name, typeof(T))).GetComponent(); + } + + public static T GetOrAddComponent(this GameObject self) where T : Component + { + var component = self.GetComponent(); + if (component == null) + component = self.AddComponent(); + return component; + } + + public static T GetOrAddComponent(this MonoBehaviour self) where T : Component + { + return self.gameObject.GetOrAddComponent(); + } + + // Call the function for each component placed on any children (every depth), but not on itself + public static void ForeachComponentsInAnyChildrenOnly(this GameObject self, Action lambda, bool includeInactive = false) where T : Component + { + var components = self.GetComponentsInChildren(includeInactive); + foreach (var comp in components) + { + if (comp.gameObject != self) + { + lambda(comp); + } + } + } + + // Call the function for each component placed on any direct children on this GameObject + public static void ForeachComponentsInDirectChildrenOnly(this GameObject self, Action lambda, bool includeInactive = false) where T : Component + { + var components = self.GetComponentsInChildren(includeInactive); + foreach (var comp in components) + { + if (comp.transform.parent == self.transform) + { + lambda(comp); + } + } + } + + public static void SetupDepthCamera(Camera depthCamera + , float coneApexOffsetZ, float maxGeometryDistance, float coneRadiusStart, float coneRadiusEnd + , Vector3 beamLocalForward, Vector3 lossyScale, bool isScalable, Quaternion beamInternalLocalRotation + , bool shouldScaleMinNearClipPlane) + { + Debug.Assert(depthCamera); + + if(!isScalable) + lossyScale.x = lossyScale.y = 1.0f; + + float apexDist = coneApexOffsetZ; + bool isPersp = apexDist >= 0.0f; + apexDist = Mathf.Max(apexDist, 0.0f); + + depthCamera.orthographic = !isPersp; + + depthCamera.transform.localPosition = beamLocalForward * (-apexDist); + + var localRot = beamInternalLocalRotation; + if (Mathf.Sign(lossyScale.z) < 0f) localRot *= Quaternion.Euler(0f, 180f, 0f); + depthCamera.transform.localRotation = localRot; + + if (!Mathf.Approximately(lossyScale.y * lossyScale.z, 0)) + { + float kMinNearClipPlane = isPersp ? 0.1f : 0.0f; // should be the same than in shader + float absScaleZ = Mathf.Abs(lossyScale.z); + depthCamera.nearClipPlane = Mathf.Max(apexDist * absScaleZ, kMinNearClipPlane * (shouldScaleMinNearClipPlane ? absScaleZ : 1.0f)); + depthCamera.farClipPlane = (maxGeometryDistance + apexDist * (isScalable ? 1 : absScaleZ)) * (isScalable ? absScaleZ : 1); + depthCamera.aspect = Mathf.Abs(lossyScale.x / lossyScale.y); + + if (isPersp) + { + float fov = Mathf.Atan2(coneRadiusEnd * Mathf.Abs(lossyScale.y), depthCamera.farClipPlane) * Mathf.Rad2Deg * 2.0f; + Debug.Assert(fov < 180.0f); + depthCamera.fieldOfView = fov; + } + else + { + depthCamera.orthographicSize = coneRadiusStart * lossyScale.y; + } + } + } + + /// + /// true if the bit field or bit fields that are set in flags are also set in the current instance; otherwise, false. + /// + public static bool HasFlag(this Enum mask, Enum flags) // Same behavior than Enum.HasFlag is .NET 4 + { +#if DEBUG + if (mask.GetType() != flags.GetType()) + throw new System.ArgumentException(string.Format("The argument type, '{0}', is not the same as the enum type '{1}'.", flags.GetType(), mask.GetType())); +#endif + return ((int)(IConvertible)mask & (int)(IConvertible)flags) == (int)(IConvertible)flags; + } + + /// + /// Returns this vector divided by the vector passed as argument + /// + public static Vector3 Divide(this Vector3 aVector, Vector3 scale) + { + if(Mathf.Approximately(scale.x * scale.y * scale.z, 0.0f)) + return Vector3.zero; + return new Vector3(aVector.x / scale.x, aVector.y / scale.y, aVector.z / scale.z); + } + + public static Vector2 xy(this Vector3 aVector) { return new Vector2(aVector.x, aVector.y); } + public static Vector2 xz(this Vector3 aVector) { return new Vector2(aVector.x, aVector.z); } + public static Vector2 yz(this Vector3 aVector) { return new Vector2(aVector.y, aVector.z); } + public static Vector2 yx(this Vector3 aVector) { return new Vector2(aVector.y, aVector.x); } + public static Vector2 zx(this Vector3 aVector) { return new Vector2(aVector.z, aVector.x); } + public static Vector2 zy(this Vector3 aVector) { return new Vector2(aVector.z, aVector.y); } + + const float kEpsilon = 0.00001f; + public static bool Approximately(this float a, float b, float epsilon = kEpsilon) { return Mathf.Abs(a - b) < epsilon; } + public static bool Approximately(this Vector2 a, Vector2 b, float epsilon = kEpsilon) { return Vector2.SqrMagnitude(a - b) < epsilon; } + public static bool Approximately(this Vector3 a, Vector3 b, float epsilon = kEpsilon) { return Vector3.SqrMagnitude(a - b) < epsilon; } + public static bool Approximately(this Vector4 a, Vector4 b, float epsilon = kEpsilon) { return Vector4.SqrMagnitude(a - b) < epsilon; } + + public static Vector4 AsVector4(this Vector3 vec3, float w) { return new Vector4(vec3.x, vec3.y, vec3.z, w); } + public static Vector4 PlaneEquation(Vector3 normalizedNormal, Vector3 pt) { return normalizedNormal.AsVector4(-Vector3.Dot(normalizedNormal, pt)); } + + public static float GetVolumeCubic(this Bounds self) { return self.size.x * self.size.y * self.size.z; } + public static float GetMaxArea2D(this Bounds self) { return Mathf.Max(Mathf.Max(self.size.x * self.size.y, self.size.y * self.size.z), self.size.x * self.size.z); } + + public static Color Opaque(this Color self) { return new Color(self.r, self.g, self.b, 1f); } + + public static Color ComputeComplementaryColor(this Color self, bool blackAndWhite) + { + if (blackAndWhite) + { + // http://stackoverflow.com/a/3943023/112731 + return (self.r * 0.299 + self.g * 0.587 + self.b * 0.114) > (186.0f / 255) ? Color.black : Color.white; + } + + return new Color(1.0f - self.r, 1.0f - self.g, 1.0f - self.b); + } + +#if UNITY_EDITOR + public static void GizmosDrawPlane(Vector3 normal, Vector3 position, Color color, Matrix4x4 mat, float size = 1f, float normalLength = 0.0f) + { + normal = normal.normalized; + var prevMat = UnityEditor.Handles.matrix; + var prevColor = UnityEditor.Handles.color; + + UnityEditor.Handles.matrix = mat; + UnityEditor.Handles.color = color; + UnityEditor.Handles.RectangleHandleCap(0, position, Quaternion.LookRotation(normal), size, EventType.Repaint); + + if (normalLength > 0.0f) + { + UnityEditor.Handles.DrawLine(position, position + normal * normalLength); + UnityEditor.Handles.ConeHandleCap(0, position + normal * normalLength, Quaternion.LookRotation(normal), normalLength * 0.25f, EventType.Repaint); + } + + UnityEditor.Handles.matrix = prevMat; + UnityEditor.Handles.color = prevColor; + } +#endif // UNITY_EDITOR + + // Plane.Translate is not available in Unity 5 + public static Plane TranslateCustom(this Plane plane, Vector3 translation) + { + plane.distance += Vector3.Dot(translation.normalized, plane.normal) * translation.magnitude; + return plane; + } + + // Plane.ClosestPointOnPlaneCustom is not available in Unity 5 + public static Vector3 ClosestPointOnPlaneCustom(this Plane plane, Vector3 point) + { + return point - plane.GetDistanceToPoint(point) * plane.normal; + } + + public static bool IsAlmostZero(float f) { return Mathf.Abs(f) < 0.001f; } + + public static bool IsValid(this Plane plane) + { + return plane.normal.sqrMagnitude > 0.5f; + } + + public static void SetKeywordEnabled(this Material mat, string name, bool enabled) + { + if(enabled) mat.EnableKeyword(name); + else mat.DisableKeyword(name); + } + + public static void SetShaderKeywordEnabled(string name, bool enabled) + { + if (enabled) Shader.EnableKeyword(name); + else Shader.DisableKeyword(name); + } + + public static Matrix4x4 SampleInMatrix(this Gradient self, int floatPackingPrecision) + { + const int kSamplesCount = 16; + var mat = new Matrix4x4(); + for (int i = 0; i < kSamplesCount; ++i) + { + var color = self.Evaluate(Mathf.Clamp01((float)(i) / (kSamplesCount - 1))); + mat[i] = color.PackToFloat(floatPackingPrecision); + } + return mat; + } + + public static Color[] SampleInArray(this Gradient self, int samplesCount) + { + var array = new Color[samplesCount]; + for (int i = 0; i < samplesCount; ++i) + array[i] = self.Evaluate(Mathf.Clamp01((float)(i) / (samplesCount - 1))); + return array; + } + + static Vector4 Vector4_Floor(Vector4 vec) { return new Vector4(Mathf.Floor(vec.x), Mathf.Floor(vec.y), Mathf.Floor(vec.z), Mathf.Floor(vec.w)); } + + public static float PackToFloat(this Color color, int floatPackingPrecision) + { + Vector4 iVal = Vector4_Floor(color * (floatPackingPrecision - 1)); + + float output = 0; + + output += iVal.x * floatPackingPrecision * floatPackingPrecision * floatPackingPrecision; + output += iVal.y * floatPackingPrecision * floatPackingPrecision; + output += iVal.z * floatPackingPrecision; + output += iVal.w; + + return output; + } + + public enum FloatPackingPrecision { High = 64, Low = 8, Undef = 0 } + static FloatPackingPrecision ms_FloatPackingPrecision = FloatPackingPrecision.Undef; + + // OpenGL ES 2.0 GPU (graphicsShaderLevel = 30) usually have low float precision (16 bits on fragments) + // So we lower the float packing precision on them (8 seems fine on Adreno (TM) 220, NVIDIA Tegra 3 and on Mali-450 MP) + // https://docs.unity3d.com/Manual/SL-DataTypesAndPrecision.html + const int kFloatPackingHighMinShaderLevel = 35; + + public static FloatPackingPrecision GetFloatPackingPrecision() + { + if (ms_FloatPackingPrecision == FloatPackingPrecision.Undef) + { + ms_FloatPackingPrecision = SystemInfo.graphicsShaderLevel >= kFloatPackingHighMinShaderLevel ? FloatPackingPrecision.High : FloatPackingPrecision.Low; + } + return ms_FloatPackingPrecision; + } + + /// + /// true if at least one of the bit of 'flags' is also set in the current instance; otherwise, false. + /// + public static bool HasAtLeastOneFlag(this Enum mask, Enum flags) + { +#if DEBUG + if (mask.GetType() != flags.GetType()) + throw new System.ArgumentException(string.Format("The argument type, '{0}', is not the same as the enum type '{1}'.", flags.GetType(), mask.GetType())); +#endif + return ((int)(IConvertible)mask & (int)(IConvertible)flags) != 0; + } + + public static void MarkCurrentSceneDirty() + { +#if UNITY_EDITOR + if (!Application.isPlaying) + { + UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene()); + } +#endif + } + + public static void MarkObjectDirty(UnityEngine.Object obj) + { +#if UNITY_EDITOR + if (!Application.isPlaying) + { + UnityEditor.EditorUtility.SetDirty(obj); + } +#endif + } + +#if UNITY_EDITOR + public static void _EditorSetAllBeamGeomDirty() + { + VolumetricLightBeamSD._EditorSetAllBeamGeomDirty(); + VolumetricLightBeamHD._EditorSetAllBeamGeomDirty(); + } + + public static void _EditorSetAllMeshesDirty() + { + VolumetricLightBeamSD._EditorSetAllMeshesDirty(); + VolumetricLightBeamHD._EditorSetAllMeshesDirty(); + } + + public static bool IsEditorCamera(Camera cam) + { + var sceneView = UnityEditor.SceneView.currentDrawingSceneView; + if (sceneView) + { + return cam == sceneView.camera; + } + return false; + } + + public static void SetSameSceneVisibilityStatesThan(this GameObject self, GameObject model) + { + // SceneVisibilityManager is a feature available from 2019.2, but fixed for transient objects only from 2019.3.14f1 + // https://issuetracker.unity3d.com/issues/toggling-of-picking-and-visibility-flags-of-a-gameobject-is-ignored-when-gameobject-dot-hideflags-is-set-to-hideflags-dot-dontsave + #if UNITY_2019_3_OR_NEWER + bool pickingDisabled = UnityEditor.SceneVisibilityManager.instance.IsPickingDisabled(model); + self.SetScenePickabilityState(!pickingDisabled); + + bool hidden = UnityEditor.SceneVisibilityManager.instance.IsHidden(model); + self.SetSceneVisibilityState(!hidden); + #endif // UNITY_2019_3_OR_NEWER + } + +#if UNITY_2019_3_OR_NEWER + public static void SetScenePickabilityState(this GameObject self, bool pickable) + { + if (pickable) UnityEditor.SceneVisibilityManager.instance.EnablePicking(self, true); + else UnityEditor.SceneVisibilityManager.instance.DisablePicking(self, true); + } + + public static void SetSceneVisibilityState(this GameObject self, bool visible) + { + if (visible) UnityEditor.SceneVisibilityManager.instance.Show(self, true); + else UnityEditor.SceneVisibilityManager.instance.Hide(self, true); + } +#endif // UNITY_2019_3_OR_NEWER +#endif // UNITY_EDITOR + } + +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/Utils.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/Utils.cs.meta new file mode 100644 index 00000000..6c853aa3 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/Utils.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8a3c52d4dd2a02a4499d1c94fcc9c542 +timeCreated: 1504688222 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/UtilsBeamProps.cs b/Assets/External/VolumetricLightBeam/Scripts/UtilsBeamProps.cs new file mode 100644 index 00000000..f5a1ca69 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/UtilsBeamProps.cs @@ -0,0 +1,172 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace VLB +{ + public static class UtilsBeamProps + { + public static bool CanChangeDuringPlaytime(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.trackChangesDuringPlaytime; + return true; + } + + public static Quaternion GetInternalLocalRotation(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.beamInternalLocalRotation; + + var hd = self as VolumetricLightBeamHD; + if (hd) return hd.beamInternalLocalRotation; + + return Quaternion.identity; + } + + public static float GetThickness(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return Mathf.Clamp01(1 - (sd.fresnelPow / Consts.Beam.SD.FresnelPowMaxValue)); + + var hd = self as VolumetricLightBeamHD; + if (hd) return Mathf.Clamp01(1 - (hd.sideSoftness / Consts.Beam.HD.SideSoftnessMax)); + + return 0f; + } + + public static float GetFallOffEnd(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.fallOffEnd; + + var hd = self as VolumetricLightBeamHD; + if (hd) return hd.fallOffEnd; + + return 0f; + } + + public static ColorMode GetColorMode(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.usedColorMode; + + var hd = self as VolumetricLightBeamHD; + if (hd) return hd.colorMode; + + return ColorMode.Flat; + } + + public static Color GetColorFlat(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.color; + + var hd = self as VolumetricLightBeamHD; + if (hd) return hd.colorFlat; + + return Color.white; + } + + public static Gradient GetColorGradient(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.colorGradient; + + var hd = self as VolumetricLightBeamHD; + if (hd) return hd.colorGradient; + + return null; + } + + public static float GetConeAngle(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.coneAngle; + + var hd = self as VolumetricLightBeamHD; + if (hd) return hd.coneAngle; + + return 0f; + } + + public static float GetConeRadiusStart(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.coneRadiusStart; + + var hd = self as VolumetricLightBeamHD; + if (hd) return hd.coneRadiusStart; + + return 0f; + } + + public static float GetConeRadiusEnd(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.coneRadiusEnd; + + var hd = self as VolumetricLightBeamHD; + if (hd) return hd.coneRadiusEnd; + + return 0f; + } + + public static int GetSortingLayerID(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.sortingLayerID; + + var hd = self as VolumetricLightBeamHD; + if (hd) return hd.GetSortingLayerID(); + + return 0; + } + + public static int GetSortingOrder(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.sortingOrder; + + var hd = self as VolumetricLightBeamHD; + if (hd) return hd.GetSortingOrder(); + + return 0; + } + + public static bool GetFadeOutEnabled(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.isFadeOutEnabled; + + return false; + } + + public static float GetFadeOutEnd(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.fadeOutEnd; + + return 0f; + } + + public static Dimensions GetDimensions(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.dimensions; + + var hd = self as VolumetricLightBeamHD; + if (hd) return hd.GetDimensions(); + + return Dimensions.Dim3D; + } + + public static int GetGeomSides(VolumetricLightBeamAbstractBase self) + { + var sd = self as VolumetricLightBeamSD; + if (sd) return sd.geomSides; + + return Config.Instance.sharedMeshSides; + } + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/UtilsBeamProps.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/UtilsBeamProps.cs.meta new file mode 100644 index 00000000..58c102c8 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/UtilsBeamProps.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b8743021f0ebd534481226847acc7f8d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/Version.cs b/Assets/External/VolumetricLightBeam/Scripts/Version.cs new file mode 100644 index 00000000..da7abb86 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/Version.cs @@ -0,0 +1,22 @@ +namespace VLB +{ + public static class Version + { + public const int Current = 20100; + + public static string CurrentAsString => GetVersionAsString(Current); + + static string GetVersionAsString(int version) + { + const int n1Mult = 10000; + const int n2Mult = 100; + const int n3Mult = 1; + + int n1 = (int)(version / n1Mult); + int n2 = (int)((version - n1 * n1Mult) / n2Mult); + int n3 = (int)((version - n1 * n1Mult - n2 * n2Mult) / n3Mult); + + return string.Format("{0}.{1}.{2}", n1, n2, n3); + } + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/Version.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/Version.cs.meta new file mode 100644 index 00000000..3c4dfe77 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/Version.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c62ea6a423ab5824c9d344b83ee9706e +timeCreated: 1507996747 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/VolumetricDustParticles.cs b/Assets/External/VolumetricLightBeam/Scripts/VolumetricDustParticles.cs new file mode 100644 index 00000000..144c6199 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/VolumetricDustParticles.cs @@ -0,0 +1,407 @@ +using UnityEngine; + +namespace VLB +{ + [ExecuteInEditMode] + [DisallowMultipleComponent] + [RequireComponent(typeof(VolumetricLightBeamAbstractBase))] + [HelpURL(Consts.Help.UrlDustParticles)] + public class VolumetricDustParticles : MonoBehaviour + { + public const string ClassName = "VolumetricDustParticles"; + + /// + /// Max alpha of the particles + /// + [Range(0f, 1f)] + public float alpha = Consts.DustParticles.AlphaDefault; + + /// + /// Max size of the particles + /// + [Range(0.0001f, 0.1f)] + public float size = Consts.DustParticles.SizeDefault; + + /// + /// Direction of the particles. + /// + public ParticlesDirection direction = Consts.DustParticles.DirectionDefault; + + /// + /// Movement speed of the particles. + /// + public Vector3 velocity = Consts.DustParticles.VelocityDefault; + + [System.Obsolete("Use 'velocity' instead")] + public float speed = 0.03f; + + /// + /// Control how many particles are spawned. The higher the density, the more particles are spawned, the higher the performance cost is. + /// + public float density = Consts.DustParticles.DensityDefault; + + /// + /// The distance range (from the light source) where the particles are spawned. + /// - Min bound: the higher it is, the more the particles are spawned away from the light source. + /// - Max bound: the lower it is, the more the particles are gathered near the light source. + /// + [MinMaxRange(0.0f, 1.0f)] + public MinMaxRangeFloat spawnDistanceRange = Consts.DustParticles.SpawnDistanceRangeDefault; + + [System.Obsolete("Use 'spawnDistanceRange' instead")] + public float spawnMinDistance = 0f; + + [System.Obsolete("Use 'spawnDistanceRange' instead")] + public float spawnMaxDistance = 0.7f; + + /// + /// Enable particles culling based on the distance to the Main Camera. + /// We highly recommend to enable this feature to keep good runtime performances. + /// + public bool cullingEnabled = Consts.DustParticles.CullingEnabledDefault; + + /// + /// If culling is enabled, the particles will not be rendered if they are further than cullingMaxDistance to the Main Camera. + /// + public float cullingMaxDistance = Consts.DustParticles.CullingMaxDistanceDefault; + + /// + /// Is the particle system currently culled (no visible) because too far from the main camera? + /// + public bool isCulled { get; private set; } + + + [SerializeField] float m_AlphaAdditionalRuntime = 1.0f; + public float alphaAdditionalRuntime + { + get { return m_AlphaAdditionalRuntime; } + set { if (m_AlphaAdditionalRuntime != value) { m_AlphaAdditionalRuntime = value; m_RuntimePropertiesDirty = true; } } + } + + public bool particlesAreInstantiated { get { return m_Particles; } } + public int particlesCurrentCount { get { return m_Particles ? m_Particles.particleCount : 0; } } + public int particlesMaxCount { get { return m_Particles ? m_Particles.main.maxParticles : 0; } } + ParticleSystem m_Particles = null; + ParticleSystemRenderer m_Renderer = null; + Material m_Material = null; + Gradient m_GradientCached = new Gradient(); + bool m_RuntimePropertiesDirty = true; + + + /// Cached version of Camera.main, for performance reasons + public Camera mainCamera + { + get + { + if (!ms_MainCamera) + { + ms_MainCamera = Camera.main; + if (!ms_MainCamera && !ms_NoMainCameraLogged) + { + Debug.LogErrorFormat(gameObject, "In order to use '" + VolumetricDustParticles.ClassName + "' culling, you must have a MainCamera defined in your scene."); + ms_NoMainCameraLogged = true; + } + } + + return ms_MainCamera; + } + } + + // Cache the main camera, because accessing Camera.main at each frame is very bad performance-wise + static bool ms_NoMainCameraLogged = false; + static Camera ms_MainCamera = null; + +#if UNITY_EDITOR + void OnValidate() + { + density = Mathf.Clamp(density, Consts.DustParticles.DensityMin, Consts.DustParticles.DensityMax); + cullingMaxDistance = Mathf.Max(cullingMaxDistance, Consts.DustParticles.CullingMaxDistanceMin); + Play(); // support instant refresh when modifying properties from inspector + } +#endif // UNITY_EDITOR + + VolumetricLightBeamAbstractBase m_Master = null; + + void Start() + { + isCulled = false; + + m_Master = GetComponent(); + Debug.Assert(m_Master); + HandleBackwardCompatibility(m_Master._INTERNAL_pluginVersion, Version.Current); + + InstantiateParticleSystem(); + + SetActiveAndPlay(); + } + + void InstantiateParticleSystem() + { + // If we duplicate (from Editor and Playmode) the VLB, the children are also duplicated (like the dust particles) + // we have to make sure to properly destroy them before creating our proper procedural particle instance. + gameObject.ForeachComponentsInDirectChildrenOnly(ps => DestroyImmediate(ps.gameObject), true); + + m_Particles = Config.Instance.NewVolumetricDustParticles(); + + if (m_Particles) + { +#if UNITY_EDITOR + if (m_Master) + { + UnityEditor.GameObjectUtility.SetStaticEditorFlags(m_Particles.gameObject, m_Master.GetStaticEditorFlagsForSubObjects()); + m_Particles.gameObject.SetSameSceneVisibilityStatesThan(m_Master.gameObject); + } +#endif // UNITY_EDITOR + m_Particles.transform.SetParent(transform, false); + + m_Renderer = m_Particles.GetComponent(); + Debug.Assert(m_Renderer); + + m_Material = new Material(m_Renderer.sharedMaterial); + Debug.Assert(m_Material); + m_Renderer.material = m_Material; + } + } + + void OnEnable() + { + SetActiveAndPlay(); + } + + void SetActive(bool active) + { + if (m_Particles) m_Particles.gameObject.SetActive(active); + } + + void SetActiveAndPlay() + { + SetActive(true); + Play(); + } + + void Play() + { + if (m_Particles) + { + SetParticleProperties(); + m_Particles.Simulate(0f); + m_Particles.Play(true); + } + } + + void OnDisable() + { + SetActive(false); + } + + void OnDestroy() + { + if (m_Particles) + { + DestroyImmediate(m_Particles.gameObject); // Make sure to delete the GAO + m_Particles = null; + } + + if (m_Material) + { + DestroyImmediate(m_Material); + m_Material = null; + } + } + + void Update() + { +#if UNITY_EDITOR + if(!Application.isPlaying) + { + if (m_Particles == null) + InstantiateParticleSystem(); + + Play(); + } + else +#endif // UNITY_EDITOR + { + UpdateCulling(); + + if (UtilsBeamProps.CanChangeDuringPlaytime(m_Master)) + SetParticleProperties(); + } + + if (m_RuntimePropertiesDirty && m_Material != null) + { + m_Material.SetColor(ShaderProperties.ParticlesTintColor, new Color(1.0f, 1.0f, 1.0f, alphaAdditionalRuntime)); + m_RuntimePropertiesDirty = false; + } + } + + void SetParticleProperties() + { + if (m_Particles && m_Particles.gameObject.activeSelf) + { + // set these props here instead of from InstantiateParticleSystem to support dimension change in editor + m_Particles.transform.localRotation = UtilsBeamProps.GetInternalLocalRotation(m_Master); + m_Particles.transform.localScale = m_Master.IsScalable() ? Vector3.one : Vector3.one.Divide(m_Master.GetLossyScale()); + + var coneLength = UtilsBeamProps.GetFallOffEnd(m_Master) * (spawnDistanceRange.maxValue - spawnDistanceRange.minValue); + var ratePerSec = coneLength * density; + int maxParticles = (int)(ratePerSec * 4); + + var main = m_Particles.main; + + var startLifetime = main.startLifetime; + startLifetime.mode = ParticleSystemCurveMode.TwoConstants; + startLifetime.constantMin = 4f; + startLifetime.constantMax = 6f; + main.startLifetime = startLifetime; + + var startSize = main.startSize; + startSize.mode = ParticleSystemCurveMode.TwoConstants; + startSize.constantMin = size * 0.9f; + startSize.constantMax = size * 1.1f; + main.startSize = startSize; + + var startColor = main.startColor; + + if (UtilsBeamProps.GetColorMode(m_Master) == ColorMode.Flat) + { + startColor.mode = ParticleSystemGradientMode.Color; + var colorMax = UtilsBeamProps.GetColorFlat(m_Master); + colorMax.a *= alpha; + startColor.color = colorMax; + } + else + { + startColor.mode = ParticleSystemGradientMode.Gradient; + + // Duplicate gradient and apply alpha + var gradientRef = UtilsBeamProps.GetColorGradient(m_Master); + Debug.Assert(gradientRef != null); + var colorKeys = gradientRef.colorKeys; + var alphaKeys = gradientRef.alphaKeys; + + for(int i=0; i< alphaKeys.Length; ++i) + alphaKeys[i].alpha *= alpha; + + Debug.Assert(m_GradientCached != null); + m_GradientCached.SetKeys(colorKeys, alphaKeys); + startColor.gradient = m_GradientCached; + } + main.startColor = startColor; + + { + var startSpeed = main.startSpeed; + startSpeed.constant = (direction == ParticlesDirection.Random) ? Mathf.Abs(velocity.z) : 0.0f; + main.startSpeed = startSpeed; + } + + { + var velocityOverLifetime = m_Particles.velocityOverLifetime; + velocityOverLifetime.enabled = (direction != ParticlesDirection.Random); + velocityOverLifetime.space = (direction == ParticlesDirection.LocalSpace) ? ParticleSystemSimulationSpace.Local : ParticleSystemSimulationSpace.World; + velocityOverLifetime.xMultiplier = velocity.x; + velocityOverLifetime.yMultiplier = velocity.y; + velocityOverLifetime.zMultiplier = velocity.z; + } + + main.maxParticles = maxParticles; + + { + float thickness = UtilsBeamProps.GetThickness(m_Master); + float fallOffEnd = UtilsBeamProps.GetFallOffEnd(m_Master); + + var shape = m_Particles.shape; + shape.shapeType = ParticleSystemShapeType.ConeVolume; + + float coneAngle = UtilsBeamProps.GetConeAngle(m_Master) * Mathf.Lerp(0.7f, 1f, thickness); + shape.angle = coneAngle * 0.5f; + + float radiusStart = UtilsBeamProps.GetConeRadiusStart(m_Master) * Mathf.Lerp(0.3f, 1.0f, thickness); + float radiusEnd = Utils.ComputeConeRadiusEnd(fallOffEnd, coneAngle); + shape.radius = Mathf.Lerp(radiusStart, radiusEnd, spawnDistanceRange.minValue); + + shape.length = coneLength; + + var localOffset = fallOffEnd * spawnDistanceRange.minValue; +#if UNITY_2017_1_OR_NEWER + shape.position = new Vector3(0f, 0f, localOffset); +#else + m_Particles.transform.localPosition = m_Master.beamLocalForward * localOffset; +#endif + shape.arc = 360f; + shape.randomDirectionAmount = (direction == ParticlesDirection.Random) ? 1f : 0f; + } + + var emission = m_Particles.emission; + var rate = emission.rateOverTime; + rate.constant = ratePerSec; + emission.rateOverTime = rate; + + if(m_Renderer) + { + m_Renderer.sortingLayerID = UtilsBeamProps.GetSortingLayerID(m_Master); + m_Renderer.sortingOrder = UtilsBeamProps.GetSortingOrder(m_Master); + } + } + } + + void HandleBackwardCompatibility(int serializedVersion, int newVersion) + { + if (serializedVersion == -1) return; // freshly new spawned entity: nothing to do + if (serializedVersion == newVersion) return; // same version: nothing to do + +#pragma warning disable 0618 + if (serializedVersion < 1880) + { + // Version 1880 changed the order of ParticlesDirection enum and add WorldSpace option + if ((int)direction == 0) direction = (ParticlesDirection)1; + else direction = (ParticlesDirection)0; + + // Version 1880 changed from single float speed to 3D velocity vector + velocity = new Vector3(0.0f, 0.0f, speed); + } + + if (serializedVersion < 1940) + { + spawnDistanceRange = new MinMaxRangeFloat(spawnMinDistance, spawnMaxDistance); + } +#pragma warning restore 0618 + + Utils.MarkCurrentSceneDirty(); + } + + #region Culling + void UpdateCulling() + { + if (m_Particles) + { + bool visible = true; + bool isFadeOutEnabled = UtilsBeamProps.GetFadeOutEnabled(m_Master); + if ((cullingEnabled || isFadeOutEnabled) && m_Master.hasGeometry) + { + if (mainCamera) + { + var maxDist = cullingMaxDistance; + if(isFadeOutEnabled) maxDist = Mathf.Min(maxDist, UtilsBeamProps.GetFadeOutEnd(m_Master)); + var maxDistSqr = maxDist * maxDist; + var distSqr = m_Master.bounds.SqrDistance(mainCamera.transform.position); + visible = distSqr <= maxDistSqr; + } + else + cullingEnabled = false; + } + + if (m_Particles.gameObject.activeSelf != visible) + { + SetActive(visible); + isCulled = !visible; + } + + if (visible && !m_Particles.isPlaying) + m_Particles.Play(); + } + } + #endregion + } +} + diff --git a/Assets/External/VolumetricLightBeam/Scripts/VolumetricDustParticles.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/VolumetricDustParticles.cs.meta new file mode 100644 index 00000000..34bce08c --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/VolumetricDustParticles.cs.meta @@ -0,0 +1,28 @@ +fileFormatVersion: 2 +guid: e39f0f7e17f11f2448932da58e9b63d4 +labels: +- volumetric +- light +- lighting +- ray +- shaft +- beam +- density +- vr +- dynamic +- spot +- spotlight +- fog +- noise +- occlusion +- procedural +timeCreated: 1511563236 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 54d50eb83191723439a591eeeb0eab84, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Scripts/VolumetricLightBeamAbstractBase.cs b/Assets/External/VolumetricLightBeam/Scripts/VolumetricLightBeamAbstractBase.cs new file mode 100644 index 00000000..c83d95bb --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/VolumetricLightBeamAbstractBase.cs @@ -0,0 +1,136 @@ +using UnityEngine; + +namespace VLB +{ + public abstract class VolumetricLightBeamAbstractBase : MonoBehaviour + { + public const string ClassName = "VolumetricLightBeamAbstractBase"; + + public abstract BeamGeometryAbstractBase GetBeamGeometry(); + protected abstract void SetBeamGeometryNull(); + + /// Has the geometry already been generated? + public bool hasGeometry { get { return GetBeamGeometry() != null; } } + + /// Bounds of the geometry's mesh (if the geometry exists) + public Bounds bounds { get { return GetBeamGeometry() != null ? GetBeamGeometry().meshRenderer.bounds : new Bounds(Vector3.zero, Vector3.zero); } } + + public abstract bool IsScalable(); + public abstract Vector3 GetLossyScale(); + + // INTERNAL +#pragma warning disable 0414 + [SerializeField] protected int pluginVersion = -1; + public int _INTERNAL_pluginVersion => pluginVersion; +#pragma warning restore 0414 + + public enum AttachedLightType { NoLight, OtherLight, SpotLight } + public Light GetLightSpotAttachedSlow(out AttachedLightType lightType) + { + var light = GetComponent(); + if (light) + { + if (light.type == LightType.Spot) + { + lightType = AttachedLightType.SpotLight; + return light; + } + else + { + lightType = AttachedLightType.OtherLight; + return null; + } + } + + lightType = AttachedLightType.NoLight; + return null; + } + + protected Light m_CachedLightSpot = null; + public Light lightSpotAttached + { + get + { +#if UNITY_EDITOR + if (!Application.isPlaying) { AttachedLightType lightType; return GetLightSpotAttachedSlow(out lightType); } +#endif + return m_CachedLightSpot; + } + } + + protected void InitLightSpotAttachedCached() + { + Debug.Assert(Application.isPlaying); + AttachedLightType lightType; + m_CachedLightSpot = GetLightSpotAttachedSlow(out lightType); + } + + void OnDestroy() + { + DestroyBeam(); + } + + protected void DestroyBeam() + { + // do not destroy the beam GAO here in editor to prevent crash when we undo placing a beam in a prefab (with Unity 2021.3 and 2022.1) + // in editor, we delete the beam GAO through BeamGeometryAbstractBase.Update instead + if (Application.isPlaying) + BeamGeometryAbstractBase.DestroyBeamGeometryGameObject(GetBeamGeometry()); // Make sure to delete the GAO + SetBeamGeometryNull(); + } + +#if UNITY_EDITOR + public abstract Color ComputeColorAtDepth(float depthRatio); + + public abstract int _EDITOR_GetInstancedMaterialID(); + + + [System.Flags] + protected enum EditorDirtyFlags + { + Clean = 0, + Props = 1 << 1, + Mesh = 1 << 2, + BeamGeomGAO = 1 << 3, + FullBeamGeomGAO = Mesh | BeamGeomGAO, + Everything = Props | Mesh | BeamGeomGAO, + } + protected EditorDirtyFlags m_EditorDirtyFlags; + protected CachedLightProperties m_PrevCachedLightProperties; + + protected void EditorHandleLightPropertiesUpdate() + { + // Handle edition of light properties in Editor + if (!Application.isPlaying) + { + var newProps = new CachedLightProperties(lightSpotAttached); + if (!newProps.Equals(m_PrevCachedLightProperties)) + m_EditorDirtyFlags |= EditorDirtyFlags.Props; + m_PrevCachedLightProperties = newProps; + } + } + + public UnityEditor.StaticEditorFlags GetStaticEditorFlagsForSubObjects() + { + // Apply the same static flags to the BeamGeometry and DustParticles than the VLB GAO + var flags = UnityEditor.GameObjectUtility.GetStaticEditorFlags(gameObject); + flags &= ~( + // remove the Lightmap static flag since it will generate error messages when selecting the BeamGeometry GAO in the editor +#if UNITY_2019_2_OR_NEWER + UnityEditor.StaticEditorFlags.ContributeGI +#else + UnityEditor.StaticEditorFlags.LightmapStatic +#endif + | UnityEditor.StaticEditorFlags.NavigationStatic + | UnityEditor.StaticEditorFlags.OffMeshLinkGeneration + | UnityEditor.StaticEditorFlags.OccluderStatic + ); + return flags; + } + + public bool _EditorIsDirty() { return m_EditorDirtyFlags != EditorDirtyFlags.Clean; } + public void _EditorSetMeshDirty() { m_EditorDirtyFlags |= EditorDirtyFlags.Mesh; } + public void _EditorSetBeamGeomDirty() { m_EditorDirtyFlags |= EditorDirtyFlags.FullBeamGeomGAO; } +#endif // UNITY_EDITOR + } +} diff --git a/Assets/External/VolumetricLightBeam/Scripts/VolumetricLightBeamAbstractBase.cs.meta b/Assets/External/VolumetricLightBeam/Scripts/VolumetricLightBeamAbstractBase.cs.meta new file mode 100644 index 00000000..8bcf77be --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Scripts/VolumetricLightBeamAbstractBase.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 35f4cfd37c916f345955c1c6e8bf2c17 +timeCreated: 1646306834 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders.meta b/Assets/External/VolumetricLightBeam/Shaders.meta similarity index 77% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders.meta rename to Assets/External/VolumetricLightBeam/Shaders.meta index a2dea7d0..51e006af 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders.meta +++ b/Assets/External/VolumetricLightBeam/Shaders.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 39ee3648c2c58684590305025db692f6 +guid: 6804da7de883dab4c8240fcea05a6b5a folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderDefines.cginc b/Assets/External/VolumetricLightBeam/Shaders/ShaderDefines.cginc new file mode 100644 index 00000000..e9e03fc5 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderDefines.cginc @@ -0,0 +1,80 @@ +// UNITY_SHADER_NO_UPGRADE + +#ifndef _VLB_SHADER_DEFINES_INCLUDED_ +#define _VLB_SHADER_DEFINES_INCLUDED_ + +/// **************************************** +/// GLOBAL DEFINES +/// **************************************** +#if UNITY_VERSION < 201810 // SRP support introduced in Unity 2018.1.0 +#undef VLB_SRP_API +#endif + +#if UNITY_VERSION >= 560 // Instancing API introduced in Unity 5.6 +#define VLB_INSTANCING_API_AVAILABLE 1 + +#if defined(INSTANCING_ON) +#define VLB_GPU_INSTANCING 1 +#endif + +#endif + +#if UNITY_VERSION >= 550 // Single Pass Instanced rendering introduced in Unity 5.5 +#define VLB_STEREO_INSTANCING 1 +#endif + +#if VLB_SRP_API && VLB_INSTANCING_API_AVAILABLE && VLB_GPU_INSTANCING +// When using SRP API and GPU Instancing, the unity_WorldToObject and unity_ObjectToWorld matrices are not sent, so we have to manually send them +#define VLB_CUSTOM_INSTANCED_OBJECT_MATRICES 1 +#endif + +#if VLB_COLOR_GRADIENT_MATRIX_HIGH || VLB_COLOR_GRADIENT_MATRIX_LOW +#define VLB_COLOR_GRADIENT 1 +#else +#define VLB_COLOR_FLAT 1 +#endif +/// **************************************** + +/// **************************************** +/// DEBUG +/// **************************************** +#define DEBUG_VALUE_DEPTHBUFFER_FROMEYE 1 +#define DEBUG_VALUE_DEPTHBUFFER_FROMNEARPLANE 2 +#define DEBUG_VALUE_DEPTHBLEND 3 +#define DEBUG_VALUE_DEPTHSTEREOEYE 4 +#define DEBUG_VALUE_LINEAR_OVERFLOW 5 +#define DEBUG_VALUE_SHADOW_DEPTH 6 +//#define DEBUG_DEPTH_MODE DEBUG_VALUE_SHADOW_DEPTH +//#define DEBUG_SHOW_NOISE3D 1 +//#define DEBUG_BLEND_INSIDE_OUTSIDE 1 + +#if DEBUG_DEPTH_MODE && !VLB_DEPTH_BLEND +#define VLB_DEPTH_BLEND 1 +#endif + +#if DEBUG_SHOW_NOISE3D && !VLB_NOISE_3D +#define VLB_NOISE_3D 1 +#endif +/// **************************************** + +/// **************************************** +/// OPTIM +/// **************************************** +/// compute most of the intensity in VS => huge perf improvements +#if !VLB_SHADER_ACCURACY_HIGH +#define OPTIM_VS 1 +#endif + +/// when OPTIM_VS is enabled, also compute fresnel in VS => better perf, +/// but require too much tessellation for the same quality +//#define OPTIM_VS_FRESNEL_VS 1 +/// **************************************** + +/// **************************************** +/// FIXES +/// **************************************** +#define FIX_DISABLE_DEPTH_BLEND_WITH_OBLIQUE_PROJ 1 +/// **************************************** + + +#endif diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderDefines.cginc.meta b/Assets/External/VolumetricLightBeam/Shaders/ShaderDefines.cginc.meta new file mode 100644 index 00000000..15f5b57f --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderDefines.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 49653fbebfba49948a7dd9821fc64690 +timeCreated: 1578601843 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderGenerator.asset b/Assets/External/VolumetricLightBeam/Shaders/ShaderGenerator.asset new file mode 100644 index 00000000..d149df46 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderGenerator.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a475825dcf9d915ae9b9e2b608129c8779c8cad280e4428a443a1efbd72d28d0 +size 883 diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderGenerator.asset.meta b/Assets/External/VolumetricLightBeam/Shaders/ShaderGenerator.asset.meta new file mode 100644 index 00000000..c3fbb275 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderGenerator.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 41a72982cc42d7c47a12a3e40591b5f7 +timeCreated: 1592827303 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderMaths.cginc b/Assets/External/VolumetricLightBeam/Shaders/ShaderMaths.cginc new file mode 100644 index 00000000..8d21db7c --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderMaths.cginc @@ -0,0 +1,52 @@ +// The following comment prevents Unity from auto upgrading the shader. Please keep it to keep backward compatibility. +// UNITY_SHADER_NO_UPGRADE + +#ifndef _VLB_SHADER_MATHS_INCLUDED_ +#define _VLB_SHADER_MATHS_INCLUDED_ + +inline float lengthSqr(float2 v) { return dot(v, v); } +inline float dot2(float2 v) { return dot(v,v); } +inline float lerpClamped(float a, float b, float t) { return lerp(a, b, saturate(t)); } +inline float invLerp(float a, float b, float t) { return (t - a) / (b - a); } +inline float invLerpClamped(float a, float b, float t) { return saturate(invLerp(a, b, t)); } +inline float fromABtoCD_Clamped(float valueAB, float A, float B, float C, float D) { return lerpClamped(C, D, invLerpClamped(A, B, valueAB)); } + +// Returns 1.0 if a >= b, 0.0 otherwise +inline float isEqualOrGreater(float a, float b) { return step(b, a); } + +// Returns 1.0 if a < b, 0.0 otherwise +inline float isLower(float a, float b) { return 1.0 - step(b, a); } + +// Returns 1.0 if all arguments equal 1.0, 0.0 otherwise +inline float ifAnd(float a, float b) { return isEqualOrGreater(a + b, 1.5); } +inline float ifAnd(float a, float b, float c) { return isEqualOrGreater(a + b + c, 2.5); } + +// Get signed distance of pos from the plane (normal ; d). +// Normal should be normalized. +// If we want to disable this feature, we could set normal and d to 0 (no discard in this case). +inline float DistanceToPlane(float3 pos, float3 normal, float d) { return dot(normal, pos) + d; } + +// https://www.iquilezles.org/www/articles/functions/functions.htm +// A nice choice to remap the 0..1 interval into 0..1, such that the corners are mapped to 0 and the center to 1. +// In other words, parabola(0) = parabola(1) = 0, and parabola(1/2) = 1. +inline float parabola( float x, float k ) +{ + return pow( 4.0*x*(1.0-x), k ); +} + +// https://en.wikipedia.org/wiki/Smoothstep +inline float smootherstep(float edge0, float edge1, float x) +{ + // Scale, and clamp x to 0..1 range + x = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0); + // Evaluate polynomial + return x*x*x*(x*(x * 6 - 15) + 10); +} + +inline float flipUV(float uv, float shouldFlip) +{ + // returns uv or 1-uv + return max(-shouldFlip, 0) + shouldFlip * uv; +} + +#endif diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderMaths.cginc.meta b/Assets/External/VolumetricLightBeam/Shaders/ShaderMaths.cginc.meta new file mode 100644 index 00000000..b87fe21d --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderMaths.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8e2291ef6ea68d34da2e1a28422a7fdc +timeCreated: 1504539309 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderProperties.cginc b/Assets/External/VolumetricLightBeam/Shaders/ShaderProperties.cginc new file mode 100644 index 00000000..a0beb1e6 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderProperties.cginc @@ -0,0 +1,109 @@ +// UNITY_SHADER_NO_UPGRADE + +#ifndef _VLB_SHADER_PROPERTIES_INCLUDED_ +#define _VLB_SHADER_PROPERTIES_INCLUDED_ + +#include "ShaderPropertySystem.cginc" + +/// **************************************** +/// PROPERTIES DECLARATION +/// **************************************** +VLB_DEFINE_PROP_START + +#if VLB_CUSTOM_INSTANCED_OBJECT_MATRICES + VLB_DEFINE_PROP(float4x4, _LocalToWorldMatrix) + VLB_DEFINE_PROP(float4x4, _WorldToLocalMatrix) +#endif + + // if VLB_COLOR_GRADIENT_MATRIX_HIGH || VLB_COLOR_GRADIENT_MATRIX_LOW + VLB_DEFINE_PROP(float4x4, _ColorGradientMatrix) + // else + VLB_DEFINE_PROP(float4, _ColorFlat) + // endif + + VLB_DEFINE_PROP(half, _AlphaInside) + VLB_DEFINE_PROP(half, _AlphaOutside) + VLB_DEFINE_PROP(half, _HDRPExposureWeight) + VLB_DEFINE_PROP(float2, _ConeSlopeCosSin) // between -1 and +1 + VLB_DEFINE_PROP(float2, _ConeRadius) // x = start radius ; y = end radius + VLB_DEFINE_PROP(float2, _ConeGeomProps) // x = apex offset z > 0 ; y = mesh sides + VLB_DEFINE_PROP(float, _AttenuationLerpLinearQuad) + VLB_DEFINE_PROP(float3, _DistanceFallOff) // fallOffStart, fallOffEnd, maxGeometryDistance + VLB_DEFINE_PROP(float, _DistanceCamClipping) + VLB_DEFINE_PROP(float, _FadeOutFactor) + VLB_DEFINE_PROP(float, _FresnelPow) // must be != 0 to avoid infinite fresnel + VLB_DEFINE_PROP(float, _GlareFrontal) + VLB_DEFINE_PROP(float, _GlareBehind) + VLB_DEFINE_PROP(float, _DrawCap) + VLB_DEFINE_PROP(float4, _CameraParams) // xyz: object space forward vector ; w: cameraIsInsideBeamFactor (-1 : +1) + + // if VLB_OCCLUSION_CLIPPING_PLANE + VLB_DEFINE_PROP(float4, _DynamicOcclusionClippingPlaneWS) + VLB_DEFINE_PROP(float, _DynamicOcclusionClippingPlaneProps) + // elif VLB_OCCLUSION_DEPTH_TEXTURE + VLB_DEFINE_PROP(float4, _DynamicOcclusionDepthProps) // x = should flip x? ; y = should flip y? ; z = fade distance ; w = perspective cam ? + // endif + + // VLB_NOISE_3D + VLB_DEFINE_PROP(float4, _NoiseVelocityAndScale) + VLB_DEFINE_PROP(float2, _NoiseParam) + + ///////////////// + /// SD + ///////////////// + VLB_DEFINE_PROP(float, _DepthBlendDistance) + VLB_DEFINE_PROP(float2, _TiltVector) + VLB_DEFINE_PROP(float4, _AdditionalClippingPlaneWS) + VLB_DEFINE_PROP(float3, _LocalForwardDirection) // VLB_MESH_SKEWING + + ///////////////// + /// HD + ///////////////// + VLB_DEFINE_PROP(half, _Intensity) + VLB_DEFINE_PROP(float, _SideSoftness) + VLB_DEFINE_PROP(float4, _Jittering) + VLB_DEFINE_PROP(float3, _CameraForwardOS) // xyz: object space forward vector + VLB_DEFINE_PROP(float3, _CameraForwardWS) // xyz: world space forward vector + VLB_DEFINE_PROP(float3, _TransformScale) + + // VLB_COOKIE_1CHANNEL || VLB_COOKIE_RGBA + VLB_DEFINE_PROP(float4, _CookieProperties) + VLB_DEFINE_PROP(float4, _CookiePosAndScale) + + VLB_DEFINE_PROP(float4, _ShadowProps) // VLB_SHADOW + +VLB_DEFINE_PROP_END + +// UNITY_REVERSED_Z define is broken for WebGL and URP +uniform float _VLB_UsesReversedZBuffer; // not reversed in OpenGL on WebGL + +#if VLB_DITHERING +uniform float _VLB_DitheringFactor; +uniform sampler2D _VLB_DitheringNoiseTex; +uniform float4 _VLB_DitheringNoiseTex_TexelSize; +#endif + +///////////////// +/// SD +///////////////// +#if VLB_OCCLUSION_DEPTH_TEXTURE +// Setting a Texture property to a GPU instanced material is not supported, so keep it as regular property +uniform sampler2D _DynamicOcclusionDepthTexture; +#endif + +///////////////// +/// HD +///////////////// +uniform float _VLB_CameraBlendingDistance; + +// Setting a Texture property to a GPU instanced material is not supported, so keep it as regular property +uniform sampler2D _ShadowDepthTexture; // VLB_SHADOW + +uniform sampler2D _CookieTexture; // VLB_COOKIE_1CHANNEL || VLB_COOKIE_RGBA + +uniform sampler2D _VLB_JitteringNoiseTex; +uniform float4 _VLB_JitteringNoiseTex_TexelSize; + +/// **************************************** + +#endif diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderProperties.cginc.meta b/Assets/External/VolumetricLightBeam/Shaders/ShaderProperties.cginc.meta new file mode 100644 index 00000000..8f8d932a --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderProperties.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 27b50b866731025428ef37b38a364a98 +timeCreated: 1578601843 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderPropertySystem.cginc b/Assets/External/VolumetricLightBeam/Shaders/ShaderPropertySystem.cginc new file mode 100644 index 00000000..bfc16051 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderPropertySystem.cginc @@ -0,0 +1,39 @@ +// UNITY_SHADER_NO_UPGRADE + +#ifndef _VLB_SHADER_PROPERTY_SYSTEM_INCLUDED_ +#define _VLB_SHADER_PROPERTY_SYSTEM_INCLUDED_ + +/// **************************************** +/// PROPERTIES MACROS +/// **************************************** +#if VLB_INSTANCING_API_AVAILABLE && VLB_GPU_INSTANCING + #if UNITY_VERSION < 201730 // https://unity3d.com/fr/unity/beta/unity2017.3.0b1 + // PRE UNITY 2017.3 + // for some reason, letting the default UNITY_MAX_INSTANCE_COUNT value generates the following error: + // "Internal error communicating with the shader compiler process" + #define UNITY_MAX_INSTANCE_COUNT 150 + #define VLB_DEFINE_PROP_START UNITY_INSTANCING_CBUFFER_START(Props) + #define VLB_DEFINE_PROP_END UNITY_INSTANCING_CBUFFER_END + #define VLB_GET_PROP(name) UNITY_ACCESS_INSTANCED_PROP(name) + #else + // POST UNITY 2017.3 + #define VLB_DEFINE_PROP_START UNITY_INSTANCING_BUFFER_START(Props) + #define VLB_DEFINE_PROP_END UNITY_INSTANCING_BUFFER_END(Props) + #define VLB_GET_PROP(name) UNITY_ACCESS_INSTANCED_PROP(Props, name) + #endif + + #define VLB_DEFINE_PROP(type, name) UNITY_DEFINE_INSTANCED_PROP(type, name) +#elif VLB_SRP_API && VLB_SRP_BATCHER + #define VLB_DEFINE_PROP_START CBUFFER_START(UnityPerMaterial) + #define VLB_DEFINE_PROP_END CBUFFER_END + #define VLB_DEFINE_PROP(type, name) type name; + #define VLB_GET_PROP(name) name +#else + #define VLB_DEFINE_PROP_START + #define VLB_DEFINE_PROP_END + #define VLB_DEFINE_PROP(type, name) uniform type name; + #define VLB_GET_PROP(name) name +#endif +/// **************************************** + +#endif diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderPropertySystem.cginc.meta b/Assets/External/VolumetricLightBeam/Shaders/ShaderPropertySystem.cginc.meta new file mode 100644 index 00000000..dccf69c1 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderPropertySystem.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4db26b55566f95a47adcaf8ca699bf3b +timeCreated: 1578601843 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificBuiltin.cginc b/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificBuiltin.cginc new file mode 100644 index 00000000..d48f1dfd --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificBuiltin.cginc @@ -0,0 +1,65 @@ +// The following comment prevents Unity from auto upgrading the shader. Please keep it to keep backward compatibility. +// UNITY_SHADER_NO_UPGRADE + +#ifndef _VLB_SHADER_SPECIFIC_INCLUDED_ +#define _VLB_SHADER_SPECIFIC_INCLUDED_ + +// POSITION TRANSFORM +#if UNITY_VERSION < 540 + #define __VLBMatrixWorldToObject _World2Object + #define __VLBMatrixObjectToWorld _Object2World + #define __VLBMatrixV UNITY_MATRIX_V + inline float4 VLBObjectToClipPos(in float3 pos) { return mul(UNITY_MATRIX_MVP, float4(pos, 1.0)); } +#else + #if VLB_CUSTOM_INSTANCED_OBJECT_MATRICES + #define __VLBMatrixWorldToObject UNITY_ACCESS_INSTANCED_PROP(Props, _WorldToLocalMatrix) + #define __VLBMatrixObjectToWorld UNITY_ACCESS_INSTANCED_PROP(Props, _LocalToWorldMatrix) + #define __VLBMatrixV unity_MatrixV + inline float4 VLBObjectToClipPos(in float3 pos) { return mul(mul(unity_MatrixVP, __VLBMatrixObjectToWorld), float4(pos, 1.0)); } + #else + #define __VLBMatrixWorldToObject unity_WorldToObject + #define __VLBMatrixObjectToWorld unity_ObjectToWorld + #define __VLBMatrixV UNITY_MATRIX_V + #define VLBObjectToClipPos UnityObjectToClipPos + #endif +#endif + +inline float4 VLBObjectToWorldPos(in float4 pos) { return mul(__VLBMatrixObjectToWorld, pos); } +#define VLBWorldToViewPos(pos) (mul(__VLBMatrixV, float4(pos.xyz, 1.0)).xyz) + +// FRUSTUM PLANES +#define VLBFrustumPlanes unity_CameraWorldClipPlanes + +// CAMERA +inline float3 __VLBWorldToObjectPos(in float3 pos) { return mul(__VLBMatrixWorldToObject, float4(pos, 1.0)).xyz; } +inline float3 VLBGetCameraPositionObjectSpace(float3 scaleObjectSpace) +{ + return __VLBWorldToObjectPos(_WorldSpaceCameraPos).xyz * scaleObjectSpace; +} + +// DEPTH +#ifndef UNITY_DECLARE_DEPTH_TEXTURE // handle Unity pre 5.6.0 +#define UNITY_DECLARE_DEPTH_TEXTURE(tex) sampler2D_float tex +#endif +UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + +#define VLBSampleDepthTexture(/*float4*/uv) (SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, (uv)/(uv.w))) +#define VLBLinearEyeDepth(depth) (LinearEyeDepth(depth)) + +// FOG +#define VLB_FOG_UNITY_BUILTIN_COORDS + +#if VLB_ALPHA_AS_BLACK +#define VLB_FOG_APPLY(color) \ + float4 fogColor = unity_FogColor; \ + fogColor.rgb *= color.a; \ + UNITY_APPLY_FOG_COLOR(i.fogCoord, color, fogColor); + // since we use this shader with Additive blending, fog color should be modulated by general alpha +#else +#define VLB_FOG_APPLY(color) UNITY_APPLY_FOG(i.fogCoord, color); +#endif + + +inline void ApplyPipelineSpecificIntensityModifier(inout float intensity) {} + +#endif // _VLB_SHADER_SPECIFIC_INCLUDED_ diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificBuiltin.cginc.meta b/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificBuiltin.cginc.meta new file mode 100644 index 00000000..4e345088 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificBuiltin.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0f65a880b7990834b8700ebf9f9a53fa +timeCreated: 1578601843 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificHDRP.hlsl b/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificHDRP.hlsl new file mode 100644 index 00000000..9f8dc0b0 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificHDRP.hlsl @@ -0,0 +1,73 @@ +// The following comment prevents Unity from auto upgrading the shader. Please keep it to keep backward compatibility. +// UNITY_SHADER_NO_UPGRADE + +#ifndef _VLB_SHADER_SPECIFIC_INCLUDED_ +#define _VLB_SHADER_SPECIFIC_INCLUDED_ + +///////////////////////////////////////////////////// +// Redefine missing functions from legacy pipeline +///////////////////////////////////////////////////// +inline float4 ComputeNonStereoScreenPos(float4 pos) +{ + float4 o = pos * 0.5f; + o.xy = float2(o.x, o.y * _ProjectionParams.x) + o.w; + o.zw = pos.zw; + return o; +} + +#define TransformStereoScreenSpaceTex(uv, w) uv + +inline float4 ComputeScreenPos(float4 pos) +{ + float4 o = ComputeNonStereoScreenPos(pos); +#if defined(UNITY_SINGLE_PASS_STEREO) + o.xy = TransformStereoScreenSpaceTex(o.xy, pos.w); +#endif + return o; +} +///////////////////////////////////////////////////// + +// POSITION TRANSFORM +inline float4 VLBObjectToClipPos(in float3 pos) { return mul(UNITY_MATRIX_VP, mul(UNITY_MATRIX_M, float4(pos.xyz, 1.0))); } + +// Don't use UNITY_MATRIX_M directly here, because ApplyCameraTranslationToMatrix has been applied to it to substract the camera position. +// But we can't use GetRawUnityObjectToWorld neither, since it doesn't work on Unity 2018.4.19 and HDRP 4.10.0 with GPUInstancing. +// So we counter the effect of ApplyCameraTranslationToMatrix by adding the _WorldSpaceCameraPos back. +inline float4 VLBObjectToWorldPos(in float4 pos) +{ + float4x4 modelMatrix = UNITY_MATRIX_M; + +#if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) + modelMatrix._m03_m13_m23 += _WorldSpaceCameraPos; +#endif + + return mul(modelMatrix, pos); +} + +#define VLBObjectToViewPos(pos) (mul(UNITY_MATRIX_V, mul(UNITY_MATRIX_M, float4(pos.xyz, 1.0))).xyz) + +// FRUSTUM PLANES +#define VLBFrustumPlanes _FrustumPlanes + +// CAMERA +inline float3 __VLBWorldToObjectPos(in float3 pos) { return mul(UNITY_MATRIX_I_M, float4(pos, 1.0)).xyz; } +inline float3 VLBGetCameraPositionObjectSpace(float3 scaleObjectSpace) +{ + // getting access directly to _WorldSpaceCameraPos gives wrong values + return __VLBWorldToObjectPos(GetCurrentViewPosition()) * scaleObjectSpace; +} + +// DEPTH +#define VLBSampleDepthTexture(/*float4*/uv) (SampleCameraDepth((uv.xy) / (uv.w))) +#define VLBLinearEyeDepth(depth) LinearEyeDepth((depth), _ZBufferParams) + + +inline void ApplyPipelineSpecificIntensityModifier(inout float intensity) +{ +#if defined(UNITY_SHADER_VARIABLES_INCLUDED) && UNITY_VERSION >= 202110 + intensity *= lerp(1.0, GetCurrentExposureMultiplier(), VLB_GET_PROP(_HDRPExposureWeight)); +#endif +} + +#endif // _VLB_SHADER_SPECIFIC_INCLUDED_ + \ No newline at end of file diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificHDRP.hlsl.meta b/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificHDRP.hlsl.meta new file mode 100644 index 00000000..059fc6da --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificHDRP.hlsl.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8895ab27688df164283e6aa7391ecabd +timeCreated: 1578601839 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificURP.cginc b/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificURP.cginc new file mode 100644 index 00000000..30c4a31f --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificURP.cginc @@ -0,0 +1,54 @@ +// The following comment prevents Unity from auto upgrading the shader. Please keep it to keep backward compatibility. +// UNITY_SHADER_NO_UPGRADE + +#ifndef _VLB_SHADER_SPECIFIC_INCLUDED_ +#define _VLB_SHADER_SPECIFIC_INCLUDED_ + +// POSITION TRANSFORM +#if VLB_CUSTOM_INSTANCED_OBJECT_MATRICES + #define __VLBMatrixWorldToObject UNITY_ACCESS_INSTANCED_PROP(Props, _WorldToLocalMatrix) + #define __VLBMatrixObjectToWorld UNITY_ACCESS_INSTANCED_PROP(Props, _LocalToWorldMatrix) + #define __VLBMatrixV unity_MatrixV + inline float4 VLBObjectToClipPos(in float3 pos) { return mul(mul(unity_MatrixVP, __VLBMatrixObjectToWorld), float4(pos, 1.0)); } +#else + #define __VLBMatrixWorldToObject unity_WorldToObject + #define __VLBMatrixObjectToWorld unity_ObjectToWorld + #define __VLBMatrixV UNITY_MATRIX_V + inline float4 VLBObjectToClipPos(in float3 pos) { return mul(UNITY_MATRIX_VP, mul(UNITY_MATRIX_M, float4(pos.xyz, 1.0))); } +#endif + +inline float4 VLBObjectToWorldPos(in float4 pos) { return mul(__VLBMatrixObjectToWorld, pos); } +#define VLBWorldToViewPos(pos) (mul(__VLBMatrixV, float4(pos.xyz, 1.0)).xyz) + +// FRUSTUM PLANES +#define VLBFrustumPlanes unity_CameraWorldClipPlanes + +// CAMERA +inline float3 __VLBWorldToObjectPos(in float3 pos) { return mul(__VLBMatrixWorldToObject, float4(pos, 1.0)).xyz; } +inline float3 VLBGetCameraPositionObjectSpace(float3 scaleObjectSpace) +{ + return __VLBWorldToObjectPos(_WorldSpaceCameraPos).xyz * scaleObjectSpace; +} + +// DEPTH +#define VLBSampleDepthTexture(/*float4*/uv) (SampleSceneDepth((uv.xy) / (uv.w))) +#define VLBLinearEyeDepth(depth) LinearEyeDepth((depth), _ZBufferParams) + +// FOG +#if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2) + #define VLB_FOG_MIX(color, fogColor, posClipSpace) color.rgb = MixFogColor(color.rgb, fogColor.rgb, ComputeFogFactor(posClipSpace.z * posClipSpace.w)) + + #if VLB_ALPHA_AS_BLACK + #define VLB_FOG_APPLY(color) \ + float4 fogColor = unity_FogColor; \ + fogColor.rgb *= color.a; \ + VLB_FOG_MIX(color, fogColor, i.posClipSpace); + #else + #define VLB_FOG_APPLY(color) VLB_FOG_MIX(color, unity_FogColor, i.posClipSpace); + #endif +#endif + + +inline void ApplyPipelineSpecificIntensityModifier(inout float intensity) {} + +#endif // _VLB_SHADER_SPECIFIC_INCLUDED_ diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificURP.cginc.meta b/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificURP.cginc.meta new file mode 100644 index 00000000..c34f781c --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderSpecificURP.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5506b213335ebb24f91756ab209e7915 +timeCreated: 1578601843 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderUtils.cginc b/Assets/External/VolumetricLightBeam/Shaders/ShaderUtils.cginc new file mode 100644 index 00000000..842c6371 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderUtils.cginc @@ -0,0 +1,230 @@ +// The following comment prevents Unity from auto upgrading the shader. Please keep it to keep backward compatibility. +// UNITY_SHADER_NO_UPGRADE + +#ifndef _VLB_SHADER_UTILS_INCLUDED_ +#define _VLB_SHADER_UTILS_INCLUDED_ + +#include "ShaderMaths.cginc" + +// https://docs.unity3d.com/Manual/SL-UnityShaderVariables.html +#define VLB_CAMERA_NEAR_PLANE _ProjectionParams.y +#define VLB_CAMERA_FAR_PLANE _ProjectionParams.z +#define VLB_CAMERA_ORTHO unity_OrthoParams.w // w is 1.0 when camera is orthographic, 0.0 when perspective + +// Z buffer to 0..1 depth (0 at eye, 1 at far plane) +float VLB_ZBufferTo01(float depth, float near, float far) +{ + float x = 1 - far / near; + float y = far / near; + + return 1.0 / (x * depth + y); +} + +// Z buffer to linear depth +float VLB_ZBufferToLinear(float depth, float near, float far) +{ + float x = 1 - far / near; + float y = far / near; + + float z = x / far; + float w = y / far; + + return 1.0 / (z * depth + w); +} + +inline float4 Depth_VS_ComputeProjPos(float3 vertexViewSpace, float4 vertexClipSpace) +{ + float4 projPos = ComputeScreenPos(vertexClipSpace); + projPos.z = -vertexViewSpace.z; // = COMPUTE_EYEDEPTH + return projPos; +} + +inline float Depth_PS_GetLinearDepthOrtho(float rawDepth) +{ + rawDepth = lerp(rawDepth, 1.0f - rawDepth, _VLB_UsesReversedZBuffer); + return (VLB_CAMERA_FAR_PLANE - VLB_CAMERA_NEAR_PLANE) * rawDepth + VLB_CAMERA_NEAR_PLANE; +} + +inline float Depth_PS_GetSceneDepthFromNearPlane(float4 uv) +{ + float rawDepth = VLBSampleDepthTexture(uv); + float linearDepthPersp = VLBLinearEyeDepth(rawDepth); + + float linearDepthOrtho = Depth_PS_GetLinearDepthOrtho(rawDepth); + return lerp(linearDepthPersp, linearDepthOrtho, VLB_CAMERA_ORTHO); +} + +inline float Depth_PS_GetSceneDepthFromEye(float4 uv, float3 posViewSpace) +{ + float rawDepth = VLBSampleDepthTexture(uv); + float linearDepthPersp = VLBLinearEyeDepth(rawDepth); + + // transform perspective depth from near plane to distance based on the eye + float acosViewDirZ = abs(normalize(posViewSpace.xyz).z); // TODO precompute that in VS? + linearDepthPersp /= acosViewDirZ; + + float linearDepthOrtho = Depth_PS_GetLinearDepthOrtho(rawDepth); + return lerp(linearDepthPersp, linearDepthOrtho, VLB_CAMERA_ORTHO); +} + + +#if VLB_DEPTH_BLEND || VLB_DITHERING +inline float DepthFade_PS_BlendDistance(float4 projPos, float3 posViewSpace, float distance) +{ + // Use FromNearPlane instead of FromEye for SD beams, it looks better specially in QA tests 'BlendWithGeom' and 'BlendWithGeomDisableAtSrc' + float sceneDepth = Depth_PS_GetSceneDepthFromNearPlane(projPos); + float sceneZ = max(0, sceneDepth - VLB_CAMERA_NEAR_PLANE); + float partZ = max(0, projPos.z - VLB_CAMERA_NEAR_PLANE); + return saturate((sceneZ - partZ) / distance); +} +#endif // VLB_DEPTH_BLEND || VLB_DITHERING + + +#if VLB_NOISE_3D +uniform sampler3D _VLB_NoiseTex3D; +uniform float _VLB_NoiseCustomTime; + +float3 Noise3D_GetUVW(float3 posWorldSpace, float3 posLocalSpace) +{ + float4 noiseVelocityAndScale = VLB_GET_PROP(_NoiseVelocityAndScale); + float2 noiseParam = VLB_GET_PROP(_NoiseParam); + float3 velocity = noiseVelocityAndScale.xyz; + float scale = noiseVelocityAndScale.w; + + float3 posRef = lerp(posWorldSpace, posLocalSpace, noiseParam.y); // 0 -> World Space ; 1 -> Local Space + + // use _VLB_NoiseCustomTime if it's equal or higher than 0.0 + float currentTime = lerp(_Time.y, _VLB_NoiseCustomTime, isEqualOrGreater(_VLB_NoiseCustomTime, 0.0f)); + + //return frac(posRef.xyz * scale + (currentTime * velocity)); // frac doesn't give good results on VS + return (posRef.xyz * scale + (currentTime * velocity)); +} + +float Noise3D_GetFactorFromUVW(float3 uvw) +{ + float2 noiseParam = VLB_GET_PROP(_NoiseParam); + float intensity = noiseParam.x; + float noise = tex3D(_VLB_NoiseTex3D, uvw).a; + return lerp(1, noise, intensity); +} +#endif // VLB_NOISE_3D + + +inline float ComputeAttenuationSD(float pixDistZ, float fallOffStart, float fallOffEnd, float lerpLinearQuad) +{ + float distFromSourceNormalized = invLerpClamped(fallOffStart, fallOffEnd, pixDistZ); + + // Almost simple linear attenuation between Fade Start and Fade End: Use smoothstep for a better fall to zero rendering + float attLinear = smoothstep(0, 1, 1 - distFromSourceNormalized); + + // Unity's custom quadratic attenuation https://forum.unity.com/threads/light-attentuation-equation.16006/ + float attQuad = 1.0 / (1.0 + 25.0 * distFromSourceNormalized * distFromSourceNormalized); + + const float kAttQuadStartToFallToZero = 0.8; + attQuad *= saturate(smoothstep(1.0, kAttQuadStartToFallToZero, distFromSourceNormalized)); // Near the light's range (fade end) we fade to 0 (because quadratic formula never falls to 0) + + return lerp(attLinear, attQuad, lerpLinearQuad); +} + +inline float ComputeAttenuationHD(float pixDistZ, float fallOffStart, float fallOffEnd) +{ + float distFromSourceNormalized = invLerpClamped(fallOffStart, fallOffEnd, pixDistZ); + float att = -1.0f; + +#if VLB_ATTENUATION_LINEAR + // Simple linear attenuation + att = (1 - distFromSourceNormalized); +#elif VLB_ATTENUATION_QUAD + // Unity's custom quadratic attenuation + // https://forum.unity.com/threads/light-attentuation-equation.16006/ + // https://forum.unity.com/threads/light-distance-in-shader.509306/#post-3326818 + att = saturate(1.0 / (1.0 + 25.0 * distFromSourceNormalized * distFromSourceNormalized) * saturate((1 - distFromSourceNormalized) * 5.0)); +#endif + + return att; +} + +#if VLB_COLOR_GRADIENT +#if VLB_COLOR_GRADIENT_MATRIX_HIGH || VLB_COLOR_GRADIENT_MATRIX_LOW +#if VLB_COLOR_GRADIENT_MATRIX_HIGH +#define FLOAT_PACKING_PRECISION 64 +#else +#define FLOAT_PACKING_PRECISION 8 +#endif +inline float4 UnpackToColor(float packedFloat) +{ + float4 color; + + color.a = packedFloat % FLOAT_PACKING_PRECISION; + packedFloat = floor(packedFloat / FLOAT_PACKING_PRECISION); + + color.b = packedFloat % FLOAT_PACKING_PRECISION; + packedFloat = floor(packedFloat / FLOAT_PACKING_PRECISION); + + color.g = packedFloat % FLOAT_PACKING_PRECISION; + packedFloat = floor(packedFloat / FLOAT_PACKING_PRECISION); + + color.r = packedFloat; + + return color / (FLOAT_PACKING_PRECISION - 1); +} + +inline float GetAtMatrixIndex(float4x4 mat, uint idx) { return mat[idx % 4][floor(idx / 4)]; } + +inline float4 DecodeGradient(float t, float4x4 colorMatrix) +{ +#define kColorGradientMatrixSize 16 + float sampleIndexFloat = t * (kColorGradientMatrixSize - 1); + float ratioPerSample = sampleIndexFloat - (int)sampleIndexFloat; + uint sampleIndexInt = min((uint)sampleIndexFloat, kColorGradientMatrixSize - 2); + float4 colorA = UnpackToColor(GetAtMatrixIndex(colorMatrix, sampleIndexInt + 0)); + float4 colorB = UnpackToColor(GetAtMatrixIndex(colorMatrix, sampleIndexInt + 1)); + return lerp(colorA, colorB, ratioPerSample); +} +#elif VLB_COLOR_GRADIENT_ARRAY +inline half4 DecodeGradient(float t, float4 colorArray[kColorGradientArraySize]) +{ + uint arraySize = kColorGradientArraySize; + float sampleIndexFloat = t * (arraySize - 1); + float ratioPerSample = sampleIndexFloat - (int)sampleIndexFloat; + uint sampleIndexInt = min((uint)sampleIndexFloat, arraySize - 2); + float4 colorA = colorArray[sampleIndexInt + 0]; + float4 colorB = colorArray[sampleIndexInt + 1]; + return lerp(colorA, colorB, ratioPerSample); +} +#endif // VLB_COLOR_GRADIENT_* + +inline float4 ComputeColorGradient(float pixDistFromSource) +{ + float distanceFadeEnd = VLB_GET_PROP(_DistanceFallOff).y; + float4x4 colorGradientMatrix = VLB_GET_PROP(_ColorGradientMatrix); + float distFromSourceNormalized = invLerpClamped(0, distanceFadeEnd, pixDistFromSource); + return DecodeGradient(distFromSourceNormalized, colorGradientMatrix); +} +#elif VLB_COLOR_FLAT +inline float4 ComputeColorFlat() +{ + return VLB_GET_PROP(_ColorFlat); +} +#endif // VLB_COLOR_GRADIENT / VLB_COLOR_FLAT + +inline float4 ApplyAlphaToColor(float4 color) +{ +#if VLB_ALPHA_AS_BLACK + color.rgb *= color.a; +#endif + return color; +} + +inline float4 ApplyAlphaToColor(float4 color, float additionalAlpha) +{ +#if VLB_ALPHA_AS_BLACK + color.rgb *= color.a; + color.rgb *= additionalAlpha; +#else + color.a *= additionalAlpha; +#endif + return color; +} + +#endif // _VLB_SHADER_UTILS_INCLUDED_ diff --git a/Assets/External/VolumetricLightBeam/Shaders/ShaderUtils.cginc.meta b/Assets/External/VolumetricLightBeam/Shaders/ShaderUtils.cginc.meta new file mode 100644 index 00000000..82ceb85f --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/ShaderUtils.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 05361e63ec7797d4cac0db54e579335c +timeCreated: 1504539309 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialHD.mat b/Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialHD.mat new file mode 100644 index 00000000..8bc4e1eb --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialHD.mat @@ -0,0 +1,78 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: VLBDummyMaterialHD + m_Shader: {fileID: 4800000, guid: 901a8562da79d454a91ce78726952c06, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _CookieTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DynamicOcclusionDepthTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShadowDepthTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaInside: 1 + - _AlphaOutside: 1 + - _AttenuationLerpLinearQuad: 0.5 + - _BlendDstFactor: 1 + - _BlendSrcFactor: 1 + - _DepthBlendDistance: 2 + - _DistanceCamClipping: 0.5 + - _DrawCap: 1 + - _DynamicOcclusionClippingPlaneProps: 0.25 + - _FadeOutFactor: 1 + - _FresnelPow: 1 + - _GlareBehind: 0.5 + - _GlareFrontal: 0.5 + - _HDRPExposureWeight: 0 + - _Intensity: 1 + - _SideSoftness: 1 + - _ZTest: 4 + m_Colors: + - _AdditionalClippingPlaneWS: {r: 0, g: 0, b: 0, a: 0} + - _CameraForwardOS: {r: 0, g: 0, b: 0, a: 1} + - _CameraForwardWS: {r: 0, g: 0, b: 0, a: 1} + - _CameraParams: {r: 0, g: 0, b: 0, a: 0} + - _ColorFlat: {r: 1, g: 1, b: 1, a: 1} + - _ConeGeomProps: {r: 0, g: 0, b: 0, a: 0} + - _ConeRadius: {r: 0, g: 0, b: 0, a: 0} + - _ConeSlopeCosSin: {r: 0, g: 0, b: 0, a: 0} + - _CookiePosAndScale: {r: 0, g: 0, b: 1, a: 1} + - _CookieProperties: {r: 0, g: 0, b: 0, a: 0} + - _DistanceFallOff: {r: 0, g: 1, b: 1, a: 0} + - _DynamicOcclusionClippingPlaneWS: {r: 0, g: 0, b: 0, a: 0} + - _DynamicOcclusionDepthProps: {r: 1, g: 1, b: 0.25, a: 1} + - _Jittering: {r: 0, g: 0, b: 0, a: 0} + - _LocalForwardDirection: {r: 0, g: 0, b: 1, a: 1} + - _NoiseParam: {r: 0, g: 0, b: 0, a: 0} + - _NoiseVelocityAndScale: {r: 0, g: 0, b: 0, a: 0} + - _ShadowProps: {r: 1, g: 1, b: 1, a: 1} + - _TiltVector: {r: 0, g: 0, b: 0, a: 0} + - _TransformScale: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAO.Demo.Runtime.asmdef.meta b/Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialHD.mat.meta similarity index 52% rename from Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAO.Demo.Runtime.asmdef.meta rename to Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialHD.mat.meta index acd4b42a..2f895f17 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAO.Demo.Runtime.asmdef.meta +++ b/Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialHD.mat.meta @@ -1,7 +1,8 @@ fileFormatVersion: 2 -guid: d7729a5237c96f948aaf7de13ad4cffb -AssemblyDefinitionImporter: +guid: 1919769774a46024eadbadd9b0ecdf00 +NativeFormatImporter: externalObjects: {} + mainObjectFileID: 2100000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialSD.mat b/Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialSD.mat new file mode 100644 index 00000000..ecca29a0 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialSD.mat @@ -0,0 +1,78 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: VLBDummyMaterialSD + m_Shader: {fileID: 4800000, guid: 5cd77151c8960484c835ba6865932f1c, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _CookieTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DynamicOcclusionDepthTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShadowDepthTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaInside: 1 + - _AlphaOutside: 1 + - _AttenuationLerpLinearQuad: 0.5 + - _BlendDstFactor: 1 + - _BlendSrcFactor: 1 + - _DepthBlendDistance: 2 + - _DistanceCamClipping: 0.5 + - _DrawCap: 1 + - _DynamicOcclusionClippingPlaneProps: 0.25 + - _FadeOutFactor: 1 + - _FresnelPow: 1 + - _GlareBehind: 0.5 + - _GlareFrontal: 0.5 + - _HDRPExposureWeight: 0 + - _Intensity: 1 + - _SideSoftness: 1 + - _ZTest: 4 + m_Colors: + - _AdditionalClippingPlaneWS: {r: 0, g: 0, b: 0, a: 0} + - _CameraForwardOS: {r: 0, g: 0, b: 0, a: 1} + - _CameraForwardWS: {r: 0, g: 0, b: 0, a: 1} + - _CameraParams: {r: 0, g: 0, b: 0, a: 0} + - _ColorFlat: {r: 1, g: 1, b: 1, a: 1} + - _ConeGeomProps: {r: 0, g: 0, b: 0, a: 0} + - _ConeRadius: {r: 0, g: 0, b: 0, a: 0} + - _ConeSlopeCosSin: {r: 0, g: 0, b: 0, a: 0} + - _CookiePosAndScale: {r: 0, g: 0, b: 1, a: 1} + - _CookieProperties: {r: 0, g: 0, b: 0, a: 0} + - _DistanceFallOff: {r: 0, g: 1, b: 1, a: 0} + - _DynamicOcclusionClippingPlaneWS: {r: 0, g: 0, b: 0, a: 0} + - _DynamicOcclusionDepthProps: {r: 1, g: 1, b: 0.25, a: 1} + - _Jittering: {r: 0, g: 0, b: 0, a: 0} + - _LocalForwardDirection: {r: 0, g: 0, b: 1, a: 1} + - _NoiseParam: {r: 0, g: 0, b: 0, a: 0} + - _NoiseVelocityAndScale: {r: 0, g: 0, b: 0, a: 0} + - _ShadowProps: {r: 1, g: 1, b: 1, a: 1} + - _TiltVector: {r: 0, g: 0, b: 0, a: 0} + - _TransformScale: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialSD.mat.meta b/Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialSD.mat.meta new file mode 100644 index 00000000..c5c41a33 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/VLBDummyMaterialSD.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: da564852c4af5ec43b5d6543a27a175c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Shaders/VLBGeneratedShaderHD.shader b/Assets/External/VolumetricLightBeam/Shaders/VLBGeneratedShaderHD.shader new file mode 100644 index 00000000..4c91b000 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/VLBGeneratedShaderHD.shader @@ -0,0 +1,138 @@ +Shader "Hidden/VLB_HD_URP_Default" +{ + Properties + { + _ConeRadius("Cone Radius", Vector) = (0,0,0,0) + _ConeGeomProps("Cone Geom Props", Vector) = (0,0,0,0) + + _ColorFlat("Color", Color) = (1,1,1,1) + + _HDRPExposureWeight("HDRP Exposure Weight", Range(0,1)) = 0 + + _DistanceFallOff("Distance Fall Off", Vector) = (0,1,1,0) + + _NoiseVelocityAndScale("Noise Velocity And Scale", Vector) = (0,0,0,0) + _NoiseParam("Noise Param", Vector) = (0,0,0,0) + + _BlendSrcFactor("BlendSrcFactor", Int) = 1 // One + _BlendDstFactor("BlendDstFactor", Int) = 1 // One + _ZTest("ZTest", Int) = 4 // LEqual + + + // SD + _ConeSlopeCosSin("Cone Slope Cos Sin", Vector) = (0,0,0,0) + + _AlphaInside("Alpha Inside", Range(0,1)) = 1 + _AlphaOutside("Alpha Outside", Range(0,1)) = 1 + + _DistanceCamClipping("Camera Clipping Distance", Float) = 0.5 + _FadeOutFactor("FadeOutFactor", Float) = 1 + + _AttenuationLerpLinearQuad("Lerp between attenuation linear and quad", Float) = 0.5 + _DepthBlendDistance("Depth Blend Distance", Float) = 2 + + _FresnelPow("Fresnel Pow", Range(0,15)) = 1 + + _GlareFrontal("Glare Frontal", Range(0,1)) = 0.5 + _GlareBehind("Glare from Behind", Range(0,1)) = 0.5 + _DrawCap("Draw Cap", Float) = 1 + + _CameraParams("Camera Params", Vector) = (0,0,0,0) + + _DynamicOcclusionClippingPlaneWS("Dynamic Occlusion Clipping Plane WS", Vector) = (0,0,0,0) + _DynamicOcclusionClippingPlaneProps("Dynamic Occlusion Clipping Plane Props", Float) = 0.25 + + _DynamicOcclusionDepthTexture("DynamicOcclusionDepthTexture", 2D) = "white" {} + _DynamicOcclusionDepthProps("DynamicOcclusionDepthProps", Vector) = (1, 1, 0.25, 1) + + _LocalForwardDirection("LocalForwardDirection", Vector) = (0,0,1) + _TiltVector("TiltVector", Vector) = (0,0,0,0) + _AdditionalClippingPlaneWS("AdditionalClippingPlaneWS", Vector) = (0,0,0,0) + + // HD + _Intensity("Intensity", Range(0,8)) = 1 + _SideSoftness("SideSoftness", Range(0,15)) = 1 + _Jittering("Jittering", Vector) = (0,0,0,0) + + _CameraForwardOS("Camera Forward OS", Vector) = (0,0,0) + _CameraForwardWS("Camera Forward WS", Vector) = (0,0,0) + + _TransformScale("Transform Scale", Vector) = (0,0,0) + + _CookieTexture("CookieTexture", 2D) = "white" {} + _CookieProperties("CookieProperties", Vector) = (0,0,0,0) + _CookiePosAndScale("CookiePosAndScale", Vector) = (0,0,1,1) + + _ShadowDepthTexture("ShadowDepthTexture", 2D) = "white" {} + _ShadowProps("ShadowProps", Vector) = (1,1,1,1) + } + + Category + { + Tags + { + "Queue" = "Transparent" + "RenderType" = "Transparent" + "IgnoreProjector" = "True" + "DisableBatching" = "True" // disable dynamic batching which doesn't work neither with multiple materials nor material property blocks + } + + Blend[_BlendSrcFactor][_BlendDstFactor] + ZWrite Off + ZTest[_ZTest] + + SubShader + { + Pass + { + Cull Front + + HLSLPROGRAM + #if !defined(SHADER_API_METAL) // Removed shader model spec for Metal support https://github.com/keijiro/Cloner/commit/1120493ca2df265d450de3ec1b38a1d388468964 + #pragma target 3.0 + #endif + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_fog + + #pragma multi_compile_local __ VLB_ALPHA_AS_BLACK + #pragma multi_compile_local __ VLB_NOISE_3D + #pragma multi_compile_local __ VLB_COLOR_GRADIENT_MATRIX_HIGH + #pragma multi_compile_local VLB_ATTENUATION_LINEAR VLB_ATTENUATION_QUAD + #pragma multi_compile_local __ VLB_SHADOW + #pragma multi_compile_local __ VLB_COOKIE_1CHANNEL VLB_COOKIE_RGBA + #pragma multi_compile_local VLB_RAYMARCHING_QUALITY_0 VLB_RAYMARCHING_QUALITY_1 VLB_RAYMARCHING_QUALITY_2 + + + #define VLB_SHADER_HD 1 + #define VLB_SRP_API 1 + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" + + #if VLB_RAYMARCHING_QUALITY_0 + #define VLB_RAYMARCHING_STEP_COUNT 5 + #endif + #if VLB_RAYMARCHING_QUALITY_1 + #define VLB_RAYMARCHING_STEP_COUNT 10 + #endif + #if VLB_RAYMARCHING_QUALITY_2 + #define VLB_RAYMARCHING_STEP_COUNT 20 + #endif + + + #include "ShaderDefines.cginc" + #include "ShaderProperties.cginc" + #include "ShaderSpecificURP.cginc" + #include "VolumetricLightBeamSharedHD.cginc" + + + v2f vert(vlb_appdata v) { return vertShared(v ); } + half4 frag(v2f i) : SV_Target { return fragShared(i ); } + + ENDHLSL + } + + } + } +} diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO.shader.meta b/Assets/External/VolumetricLightBeam/Shaders/VLBGeneratedShaderHD.shader.meta similarity index 80% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO.shader.meta rename to Assets/External/VolumetricLightBeam/Shaders/VLBGeneratedShaderHD.shader.meta index c979c4a0..771412e2 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO.shader.meta +++ b/Assets/External/VolumetricLightBeam/Shaders/VLBGeneratedShaderHD.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: bf610497676b34e4dbe0f14fe3fe311c +guid: 901a8562da79d454a91ce78726952c06 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/Assets/External/VolumetricLightBeam/Shaders/VLBGeneratedShaderSD.shader b/Assets/External/VolumetricLightBeam/Shaders/VLBGeneratedShaderSD.shader new file mode 100644 index 00000000..570b1186 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/VLBGeneratedShaderSD.shader @@ -0,0 +1,128 @@ +Shader "Hidden/VLB_SD_URP_Default" +{ + Properties + { + _ConeRadius("Cone Radius", Vector) = (0,0,0,0) + _ConeGeomProps("Cone Geom Props", Vector) = (0,0,0,0) + + _ColorFlat("Color", Color) = (1,1,1,1) + + _HDRPExposureWeight("HDRP Exposure Weight", Range(0,1)) = 0 + + _DistanceFallOff("Distance Fall Off", Vector) = (0,1,1,0) + + _NoiseVelocityAndScale("Noise Velocity And Scale", Vector) = (0,0,0,0) + _NoiseParam("Noise Param", Vector) = (0,0,0,0) + + _BlendSrcFactor("BlendSrcFactor", Int) = 1 // One + _BlendDstFactor("BlendDstFactor", Int) = 1 // One + _ZTest("ZTest", Int) = 4 // LEqual + + + // SD + _ConeSlopeCosSin("Cone Slope Cos Sin", Vector) = (0,0,0,0) + + _AlphaInside("Alpha Inside", Range(0,1)) = 1 + _AlphaOutside("Alpha Outside", Range(0,1)) = 1 + + _DistanceCamClipping("Camera Clipping Distance", Float) = 0.5 + _FadeOutFactor("FadeOutFactor", Float) = 1 + + _AttenuationLerpLinearQuad("Lerp between attenuation linear and quad", Float) = 0.5 + _DepthBlendDistance("Depth Blend Distance", Float) = 2 + + _FresnelPow("Fresnel Pow", Range(0,15)) = 1 + + _GlareFrontal("Glare Frontal", Range(0,1)) = 0.5 + _GlareBehind("Glare from Behind", Range(0,1)) = 0.5 + _DrawCap("Draw Cap", Float) = 1 + + _CameraParams("Camera Params", Vector) = (0,0,0,0) + + _DynamicOcclusionClippingPlaneWS("Dynamic Occlusion Clipping Plane WS", Vector) = (0,0,0,0) + _DynamicOcclusionClippingPlaneProps("Dynamic Occlusion Clipping Plane Props", Float) = 0.25 + + _DynamicOcclusionDepthTexture("DynamicOcclusionDepthTexture", 2D) = "white" {} + _DynamicOcclusionDepthProps("DynamicOcclusionDepthProps", Vector) = (1, 1, 0.25, 1) + + _LocalForwardDirection("LocalForwardDirection", Vector) = (0,0,1) + _TiltVector("TiltVector", Vector) = (0,0,0,0) + _AdditionalClippingPlaneWS("AdditionalClippingPlaneWS", Vector) = (0,0,0,0) + + // HD + _Intensity("Intensity", Range(0,8)) = 1 + _SideSoftness("SideSoftness", Range(0,15)) = 1 + _Jittering("Jittering", Vector) = (0,0,0,0) + + _CameraForwardOS("Camera Forward OS", Vector) = (0,0,0) + _CameraForwardWS("Camera Forward WS", Vector) = (0,0,0) + + _TransformScale("Transform Scale", Vector) = (0,0,0) + + _CookieTexture("CookieTexture", 2D) = "white" {} + _CookieProperties("CookieProperties", Vector) = (0,0,0,0) + _CookiePosAndScale("CookiePosAndScale", Vector) = (0,0,1,1) + + _ShadowDepthTexture("ShadowDepthTexture", 2D) = "white" {} + _ShadowProps("ShadowProps", Vector) = (1,1,1,1) + } + + Category + { + Tags + { + "Queue" = "Transparent" + "RenderType" = "Transparent" + "IgnoreProjector" = "True" + "DisableBatching" = "True" // disable dynamic batching which doesn't work neither with multiple materials nor material property blocks + } + + Blend[_BlendSrcFactor][_BlendDstFactor] + ZWrite Off + ZTest[_ZTest] + + SubShader + { + Pass + { + Cull Front + + HLSLPROGRAM + #if !defined(SHADER_API_METAL) // Removed shader model spec for Metal support https://github.com/keijiro/Cloner/commit/1120493ca2df265d450de3ec1b38a1d388468964 + #pragma target 3.0 + #endif + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_fog + + #pragma multi_compile_local __ VLB_ALPHA_AS_BLACK + #pragma multi_compile_local __ VLB_NOISE_3D + #pragma multi_compile_local __ VLB_COLOR_GRADIENT_MATRIX_HIGH + #pragma multi_compile_local __ VLB_DEPTH_BLEND + #pragma multi_compile_local __ VLB_OCCLUSION_CLIPPING_PLANE VLB_OCCLUSION_DEPTH_TEXTURE + #pragma multi_compile_local __ VLB_MESH_SKEWING + #pragma multi_compile_local __ VLB_SHADER_ACCURACY_HIGH + + + #define VLB_SRP_API 1 + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" + + + + #include "ShaderDefines.cginc" + #include "ShaderProperties.cginc" + #include "ShaderSpecificURP.cginc" + #include "VolumetricLightBeamSharedSD.cginc" + + + v2f vert(vlb_appdata v) { return vertShared(v , v.texcoord.y); } + half4 frag(v2f i) : SV_Target { return fragShared(i , i.cameraPosObjectSpace_outsideBeam.w); } + + ENDHLSL + } + + } + } +} diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_AO.hlsl.meta b/Assets/External/VolumetricLightBeam/Shaders/VLBGeneratedShaderSD.shader.meta similarity index 80% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_AO.hlsl.meta rename to Assets/External/VolumetricLightBeam/Shaders/VLBGeneratedShaderSD.shader.meta index 2c68d739..18f3c467 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_AO.hlsl.meta +++ b/Assets/External/VolumetricLightBeam/Shaders/VLBGeneratedShaderSD.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1361d098ef86d6c41a6a6c41e84c33a4 +guid: 5cd77151c8960484c835ba6865932f1c ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedHD.cginc b/Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedHD.cginc new file mode 100644 index 00000000..022f470b --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedHD.cginc @@ -0,0 +1,527 @@ +// The following comment prevents Unity from auto upgrading the shader. Please keep it to keep backward compatibility +// UNITY_SHADER_NO_UPGRADE + +#ifndef _VOLUMETRIC_LIGHT_BEAM_SHARED_INCLUDED_ +#define _VOLUMETRIC_LIGHT_BEAM_SHARED_INCLUDED_ + +/// **************************************** +/// SHADER INPUT / OUTPUT STRUCT +/// **************************************** +struct vlb_appdata +{ + float4 vertex : POSITION; + float4 texcoord : TEXCOORD0; + +#if VLB_INSTANCING_API_AVAILABLE && (VLB_STEREO_INSTANCING || VLB_GPU_INSTANCING) + UNITY_VERTEX_INPUT_INSTANCE_ID // for GPU Instancing and Single Pass Instanced rendering +#endif +}; + +struct v2f +{ + float4 posClipSpace : SV_POSITION; + float3 posObjectSpace : TEXCOORD0; + float4 posWorldSpace : TEXCOORD1; + float3 posViewSpace : TEXCOORD2; + float3 cameraPosObjectSpace : TEXCOORD3; + + float4 projPos : TEXCOORD6; + +#ifdef VLB_FOG_UNITY_BUILTIN_COORDS + UNITY_FOG_COORDS(7) +#endif + +#if VLB_INSTANCING_API_AVAILABLE +#if VLB_GPU_INSTANCING + UNITY_VERTEX_INPUT_INSTANCE_ID // not sure this one is useful +#endif + +#if VLB_STEREO_INSTANCING + UNITY_VERTEX_OUTPUT_STEREO // for Single Pass Instanced rendering +#endif +#endif // VLB_INSTANCING_API_AVAILABLE +}; + + +#include "ShaderUtils.cginc" + +inline float ComputeFadeWithCamera(float3 posViewSpace, float enabled) +{ + float distCamToPixWS = abs(posViewSpace.z); // only check Z axis (instead of length(posViewSpace.xyz)) to have smoother transition with near plane (which is not curved) + float camFadeDistStart = _ProjectionParams.y; // cam near place + float camFadeDistEnd = camFadeDistStart + _VLB_CameraBlendingDistance; + float fadeWhenTooClose = smoothstep(0, 1, invLerpClamped(camFadeDistStart, camFadeDistEnd, distCamToPixWS)); + + // fade out according to camera's near plane + return lerp(1, fadeWhenTooClose, enabled); +} + +// Vector Camera to current Pixel, in object space and normalized +inline float3 ComputeVectorCamToPixOSN(float3 pixPosOS, float3 cameraPosOS) +{ + float3 vecCamToPixOSN = normalize(pixPosOS - cameraPosOS); + + // Deal with ortho camera: + // With ortho camera, we don't want to change the fresnel according to camera position. + // So instead of computing the proper vector "Camera to Pixel", we take account of the "Camera Forward" vector (which is not dependant on the pixel position) + float3 vecCamForwardOSN = VLB_GET_PROP(_CameraForwardOS); + + return lerp(vecCamToPixOSN, vecCamForwardOSN, VLB_CAMERA_ORTHO); +} + +v2f vertShared(vlb_appdata v) +{ + v2f o; + +#if VLB_INSTANCING_API_AVAILABLE && (VLB_STEREO_INSTANCING || VLB_GPU_INSTANCING) + UNITY_SETUP_INSTANCE_ID(v); + + #if VLB_STEREO_INSTANCING + #ifndef VLB_SRP_API // TODO CHECK THAT WE DON'T NEED THIS WITH SRP + UNITY_INITIALIZE_OUTPUT(v2f, o); + #endif + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + #endif + + #if VLB_GPU_INSTANCING + UNITY_TRANSFER_INSTANCE_ID(v, o); + #endif +#endif + + // compute the proper cone shape, so the whole beam fits into a 2x2x1 box + // The model matrix (computed via the localScale from BeamGeometry.) + float4 vertexOS = v.vertex; + + float2 coneRadius = VLB_GET_PROP(_ConeRadius); + float maxRadius = max(coneRadius.x, coneRadius.y); + float normalizedRadiusStart = coneRadius.x / maxRadius; + float normalizedRadiusEnd = coneRadius.y / maxRadius; + vertexOS.xy *= lerp(normalizedRadiusStart, normalizedRadiusEnd, vertexOS.z); + + float3 scaleObjectSpace = float3(maxRadius, maxRadius, VLB_GET_PROP(_DistanceFallOff).z); // maxGeometryDistance + + o.posWorldSpace = VLBObjectToWorldPos(vertexOS); + o.posClipSpace = VLBObjectToClipPos(vertexOS.xyz); + // TODO Should create and use VLBWorldToClipPos instead + //o.posClipSpace = VLBWorldToClipPos(o.posWorldSpace.xyz); + +#if defined(VLBWorldToViewPos) + float3 posViewSpace = VLBWorldToViewPos(o.posWorldSpace.xyz); +#elif defined(VLBObjectToViewPos) + float3 posViewSpace = VLBObjectToViewPos(vertexOS); +#else + You_should_define_either_VLBWorldToViewPos_or_VLBObjectToViewPos +#endif + + // apply the same scaling than we do through the localScale in BeamGeometry.ComputeLocalMatrix + // to get the proper transformed vertex position in object space + o.posObjectSpace = vertexOS.xyz * scaleObjectSpace; + + + o.projPos = Depth_VS_ComputeProjPos(posViewSpace, o.posClipSpace); + + o.cameraPosObjectSpace = VLBGetCameraPositionObjectSpace(scaleObjectSpace); + + o.posViewSpace = posViewSpace; + +#ifdef VLB_FOG_UNITY_BUILTIN_COORDS + UNITY_TRANSFER_FOG(o, o.posClipSpace); +#endif + return o; +} + +// original code from Inigo Quilez: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm +float coneIntersect(float3 rayOrigin, float3 rayDir, float3 conePosEnd, float radiusStart, float radiusEnd) +{ + float3 ba = conePosEnd; + float3 oa = rayOrigin; + float3 ob = rayOrigin - conePosEnd; + float m0 = dot(ba, ba); + float m1 = dot(oa, ba); + float m2 = dot(rayDir, ba); + float m3 = dot(rayDir, oa); + float m5 = dot(oa, oa); + float m9 = dot(ob, ba); + + // caps + if (m1 < 0.0) + { + if (dot2(oa*m2 - rayDir * m1) < (radiusStart*radiusStart*m2*m2)) // delayed division + return -m1 / m2; + } + else if (m9 > 0.0) + { + float t = -m9 / m2; // NOT delayed division + if (dot2(ob + rayDir * t) < (radiusEnd*radiusEnd)) + return t; + } + + // body + float rr = radiusStart - radiusEnd; + float hy = m0 + rr * rr; + float k2 = m0 * m0 - m2 * m2*hy; + float k1 = m0 * m0*m3 - m1 * m2*hy + m0 * radiusStart*(rr*m2*1.0); + float k0 = m0 * m0*m5 - m1 * m1*hy + m0 * radiusStart*(rr*m1*2.0 - m0 * radiusStart); + float h = k1 * k1 - k2 * k0; + if (h < 0.0) return -1.0; // no intersection + + float t = (-k1 - sqrt(h)) / k2; + float y = m1 + t * m2; + if (y<0.0 || y>m0) return -1.0; //no intersection + return t; +} + +half4 fragShared(v2f i) +{ +#if VLB_INSTANCING_API_AVAILABLE && VLB_GPU_INSTANCING + UNITY_SETUP_INSTANCE_ID(i); +#endif + +#if VLB_INSTANCING_API_AVAILABLE && VLB_STEREO_INSTANCING + // This fix access to depth map on the right eye when using single pass (aka Stereo Rendering Mode Multiview) on Gear VR or Oculus Go/Quest + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); // https://docs.unity3d.com/Manual/SinglePassInstancing.html +#endif + + float3 transformScale = VLB_GET_PROP(_TransformScale); + float3 intersectOutOS = i.posObjectSpace * transformScale; + + // compute proper ray start and dir + float3 realCamPosOS = i.cameraPosObjectSpace.xyz * transformScale; + float3 rayDirOS = ComputeVectorCamToPixOSN(intersectOutOS, realCamPosOS); // deal with ortho cam here + float3 realVecCamToPix = intersectOutOS - realCamPosOS; + float rayLength = dot(rayDirOS, realVecCamToPix); + float3 rayStartOS = intersectOutOS - rayLength * rayDirOS; + +#if VLB_NOISE_3D + // only useful for noise world space + float3 intersectOutWS = i.posWorldSpace.xyz; + float3 rayDirWS, rayStartWS; + { + float3 perspRayStartWS = _WorldSpaceCameraPos.xyz; + float3 perspRayDirWS = normalize(intersectOutWS - perspRayStartWS); + + float3 orthoRayDirWS = VLB_GET_PROP(_CameraForwardWS); + float3 orthoRayStartWS = intersectOutWS - rayLength * orthoRayDirWS; + + rayStartWS = lerp(perspRayStartWS, orthoRayStartWS, VLB_CAMERA_ORTHO); + rayDirWS = lerp(perspRayDirWS, orthoRayDirWS, VLB_CAMERA_ORTHO); + } +#endif // VLB_NOISE_3D + + float distanceFadeEnd = VLB_GET_PROP(_DistanceFallOff).y * transformScale.z; + float2 coneRadius = VLB_GET_PROP(_ConeRadius) * min(transformScale.x, transformScale.y); + + float tIn = coneIntersect(rayStartOS, rayDirOS, float3(0, 0, distanceFadeEnd), coneRadius.x, coneRadius.y); + + // fix artifact in VR on geometry edges when no intersection is found + float intensity = 1.0 - ifAnd( + isLower(tIn, 0.0), + isLower(realCamPosOS.z, 0.0) // is it ok to apply transformScale here? + ); + + tIn = max(tIn, 0); // when camera is inside the beam, tIn = -1: set tIn at 0 + + float tOut = length(rayStartOS - intersectOutOS); + float sceneZ = Depth_PS_GetSceneDepthFromEye(i.projPos, i.posViewSpace); + + { // DEBUG +#if DEBUG_DEPTH_MODE == DEBUG_VALUE_DEPTHBUFFER_FROMEYE + return Depth_PS_GetSceneDepthFromEye(i.projPos, i.posViewSpace) * _ProjectionParams.w; +#elif DEBUG_DEPTH_MODE == DEBUG_VALUE_DEPTHBUFFER_FROMNEARPLANE + return Depth_PS_GetSceneDepthFromNearPlane(i.projPos) * _ProjectionParams.w; +#elif DEBUG_DEPTH_MODE == DEBUG_VALUE_DEPTHSTEREOEYE + float depthValue = Depth_PS_GetSceneDepthFromEye(i.projPos, i.posViewSpace) * _ProjectionParams.w; +#if defined(USING_STEREO_MATRICES) && defined(UNITY_STEREO_MULTIVIEW_ENABLED) // used with single pass / multiview on android VR (Oculus Go/Quest, Gear VR) + return depthValue * lerp(float4(1, 0, 0, 1), float4(0, 1, 0, 1), unity_StereoEyeIndex); +#elif defined(UNITY_SINGLE_PASS_STEREO) + return depthValue * lerp(float4(1, 0, 0, 1), float4(0, 0, 1, 1), unity_StereoEyeIndex); +#elif defined(UNITY_STEREO_INSTANCING_ENABLED) + return depthValue * lerp(float4(0, 1, 0, 1), float4(0, 0, 1, 1), unity_StereoEyeIndex); +#elif defined(UNITY_STEREO_MULTIVIEW_ENABLED) + return depthValue * lerp(float4(1, 1, 0, 1), float4(0, 1, 1, 1), unity_StereoEyeIndex); +#else + return depthValue; +#endif +#elif DEBUG_DEPTH_MODE == DEBUG_VALUE_DEPTHBLEND + return float4(1 - saturate(abs(tIn - sceneZ)), 1 - saturate(abs(tOut - sceneZ)), 0, 1); +#endif + } // DEBUG + + tOut = min(tOut, sceneZ); + + float tInJittered = tIn; + + // add jittering + { + float2 screenPos = i.projPos.xy / i.projPos.w; + + float2 jitterCoord = screenPos * _ScreenParams.xy * _VLB_JitteringNoiseTex_TexelSize.xy; + float jitterNoise = tex2D(_VLB_JitteringNoiseTex, jitterCoord).r; + + float4 jitterProps = VLB_GET_PROP(_Jittering); + + // Golden Ratio Animated Noise https://blog.demofox.org/2017/10/31/animating-noise-for-integration-over-time/ + float frameRate = jitterProps.y; + const float kGoldenRatio = 1.61803398875f; // (1.0f + sqrt(5.0f)) * 0.5f; + const float kGoldenRatioFrac = 0.61803398875f; + + uint frame = uint(floor(_Time.y * frameRate)); + jitterNoise = frac(jitterNoise + float(frame) * kGoldenRatio); + + float3 intersectInOS = rayStartOS + rayDirOS * tIn; + float currentPosZNorm = max(intersectInOS.z, intersectOutOS.z) / distanceFadeEnd; + + float jitterRatio = invLerpClamped(jitterProps.z /* range start */, jitterProps.w /* range end */, currentPosZNorm); + tInJittered += jitterNoise * jitterRatio * jitterProps.x; + } + +#if VLB_COLOR_GRADIENT + float4 colorGradient = 0.0; +#endif // VLB_COLOR_GRADIENT + +#if VLB_COOKIE_RGBA + float4 colorCookieSum = 0; +#endif // VLB_COOKIE_RGBA + + { + float distanceFadeStart = VLB_GET_PROP(_DistanceFallOff).x * transformScale.z; + + float sumLerp = 0.0; + float sumLinear = 0.0; + + float sideSoftness = VLB_GET_PROP(_SideSoftness); + + const int raymarchSteps = VLB_RAYMARCHING_STEP_COUNT; + + int stepCountLinear = 0; + float stepLinear = 1.1 * distanceFadeEnd / raymarchSteps; + float tLinear = tIn; // using the non jittered version of tIn for linear sampling helps a bit smoothing the noise + +#if VLB_SHADOW + // cache some values useful for shadow computing + float4 shw_props = VLB_GET_PROP(_ShadowProps); + const float shw_isPersp = shw_props.w; + const float shw_apexDist = VLB_GET_PROP(_ConeGeomProps).x * shw_isPersp; + const float kMinNearClipPlane = 0.1f * shw_isPersp; // should be the same than in VolumetricShadowHD.cs + + const float shw_nearUnscaled = max(shw_apexDist, kMinNearClipPlane / transformScale.z); + const float shw_nearScaled = max(shw_apexDist, kMinNearClipPlane); + const float shw_farUnscaled = shw_nearUnscaled + distanceFadeEnd / transformScale.z; + const float shw_farScaled = shw_nearScaled + distanceFadeEnd; + + // handle scale X & Y + float2 shw_ratioScale; + { + float ratioScale = transformScale.x / transformScale.y; + if (ratioScale >= 1) shw_ratioScale = float2(1.0 / ratioScale, 1.0); + else shw_ratioScale = float2(1.0, ratioScale); + } + + #if DEBUG_DEPTH_MODE == DEBUG_VALUE_SHADOW_DEPTH + { + float shadowDepthRaw = tex2D(_ShadowDepthTexture, i.projPos.xy / i.projPos.w).r; + float shadowDepthLinearPersp = VLB_ZBufferToLinear(shadowDepthRaw, shw_nearUnscaled, shw_farUnscaled); + shadowDepthLinearPersp = fromABtoCD_Clamped(shadowDepthLinearPersp, shw_nearUnscaled, shw_farUnscaled, shw_nearScaled, shw_farScaled); + const float shadowDepthLinearOrtho = shadowDepthRaw * (shw_farScaled - shw_nearScaled); + float shadowDepthLinear = lerp(shadowDepthLinearOrtho, shadowDepthLinearPersp, shw_isPersp) - shw_apexDist; + return shadowDepthLinear; + } + #endif // DEBUG_DEPTH_MODE +#endif // VLB_SHADOW + +#if DEBUG_DEPTH_MODE == DEBUG_VALUE_LINEAR_OVERFLOW + bool linearStepsOverflow = false; +#endif // DEBUG_VALUE_LINEAR_OVERFLOW + for (int i = 0; i < raymarchSteps; i++) + { + float t = saturate(float(i+1) / (raymarchSteps + 1)); + float tLerp = lerp(tInJittered, tOut, t); // use the jittered version of tIn to apply noise on raymarching + + float3 posOSLinear = rayStartOS + rayDirOS * tLinear; + float3 posOSLerp = rayStartOS + rayDirOS * tLerp; + + //if (length(posOSLerp - rayStartOS) > tOut) { break; } // Fix cookie sampling artifacts when a geometry is placed between the camera and the beam. Useless when disabling mipmaps on cookie texture + + float att = ComputeAttenuationHD(posOSLerp.z, distanceFadeStart, distanceFadeEnd); + float widthAtThisZ = fromABtoCD_Clamped(posOSLerp.z, 0.0, distanceFadeEnd, coneRadius.x, coneRadius.y); + + float fresnel = (widthAtThisZ - length(posOSLerp.xy)) / (widthAtThisZ * sideSoftness); + fresnel = saturate(fresnel); + + float powerAtThisStepLerp = att * fresnel; + float powerAtThisStepLinear = 1.0; + +#if VLB_COLOR_GRADIENT + colorGradient += ApplyAlphaToColor(ComputeColorGradient(posOSLerp.z / transformScale.z)); +#endif // VLB_COLOR_GRADIENT + +#if VLB_NOISE_3D + { + //#define VLB_NOISE_3D_LINEAR 1 + #if VLB_NOISE_3D_LINEAR + float3 posWSLinear = rayStartWS + rayDirWS * tLinear; + float3 noiseUVWLinear = Noise3D_GetUVW(posWSLinear, posOSLinear); + float noiseFactorLinear = Noise3D_GetFactorFromUVW(noiseUVWLinear); + powerAtThisStepLinear *= noiseFactorLinear; + #else + float3 posWSLerp = rayStartWS + rayDirWS * tLerp; + float3 noiseUVWLerp = Noise3D_GetUVW(posWSLerp, posOSLerp); + float noiseFactorLerp = Noise3D_GetFactorFromUVW(noiseUVWLerp); + powerAtThisStepLerp *= noiseFactorLerp; + #endif + } +#endif // VLB_NOISE_3D + +#if VLB_COOKIE_1CHANNEL || VLB_COOKIE_RGBA + { + float4 posAndScale = VLB_GET_PROP(_CookiePosAndScale); + float4 props = VLB_GET_PROP(_CookieProperties); // contrib + negative, texture channel, cos(rot), sin(rot) + float2x2 rotMatrix = float2x2(props.z, -props.w, props.w, props.z); + + float2 posOSXY = posOSLerp.xy / widthAtThisZ; // [-0.5 ; 0.5] + posOSXY += posAndScale.xy; // translate + posOSXY = mul(posOSXY, rotMatrix); // rotate + posOSXY *= posAndScale.zw; // scale + posOSXY = posOSXY * 0.5 + 0.5; // transform coord to [0.0 ; 1.0] + + #if VLB_COOKIE_1CHANNEL + float cookie = tex2D(_CookieTexture, posOSXY)[(int)props.y]; + float negative = max(props.x, 0); // props.x also store contribution as negative value if negative + float contrib = abs(props.x); + powerAtThisStepLerp *= lerp(1.0, lerp(cookie, 1.0 - cookie, negative), contrib); + #endif + + #if VLB_COOKIE_RGBA + colorCookieSum += tex2D(_CookieTexture, posOSXY); + #endif + } +#endif // VLB_COOKIE_1CHANNEL || VLB_COOKIE_RGBA + +#if VLB_SHADOW + { + float3 posOSRef = posOSLerp; + + float width = lerp(coneRadius.x, widthAtThisZ, shw_isPersp); + float2 posOSXYNormalized = posOSRef.xy / width; + + // handle scale X & Y + posOSXYNormalized *= shw_ratioScale; + + posOSXYNormalized = posOSXYNormalized * 0.5 + 0.5; + posOSXYNormalized.x = flipUV(posOSXYNormalized.x, shw_props.x); + posOSXYNormalized.y = flipUV(posOSXYNormalized.y, shw_props.y); + + float shadowDepthRaw = tex2D(_ShadowDepthTexture, posOSXYNormalized).r; + shadowDepthRaw = lerp(shadowDepthRaw, 1.0f - shadowDepthRaw, _VLB_UsesReversedZBuffer); + + // Compte perspective linear depth and handle Z scaling + float shadowDepthLinearPersp = VLB_ZBufferToLinear(shadowDepthRaw, shw_nearUnscaled, shw_farUnscaled); // decode depth value using unscaled near/far distance + shadowDepthLinearPersp = fromABtoCD_Clamped(shadowDepthLinearPersp, shw_nearUnscaled, shw_farUnscaled, shw_nearScaled, shw_farScaled); // scale the linear depth value according to the scaled near/far distance + + // Compute ortho linear depth + const float shadowDepthLinearOrtho = shadowDepthRaw * (shw_farScaled - shw_nearScaled); + + // get either the perspective or ortho depth + float shadowDepthLinear = lerp(shadowDepthLinearOrtho, shadowDepthLinearPersp, shw_isPersp) - shw_apexDist; + + float factor = isEqualOrGreater(shadowDepthLinear, posOSRef.z); + + float dimmer = shw_props.z; + factor = (1 - dimmer) + factor * dimmer; // lerp(1 - dimmer, 1, factor) + powerAtThisStepLerp *= factor; + } +#endif // VLB_SHADOW + + sumLerp += powerAtThisStepLerp; + + if (tLinear < tOut) + { + tLinear += stepLinear; + sumLinear += powerAtThisStepLinear; + stepCountLinear++; + } + #if DEBUG_DEPTH_MODE == DEBUG_VALUE_LINEAR_OVERFLOW + else + { + linearStepsOverflow = true; + } + #endif // DEBUG_VALUE_LINEAR_OVERFLOW + } + // for loop end + +#if VLB_COLOR_GRADIENT + colorGradient /= raymarchSteps; +#endif // VLB_COLOR_GRADIENT + +#if VLB_COOKIE_RGBA + colorCookieSum /= raymarchSteps; +#endif // VLB_COOKIE_RGBA + + + intensity *= (sumLerp / raymarchSteps); + + if (stepCountLinear > 0) + { + float meanLinear = (sumLinear / stepCountLinear); + #if DEBUG_DEPTH_MODE == DEBUG_VALUE_LINEAR_OVERFLOW + { + if (!linearStepsOverflow) + return float4(0, 0, 1, 1); + } + #endif // DEBUG_VALUE_LINEAR_OVERFLOW + intensity *= meanLinear; + } + + intensity *= (tOut - tIn); // prevent from having a darker circle at end cap + intensity *= VLB_GET_PROP(_Intensity); + } + + { + float fadeWithCameraEnabled = 1 - VLB_CAMERA_ORTHO; // fading according to camera eye position doesn't make sense with ortho camera + intensity *= ComputeFadeWithCamera(i.posViewSpace, fadeWithCameraEnabled); + } + + { + float factorInsideGeom = isEqualOrGreater(tOut, tIn); + intensity *= factorInsideGeom; + } + +#if VLB_COLOR_GRADIENT + float4 color = colorGradient; +#elif VLB_COLOR_FLAT + float4 color = ApplyAlphaToColor(ComputeColorFlat()); +#endif // VLB_COLOR_GRADIENT / VLB_COLOR_FLAT + +#if VLB_COOKIE_RGBA + { + float4 props = VLB_GET_PROP(_CookieProperties); // contrib + negative, texture channel, cos(rot), sin(rot) + float contrib = abs(props.x); + color *= lerp(1, colorCookieSum, contrib); + } +#endif // VLB_COOKIE_RGBA + +#if VLB_DITHERING + { + float2 screenPos = i.projPos.xy / i.projPos.w; + float2 ditherCoord = screenPos * _ScreenParams.xy * _VLB_DitheringNoiseTex_TexelSize.xy; + float dither = tex2D(_VLB_DitheringNoiseTex, ditherCoord).r - 0.5; + color += (1 - saturate(intensity)) * _VLB_DitheringFactor * dither; + } +#endif + + ApplyPipelineSpecificIntensityModifier(/* inout */ intensity); + +#if VLB_ALPHA_AS_BLACK + color *= intensity; +#else + color.a *= intensity; +#endif + +#ifdef VLB_FOG_APPLY + VLB_FOG_APPLY(color); +#endif + + return color; +} + +#endif \ No newline at end of file diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Blur.hlsl.meta b/Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedHD.cginc.meta similarity index 80% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Blur.hlsl.meta rename to Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedHD.cginc.meta index 8795429b..1d7c4708 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Blur.hlsl.meta +++ b/Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedHD.cginc.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 88f16f7670609254aa357e3d46e3dffe +guid: 525b43419cd021c4bbc9a066c4cb099a ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedSD.cginc b/Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedSD.cginc new file mode 100644 index 00000000..d9d00bea --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedSD.cginc @@ -0,0 +1,581 @@ +// The following comment prevents Unity from auto upgrading the shader. Please keep it to keep backward compatibility +// UNITY_SHADER_NO_UPGRADE + +#ifndef _VOLUMETRIC_LIGHT_BEAM_SHARED_INCLUDED_ +#define _VOLUMETRIC_LIGHT_BEAM_SHARED_INCLUDED_ + +/// **************************************** +/// SHADER INPUT / OUTPUT STRUCT +/// **************************************** +struct vlb_appdata +{ + float4 vertex : POSITION; + float4 texcoord : TEXCOORD0; + +#if VLB_INSTANCING_API_AVAILABLE && (VLB_STEREO_INSTANCING || VLB_GPU_INSTANCING) + UNITY_VERTEX_INPUT_INSTANCE_ID // for GPU Instancing and Single Pass Instanced rendering +#endif +}; + +struct v2f +{ + float4 posClipSpace : SV_POSITION; + float3 posObjectSpace : TEXCOORD0; + float3 posObjectSpaceNonSkewed : TEXCOORD8; + float4 posWorldSpace : TEXCOORD1; + float4 posViewSpace_extraData : TEXCOORD2; + float4 cameraPosObjectSpace_outsideBeam : TEXCOORD3; + +#if OPTIM_VS + half4 color : TEXCOORD4; +#endif + +#if VLB_NOISE_3D || OPTIM_VS + float4 uvwNoise_intensity : TEXCOORD5; +#endif + +#if VLB_DEPTH_BLEND || VLB_DITHERING + float4 projPos : TEXCOORD6; +#endif + +#ifdef VLB_FOG_UNITY_BUILTIN_COORDS + UNITY_FOG_COORDS(7) +#endif + +#if VLB_INSTANCING_API_AVAILABLE +#if VLB_GPU_INSTANCING + UNITY_VERTEX_INPUT_INSTANCE_ID // not sure this one is useful +#endif + +#if VLB_STEREO_INSTANCING + UNITY_VERTEX_OUTPUT_STEREO // for Single Pass Instanced rendering +#endif +#endif // VLB_INSTANCING_API_AVAILABLE +}; + + +#include "ShaderUtils.cginc" + + +inline float ComputeBoostFactor(float pixDistFromSource, float outsideBeam, float isCap) +{ + pixDistFromSource = max(pixDistFromSource, 0.001); // prevent 1st segment from being boosted when boostFactor is 0 + float glareFrontal = VLB_GET_PROP(_GlareFrontal); + float insideBoostDistance = glareFrontal * VLB_GET_PROP(_DistanceFallOff).y; + float boostFactor = 1 - smoothstep(0, 0 + insideBoostDistance + 0.001, pixDistFromSource); // 0 = no boost ; 1 = max boost + boostFactor = lerp(boostFactor, 0, outsideBeam); // no boost for outside pass + + float4 cameraParams = VLB_GET_PROP(_CameraParams); + float cameraIsInsideBeamFactor = saturate(cameraParams.w); // _CameraParams.w is (-1 ; 1) + boostFactor = cameraIsInsideBeamFactor * boostFactor; // no boost for outside pass + + boostFactor = lerp(boostFactor, 1, isCap); // cap is always at max boost + return boostFactor; +} + +// boostFactor is normalized +float ComputeFresnel(float3 posObjectSpace, float3 vecCamToPixOSN, float outsideBeam, float boostFactor) +{ + // Compute normal + float2 cosSinFlat = normalize(posObjectSpace.xy); + float2 coneSlopeCosSin = VLB_GET_PROP(_ConeSlopeCosSin); + float3 normalObjectSpace = (float3(cosSinFlat.x * coneSlopeCosSin.x, cosSinFlat.y * coneSlopeCosSin.x, -coneSlopeCosSin.y)); + normalObjectSpace *= (outsideBeam * 2 - 1); // = outsideBeam ? 1 : -1; + + // real fresnel factor + float fresnelReal = dot(normalObjectSpace, -vecCamToPixOSN); + + // compute a fresnel factor to support long beams by projecting the viewDir vector + // on the virtual plane formed by the normal and tangent + float coneApexOffsetZ = VLB_GET_PROP(_ConeGeomProps).x; + float3 tangentPlaneNormal = normalize(posObjectSpace.xyz + float3(0, 0, coneApexOffsetZ)); + float distToPlane = dot(-vecCamToPixOSN, tangentPlaneNormal); + float3 vec2D = normalize(-vecCamToPixOSN - distToPlane * tangentPlaneNormal); + float fresnelProjOnTangentPlane = dot(normalObjectSpace, vec2D); + + // blend between the 2 fresnels + float3 localForwardDirN = VLB_GET_PROP(_LocalForwardDirection); + float vecCamToPixDotZ = dot(vecCamToPixOSN, localForwardDirN); + float factorNearAxisZ = abs(vecCamToPixDotZ); // factorNearAxisZ is normalized + + float fresnel = lerp(fresnelProjOnTangentPlane, fresnelReal, factorNearAxisZ); + + float fresnelPow = VLB_GET_PROP(_FresnelPow); + + // Lerp the fresnel pow to the glare factor according to how far we are from the axis Z + const float kMaxGlarePow = 1.5; + float glareFrontal = VLB_GET_PROP(_GlareFrontal); + float glareBehind = VLB_GET_PROP(_GlareBehind); + float glareFactor = kMaxGlarePow * (1 - lerp(glareFrontal, glareBehind, outsideBeam)); + fresnelPow = lerp(fresnelPow, min(fresnelPow, glareFactor), factorNearAxisZ); + + // Pow the fresnel + fresnel = smoothstep(0, 1, fresnel); + fresnel = (1 - isEqualOrGreater(-fresnel, 0)) * // fix edges artefacts on android ES2 + (pow(fresnel, fresnelPow)); + + // Boost distance inside + float boostFresnel = lerp(fresnel, 1 + 0.001, boostFactor); + fresnel = lerp(boostFresnel, fresnel, outsideBeam); // no boosted fresnel if outside + + // We do not have to treat cap a special way, since boostFactor is already set to 1 for cap via ComputeBoostFactor + + return fresnel; +} + + +inline float ComputeFadeWithCamera(float3 posViewSpace, float enabled) +{ + float distCamToPixWS = abs(posViewSpace.z); // only check Z axis (instead of length(posViewSpace.xyz)) to have smoother transition with near plane (which is not curved) + float camFadeDistStart = _ProjectionParams.y; // cam near place + float camFadeDistEnd = camFadeDistStart + VLB_GET_PROP(_DistanceCamClipping); + float fadeWhenTooClose = smoothstep(0, 1, invLerpClamped(camFadeDistStart, camFadeDistEnd, distCamToPixWS)); + + // fade out according to camera's near plane + return lerp(1, fadeWhenTooClose, enabled); +} + +float4 ComputeColor(float pixDistFromSource, float outsideBeam) +{ +#if VLB_COLOR_GRADIENT + float4 color = ComputeColorGradient(pixDistFromSource); +#elif VLB_COLOR_FLAT + float4 color = ComputeColorFlat(); +#endif + + float alphaInside = VLB_GET_PROP(_AlphaInside); + float alphaOutside = VLB_GET_PROP(_AlphaOutside); + float alpha = lerp(alphaInside, alphaOutside, outsideBeam); + + return ApplyAlphaToColor(color, alpha); +} + +inline float ComputeInOutBlending(float vecCamToPixDotZ, float outsideBeam) +{ + // smooth blend between inside and outside geometry depending of View Direction + const float kFaceLightSmoothingLimit = 1; + float factorFaceLightSourcePerPixN = saturate(smoothstep(kFaceLightSmoothingLimit, -kFaceLightSmoothingLimit, vecCamToPixDotZ)); // smoother transition + + return lerp(factorFaceLightSourcePerPixN, 1 - factorFaceLightSourcePerPixN, outsideBeam); +} + +#if VLB_MESH_SKEWING +inline float4 SkewVectorOS(float4 vec, float3 scaleObjectSpace) +{ + float3 localForwardDirN = VLB_GET_PROP(_LocalForwardDirection); + vec.xy += vec.z * localForwardDirN.xy * scaleObjectSpace.z / (scaleObjectSpace.xy * localForwardDirN.z); + return vec; +} + +inline float3 UnskewVectorOS(float3 vec) +{ + float3 localForwardDirN = VLB_GET_PROP(_LocalForwardDirection); + vec.xy -= localForwardDirN.xy * (vec.z / localForwardDirN.z); + return vec; +} +#endif // VLB_MESH_SKEWING + +// Vector Camera to current Pixel, in object space and normalized +inline float3 ComputeVectorCamToPixOSN(float3 pixPosOS, float3 cameraPosOS) +{ + float3 vecCamToPixOSN = normalize(pixPosOS - cameraPosOS); + + // Deal with ortho camera: + // With ortho camera, we don't want to change the fresnel according to camera position. + // So instead of computing the proper vector "Camera to Pixel", we take account of the "Camera Forward" vector (which is not dependant on the pixel position) + float4 cameraParams = VLB_GET_PROP(_CameraParams); + float3 vecCamForwardOSN = cameraParams.xyz; + +#if VLB_MESH_SKEWING + vecCamForwardOSN = normalize(UnskewVectorOS(vecCamForwardOSN)); +#endif // VLB_MESH_SKEWING + + return lerp(vecCamToPixOSN, vecCamForwardOSN, VLB_CAMERA_ORTHO); +} + +inline float GetTiltDistanceFactor(float3 posObjectSpace) +{ + float2 tiltVector = VLB_GET_PROP(_TiltVector); + float pixDistFromSource = abs(posObjectSpace.z); + return pixDistFromSource + posObjectSpace.x * tiltVector.x + posObjectSpace.y * tiltVector.y; +} + +v2f vertShared(vlb_appdata v, float outsideBeam) +{ + v2f o; + +#if VLB_INSTANCING_API_AVAILABLE && (VLB_STEREO_INSTANCING || VLB_GPU_INSTANCING) + UNITY_SETUP_INSTANCE_ID(v); + + #if VLB_STEREO_INSTANCING + #ifndef VLB_SRP_API // TODO CHECK THAT WE DON'T NEED THIS WITH SRP + UNITY_INITIALIZE_OUTPUT(v2f, o); + #endif + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + #endif + + #if VLB_GPU_INSTANCING + UNITY_TRANSFER_INSTANCE_ID(v, o); + #endif +#endif + +#if VLB_NOISE_3D || OPTIM_VS + o.uvwNoise_intensity = 1; +#endif + + // compute the proper cone shape, so the whole beam fits into a 2x2x1 box + // The model matrix (computed via the localScale from BeamGeometry.) + float4 vertexOS = v.vertex; + + vertexOS.z *= vertexOS.z; // make segment tessellation denser near the source, since beam is usually more visible at start + + float2 coneRadius = VLB_GET_PROP(_ConeRadius); + float maxRadius = max(coneRadius.x, coneRadius.y); + float normalizedRadiusStart = coneRadius.x / maxRadius; + float normalizedRadiusEnd = coneRadius.y / maxRadius; + vertexOS.xy *= lerp(normalizedRadiusStart, normalizedRadiusEnd, vertexOS.z); + + float3 scaleObjectSpace = float3(maxRadius, maxRadius, VLB_GET_PROP(_DistanceFallOff).z); // maxGeometryDistance + + o.posObjectSpaceNonSkewed = vertexOS.xyz * scaleObjectSpace; + +#if VLB_MESH_SKEWING + // skew the real vertex position + vertexOS = SkewVectorOS(vertexOS, scaleObjectSpace); +#endif + + o.posWorldSpace = VLBObjectToWorldPos(vertexOS); + o.posClipSpace = VLBObjectToClipPos(vertexOS.xyz); + // TODO Should create and use VLBWorldToClipPos instead + //o.posClipSpace = VLBWorldToClipPos(o.posWorldSpace.xyz); + +#if defined(VLBWorldToViewPos) + float3 posViewSpace = VLBWorldToViewPos(o.posWorldSpace.xyz); +#elif defined(VLBObjectToViewPos) + float3 posViewSpace = VLBObjectToViewPos(vertexOS); +#else + You_should_define_either_VLBWorldToViewPos_or_VLBObjectToViewPos +#endif + + // apply the same scaling than we do through the localScale in BeamGeometry.ComputeLocalMatrix + // to get the proper transformed vertex position in object space + o.posObjectSpace = vertexOS.xyz * scaleObjectSpace; + + +#if VLB_DEPTH_BLEND || VLB_DITHERING + o.projPos = Depth_VS_ComputeProjPos(posViewSpace, o.posClipSpace); +#endif + + float isCap = v.texcoord.x; + +#if VLB_NOISE_3D + o.uvwNoise_intensity.rgb = Noise3D_GetUVW(o.posWorldSpace.xyz, o.posObjectSpace); +#endif + + float3 cameraPosObjectSpace = VLBGetCameraPositionObjectSpace(scaleObjectSpace); + +#if VLB_MESH_SKEWING + cameraPosObjectSpace = UnskewVectorOS(cameraPosObjectSpace); // unskew the camera position of object space +#endif // VLB_MESH_SKEWING + + o.cameraPosObjectSpace_outsideBeam = float4( + cameraPosObjectSpace, + outsideBeam); + +#if OPTIM_VS + // Treat Cap a special way: cap is only visible from inside + float intensity = 1 - outsideBeam * isCap; // AKA if (outsideBeam == 1 && isCap == 1) intensity = 0 + + float pixDistFromSource = length(o.posObjectSpace.z); + + float pixDistFromSourceTilted = GetTiltDistanceFactor(o.posObjectSpace); + + float3 distancesFallOff = VLB_GET_PROP(_DistanceFallOff); + float attenuationLerpLinearQuad = VLB_GET_PROP(_AttenuationLerpLinearQuad); + intensity *= ComputeAttenuationSD(pixDistFromSourceTilted, distancesFallOff.x, distancesFallOff.y, attenuationLerpLinearQuad); + float boostFactor = ComputeBoostFactor(pixDistFromSource, outsideBeam, isCap); + + // Vector Camera to current Pixel, in object space and normalized + float3 vecCamToPixOSN = ComputeVectorCamToPixOSN(o.posObjectSpaceNonSkewed.xyz, cameraPosObjectSpace); + float vecCamToPixDotZ = dot(vecCamToPixOSN, float3(0, 0, 1)); + +#if OPTIM_VS_FRESNEL_VS + // Pass data needed to compute fresnel in fragment shader + // Computing fresnel on vertex shader give imprecise results + intensity *= ComputeFresnel(o.posObjectSpaceNonSkewed, vecCamToPixOSN, outsideBeam, boostFactor); +#endif + + // fade out + intensity *= VLB_GET_PROP(_FadeOutFactor); + + // smooth blend between inside and outside geometry depending of View Direction + intensity *= ComputeInOutBlending(vecCamToPixDotZ, outsideBeam); + + // no intensity for cap if _DrawCap = 0 + float drawCap = VLB_GET_PROP(_DrawCap); + intensity *= isEqualOrGreater(drawCap, isCap); + + o.uvwNoise_intensity.a = intensity; + + o.color = ComputeColor(pixDistFromSourceTilted, outsideBeam); + + float extraData = boostFactor; +#else + float extraData = isCap; +#endif // OPTIM_VS + + o.posViewSpace_extraData = float4(posViewSpace, extraData); + +#ifdef VLB_FOG_UNITY_BUILTIN_COORDS + UNITY_TRANSFER_FOG(o, o.posClipSpace); +#endif + return o; +} + +half4 fragShared(v2f i, float outsideBeam) +{ +#if VLB_INSTANCING_API_AVAILABLE && VLB_GPU_INSTANCING + UNITY_SETUP_INSTANCE_ID(i); +#endif + +#if VLB_INSTANCING_API_AVAILABLE && VLB_STEREO_INSTANCING + // This fix access to depth map on the right eye when using single pass (aka Stereo Rendering Mode Multiview) on Gear VR or Oculus Go/Quest + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); // https://docs.unity3d.com/Manual/SinglePassInstancing.html +#endif + + { + float4 cameraParams = VLB_GET_PROP(_CameraParams); + float cameraIsInsideBeamFactor = saturate(cameraParams.w); // _CameraParams.w is (-1 ; 1) + } + +#if OPTIM_VS + float intensity = i.uvwNoise_intensity.a; +#else + float intensity = 1; +#endif + + float pixDistFromSource = length(i.posObjectSpace.z); + + // additional clipping plane + { + float4 addClippingPlaneWS = VLB_GET_PROP(_AdditionalClippingPlaneWS); + clip(DistanceToPlane(i.posWorldSpace.xyz, addClippingPlaneWS.xyz, addClippingPlaneWS.w)); + } + + // DYNAMIC OCCLUSION +#if VLB_OCCLUSION_CLIPPING_PLANE + { + float4 clippingPlaneWS = VLB_GET_PROP(_DynamicOcclusionClippingPlaneWS); + float distToClipPlane = DistanceToPlane(i.posWorldSpace.xyz, clippingPlaneWS.xyz, clippingPlaneWS.w); + clip(distToClipPlane); + float fadeDistance = VLB_GET_PROP(_DynamicOcclusionClippingPlaneProps); + intensity *= smoothstep(0, fadeDistance, distToClipPlane); + } +#elif VLB_OCCLUSION_DEPTH_TEXTURE + { + #if VLB_GPU_INSTANCING + // Dynamic Occlusion Depth Texture is not supported with GPU Instancing because instanced cbuffers cannot hold samplers + return float4(1, 0, 0, 1); + #endif + + const float kMinNearClipPlane = 0.1f; // should be the same than in DynamicOcclusion.cs + float4 depthProps = VLB_GET_PROP(_DynamicOcclusionDepthProps); + const float isPersp = depthProps.w; + + float2 coneMeshProps = VLB_GET_PROP(_ConeGeomProps); + + float2 coneRadius = VLB_GET_PROP(_ConeRadius); + float widthAtThisZ = fromABtoCD_Clamped(pixDistFromSource, 0.0, VLB_GET_PROP(_DistanceFallOff).z, coneRadius.x, coneRadius.y); + float width = lerp(coneRadius.x, widthAtThisZ, isPersp); + + float2 srcUvCentered = (i.posObjectSpace.xy) / width; + + int coneMeshSides = (int)coneMeshProps.y; + if (coneMeshSides == 4) + { + // with 4 sides, make the UV matches a square instead of a cone to match with depth buffer camera frustum + float maxCenteredUV = max(abs(srcUvCentered.x), abs(srcUvCentered.y)); + srcUvCentered /= maxCenteredUV; + } + + float2 uv = srcUvCentered * 0.5 + 0.5; + + uv.x = flipUV(uv.x, depthProps.x); + uv.y = flipUV(uv.y, depthProps.y); + + float dynamicOcclusionDepthRaw = tex2D(_DynamicOcclusionDepthTexture, uv).r; + dynamicOcclusionDepthRaw = lerp(dynamicOcclusionDepthRaw, 1.0f - dynamicOcclusionDepthRaw, _VLB_UsesReversedZBuffer); + + float fallOffEnd = VLB_GET_PROP(_DistanceFallOff).z; // maxGeometryDistance + + float apexDist = coneMeshProps.x * isPersp; + float near = max(apexDist, kMinNearClipPlane); + float far = near + fallOffEnd; + + const float dynamicOcclusionDepthLinearPersp = VLB_ZBufferToLinear(dynamicOcclusionDepthRaw, near, far); + + // Compute ortho linear depth + const float dynamicOcclusionDepthLinearOrtho = dynamicOcclusionDepthRaw * (far - near); + + // get either the perspective or ortho depth + float dynamicOcclusionDepthLinear = lerp(dynamicOcclusionDepthLinearOrtho, dynamicOcclusionDepthLinearPersp, isPersp) - apexDist; + + float fadeDistance = depthProps.z; + float factor = smoothstep(0, fadeDistance, dynamicOcclusionDepthLinear - pixDistFromSource); + intensity *= lerp(factor, 1, isEqualOrGreater(dynamicOcclusionDepthRaw, 1)); // only apply factor if(dynamicOcclusionDepthRaw < 1), meaning there is an occlusion + } + +#endif + +#if DEBUG_SHOW_NOISE3D + return Noise3D_GetFactorFromUVW(i.uvwNoise_intensity.xyz); +#endif + + float3 cameraPosObjectSpace = i.cameraPosObjectSpace_outsideBeam.xyz; + + // Vector Camera to current Pixel, in object space and normalized + float3 vecCamToPixOSN = ComputeVectorCamToPixOSN(i.posObjectSpaceNonSkewed.xyz, cameraPosObjectSpace); + +#if VLB_NOISE_3D || !OPTIM_VS + // Blend inside and outside + float vecCamToPixDotZ = dot(vecCamToPixOSN, float3(0, 0, 1)); + float factorNearAxisZ = abs(vecCamToPixDotZ); +#endif + + // 3D NOISE +#if VLB_NOISE_3D + { + float noise3DFactor = Noise3D_GetFactorFromUVW(i.uvwNoise_intensity.rgb); + + // disable noise 3D when looking from behind or from inside because it makes the cone shape too much visible + noise3DFactor = lerp(noise3DFactor, 1, pow(factorNearAxisZ, 10)); + + intensity *= noise3DFactor; + } +#endif // VLB_NOISE_3D + + float3 posViewSpace = i.posViewSpace_extraData.xyz; + + // DEPTH BLEND +#if VLB_DEPTH_BLEND + { + float depthBlendDistance = VLB_GET_PROP(_DepthBlendDistance); + + #if FIX_DISABLE_DEPTH_BLEND_WITH_OBLIQUE_PROJ + // disable depth sampling with oblique projection + float3 nearPlaneWS = VLBFrustumPlanes[4].xyz; + float3 farPlaneWS = VLBFrustumPlanes[5].xyz; + float dotNearFar = abs(dot(nearPlaneWS, farPlaneWS)); // abs needed on 5.2, but not needed on 2018 + depthBlendDistance *= isEqualOrGreater(dotNearFar, 0.99); + #endif // FIX_DISABLE_DEPTH_BLEND_WITH_OBLIQUE_PROJ + + // we disable blend factor when the pixel is near the light source, + // to prevent from blending with the light source model geometry (like the flashlight model). + float depthBlendStartDistFromSource = depthBlendDistance; + float pixDistFromSourceNormalized = invLerpClamped(0, depthBlendStartDistFromSource, pixDistFromSource); + float depthBlendDist = depthBlendDistance * pixDistFromSourceNormalized; + float depthBlendFactor = DepthFade_PS_BlendDistance(i.projPos, posViewSpace, depthBlendDist); + depthBlendFactor = lerp(depthBlendFactor, 1, isEqualOrGreater(0, depthBlendDistance)); + depthBlendFactor = lerpClamped(1, depthBlendFactor, pixDistFromSourceNormalized * 100); // prevent artifacts when cap geometry is too close from some geometry + intensity *= depthBlendFactor; + + { // DEBUG + #if DEBUG_DEPTH_MODE == DEBUG_VALUE_DEPTHBUFFER_FROMEYE + return Depth_PS_GetSceneDepthFromEye(i.projPos, posViewSpace) * _ProjectionParams.w; + #elif DEBUG_DEPTH_MODE == DEBUG_VALUE_DEPTHBUFFER_FROMNEARPLANE + return Depth_PS_GetSceneDepthFromNearPlane(i.projPos) * _ProjectionParams.w; + #elif DEBUG_DEPTH_MODE == DEBUG_VALUE_DEPTHSTEREOEYE + float depthValue = Depth_PS_GetSceneDepthFromEye(i.projPos, posViewSpace) * _ProjectionParams.w; + #if defined(USING_STEREO_MATRICES) && defined(UNITY_STEREO_MULTIVIEW_ENABLED) // used with single pass / multiview on android VR (Oculus Go/Quest, Gear VR) + return depthValue * lerp(float4(1, 0, 0, 1), float4(0, 1, 0, 1), unity_StereoEyeIndex); + #elif defined(UNITY_SINGLE_PASS_STEREO) + return depthValue * lerp(float4(1, 0, 0, 1), float4(0, 0, 1, 1), unity_StereoEyeIndex); + #elif defined(UNITY_STEREO_INSTANCING_ENABLED) + return depthValue * lerp(float4(0, 1, 0, 1), float4(0, 0, 1, 1), unity_StereoEyeIndex); + #elif defined(UNITY_STEREO_MULTIVIEW_ENABLED) + return depthValue * lerp(float4(1, 1, 0, 1), float4(0, 1, 1, 1), unity_StereoEyeIndex); + #else + return depthValue; + #endif + #elif DEBUG_DEPTH_MODE == DEBUG_VALUE_DEPTHBLEND + return depthBlendFactor; + #endif + } // DEBUG + } +#endif // VLB_DEPTH_BLEND + +#if !OPTIM_VS + float pixDistFromSourceTilted = GetTiltDistanceFactor(i.posObjectSpace); + { + float isCap = i.posViewSpace_extraData.w; + + // no intensity for cap if _DrawCap = 0 + intensity *= isEqualOrGreater(VLB_GET_PROP(_DrawCap), isCap - 0.00001); + + // Treat Cap a special way: cap is only visible from inside + intensity *= 1 - outsideBeam * isCap; // AKA if (outsideBeam == 1 && isCap == 1) intensity = 0 + + // boost factor + float boostFactor = ComputeBoostFactor(pixDistFromSource, outsideBeam, isCap); + + // fresnel + intensity *= ComputeFresnel(i.posObjectSpaceNonSkewed, vecCamToPixOSN, outsideBeam, boostFactor); + + // fade out + intensity *= VLB_GET_PROP(_FadeOutFactor); + + // attenuation + float3 distancesFallOff = VLB_GET_PROP(_DistanceFallOff); + intensity *= ComputeAttenuationSD(pixDistFromSourceTilted, distancesFallOff.x, distancesFallOff.y, VLB_GET_PROP(_AttenuationLerpLinearQuad)); + + // smooth blend between inside and outside geometry depending of View Direction + intensity *= ComputeInOutBlending(vecCamToPixDotZ, outsideBeam); + } +#elif !OPTIM_VS_FRESNEL_VS // && OPTIM_VS + { + float boostFactor = i.posViewSpace_extraData.w; + // compute fresnel in fragment shader to keep good quality even with low tessellation + intensity *= ComputeFresnel(i.posObjectSpaceNonSkewed, vecCamToPixOSN, outsideBeam, boostFactor); + } +#endif // !OPTIM_VS_FRESNEL_VS && OPTIM_VS + + // fade when too close to camera factor + { + float fadeWithCameraEnabled = 1 - VLB_CAMERA_ORTHO; // fading according to camera eye position doesn't make sense with ortho camera + intensity *= ComputeFadeWithCamera(posViewSpace, fadeWithCameraEnabled); + } + +#if DEBUG_BLEND_INSIDE_OUTSIDE + float DBGvecCamToPixDotZ = dot(vecCamToPixOSN, float3(0, 0, 1)); + return lerp(float4(1, 0, 0, 1), float4(0, 1, 0, 1), ComputeInOutBlending(DBGvecCamToPixDotZ, outsideBeam)); +#endif // DEBUG_BLEND_INSIDE_OUTSIDE + + // Do not fill color.rgb only, because of performance drops on android +#if !OPTIM_VS + float4 color = ComputeColor(pixDistFromSourceTilted, outsideBeam); +#else + float4 color = i.color; +#endif + +#if VLB_DITHERING + float2 screenPos = i.projPos.xy / i.projPos.w; + float2 ditherCoord = screenPos * _ScreenParams.xy * _VLB_DitheringNoiseTex_TexelSize.xy; + float dither = tex2D(_VLB_DitheringNoiseTex, ditherCoord).r - 0.5; + color += (1 - saturate(intensity)) * _VLB_DitheringFactor * dither; +#endif + + ApplyPipelineSpecificIntensityModifier(/* inout */ intensity); + +#if VLB_ALPHA_AS_BLACK + color *= intensity; +#else + color.a *= intensity; +#endif + +#ifdef VLB_FOG_APPLY + VLB_FOG_APPLY(color); +#endif + return color; +} + +#endif \ No newline at end of file diff --git a/Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedSD.cginc.meta b/Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedSD.cginc.meta new file mode 100644 index 00000000..4d6b18c0 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/VolumetricLightBeamSharedSD.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 025a6043ec7e0b449bb360c35c0bcb20 +timeCreated: 1504539309 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Shaders/shadergen_base.txt b/Assets/External/VolumetricLightBeam/Shaders/shadergen_base.txt new file mode 100644 index 00000000..6f1d6f42 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/shadergen_base.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf8a7ed3d7bd154572fdc23688d187003f759431adec9c3f00420dabeea3c2b3 +size 3226 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Readme.txt.meta b/Assets/External/VolumetricLightBeam/Shaders/shadergen_base.txt.meta similarity index 54% rename from Assets/External/Horizon Based Ambient Occlusion/Readme.txt.meta rename to Assets/External/VolumetricLightBeam/Shaders/shadergen_base.txt.meta index f0990452..bab88943 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Readme.txt.meta +++ b/Assets/External/VolumetricLightBeam/Shaders/shadergen_base.txt.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 5ea4d0d9dc9d11941b341f03453fd6d3 -timeCreated: 1453642158 -licenseType: Store +guid: 08ac1efda1d05b44287ea2dd367f9d5e +timeCreated: 1592812249 +licenseType: Free TextScriptImporter: userData: assetBundleName: diff --git a/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_builtin.txt b/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_builtin.txt new file mode 100644 index 00000000..cb9c27f1 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_builtin.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:467152808940a8632411be9622c443a8de8861736b98b12678988c396c25feb1 +size 40 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials/Dragons.mat.meta b/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_builtin.txt.meta similarity index 55% rename from Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials/Dragons.mat.meta rename to Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_builtin.txt.meta index 76a19b69..e02f6c8b 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials/Dragons.mat.meta +++ b/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_builtin.txt.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 86e1545bedbf12044bc434adf047297c -timeCreated: 1454157498 -licenseType: Store -NativeFormatImporter: +guid: ee8814b2cee7fd144a04d6a24551c48b +timeCreated: 1592841392 +licenseType: Free +TextScriptImporter: userData: assetBundleName: assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_hdrp.txt b/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_hdrp.txt new file mode 100644 index 00000000..b976b6b7 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_hdrp.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a77bf97b3fd9a3785cb9c4fb9e34369a5f410341d75203dd8b00a307e2fc302 +size 216 diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP/Readme.txt.meta b/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_hdrp.txt.meta similarity index 54% rename from Assets/External/Horizon Based Ambient Occlusion/SRP/Readme.txt.meta rename to Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_hdrp.txt.meta index b12818a3..92978e8d 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP/Readme.txt.meta +++ b/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_hdrp.txt.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 15a5b7bce341d6a4189869b3d1c95ca1 -timeCreated: 1582907133 -licenseType: Store +guid: 30c63e832e947354e8a77d5e829fffeb +timeCreated: 1592841465 +licenseType: Free TextScriptImporter: userData: assetBundleName: diff --git a/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_urp.txt b/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_urp.txt new file mode 100644 index 00000000..d7ea8e4a --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_urp.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1df066031e48fa3cf8b845a5df85600149c90ab1ea0d407b01deec074476b10 +size 313 diff --git a/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_urp.txt.meta b/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_urp.txt.meta new file mode 100644 index 00000000..4443c1ae --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/shadergen_includes_urp.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 63a637fa650f3444d93ad1bcb6b45d28 +timeCreated: 1592841460 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/Shaders/shadergen_pass.txt b/Assets/External/VolumetricLightBeam/Shaders/shadergen_pass.txt new file mode 100644 index 00000000..c78b8a72 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/shadergen_pass.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e435c4b58e0ac4efc866c978d4617f584f5b9d7276ee68a5474d4a25cadeffb +size 979 diff --git a/Assets/External/VolumetricLightBeam/Shaders/shadergen_pass.txt.meta b/Assets/External/VolumetricLightBeam/Shaders/shadergen_pass.txt.meta new file mode 100644 index 00000000..b009bafb --- /dev/null +++ b/Assets/External/VolumetricLightBeam/Shaders/shadergen_pass.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b6eb5846ef7ddc640b6a24b36de75bda +timeCreated: 1592812249 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/VolumetricLightBeam/package.json b/Assets/External/VolumetricLightBeam/package.json new file mode 100644 index 00000000..a7e47e77 --- /dev/null +++ b/Assets/External/VolumetricLightBeam/package.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c393208e125a30d983e0746639c8e83f5ec23963e996a022b438574af495822e +size 965 diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs/Dragons Candle.prefab.meta b/Assets/External/VolumetricLightBeam/package.json.meta similarity index 62% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs/Dragons Candle.prefab.meta rename to Assets/External/VolumetricLightBeam/package.json.meta index 65282e40..6fb96d0c 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs/Dragons Candle.prefab.meta +++ b/Assets/External/VolumetricLightBeam/package.json.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 4fa342793b1493444a4aa2562a2d6aa4 -PrefabImporter: +guid: 9095888345d05644ebaee5d07b5bc0e4 +TextScriptImporter: externalObjects: {} userData: assetBundleName: diff --git a/Assets/Resources/VLBConfigOverride.asset b/Assets/Resources/VLBConfigOverride.asset new file mode 100644 index 00000000..9dd8d429 --- /dev/null +++ b/Assets/Resources/VLBConfigOverride.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c334cf3733d3d86153609584bf1cd403f6c22ac42141d3ea4dd3ce9dfc552af1 +size 2052 diff --git a/Assets/Resources/VLBConfigOverride.asset.meta b/Assets/Resources/VLBConfigOverride.asset.meta new file mode 100644 index 00000000..9e4c2240 --- /dev/null +++ b/Assets/Resources/VLBConfigOverride.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a750379b2057ad840ad53e37e279e713 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic.meta new file mode 100644 index 00000000..bbf1785d --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8e3533db80319d54eaf4907803e37b4d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Cookie.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Cookie.meta new file mode 100644 index 00000000..2ea5e573 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Cookie.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c0ca9a37de03d8f4caba6a0831f45aa5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Cookie/Light Cookie.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Cookie/Light Cookie.png new file mode 100644 index 00000000..6234113b --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Cookie/Light Cookie.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb17a82e4586c2eb25e72c9056ec2aaa9cefd0d11a657f8a09e0f9dc450ec962 +size 237331 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Cookie/Light Cookie.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Cookie/Light Cookie.png.meta new file mode 100644 index 00000000..73727b54 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Cookie/Light Cookie.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: e38cdc25b1f74cf42b36360139a8eb61 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb.meta new file mode 100644 index 00000000..fb370388 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3d289b1c8ab640842897ab6f0ab4e94c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials.meta new file mode 100644 index 00000000..d6f46bd3 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 99734d83ae92c4c4b9f646cb3b9bf9fd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorD03].mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorD03].mat new file mode 100644 index 00000000..92cb92d7 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorD03].mat @@ -0,0 +1,141 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-4265519077924887625 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: '[ColorD03]' + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _ALPHAPREMULTIPLY_ON + - _SURFACE_TYPE_TRANSPARENT + m_InvalidKeywords: + - _ALPHABLEND_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: + - MOTIONVECTORS + - DepthOnly + - SHADOWCASTER + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _DstBlendAlpha: 10 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 1 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 1 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 1 + - _WorkflowMode: 1 + - _ZWrite: 0 + m_Colors: + - _BaseColor: {r: 0.870302, g: 0.66858035, b: 0.12924352, a: 0.64} + - _Color: {r: 0.870302, g: 0.66858035, b: 0.1292435, a: 0.64} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorD03].mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorD03].mat.meta new file mode 100644 index 00000000..73fdbbbf --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorD03].mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 30c831715f2ed114685291ea40ebd806 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorI07].mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorI07].mat new file mode 100644 index 00000000..a89d660c --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorI07].mat @@ -0,0 +1,141 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: '[ColorI07]' + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _ALPHAPREMULTIPLY_ON + - _SURFACE_TYPE_TRANSPARENT + m_InvalidKeywords: + - _ALPHABLEND_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: + - MOTIONVECTORS + - DepthOnly + - SHADOWCASTER + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _DstBlendAlpha: 10 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 1 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 1 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 1 + - _WorkflowMode: 1 + - _ZWrite: 0 + m_Colors: + - _BaseColor: {r: 0.029237356, g: 0.15134946, b: 0.7583611, a: 0.64} + - _Color: {r: 0.029237356, g: 0.15134943, b: 0.7583611, a: 0.64} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &7125192465405682734 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorI07].mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorI07].mat.meta new file mode 100644 index 00000000..5a9d3799 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/[ColorI07].mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 34e65dd9a1a17474fafb1fb20da82d21 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials/Dragons.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-1.mat similarity index 91% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials/Dragons.mat rename to Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-1.mat index 56a79cce..3fbb6d17 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials/Dragons.mat +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-1.mat @@ -7,7 +7,7 @@ Material: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: Dragons + m_Name: f-1 m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} m_Parent: {fileID: 0} m_ModifiedSerializedProperties: 0 @@ -16,7 +16,7 @@ Material: m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 - m_CustomRenderQueue: 2000 + m_CustomRenderQueue: -1 stringTagMap: RenderType: Opaque disabledShaderPasses: @@ -26,11 +26,11 @@ Material: serializedVersion: 3 m_TexEnvs: - _BaseMap: - m_Texture: {fileID: 2800000, guid: ca39994063dd9c94894e7e05a63ed4af, type: 3} + m_Texture: {fileID: 2800000, guid: 754ccae5837f42e4ea0a86b5f7645bd9, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _BumpMap: - m_Texture: {fileID: 2800000, guid: bfacece48cb4c964eb84698e1d9cf1f5, type: 3} + m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _DetailAlbedoMap: @@ -50,7 +50,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: - m_Texture: {fileID: 2800000, guid: ca39994063dd9c94894e7e05a63ed4af, type: 3} + m_Texture: {fileID: 2800000, guid: 754ccae5837f42e4ea0a86b5f7645bd9, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MetallicGlossMap: @@ -83,6 +83,7 @@ Material: m_Offset: {x: 0, y: 0} m_Ints: [] m_Floats: + - _AddPrecomputedVelocity: 0 - _AlphaClip: 0 - _AlphaToMask: 0 - _Blend: 0 @@ -120,7 +121,7 @@ Material: - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} m_BuildTextureStacks: [] m_AllowLocking: 1 ---- !u!114 &3150744375204830071 +--- !u!114 &7755827132108391764 MonoBehaviour: m_ObjectHideFlags: 11 m_CorrespondingSourceObject: {fileID: 0} diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-1.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-1.mat.meta new file mode 100644 index 00000000..d4276ab9 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-1.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 42be02ff9ed74d94fbc10eda95cc9a34 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials/Dragons.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-2.mat similarity index 53% rename from Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials/Dragons.mat rename to Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-2.mat index 659c96ba..dd241f28 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials/Dragons.mat +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-2.mat @@ -7,8 +7,8 @@ Material: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: Dragons - m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_Name: f-2 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} m_Parent: {fileID: 0} m_ModifiedSerializedProperties: 0 m_ValidKeywords: [] @@ -17,12 +17,18 @@ Material: m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS m_LockedProperties: m_SavedProperties: serializedVersion: 3 m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: f0e68b381628414498f5d35f9b5980d6, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} - _BumpMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} @@ -44,7 +50,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: - m_Texture: {fileID: 2800000, guid: ca39994063dd9c94894e7e05a63ed4af, type: 3} + m_Texture: {fileID: 2800000, guid: f0e68b381628414498f5d35f9b5980d6, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MetallicGlossMap: @@ -63,28 +69,68 @@ Material: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} m_Ints: [] m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 - _DetailNormalMapScale: 1 - _DstBlend: 0 - - _EmissionScaleUI: 0 - - _GlossMapScale: 1 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 - _Glossiness: 0 - - _GlossyReflections: 1 + - _GlossyReflections: 0 - _Metallic: 0 - - _Mode: 0 - _OcclusionStrength: 1 - - _Parallax: 0.02 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1 - - _UVSec: 0 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 - _ZWrite: 1 m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1} - - _EmissionColor: {r: 0, g: 0, b: 0, a: 0} - - _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &4947898158809251731 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-2.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-2.mat.meta new file mode 100644 index 00000000..a2b0579d --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-2.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eaae604dd1420bc498b3454b90ad35b5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-3.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-3.mat new file mode 100644 index 00000000..a0f5a9c8 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-3.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: f-3 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: 4039b45cf582f3d4e8a15e35ac6419b9, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 4039b45cf582f3d4e8a15e35ac6419b9, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &4833214442972585206 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-3.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-3.mat.meta new file mode 100644 index 00000000..f4cdf294 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-3.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1cf622092f589ed4f8df6c056123f4ac +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-4.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-4.mat new file mode 100644 index 00000000..d1492f9b --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-4.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: f-4 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: d38e461c9b35a2d4e9b6ec269b2e5a5c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: d38e461c9b35a2d4e9b6ec269b2e5a5c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &6897251677834305735 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-4.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-4.mat.meta new file mode 100644 index 00000000..15524a25 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-4.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 576dc26f77bb9a1428679c0b24ebbe98 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-5.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-5.mat new file mode 100644 index 00000000..b954d735 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-5.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: f-5 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: 1858b2111cb35e149a0a11a8010e7ad4, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 1858b2111cb35e149a0a11a8010e7ad4, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &8091623698422107597 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-5.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-5.mat.meta new file mode 100644 index 00000000..18732a52 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/f-5.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a960abc606117eb48b48fdbe9591f4b1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/floor.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/floor.mat new file mode 100644 index 00000000..8f69d180 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/floor.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-3207180508026032363 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: floor + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: 37636f199193de44fb43f2155ff94f60, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 37636f199193de44fb43f2155ff94f60, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/floor.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/floor.mat.meta new file mode 100644 index 00000000..6b43b55f --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/floor.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f5420bff8b9b2f9488491961c8e51358 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-1.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-1.mat new file mode 100644 index 00000000..403bb84d --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-1.mat @@ -0,0 +1,141 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-6917602037968300824 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: g-1 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _ALPHAPREMULTIPLY_ON + - _SURFACE_TYPE_TRANSPARENT + m_InvalidKeywords: + - _ALPHABLEND_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: + - MOTIONVECTORS + - DepthOnly + - SHADOWCASTER + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _DstBlendAlpha: 10 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 1 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 1 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 1 + - _WorkflowMode: 1 + - _ZWrite: 0 + m_Colors: + - _BaseColor: {r: 0.98482007, g: 0.93534416, b: 0.8125654, a: 0.64} + - _Color: {r: 0.98482007, g: 0.93534416, b: 0.8125654, a: 0.64} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-1.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-1.mat.meta new file mode 100644 index 00000000..4b11151c --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-1.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 329933511d2ad554aa3ecdb669afbab2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-2.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-2.mat new file mode 100644 index 00000000..cc2ff1e0 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-2.mat @@ -0,0 +1,141 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: g-2 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _ALPHAPREMULTIPLY_ON + - _SURFACE_TYPE_TRANSPARENT + m_InvalidKeywords: + - _ALPHABLEND_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: + - MOTIONVECTORS + - DepthOnly + - SHADOWCASTER + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _DstBlendAlpha: 10 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 1 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 1 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 1 + - _WorkflowMode: 1 + - _ZWrite: 0 + m_Colors: + - _BaseColor: {r: 0.82414, g: 0.3469741, b: 0.025367336, a: 0.64} + - _Color: {r: 0.82414, g: 0.34697407, b: 0.025367336, a: 0.64} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &8024971840253124130 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-2.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-2.mat.meta new file mode 100644 index 00000000..628fcc80 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-2.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 45a7a7a841b665d4789345a3d33f2080 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-3.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-3.mat new file mode 100644 index 00000000..617487ee --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-3.mat @@ -0,0 +1,141 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: g-3 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _ALPHAPREMULTIPLY_ON + - _SURFACE_TYPE_TRANSPARENT + m_InvalidKeywords: + - _ALPHABLEND_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: + - MOTIONVECTORS + - DepthOnly + - SHADOWCASTER + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _DstBlendAlpha: 10 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 1 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 1 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 1 + - _WorkflowMode: 1 + - _ZWrite: 0 + m_Colors: + - _BaseColor: {r: 0.18194437, g: 0.5618623, b: 0.62134033, a: 0.64} + - _Color: {r: 0.18194434, g: 0.5618623, b: 0.62134033, a: 0.64} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &7112385592040011534 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-3.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-3.mat.meta new file mode 100644 index 00000000..bbed8710 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/g-3.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e7ac1467c5159ae4499efe280e9232ac +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/glass.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/glass.mat new file mode 100644 index 00000000..6babae4e --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/glass.mat @@ -0,0 +1,141 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: glass + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _ALPHAPREMULTIPLY_ON + - _SURFACE_TYPE_TRANSPARENT + m_InvalidKeywords: + - _ALPHABLEND_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: + - MOTIONVECTORS + - DepthOnly + - SHADOWCASTER + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _DstBlendAlpha: 10 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0.996 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 1 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 1 + - _WorkflowMode: 1 + - _ZWrite: 0 + m_Colors: + - _BaseColor: {r: 0.8087041, g: 0.8318487, b: 0.85493845, a: 0.43} + - _Color: {r: 0.8087041, g: 0.8318487, b: 0.85493845, a: 0.43} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &7387180335468670927 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/glass.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/glass.mat.meta new file mode 100644 index 00000000..67ec8e50 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/glass.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b92dfb6a09925d84cbc54b78994e3306 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble1.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble1.mat new file mode 100644 index 00000000..74494045 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble1.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: marble1 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: fd223f4e3f0a9774db9a7eeff6e93668, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: fd223f4e3f0a9774db9a7eeff6e93668, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &1433456765538791170 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble1.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble1.mat.meta new file mode 100644 index 00000000..cf77c8dc --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble1.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 08fb09530eeb3f34f992f855a8925c00 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble2.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble2.mat new file mode 100644 index 00000000..fe343075 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble2.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: marble2 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: a24c39785d24a5a4a8c7056028bc7b58, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: a24c39785d24a5a4a8c7056028bc7b58, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &5300005846258697753 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble2.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble2.mat.meta new file mode 100644 index 00000000..8f16f569 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble2.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 39f3e0ed7b4597c4db96b89fe5b67e05 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble3.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble3.mat new file mode 100644 index 00000000..2305cdd0 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble3.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-3282735006127745162 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: marble3 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: 1065083bce348314b89bb0ab1fc9d973, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 1065083bce348314b89bb0ab1fc9d973, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble3.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble3.mat.meta new file mode 100644 index 00000000..529ff33f --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble3.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0808942aba8350742ba332f592875b36 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble4.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble4.mat new file mode 100644 index 00000000..76bc5fcb --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble4.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-4389493933235067316 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: marble4 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: 8df8619c93282494a83768bb2d913188, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 8df8619c93282494a83768bb2d913188, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble4.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble4.mat.meta new file mode 100644 index 00000000..a4c75068 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/marble4.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 429d720de14bdcf4d8ff650d616d726d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof.mat new file mode 100644 index 00000000..2966404b --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-1149154889806339825 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: roof + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: 9d3f0b6826b53e44885c04ba560797ed, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 9d3f0b6826b53e44885c04ba560797ed, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof.mat.meta new file mode 100644 index 00000000..311e5536 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ecd60eb0d9d7f4344b4f59cbc2bc80c2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof2.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof2.mat new file mode 100644 index 00000000..f386009d --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof2.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-2440763372426997511 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: roof2 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0.25909215, g: 0.24211338, b: 0.21647692, a: 1} + - _Color: {r: 0.25909212, g: 0.24211335, b: 0.21647689, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof2.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof2.mat.meta new file mode 100644 index 00000000..d03612a1 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/roof2.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 36d4c2cbeefa9a246a1957200940e9f2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/silver.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/silver.mat new file mode 100644 index 00000000..621694d4 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/silver.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-3987220690674404887 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: silver + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: 2b6532ab642109a44b7075f2a2d4e516, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 2b6532ab642109a44b7075f2a2d4e516, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/silver.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/silver.mat.meta new file mode 100644 index 00000000..4069bf22 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/silver.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cd3881c52204ccc408770cfe3e81a0f1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone.mat new file mode 100644 index 00000000..839f83f2 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: stone + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: d7983b8f1d4aae84e9a4586d71dbd7ce, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: d7983b8f1d4aae84e9a4586d71dbd7ce, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &3765672611302530192 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone.mat.meta new file mode 100644 index 00000000..c9086c5d --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a4e300991cbba4f45873a32b428cbc80 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone3.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone3.mat new file mode 100644 index 00000000..9397cf94 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone3.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-8631058674928105287 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: stone3 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: 57b5dfbc7164b8440b54663282d2ccd6, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 57b5dfbc7164b8440b54663282d2ccd6, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone3.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone3.mat.meta new file mode 100644 index 00000000..bc6ba094 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/stone3.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ca74c7b7e9957e54a82e913df5045687 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wall.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wall.mat new file mode 100644 index 00000000..54f2eb86 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wall.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-5158730541226136945 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: wall + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: 39327623265f2e749acafeb4c1be431d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 39327623265f2e749acafeb4c1be431d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wall.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wall.mat.meta new file mode 100644 index 00000000..08a39779 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wall.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c3ea399484a607140bd31e2b136b35be +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/window.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/window.mat new file mode 100644 index 00000000..5f6032df --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/window.mat @@ -0,0 +1,140 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-3595389983073707400 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: window + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _ALPHAPREMULTIPLY_ON + - _SURFACE_TYPE_TRANSPARENT + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: + - MOTIONVECTORS + - DepthOnly + - SHADOWCASTER + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: 2a2cc315d0b425445ad6ee0a9d244fe7, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 2a2cc315d0b425445ad6ee0a9d244fe7, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _DstBlendAlpha: 10 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 1 + - _WorkflowMode: 1 + - _ZWrite: 0 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/window.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/window.mat.meta new file mode 100644 index 00000000..43b42ac0 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/window.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5094bd216cabc3244a647915d1d63cba +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood.mat new file mode 100644 index 00000000..8e2139b2 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: wood + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: e02433d2f6233cf48aaef5bf9d8e8706, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: e02433d2f6233cf48aaef5bf9d8e8706, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &2057227840791439383 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood.mat.meta new file mode 100644 index 00000000..9e366d99 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 256b07847bdf5584794193f83e7acc04 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood1.mat b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood1.mat new file mode 100644 index 00000000..c50ac76f --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood1.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-5810170270064531800 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: wood1 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: 6a2a388d96cfa694aab2ab2797a93511, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 6a2a388d96cfa694aab2ab2797a93511, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood1.mat.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood1.mat.meta new file mode 100644 index 00000000..4a019815 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Materials/wood1.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f2c91427ea62744428aee141797f74bb +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures.meta new file mode 100644 index 00000000..6f6bdd40 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8e180ccb94a6b1f4383ea8318ab3a82e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5.png new file mode 100644 index 00000000..24791e63 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b13168de91d0d89841ef4a33702428450fd8924fc0503a696ee4bf63d67eeceb +size 132089 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5.png.meta new file mode 100644 index 00000000..88d87ad5 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 6a2a388d96cfa694aab2ab2797a93511 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5__UNIGLTF__DUPLICATED__2.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5__UNIGLTF__DUPLICATED__2.png new file mode 100644 index 00000000..0c93faf7 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5__UNIGLTF__DUPLICATED__2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11baacaa14687a893e470e8bff6a45634f4613253401b55fd885e2bb16f272f6 +size 141811 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5__UNIGLTF__DUPLICATED__2.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5__UNIGLTF__DUPLICATED__2.png.meta new file mode 100644 index 00000000..f5e28963 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/wood_5__UNIGLTF__DUPLICATED__2.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: e02433d2f6233cf48aaef5bf9d8e8706 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/금속2_수정.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/금속2_수정.png new file mode 100644 index 00000000..209d4bff --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/금속2_수정.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbfc2338ce169e90244548d149c1aa8977da26d250884841f1e07f0a0cb1c369 +size 43600 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/금속2_수정.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/금속2_수정.png.meta new file mode 100644 index 00000000..27c1e277 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/금속2_수정.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 2b6532ab642109a44b7075f2a2d4e516 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2.png new file mode 100644 index 00000000..501f92a0 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca93ad7460b8c3e874ae5683ab94831d65745585db1df53c0f9b65a8629ca291 +size 70192 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2.png.meta new file mode 100644 index 00000000..0beeabd2 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 37636f199193de44fb43f2155ff94f60 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__2.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__2.png new file mode 100644 index 00000000..cb92aa69 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c38e6c6effcfdcb722b753423970c7ac85da081e1ac037f92832e537ae62723d +size 59233 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__2.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__2.png.meta new file mode 100644 index 00000000..a1c83e63 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__2.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: a24c39785d24a5a4a8c7056028bc7b58 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__3.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__3.png new file mode 100644 index 00000000..55a2ab0a --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8790e79336d7776789377fba35eb9d5987bcaa46a04ac65fca1a1698768589ed +size 68866 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__3.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__3.png.meta new file mode 100644 index 00000000..41a219f7 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__3.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 8df8619c93282494a83768bb2d913188 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__4.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__4.png new file mode 100644 index 00000000..b41fc66a --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ed54ccb90d570fa093233abb09931b05c812b8738bb64dac0cde097072c395b +size 60114 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__4.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__4.png.meta new file mode 100644 index 00000000..b0dde58c --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__4.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 1065083bce348314b89bb0ab1fc9d973 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__5.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__5.png new file mode 100644 index 00000000..8928917f --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__5.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75825b7e92f96c9627d3469a1b5fa3337f904c18d176d7c5a986b2dc4b7e080c +size 62542 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__5.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__5.png.meta new file mode 100644 index 00000000..605249af --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_2__UNIGLTF__DUPLICATED__5.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 2a2cc315d0b425445ad6ee0a9d244fe7 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown.png new file mode 100644 index 00000000..4ad20112 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5f4a8f45218409f155fe02faf4a55350029df03cd04d5f1d36a5fe943b0ce0a +size 110601 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown.png.meta new file mode 100644 index 00000000..98d454d1 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: fd223f4e3f0a9774db9a7eeff6e93668 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__2.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__2.png new file mode 100644 index 00000000..c267d6e0 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b8bb8bab102ea238122e67cd93c88c674ac48a8ac5613d881478f0b64456cc62 +size 109675 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__2.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__2.png.meta new file mode 100644 index 00000000..3469e08c --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__2.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 1858b2111cb35e149a0a11a8010e7ad4 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__3.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__3.png new file mode 100644 index 00000000..73e75af0 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee4996744a22863ab530093502f6c2d59de8ddadd9abd4d72701c55a60f00721 +size 151136 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__3.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__3.png.meta new file mode 100644 index 00000000..a2d94fdd --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__3.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: d38e461c9b35a2d4e9b6ec269b2e5a5c +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__4.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__4.png new file mode 100644 index 00000000..90788989 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3b07074f83cae06aed3771881f58fb59d3a8299f7b75e6b216adf3deb5ea48e1 +size 153375 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__4.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__4.png.meta new file mode 100644 index 00000000..af784b03 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__4.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: f0e68b381628414498f5d35f9b5980d6 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__5.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__5.png new file mode 100644 index 00000000..c6478ca8 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__5.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:033b2011d8a13db6f5651a9ab5020d0e0a90ec1168bc87f2c2d3b0ddabe070cc +size 83066 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__5.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__5.png.meta new file mode 100644 index 00000000..fbb9be95 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__5.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 4039b45cf582f3d4e8a15e35ac6419b9 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__6.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__6.png new file mode 100644 index 00000000..f93b2d41 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__6.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3457e34e2ecfed0bfc305799802d01aef2ee9cbd758e1657c130de801ddd4e95 +size 125804 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__6.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__6.png.meta new file mode 100644 index 00000000..8aa54c17 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/대리석_brown__UNIGLTF__DUPLICATED__6.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 754ccae5837f42e4ea0a86b5f7645bd9 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/돌바닥2.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/돌바닥2.png new file mode 100644 index 00000000..6cf439ad --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/돌바닥2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f4e8eefd22adb5859ddea04801366b7f5a3bf8c47e3fb2cba228345a5d9943cd +size 153231 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/돌바닥2.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/돌바닥2.png.meta new file mode 100644 index 00000000..1fd3edc3 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/돌바닥2.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: d7983b8f1d4aae84e9a4586d71dbd7ce +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/벽돌2-1.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/벽돌2-1.png new file mode 100644 index 00000000..f3d677d5 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/벽돌2-1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dfa748883fa7ef60687506fc706e883103f2647e4edbe21072e6d91fe42e9e25 +size 476400 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/벽돌2-1.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/벽돌2-1.png.meta new file mode 100644 index 00000000..5f88e86a --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/벽돌2-1.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 39327623265f2e749acafeb4c1be431d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/석재.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/석재.png new file mode 100644 index 00000000..4cbc35ab --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/석재.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73170e4d32027ca976ce9e90c2395c561185b68facfc25982d48532afb082eed +size 65311 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/석재.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/석재.png.meta new file mode 100644 index 00000000..f953fe44 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/석재.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 57b5dfbc7164b8440b54663282d2ccd6 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/지붕2.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/지붕2.png new file mode 100644 index 00000000..cd95151b --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/지붕2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:86187947ffe6fabde8927b977bb8dd1bbb4c4f1f791732ac71d264b3076955d3 +size 89106 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/지붕2.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/지붕2.png.meta new file mode 100644 index 00000000..ff7fcad6 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.Textures/지붕2.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 9d3f0b6826b53e44885c04ba560797ed +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.glb b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.glb new file mode 100644 index 00000000..f38d08fe --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad8f6f93be920ed522791b6f7fe6b2ad06cee14ba9e5928fb0c5548520490271 +size 51359276 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.glb.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.glb.meta new file mode 100644 index 00000000..dc061456 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/Cathedral_medieval_Fantastic.glb.meta @@ -0,0 +1,227 @@ +fileFormatVersion: 2 +guid: 6ee481ea7bdbffe4dac0d834711b2c56 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: '[ColorD03]' + second: {fileID: 2100000, guid: 30c831715f2ed114685291ea40ebd806, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: '[ColorI07]' + second: {fileID: 2100000, guid: 34e65dd9a1a17474fafb1fb20da82d21, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: f-1 + second: {fileID: 2100000, guid: 42be02ff9ed74d94fbc10eda95cc9a34, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: f-2 + second: {fileID: 2100000, guid: eaae604dd1420bc498b3454b90ad35b5, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: f-3 + second: {fileID: 2100000, guid: 1cf622092f589ed4f8df6c056123f4ac, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: f-4 + second: {fileID: 2100000, guid: 576dc26f77bb9a1428679c0b24ebbe98, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: f-5 + second: {fileID: 2100000, guid: a960abc606117eb48b48fdbe9591f4b1, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: floor + second: {fileID: 2100000, guid: f5420bff8b9b2f9488491961c8e51358, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: g-1 + second: {fileID: 2100000, guid: 329933511d2ad554aa3ecdb669afbab2, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: g-2 + second: {fileID: 2100000, guid: 45a7a7a841b665d4789345a3d33f2080, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: g-3 + second: {fileID: 2100000, guid: e7ac1467c5159ae4499efe280e9232ac, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: glass + second: {fileID: 2100000, guid: b92dfb6a09925d84cbc54b78994e3306, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: marble1 + second: {fileID: 2100000, guid: 08fb09530eeb3f34f992f855a8925c00, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: marble2 + second: {fileID: 2100000, guid: 39f3e0ed7b4597c4db96b89fe5b67e05, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: marble3 + second: {fileID: 2100000, guid: 0808942aba8350742ba332f592875b36, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: marble4 + second: {fileID: 2100000, guid: 429d720de14bdcf4d8ff650d616d726d, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: roof + second: {fileID: 2100000, guid: ecd60eb0d9d7f4344b4f59cbc2bc80c2, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: roof2 + second: {fileID: 2100000, guid: 36d4c2cbeefa9a246a1957200940e9f2, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: silver + second: {fileID: 2100000, guid: cd3881c52204ccc408770cfe3e81a0f1, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: stone + second: {fileID: 2100000, guid: a4e300991cbba4f45873a32b428cbc80, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: stone3 + second: {fileID: 2100000, guid: ca74c7b7e9957e54a82e913df5045687, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: wall + second: {fileID: 2100000, guid: c3ea399484a607140bd31e2b136b35be, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: window + second: {fileID: 2100000, guid: 5094bd216cabc3244a647915d1d63cba, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: wood + second: {fileID: 2100000, guid: 256b07847bdf5584794193f83e7acc04, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: wood1 + second: {fileID: 2100000, guid: f2c91427ea62744428aee141797f74bb, type: 2} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: wood_5 + second: {fileID: 2800000, guid: 6a2a388d96cfa694aab2ab2797a93511, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: wood_5__UNIGLTF__DUPLICATED__2 + second: {fileID: 2800000, guid: e02433d2f6233cf48aaef5bf9d8e8706, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uAE08\uC18D2_\uC218\uC815" + second: {fileID: 2800000, guid: 2b6532ab642109a44b7075f2a2d4e516, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uB300\uB9AC\uC11D_2" + second: {fileID: 2800000, guid: 37636f199193de44fb43f2155ff94f60, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uB300\uB9AC\uC11D_2__UNIGLTF__DUPLICATED__2" + second: {fileID: 2800000, guid: a24c39785d24a5a4a8c7056028bc7b58, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uB300\uB9AC\uC11D_2__UNIGLTF__DUPLICATED__3" + second: {fileID: 2800000, guid: 8df8619c93282494a83768bb2d913188, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uB300\uB9AC\uC11D_2__UNIGLTF__DUPLICATED__4" + second: {fileID: 2800000, guid: 1065083bce348314b89bb0ab1fc9d973, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uB300\uB9AC\uC11D_2__UNIGLTF__DUPLICATED__5" + second: {fileID: 2800000, guid: 2a2cc315d0b425445ad6ee0a9d244fe7, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uB300\uB9AC\uC11D_brown" + second: {fileID: 2800000, guid: fd223f4e3f0a9774db9a7eeff6e93668, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uB300\uB9AC\uC11D_brown__UNIGLTF__DUPLICATED__2" + second: {fileID: 2800000, guid: 1858b2111cb35e149a0a11a8010e7ad4, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uB300\uB9AC\uC11D_brown__UNIGLTF__DUPLICATED__3" + second: {fileID: 2800000, guid: d38e461c9b35a2d4e9b6ec269b2e5a5c, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uB300\uB9AC\uC11D_brown__UNIGLTF__DUPLICATED__4" + second: {fileID: 2800000, guid: f0e68b381628414498f5d35f9b5980d6, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uB300\uB9AC\uC11D_brown__UNIGLTF__DUPLICATED__5" + second: {fileID: 2800000, guid: 4039b45cf582f3d4e8a15e35ac6419b9, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uB300\uB9AC\uC11D_brown__UNIGLTF__DUPLICATED__6" + second: {fileID: 2800000, guid: 754ccae5837f42e4ea0a86b5f7645bd9, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uB3CC\uBC14\uB2E52" + second: {fileID: 2800000, guid: d7983b8f1d4aae84e9a4586d71dbd7ce, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uBCBD\uB3CC2-1" + second: {fileID: 2800000, guid: 39327623265f2e749acafeb4c1be431d, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uC11D\uC7AC" + second: {fileID: 2800000, guid: 57b5dfbc7164b8440b54663282d2ccd6, type: 3} + - first: + type: UnityEngine:Texture + assembly: UnityEngine.CoreModule + name: "\uC9C0\uBD952" + second: {fileID: 2800000, guid: 9d3f0b6826b53e44885c04ba560797ed, type: 3} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: cc45016b844e7624dae3aec10fb443ea, type: 3} + reverseAxis: 2 + renderPipeline: 1 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/DemoSettings.lighting b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/New Lighting Settings.lighting similarity index 68% rename from Assets/External/Horizon Based Ambient Occlusion/Demo/DemoSettings.lighting rename to Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/New Lighting Settings.lighting index 7bbaaa27..ff711160 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/DemoSettings.lighting +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/New Lighting Settings.lighting @@ -6,61 +6,58 @@ LightingSettings: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: DemoSettings - serializedVersion: 6 - m_GIWorkflowMode: 0 + m_Name: New Lighting Settings + serializedVersion: 8 m_EnableBakedLightmaps: 1 - m_EnableRealtimeLightmaps: 1 + m_EnableRealtimeLightmaps: 0 m_RealtimeEnvironmentLighting: 1 m_BounceScale: 1 m_AlbedoBoost: 1 m_IndirectOutputScale: 1 - m_UsingShadowmask: 0 - m_BakeBackend: 0 + m_UsingShadowmask: 1 + m_BakeBackend: 2 m_LightmapMaxSize: 1024 + m_LightmapSizeFixed: 0 + m_UseMipmapLimits: 1 m_BakeResolution: 40 m_Padding: 2 m_LightmapCompression: 3 - m_AO: 0 + m_AO: 1 m_AOMaxDistance: 1 - m_CompAOExponent: 0 + m_CompAOExponent: 1 m_CompAOExponentDirect: 0 m_ExtractAO: 0 - m_MixedBakeMode: 1 + m_MixedBakeMode: 2 m_LightmapsBakeMode: 1 m_FilterMode: 1 m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} m_ExportTrainingData: 0 + m_EnableWorkerProcessBaking: 1 m_TrainingDataDestination: TrainingData m_RealtimeResolution: 2 m_ForceWhiteAlbedo: 0 m_ForceUpdates: 0 - m_FinalGather: 0 - m_FinalGatherRayCount: 1024 - m_FinalGatherFiltering: 1 m_PVRCulling: 1 m_PVRSampling: 1 m_PVRDirectSampleCount: 32 m_PVRSampleCount: 512 - m_PVREnvironmentSampleCount: 512 + m_PVREnvironmentSampleCount: 256 m_PVREnvironmentReferencePointCount: 2048 m_LightProbeSampleCountMultiplier: 4 m_PVRBounces: 2 m_PVRMinBounces: 2 - m_PVREnvironmentImportanceSampling: 0 - m_PVRFilteringMode: 0 - m_PVRDenoiserTypeDirect: 0 - m_PVRDenoiserTypeIndirect: 0 - m_PVRDenoiserTypeAO: 0 + m_PVREnvironmentImportanceSampling: 1 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 m_PVRFilterTypeDirect: 0 m_PVRFilterTypeIndirect: 0 m_PVRFilterTypeAO: 0 m_PVRFilteringGaussRadiusDirect: 1 - m_PVRFilteringGaussRadiusIndirect: 5 - m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringGaussRadiusIndirect: 1 + m_PVRFilteringGaussRadiusAO: 1 m_PVRFilteringAtrousPositionSigmaDirect: 0.5 m_PVRFilteringAtrousPositionSigmaIndirect: 2 m_PVRFilteringAtrousPositionSigmaAO: 1 - m_PVRTiledBaking: 0 - m_NumRaysToShootPerTexel: -1 m_RespectSceneVisibilityWhenBakingGI: 0 diff --git a/Assets/External/Horizon Based Ambient Occlusion/Demo/DemoSettings.lighting.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/New Lighting Settings.lighting.meta similarity index 80% rename from Assets/External/Horizon Based Ambient Occlusion/Demo/DemoSettings.lighting.meta rename to Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/New Lighting Settings.lighting.meta index d7838aa6..a508a486 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/Demo/DemoSettings.lighting.meta +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Glb/New Lighting Settings.lighting.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f6d3b38e8d8f13644ad766bdf2609543 +guid: 4af41f0ae120fb445b8dfc01836340d6 NativeFormatImporter: externalObjects: {} mainObjectFileID: 4890085278179872738 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene.meta new file mode 100644 index 00000000..3d1669e6 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8077bb33794ae074bb7161499988ca3f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic.meta new file mode 100644 index 00000000..b11760a4 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cd8bc92b7a4ad604fafb3fffb3cf736b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic.unity b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic.unity new file mode 100644 index 00000000..53ad4605 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c206836fa355ddeccdeb50737ca6c0d97db3f061b17cf26331b8a5f58c264717 +size 305249 diff --git a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Demo.unity.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic.unity.meta similarity index 74% rename from Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Demo.unity.meta rename to Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic.unity.meta index 14d60937..f04bd6f7 100644 --- a/Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Demo.unity.meta +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic.unity.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7fd201e2f8d95b9428ab5708b9577531 +guid: 1310d4777d471b144a6ac77cf3c836fe DefaultImporter: externalObjects: {} userData: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Global Volume Profile.asset b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Global Volume Profile.asset new file mode 100644 index 00000000..84711ddb --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Global Volume Profile.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cfb3538ed2d35f5b0b2a665a6b8b513e02e53865dc8481ccdae330410feddc6b +size 1473 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Global Volume Profile.asset.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Global Volume Profile.asset.meta new file mode 100644 index 00000000..096b26d8 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Global Volume Profile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 48f22d5372f40344e99c21f18a8fa04c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/LightingData.asset b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/LightingData.asset new file mode 100644 index 00000000..99bed473 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/LightingData.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:945056cca34b593b280d9402bf2581c2b56299a55a8c29054dbe037bfbe4cf5d +size 46969 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/LightingData.asset.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/LightingData.asset.meta new file mode 100644 index 00000000..b305c5a9 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/LightingData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6e62919d2b259084588784cbd293bafe +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 112000000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_dir.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_dir.png new file mode 100644 index 00000000..6ad45297 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_dir.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:39845c483e34249986d17bb3bfc225cf2356b9d515baa2e7474f9cde1b9dcffc +size 1208418 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_dir.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_dir.png.meta new file mode 100644 index 00000000..c526f8cc --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_dir.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 684e588dca509fe4da487537d5c1adbb +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 12 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_light.exr b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_light.exr new file mode 100644 index 00000000..80d1c137 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_light.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:39fcf1d0f72e7fb6a029680afdaa0c594bf586bdbf04ac832ba895d320901daf +size 10451744 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_light.exr.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_light.exr.meta new file mode 100644 index 00000000..99c718be --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_light.exr.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 2a5d7b8ceb341784b9a505534191d2c3 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 6 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_shadowmask.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_shadowmask.png new file mode 100644 index 00000000..2f120ec6 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_shadowmask.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:548706327793cc77c389c8c73c6789497fb182ee8ca33e45b21962785832bea2 +size 138727 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_shadowmask.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_shadowmask.png.meta new file mode 100644 index 00000000..aacdda68 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-0_comp_shadowmask.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 919d6b39434523841b7f493fb917dd20 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 11 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_dir.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_dir.png new file mode 100644 index 00000000..cfc9b5cf --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_dir.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2cbcca978382294c3a20b93671a9244a5acf2b3194a36e9f2962404a4b38f369 +size 186855 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_dir.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_dir.png.meta new file mode 100644 index 00000000..24887672 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_dir.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 8dfd995c8a2b1b746ab81ffed6eabdf1 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 12 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_light.exr b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_light.exr new file mode 100644 index 00000000..c01a795e --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_light.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02832aa2dfd9c5817ada81cf7d6de7229585b5472510d45d07c3611ad2877ceb +size 2215937 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_light.exr.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_light.exr.meta new file mode 100644 index 00000000..02c3e52b --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_light.exr.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: d4d9d4d245113b8439db1714a880baaa +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 6 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_shadowmask.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_shadowmask.png new file mode 100644 index 00000000..0dbd1fb5 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_shadowmask.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4f163489f392e10c762730b0c5971a24ca628bd8ec1b933e2251ebdf383ec1e +size 48124 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_shadowmask.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_shadowmask.png.meta new file mode 100644 index 00000000..750b0248 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-10_comp_shadowmask.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: e1eafc709832553459ceb9d546408f86 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 11 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_dir.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_dir.png new file mode 100644 index 00000000..0de6b40e --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_dir.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10260c24d3aeb3f388a4cf7b7136add7222f5156ac954b8f5f6a76fdc856267b +size 914087 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_dir.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_dir.png.meta new file mode 100644 index 00000000..5d9a6307 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_dir.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 7083c64819846fe4594d653bb76e8ab5 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 12 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_light.exr b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_light.exr new file mode 100644 index 00000000..5c51b239 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_light.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b177c70b3ba4d98f996954126b7a5d5b41593069e0759e61d6d495320e5a9f2 +size 9715341 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_light.exr.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_light.exr.meta new file mode 100644 index 00000000..86864b4b --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_light.exr.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 5d8515352296d1c44a3c3f039ed0286c +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 6 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_shadowmask.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_shadowmask.png new file mode 100644 index 00000000..3d65e9e2 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_shadowmask.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00aee7e64a91b81e52bde383f93f8d234ab6f2874b2b175313b453645d72e2fa +size 52166 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_shadowmask.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_shadowmask.png.meta new file mode 100644 index 00000000..9e984ef3 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-1_comp_shadowmask.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: a7d48ddf964696b4da64a929ccac2336 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 11 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_dir.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_dir.png new file mode 100644 index 00000000..8586e769 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_dir.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:80677243d63946366e6647d03901a91b3141690c88be4899c33388f21c587c08 +size 425437 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_dir.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_dir.png.meta new file mode 100644 index 00000000..29ad1a66 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_dir.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 4282a6231d01c3a4788a8da536c9aed9 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 12 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_light.exr b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_light.exr new file mode 100644 index 00000000..fcf25c91 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_light.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ebd4dee3b2468ba4fd75ad8c83c69c91c49bf1a506b31c94019498ebfe201c1 +size 7322121 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_light.exr.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_light.exr.meta new file mode 100644 index 00000000..b015a432 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_light.exr.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 613ddd50c7fd1284292d67dc36fee0dc +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 6 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_shadowmask.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_shadowmask.png new file mode 100644 index 00000000..f51766b8 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_shadowmask.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:01622ccf16bed460fa526715e230b4e771431d9632a7d751dedb046efcd5635d +size 75521 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_shadowmask.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_shadowmask.png.meta new file mode 100644 index 00000000..d28b045f --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-2_comp_shadowmask.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 84090f1aceeda1d4ca0d4c67e5dea8d9 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 11 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_dir.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_dir.png new file mode 100644 index 00000000..00e482ee --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_dir.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a4921a2df1f45899a90f961aacc0ca422813aebbf4adf82af93a2126b47a435 +size 843303 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_dir.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_dir.png.meta new file mode 100644 index 00000000..412bdf38 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_dir.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 1504ce079ac892648bb908add18109d8 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 12 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_light.exr b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_light.exr new file mode 100644 index 00000000..416e775b --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_light.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1b25fe557e3ba103b9882bec79b42e9bbd60b2c966db8ef1621284865961f3f +size 8648493 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_light.exr.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_light.exr.meta new file mode 100644 index 00000000..c13570b4 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_light.exr.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 14b1c938f8f92064b935713867a113f1 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 6 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_shadowmask.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_shadowmask.png new file mode 100644 index 00000000..c2c62450 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_shadowmask.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:652c584882589393bcfdecaacffe98a8e2d23297e6d038b48a96b07a43859e5f +size 135335 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_shadowmask.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_shadowmask.png.meta new file mode 100644 index 00000000..a8b77436 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-3_comp_shadowmask.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 66abac35c11c14646a9da87b7ee9f1fd +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 11 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_dir.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_dir.png new file mode 100644 index 00000000..9ebeaa72 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_dir.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c3515c989b0fc2a9d5f7f655380636eb55dc5bbb2780bf5e5d4c351af3f3a24 +size 888334 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_dir.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_dir.png.meta new file mode 100644 index 00000000..846ec0e8 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_dir.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 98588ec71917bc449810e6b422a3d9af +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 12 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_light.exr b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_light.exr new file mode 100644 index 00000000..e74c9422 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_light.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d110c1c2e461f2d2995aa129ec00b2d73e3a010170812306bb9a0f737acacbd7 +size 9070216 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_light.exr.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_light.exr.meta new file mode 100644 index 00000000..09574eed --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_light.exr.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 3da452a839c29364c988c9e5719fd4ab +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 6 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_shadowmask.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_shadowmask.png new file mode 100644 index 00000000..0f347585 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_shadowmask.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:772d65aba2d41d17ffaddff6db7ecda5f3b8eba256117152fc2353ebb293e7bb +size 101926 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_shadowmask.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_shadowmask.png.meta new file mode 100644 index 00000000..a34a3ed3 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-4_comp_shadowmask.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 67b1387449cb0434d8610fc54c462a14 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 11 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_dir.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_dir.png new file mode 100644 index 00000000..cc4b2981 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_dir.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbe97dee4bbe5f0c8fe42b52312d369f4415ec773999caf599eefe0f4f6d9826 +size 451376 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_dir.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_dir.png.meta new file mode 100644 index 00000000..7b2f43c4 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_dir.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: dce072cb14138bf478dfb5e9ea9bac9a +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 12 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_light.exr b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_light.exr new file mode 100644 index 00000000..35d048d6 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_light.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:acaf628ac5f77b884aed3cac57dcd4bb6f671ad855c2bafe1cbaca30330e4fa9 +size 5812755 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_light.exr.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_light.exr.meta new file mode 100644 index 00000000..6bd32fea --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_light.exr.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 7001f77fd58b3344887fdc1f36104880 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 6 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_shadowmask.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_shadowmask.png new file mode 100644 index 00000000..a22993f5 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_shadowmask.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c32031bd1e944484345f986d678c92dcb9a67e780815a69f6773dc308ef9dd38 +size 25625 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_shadowmask.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_shadowmask.png.meta new file mode 100644 index 00000000..4dd43636 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-5_comp_shadowmask.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: a871517ca80153641b23b049b34b38f4 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 11 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_dir.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_dir.png new file mode 100644 index 00000000..0ac65dac --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_dir.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4b7a42bbe3657a65019abc1c1a033b0821390b4f4c1267e0d561cfd971a9d2aa +size 328731 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_dir.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_dir.png.meta new file mode 100644 index 00000000..29eb2b3b --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_dir.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 98c88109a8954694d94fdcb98ac323e4 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 12 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_light.exr b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_light.exr new file mode 100644 index 00000000..3d04a858 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_light.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f92dd66480d0bf4ef5cbc2b43caf88978e2f4b3d2568e484b15e72f3e58fbf03 +size 3194269 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_light.exr.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_light.exr.meta new file mode 100644 index 00000000..70dc95c8 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_light.exr.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 2366fcf3bb20d8746bcf527504784a13 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 6 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_shadowmask.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_shadowmask.png new file mode 100644 index 00000000..14a59d08 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_shadowmask.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:217fd3121561e29d6fa25c5daf8c4920b8e08637a604df29c974606bff799088 +size 36490 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_shadowmask.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_shadowmask.png.meta new file mode 100644 index 00000000..11c140ec --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-6_comp_shadowmask.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: a978a1d213f2c5045827bb893a0993e7 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 11 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_dir.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_dir.png new file mode 100644 index 00000000..033976f1 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_dir.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75e22d70e89beed68fad8cd2a636a035c14c22385c5285e6d928ee37fa3e3416 +size 266572 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_dir.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_dir.png.meta new file mode 100644 index 00000000..3283f2c3 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_dir.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 763ecca077ae3ff47ab26722bd1bd71e +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 12 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_light.exr b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_light.exr new file mode 100644 index 00000000..81095a73 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_light.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6533016d926bce8a5f09244732bd259eb6019dab009179958b3c28c81b5c6785 +size 7497029 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_light.exr.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_light.exr.meta new file mode 100644 index 00000000..9e755af5 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_light.exr.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 6fc32b81fe700d941977d7563a386f93 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 6 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_shadowmask.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_shadowmask.png new file mode 100644 index 00000000..5d85553c --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_shadowmask.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30903c87d974865354b5170e0593c0ccf2e8e44b037f49e61b05b3b4d0a628d9 +size 54393 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_shadowmask.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_shadowmask.png.meta new file mode 100644 index 00000000..480d407c --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-7_comp_shadowmask.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: b1b3341f34bbab54080a6de4feeee104 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 11 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_dir.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_dir.png new file mode 100644 index 00000000..1860bc2b --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_dir.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a3c264224e9bbadce6f1934d1f4160d73fd9f4fbfda257310a2bada06e540711 +size 156355 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_dir.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_dir.png.meta new file mode 100644 index 00000000..e2d909f5 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_dir.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 6e224bbc7d0200948a6d0de0140068de +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 12 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_light.exr b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_light.exr new file mode 100644 index 00000000..099a3fbc --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_light.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c477bf0d86dcaac07a733c6db0463bc9306807caf19ece083bd2d5f4324fe65 +size 2384276 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_light.exr.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_light.exr.meta new file mode 100644 index 00000000..9e98b266 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_light.exr.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 7fd7440023b242a4c819bde2e4ce9504 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 6 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_shadowmask.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_shadowmask.png new file mode 100644 index 00000000..5b649c0d --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_shadowmask.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff37887ac13e46660f1c5540253c2b745559c91ed0270daac72360d0d885a2db +size 4165 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_shadowmask.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_shadowmask.png.meta new file mode 100644 index 00000000..3c10e4fb --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-8_comp_shadowmask.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 91e42f7af0cbb9b40a93d3eb1376587d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 11 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_dir.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_dir.png new file mode 100644 index 00000000..8a999527 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_dir.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46bb3d4562a8fdf66528c4684746735d0fd55bf3915b86ecc4d36699e8494e90 +size 317809 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_dir.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_dir.png.meta new file mode 100644 index 00000000..f5d63cfa --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_dir.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: ec6a3484e96d3cf49822183f920e6941 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 12 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_light.exr b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_light.exr new file mode 100644 index 00000000..866108c6 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_light.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:40ab147a741a8e42144ae480fb3c8f3084f63c61508f14172246a0b3bcc5524c +size 4717961 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_light.exr.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_light.exr.meta new file mode 100644 index 00000000..79c2910f --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_light.exr.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: b079810e9a910b44d91bdf256051f3aa +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 6 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_shadowmask.png b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_shadowmask.png new file mode 100644 index 00000000..50bcdd23 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_shadowmask.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61fc7f8939718bba21de9fc3b412b2f05ea3b5872062ce5e8abe58889e01a99c +size 20112 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_shadowmask.png.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_shadowmask.png.meta new file mode 100644 index 00000000..dccf218a --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/Lightmap-9_comp_shadowmask.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 1d20ec4a4d44da14baa4c6aa527f99b9 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 1 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 3 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 11 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 2 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-0.exr b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-0.exr new file mode 100644 index 00000000..8f5a4cf9 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-0.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c68dd4b12d67fb261d1df29756a6f4a8f54d42bd1e75c3dc513444e2c6a4301d +size 5448034 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-0.exr.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-0.exr.meta new file mode 100644 index 00000000..55ff9e6b --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-0.exr.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: a1707cbbb476f07428440dbeac02f509 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 1 + seamlessCubemap: 1 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 0 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 2 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 100 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-1.exr b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-1.exr new file mode 100644 index 00000000..8dd8ebc2 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-1.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e033b0853bd96d1a242dd2074db00354d011493ab37b5cc285597e72be19f25b +size 184458 diff --git a/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-1.exr.meta b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-1.exr.meta new file mode 100644 index 00000000..e8486586 --- /dev/null +++ b/Assets/ResourcesData/Background/Cathedral_medieval_Fantastic/Scene/Cathedral_medieval_Fantastic/ReflectionProbe-1.exr.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: 933db615d8e9ec54eafe2319e838429f +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 1 + seamlessCubemap: 1 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 0 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 2 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 100 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ResourcesData/Etc/Fake Shadow/Fake Shadow.shader b/Assets/ResourcesData/Etc/Fake Shadow/Fake Shadow.shader index 5dc194ed..734ab41a 100644 --- a/Assets/ResourcesData/Etc/Fake Shadow/Fake Shadow.shader +++ b/Assets/ResourcesData/Etc/Fake Shadow/Fake Shadow.shader @@ -1,4 +1,4 @@ -// Made with Amplify Shader Editor v1.9.7.1 +// Made with Amplify Shader Editor v1.9.8.1 // Available at the Unity Asset Store - http://u3d.as/y3X Shader "Util function/Fake Shadow" { @@ -21,7 +21,7 @@ Shader "Util function/Fake Shadow" [HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} [HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} - [HideInInspector] _DecalAngleFadeSupported("Decal Angle Fade Supported", Float) = 1 + //[HideInInspector] _DecalAngleFadeSupported("Decal Angle Fade Supported", Float) = 1 } SubShader @@ -55,17 +55,14 @@ Shader "Util function/Fake Shadow" ZTest Greater ZWrite Off ColorMask RGBA - ColorMask RGBA 1 + ColorMask 0 1 ColorMask RGBA 2 HLSLPROGRAM #define _MATERIAL_AFFECTS_ALBEDO 1 - #define _MATERIAL_AFFECTS_NORMAL 1 - #define _MATERIAL_AFFECTS_NORMAL_BLEND 1 - #define DECAL_ANGLE_FADE 1 - #define ASE_VERSION 19701 - #define ASE_SRP_VERSION 140009 + #define ASE_VERSION 19801 + #define ASE_SRP_VERSION 170003 #pragma vertex Vert @@ -78,12 +75,9 @@ Shader "Util function/Fake Shadow" #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 #pragma multi_compile _ _DECAL_LAYERS - - #pragma multi_compile_fragment _ _FOVEATED_RENDERING_NON_UNIFORM_RASTER - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #define HAVE_MESH_MODIFICATION #define SHADERPASS SHADERPASS_DBUFFER_PROJECTOR @@ -91,36 +85,22 @@ Shader "Util function/Fake Shadow" #if _RENDER_PASS_ENABLED #define GBUFFER3 0 #define GBUFFER4 1 - FRAMEBUFFER_INPUT_HALF(GBUFFER3); - FRAMEBUFFER_INPUT_HALF(GBUFFER4); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); #endif - - - - #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" - #endif - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" - - - - #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" - #endif - - + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl" @@ -172,6 +152,7 @@ Shader "Util function/Fake Shadow" #if defined(DECAL_ANGLE_FADE) float _DecalAngleFadeSupported; #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; CBUFFER_END #ifdef SCENEPICKINGPASS @@ -226,18 +207,9 @@ Shader "Util function/Fake Shadow" #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) #if defined(_MATERIAL_AFFECTS_NORMAL) - - - surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz)); - - #else - - - surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz); - #endif #elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) #if defined(_MATERIAL_AFFECTS_NORMAL) @@ -247,11 +219,7 @@ Shader "Util function/Fake Shadow" surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld)); #else - - - surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); - #endif #endif @@ -360,13 +328,13 @@ Shader "Util function/Fake Shadow" #if defined(DECAL_PROJECTOR) #if UNITY_REVERSED_Z #if _RENDER_PASS_ENABLED - float depth = LOAD_FRAMEBUFFER_INPUT(GBUFFER3, packedInput.positionCS.xy).x; + float depth = LOAD_FRAMEBUFFER_X_INPUT(GBUFFER3, packedInput.positionCS.xy).x; #else float depth = LoadSceneDepth(packedInput.positionCS.xy); #endif #else #if _RENDER_PASS_ENABLED - float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LOAD_FRAMEBUFFER_INPUT(GBUFFER3, packedInput.positionCS.xy)); + float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LOAD_FRAMEBUFFER_X_INPUT(GBUFFER3, packedInput.positionCS.xy)); #else float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LoadSceneDepth(packedInput.positionCS.xy)); #endif @@ -385,16 +353,14 @@ Shader "Util function/Fake Shadow" half3 normalWS = half3(LoadSceneNormals(packedInput.positionCS.xy)); #endif - - #if ASE_SRP_VERSION <=140011 - float2 positionSS = packedInput.positionCS.xy * _ScreenSize.zw; - #endif - - - - - float3 positionWS = ComputeWorldSpacePosition(positionSS, depth, UNITY_MATRIX_I_VP); + float2 positionSS = FoveatedRemapNonUniformToLinearCS(packedInput.positionCS.xy) * _ScreenSize.zw; + float4 positionCS = ComputeClipSpacePosition( positionSS, depth ); + float4 hpositionVS = mul( UNITY_MATRIX_I_P, positionCS ); + float3 positionRWS = mul( ( float3x3 )UNITY_MATRIX_I_V, hpositionVS.xyz / hpositionVS.w ); + float3 positionWS = positionRWS + _WorldSpaceCameraPos; + float3 positionOS = TransformWorldToObject( positionWS ); + float3 positionVS = TransformWorldToView( positionWS ); float3 positionDS = TransformWorldToObject(positionWS); positionDS = positionDS * float3(1.0, -1.0, 1.0); @@ -458,15 +424,6 @@ Shader "Util function/Fake Shadow" GetSurfaceData(surfaceDescription, angleFadeFactor, surfaceData); ENCODE_INTO_DBUFFER(surfaceData, outDBuffer); - - #if defined(SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER) - UNITY_BRANCH if (_FOVEATED_RENDERING_NON_UNIFORM_RASTER) - { - positionSS = RemapFoveatedRenderingNonUniformToLinearCS(input.positionCS.xy, true) * _ScreenSize.zw; - } - #endif - - } ENDHLSL } @@ -486,11 +443,8 @@ Shader "Util function/Fake Shadow" HLSLPROGRAM #define _MATERIAL_AFFECTS_ALBEDO 1 - #define _MATERIAL_AFFECTS_NORMAL 1 - #define _MATERIAL_AFFECTS_NORMAL_BLEND 1 - #define DECAL_ANGLE_FADE 1 - #define ASE_VERSION 19701 - #define ASE_SRP_VERSION 140009 + #define ASE_VERSION 19801 + #define ASE_SRP_VERSION 170003 #pragma vertex Vert @@ -502,26 +456,16 @@ Shader "Util function/Fake Shadow" #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS - - - - #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH - - #pragma multi_compile _ _FORWARD_PLUS - - - - - #pragma multi_compile_fragment _ _FOVEATED_RENDERING_NON_UNIFORM_RASTER - - + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile_fragment _ DEBUG_DISPLAY #pragma multi_compile _DECAL_NORMAL_BLEND_LOW _DECAL_NORMAL_BLEND_MEDIUM _DECAL_NORMAL_BLEND_HIGH #pragma multi_compile _ _DECAL_LAYERS #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #define ATTRIBUTES_NEED_NORMAL #define ATTRIBUTES_NEED_TEXCOORD0 @@ -540,36 +484,22 @@ Shader "Util function/Fake Shadow" #if _RENDER_PASS_ENABLED #define GBUFFER3 0 #define GBUFFER4 1 - FRAMEBUFFER_INPUT_HALF(GBUFFER3); - FRAMEBUFFER_INPUT_HALF(GBUFFER4); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); #endif - - - - #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" - #endif - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" - - - - #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" - #endif - - + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl" @@ -608,10 +538,12 @@ Shader "Util function/Fake Shadow" float4 positionCS : SV_POSITION; float3 normalWS : TEXCOORD0; float3 viewDirectionWS : TEXCOORD1; - float2 staticLightmapUV : TEXCOORD2; - float2 dynamicLightmapUV : TEXCOORD3; - float3 sh : TEXCOORD4; - float4 fogFactorAndVertexLight : TEXCOORD5; + float4 lightmapUVs : TEXCOORD2; // @diogo: packs both static (xy) and dynamic (zw) + float3 sh : TEXCOORD3; + float4 fogFactorAndVertexLight : TEXCOORD4; + #ifdef USE_APV_PROBE_OCCLUSION + float4 probeOcclusion : TEXCOORD5; + #endif UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO @@ -627,6 +559,7 @@ Shader "Util function/Fake Shadow" #if defined(DECAL_ANGLE_FADE) float _DecalAngleFadeSupported; #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; CBUFFER_END #ifdef SCENEPICKINGPASS @@ -685,18 +618,9 @@ Shader "Util function/Fake Shadow" #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) #if defined(_MATERIAL_AFFECTS_NORMAL) - - - surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz)); - - #else - - - surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz); - #endif #elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) #if defined(_MATERIAL_AFFECTS_NORMAL) @@ -706,11 +630,7 @@ Shader "Util function/Fake Shadow" surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld)); #else - - - surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); - #endif #endif @@ -789,24 +709,39 @@ Shader "Util function/Fake Shadow" #endif #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) - inputData.bakedGI = SAMPLE_GI(input.lightmapUVs.xy, input.lightmapUVs.zw, input.sh, normalWS); - #elif defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) - inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, half3(input.sh), normalWS); - #endif - - #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV.xy, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #elif defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + #if !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) + inputData.bakedGI = SAMPLE_GI(input.sh, + GetAbsolutePositionWS(inputData.positionWS), + inputData.normalWS, + inputData.viewDirectionWS, + input.positionCS.xy, + input.probeOcclusion, + inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #endif #endif #if defined(DEBUG_DISPLAY) #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) - inputData.dynamicLightmapUV = input.lightmapUVs.zw; + inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy; #endif #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) && defined(LIGHTMAP_ON) - inputData.staticLightmapUV = input.lightmapUVs.xy; + inputData.staticLightmapUV = input.staticLightmapUV #elif defined(VARYINGS_NEED_SH) inputData.vertexSH = input.sh; #endif + #if defined(USE_APV_PROBE_OCCLUSION) + inputData.probeOcclusion = input.probeOcclusion; + #endif #endif inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); @@ -894,13 +829,13 @@ Shader "Util function/Fake Shadow" #if defined(DECAL_PROJECTOR) #if UNITY_REVERSED_Z #if _RENDER_PASS_ENABLED - float depth = LOAD_FRAMEBUFFER_INPUT(GBUFFER3, packedInput.positionCS.xy).x; + float depth = LOAD_FRAMEBUFFER_X_INPUT(GBUFFER3, packedInput.positionCS.xy).x; #else float depth = LoadSceneDepth(packedInput.positionCS.xy); #endif #else #if _RENDER_PASS_ENABLED - float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LOAD_FRAMEBUFFER_INPUT(GBUFFER3, packedInput.positionCS.xy)); + float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LOAD_FRAMEBUFFER_X_INPUT(GBUFFER3, packedInput.positionCS.xy)); #else float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LoadSceneDepth(packedInput.positionCS.xy)); #endif @@ -919,15 +854,14 @@ Shader "Util function/Fake Shadow" half3 normalWS = half3(LoadSceneNormals(packedInput.positionCS.xy)); #endif - - #if ASE_SRP_VERSION <=140011 - float2 positionSS = packedInput.positionCS.xy * _ScreenSize.zw; - #endif - + float2 positionSS = FoveatedRemapNonUniformToLinearCS(packedInput.positionCS.xy) * _ScreenSize.zw; - - - float3 positionWS = ComputeWorldSpacePosition(positionSS, depth, UNITY_MATRIX_I_VP); + float4 positionCS = ComputeClipSpacePosition( positionSS, depth ); + float4 hpositionVS = mul( UNITY_MATRIX_I_P, positionCS ); + float3 positionRWS = mul( ( float3x3 )UNITY_MATRIX_I_V, hpositionVS.xyz / hpositionVS.w ); + float3 positionWS = positionRWS + _WorldSpaceCameraPos; + float3 positionOS = TransformWorldToObject( positionWS ); + float3 positionVS = TransformWorldToView( positionWS ); float3 positionDS = TransformWorldToObject(positionWS); positionDS = positionDS * float3(1.0, -1.0, 1.0); @@ -1009,15 +943,6 @@ Shader "Util function/Fake Shadow" color.rgb = MixFog(color.rgb, inputData.fogCoord); outColor = color; - - #if defined(SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER) - UNITY_BRANCH if (_FOVEATED_RENDERING_NON_UNIFORM_RASTER) - { - positionSS = RemapFoveatedRenderingNonUniformToLinearCS(input.positionCS.xy, true) * _ScreenSize.zw; - } - #endif - - } ENDHLSL } @@ -1038,17 +963,14 @@ Shader "Util function/Fake Shadow" ZWrite Off ColorMask RGB ColorMask 0 1 - ColorMask RGB 2 + ColorMask 0 2 ColorMask RGB 3 HLSLPROGRAM #define _MATERIAL_AFFECTS_ALBEDO 1 - #define _MATERIAL_AFFECTS_NORMAL 1 - #define _MATERIAL_AFFECTS_NORMAL_BLEND 1 - #define DECAL_ANGLE_FADE 1 - #define ASE_VERSION 19701 - #define ASE_SRP_VERSION 140009 + #define ASE_VERSION 19801 + #define ASE_SRP_VERSION 170003 #pragma vertex Vert @@ -1058,13 +980,7 @@ Shader "Util function/Fake Shadow" #pragma editor_sync_compilation #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN - - - - #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH - - #pragma multi_compile _DECAL_NORMAL_BLEND_LOW _DECAL_NORMAL_BLEND_MEDIUM _DECAL_NORMAL_BLEND_HIGH #pragma multi_compile _ _DECAL_LAYERS #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT @@ -1072,6 +988,7 @@ Shader "Util function/Fake Shadow" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #define ATTRIBUTES_NEED_NORMAL #define ATTRIBUTES_NEED_TEXCOORD0 @@ -1089,36 +1006,22 @@ Shader "Util function/Fake Shadow" #if _RENDER_PASS_ENABLED #define GBUFFER3 0 #define GBUFFER4 1 - FRAMEBUFFER_INPUT_HALF(GBUFFER3); - FRAMEBUFFER_INPUT_HALF(GBUFFER4); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); #endif - - - - #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" - #endif - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" - - - - #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" - #endif - - + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" @@ -1158,9 +1061,11 @@ Shader "Util function/Fake Shadow" float4 positionCS : SV_POSITION; float3 normalWS : TEXCOORD0; float3 viewDirectionWS : TEXCOORD1; - float2 staticLightmapUV : TEXCOORD2; - float2 dynamicLightmapUV : TEXCOORD3; - float3 sh : TEXCOORD4; + float4 lightmapUVs : TEXCOORD2; // @diogo: packs both static (xy) and dynamic (zw) + float3 sh : TEXCOORD3; + #ifdef USE_APV_PROBE_OCCLUSION + float4 probeOcclusion : TEXCOORD4; + #endif UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO @@ -1176,6 +1081,7 @@ Shader "Util function/Fake Shadow" #if defined(DECAL_ANGLE_FADE) float _DecalAngleFadeSupported; #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; CBUFFER_END #ifdef SCENEPICKINGPASS @@ -1234,18 +1140,9 @@ Shader "Util function/Fake Shadow" #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) #if defined(_MATERIAL_AFFECTS_NORMAL) - - - surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz)); - - #else - - - surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz); - #endif #elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) #if defined(_MATERIAL_AFFECTS_NORMAL) @@ -1255,11 +1152,7 @@ Shader "Util function/Fake Shadow" surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld)); #else - - - surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); - #endif #endif @@ -1338,24 +1231,39 @@ Shader "Util function/Fake Shadow" #endif #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) - inputData.bakedGI = SAMPLE_GI(input.lightmapUVs.xy, input.lightmapUVs.zw, input.sh, normalWS); - #elif defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) - inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, half3(input.sh), normalWS); - #endif - - #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV.xy, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #elif defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + #if !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) + inputData.bakedGI = SAMPLE_GI(input.sh, + GetAbsolutePositionWS(inputData.positionWS), + inputData.normalWS, + inputData.viewDirectionWS, + input.positionCS.xy, + input.probeOcclusion, + inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #endif #endif #if defined(DEBUG_DISPLAY) #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) - inputData.dynamicLightmapUV = input.lightmapUVs.zw; + inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy; #endif #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) && defined(LIGHTMAP_ON) - inputData.staticLightmapUV = input.lightmapUVs.xy; + inputData.staticLightmapUV = input.staticLightmapUV #elif defined(VARYINGS_NEED_SH) inputData.vertexSH = input.sh; #endif + #if defined(USE_APV_PROBE_OCCLUSION) + inputData.probeOcclusion = input.probeOcclusion; + #endif #endif inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); @@ -1433,13 +1341,13 @@ Shader "Util function/Fake Shadow" #if defined(DECAL_PROJECTOR) #if UNITY_REVERSED_Z #if _RENDER_PASS_ENABLED - float depth = LOAD_FRAMEBUFFER_INPUT(GBUFFER3, packedInput.positionCS.xy).x; + float depth = LOAD_FRAMEBUFFER_X_INPUT(GBUFFER3, packedInput.positionCS.xy).x; #else float depth = LoadSceneDepth(packedInput.positionCS.xy); #endif #else #if _RENDER_PASS_ENABLED - float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LOAD_FRAMEBUFFER_INPUT(GBUFFER3, packedInput.positionCS.xy)); + float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LOAD_FRAMEBUFFER_X_INPUT(GBUFFER3, packedInput.positionCS.xy)); #else float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LoadSceneDepth(packedInput.positionCS.xy)); #endif @@ -1458,15 +1366,14 @@ Shader "Util function/Fake Shadow" half3 normalWS = half3(LoadSceneNormals(packedInput.positionCS.xy)); #endif - - #if ASE_SRP_VERSION <=140011 - float2 positionSS = packedInput.positionCS.xy * _ScreenSize.zw; - #endif - + float2 positionSS = FoveatedRemapNonUniformToLinearCS(packedInput.positionCS.xy) * _ScreenSize.zw; - - - float3 positionWS = ComputeWorldSpacePosition(positionSS, depth, UNITY_MATRIX_I_VP); + float4 positionCS = ComputeClipSpacePosition( positionSS, depth ); + float4 hpositionVS = mul( UNITY_MATRIX_I_P, positionCS ); + float3 positionRWS = mul( ( float3x3 )UNITY_MATRIX_I_V, hpositionVS.xyz / hpositionVS.w ); + float3 positionWS = positionRWS + _WorldSpaceCameraPos; + float3 positionOS = TransformWorldToObject( positionWS ); + float3 positionVS = TransformWorldToView( positionWS ); float3 positionDS = TransformWorldToObject(positionWS); positionDS = positionDS * float3(1.0, -1.0, 1.0); @@ -1562,19 +1469,10 @@ Shader "Util function/Fake Shadow" fragmentOutput.GBuffer2 = half4(packedNormalWS, surfaceData.normalWS.a); fragmentOutput.GBuffer3 = half4(surfaceData.emissive + color, surfaceData.baseColor.a); #if OUTPUT_SHADOWMASK - fragmentOutput.GBuffer4 = inputData.shadowMask; + fragmentOutput.GBuffer4 = inputData.shadowMask; // will have unity_ProbesOcclusion value if subtractive lighting is used (baked) #endif #pragma warning (default : 3578) // Restore output value isn't completely initialized. - - #if defined(SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER) - UNITY_BRANCH if (_FOVEATED_RENDERING_NON_UNIFORM_RASTER) - { - positionSS = RemapFoveatedRenderingNonUniformToLinearCS(input.positionCS.xy, true) * _ScreenSize.zw; - } - #endif - - } ENDHLSL } @@ -1592,16 +1490,14 @@ Shader "Util function/Fake Shadow" ZTest LEqual ZWrite Off ColorMask RGBA - ColorMask RGBA 1 + ColorMask 0 1 ColorMask RGBA 2 HLSLPROGRAM #define _MATERIAL_AFFECTS_ALBEDO 1 - #define _MATERIAL_AFFECTS_NORMAL 1 - #define _MATERIAL_AFFECTS_NORMAL_BLEND 1 - #define ASE_VERSION 19701 - #define ASE_SRP_VERSION 140009 + #define ASE_VERSION 19801 + #define ASE_SRP_VERSION 170003 #pragma vertex Vert @@ -1614,6 +1510,7 @@ Shader "Util function/Fake Shadow" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #define ATTRIBUTES_NEED_NORMAL #define ATTRIBUTES_NEED_TANGENT @@ -1632,36 +1529,22 @@ Shader "Util function/Fake Shadow" #if _RENDER_PASS_ENABLED #define GBUFFER3 0 #define GBUFFER4 1 - FRAMEBUFFER_INPUT_HALF(GBUFFER3); - FRAMEBUFFER_INPUT_HALF(GBUFFER4); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); #endif - - - - #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" - #endif - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" - - - - #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" - #endif - - + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl" @@ -1719,6 +1602,7 @@ Shader "Util function/Fake Shadow" #if defined(DECAL_ANGLE_FADE) float _DecalAngleFadeSupported; #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; CBUFFER_END #ifdef SCENEPICKINGPASS @@ -1774,18 +1658,9 @@ Shader "Util function/Fake Shadow" #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) #if defined(_MATERIAL_AFFECTS_NORMAL) - - - surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz)); - - #else - - - surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz); - #endif #elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) #if defined(_MATERIAL_AFFECTS_NORMAL) @@ -1795,11 +1670,7 @@ Shader "Util function/Fake Shadow" surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld)); #else - - - surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); - #endif #endif @@ -1945,13 +1816,7 @@ Shader "Util function/Fake Shadow" half3 normalWS = half3(LoadSceneNormals(packedInput.positionCS.xy)); #endif - - #if ASE_SRP_VERSION <=140011 - float2 positionSS = packedInput.positionCS.xy * _ScreenSize.zw; - #endif - - - + float2 positionSS = FoveatedRemapNonUniformToLinearCS(packedInput.positionCS.xy) * _ScreenSize.zw; float3 positionWS = packedInput.positionWS.xyz; half3 viewDirectionWS = half3(1.0, 1.0, 1.0); @@ -1983,15 +1848,6 @@ Shader "Util function/Fake Shadow" GetSurfaceData(packedInput, surfaceDescription, surfaceData); ENCODE_INTO_DBUFFER(surfaceData, outDBuffer); - - #if defined(SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER) - UNITY_BRANCH if (_FOVEATED_RENDERING_NON_UNIFORM_RASTER) - { - positionSS = RemapFoveatedRenderingNonUniformToLinearCS(input.positionCS.xy, true) * _ScreenSize.zw; - } - #endif - - } ENDHLSL @@ -2011,10 +1867,8 @@ Shader "Util function/Fake Shadow" HLSLPROGRAM #define _MATERIAL_AFFECTS_ALBEDO 1 - #define _MATERIAL_AFFECTS_NORMAL 1 - #define _MATERIAL_AFFECTS_NORMAL_BLEND 1 - #define ASE_VERSION 19701 - #define ASE_SRP_VERSION 140009 + #define ASE_VERSION 19801 + #define ASE_SRP_VERSION 170003 #pragma vertex Vert @@ -2026,24 +1880,21 @@ Shader "Util function/Fake Shadow" #pragma multi_compile _ LIGHTMAP_ON #pragma multi_compile _ DYNAMICLIGHTMAP_ON #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS - - - - #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH - - #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING #pragma multi_compile _ SHADOWS_SHADOWMASK #pragma multi_compile _ _FORWARD_PLUS #pragma multi_compile _DECAL_NORMAL_BLEND_LOW _DECAL_NORMAL_BLEND_MEDIUM _DECAL_NORMAL_BLEND_HIGH + #pragma multi_compile_fragment _ DEBUG_DISPLAY #pragma multi_compile _ _DECAL_LAYERS #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #define ATTRIBUTES_NEED_NORMAL #define ATTRIBUTES_NEED_TANGENT @@ -2067,36 +1918,22 @@ Shader "Util function/Fake Shadow" #if _RENDER_PASS_ENABLED #define GBUFFER3 0 #define GBUFFER4 1 - FRAMEBUFFER_INPUT_HALF(GBUFFER3); - FRAMEBUFFER_INPUT_HALF(GBUFFER4); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); #endif - - - - #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" - #endif - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" - - - - #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" - #endif - - + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl" @@ -2140,10 +1977,12 @@ Shader "Util function/Fake Shadow" float4 tangentWS : TEXCOORD2; float4 texCoord0 : TEXCOORD3; float3 viewDirectionWS : TEXCOORD4; - float2 staticLightmapUV : TEXCOORD5; - float2 dynamicLightmapUV : TEXCOORD6; - float3 sh : TEXCOORD7; - float4 fogFactorAndVertexLight : TEXCOORD8; + float4 lightmapUVs : TEXCOORD5; // @diogo: packs both static (xy) and dynamic (zw) + float3 sh : TEXCOORD6; + float4 fogFactorAndVertexLight : TEXCOORD7; + #ifdef USE_APV_PROBE_OCCLUSION + float4 probeOcclusion : TEXCOORD8; + #endif UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO @@ -2159,6 +1998,7 @@ Shader "Util function/Fake Shadow" #if defined(DECAL_ANGLE_FADE) float _DecalAngleFadeSupported; #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; CBUFFER_END #ifdef SCENEPICKINGPASS @@ -2218,18 +2058,9 @@ Shader "Util function/Fake Shadow" #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) #if defined(_MATERIAL_AFFECTS_NORMAL) - - - surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz)); - - #else - - - surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz); - #endif #elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) #if defined(_MATERIAL_AFFECTS_NORMAL) @@ -2239,11 +2070,7 @@ Shader "Util function/Fake Shadow" surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld)); #else - - - surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); - #endif #endif @@ -2332,24 +2159,39 @@ Shader "Util function/Fake Shadow" #endif #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) - inputData.bakedGI = SAMPLE_GI(input.lightmapUVs.xy, input.lightmapUVs.zw, input.sh, normalWS); - #elif defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) - inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, half3(input.sh), normalWS); - #endif - - #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV.xy, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #elif defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + #if !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) + inputData.bakedGI = SAMPLE_GI(input.sh, + GetAbsolutePositionWS(inputData.positionWS), + inputData.normalWS, + inputData.viewDirectionWS, + input.positionCS.xy, + input.probeOcclusion, + inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #endif #endif #if defined(DEBUG_DISPLAY) #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) - inputData.dynamicLightmapUV = input.lightmapUVs.zw; + inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy; #endif #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) && defined(LIGHTMAP_ON) - inputData.staticLightmapUV = input.lightmapUVs.xy; + inputData.staticLightmapUV = input.staticLightmapUV #elif defined(VARYINGS_NEED_SH) inputData.vertexSH = input.sh; #endif + #if defined(USE_APV_PROBE_OCCLUSION) + inputData.probeOcclusion = input.probeOcclusion; + #endif #endif inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); @@ -2461,13 +2303,7 @@ Shader "Util function/Fake Shadow" half3 normalWS = half3(LoadSceneNormals(packedInput.positionCS.xy)); #endif - - #if ASE_SRP_VERSION <=140011 - float2 positionSS = packedInput.positionCS.xy * _ScreenSize.zw; - #endif - - - + float2 positionSS = FoveatedRemapNonUniformToLinearCS(packedInput.positionCS.xy) * _ScreenSize.zw; float3 positionWS = packedInput.positionWS.xyz; half3 viewDirectionWS = half3(packedInput.viewDirectionWS); @@ -2517,15 +2353,6 @@ Shader "Util function/Fake Shadow" color.rgb = MixFog(color.rgb, inputData.fogCoord); outColor = color; - - #if defined(SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER) - UNITY_BRANCH if (_FOVEATED_RENDERING_NON_UNIFORM_RASTER) - { - positionSS = RemapFoveatedRenderingNonUniformToLinearCS(input.positionCS.xy, true) * _ScreenSize.zw; - } - #endif - - } ENDHLSL } @@ -2544,16 +2371,14 @@ Shader "Util function/Fake Shadow" ZWrite Off ColorMask RGB ColorMask 0 1 - ColorMask RGB 2 + ColorMask 0 2 ColorMask RGB 3 HLSLPROGRAM #define _MATERIAL_AFFECTS_ALBEDO 1 - #define _MATERIAL_AFFECTS_NORMAL 1 - #define _MATERIAL_AFFECTS_NORMAL_BLEND 1 - #define ASE_VERSION 19701 - #define ASE_SRP_VERSION 140009 + #define ASE_VERSION 19801 + #define ASE_SRP_VERSION 170003 #pragma vertex Vert @@ -2565,14 +2390,9 @@ Shader "Util function/Fake Shadow" #pragma multi_compile _ LIGHTMAP_ON #pragma multi_compile _ DYNAMICLIGHTMAP_ON #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN - - - - #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH - - #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE #pragma multi_compile _DECAL_NORMAL_BLEND_LOW _DECAL_NORMAL_BLEND_MEDIUM _DECAL_NORMAL_BLEND_HIGH @@ -2582,6 +2402,7 @@ Shader "Util function/Fake Shadow" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #define ATTRIBUTES_NEED_NORMAL #define ATTRIBUTES_NEED_TANGENT @@ -2605,36 +2426,22 @@ Shader "Util function/Fake Shadow" #if _RENDER_PASS_ENABLED #define GBUFFER3 0 #define GBUFFER4 1 - FRAMEBUFFER_INPUT_HALF(GBUFFER3); - FRAMEBUFFER_INPUT_HALF(GBUFFER4); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); #endif - - - - #if ASE_SRP_VERSION >=140007 #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" - #endif - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" - - - - #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" - #endif - - + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" @@ -2679,10 +2486,12 @@ Shader "Util function/Fake Shadow" float4 tangentWS : TEXCOORD2; float4 texCoord0 : TEXCOORD3; float3 viewDirectionWS : TEXCOORD4; - float2 staticLightmapUV : TEXCOORD5; - float2 dynamicLightmapUV : TEXCOORD6; - float3 sh : TEXCOORD7; - float4 fogFactorAndVertexLight : TEXCOORD8; + float4 lightmapUVs : TEXCOORD5; // @diogo: packs both static (xy) and dynamic (zw) + float3 sh : TEXCOORD6; + float4 fogFactorAndVertexLight : TEXCOORD7; + #ifdef USE_APV_PROBE_OCCLUSION + float4 probeOcclusion : TEXCOORD10; + #endif UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO @@ -2698,6 +2507,7 @@ Shader "Util function/Fake Shadow" #if defined(DECAL_ANGLE_FADE) float _DecalAngleFadeSupported; #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; CBUFFER_END #ifdef SCENEPICKINGPASS @@ -2757,18 +2567,9 @@ Shader "Util function/Fake Shadow" #if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) #if defined(_MATERIAL_AFFECTS_NORMAL) - - - surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz)); - - #else - - - surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz); - #endif #elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH) #if defined(_MATERIAL_AFFECTS_NORMAL) @@ -2778,11 +2579,7 @@ Shader "Util function/Fake Shadow" surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld)); #else - - - surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); - #endif #endif @@ -2870,24 +2667,39 @@ Shader "Util function/Fake Shadow" #endif #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) - inputData.bakedGI = SAMPLE_GI(input.lightmapUVs.xy, input.lightmapUVs.zw, input.sh, normalWS); - #elif defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) - inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, half3(input.sh), normalWS); - #endif - - #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV.xy, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #elif defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + #if !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) + inputData.bakedGI = SAMPLE_GI(input.sh, + GetAbsolutePositionWS(inputData.positionWS), + inputData.normalWS, + inputData.viewDirectionWS, + input.positionCS.xy, + input.probeOcclusion, + inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, half3(input.sh), normalWS); + #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) + inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #endif + #endif #endif #if defined(DEBUG_DISPLAY) #if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON) - inputData.dynamicLightmapUV = input.lightmapUVs.zw; + inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy; #endif #if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) && defined(LIGHTMAP_ON) - inputData.staticLightmapUV = input.lightmapUVs.xy; + inputData.staticLightmapUV = input.staticLightmapUV #elif defined(VARYINGS_NEED_SH) inputData.vertexSH = input.sh; #endif + #if defined(USE_APV_PROBE_OCCLUSION) + inputData.probeOcclusion = input.probeOcclusion; + #endif #endif inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); @@ -3000,13 +2812,7 @@ Shader "Util function/Fake Shadow" half3 normalWS = half3(LoadSceneNormals(packedInput.positionCS.xy)); #endif - - #if ASE_SRP_VERSION <=140011 - float2 positionSS = packedInput.positionCS.xy * _ScreenSize.zw; - #endif - - - + float2 positionSS = FoveatedRemapNonUniformToLinearCS(packedInput.positionCS.xy) * _ScreenSize.zw; float3 positionWS = packedInput.positionWS.xyz; half3 viewDirectionWS = half3(packedInput.viewDirectionWS); @@ -3070,19 +2876,10 @@ Shader "Util function/Fake Shadow" fragmentOutput.GBuffer2 = half4(packedNormalWS, surfaceData.normalWS.a); fragmentOutput.GBuffer3 = half4(surfaceData.emissive + color, surfaceData.baseColor.a); #if OUTPUT_SHADOWMASK - fragmentOutput.GBuffer4 = inputData.shadowMask; + fragmentOutput.GBuffer4 = inputData.shadowMask; // will have unity_ProbesOcclusion value if subtractive lighting is used (baked) #endif #pragma warning (default : 3578) // Restore output value isn't completely initialized. - - #if defined(SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER) - UNITY_BRANCH if (_FOVEATED_RENDERING_NON_UNIFORM_RASTER) - { - positionSS = RemapFoveatedRenderingNonUniformToLinearCS(input.positionCS.xy, true) * _ScreenSize.zw; - } - #endif - - } ENDHLSL @@ -3100,10 +2897,8 @@ Shader "Util function/Fake Shadow" HLSLPROGRAM #define _MATERIAL_AFFECTS_ALBEDO 1 - #define _MATERIAL_AFFECTS_NORMAL 1 - #define _MATERIAL_AFFECTS_NORMAL_BLEND 1 - #define ASE_VERSION 19701 - #define ASE_SRP_VERSION 140009 + #define ASE_VERSION 19801 + #define ASE_SRP_VERSION 170003 #pragma multi_compile_instancing @@ -3113,6 +2908,7 @@ Shader "Util function/Fake Shadow" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #define HAVE_MESH_MODIFICATION @@ -3122,8 +2918,8 @@ Shader "Util function/Fake Shadow" #if _RENDER_PASS_ENABLED #define GBUFFER3 0 #define GBUFFER4 1 - FRAMEBUFFER_INPUT_HALF(GBUFFER3); - FRAMEBUFFER_INPUT_HALF(GBUFFER4); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER3); + FRAMEBUFFER_INPUT_X_HALF(GBUFFER4); #endif #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" @@ -3132,17 +2928,9 @@ Shader "Util function/Fake Shadow" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" - - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl" - - - - #if ASE_SRP_VERSION >=140009 #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" - #endif - - + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl" @@ -3177,6 +2965,7 @@ Shader "Util function/Fake Shadow" #if defined(DECAL_ANGLE_FADE) float _DecalAngleFadeSupported; #endif + UNITY_TEXTURE_STREAMING_DEBUG_VARS; CBUFFER_END #ifdef SCENEPICKINGPASS @@ -3309,7 +3098,7 @@ Shader "Util function/Fake Shadow" Fallback Off } /*ASEBEGIN -Version=19701 +Version=19801 Node;AmplifyShaderEditor.TexturePropertyNode;24;-1728,48;Inherit;True;Property;_MainTex;MainTex;1;0;Create;True;0;0;0;False;0;False;None;None;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1 Node;AmplifyShaderEditor.TextureCoordinatesNode;28;-1440,320;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode;30;-1552,496;Inherit;False;Property;_BlurRadius;Blur Radius;2;0;Create;True;0;0;0;False;0;False;0;0;0;10;0;1;FLOAT;0 @@ -3318,14 +3107,14 @@ Node;AmplifyShaderEditor.CustomExpressionNode;23;-1088,288;Inherit;False; flo Node;AmplifyShaderEditor.SamplerNode;27;-1424,-256;Inherit;True;Property;_TextureSample0;Texture Sample 0;2;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;20;-848,-80;Inherit;False;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.BreakToComponentsNode;29;-638.307,131.2985;Inherit;False;COLOR;1;0;COLOR;0,0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15 -Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;11;0,0;Float;False;False;-1;2;UnityEditor.Rendering.Universal.DecalShaderGraphGUI;0;14;New Amplify Shader;c2a467ab6d5391a4ea692226d82ffefd;True;DBufferProjector;0;0;DBufferProjector;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;PreviewType=Plane;DisableBatching=LODFading=DisableBatching;ShaderGraphShader=true;ShaderGraphTargetId=UniversalDecalSubTarget;True;3;True;12;all;0;False;True;2;5;False;;10;False;;1;0;False;;10;False;;False;False;True;2;5;False;;10;False;;1;0;False;;10;False;;False;False;True;2;5;False;;10;False;;1;0;False;;10;False;;False;False;False;False;False;False;True;1;False;;False;False;False;True;True;True;True;True;0;False;;False;True;True;True;True;True;0;False;;False;False;False;False;False;True;2;False;;True;2;False;;False;True;1;LightMode=DBufferProjector;False;True;9;d3d11;metal;vulkan;xboxone;xboxseries;playstation;ps4;ps5;switch;0;;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;11;0,0;Float;False;False;-1;2;UnityEditor.Rendering.Universal.DecalShaderGraphGUI;0;14;New Amplify Shader;c2a467ab6d5391a4ea692226d82ffefd;True;DBufferProjector;0;0;DBufferProjector;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;PreviewType=Plane;DisableBatching=LODFading=DisableBatching;ShaderGraphShader=true;ShaderGraphTargetId=UniversalDecalSubTarget;True;3;True;12;all;0;False;True;2;5;False;;10;False;;1;0;False;;10;False;;False;False;True;2;5;False;;10;False;;1;0;False;;10;False;;False;False;True;2;5;False;;10;False;;1;0;False;;10;False;;False;False;False;False;False;False;True;1;False;;False;False;False;True;False;False;False;False;0;False;;False;True;True;True;True;True;0;False;;False;False;False;False;False;True;2;False;;True;2;False;;False;True;1;LightMode=DBufferProjector;False;True;9;d3d11;metal;vulkan;xboxone;xboxseries;playstation;ps4;ps5;switch;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;12;0,0;Float;False;False;-1;2;UnityEditor.Rendering.Universal.DecalShaderGraphGUI;0;14;New Amplify Shader;c2a467ab6d5391a4ea692226d82ffefd;True;DecalProjectorForwardEmissive;0;1;DecalProjectorForwardEmissive;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;PreviewType=Plane;DisableBatching=LODFading=DisableBatching;ShaderGraphShader=true;ShaderGraphTargetId=UniversalDecalSubTarget;True;3;True;12;all;0;False;True;8;5;False;;1;False;;0;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;True;2;False;;False;True;1;LightMode=DecalProjectorForwardEmissive;False;False;0;;0;0;Standard;0;False;0 -Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;13;0,0;Float;False;True;-1;2;UnityEditor.Rendering.Universal.DecalShaderGraphGUI;0;14;Util function/Fake Shadow;c2a467ab6d5391a4ea692226d82ffefd;True;DecalScreenSpaceProjector;0;2;DecalScreenSpaceProjector;9;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;PreviewType=Plane;DisableBatching=LODFading=DisableBatching;ShaderGraphShader=true;ShaderGraphTargetId=UniversalDecalSubTarget;True;3;True;12;all;0;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;True;2;False;;False;True;1;LightMode=DecalScreenSpaceProjector;False;False;0;;0;0;Standard;7;Affect BaseColor;1;0;Affect Normal;1;0;Blend;1;0;Affect MAOS;0;0;Affect Emission;0;0;Support LOD CrossFade;0;0;Angle Fade;1;0;0;9;True;False;True;True;True;False;True;True;True;False;;False;0 -Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;14;0,0;Float;False;False;-1;2;UnityEditor.Rendering.Universal.DecalShaderGraphGUI;0;14;New Amplify Shader;c2a467ab6d5391a4ea692226d82ffefd;True;DecalGBufferProjector;0;3;DecalGBufferProjector;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;PreviewType=Plane;DisableBatching=LODFading=DisableBatching;ShaderGraphShader=true;ShaderGraphTargetId=UniversalDecalSubTarget;True;3;True;12;all;0;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;False;True;1;False;;False;False;False;True;False;False;False;False;0;False;;False;True;True;True;True;False;0;False;;False;True;True;True;True;False;0;False;;False;False;False;True;2;False;;True;2;False;;False;True;1;LightMode=DecalGBufferProjector;False;False;0;;0;0;Standard;0;False;0 -Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;15;0,0;Float;False;False;-1;2;UnityEditor.Rendering.Universal.DecalShaderGraphGUI;0;14;New Amplify Shader;c2a467ab6d5391a4ea692226d82ffefd;True;DBufferMesh;0;4;DBufferMesh;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;PreviewType=Plane;DisableBatching=LODFading=DisableBatching;ShaderGraphShader=true;ShaderGraphTargetId=UniversalDecalSubTarget;True;3;True;12;all;0;False;True;2;5;False;;10;False;;1;0;False;;10;False;;False;False;True;2;5;False;;10;False;;1;0;False;;10;False;;False;False;True;2;5;False;;10;False;;1;0;False;;10;False;;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;;False;True;True;True;True;True;0;False;;False;False;False;False;False;True;2;False;;True;3;False;;False;True;1;LightMode=DBufferMesh;False;False;0;;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;13;0,0;Float;False;True;-1;2;UnityEditor.Rendering.Universal.DecalShaderGraphGUI;0;14;Util function/Fake Shadow;c2a467ab6d5391a4ea692226d82ffefd;True;DecalScreenSpaceProjector;0;2;DecalScreenSpaceProjector;9;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;PreviewType=Plane;DisableBatching=LODFading=DisableBatching;ShaderGraphShader=true;ShaderGraphTargetId=UniversalDecalSubTarget;True;3;True;12;all;0;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;True;2;False;;False;True;1;LightMode=DecalScreenSpaceProjector;False;False;0;;0;0;Standard;7;Affect BaseColor;1;0;Affect Normal;0;638824822181487303;Blend;0;638824822142402961;Affect MAOS;0;638824822138530880;Affect Emission;0;0;Support LOD CrossFade;0;0;Angle Fade;0;638824822193992285;0;9;True;False;True;True;True;False;True;True;True;False;;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;14;0,0;Float;False;False;-1;2;UnityEditor.Rendering.Universal.DecalShaderGraphGUI;0;14;New Amplify Shader;c2a467ab6d5391a4ea692226d82ffefd;True;DecalGBufferProjector;0;3;DecalGBufferProjector;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;PreviewType=Plane;DisableBatching=LODFading=DisableBatching;ShaderGraphShader=true;ShaderGraphTargetId=UniversalDecalSubTarget;True;3;True;12;all;0;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;False;True;1;False;;False;False;False;True;False;False;False;False;0;False;;False;True;False;False;False;False;0;False;;False;True;True;True;True;False;0;False;;False;False;False;True;2;False;;True;2;False;;False;True;1;LightMode=DecalGBufferProjector;False;False;0;;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;15;0,0;Float;False;False;-1;2;UnityEditor.Rendering.Universal.DecalShaderGraphGUI;0;14;New Amplify Shader;c2a467ab6d5391a4ea692226d82ffefd;True;DBufferMesh;0;4;DBufferMesh;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;PreviewType=Plane;DisableBatching=LODFading=DisableBatching;ShaderGraphShader=true;ShaderGraphTargetId=UniversalDecalSubTarget;True;3;True;12;all;0;False;True;2;5;False;;10;False;;1;0;False;;10;False;;False;False;True;2;5;False;;10;False;;1;0;False;;10;False;;False;False;True;2;5;False;;10;False;;1;0;False;;10;False;;False;False;False;False;False;False;False;False;False;False;True;False;False;False;False;0;False;;False;True;True;True;True;True;0;False;;False;False;False;False;False;True;2;False;;True;3;False;;False;True;1;LightMode=DBufferMesh;False;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;16;0,0;Float;False;False;-1;2;UnityEditor.Rendering.Universal.DecalShaderGraphGUI;0;14;New Amplify Shader;c2a467ab6d5391a4ea692226d82ffefd;True;DecalMeshForwardEmissive;0;5;DecalMeshForwardEmissive;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;PreviewType=Plane;DisableBatching=LODFading=DisableBatching;ShaderGraphShader=true;ShaderGraphTargetId=UniversalDecalSubTarget;True;3;True;12;all;0;False;True;8;5;False;;1;False;;0;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;True;3;False;;False;True;1;LightMode=DecalMeshForwardEmissive;False;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;17;0,0;Float;False;False;-1;2;UnityEditor.Rendering.Universal.DecalShaderGraphGUI;0;14;New Amplify Shader;c2a467ab6d5391a4ea692226d82ffefd;True;DecalScreenSpaceMesh;0;6;DecalScreenSpaceMesh;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;PreviewType=Plane;DisableBatching=LODFading=DisableBatching;ShaderGraphShader=true;ShaderGraphTargetId=UniversalDecalSubTarget;True;3;True;12;all;0;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;True;3;False;;False;True;1;LightMode=DecalScreenSpaceMesh;False;False;0;;0;0;Standard;0;False;0 -Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;18;0,0;Float;False;False;-1;2;UnityEditor.Rendering.Universal.DecalShaderGraphGUI;0;14;New Amplify Shader;c2a467ab6d5391a4ea692226d82ffefd;True;DecalGBufferMesh;0;7;DecalGBufferMesh;1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;PreviewType=Plane;DisableBatching=LODFading=DisableBatching;ShaderGraphShader=true;ShaderGraphTargetId=UniversalDecalSubTarget;True;3;True;12;all;0;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;False;False;False;False;False;True;False;False;False;False;0;False;;False;True;True;True;True;False;0;False;;False;True;True;True;True;False;0;False;;False;False;False;True;2;False;;False;False;True;1;LightMode=DecalGBufferMesh;False;False;0;;0;0;Standard;0;False;0 +Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;18;0,0;Float;False;False;-1;2;UnityEditor.Rendering.Universal.DecalShaderGraphGUI;0;14;New Amplify Shader;c2a467ab6d5391a4ea692226d82ffefd;True;DecalGBufferMesh;0;7;DecalGBufferMesh;1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;PreviewType=Plane;DisableBatching=LODFading=DisableBatching;ShaderGraphShader=true;ShaderGraphTargetId=UniversalDecalSubTarget;True;3;True;12;all;0;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;False;False;False;False;False;True;False;False;False;False;0;False;;False;True;False;False;False;False;0;False;;False;True;True;True;True;False;0;False;;False;False;False;True;2;False;;False;False;True;1;LightMode=DecalGBufferMesh;False;False;0;;0;0;Standard;0;False;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;19;0,0;Float;False;False;-1;2;UnityEditor.Rendering.Universal.DecalShaderGraphGUI;0;14;New Amplify Shader;c2a467ab6d5391a4ea692226d82ffefd;True;ScenePickingPass;0;8;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;5;RenderPipeline=UniversalPipeline;PreviewType=Plane;DisableBatching=LODFading=DisableBatching;ShaderGraphShader=true;ShaderGraphTargetId=UniversalDecalSubTarget;True;3;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;False;0;;0;0;Standard;0;False;0 WireConnection;23;0;24;0 WireConnection;23;1;28;0 @@ -3337,4 +3126,4 @@ WireConnection;29;0;20;0 WireConnection;13;0;20;0 WireConnection;13;1;29;3 ASEEND*/ -//CHKSM=60933D375D76363F3FE77B8091D241989A311C4A \ No newline at end of file +//CHKSM=8371BDC4078B3445C901A743545BC9CD1B50EED6 \ No newline at end of file